From 0adb30b01cf825912b2e402f19040490636574ea Mon Sep 17 00:00:00 2001 From: github-actions Date: Thu, 18 May 2023 23:02:01 +0000 Subject: [PATCH] v0.6.1 --- Account.html | 4 +- Address.html | 1437 +++++++++++ Asset.html | 472 ++-- Claimant.html | 220 +- Contract.html | 685 ++++++ FeeBumpTransaction.html | 232 +- Keypair.html | 798 +++--- LiquidityPoolAsset.html | 190 +- LiquidityPoolId.html | 188 +- Memo.html | 212 +- MuxedAccount.html | 242 +- Operation.html | 569 ++++- Server.html | 2159 +---------------- SignerKey.html | 4 +- StrKey.html | 506 +++- Transaction.html | 158 +- TransactionBuilder.html | 858 ++++--- global.html | 410 ++-- index.html | 4 +- js-stellar-base_src_account.js.html | 4 +- js-stellar-base_src_address.js.html | 198 ++ js-stellar-base_src_asset.js.html | 4 +- js-stellar-base_src_claimant.js.html | 4 +- js-stellar-base_src_contract.js.html | 148 ++ ...llar-base_src_fee_bump_transaction.js.html | 12 +- ...lar-base_src_get_liquidity_pool_id.js.html | 4 +- js-stellar-base_src_keypair.js.html | 4 +- ...llar-base_src_liquidity_pool_asset.js.html | 4 +- js-stellar-base_src_liquidity_pool_id.js.html | 4 +- js-stellar-base_src_memo.js.html | 4 +- js-stellar-base_src_muxed_account.js.html | 4 +- js-stellar-base_src_network.js.html | 9 +- js-stellar-base_src_operation.js.html | 20 +- ...-base_src_operations_account_merge.js.html | 4 +- ...ar-base_src_operations_allow_trust.js.html | 4 +- ...s_begin_sponsoring_future_reserves.js.html | 4 +- ...-base_src_operations_bump_sequence.js.html | 4 +- ...r-base_src_operations_change_trust.js.html | 4 +- ...operations_claim_claimable_balance.js.html | 4 +- ...ellar-base_src_operations_clawback.js.html | 4 +- ...rations_clawback_claimable_balance.js.html | 4 +- ...base_src_operations_create_account.js.html | 4 +- ...perations_create_claimable_balance.js.html | 4 +- ...erations_create_passive_sell_offer.js.html | 4 +- ...ons_end_sponsoring_future_reserves.js.html | 4 +- ...llar-base_src_operations_inflation.js.html | 4 +- ...rc_operations_invoke_host_function.js.html | 114 + ..._operations_liquidity_pool_deposit.js.html | 4 +- ...operations_liquidity_pool_withdraw.js.html | 4 +- ...se_src_operations_manage_buy_offer.js.html | 4 +- ...ar-base_src_operations_manage_data.js.html | 4 +- ...e_src_operations_manage_sell_offer.js.html | 4 +- ...ations_path_payment_strict_receive.js.html | 4 +- ...perations_path_payment_strict_send.js.html | 4 +- ...tellar-base_src_operations_payment.js.html | 4 +- ..._src_operations_revoke_sponsorship.js.html | 4 +- ...ar-base_src_operations_set_options.js.html | 4 +- ...src_operations_set_trustline_flags.js.html | 4 +- js-stellar-base_src_signerkey.js.html | 4 +- js-stellar-base_src_signing.js.html | 4 +- js-stellar-base_src_strkey.js.html | 43 +- js-stellar-base_src_transaction.js.html | 4 +- js-stellar-base_src_transaction_base.js.html | 15 +- ...ellar-base_src_transaction_builder.js.html | 56 +- ...c_util_decode_encode_muxed_account.js.html | 4 +- lib_axios.js.html | 132 + lib_jsonrpc.js.html | 158 ++ lib_server.js.html | 888 +++++++ 68 files changed, 7195 insertions(+), 4094 deletions(-) create mode 100644 Address.html create mode 100644 Contract.html create mode 100644 js-stellar-base_src_address.js.html create mode 100644 js-stellar-base_src_contract.js.html create mode 100644 js-stellar-base_src_operations_invoke_host_function.js.html create mode 100644 lib_axios.js.html create mode 100644 lib_jsonrpc.js.html create mode 100644 lib_server.js.html diff --git a/Account.html b/Account.html index 9481ac71..866a0fc8 100644 --- a/Account.html +++ b/Account.html @@ -24,7 +24,7 @@
@@ -573,7 +573,7 @@
Returns:

- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/Address.html b/Address.html new file mode 100644 index 00000000..8a37ef6f --- /dev/null +++ b/Address.html @@ -0,0 +1,1437 @@ + + + + + + Address - Documentation + + + + + + + + + + + + + + + + + +
+ +

Address

+ + + + + + + +
+ +
+ +

+ Address +

+ +

Create a new Address object.

+

Address represents a single address in the Stellar network. An address can +represent an account or a contract.

+ + +
+ +
+
+ + +
+ + +

Constructor

+ + +

new Address(address)

+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
address + + +string + + + + +

ID of the account (ex. +GB3KJPLFUYN5VL6R3GU3EGCGVCKFDSD7BEDX42HWG5BWFKB3KQGJJRMA). If you +provide a muxed account address, this will throw; use MuxedAccount instead.

+ +
+ + + + + + + + + + + + + + + + +
+ +
+ + + + + + +

Classes

+ +
+
Address
+
+
+ + + + + + + + + +

Methods

+ + + +
+ + + +

toBuffer() → {Buffer}

+ + + + + +
+

Return the raw public key bytes for this address.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +Buffer + + +
+
+ + + +
+ + + +
+ + +
+ + + +

toScAddress() → {xdr.ScAddress}

+ + + + + +
+

Convert this Address to an xdr.ScAddress type.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +xdr.ScAddress + + +
+
+ + + +
+ + + +
+ + +
+ + + +

toScVal() → {xdr.ScVal}

+ + + + + +
+

Convert this Address to an xdr.ScVal type.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +xdr.ScVal + + +
+
+ + + +
+ + + +
+ + +
+ + + +

toString() → {string}

+ + + + + +
+

Serialize an address to string.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +string + + +
+
+ + + +
+ + + +
+ + +
+ + + +

(static) account(buffer) → {Address}

+ + + + + +
+

Creates a new account Address object from a buffer of raw bytes.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
buffer + + +Buffer + + + + +

The bytes of an address to parse.

+ +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +Address + + +
+
+ + + +
+ + + +
+ + +
+ + + +

(static) contract(buffer) → {Address}

+ + + + + +
+

Creates a new contract Address object from a buffer of raw bytes.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
buffer + + +Buffer + + + + +

The bytes of an address to parse.

+ +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +Address + + +
+
+ + + +
+ + + +
+ + +
+ + + +

(static) fromScAddress(scAddress) → {Address}

+ + + + + +
+

Convert this from an xdr.ScAddress type

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
scAddress + + +xdr.ScAddress + + + + +

The xdr.ScAddress type to parse

+ +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +Address + + +
+
+ + + +
+ + + +
+ + +
+ + + +

(static) fromScVal(scVal) → {Address}

+ + + + + +
+

Convert this from an xdr.ScVal type

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
scVal + + +xdr.ScVal + + + + +

The xdr.ScVal type to parse

+ +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +Address + + +
+
+ + + +
+ + + +
+ + +
+ + + +

(static) fromString(address) → {Address}

+ + + + + +
+

Parses a string and returns an Address object.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
address + + +string + + + + +

The address to parse. ex. GB3KJPLFUYN5VL6R3GU3EGCGVCKFDSD7BEDX42HWG5BWFKB3KQGJJRMA

+ +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +Address + + +
+
+ + + +
+ + + +
+ + + + + + +
+ +
+ + + + +
+ +
+ +
+ Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme. +
+ + + + + \ No newline at end of file diff --git a/Asset.html b/Asset.html index b422c4e7..dd79b230 100644 --- a/Asset.html +++ b/Asset.html @@ -24,7 +24,7 @@
@@ -245,19 +245,14 @@

Methods

-

(static) compare(assetA, assetB) → {number}

+

_toXDRObject(xdrAsset) → {xdr.Asset|xdr.ChangeTrustAsset|xdr.TrustLineAsset}

-

Compares two assets according to the criteria:

-
    -
  1. First compare the type (native < alphanum4 < alphanum12).
  2. -
  3. If the types are equal, compare the assets codes.
  4. -
  5. If the asset codes are equal, compare the issuers.
  6. -
+

Returns the xdr object for this asset.

@@ -293,7 +288,7 @@

(static) comp
Source:
@@ -337,39 +332,16 @@

Parameters:
- assetA + xdrAsset -Asset - - - - - - - - - - -

the first asset

- - - - - - - - - assetB - +xdr.Asset +| - - - -Asset +xdr.ChangeTrustAsset @@ -380,7 +352,7 @@
Parameters:
-

the second asset

+

The asset xdr object.

@@ -413,7 +385,13 @@
Returns:
-number +xdr.Asset +| + +xdr.ChangeTrustAsset +| + +xdr.TrustLineAsset
@@ -421,7 +399,7 @@
Returns:
-

-1 if assetA < assetB, 0 if assetA == assetB, 1 if assetA > assetB.

+

XDR Asset object

@@ -436,16 +414,12 @@
Returns:
-

(static) fromOperation(assetXdr) → {Asset}

+

equals(asset) → {boolean}

-
-

Returns an asset object from its XDR object representation.

-
- @@ -479,7 +453,7 @@

(static) Source:
@@ -523,13 +497,13 @@
Parameters:
- assetXdr + asset -xdr.Asset +Asset @@ -540,7 +514,7 @@
Parameters:
-

The asset xdr object.

+

Asset to compare

@@ -573,13 +547,17 @@
Returns:
-Asset +boolean
+
+

true if this asset equals the given asset.

+
+

@@ -592,16 +570,12 @@
Returns:
-

(static) native() → {Asset}

+

getAssetType() → {string}

-
-

Returns an asset object for the native asset.

-
- @@ -635,13 +609,20 @@

(static) nativ
Source:
+
See:
+
+ +
+ @@ -677,13 +658,23 @@

Returns:
-Asset +string
+
+

Asset type. Can be one of following types:

+
    +
  • native,
  • +
  • credit_alphanum4,
  • +
  • credit_alphanum12, or
  • +
  • unknown as the error case (which should never occur)
  • +
+
+
@@ -696,16 +687,12 @@
Returns:
-

_toXDRObject(xdrAsset) → {xdr.Asset|xdr.ChangeTrustAsset|xdr.TrustLineAsset}

+

getCode() → {string}

-
-

Returns the xdr object for this asset.

-
- @@ -739,7 +726,7 @@

_toXDRObj
Source:
@@ -758,61 +745,6 @@

_toXDRObj -

Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
xdrAsset - - -xdr.Asset -| - -xdr.ChangeTrustAsset - - - - -

The asset xdr object.

- -
- - @@ -836,13 +768,7 @@
Returns:
-xdr.Asset -| - -xdr.ChangeTrustAsset -| - -xdr.TrustLineAsset +string
@@ -850,7 +776,7 @@
Returns:
-

XDR Asset object

+

Asset code

@@ -865,7 +791,7 @@
Returns:
-

equals(asset) → {boolean}

+

getIssuer() → {string}

@@ -904,7 +830,7 @@

equalsSource:
@@ -923,58 +849,6 @@

equalsParameters:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
asset - - -Asset - - - - -

Asset to compare

- -
- - @@ -998,7 +872,7 @@
Returns:
-boolean +string
@@ -1006,7 +880,7 @@
Returns:
-

true if this asset equals the given asset.

+

Asset issuer

@@ -1021,7 +895,7 @@
Returns:
-

getAssetType() → {string}

+

getRawAssetType() → {xdr.AssetType}

@@ -1060,20 +934,13 @@

getAssetT
Source:
-
See:
-
- -
- @@ -1109,7 +976,7 @@

Returns:
-string +xdr.AssetType
@@ -1117,13 +984,7 @@
Returns:
-

Asset type. Can be one of following types:

-
    -
  • native,
  • -
  • credit_alphanum4,
  • -
  • credit_alphanum12, or
  • -
  • unknown as the error case (which should never occur)
  • -
+

the raw XDR representation of the asset type

@@ -1138,7 +999,7 @@
Returns:
-

getCode() → {string}

+

isNative() → {boolean}

@@ -1177,7 +1038,7 @@

getCodeSource:
@@ -1219,7 +1080,7 @@
Returns:
-string +boolean
@@ -1227,7 +1088,7 @@
Returns:
-

Asset code

+

true if this asset object is the native asset.

@@ -1242,12 +1103,16 @@
Returns:
-

getIssuer() → {string}

+

toChangeTrustXDRObject() → {xdr.ChangeTrustAsset}

+
+

Returns the xdr.ChangeTrustAsset object for this asset.

+
+ @@ -1281,7 +1146,7 @@

getIssuerSource:
@@ -1323,7 +1188,7 @@
Returns:
-string +xdr.ChangeTrustAsset
@@ -1331,7 +1196,7 @@
Returns:
-

Asset issuer

+

XDR asset object

@@ -1346,12 +1211,16 @@
Returns:
-

getRawAssetType() → {xdr.AssetType}

+

toTrustLineXDRObject() → {xdr.TrustLineAsset}

+
+

Returns the xdr.TrustLineAsset object for this asset.

+
+ @@ -1385,7 +1254,7 @@

getRaw
Source:
@@ -1427,7 +1296,7 @@

Returns:
-xdr.AssetType +xdr.TrustLineAsset
@@ -1435,7 +1304,7 @@
Returns:
-

the raw XDR representation of the asset type

+

XDR asset object

@@ -1450,12 +1319,16 @@
Returns:
-

isNative() → {boolean}

+

toXDRObject() → {xdr.Asset}

+
+

Returns the xdr.Asset object for this asset.

+
+ @@ -1489,7 +1362,7 @@

isNativeSource:
@@ -1531,7 +1404,7 @@
Returns:
-boolean +xdr.Asset
@@ -1539,7 +1412,7 @@
Returns:
-

true if this asset object is the native asset.

+

XDR asset object

@@ -1554,14 +1427,19 @@
Returns:
-

toChangeTrustXDRObject() → {xdr.ChangeTrustAsset}

+

(static) compare(assetA, assetB) → {number}

-

Returns the xdr.ChangeTrustAsset object for this asset.

+

Compares two assets according to the criteria:

+
    +
  1. First compare the type (native < alphanum4 < alphanum12).
  2. +
  3. If the types are equal, compare the assets codes.
  4. +
  5. If the asset codes are equal, compare the issuers.
  6. +
@@ -1597,7 +1475,7 @@

Source:
@@ -1616,6 +1494,84 @@

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
assetA + + +Asset + + + + +

the first asset

+ +
assetB + + +Asset + + + + +

the second asset

+ +
+ + @@ -1639,7 +1595,7 @@
Returns:
-xdr.ChangeTrustAsset +number
@@ -1647,7 +1603,7 @@
Returns:
-

XDR asset object

+

-1 if assetA < assetB, 0 if assetA == assetB, 1 if assetA > assetB.

@@ -1662,14 +1618,14 @@
Returns:
-

toTrustLineXDRObject() → {xdr.TrustLineAsset}

+

(static) fromOperation(assetXdr) → {Asset}

-

Returns the xdr.TrustLineAsset object for this asset.

+

Returns an asset object from its XDR object representation.

@@ -1705,7 +1661,7 @@

t
Source:
@@ -1724,6 +1680,58 @@

t +

Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
assetXdr + + +xdr.Asset + + + + +

The asset xdr object.

+ +
+ + @@ -1747,17 +1755,13 @@
Returns:
-xdr.TrustLineAsset +Asset
-
-

XDR asset object

-
- @@ -1770,14 +1774,14 @@
Returns:
-

toXDRObject() → {xdr.Asset}

+

(static) native() → {Asset}

-

Returns the xdr.Asset object for this asset.

+

Returns an asset object for the native asset.

@@ -1813,7 +1817,7 @@

toXDRObjec
Source:
@@ -1855,17 +1859,13 @@

Returns:
-xdr.Asset +Asset
-
-

XDR asset object

-
- @@ -1890,7 +1890,7 @@
Returns:

- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/Claimant.html b/Claimant.html index b477714c..0cf34fa3 100644 --- a/Claimant.html +++ b/Claimant.html @@ -24,7 +24,7 @@
@@ -403,6 +403,114 @@

Methods

+
+ + + +

toXDRObject() → {xdr.Claimant}

+ + + + + +
+

Returns the xdr object for this claimant.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +xdr.Claimant + + +
+
+ + +
+

XDR Claimant object

+
+ + +
+ + + +
+ +
@@ -1500,114 +1608,6 @@
Returns:
- -
- - - -

toXDRObject() → {xdr.Claimant}

- - - - - -
-

Returns the xdr object for this claimant.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -xdr.Claimant - - -
-
- - -
-

XDR Claimant object

-
- - -
- - - -
- @@ -1625,7 +1625,7 @@
Returns:

- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/Contract.html b/Contract.html new file mode 100644 index 00000000..808ee632 --- /dev/null +++ b/Contract.html @@ -0,0 +1,685 @@ + + + + + + Contract - Documentation + + + + + + + + + + + + + + + + + +
+ +

Contract

+ + + + + + + +
+ +
+ +

+ Contract +

+ +

Create a new Contract object.

+

Contract represents a single contract in the Stellar network, embodying the +interface of the contract. See +Contracts +for more information about how contracts work in Stellar.

+ + +
+ +
+
+ + +
+ + +

Constructor

+ + +

new Contract(contractId)

+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
contractId + + +string + + + + +

ID of the contract (ex. +000000000000000000000000000000000000000000000000000000000000000001).

+ +
+ + + + + + + + + + + + + + + + +
+ +
+ + + + + + +

Classes

+ +
+
Contract
+
+
+ + + + + + + + + +

Methods

+ + + +
+ + + +

call(method, …params) → {xdr.Operation}

+ + + + + +
+

Returns an operation that will invoke this contract call.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
To Do:
+
+
    +
  • Allow easily building `Operation`s that invoke multiple contract +calls at once via this abstraction layer. For example, something like + +```js +let [ a, b ] = [someId1, someId2].map(id => { new Contract(id) }); + +let combinedOp = Operation.invokeHostFunctions({ + source: undefined, // optional + functions: [ + a.partialCall("hello"), + a.partialCall("transfer", ...), + b.partialCall("increment"), + ] +}); +```
  • +
+
+ +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
method + + +string + + + + + + + + + + +

name of the method to call

+ +
params + + +xdr.ScVal + + + + + + + + + + <repeatable>
+ +
+

arguments to pass to the function call

+ +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +xdr.Operation + + +
+
+ + +
+

Build a InvokeHostFunctionOp operation to call the +contract.

+
+ + +
+ + + +
+ + +
+ + + +

contractId() → {string}

+ + + + + +
+

Returns Stellar contract ID as a hex string, ex. +000000000000000000000000000000000000000000000000000000000000000001.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +string + + +
+
+ + + +
+ + + +
+ + +
+ + + +

getFootprint() → {xdr.LedgerKey}

+ + + + + +
+

Returns the read-only footprint entry necessary for any invocations to this +contract, for convenience when adding it to your transaction's overall +footprint.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +xdr.LedgerKey + + +
+
+ + +
+

the contract's executable data ledger key

+
+ + +
+ + + +
+ + + + + + +
+ +
+ + + + +
+ +
+ +
+ Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme. +
+ + + + + \ No newline at end of file diff --git a/FeeBumpTransaction.html b/FeeBumpTransaction.html index 3dc5bab2..6f645ba6 100644 --- a/FeeBumpTransaction.html +++ b/FeeBumpTransaction.html @@ -24,7 +24,7 @@
@@ -371,7 +371,7 @@

(readonly) f
Source:
@@ -543,6 +543,76 @@

Type:
+
+ + + +
+

(readonly) operations :Array.<Operation>

+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + +
Type:
+ + + + + +
@@ -680,7 +750,7 @@

Source:
@@ -868,7 +938,7 @@

addSignat
Source:
@@ -1070,7 +1140,7 @@

ge
Source:
@@ -1235,7 +1305,7 @@

hashSource:
@@ -1469,18 +1539,14 @@
Returns:
-

signatureBase() → {Buffer}

+

signHashX(preimage) → {void}

-

Returns the "signature base" of this transaction, which is the value -that, when hashed, should be signed to create a signature that -validators on the Stellar Network will accept.

-

It is composed of a 4 prefix bytes followed by the xdr-encoded form -of this transaction.

+

Add hashX signer preimage as signature.

@@ -1496,6 +1562,11 @@

signatur +
Overrides:
+
+ @@ -1516,7 +1587,7 @@

signatur
Source:
@@ -1535,6 +1606,61 @@

signatur +

Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
preimage + + +Buffer +| + +String + + + + +

Preimage of hash used as signer

+ +
+ + @@ -1558,7 +1684,7 @@
Returns:
-Buffer +void
@@ -1577,14 +1703,18 @@
Returns:
-

signHashX(preimage) → {void}

+

signatureBase() → {Buffer}

-

Add hashX signer preimage as signature.

+

Returns the "signature base" of this transaction, which is the value +that, when hashed, should be signed to create a signature that +validators on the Stellar Network will accept.

+

It is composed of a 4 prefix bytes followed by the xdr-encoded form +of this transaction.

@@ -1600,11 +1730,6 @@

signHashXOverrides: -
- @@ -1625,7 +1750,7 @@

signHashXSource:
@@ -1644,61 +1769,6 @@

signHashXParameters:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
preimage - - -Buffer -| - -String - - - - -

Preimage of hash used as signer

- -
- - @@ -1722,7 +1792,7 @@
Returns:
-void +Buffer
@@ -1784,7 +1854,7 @@

toEnvelope<
Source:
@@ -1893,7 +1963,7 @@

toXDRSource:
@@ -1970,7 +2040,7 @@
Returns:

- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/Keypair.html b/Keypair.html index 8a1d6ce3..21612beb 100644 --- a/Keypair.html +++ b/Keypair.html @@ -24,7 +24,7 @@
@@ -357,14 +357,14 @@

Methods

-

(static) fromPublicKey(publicKey) → {Keypair}

+

canSign() → {boolean}

-

Creates a new Keypair object from public key.

+

Returns true if this Keypair object contains secret key and can sign.

@@ -400,7 +400,7 @@

(static) Source:
@@ -419,58 +419,6 @@

(static) Parameters:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
publicKey - - -string - - - - -

public key (ex. GB3KJPLFUYN5VL6R3GU3EGCGVCKFDSD7BEDX42HWG5BWFKB3KQGJJRMA)

- -
- - @@ -494,7 +442,7 @@
Returns:
-Keypair +boolean
@@ -513,14 +461,14 @@
Returns:
-

(static) fromRawEd25519Seed(rawSeed) → {Keypair}

+

publicKey() → {string}

-

Creates a new Keypair object from ed25519 secret key seed raw bytes.

+

Returns public key associated with this Keypair object.

@@ -556,7 +504,7 @@

(static)
Source:
@@ -575,58 +523,6 @@

(static) -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
rawSeed - - -Buffer - - - - -

Raw 32-byte ed25519 secret key seed

- -
- - @@ -650,7 +546,7 @@
Returns:
-Keypair +string
@@ -669,15 +565,14 @@
Returns:
-

(static) fromSecret(secret) → {Keypair}

+

rawPublicKey() → {Buffer}

-

Creates a new Keypair instance from secret. This can either be secret key or secret seed depending -on underlying public-key signature system. Currently Keypair only supports ed25519.

+

Returns raw public key

@@ -713,7 +608,7 @@

(static) f
Source:
@@ -732,58 +627,6 @@

(static) f -

Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
secret - - -string - - - - -

secret key (ex. SDAKFNYEIAORZKKCYRILFQKLLOCNPL5SWJ3YY5NM3ZH6GJSZGXHZEPQS)

- -
- - @@ -807,7 +650,7 @@
Returns:
-Keypair +Buffer
@@ -826,14 +669,14 @@
Returns:
-

(static) master(networkPassphrase) → {Keypair}

+

rawSecretKey() → {Buffer}

-

Returns Keypair object representing network master key.

+

Returns raw secret key.

@@ -869,7 +712,7 @@

(static) maste
Source:
@@ -888,58 +731,6 @@

(static) maste -

Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
networkPassphrase - - -string - - - - -

passphrase of the target stellar network (e.g. "Public Global Stellar Network ; September 2015").

- -
- - @@ -963,7 +754,7 @@
Returns:
-Keypair +Buffer
@@ -982,14 +773,14 @@
Returns:
-

(static) random() → {Keypair}

+

secret() → {string}

-

Create a random Keypair object.

+

Returns secret key associated with this Keypair object

@@ -1025,7 +816,7 @@

(static) rando
Source:
@@ -1067,7 +858,7 @@

Returns:
-Keypair +string
@@ -1086,14 +877,14 @@
Returns:
-

canSign() → {boolean}

+

sign(data) → {Buffer}

-

Returns true if this Keypair object contains secret key and can sign.

+

Signs data.

@@ -1129,7 +920,7 @@

canSignSource:
@@ -1148,6 +939,59 @@

canSignParameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + +Buffer + + + + +

Data to sign

+ +
+ + + @@ -1159,7 +1003,6 @@

canSign
Returns:
@@ -1171,7 +1014,7 @@
Returns:
-boolean +Buffer
@@ -1190,14 +1033,14 @@
Returns:
-

publicKey() → {string}

+

signDecorated(data) → {xdr.DecoratedSignature}

-

Returns public key associated with this Keypair object.

+

Returns the decorated signature (hint+sig) for arbitrary data.

@@ -1233,13 +1076,20 @@

publicKeySource:
+
See:
+
+
    +
  • TransactionBase.addDecoratedSignature
  • +
+
+ @@ -1252,6 +1102,58 @@

publicKeyParameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + +Buffer + + + + +

arbitrary data to sign

+ +
+ + @@ -1275,13 +1177,18 @@
Returns:
-string +xdr.DecoratedSignature
+
+

the raw signature structure which can be +added directly to a transaction envelope

+
+

@@ -1294,14 +1201,16 @@
Returns:
-

rawPublicKey() → {Buffer}

+

signPayloadDecorated(data) → {xdr.DecoratedSignature}

-

Returns raw public key

+

Returns the raw decorated signature (hint+sig) for a signed payload signer.

+

The hint is defined as the last 4 bytes of the signer key XORed with last +4 bytes of the payload (zero-left-padded if necessary).

@@ -1337,13 +1246,22 @@

rawPublic
Source:
+
See:
+
+ +
+ @@ -1356,6 +1274,58 @@

rawPublic +

Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + +Buffer + + + + +

data to both sign and treat as the payload

+ +
+ + @@ -1379,7 +1349,7 @@
Returns:
-Buffer +xdr.DecoratedSignature
@@ -1398,14 +1368,14 @@
Returns:
-

rawSecretKey() → {Buffer}

+

verify(data, signature) → {boolean}

-

Returns raw secret key.

+

Verifies if signature for data is valid.

@@ -1441,7 +1411,7 @@

rawSecret
Source:
@@ -1460,6 +1430,84 @@

rawSecret +

Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + +Buffer + + + + +

Signed data

+ +
signature + + +Buffer + + + + +

Signature

+ +
+ + @@ -1483,7 +1531,7 @@
Returns:
-Buffer +boolean
@@ -1502,14 +1550,16 @@
Returns:
-

secret() → {string}

+

xdrMuxedAccount(idopt) → {xdr.MuxedAccount}

-

Returns secret key associated with this Keypair object

+

Creates a xdr.MuxedAccount object from the public key.

+

You will get a different type of muxed account depending on whether or not +you pass an ID.

@@ -1545,7 +1595,7 @@

secretSource:
@@ -1564,6 +1614,71 @@

secretParameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
id + + +string + + + + + + <optional>
+ + + + + +
+

stringified integer indicating the underlying muxed +ID of the new account object

+ +
+ + @@ -1587,7 +1702,7 @@
Returns:
-string +xdr.MuxedAccount
@@ -1606,14 +1721,14 @@
Returns:
-

sign(data) → {Buffer}

+

(static) fromPublicKey(publicKey) → {Keypair}

-

Signs data.

+

Creates a new Keypair object from public key.

@@ -1649,7 +1764,7 @@

signSource:
@@ -1693,13 +1808,13 @@
Parameters:
- data + publicKey -Buffer +string @@ -1710,7 +1825,7 @@
Parameters:
-

Data to sign

+

public key (ex. GB3KJPLFUYN5VL6R3GU3EGCGVCKFDSD7BEDX42HWG5BWFKB3KQGJJRMA)

@@ -1743,7 +1858,7 @@
Returns:
-Buffer +Keypair
@@ -1762,14 +1877,14 @@
Returns:
-

signDecorated(data) → {xdr.DecoratedSignature}

+

(static) fromRawEd25519Seed(rawSeed) → {Keypair}

-

Returns the decorated signature (hint+sig) for arbitrary data.

+

Creates a new Keypair object from ed25519 secret key seed raw bytes.

@@ -1805,20 +1920,13 @@

signDeco
Source:
-
See:
-
-
    -
  • TransactionBase.addDecoratedSignature
  • -
-
- @@ -1856,7 +1964,7 @@

Parameters:
- data + rawSeed @@ -1873,7 +1981,7 @@
Parameters:
-

arbitrary data to sign

+

Raw 32-byte ed25519 secret key seed

@@ -1906,18 +2014,13 @@
Returns:
-xdr.DecoratedSignature +Keypair
-
-

the raw signature structure which can be -added directly to a transaction envelope

-
-

@@ -1930,16 +2033,15 @@
Returns:
-

signPayloadDecorated(data) → {xdr.DecoratedSignature}

+

(static) fromSecret(secret) → {Keypair}

-

Returns the raw decorated signature (hint+sig) for a signed payload signer.

-

The hint is defined as the last 4 bytes of the signer key XORed with last -4 bytes of the payload (zero-left-padded if necessary).

+

Creates a new Keypair instance from secret. This can either be secret key or secret seed depending +on underlying public-key signature system. Currently Keypair only supports ed25519.

@@ -1975,22 +2077,13 @@

s
Source:
-
See:
-
- -
- @@ -2028,13 +2121,13 @@

Parameters:
- data + secret -Buffer +string @@ -2045,7 +2138,7 @@
Parameters:
-

data to both sign and treat as the payload

+

secret key (ex. SDAKFNYEIAORZKKCYRILFQKLLOCNPL5SWJ3YY5NM3ZH6GJSZGXHZEPQS)

@@ -2078,7 +2171,7 @@
Returns:
-xdr.DecoratedSignature +Keypair
@@ -2097,14 +2190,14 @@
Returns:
-

verify(data, signature) → {boolean}

+

(static) master(networkPassphrase) → {Keypair}

-

Verifies if signature for data is valid.

+

Returns Keypair object representing network master key.

@@ -2140,7 +2233,7 @@

verifySource:
@@ -2184,39 +2277,13 @@
Parameters:
- data - - - - - -Buffer - - - - - - - - - - -

Signed data

- - - - - - - - - signature + networkPassphrase -Buffer +string @@ -2227,7 +2294,7 @@
Parameters:
-

Signature

+

passphrase of the target stellar network (e.g. "Public Global Stellar Network ; September 2015").

@@ -2260,7 +2327,7 @@
Returns:
-boolean +Keypair
@@ -2279,16 +2346,14 @@
Returns:
-

xdrMuxedAccount(idopt) → {xdr.MuxedAccount}

+

(static) random() → {Keypair}

-

Creates a xdr.MuxedAccount object from the public key.

-

You will get a different type of muxed account depending on whether or not -you pass an ID.

+

Create a random Keypair object.

@@ -2324,7 +2389,7 @@

xdrMux
Source:
@@ -2343,71 +2408,6 @@

xdrMux -

Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
id - - -string - - - - - - <optional>
- - - - - -
-

stringified integer indicating the underlying muxed -ID of the new account object

- -
- - @@ -2431,7 +2431,7 @@
Returns:
-xdr.MuxedAccount +Keypair
@@ -2462,7 +2462,7 @@
Returns:

- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/LiquidityPoolAsset.html b/LiquidityPoolAsset.html index 94f2c869..4083815f 100644 --- a/LiquidityPoolAsset.html +++ b/LiquidityPoolAsset.html @@ -24,7 +24,7 @@
@@ -268,17 +268,12 @@

Methods

-

(static) fromOperation(ctAssetXdr) → {LiquidityPoolAsset}

+

equals(other) → {boolean}

-
-

Returns a liquidity pool asset object from its XDR ChangeTrustAsset object -representation.

-
- @@ -312,7 +307,7 @@

(static) Source:
@@ -356,13 +351,13 @@
Parameters:
- ctAssetXdr + other -xdr.ChangeTrustAsset +LiquidityPoolAsset @@ -373,7 +368,7 @@
Parameters:
-

The asset XDR object.

+

the LiquidityPoolAsset to compare

@@ -406,13 +401,17 @@
Returns:
-LiquidityPoolAsset +boolean
+
+

true if this asset equals the given asset.

+
+

@@ -425,7 +424,7 @@
Returns:
-

equals(other) → {boolean}

+

getAssetType() → {AssetType.liquidityPoolShares}

@@ -464,75 +463,30 @@

equalsSource:
- +
See:
+
+ +
- - - - - - - - - -
Parameters:
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
other - - -LiquidityPoolAsset - - -

the LiquidityPoolAsset to compare

- -
@@ -558,7 +512,7 @@
Returns:
-boolean +AssetType.liquidityPoolShares
@@ -566,7 +520,7 @@
Returns:
-

true if this asset equals the given asset.

+

asset type. Can only be liquidity_pool_shares.

@@ -581,7 +535,7 @@
Returns:
-

getAssetType() → {AssetType.liquidityPoolShares}

+

getLiquidityPoolParameters() → {LiquidityPoolParameters}

@@ -620,20 +574,13 @@

getAssetT
Source:
-
See:
-
- -
- @@ -669,7 +616,7 @@

Returns:
-AssetType.liquidityPoolShares +LiquidityPoolParameters
@@ -677,7 +624,7 @@
Returns:
-

asset type. Can only be liquidity_pool_shares.

+

Liquidity pool parameters.

@@ -692,12 +639,19 @@
Returns:
-

getLiquidityPoolParameters() → {LiquidityPoolParameters}

+

toXDRObject() → {xdr.ChangeTrustAsset}

+
+

Returns the xdr.ChangeTrustAsset object for this liquidity pool asset.

+

Note: To convert from an Asset to xdr.ChangeTrustAsset +please refer to the +Asset.toChangeTrustXDRObject method.

+
+ @@ -731,7 +685,7 @@

Source:
@@ -773,7 +727,7 @@
Returns:
-LiquidityPoolParameters +xdr.ChangeTrustAsset
@@ -781,7 +735,7 @@
Returns:
-

Liquidity pool parameters.

+

XDR ChangeTrustAsset object.

@@ -796,17 +750,15 @@
Returns:
-

toXDRObject() → {xdr.ChangeTrustAsset}

+

(static) fromOperation(ctAssetXdr) → {LiquidityPoolAsset}

-

Returns the xdr.ChangeTrustAsset object for this liquidity pool asset.

-

Note: To convert from an Asset to xdr.ChangeTrustAsset -please refer to the -Asset.toChangeTrustXDRObject method.

+

Returns a liquidity pool asset object from its XDR ChangeTrustAsset object +representation.

@@ -842,7 +794,7 @@

toXDRObjec
Source:
@@ -861,6 +813,58 @@

toXDRObjec +

Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
ctAssetXdr + + +xdr.ChangeTrustAsset + + + + +

The asset XDR object.

+ +
+ + @@ -884,17 +888,13 @@
Returns:
-xdr.ChangeTrustAsset +LiquidityPoolAsset
-
-

XDR ChangeTrustAsset object.

-
- @@ -919,7 +919,7 @@
Returns:

- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/LiquidityPoolId.html b/LiquidityPoolId.html index b44ee47d..8866b321 100644 --- a/LiquidityPoolId.html +++ b/LiquidityPoolId.html @@ -24,7 +24,7 @@
@@ -217,16 +217,12 @@

Methods

-

(static) fromOperation(tlAssetXdr) → {LiquidityPoolId}

+

equals(asset) → {boolean}

-
-

Returns a liquidity pool ID object from its xdr.TrustLineAsset representation.

-
- @@ -260,7 +256,7 @@

(static) Source:
@@ -304,13 +300,13 @@
Parameters:
- tlAssetXdr + asset -xdr.TrustLineAsset +LiquidityPoolId @@ -321,7 +317,7 @@
Parameters:
-

The asset XDR object.

+

LiquidityPoolId to compare.

@@ -354,13 +350,17 @@
Returns:
-LiquidityPoolId +boolean
+
+

true if this asset equals the given asset.

+
+

@@ -373,7 +373,7 @@
Returns:
-

equals(asset) → {boolean}

+

getAssetType() → {AssetType.liquidityPoolShares}

@@ -412,75 +412,30 @@

equalsSource:
- - - - - - - - - - - - -
Parameters:
+
See:
+
+ +
- - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - -
NameTypeDescription
asset - - -LiquidityPoolId - - -

LiquidityPoolId to compare.

- -
@@ -506,7 +461,7 @@
Returns:
-boolean +AssetType.liquidityPoolShares
@@ -514,7 +469,7 @@
Returns:
-

true if this asset equals the given asset.

+

asset type. Can only be liquidity_pool_shares.

@@ -529,7 +484,7 @@
Returns:
-

getAssetType() → {AssetType.liquidityPoolShares}

+

getLiquidityPoolId() → {string}

@@ -568,20 +523,13 @@

getAssetT
Source:
-
See:
-
- -
- @@ -617,7 +565,7 @@

Returns:
-AssetType.liquidityPoolShares +string
@@ -625,7 +573,7 @@
Returns:
-

asset type. Can only be liquidity_pool_shares.

+

Liquidity pool ID.

@@ -640,12 +588,19 @@
Returns:
-

getLiquidityPoolId() → {string}

+

toXDRObject() → {xdr.TrustLineAsset}

+
+

Returns the xdr.TrustLineAsset object for this liquidity pool ID.

+

Note: To convert from Asset to xdr.TrustLineAsset please +refer to the +Asset.toTrustLineXDRObject method.

+
+ @@ -679,7 +634,7 @@

get
Source:
@@ -721,7 +676,7 @@

Returns:
-string +xdr.TrustLineAsset
@@ -729,7 +684,7 @@
Returns:
-

Liquidity pool ID.

+

XDR LiquidityPoolId object

@@ -744,17 +699,14 @@
Returns:
-

toXDRObject() → {xdr.TrustLineAsset}

+

(static) fromOperation(tlAssetXdr) → {LiquidityPoolId}

-

Returns the xdr.TrustLineAsset object for this liquidity pool ID.

-

Note: To convert from Asset to xdr.TrustLineAsset please -refer to the -Asset.toTrustLineXDRObject method.

+

Returns a liquidity pool ID object from its xdr.TrustLineAsset representation.

@@ -790,7 +742,7 @@

toXDRObjec
Source:
@@ -809,6 +761,58 @@

toXDRObjec +

Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
tlAssetXdr + + +xdr.TrustLineAsset + + + + +

The asset XDR object.

+ +
+ + @@ -832,17 +836,13 @@
Returns:
-xdr.TrustLineAsset +LiquidityPoolId
-
-

XDR LiquidityPoolId object

-
- @@ -867,7 +867,7 @@
Returns:

- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/Memo.html b/Memo.html index 7c2f85dc..2fac55ae 100644 --- a/Memo.html +++ b/Memo.html @@ -24,7 +24,7 @@
@@ -376,6 +376,110 @@

Methods

+
+ + + +

toXDRObject() → {xdr.Memo}

+ + + + + +
+

Returns XDR memo object.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +xdr.Memo + + +
+
+ + + +
+ + + +
+ +
@@ -1265,110 +1369,6 @@
Returns:
- -
- - - -

toXDRObject() → {xdr.Memo}

- - - - - -
-

Returns XDR memo object.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -xdr.Memo - - -
-
- - - -
- - - -
- @@ -1386,7 +1386,7 @@
Returns:

- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/MuxedAccount.html b/MuxedAccount.html index 4bc2d1f4..a20234b5 100644 --- a/MuxedAccount.html +++ b/MuxedAccount.html @@ -24,7 +24,7 @@
@@ -263,16 +263,12 @@

Methods

-

(static) fromAddress(mAddress, sequenceNum) → {MuxedAccount}

+

accountId() → {string}

-
-

Parses an M-address into a MuxedAccount object.

-
- @@ -306,7 +302,7 @@

(static)
Source:
@@ -325,86 +321,6 @@

(static) -

Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
mAddress - - -string - - - - -

an M-address to transform

- -
sequenceNum - - -string - - - - -

the sequence number of the underlying Account, to use for the underlying base account (@link -MuxedAccount.baseAccount). If you're using the SDK, you can use -server.loadAccount to fetch this if you don't know it.

- -
- - @@ -428,13 +344,17 @@
Returns:
-MuxedAccount +string
+
+

the M-address representing this account's (G-address, ID)

+
+
@@ -447,7 +367,7 @@
Returns:
-

accountId() → {string}

+

baseAccount() → {Account}

@@ -486,7 +406,7 @@

accountIdSource:
@@ -528,7 +448,7 @@
Returns:
-string +Account
@@ -536,7 +456,8 @@
Returns:
-

the M-address representing this account's (G-address, ID)

+

the underlying account object shared among all muxed +accounts with this Stellar address

@@ -551,12 +472,16 @@
Returns:
-

baseAccount() → {Account}

+

incrementSequenceNumber() → {void}

+
+

Increments the underlying account's sequence number by one.

+
+ @@ -590,7 +515,7 @@

baseAccoun
Source:
@@ -632,18 +557,13 @@

Returns:
-Account +void
-
-

the underlying account object shared among all muxed -accounts with this Stellar address

-
-

@@ -656,14 +576,14 @@
Returns:
-

incrementSequenceNumber() → {void}

+

sequenceNumber() → {string}

-

Increments the underlying account's sequence number by one.

+

Accesses the underlying account's sequence number.

@@ -699,7 +619,7 @@

Source:
@@ -741,13 +661,17 @@
Returns:
-void +string
+
+

strigified sequence number for the underlying account

+
+ @@ -760,16 +684,12 @@
Returns:
-

sequenceNumber() → {string}

+

toXDRObject() → {xdr.MuxedAccount}

-
-

Accesses the underlying account's sequence number.

-
- @@ -803,7 +723,7 @@

sequenc
Source:
@@ -845,7 +765,7 @@

Returns:
-string +xdr.MuxedAccount
@@ -853,7 +773,8 @@
Returns:
-

strigified sequence number for the underlying account

+

the XDR object representing this muxed account's +G-address and uint64 ID

@@ -868,12 +789,16 @@
Returns:
-

toXDRObject() → {xdr.MuxedAccount}

+

(static) fromAddress(mAddress, sequenceNum) → {MuxedAccount}

+
+

Parses an M-address into a MuxedAccount object.

+
+ @@ -907,7 +832,7 @@

toXDRObjec
Source:
@@ -926,6 +851,86 @@

toXDRObjec +

Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mAddress + + +string + + + + +

an M-address to transform

+ +
sequenceNum + + +string + + + + +

the sequence number of the underlying Account, to use for the underlying base account (@link +MuxedAccount.baseAccount). If you're using the SDK, you can use +server.loadAccount to fetch this if you don't know it.

+ +
+ + @@ -949,18 +954,13 @@
Returns:
-xdr.MuxedAccount +MuxedAccount
-
-

the XDR object representing this muxed account's -G-address and uint64 ID

-
- @@ -985,7 +985,7 @@
Returns:

- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/Operation.html b/Operation.html index 5376c764..f020be07 100644 --- a/Operation.html +++ b/Operation.html @@ -24,7 +24,7 @@
@@ -63,8 +63,10 @@

new Operatio
-

Operation class represents operations in Stellar network. -Use one of static methods to create operations:

+

Operation class represents +operations in +Stellar network.

+

Use one of static methods to create operations:

@@ -3853,7 +3857,7 @@

(static) Source:
@@ -4194,6 +4198,561 @@
Returns:
+

+ + +
+ + + +

(static) invokeHostFunction(opts) → {xdr.Operation}

+ + + + + +
+

Invokes a single smart contract function.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
opts + + +object + + + + +

options object

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
args + + +xdr.HostFunctionArgs + + + + + + + + + + +

parameters to pass to the host +function being invoked

+ +
auth + + +Array.<xdr.ContractAuth> + + + + + + <optional>
+ + + + + +
+

list of authorizations for the call

+ +
source + + +string + + + + + + <optional>
+ + + + + +
+

an optional source account

+ +
+ + +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +xdr.Operation + + +
+
+ + +
+

an Invoke Host Function operation +(xdr.InvokeHostFunctionOp)

+
+ + +
+ + + +
+ + +
+ + + +

(static) invokeHostFunctions(opts) → {xdr.Operation}

+ + + + + +
+

Invokes multiple smart contract functions via a single operation.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
opts + + +object + + + + +

options for the operation

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
functions + + +Array.<xdr.HostFunction> + + + + + + + + + + +

a list of contract functions to +invoke in this operation.

+ +
source + + +string + + + + + + <optional>
+ + + + + +
+

an optional source account

+ +
+ + +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +xdr.Operation + + +
+
+ + +
+

an Invoke Host Function operation +(xdr.InvokeHostFunctionOp) with xdr.HostFunction instances corresponding +to each invocation

+
+ + +
+ + +
@@ -11116,7 +11675,7 @@
Returns:

- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/Server.html b/Server.html index 843f9250..2ffffffc 100644 --- a/Server.html +++ b/Server.html @@ -24,7 +24,7 @@
@@ -45,9 +45,6 @@

Server

-

Server handles the network connection to a Soroban-RPC -instance and exposes an interface for requests to that instance.

- @@ -58,8 +55,6 @@

-

Constructor

-

new Server(serverURL, optsopt)

@@ -67,6 +62,11 @@

new Server +

Server handles the network connection to a Soroban-RPC +instance and exposes an interface for requests to that instance.

+

+ @@ -100,7 +100,7 @@

new ServerSource:
@@ -375,13 +375,6 @@
Parameters:
-

Classes

- -
-
Server
-
-
- @@ -390,2142 +383,6 @@

Classes

-

Methods

- - - -
- - - -

getAccount(address) → {Promise.<Account>}

- - - - - -
-

Fetch a minimal set of current info about a Stellar account.

-

Needed to get the current sequence number for the account so you can build -a successful transaction with TransactionBuilder.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
address - - -string - - - - -

The public address of the account to load.

- -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Promise.<Account> - - -
-
- - -
-

Returns a promise to the Account object with populated sequence number.

-
- - -
- - - -
-
Example
- -
server.getAccount("GBZC6Y2Y7Q3ZQ2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4").then(account => {
-  console.log("sequence:", account.sequence);
-});
- -
- -
- - -
- - - -

getContractData(contractId, key) → {Promise.<SorobanRpc.GetLedgerEntryResponse>}

- - - - - -
-

Reads the current value of contract data ledger entries directly.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contractId - - -string - - - - -

The contract ID containing the data to load. Encoded as a hex string.

- -
key - - -xdr.ScVal - - - - -

The key of the contract data to load.

- -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Promise.<SorobanRpc.GetLedgerEntryResponse> - - -
-
- - -
-

Returns a promise to the SorobanRpc.GetLedgerEntryResponse object with the current value.

-
- - -
- - - -
-
Example
- -
const contractId = "0000000000000000000000000000000000000000000000000000000000000001";
-const key = xdr.ScVal.scvSymbol("counter");
-server.getContractData(contractId, key).then(data => {
-  console.log("value:", data.xdr);
-  console.log("lastModified:", data.lastModifiedLedgerSeq);
-  console.log("latestLedger:", data.latestLedger);
-});
-
-Allows you to directly inspect the current state of a contract. This is a backup way to access your contract data which may not be available via events or simulateTransaction.
- -
- -
- - -
- - - -

getEvents() → {Promise.<SorobanRpc.GetEventsResponse>}

- - - - - -
-

Fetches all events that match a given set of filters.

-

The given filters (see SorobanRpc.EventFilter for detailed fields) -are combined only in a logical OR fashion, and all of the fields in each -filter are optional.

-

To page through events, use the pagingToken field on the relevant -SorobanRpc.EventResponse object to set the cursor parameter.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Promise.<SorobanRpc.GetEventsResponse> - - -
-
- - -
-

a promise to the -SorobanRpc.GetEventsResponse object containing a paginatable set -of the events matching the given event filters.

-
- - -
- - - -
-
Example
- -
server.getEvents({
-   startLedger: "1000",
-   filters: [
-    {
-     type: "contract",
-     contractIds: [ "deadb33f..." ],
-     topics: [[ "AAAABQAAAAh0cmFuc2Zlcg==", "AAAAAQB6Mcc=", "*" ]]
-    }, {
-     type: "system",
-     contractIds: [ "...c4f3b4b3..." ],
-     topics: [[ "*" ], [ "*", "AAAAAQB6Mcc=" ]]
-    }, {
-     contractIds: [ "...c4f3b4b3..." ],
-     topics: [[ "AAAABQAAAAh0cmFuc2Zlcg==" ]]
-    }, {
-     type: "diagnostic",
-     topics: [[ "AAAAAQB6Mcc=" ]]
-    }
-   ],
-   limit: 10,
-});
- -
- -
- - -
- - - -

getHealth() → {Promise.<SorobanRpc.GetHealthResponse>}

- - - - - -
-

General node health check.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Promise.<SorobanRpc.GetHealthResponse> - - -
-
- - -
-

Returns a promise to the SorobanRpc.GetHealthResponse object with the status of the server ("healthy").

-
- - -
- - - -
-
Example
- -
server.getHealth().then(health => {
-  console.log("status:", health.status);
-});
- -
- -
- - -
- - - -

getLatestLedger() → {Promise.<SorobanRpc.GetLatestLedgerResponse>}

- - - - - -
-

Fetches the latest ledger meta info from network which Soroban-RPC is connected to.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Promise.<SorobanRpc.GetLatestLedgerResponse> - - -
-
- - -
-

a promise to the -SorobanRpc.GetLatestLedgerResponse object containing metadata -about the latest ledger from network soroban-rpc server is connected to.

-
- - -
- - - -
-
Example
- -
server.getLatestLedger().then(response => {
-  console.log("hash:", response.id);
-  console.log("sequence:", response.sequence);
-  console.log("protocolVersion:", response.protocolVersion);
-});
- -
- -
- - -
- - - -

getLedgerEntry(key) → {Promise.<SorobanRpc.GetLedgerEntryResponse>}

- - - - - -
-

Reads the current value of ledger entries directly.

-

Allows you to directly inspect the current state of a contract, -contract's code, or any other ledger entry. This is a backup way to access -your contract data which may not be available via events or -simulateTransaction.

-

To fetch contract wasm byte-code, use the ContractCode ledger entry key.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
key - - -xdr.ScVal - - - - -

The key of the contract data to load.

- -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Promise.<SorobanRpc.GetLedgerEntryResponse> - - -
-
- - -
-

Returns a promise to the SorobanRpc.GetLedgerEntryResponse object with the current value.

-
- - -
- - - -
-
Example
- -
const contractId = "0000000000000000000000000000000000000000000000000000000000000001";
-const key = xdr.LedgerKey.contractData(new xdr.LedgerKeyContractData({
-  contractId: Buffer.from(contractId, "hex"),
-  key: xdr.ScVal.scvSymbol("counter"),
-}));
-server.getLedgerEntry(key).then(data => {
-  console.log("value:", data.xdr);
-  console.log("lastModified:", data.lastModifiedLedgerSeq);
-  console.log("latestLedger:", data.latestLedger);
-});
- -
- -
- - -
- - - -

getNetwork() → {Promise.<SorobanRpc.GetNetworkResponse>}

- - - - - -
-

Fetches metadata about the network which Soroban-RPC is connected to.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Promise.<SorobanRpc.GetNetworkResponse> - - -
-
- - -
-

a promise to the -SorobanRpc.GetNetworkResponse object containing metadata -about the current network this soroban-rpc server is connected to.

-
- - -
- - - -
-
Example
- -
server.getNetwork().then(network => {
-  console.log("friendbotUrl:", network.friendbotUrl);
-  console.log("passphrase:", network.passphrase);
-  console.log("protocolVersion:", network.protocolVersion);
-});
- -
- -
- - -
- - - -

getTransaction(hash) → {Promise.<SorobanRpc.GetTransactionResponse>}

- - - - - -
-

Fetch the details of a submitted transaction.

-

When submitting a transaction, clients should poll this to tell when the -transaction has completed.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
hash - - -string - - - - -

The hash of the transaction to check. Encoded as a -hex string.

- -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Promise.<SorobanRpc.GetTransactionResponse> - - -
-
- - -
-

Returns a -promise to the SorobanRpc.GetTransactionResponse object -with the status, result, and other details about the transaction.

-
- - -
- - - -
-
Example
- -
const transactionHash = "c4515e3bdc0897f21cc5dbec8c82cf0a936d4741cb74a8e158eb51b9fb00411a";
-server.getTransaction(transactionHash).then(transaction => {
-  console.log("status:", transaction.status);
-  console.log("envelopeXdr:", transaction.envelopeXdr);
-  console.log("resultMetaXdr:", transaction.resultMetaXdr);
-  console.log("resultXdr:", transaction.resultXdr);
-});
- -
- -
- - -
- - - -

prepareTransaction(transaction, networkPassphraseopt) → {Promise.<(Transaction|FeeBumpTransaction)>}

- - - - - -
-

Submit a trial contract invocation, then add the expected ledger footprint -and auth into the transaction so it is ready for signing & sending.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
transaction - - -Transaction -| - -FeeBumpTransaction - - - - - - - - - - -

The transaction to -prepare. It should include exactly one operation, which must be a -InvokeHostFunctionOp. Any provided footprint will be overwritten.

- -
networkPassphrase - - -string - - - - - - <optional>
- - - - - -
-

Explicitly provide a network -passphrase. If not passed, the current network passphrase will be requested -from the server via getNetwork.

- -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Promise.<(Transaction|FeeBumpTransaction)> - - -
-
- - -
-

Returns a copy of the -transaction, with the expected ledger footprint added.

-
- - -
- - - -
-
Example
- -
const contractId = '0000000000000000000000000000000000000000000000000000000000000001';
-const contract = new SorobanClient.Contract(contractId);
-
-// Right now, this is just the default fee for this example.
-const fee = 100;
-
-const transaction = new SorobanClient.TransactionBuilder(account, {
-    fee,
-    // Uncomment the following line to build transactions for the live network. Be
-    // sure to also change the horizon hostname.
-    // networkPassphrase: SorobanClient.Networks.PUBLIC,
-    networkPassphrase: SorobanClient.Networks.TESTNET
-  })
-  // Add a contract.increment soroban contract invocation operation
-  .addOperation(contract.call("increment"))
-  // Make this transaction valid for the next 30 seconds only
-  .setTimeout(30)
-  // Uncomment to add a memo (https://developers.stellar.org/docs/glossary/transactions/)
-  // .addMemo(SorobanClient.Memo.text('Hello world!'))
-  .build();
-
-preparedTransaction = await server.prepareTransaction(transaction);
-
-// Sign this transaction with the secret key
-// NOTE: signing is transaction is network specific. Test network transactions
-// won't work in the public network. To switch networks, use the Network object
-// as explained above (look for SorobanClient.Network).
-const sourceKeypair = SorobanClient.Keypair.fromSecret(sourceSecretKey);
-preparedTransaction.sign(sourceKeypair);
-
-server.sendTransaction(transaction).then(result => {
-  console.log("hash:", result.hash);
-  console.log("status:", result.status);
-  console.log("errorResultXdr:", result.errorResultXdr);
-});
- -
- -
- - -
- - - -

requestAirdrop(address, friendbotUrlopt) → {Promise.<Account>}

- - - - - -
-

Use the friendbot faucet to create and fund a new account. The method will -return an Account object for the created account, or if the account already -existed. If friendbot is not configured on this network, this method will -throw an error. If the request fails, this method will throw an error.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
address - - -string -| - -Account - - - - - - - - - - -

The address or account we want to create and fund.

- -
friendbotUrl - - -string - - - - - - <optional>
- - - - - -
-

The optional explicit address for -friendbot. If not provided, the client will call the Soroban-RPC getNetwork -method to attempt to find this network's friendbot url.

- -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Promise.<Account> - - -
-
- - -
-

Returns a promise to the Account object with populated sequence number.

-
- - -
- - - -
-
Example
- -
server.requestAirdrop("GBZC6Y2Y7Q3ZQ2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4").then(accountCreated => {
-  console.log("accountCreated:", accountCreated);
-}).catch(error => {
-  console.error("error:", error);
-});
- -
- -
- - -
- - - -

sendTransaction(transaction) → {Promise.<SorobanRpc.SendTransactionResponse>}

- - - - - -
-

Submit a real transaction to the Stellar network. This is the only way to -make changes "on-chain". Unlike Horizon, Soroban-RPC does not wait for -transaction completion. It simply validates the transaction and enqueues -it. Clients should call Server#getTransactionStatus to learn about -transaction success/failure.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
transaction - - -Transaction -| - -FeeBumpTransaction - - - - -

The transaction to -submit.

- -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Promise.<SorobanRpc.SendTransactionResponse> - - -
-
- - -
-

Returns a promise to -the SorobanRpc.SendTransactionResponse object with the -transaction id, status, and any error if available.

-
- - -
- - - -
-
Example
- -
const contractId = '0000000000000000000000000000000000000000000000000000000000000001';
-const contract = new SorobanClient.Contract(contractId);
-
-// Right now, this is just the default fee for this example.
-const fee = 100;
-
-const transaction = new SorobanClient.TransactionBuilder(account, {
-    fee,
-    // Uncomment the following line to build transactions for the live network. Be
-    // sure to also change the horizon hostname.
-    // networkPassphrase: SorobanClient.Networks.PUBLIC,
-    networkPassphrase: SorobanClient.Networks.STANDALONE
-  })
-  // Add a contract.increment soroban contract invocation operation
-  // Note: For real transactions you will need to include the footprint
-  // and auth in the operation, as returned from simulateTransaction.
-  .addOperation(contract.call("increment"))
-  // Make this transaction valid for the next 30 seconds only
-  .setTimeout(30)
-  // Uncomment to add a memo (https://developers.stellar.org/docs/glossary/transactions/)
-  // .addMemo(SorobanClient.Memo.text('Hello world!'))
-  .build();
-
-// Sign this transaction with the secret key
-// NOTE: signing is transaction is network specific. Test network transactions
-// won't work in the public network. To switch networks, use the Network object
-// as explained above (look for SorobanClient.Network).
-const sourceKeypair = SorobanClient.Keypair.fromSecret(sourceSecretKey);
-transaction.sign(sourceKeypair);
-
-server.sendTransaction(transaction).then(result => {
-  console.log("hash:", result.hash);
-  console.log("status:", result.status);
-  console.log("errorResultXdr:", result.errorResultXdr);
-});
- -
- -
- - -
- - - -

simulateTransaction(transaction) → {Promise.<SorobanRpc.SimulateTransactionResponse>}

- - - - - -
-

Submit a trial contract invocation to get back return values, expected -ledger footprint, expected authorizations, and expected costs.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
transaction - - -Transaction -| - -FeeBumpTransaction - - - - -

The transaction to -simulate. It should include exactly one operation, which must be a -InvokeHostFunctionOp. Any provided footprint will be ignored.

- -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Promise.<SorobanRpc.SimulateTransactionResponse> - - -
-
- - -
-

Returns a -promise to the SorobanRpc.SimulateTransactionResponse object -with the cost, result, footprint, auth, and error of the transaction.

-
- - -
- - - -
-
Example
- -
const contractId = '0000000000000000000000000000000000000000000000000000000000000001';
-const contract = new SorobanClient.Contract(contractId);
-
-// Right now, this is just the default fee for this example.
-const fee = 100;
-
-const transaction = new SorobanClient.TransactionBuilder(account, {
-    fee,
-    // Uncomment the following line to build transactions for the live network. Be
-    // sure to also change the horizon hostname.
-    // networkPassphrase: SorobanClient.Networks.PUBLIC,
-    networkPassphrase: SorobanClient.Networks.STANDALONE
-  })
-  // Add a contract.increment soroban contract invocation operation
-  .addOperation(contract.call("increment"))
-  // Make this transaction valid for the next 30 seconds only
-  .setTimeout(30)
-  // Uncomment to add a memo (https://developers.stellar.org/docs/glossary/transactions/)
-  // .addMemo(SorobanClient.Memo.text('Hello world!'))
-  .build();
-
-// Sign this transaction with the secret key
-// NOTE: signing is transaction is network specific. Test network transactions
-// won't work in the public network. To switch networks, use the Network object
-// as explained above (look for SorobanClient.Network).
-const sourceKeypair = SorobanClient.Keypair.fromSecret(sourceSecretKey);
-transaction.sign(sourceKeypair);
-
-server.simulateTransaction(transaction).then(sim => {
-  console.log("cost:", sim.cost);
-  console.log("results:", sim.results);
-  console.log("error:", sim.error);
-  console.log("latestLedger:", sim.latestLedger);
-});
- -
- -
- - @@ -2542,7 +399,7 @@
Example

- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/SignerKey.html b/SignerKey.html index 01bdf762..91810102 100644 --- a/SignerKey.html +++ b/SignerKey.html @@ -24,7 +24,7 @@
@@ -497,7 +497,7 @@
Returns:

- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/StrKey.html b/StrKey.html index 1561f9d8..6ac418ce 100644 --- a/StrKey.html +++ b/StrKey.html @@ -24,7 +24,7 @@
@@ -101,7 +101,7 @@

new StrKeySource:
@@ -155,6 +155,162 @@

Methods

+
+ + + +

(static) decodeContract(address) → {Buffer}

+ + + + + +
+

Decodes strkey contract (C...) to raw data.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
address + + +string + + + + +

address to decode

+ +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +Buffer + + +
+
+ + + +
+ + + +
+ +
@@ -204,7 +360,7 @@

(stat
Source:
@@ -364,7 +520,7 @@

(sta
Source:
@@ -520,7 +676,7 @@

(sta
Source:
@@ -676,7 +832,7 @@

(static) Source:
@@ -832,7 +988,7 @@

(static) Source:
@@ -988,7 +1144,7 @@

(static)
Source:
@@ -1094,6 +1250,162 @@
Returns:
+

+ + +
+ + + +

(static) encodeContract(data) → {string}

+ + + + + +
+

Encodes raw data to strkey contract (C...).

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + +Buffer + + + + +

data to encode

+ +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +string + + +
+
+ + + +
+ + +
@@ -1144,7 +1456,7 @@

(stat
Source:
@@ -1304,7 +1616,7 @@

(sta
Source:
@@ -1460,7 +1772,7 @@

(sta
Source:
@@ -1616,7 +1928,7 @@

(static) Source:
@@ -1772,7 +2084,7 @@

(static) Source:
@@ -1928,7 +2240,7 @@

(static)
Source:
@@ -2034,6 +2346,162 @@
Returns:
+

+ + +
+ + + +

(static) isValidContract(address) → {boolean}

+ + + + + +
+

Checks validity of alleged contract (C...) strkey address.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
address + + +string + + + + +

signer key to check

+ +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +boolean + + +
+
+ + + +
+ + +
@@ -2084,7 +2552,7 @@

(sta
Source:
@@ -2240,7 +2708,7 @@

(st
Source:
@@ -2396,7 +2864,7 @@

(st
Source:
@@ -2552,7 +3020,7 @@

(static
Source:
@@ -2677,7 +3145,7 @@
Returns:

- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/Transaction.html b/Transaction.html index 385aac75..b500944c 100644 --- a/Transaction.html +++ b/Transaction.html @@ -24,7 +24,7 @@
@@ -1434,7 +1434,7 @@

Source:
@@ -1622,7 +1622,7 @@

addSignat
Source:
@@ -2060,7 +2060,7 @@

ge
Source:
@@ -2225,7 +2225,7 @@

hashSource:
@@ -2459,18 +2459,14 @@
Returns:
-

signatureBase() → {Buffer}

+

signHashX(preimage) → {void}

-

Returns the "signature base" of this transaction, which is the value -that, when hashed, should be signed to create a signature that -validators on the Stellar Network will accept.

-

It is composed of a 4 prefix bytes followed by the xdr-encoded form -of this transaction.

+

Add hashX signer preimage as signature.

@@ -2486,6 +2482,11 @@

signatur +
Overrides:
+
+ @@ -2506,7 +2507,7 @@

signatur
Source:
@@ -2525,6 +2526,61 @@

signatur +

Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
preimage + + +Buffer +| + +String + + + + +

Preimage of hash used as signer

+ +
+ + @@ -2548,7 +2604,7 @@
Returns:
-Buffer +void
@@ -2567,14 +2623,18 @@
Returns:
-

signHashX(preimage) → {void}

+

signatureBase() → {Buffer}

-

Add hashX signer preimage as signature.

+

Returns the "signature base" of this transaction, which is the value +that, when hashed, should be signed to create a signature that +validators on the Stellar Network will accept.

+

It is composed of a 4 prefix bytes followed by the xdr-encoded form +of this transaction.

@@ -2590,11 +2650,6 @@

signHashXOverrides: -
- @@ -2615,7 +2670,7 @@

signHashXSource:
@@ -2634,61 +2689,6 @@

signHashXParameters:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
preimage - - -Buffer -| - -String - - - - -

Preimage of hash used as signer

- -
- - @@ -2712,7 +2712,7 @@
Returns:
-void +Buffer
@@ -2883,7 +2883,7 @@

toXDRSource:
@@ -2960,7 +2960,7 @@
Returns:

- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/TransactionBuilder.html b/TransactionBuilder.html index 0344debf..cf4a82bc 100644 --- a/TransactionBuilder.html +++ b/TransactionBuilder.html @@ -24,7 +24,7 @@
@@ -137,7 +137,7 @@

new
Source:
@@ -794,6 +794,49 @@

Parameters:
+ + + + sorobanData + + + + + +xdr.SorobanTransactionData +| + +string + + + + + + + + + <optional>
+ + + + + + + + + + + +

an optional xdr instance of SorobanTransactionData +to be set as .Transaction.Ext.SorobanData. It can be xdr object or base64 string. +For non-contract(non-Soroban) transactions, this has no effect. +In the case of Soroban transactions, SorobanTransactionData can be obtained from a prior simulation of +the transaction with a contract invocation and provides necessary resource estimations.

+ + + + + @@ -852,15 +895,14 @@

Methods

-

(static) buildFeeBumpTransaction(feeSource, baseFee, innerTx, networkPassphrase) → {FeeBumpTransaction}

+

addMemo(memo) → {TransactionBuilder}

-

Builds a FeeBumpTransaction, enabling you to resubmit an existing -transaction with a higher fee.

+

Adds a memo to the transaction.

@@ -896,31 +938,15 @@

(sta
Source:
-
See:
-
- -
- -
To Do:
-
-
    -
  • Alongside the next major version bump, this type signature can be - changed to be less awkward: accept a MuxedAccount as the `feeSource` - rather than a keypair or string.
  • -
-
- @@ -956,98 +982,13 @@
Parameters:
- feeSource - - - - - -Keypair -| - -string - - - - - - - - - - -

account paying for the transaction, -in the form of either a Keypair (only the public key is used) or -an account ID (in G... or M... form, but refer to withMuxing)

- - - - - - - - - baseFee - - - - - -string - - - - - - - - - - -

max fee willing to pay per operation -in inner transaction (in stroops)

- - - - - - - - - innerTx - - - - - -Transaction - - - - - - - - - - -

Transaction to be bumped by -the fee bump transaction

- - - - - - - - - networkPassphrase + memo -string +Memo @@ -1058,9 +999,7 @@
Parameters:
-

passphrase of the target -Stellar network (e.g. "Public Global Stellar Network ; September 2015", -see Networks)

+

Memo object

@@ -1093,7 +1032,7 @@
Returns:
-FeeBumpTransaction +TransactionBuilder
@@ -1112,15 +1051,14 @@
Returns:
-

(static) fromXDR(envelope, networkPassphrase) → {Transaction|FeeBumpTransaction}

+

addOperation(operation) → {TransactionBuilder}

-

Build a Transaction or FeeBumpTransaction from an -xdr.TransactionEnvelope.

+

Adds an operation to the transaction.

@@ -1156,7 +1094,7 @@

(static) from
Source:
@@ -1200,16 +1138,13 @@

Parameters:
- envelope + operation -string -| - -xdr.TransactionEnvelope +xdr.Operation @@ -1220,43 +1155,119 @@
Parameters:
-

The transaction envelope -object or base64 encoded string.

+

The xdr operation object, use Operation static methods.

+ + + + + + + - - - networkPassphrase - - - - -string - - - + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +TransactionBuilder + + +
+
+ + + +
+ + + +

+ +
- -

The network passphrase of the target -Stellar network (e.g. "Public Global Stellar Network ; September -2015"), see Networks.

- - - + + +

build() → {Transaction}

- - + + + +
+

This will build the transaction. +It will also increment the source account's sequence number by 1.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + @@ -1283,15 +1294,16 @@
Returns:
Transaction -| - -FeeBumpTransaction
+
+

This method will return the built Transaction.

+
+
@@ -1304,14 +1316,17 @@
Returns:
-

addMemo(memo) → {TransactionBuilder}

+

setExtraSigners(extraSigners) → {TransactionBuilder}

-

Adds a memo to the transaction.

+

For the transaction to be valid, there must be a signature corresponding to +every Signer in this array, even if the signature is not otherwise required +by the sourceAccount or operations. Internally this will set the +extraSigners precondition.

@@ -1347,7 +1362,7 @@

addMemoSource:
@@ -1391,13 +1406,13 @@
Parameters:
- memo + extraSigners -Memo +Array.<string> @@ -1408,7 +1423,7 @@
Parameters:
-

Memo object

+

required extra signers (as StrKeys)

@@ -1460,14 +1475,16 @@
Returns:
-

addOperation(operation) → {TransactionBuilder}

+

setLedgerbounds(minLedger, maxLedger) → {TransactionBuilder}

-

Adds an operation to the transaction.

+

If you want to prepare a transaction which will only be valid within some +range of ledgers, you can set a ledgerbounds precondition. +Internally this will set the minLedger and maxLedger preconditions.

@@ -1503,7 +1520,7 @@

addOperat
Source:
@@ -1547,13 +1564,13 @@

Parameters:
- operation + minLedger -xdr.Operation +number @@ -1564,7 +1581,37 @@
Parameters:
-

The xdr operation object, use Operation static methods.

+

The minimum ledger this transaction is valid at +or after. Cannot be negative. If the value is 0 (the default), the +transaction is valid immediately.

+ + + + + + + + + maxLedger + + + + + +number + + + + + + + + + + +

The maximum ledger this transaction is valid +before. Cannot be negative. If the value is 0, the transaction is +valid indefinitely.

@@ -1616,15 +1663,20 @@
Returns:
-

build() → {Transaction}

+

setMinAccountSequence(minAccountSequence) → {TransactionBuilder}

-

This will build the transaction. -It will also increment the source account's sequence number by 1.

+

If you want to prepare a transaction which will be valid only while the +account sequence number is

+
minAccountSequence <= sourceAccountSequence < tx.seqNum
+
+

Note that after execution the account's sequence number is always raised to +tx.seqNum. Internally this will set the minAccountSequence +precondition.

@@ -1660,7 +1712,7 @@

buildSource:
@@ -1679,6 +1731,60 @@

buildParameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
minAccountSequence + + +string + + + + +

The minimum source account sequence +number this transaction is valid for. If the value is 0 (the +default), the transaction is valid when sourceAccount's sequence number == tx.seqNum- 1.

+ +
+ + @@ -1702,17 +1808,13 @@
Returns:
-Transaction +TransactionBuilder
-
-

This method will return the built Transaction.

-
-

@@ -1725,17 +1827,16 @@
Returns:
-

setExtraSigners(extraSigners) → {TransactionBuilder}

+

setMinAccountSequenceAge(durationInSeconds) → {TransactionBuilder}

-

For the transaction to be valid, there must be a signature corresponding to -every Signer in this array, even if the signature is not otherwise required -by the sourceAccount or operations. Internally this will set the -extraSigners precondition.

+

For the transaction to be valid, the current ledger time must be at least +minAccountSequenceAge greater than sourceAccount's sequenceTime. +Internally this will set the minAccountSequenceAge precondition.

@@ -1771,7 +1872,7 @@

setExt
Source:
@@ -1815,13 +1916,13 @@

Parameters:
- extraSigners + durationInSeconds -Array.<string> +number @@ -1832,7 +1933,10 @@
Parameters:
-

required extra signers (as StrKeys)

+

The minimum amount of time between +source account sequence time and the ledger time when this transaction +will become valid. If the value is 0, the transaction is unrestricted +by the account sequence age. Cannot be negative.

@@ -1884,16 +1988,16 @@
Returns:
-

setLedgerbounds(minLedger, maxLedger) → {TransactionBuilder}

+

setMinAccountSequenceLedgerGap(gap) → {TransactionBuilder}

-

If you want to prepare a transaction which will only be valid within some -range of ledgers, you can set a ledgerbounds precondition. -Internally this will set the minLedger and maxLedger preconditions.

+

For the transaction to be valid, the current ledger number must be at least +minAccountSequenceLedgerGap greater than sourceAccount's ledger sequence. +Internally this will set the minAccountSequenceLedgerGap precondition.

@@ -1929,7 +2033,7 @@

setLed
Source:
@@ -1973,35 +2077,7 @@

Parameters:
- minLedger - - - - - -number - - - - - - - - - - -

The minimum ledger this transaction is valid at -or after. Cannot be negative. If the value is 0 (the default), the -transaction is valid immediately.

- - - - - - - - - maxLedger + gap @@ -2018,9 +2094,10 @@
Parameters:
-

The maximum ledger this transaction is valid -before. Cannot be negative. If the value is 0, the transaction is -valid indefinitely.

+

The minimum number of ledgers between source account +sequence and the ledger number when this transaction will become valid. +If the value is 0, the transaction is unrestricted by the account +sequence ledger. Cannot be negative.

@@ -2072,20 +2149,14 @@
Returns:
-

setMinAccountSequence(minAccountSequence) → {TransactionBuilder}

+

setNetworkPassphrase(networkPassphrase) → {TransactionBuilder}

-

If you want to prepare a transaction which will be valid only while the -account sequence number is

-
minAccountSequence <= sourceAccountSequence < tx.seqNum
-
-

Note that after execution the account's sequence number is always raised to -tx.seqNum. Internally this will set the minAccountSequence -precondition.

+

Set network nassphrase for the Transaction that will be built.

@@ -2121,7 +2192,7 @@

Source:
@@ -2165,7 +2236,7 @@

Parameters:
- minAccountSequence + networkPassphrase @@ -2182,9 +2253,8 @@
Parameters:
-

The minimum source account sequence -number this transaction is valid for. If the value is 0 (the -default), the transaction is valid when sourceAccount's sequence number == tx.seqNum- 1.

+

passphrase of the target Stellar +network (e.g. "Public Global Stellar Network ; September 2015").

@@ -2236,16 +2306,19 @@
Returns:
-

setMinAccountSequenceAge(durationInSeconds) → {TransactionBuilder}

+

setSorobanData(sorobanData) → {TransactionBuilder}

-

For the transaction to be valid, the current ledger time must be at least -minAccountSequenceAge greater than sourceAccount's sequenceTime. -Internally this will set the minAccountSequenceAge precondition.

+

Set the {SorobanTransactionData}. For non-contract(non-Soroban) transactions, +this setting has no effect. +In the case of Soroban transactions, set to an instance of +SorobanTransactionData. This can typically be obtained from the simulation +response based on a transaction with a InvokeHostFunctionOp. +It provides necessary resource estimations for contract invocation.

@@ -2281,7 +2354,7 @@

Source:
@@ -2325,13 +2398,16 @@
Parameters:
- durationInSeconds + sorobanData -number +xdr.SorobanTransactionData +| + +string @@ -2342,10 +2418,8 @@
Parameters:
-

The minimum amount of time between -source account sequence time and the ledger time when this transaction -will become valid. If the value is 0, the transaction is unrestricted -by the account sequence age. Cannot be negative.

+

the SorobanTransactionData as xdr object or base64 string +to be set as Transaction.Ext.SorobanData.

@@ -2397,16 +2471,17 @@
Returns:
-

setMinAccountSequenceLedgerGap(gap) → {TransactionBuilder}

+

setTimebounds(minEpochOrDate, maxEpochOrDate) → {TransactionBuilder}

-

For the transaction to be valid, the current ledger number must be at least -minAccountSequenceLedgerGap greater than sourceAccount's ledger sequence. -Internally this will set the minAccountSequenceLedgerGap precondition.

+

If you want to prepare a transaction which will become valid at some point +in the future, or be invalid after some time, you can set a timebounds +precondition. Internally this will set the minTime, and maxTime +preconditions. Conflicts with setTimeout, so use one or the other.

@@ -2442,7 +2517,7 @@

Source:
@@ -2461,37 +2536,72 @@

+ + + + Name + + + Type + + + + + + Description + + + + + + + + + minEpochOrDate + + + + + +Date +| + +number - - - - - - - + + - + - + - - - + + - - + @@ -2558,14 +2668,28 @@
Returns:
-

setNetworkPassphrase(networkPassphrase) → {TransactionBuilder}

+

setTimeout(timeoutSeconds) → {TransactionBuilder}

-

Set network nassphrase for the Transaction that will be built.

+

Sets a timeout precondition on the transaction.

+

Because of the distributed nature of the Stellar network it is possible +that the status of your transaction will be determined after a long time +if the network is highly congested. If you want to be sure to receive the +status of the transaction within a given period you should set the TimeBounds with maxTime on the transaction (this is what setTimeout +does internally; if there's minTime set but no maxTime it will be +added).

+

A call to TransactionBuilder.setTimeout is required if Transaction +does not have max_time set. If you don't want to set timeout, use +TimeoutInfinite. In general you should set TimeoutInfinite only in smart contracts.

+

Please note that Horizon may still return 504 Gateway Timeout +error, even for short timeouts. In such case you need to resubmit the same +transaction again without making any changes to receive a status. This +method is using the machine system time (UTC), make sure it is set +correctly.

@@ -2601,13 +2725,22 @@

s
Source:
+
See:
+
+ +
+ @@ -2645,13 +2778,13 @@

Parameters:
- + @@ -2715,17 +2849,15 @@
Returns:
-

setTimebounds(minEpochOrDate, maxEpochOrDate) → {TransactionBuilder}

+

(static) buildFeeBumpTransaction(feeSource, baseFee, innerTx, networkPassphrase) → {FeeBumpTransaction}

-

If you want to prepare a transaction which will become valid at some point -in the future, or be invalid after some time, you can set a timebounds -precondition. Internally this will set the minTime, and maxTime -preconditions. Conflicts with setTimeout, so use one or the other.

+

Builds a FeeBumpTransaction, enabling you to resubmit an existing +transaction with a higher fee.

@@ -2761,15 +2893,31 @@

setTimeb
Source:
+
See:
+
+ +
+ +
To Do:
+
+
    +
  • Alongside the next major version bump, this type signature can be + changed to be less awkward: accept a MuxedAccount as the `feeSource` + rather than a keypair or string.
  • +
+
+ @@ -2805,16 +2953,16 @@

Parameters:
- + @@ -2837,16 +2984,40 @@
Parameters:
- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2893,7 +3090,7 @@
Returns:
-TransactionBuilder +FeeBumpTransaction
@@ -2912,28 +3109,15 @@
Returns:
-

setTimeout(timeoutSeconds) → {TransactionBuilder}

+

(static) fromXDR(envelope, networkPassphrase) → {Transaction|FeeBumpTransaction}

-

Sets a timeout precondition on the transaction.

-

Because of the distributed nature of the Stellar network it is possible -that the status of your transaction will be determined after a long time -if the network is highly congested. If you want to be sure to receive the -status of the transaction within a given period you should set the TimeBounds with maxTime on the transaction (this is what setTimeout -does internally; if there's minTime set but no maxTime it will be -added).

-

A call to TransactionBuilder.setTimeout is required if Transaction -does not have max_time set. If you don't want to set timeout, use -TimeoutInfinite. In general you should set TimeoutInfinite only in smart contracts.

-

Please note that Horizon may still return 504 Gateway Timeout -error, even for short timeouts. In such case you need to resubmit the same -transaction again without making any changes to receive a status. This -method is using the machine system time (UTC), make sure it is set -correctly.

+

Build a Transaction or FeeBumpTransaction from an +xdr.TransactionEnvelope.

@@ -2969,22 +3153,13 @@

setTimeout<
Source:
-
See:
-
- -
- @@ -3022,13 +3197,16 @@

Parameters:
- + + + + + + + + + + + + + + + + + @@ -3074,7 +3279,10 @@
Returns:
-TransactionBuilder +Transaction +| + +FeeBumpTransaction
@@ -3105,7 +3313,7 @@
Returns:

- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/global.html b/global.html index 1b2c8dfd..7a442ecd 100644 --- a/global.html +++ b/global.html @@ -24,7 +24,7 @@
@@ -940,7 +940,7 @@
Type:
-

(constant) SERVER_TIME_MAP

+

SERVER_TIME_MAP

@@ -990,7 +990,7 @@

(constant) Source:
@@ -1076,6 +1076,72 @@

(constant) + + + +
+

default

+ + + + +
+

Given a hostname, get the current time of that server (i.e., use the last- +recorded server time and offset it by the time since then.) If there IS no +recorded server time, or it's been 5 minutes since the last, return null.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + +
@@ -1086,6 +1152,89 @@

Methods

+
+ + + +

_post()

+ + + + + +
+

Sends the jsonrpc 'params' as the single 'param' obj, no array wrapper is applied.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
@@ -1958,170 +2107,6 @@
Returns:
-
- - -
- - - -

getCurrentServerTime(hostname) → {number}

- - - - - -
-

Given a hostname, get the current time of that server (i.e., use the last- -recorded server time and offset it by the time since then.) If there IS no -recorded server time, or it's been 5 minutes since the last, return null.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - -

NameTypeDescription
+

Either a JS Date object, or a number +of UNIX epoch seconds. The transaction is valid after this timestamp. +Can't be negative. If the value is 0, the transaction is valid +immediately.

+ +
gapmaxEpochOrDate +Date +| + number @@ -2503,10 +2613,10 @@
Parameters:
-

The minimum number of ledgers between source account -sequence and the ledger number when this transaction will become valid. -If the value is 0, the transaction is unrestricted by the account -sequence ledger. Cannot be negative.

+

Either a JS Date object, or a number +of UNIX epoch seconds. The transaction is valid until this timestamp. +Can't be negative. If the value is 0, the transaction is valid +indefinitely.

networkPassphrasetimeoutSeconds -string +number @@ -2662,8 +2795,9 @@
Parameters:
-

passphrase of the target Stellar -network (e.g. "Public Global Stellar Network ; September 2015").

+

Number of seconds the transaction is good. +Can't be negative. If the value is TimeoutInfinite, the +transaction is good indefinitely.

minEpochOrDatefeeSource -Date +Keypair | -number +string @@ -2825,10 +2973,9 @@
Parameters:
-

Either a JS Date object, or a number -of UNIX epoch seconds. The transaction is valid after this timestamp. -Can't be negative. If the value is 0, the transaction is valid -immediately.

+

account paying for the transaction, +in the form of either a Keypair (only the public key is used) or +an account ID (in G... or M... form, but refer to withMuxing)

maxEpochOrDatebaseFee -Date -| +string -number + + + +

max fee willing to pay per operation +in inner transaction (in stroops)

+ +
innerTx + + +Transaction @@ -2857,10 +3028,36 @@
Parameters:
-

Either a JS Date object, or a number -of UNIX epoch seconds. The transaction is valid until this timestamp. -Can't be negative. If the value is 0, the transaction is valid -indefinitely.

+

Transaction to be bumped by +the fee bump transaction

+ +
networkPassphrase + + +string + + + + +

passphrase of the target +Stellar network (e.g. "Public Global Stellar Network ; September 2015", +see Networks)

timeoutSecondsenvelope -number +string +| + +xdr.TransactionEnvelope @@ -3039,9 +3217,36 @@
Parameters:
-

Number of seconds the transaction is good. -Can't be negative. If the value is TimeoutInfinite, the -transaction is good indefinitely.

+

The transaction envelope +object or base64 encoded string.

+ +
networkPassphrase + + +string + + + + +

The network passphrase of the target +Stellar network (e.g. "Public Global Stellar Network ; September +2015"), see Networks.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
hostname - - -string - - - - -

Hostname of a Soroban-RPC server.

- -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -number - - -
-
- - -
-

The UNIX timestamp (in seconds, not milliseconds) -representing the current time on that server, or null if we don't have -a record of that time.

-
- - -
- - -

@@ -2468,7 +2453,7 @@

isValidSource:
@@ -2655,7 +2640,7 @@

isValidDat
Source:
@@ -2811,7 +2796,7 @@

postSource:
@@ -2851,14 +2836,15 @@

postpostObject()

+

unmarshalSorobanData(sorobanData) → {xdr.SorobanTransactionData}

-

Sends the jsonrpc 'params' as the single 'param' obj, no array wrapper is applied.

+

local helper function to convert SorobanTransactionData from +base64 string or xdr object.

@@ -2894,7 +2880,7 @@

postObject<
Source:
@@ -2913,17 +2899,93 @@

postObject< +

Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
sorobanData + + +string +| +xdr.SorobanTransactionData + + +

the soroban transaction data

+ +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +xdr.SorobanTransactionData + + +
+
+ + + +
@@ -2946,7 +3008,7 @@

postObject<
- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/index.html b/index.html index 845593d6..1267d98b 100644 --- a/index.html +++ b/index.html @@ -24,7 +24,7 @@
@@ -226,7 +226,7 @@

License


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_account.js.html b/js-stellar-base_src_account.js.html index 0d52b3d0..03953bfd 100644 --- a/js-stellar-base_src_account.js.html +++ b/js-stellar-base_src_account.js.html @@ -24,7 +24,7 @@
@@ -114,7 +114,7 @@

js-stellar-base/src/account.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_address.js.html b/js-stellar-base_src_address.js.html new file mode 100644 index 00000000..d82c195f --- /dev/null +++ b/js-stellar-base_src_address.js.html @@ -0,0 +1,198 @@ + + + + + + js-stellar-base/src/address.js - Documentation + + + + + + + + + + + + + + + + + +
+ +

js-stellar-base/src/address.js

+ + + + + + + +
+
+
import { StrKey } from './strkey';
+import xdr from './xdr';
+
+/**
+ * Create a new Address object.
+ *
+ * `Address` represents a single address in the Stellar network. An address can
+ * represent an account or a contract.
+ *
+ * @constructor
+ *
+ * @param {string} address - ID of the account (ex.
+ *     `GB3KJPLFUYN5VL6R3GU3EGCGVCKFDSD7BEDX42HWG5BWFKB3KQGJJRMA`). If you
+ *     provide a muxed account address, this will throw; use {@link
+ *     MuxedAccount} instead.
+ */
+export class Address {
+  constructor(address) {
+    if (StrKey.isValidEd25519PublicKey(address)) {
+      this._type = 'account';
+      this._key = StrKey.decodeEd25519PublicKey(address);
+    } else if (StrKey.isValidContract(address)) {
+      this._type = 'contract';
+      this._key = StrKey.decodeContract(address);
+    } else {
+      throw new Error('Unsupported address type');
+    }
+  }
+
+  /**
+   * Parses a string and returns an Address object.
+   *
+   * @param {string} address - The address to parse. ex. `GB3KJPLFUYN5VL6R3GU3EGCGVCKFDSD7BEDX42HWG5BWFKB3KQGJJRMA`
+   * @returns {Address}
+   */
+  static fromString(address) {
+    return new Address(address);
+  }
+
+  /**
+   * Creates a new account Address object from a buffer of raw bytes.
+   *
+   * @param {Buffer} buffer - The bytes of an address to parse.
+   * @returns {Address}
+   */
+  static account(buffer) {
+    return new Address(StrKey.encodeEd25519PublicKey(buffer));
+  }
+
+  /**
+   * Creates a new contract Address object from a buffer of raw bytes.
+   *
+   * @param {Buffer} buffer - The bytes of an address to parse.
+   * @returns {Address}
+   */
+  static contract(buffer) {
+    return new Address(StrKey.encodeContract(buffer));
+  }
+
+  /**
+   * Convert this from an xdr.ScVal type
+   *
+   * @param {xdr.ScVal} scVal - The xdr.ScVal type to parse
+   * @returns {Address}
+   */
+  static fromScVal(scVal) {
+    return Address.fromScAddress(scVal.address());
+  }
+
+  /**
+   * Convert this from an xdr.ScAddress type
+   *
+   * @param {xdr.ScAddress} scAddress - The xdr.ScAddress type to parse
+   * @returns {Address}
+   */
+  static fromScAddress(scAddress) {
+    switch (scAddress.switch()) {
+      case xdr.ScAddressType.scAddressTypeAccount():
+        return Address.account(scAddress.accountId().ed25519());
+      case xdr.ScAddressType.scAddressTypeContract():
+        return Address.contract(scAddress.contractId());
+      default:
+        throw new Error('Unsupported address type');
+    }
+  }
+
+  /**
+   * Serialize an address to string.
+   *
+   * @returns {string}
+   */
+  toString() {
+    switch (this._type) {
+      case 'account':
+        return StrKey.encodeEd25519PublicKey(this._key);
+      case 'contract':
+        return StrKey.encodeContract(this._key);
+      default:
+        throw new Error('Unsupported address type');
+    }
+  }
+
+  /**
+   * Convert this Address to an xdr.ScVal type.
+   *
+   * @returns {xdr.ScVal}
+   */
+  toScVal() {
+    return xdr.ScVal.scvAddress(this.toScAddress());
+  }
+
+  /**
+   * Convert this Address to an xdr.ScAddress type.
+   *
+   * @returns {xdr.ScAddress}
+   */
+  toScAddress() {
+    switch (this._type) {
+      case 'account':
+        return xdr.ScAddress.scAddressTypeAccount(
+          xdr.PublicKey.publicKeyTypeEd25519(this._key)
+        );
+      case 'contract':
+        return xdr.ScAddress.scAddressTypeContract(this._key);
+      default:
+        throw new Error('Unsupported address type');
+    }
+  }
+
+  /**
+   * Return the raw public key bytes for this address.
+   *
+   * @returns {Buffer}
+   */
+  toBuffer() {
+    return this._key;
+  }
+}
+
+
+
+ + + + +
+ +
+ +
+ Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme. +
+ + + + + diff --git a/js-stellar-base_src_asset.js.html b/js-stellar-base_src_asset.js.html index 765730bf..cb42d628 100644 --- a/js-stellar-base_src_asset.js.html +++ b/js-stellar-base_src_asset.js.html @@ -24,7 +24,7 @@
@@ -316,7 +316,7 @@

js-stellar-base/src/asset.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_claimant.js.html b/js-stellar-base_src_claimant.js.html index e11f3356..bf0c725a 100644 --- a/js-stellar-base_src_claimant.js.html +++ b/js-stellar-base_src_claimant.js.html @@ -24,7 +24,7 @@
@@ -223,7 +223,7 @@

js-stellar-base/src/claimant.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_contract.js.html b/js-stellar-base_src_contract.js.html new file mode 100644 index 00000000..cf545580 --- /dev/null +++ b/js-stellar-base_src_contract.js.html @@ -0,0 +1,148 @@ + + + + + + js-stellar-base/src/contract.js - Documentation + + + + + + + + + + + + + + + + + +
+ +

js-stellar-base/src/contract.js

+ + + + + + + +
+
+
import { Operation } from './operation';
+import xdr from './xdr';
+
+/**
+ * Create a new Contract object.
+ *
+ * `Contract` represents a single contract in the Stellar network, embodying the
+ * interface of the contract. See
+ * [Contracts](https://soroban.stellar.org/docs/learn/interacting-with-contracts)
+ * for more information about how contracts work in Stellar.
+ *
+ * @constructor
+ *
+ * @param {string} contractId - ID of the contract (ex.
+ *     `000000000000000000000000000000000000000000000000000000000000000001`).
+ */
+// TODO: Support contract deployment, maybe?
+export class Contract {
+  // TODO: Figure out contract owner/id stuff here. How should we represent that?
+  constructor(contractId) {
+    // TODO: Add methods based on the contractSpec (or do that elsewhere?)
+    this._id = Buffer.from(contractId, 'hex');
+  }
+
+  /**
+   * Returns Stellar contract ID as a hex string, ex.
+   * `000000000000000000000000000000000000000000000000000000000000000001`.
+   * @returns {string}
+   */
+  contractId() {
+    return this._id.toString('hex');
+  }
+
+  /**
+   * Returns an operation that will invoke this contract call.
+   *
+   * @todo Allow easily building `Operation`s that invoke multiple contract
+   * calls at once via this abstraction layer. For example, something like
+   *
+   * ```js
+   * let [ a, b ] = [someId1, someId2].map(id => { new Contract(id) });
+   *
+   * let combinedOp = Operation.invokeHostFunctions({
+   *  source: undefined, // optional
+   *  functions: [
+   *    a.partialCall("hello"),
+   *    a.partialCall("transfer", ...),
+   *    b.partialCall("increment"),
+   *  ]
+   * });
+   * ```
+   *
+   * @param {string} method - name of the method to call
+   * @param {...xdr.ScVal} params - arguments to pass to the function call
+   * @returns {xdr.Operation} Build a InvokeHostFunctionOp operation to call the
+   * contract.
+   */
+  call(method, ...params) {
+    const contractId = Buffer.from(this._id, 'hex');
+
+    return Operation.invokeHostFunction({
+      args: xdr.HostFunctionArgs.hostFunctionTypeInvokeContract([
+        xdr.ScVal.scvBytes(contractId),
+        xdr.ScVal.scvSymbol(method),
+        ...params
+      ]),
+      auth: []
+    });
+  }
+
+  /**
+   * Returns the read-only footprint entry necessary for any invocations to this
+   * contract, for convenience when adding it to your transaction's overall
+   * footprint.
+   *
+   * @returns {xdr.LedgerKey} the contract's executable data ledger key
+   */
+  getFootprint() {
+    const contractId = Buffer.from(this._id, 'hex');
+
+    return xdr.LedgerKey.contractData(
+      new xdr.LedgerKeyContractData({
+        contractId,
+        key: xdr.ScVal.scvLedgerKeyContractExecutable()
+      })
+    );
+  }
+}
+
+
+
+ + + + +
+ +
+ +
+ Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme. +
+ + + + + diff --git a/js-stellar-base_src_fee_bump_transaction.js.html b/js-stellar-base_src_fee_bump_transaction.js.html index 1326874a..c6012a41 100644 --- a/js-stellar-base_src_fee_bump_transaction.js.html +++ b/js-stellar-base_src_fee_bump_transaction.js.html @@ -24,7 +24,7 @@
@@ -102,6 +102,14 @@

js-stellar-base/src/fee_bump_transaction.js

return this._innerTransaction; } + /** + * @type {Operation[]} + * @readonly + */ + get operations() { + return this._innerTransaction.operations; + } + /** * @type {string} * @readonly @@ -158,7 +166,7 @@

js-stellar-base/src/fee_bump_transaction.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_get_liquidity_pool_id.js.html b/js-stellar-base_src_get_liquidity_pool_id.js.html index 92cf2a0e..88205072 100644 --- a/js-stellar-base_src_get_liquidity_pool_id.js.html +++ b/js-stellar-base_src_get_liquidity_pool_id.js.html @@ -24,7 +24,7 @@
@@ -105,7 +105,7 @@

js-stellar-base/src/get_liquidity_pool_id.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_keypair.js.html b/js-stellar-base_src_keypair.js.html index e53e43d9..935b086e 100644 --- a/js-stellar-base_src_keypair.js.html +++ b/js-stellar-base_src_keypair.js.html @@ -24,7 +24,7 @@
@@ -329,7 +329,7 @@

js-stellar-base/src/keypair.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_liquidity_pool_asset.js.html b/js-stellar-base_src_liquidity_pool_asset.js.html index 88852e98..f73ef406 100644 --- a/js-stellar-base_src_liquidity_pool_asset.js.html +++ b/js-stellar-base_src_liquidity_pool_asset.js.html @@ -24,7 +24,7 @@
@@ -171,7 +171,7 @@

js-stellar-base/src/liquidity_pool_asset.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_liquidity_pool_id.js.html b/js-stellar-base_src_liquidity_pool_id.js.html index ab300f2f..f9b4e5b2 100644 --- a/js-stellar-base_src_liquidity_pool_id.js.html +++ b/js-stellar-base_src_liquidity_pool_id.js.html @@ -24,7 +24,7 @@
@@ -129,7 +129,7 @@

js-stellar-base/src/liquidity_pool_id.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_memo.js.html b/js-stellar-base_src_memo.js.html index 9ed1aea0..5f280059 100644 --- a/js-stellar-base_src_memo.js.html +++ b/js-stellar-base_src_memo.js.html @@ -24,7 +24,7 @@
@@ -299,7 +299,7 @@

js-stellar-base/src/memo.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_muxed_account.js.html b/js-stellar-base_src_muxed_account.js.html index b7589912..b2482c40 100644 --- a/js-stellar-base_src_muxed_account.js.html +++ b/js-stellar-base_src_muxed_account.js.html @@ -24,7 +24,7 @@
@@ -190,7 +190,7 @@

js-stellar-base/src/muxed_account.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_network.js.html b/js-stellar-base_src_network.js.html index 9c94ac17..039ceded 100644 --- a/js-stellar-base_src_network.js.html +++ b/js-stellar-base_src_network.js.html @@ -24,7 +24,7 @@
@@ -47,7 +47,10 @@

js-stellar-base/src/network.js

*/ export const Networks = { PUBLIC: 'Public Global Stellar Network ; September 2015', - TESTNET: 'Test SDF Network ; September 2015' + TESTNET: 'Test SDF Network ; September 2015', + FUTURENET: 'Test SDF Future Network ; October 2022', + SANDBOX: 'Local Sandbox Stellar Network ; September 2022', + STANDALONE: 'Standalone Network ; February 2017' }; @@ -61,7 +64,7 @@

js-stellar-base/src/network.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_operation.js.html b/js-stellar-base_src_operation.js.html index 0c56ecca..ebe22062 100644 --- a/js-stellar-base_src_operation.js.html +++ b/js-stellar-base_src_operation.js.html @@ -24,7 +24,7 @@
@@ -101,7 +101,10 @@

js-stellar-base/src/operation.js

export const AuthClawbackEnabledFlag = 1 << 3; /** - * `Operation` class represents [operations](https://developers.stellar.org/docs/glossary/operations/) in Stellar network. + * `Operation` class represents + * [operations](https://developers.stellar.org/docs/glossary/operations/) in + * Stellar network. + * * Use one of static methods to create operations: * * `{@link Operation.createAccount}` * * `{@link Operation.payment}` @@ -133,6 +136,8 @@

js-stellar-base/src/operation.js

* * `{@link Operation.setTrustLineFlags}` * * `{@link Operation.liquidityPoolDeposit}` * * `{@link Operation.liquidityPoolWithdraw}` + * * `{@link Operation.invokeHostFunction}` + * * `{@link Operation.invokeHostFunctions}` * * @class Operation */ @@ -414,6 +419,13 @@

js-stellar-base/src/operation.js

result.minAmountB = this._fromXDRAmount(attrs.minAmountB()); break; } + case 'invokeHostFunction': { + result.type = 'invokeHostFunction'; + // TODO: Unpack each of the xdr.HostFunction instances into friendlier + // objects? + result.functions = attrs.functions(); + break; + } default: { throw new Error(`Unknown operation: ${operationName}`); } @@ -678,6 +690,8 @@

js-stellar-base/src/operation.js

Operation.setTrustLineFlags = ops.setTrustLineFlags; Operation.liquidityPoolDeposit = ops.liquidityPoolDeposit; Operation.liquidityPoolWithdraw = ops.liquidityPoolWithdraw; +Operation.invokeHostFunction = ops.invokeHostFunction; +Operation.invokeHostFunctions = ops.invokeHostFunctions; @@ -690,7 +704,7 @@

js-stellar-base/src/operation.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_operations_account_merge.js.html b/js-stellar-base_src_operations_account_merge.js.html index 2e7efc43..26fe369e 100644 --- a/js-stellar-base_src_operations_account_merge.js.html +++ b/js-stellar-base_src_operations_account_merge.js.html @@ -24,7 +24,7 @@
@@ -80,7 +80,7 @@

js-stellar-base/src/operations/account_merge.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_operations_allow_trust.js.html b/js-stellar-base_src_operations_allow_trust.js.html index 5b897be4..511abd16 100644 --- a/js-stellar-base_src_operations_allow_trust.js.html +++ b/js-stellar-base_src_operations_allow_trust.js.html @@ -24,7 +24,7 @@
@@ -107,7 +107,7 @@

js-stellar-base/src/operations/allow_trust.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_operations_begin_sponsoring_future_reserves.js.html b/js-stellar-base_src_operations_begin_sponsoring_future_reserves.js.html index 2646f4c2..28dacdae 100644 --- a/js-stellar-base_src_operations_begin_sponsoring_future_reserves.js.html +++ b/js-stellar-base_src_operations_begin_sponsoring_future_reserves.js.html @@ -24,7 +24,7 @@
@@ -84,7 +84,7 @@

js-stellar-base/src/operations/begin_sponsoring_future_re
- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_operations_bump_sequence.js.html b/js-stellar-base_src_operations_bump_sequence.js.html index 3ccec6aa..b237f26d 100644 --- a/js-stellar-base_src_operations_bump_sequence.js.html +++ b/js-stellar-base_src_operations_bump_sequence.js.html @@ -24,7 +24,7 @@
@@ -89,7 +89,7 @@

js-stellar-base/src/operations/bump_sequence.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_operations_change_trust.js.html b/js-stellar-base_src_operations_change_trust.js.html index 75045d20..c014e06b 100644 --- a/js-stellar-base_src_operations_change_trust.js.html +++ b/js-stellar-base_src_operations_change_trust.js.html @@ -24,7 +24,7 @@
@@ -104,7 +104,7 @@

js-stellar-base/src/operations/change_trust.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_operations_claim_claimable_balance.js.html b/js-stellar-base_src_operations_claim_claimable_balance.js.html index 7c10f703..c0923304 100644 --- a/js-stellar-base_src_operations_claim_claimable_balance.js.html +++ b/js-stellar-base_src_operations_claim_claimable_balance.js.html @@ -24,7 +24,7 @@
@@ -92,7 +92,7 @@

js-stellar-base/src/operations/claim_claimable_balance.js
- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_operations_clawback.js.html b/js-stellar-base_src_operations_clawback.js.html index f0c80075..bd63985b 100644 --- a/js-stellar-base_src_operations_clawback.js.html +++ b/js-stellar-base_src_operations_clawback.js.html @@ -24,7 +24,7 @@
@@ -93,7 +93,7 @@

js-stellar-base/src/operations/clawback.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_operations_clawback_claimable_balance.js.html b/js-stellar-base_src_operations_clawback_claimable_balance.js.html index 364966d1..03e64073 100644 --- a/js-stellar-base_src_operations_clawback_claimable_balance.js.html +++ b/js-stellar-base_src_operations_clawback_claimable_balance.js.html @@ -24,7 +24,7 @@
@@ -88,7 +88,7 @@

js-stellar-base/src/operations/clawback_claimable_balance
- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_operations_create_account.js.html b/js-stellar-base_src_operations_create_account.js.html index 2da3fe52..3250fb4b 100644 --- a/js-stellar-base_src_operations_create_account.js.html +++ b/js-stellar-base_src_operations_create_account.js.html @@ -24,7 +24,7 @@
@@ -88,7 +88,7 @@

js-stellar-base/src/operations/create_account.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_operations_create_claimable_balance.js.html b/js-stellar-base_src_operations_create_claimable_balance.js.html index a450bee1..678f7d09 100644 --- a/js-stellar-base_src_operations_create_claimable_balance.js.html +++ b/js-stellar-base_src_operations_create_claimable_balance.js.html @@ -24,7 +24,7 @@
@@ -118,7 +118,7 @@

js-stellar-base/src/operations/create_claimable_balance.j
- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_operations_create_passive_sell_offer.js.html b/js-stellar-base_src_operations_create_passive_sell_offer.js.html index 23162880..d29e3459 100644 --- a/js-stellar-base_src_operations_create_passive_sell_offer.js.html +++ b/js-stellar-base_src_operations_create_passive_sell_offer.js.html @@ -24,7 +24,7 @@
@@ -94,7 +94,7 @@

js-stellar-base/src/operations/create_passive_sell_offer.
- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_operations_end_sponsoring_future_reserves.js.html b/js-stellar-base_src_operations_end_sponsoring_future_reserves.js.html index 57ea4b34..9e1efd11 100644 --- a/js-stellar-base_src_operations_end_sponsoring_future_reserves.js.html +++ b/js-stellar-base_src_operations_end_sponsoring_future_reserves.js.html @@ -24,7 +24,7 @@
@@ -72,7 +72,7 @@

js-stellar-base/src/operations/end_sponsoring_future_rese
- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_operations_inflation.js.html b/js-stellar-base_src_operations_inflation.js.html index f277afe4..d9c5ecde 100644 --- a/js-stellar-base_src_operations_inflation.js.html +++ b/js-stellar-base_src_operations_inflation.js.html @@ -24,7 +24,7 @@
@@ -67,7 +67,7 @@

js-stellar-base/src/operations/inflation.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_operations_invoke_host_function.js.html b/js-stellar-base_src_operations_invoke_host_function.js.html new file mode 100644 index 00000000..514b0c49 --- /dev/null +++ b/js-stellar-base_src_operations_invoke_host_function.js.html @@ -0,0 +1,114 @@ + + + + + + js-stellar-base/src/operations/invoke_host_function.js - Documentation + + + + + + + + + + + + + + + + + +
+ +

js-stellar-base/src/operations/invoke_host_function.js

+ + + + + + + +
+
+
import xdr from '../xdr';
+
+/**
+ * Invokes a single smart contract function.
+ *
+ * @function
+ * @alias Operation.invokeHostFunction
+ *
+ * @param {object} opts - options object
+ * @param {xdr.HostFunctionArgs} opts.args - parameters to pass to the host
+ *    function being invoked
+ * @param {xdr.ContractAuth[]} [opts.auth] - list of authorizations for the call
+ * @param {string} [opts.source] - an optional source account
+ *
+ * @returns {xdr.Operation} an Invoke Host Function operation
+ *    (xdr.InvokeHostFunctionOp)
+ */
+export function invokeHostFunction(opts) {
+  if (!opts.args) {
+    throw new TypeError(
+      `function arguments ('args') required (got ${JSON.stringify(opts)})`
+    );
+  }
+
+  const hostFn = new xdr.HostFunction({args: opts.args, auth: opts.auth || []});
+  return this.invokeHostFunctions({ source: opts.source, functions: [hostFn] });
+}
+
+/**
+ * Invokes multiple smart contract functions via a single operation.
+ *
+ * @function
+ * @alias Operation.invokeHostFunctions
+ *
+ * @param {object} opts - options for the operation
+ * @param {xdr.HostFunction[]} opts.functions - a list of contract functions to
+ *    invoke in this operation. 
+ * @param {string} [opts.source] - an optional source account
+ *
+ * @returns {xdr.Operation} an Invoke Host Function operation
+ *    (xdr.InvokeHostFunctionOp) with xdr.HostFunction instances corresponding
+ *    to each invocation
+ *
+ */
+export function invokeHostFunctions(opts) {
+  
+  const invokeHostFunctionOp = new xdr.InvokeHostFunctionOp({ functions: opts.functions });
+  const opAttributes = {
+    body: xdr.OperationBody.invokeHostFunction(invokeHostFunctionOp)
+  };
+  this.setSourceAccount(opAttributes, opts);
+
+  return new xdr.Operation(opAttributes);
+}
+
+
+
+ + + + +
+ +
+ +
+ Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme. +
+ + + + + diff --git a/js-stellar-base_src_operations_liquidity_pool_deposit.js.html b/js-stellar-base_src_operations_liquidity_pool_deposit.js.html index 95999d0d..ee92cd21 100644 --- a/js-stellar-base_src_operations_liquidity_pool_deposit.js.html +++ b/js-stellar-base_src_operations_liquidity_pool_deposit.js.html @@ -24,7 +24,7 @@
@@ -112,7 +112,7 @@

js-stellar-base/src/operations/liquidity_pool_deposit.js<
- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_operations_liquidity_pool_withdraw.js.html b/js-stellar-base_src_operations_liquidity_pool_withdraw.js.html index 45311c0f..7090d76a 100644 --- a/js-stellar-base_src_operations_liquidity_pool_withdraw.js.html +++ b/js-stellar-base_src_operations_liquidity_pool_withdraw.js.html @@ -24,7 +24,7 @@
@@ -99,7 +99,7 @@

js-stellar-base/src/operations/liquidity_pool_withdraw.js
- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_operations_manage_buy_offer.js.html b/js-stellar-base_src_operations_manage_buy_offer.js.html index a57a9eb4..f0898c43 100644 --- a/js-stellar-base_src_operations_manage_buy_offer.js.html +++ b/js-stellar-base_src_operations_manage_buy_offer.js.html @@ -24,7 +24,7 @@
@@ -99,7 +99,7 @@

js-stellar-base/src/operations/manage_buy_offer.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_operations_manage_data.js.html b/js-stellar-base_src_operations_manage_data.js.html index ba9dc0b8..8c74db11 100644 --- a/js-stellar-base_src_operations_manage_data.js.html +++ b/js-stellar-base_src_operations_manage_data.js.html @@ -24,7 +24,7 @@
@@ -98,7 +98,7 @@

js-stellar-base/src/operations/manage_data.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_operations_manage_sell_offer.js.html b/js-stellar-base_src_operations_manage_sell_offer.js.html index 0a02789b..47b12b3f 100644 --- a/js-stellar-base_src_operations_manage_sell_offer.js.html +++ b/js-stellar-base_src_operations_manage_sell_offer.js.html @@ -24,7 +24,7 @@
@@ -99,7 +99,7 @@

js-stellar-base/src/operations/manage_sell_offer.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_operations_path_payment_strict_receive.js.html b/js-stellar-base_src_operations_path_payment_strict_receive.js.html index 9bfdbd27..f1357802 100644 --- a/js-stellar-base_src_operations_path_payment_strict_receive.js.html +++ b/js-stellar-base_src_operations_path_payment_strict_receive.js.html @@ -24,7 +24,7 @@
@@ -117,7 +117,7 @@

js-stellar-base/src/operations/path_payment_strict_receiv
- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_operations_path_payment_strict_send.js.html b/js-stellar-base_src_operations_path_payment_strict_send.js.html index d68134c8..ded3995d 100644 --- a/js-stellar-base_src_operations_path_payment_strict_send.js.html +++ b/js-stellar-base_src_operations_path_payment_strict_send.js.html @@ -24,7 +24,7 @@
@@ -116,7 +116,7 @@

js-stellar-base/src/operations/path_payment_strict_send.j
- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_operations_payment.js.html b/js-stellar-base_src_operations_payment.js.html index 3179c210..3ab0048d 100644 --- a/js-stellar-base_src_operations_payment.js.html +++ b/js-stellar-base_src_operations_payment.js.html @@ -24,7 +24,7 @@
@@ -96,7 +96,7 @@

js-stellar-base/src/operations/payment.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_operations_revoke_sponsorship.js.html b/js-stellar-base_src_operations_revoke_sponsorship.js.html index ad2e5c22..fb275720 100644 --- a/js-stellar-base_src_operations_revoke_sponsorship.js.html +++ b/js-stellar-base_src_operations_revoke_sponsorship.js.html @@ -24,7 +24,7 @@
@@ -368,7 +368,7 @@

js-stellar-base/src/operations/revoke_sponsorship.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_operations_set_options.js.html b/js-stellar-base_src_operations_set_options.js.html index 99628e0b..97e72a7f 100644 --- a/js-stellar-base_src_operations_set_options.js.html +++ b/js-stellar-base_src_operations_set_options.js.html @@ -24,7 +24,7 @@
@@ -238,7 +238,7 @@

js-stellar-base/src/operations/set_options.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_operations_set_trustline_flags.js.html b/js-stellar-base_src_operations_set_trustline_flags.js.html index de08c9e3..436cc00d 100644 --- a/js-stellar-base_src_operations_set_trustline_flags.js.html +++ b/js-stellar-base_src_operations_set_trustline_flags.js.html @@ -24,7 +24,7 @@
@@ -137,7 +137,7 @@

js-stellar-base/src/operations/set_trustline_flags.js

- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_signerkey.js.html b/js-stellar-base_src_signerkey.js.html index af9e1613..c5a8e00d 100644 --- a/js-stellar-base_src_signerkey.js.html +++ b/js-stellar-base_src_signerkey.js.html @@ -24,7 +24,7 @@
@@ -143,7 +143,7 @@

js-stellar-base/src/signerkey.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_signing.js.html b/js-stellar-base_src_signing.js.html index 055339a3..5acbfd74 100644 --- a/js-stellar-base_src_signing.js.html +++ b/js-stellar-base_src_signing.js.html @@ -24,7 +24,7 @@
@@ -158,7 +158,7 @@

js-stellar-base/src/signing.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_strkey.js.html b/js-stellar-base_src_strkey.js.html index 69f01200..2898fb86 100644 --- a/js-stellar-base_src_strkey.js.html +++ b/js-stellar-base_src_strkey.js.html @@ -24,7 +24,7 @@
@@ -54,7 +54,8 @@

js-stellar-base/src/strkey.js

med25519PublicKey: 12 << 3, // M preAuthTx: 19 << 3, // T sha256Hash: 23 << 3, // X - signedPayload: 15 << 3 // P + signedPayload: 15 << 3, // P + contract: 2 << 3 // C }; const strkeyTypes = { @@ -63,7 +64,8 @@

js-stellar-base/src/strkey.js

M: 'med25519PublicKey', T: 'preAuthTx', X: 'sha256Hash', - P: 'signedPayload' + P: 'signedPayload', + C: 'contract' }; /** @@ -221,6 +223,33 @@

js-stellar-base/src/strkey.js

return isValid('signedPayload', address); } + /** + * Encodes raw data to strkey contract (C...). + * @param {Buffer} data data to encode + * @returns {string} + */ + static encodeContract(data) { + return encodeCheck('contract', data); + } + + /** + * Decodes strkey contract (C...) to raw data. + * @param {string} address address to decode + * @returns {Buffer} + */ + static decodeContract(address) { + return decodeCheck('contract', address); + } + + /** + * Checks validity of alleged contract (C...) strkey address. + * @param {string} address signer key to check + * @returns {boolean} + */ + static isValidContract(address) { + return isValid('contract', address); + } + static getVersionByteForPrefix(address) { return strkeyTypes[address[0]]; } @@ -249,7 +278,8 @@

js-stellar-base/src/strkey.js

case 'ed25519PublicKey': // falls through case 'ed25519SecretSeed': // falls through case 'preAuthTx': // falls through - case 'sha256Hash': + case 'sha256Hash': // falls through + case 'contract': if (encoded.length !== 56) { return false; } @@ -283,7 +313,8 @@

js-stellar-base/src/strkey.js

case 'ed25519PublicKey': // falls through case 'ed25519SecretSeed': // falls through case 'preAuthTx': // falls through - case 'sha256Hash': + case 'sha256Hash': // falls through + case 'contract': return decoded.length === 32; case 'med25519PublicKey': @@ -381,7 +412,7 @@

js-stellar-base/src/strkey.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_transaction.js.html b/js-stellar-base_src_transaction.js.html index 04e7e79e..09637273 100644 --- a/js-stellar-base_src_transaction.js.html +++ b/js-stellar-base_src_transaction.js.html @@ -24,7 +24,7 @@
@@ -421,7 +421,7 @@

js-stellar-base/src/transaction.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_transaction_base.js.html b/js-stellar-base_src_transaction_base.js.html index 7246554a..67ced364 100644 --- a/js-stellar-base_src_transaction_base.js.html +++ b/js-stellar-base_src_transaction_base.js.html @@ -24,7 +24,7 @@
@@ -110,6 +110,17 @@

js-stellar-base/src/transaction_base.js

* @returns {void} */ sign(...keypairs) { + // Temporary warning for contract auth-next signatures not being supported. + const requiresContractSignatures = (this.operations || []).some( + (op) => + op.type === 'invokeHostFunction' && + op.functions.some((fn) => fn.auth().some((a) => a.addressWithNonce())) + ); + if (requiresContractSignatures) { + throw new Error( + 'Soroban contract signatures are not supported in this version of the SDK.' + ); + } const txHash = this.hash(); keypairs.forEach((kp) => { const sig = kp.signDecorated(txHash); @@ -268,7 +279,7 @@

js-stellar-base/src/transaction_base.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_transaction_builder.js.html b/js-stellar-base_src_transaction_builder.js.html index eec103c1..545eaeb5 100644 --- a/js-stellar-base_src_transaction_builder.js.html +++ b/js-stellar-base_src_transaction_builder.js.html @@ -24,7 +24,7 @@
@@ -151,6 +151,12 @@

js-stellar-base/src/transaction_builder.js

* @param {string} [opts.networkPassphrase] passphrase of the * target Stellar network (e.g. "Public Global Stellar Network ; September * 2015" for the pubnet) + * @param {xdr.SorobanTransactionData | string} [opts.sorobanData] - an optional xdr instance of SorobanTransactionData + * to be set as .Transaction.Ext.SorobanData. It can be xdr object or base64 string. + * For non-contract(non-Soroban) transactions, this has no effect. + * In the case of Soroban transactions, SorobanTransactionData can be obtained from a prior simulation of + * the transaction with a contract invocation and provides necessary resource estimations. + * */ export class TransactionBuilder { constructor(sourceAccount, opts = {}) { @@ -174,6 +180,7 @@

js-stellar-base/src/transaction_builder.js

this.extraSigners = clone(opts.extraSigners) || null; this.memo = opts.memo || Memo.none(); this.networkPassphrase = opts.networkPassphrase || null; + this.sorobanData = unmarshalSorobanData(opts.sorobanData); } /** @@ -479,6 +486,24 @@

js-stellar-base/src/transaction_builder.js

return this; } + /** + * Set the {SorobanTransactionData}. For non-contract(non-Soroban) transactions, + * this setting has no effect. + * In the case of Soroban transactions, set to an instance of + * SorobanTransactionData. This can typically be obtained from the simulation + * response based on a transaction with a InvokeHostFunctionOp. + * It provides necessary resource estimations for contract invocation. + * + * @param {xdr.SorobanTransactionData | string} sorobanData the SorobanTransactionData as xdr object or base64 string + * to be set as Transaction.Ext.SorobanData. + * + * @returns {TransactionBuilder} + */ + setSorobanData(sorobanData) { + this.sorobanData = unmarshalSorobanData(sorobanData); + return this; + } + /** * This will build the transaction. * It will also increment the source account's sequence number by 1. @@ -558,7 +583,18 @@

js-stellar-base/src/transaction_builder.js

} attrs.sourceAccount = decodeAddressToMuxedAccount(this.source.accountId()); - attrs.ext = new xdr.TransactionExt(0); + + + // TODO - remove this workaround for TransactionExt ts constructor + // and use the typescript generated static factory method once fixed + // https://github.com/stellar/dts-xdr/issues/5 + if (this.sorobanData) { + // @ts-ignore + attrs.ext = new xdr.TransactionExt(1, this.sorobanData); + } else { + // @ts-ignore + attrs.ext = new xdr.TransactionExt(0, xdr.Void); + } const xtx = new xdr.Transaction(attrs); xtx.operations(this.operations); @@ -716,6 +752,20 @@

js-stellar-base/src/transaction_builder.js

// eslint-disable-next-line no-restricted-globals return d instanceof Date && !isNaN(d); } + +/** + * local helper function to convert SorobanTransactionData from + * base64 string or xdr object. + * @param {string | xdr.SorobanTransactionData} sorobanData the soroban transaction data + * @returns {xdr.SorobanTransactionData} + */ +function unmarshalSorobanData(sorobanData) { + if (typeof sorobanData === 'string') { + const buffer = Buffer.from(sorobanData, 'base64'); + sorobanData = xdr.SorobanTransactionData.fromXDR(buffer); + } + return sorobanData; + } @@ -728,7 +778,7 @@

js-stellar-base/src/transaction_builder.js


- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/js-stellar-base_src_util_decode_encode_muxed_account.js.html b/js-stellar-base_src_util_decode_encode_muxed_account.js.html index 8db91d5b..df2081aa 100644 --- a/js-stellar-base_src_util_decode_encode_muxed_account.js.html +++ b/js-stellar-base_src_util_decode_encode_muxed_account.js.html @@ -24,7 +24,7 @@
@@ -177,7 +177,7 @@

js-stellar-base/src/util/decode_encode_muxed_account.js
- Generated by JSDoc 3.6.11 on Fri Apr 28 2023 17:32:02 GMT+0000 (Coordinated Universal Time) using the Minami theme. + Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme.
diff --git a/lib_axios.js.html b/lib_axios.js.html new file mode 100644 index 00000000..6c080775 --- /dev/null +++ b/lib_axios.js.html @@ -0,0 +1,132 @@ + + + + + + lib/axios.js - Documentation + + + + + + + + + + + + + + + + + +
+ +

lib/axios.js

+ + + + + + + +
+
+
"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+  value: true
+});
+exports.default = exports.SERVER_TIME_MAP = void 0;
+exports.getCurrentServerTime = getCurrentServerTime;
+var _axios = _interopRequireDefault(require("axios"));
+var _urijs = _interopRequireDefault(require("urijs"));
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+/* tslint:disable-next-line:no-var-requires */
+var version = require("../package.json").version;
+/**
+ * keep a local map of server times
+ * (export this purely for testing purposes)
+ *
+ * each entry will map the server domain to the last-known time and the local
+ * time it was recorded, ex:
+ *
+ *     "localhost:8000": {
+ *       serverTime: 1552513039,
+ *       localTimeRecorded: 1552513052
+ *     }
+ */
+var SERVER_TIME_MAP = {};
+exports.SERVER_TIME_MAP = SERVER_TIME_MAP;
+var AxiosClient = _axios.default.create({
+  headers: {
+    "X-Client-Name": "js-soroban-client",
+    "X-Client-Version": version
+  }
+});
+function _toSeconds(ms) {
+  return Math.floor(ms / 1000);
+}
+AxiosClient.interceptors.response.use(function interceptorHorizonResponse(response) {
+  var hostname = (0, _urijs.default)(response.config.url).hostname();
+  var serverTime = _toSeconds(Date.parse(response.headers.date));
+  var localTimeRecorded = _toSeconds(new Date().getTime());
+  if (!isNaN(serverTime)) {
+    SERVER_TIME_MAP[hostname] = {
+      serverTime: serverTime,
+      localTimeRecorded: localTimeRecorded
+    };
+  }
+  return response;
+});
+var _default = AxiosClient;
+/**
+ * Given a hostname, get the current time of that server (i.e., use the last-
+ * recorded server time and offset it by the time since then.) If there IS no
+ * recorded server time, or it's been 5 minutes since the last, return null.
+ * @param {string} hostname Hostname of a Soroban-RPC server.
+ * @returns {number} The UNIX timestamp (in seconds, not milliseconds)
+ * representing the current time on that server, or `null` if we don't have
+ * a record of that time.
+ */
+exports.default = _default;
+function getCurrentServerTime(hostname) {
+  var entry = SERVER_TIME_MAP[hostname];
+  if (!entry || !entry.localTimeRecorded || !entry.serverTime) {
+    return null;
+  }
+  var serverTime = entry.serverTime,
+    localTimeRecorded = entry.localTimeRecorded;
+  var currentTime = _toSeconds(new Date().getTime());
+
+  // if it's been more than 5 minutes from the last time, then null it out
+  if (currentTime - localTimeRecorded > 60 * 5) {
+    return null;
+  }
+  return currentTime - localTimeRecorded + serverTime;
+}
+
+
+ + + + +
+ +
+ +
+ Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme. +
+ + + + + diff --git a/lib_jsonrpc.js.html b/lib_jsonrpc.js.html new file mode 100644 index 00000000..c693b8d6 --- /dev/null +++ b/lib_jsonrpc.js.html @@ -0,0 +1,158 @@ + + + + + + lib/jsonrpc.js - Documentation + + + + + + + + + + + + + + + + + +
+ +

lib/jsonrpc.js

+ + + + + + + +
+
+
"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+  value: true
+});
+exports.post = post;
+exports.postObject = postObject;
+var _axios = _interopRequireDefault(require("./axios"));
+var _utils = require("./utils");
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
+function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
+function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
+function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
+/**
+ * Sends the jsonrpc 'params' as an array.
+ */
+function post(_x, _x2) {
+  return _post.apply(this, arguments);
+}
+/**
+ * Sends the jsonrpc 'params' as the single 'param' obj, no array wrapper is applied.
+ */
+function _post() {
+  _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url, method) {
+    var _len,
+      params,
+      _key,
+      response,
+      _response$data,
+      _args = arguments;
+    return _regeneratorRuntime().wrap(function _callee$(_context) {
+      while (1) switch (_context.prev = _context.next) {
+        case 0:
+          for (_len = _args.length, params = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
+            params[_key - 2] = _args[_key];
+          }
+          if (params && params.length < 1) {
+            params = null;
+          }
+          _context.next = 4;
+          return _axios.default.post(url, {
+            jsonrpc: "2.0",
+            // TODO: Generate a unique request id
+            id: 1,
+            method: method,
+            params: params
+          });
+        case 4:
+          response = _context.sent;
+          if (!(0, _utils.hasOwnProperty)(response.data, "error")) {
+            _context.next = 9;
+            break;
+          }
+          throw response.data.error;
+        case 9:
+          return _context.abrupt("return", (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.result);
+        case 10:
+        case "end":
+          return _context.stop();
+      }
+    }, _callee);
+  }));
+  return _post.apply(this, arguments);
+}
+function postObject(_x3, _x4, _x5) {
+  return _postObject.apply(this, arguments);
+}
+function _postObject() {
+  _postObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(url, method, param) {
+    var response, _response$data2;
+    return _regeneratorRuntime().wrap(function _callee2$(_context2) {
+      while (1) switch (_context2.prev = _context2.next) {
+        case 0:
+          _context2.next = 2;
+          return _axios.default.post(url, {
+            jsonrpc: "2.0",
+            // TODO: Generate a unique request id
+            id: 1,
+            method: method,
+            params: param
+          });
+        case 2:
+          response = _context2.sent;
+          if (!(0, _utils.hasOwnProperty)(response.data, "error")) {
+            _context2.next = 7;
+            break;
+          }
+          throw response.data.error;
+        case 7:
+          return _context2.abrupt("return", (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.result);
+        case 8:
+        case "end":
+          return _context2.stop();
+      }
+    }, _callee2);
+  }));
+  return _postObject.apply(this, arguments);
+}
+
+
+ + + + +
+ +
+ +
+ Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme. +
+ + + + + diff --git a/lib_server.js.html b/lib_server.js.html new file mode 100644 index 00000000..5e95c38b --- /dev/null +++ b/lib_server.js.html @@ -0,0 +1,888 @@ + + + + + + lib/server.js - Documentation + + + + + + + + + + + + + + + + + +
+ +

lib/server.js

+ + + + + + + +
+
+
"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+  value: true
+});
+exports.Server = exports.SUBMIT_TRANSACTION_TIMEOUT = void 0;
+var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
+var _merge = _interopRequireDefault(require("lodash/merge"));
+var _stellarBase = require("stellar-base");
+var _urijs = _interopRequireDefault(require("urijs"));
+var _axios = _interopRequireDefault(require("./axios"));
+var jsonrpc = _interopRequireWildcard(require("./jsonrpc"));
+var _transaction = require("./transaction");
+function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
+function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
+function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
+function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
+function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
+function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
+function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
+function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
+function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
+function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
+function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
+function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
+function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
+function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
+function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
+function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
+function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /* tslint:disable:variable-name no-namespace */
+var SUBMIT_TRANSACTION_TIMEOUT = 60 * 1000;
+exports.SUBMIT_TRANSACTION_TIMEOUT = SUBMIT_TRANSACTION_TIMEOUT;
+/**
+ * Server handles the network connection to a [Soroban-RPC](https://soroban.stellar.org/docs)
+ * instance and exposes an interface for requests to that instance.
+ * @constructor
+ * @param {string} serverURL Soroban-RPC Server URL (ex. `http://localhost:8000/soroban/rpc`).
+ * @param {object} [opts] Options object
+ * @param {boolean} [opts.allowHttp] - Allow connecting to http servers, default: `false`. This must be set to false in production deployments! You can also use {@link Config} class to set this globally.
+ * @param {string} [opts.appName] - Allow set custom header `X-App-Name`, default: `undefined`.
+ * @param {string} [opts.appVersion] - Allow set custom header `X-App-Version`, default: `undefined`.
+ */
+var Server = /*#__PURE__*/function () {
+  /**
+   * serverURL Soroban-RPC Server URL (ex. `http://localhost:8000/soroban/rpc`).
+   */
+
+  function Server(serverURL) {
+    var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+    _classCallCheck(this, Server);
+    this.serverURL = (0, _urijs.default)(serverURL);
+    var customHeaders = {};
+    if (opts.appName) {
+      customHeaders["X-App-Name"] = opts.appName;
+    }
+    if (opts.appVersion) {
+      customHeaders["X-App-Version"] = opts.appVersion;
+    }
+    if (!(0, _isEmpty.default)(customHeaders)) {
+      _axios.default.interceptors.request.use(function (config) {
+        // merge the custom headers with an existing headers
+        config.headers = (0, _merge.default)(customHeaders, config.headers);
+        return config;
+      });
+    }
+    if (this.serverURL.protocol() !== "https" && !opts.allowHttp) {
+      throw new Error("Cannot connect to insecure soroban-rpc server");
+    }
+  }
+
+  /**
+   * Fetch a minimal set of current info about a Stellar account.
+   *
+   * Needed to get the current sequence number for the account so you can build
+   * a successful transaction with {@link TransactionBuilder}.
+   *
+   * @example
+   * server.getAccount("GBZC6Y2Y7Q3ZQ2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4").then(account => {
+   *   console.log("sequence:", account.sequence);
+   * });
+   *
+   * @param {string} address - The public address of the account to load.
+   * @returns {Promise<Account>} Returns a promise to the {@link Account} object with populated sequence number.
+   */
+  _createClass(Server, [{
+    key: "getAccount",
+    value: function () {
+      var _getAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(address) {
+        var _yield$jsonrpc$post, ledgerEntryData, accountEntry, _accountEntry$seqNum, high, low, sequence;
+        return _regeneratorRuntime().wrap(function _callee$(_context) {
+          while (1) switch (_context.prev = _context.next) {
+            case 0:
+              _context.next = 2;
+              return jsonrpc.post(this.serverURL.toString(), "getLedgerEntry", _stellarBase.xdr.LedgerKey.account(new _stellarBase.xdr.LedgerKeyAccount({
+                accountId: _stellarBase.xdr.PublicKey.publicKeyTypeEd25519(_stellarBase.StrKey.decodeEd25519PublicKey(address))
+              })).toXDR("base64"));
+            case 2:
+              _yield$jsonrpc$post = _context.sent;
+              ledgerEntryData = _yield$jsonrpc$post.xdr;
+              accountEntry = _stellarBase.xdr.LedgerEntryData.fromXDR(ledgerEntryData, "base64").account();
+              _accountEntry$seqNum = accountEntry.seqNum(), high = _accountEntry$seqNum.high, low = _accountEntry$seqNum.low;
+              sequence = BigInt(high) * BigInt(4294967296) + BigInt(low);
+              return _context.abrupt("return", new _stellarBase.Account(address, sequence.toString()));
+            case 8:
+            case "end":
+              return _context.stop();
+          }
+        }, _callee, this);
+      }));
+      function getAccount(_x) {
+        return _getAccount.apply(this, arguments);
+      }
+      return getAccount;
+    }()
+    /**
+     * General node health check.
+     *
+     * @example
+     * server.getHealth().then(health => {
+     *   console.log("status:", health.status);
+     * });
+     *
+     * @returns {Promise<SorobanRpc.GetHealthResponse>} Returns a promise to the {@link SorobanRpc.GetHealthResponse} object with the status of the server ("healthy").
+     */
+  }, {
+    key: "getHealth",
+    value: function () {
+      var _getHealth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
+        return _regeneratorRuntime().wrap(function _callee2$(_context2) {
+          while (1) switch (_context2.prev = _context2.next) {
+            case 0:
+              _context2.next = 2;
+              return jsonrpc.post(this.serverURL.toString(), "getHealth");
+            case 2:
+              return _context2.abrupt("return", _context2.sent);
+            case 3:
+            case "end":
+              return _context2.stop();
+          }
+        }, _callee2, this);
+      }));
+      function getHealth() {
+        return _getHealth.apply(this, arguments);
+      }
+      return getHealth;
+    }()
+    /**
+     * Reads the current value of contract data ledger entries directly.
+     *
+     * @example
+     * const contractId = "0000000000000000000000000000000000000000000000000000000000000001";
+     * const key = xdr.ScVal.scvSymbol("counter");
+     * server.getContractData(contractId, key).then(data => {
+     *   console.log("value:", data.xdr);
+     *   console.log("lastModified:", data.lastModifiedLedgerSeq);
+     *   console.log("latestLedger:", data.latestLedger);
+     * });
+     *
+     * Allows you to directly inspect the current state of a contract. This is a backup way to access your contract data which may not be available via events or simulateTransaction.
+     *
+     * @param {string} contractId - The contract ID containing the data to load. Encoded as a hex string.
+     * @param {xdr.ScVal} key - The key of the contract data to load.
+     * @returns {Promise<SorobanRpc.GetLedgerEntryResponse>} Returns a promise to the {@link SorobanRpc.GetLedgerEntryResponse} object with the current value.
+     */
+  }, {
+    key: "getContractData",
+    value: function () {
+      var _getContractData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(contractId, key) {
+        return _regeneratorRuntime().wrap(function _callee3$(_context3) {
+          while (1) switch (_context3.prev = _context3.next) {
+            case 0:
+              _context3.next = 2;
+              return jsonrpc.post(this.serverURL.toString(), "getLedgerEntry", _stellarBase.xdr.LedgerKey.contractData(new _stellarBase.xdr.LedgerKeyContractData({
+                contractId: Buffer.from(contractId, "hex"),
+                key: key
+              })).toXDR("base64"));
+            case 2:
+              return _context3.abrupt("return", _context3.sent);
+            case 3:
+            case "end":
+              return _context3.stop();
+          }
+        }, _callee3, this);
+      }));
+      function getContractData(_x2, _x3) {
+        return _getContractData.apply(this, arguments);
+      }
+      return getContractData;
+    }()
+    /**
+     * Reads the current value of ledger entries directly.
+     *
+     * Allows you to directly inspect the current state of a contract,
+     * contract's code, or any other ledger entry. This is a backup way to access
+     * your contract data which may not be available via events or
+     * simulateTransaction.
+     *
+     * To fetch contract wasm byte-code, use the ContractCode ledger entry key.
+     *
+     * @example
+     * const contractId = "0000000000000000000000000000000000000000000000000000000000000001";
+     * const key = xdr.LedgerKey.contractData(new xdr.LedgerKeyContractData({
+     *   contractId: Buffer.from(contractId, "hex"),
+     *   key: xdr.ScVal.scvSymbol("counter"),
+     * }));
+     * server.getLedgerEntry(key).then(data => {
+     *   console.log("value:", data.xdr);
+     *   console.log("lastModified:", data.lastModifiedLedgerSeq);
+     *   console.log("latestLedger:", data.latestLedger);
+     * });
+     *
+     * @param {xdr.ScVal} key - The key of the contract data to load.
+     * @returns {Promise<SorobanRpc.GetLedgerEntryResponse>} Returns a promise to the {@link SorobanRpc.GetLedgerEntryResponse} object with the current value.
+     */
+  }, {
+    key: "getLedgerEntry",
+    value: function () {
+      var _getLedgerEntry = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(key) {
+        return _regeneratorRuntime().wrap(function _callee4$(_context4) {
+          while (1) switch (_context4.prev = _context4.next) {
+            case 0:
+              _context4.next = 2;
+              return jsonrpc.post(this.serverURL.toString(), "getLedgerEntry", key.toXDR("base64"));
+            case 2:
+              return _context4.abrupt("return", _context4.sent);
+            case 3:
+            case "end":
+              return _context4.stop();
+          }
+        }, _callee4, this);
+      }));
+      function getLedgerEntry(_x4) {
+        return _getLedgerEntry.apply(this, arguments);
+      }
+      return getLedgerEntry;
+    }()
+    /**
+     * Fetch the details of a submitted transaction.
+     *
+     * When submitting a transaction, clients should poll this to tell when the
+     * transaction has completed.
+     *
+     * @example
+     * const transactionHash = "c4515e3bdc0897f21cc5dbec8c82cf0a936d4741cb74a8e158eb51b9fb00411a";
+     * server.getTransaction(transactionHash).then(transaction => {
+     *   console.log("status:", transaction.status);
+     *   console.log("envelopeXdr:", transaction.envelopeXdr);
+     *   console.log("resultMetaXdr:", transaction.resultMetaXdr);
+     *   console.log("resultXdr:", transaction.resultXdr);
+     * });
+     *
+     * @param {string} hash - The hash of the transaction to check. Encoded as a
+     *    hex string.
+     *
+     * @returns {Promise<SorobanRpc.GetTransactionResponse>} Returns a
+     *    promise to the {@link SorobanRpc.GetTransactionResponse} object
+     *    with the status, result, and other details about the transaction.
+     */
+  }, {
+    key: "getTransaction",
+    value: function () {
+      var _getTransaction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(hash) {
+        return _regeneratorRuntime().wrap(function _callee5$(_context5) {
+          while (1) switch (_context5.prev = _context5.next) {
+            case 0:
+              _context5.next = 2;
+              return jsonrpc.post(this.serverURL.toString(), "getTransaction", hash);
+            case 2:
+              return _context5.abrupt("return", _context5.sent);
+            case 3:
+            case "end":
+              return _context5.stop();
+          }
+        }, _callee5, this);
+      }));
+      function getTransaction(_x5) {
+        return _getTransaction.apply(this, arguments);
+      }
+      return getTransaction;
+    }()
+    /**
+     * Fetches all events that match a given set of filters.
+     *
+     * The given filters (see {@link SorobanRpc.EventFilter} for detailed fields)
+     * are combined only in a logical OR fashion, and all of the fields in each
+     * filter are optional.
+     *
+     * To page through events, use the `pagingToken` field on the relevant
+     * {@link SorobanRpc.EventResponse} object to set the `cursor` parameter.
+     *
+     * @example
+     * server.getEvents({
+     *    startLedger: "1000",
+     *    filters: [
+     *     {
+     *      type: "contract",
+     *      contractIds: [ "deadb33f..." ],
+     *      topics: [[ "AAAABQAAAAh0cmFuc2Zlcg==", "AAAAAQB6Mcc=", "*" ]]
+     *     }, {
+     *      type: "system",
+     *      contractIds: [ "...c4f3b4b3..." ],
+     *      topics: [[ "*" ], [ "*", "AAAAAQB6Mcc=" ]]
+     *     }, {
+     *      contractIds: [ "...c4f3b4b3..." ],
+     *      topics: [[ "AAAABQAAAAh0cmFuc2Zlcg==" ]]
+     *     }, {
+     *      type: "diagnostic",
+     *      topics: [[ "AAAAAQB6Mcc=" ]]
+     *     }
+     *    ],
+     *    limit: 10,
+     * });
+     *
+     * @returns {Promise<SorobanRpc.GetEventsResponse>} a promise to the
+     *    {@link SorobanRpc.GetEventsResponse} object containing a paginatable set
+     *    of the events matching the given event filters.
+     */
+  }, {
+    key: "getEvents",
+    value: function () {
+      var _getEvents = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(request) {
+        var _request$filters;
+        return _regeneratorRuntime().wrap(function _callee6$(_context6) {
+          while (1) switch (_context6.prev = _context6.next) {
+            case 0:
+              _context6.next = 2;
+              return jsonrpc.postObject(this.serverURL.toString(), "getEvents", _objectSpread({
+                filters: (_request$filters = request.filters) !== null && _request$filters !== void 0 ? _request$filters : [],
+                pagination: _objectSpread(_objectSpread({}, request.cursor && {
+                  cursor: request.cursor
+                }), request.limit && {
+                  limit: request.limit
+                })
+              }, request.startLedger && {
+                startLedger: String(request.startLedger)
+              }));
+            case 2:
+              return _context6.abrupt("return", _context6.sent);
+            case 3:
+            case "end":
+              return _context6.stop();
+          }
+        }, _callee6, this);
+      }));
+      function getEvents(_x6) {
+        return _getEvents.apply(this, arguments);
+      }
+      return getEvents;
+    }()
+    /**
+     * Fetches metadata about the network which Soroban-RPC is connected to.
+     *
+     * @example
+     * server.getNetwork().then(network => {
+     *   console.log("friendbotUrl:", network.friendbotUrl);
+     *   console.log("passphrase:", network.passphrase);
+     *   console.log("protocolVersion:", network.protocolVersion);
+     * });
+     *
+     * @returns {Promise<SorobanRpc.GetNetworkResponse>} a promise to the
+     *    {@link SorobanRpc.GetNetworkResponse} object containing metadata
+     *    about the current network this soroban-rpc server is connected to.
+     */
+  }, {
+    key: "getNetwork",
+    value: function () {
+      var _getNetwork = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
+        return _regeneratorRuntime().wrap(function _callee7$(_context7) {
+          while (1) switch (_context7.prev = _context7.next) {
+            case 0:
+              _context7.next = 2;
+              return jsonrpc.post(this.serverURL.toString(), "getNetwork");
+            case 2:
+              return _context7.abrupt("return", _context7.sent);
+            case 3:
+            case "end":
+              return _context7.stop();
+          }
+        }, _callee7, this);
+      }));
+      function getNetwork() {
+        return _getNetwork.apply(this, arguments);
+      }
+      return getNetwork;
+    }()
+    /**
+     * Fetches the latest ledger meta info from network which Soroban-RPC is connected to.
+     *
+     * @example
+     * server.getLatestLedger().then(response => {
+     *   console.log("hash:", response.id);
+     *   console.log("sequence:", response.sequence);
+     *   console.log("protocolVersion:", response.protocolVersion);
+     * });
+     *
+     * @returns {Promise<SorobanRpc.GetLatestLedgerResponse>} a promise to the
+     *    {@link SorobanRpc.GetLatestLedgerResponse} object containing metadata
+     *    about the latest ledger from network soroban-rpc server is connected to.
+     */
+  }, {
+    key: "getLatestLedger",
+    value: function () {
+      var _getLatestLedger = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
+        return _regeneratorRuntime().wrap(function _callee8$(_context8) {
+          while (1) switch (_context8.prev = _context8.next) {
+            case 0:
+              _context8.next = 2;
+              return jsonrpc.post(this.serverURL.toString(), "getLatestLedger");
+            case 2:
+              return _context8.abrupt("return", _context8.sent);
+            case 3:
+            case "end":
+              return _context8.stop();
+          }
+        }, _callee8, this);
+      }));
+      function getLatestLedger() {
+        return _getLatestLedger.apply(this, arguments);
+      }
+      return getLatestLedger;
+    }()
+    /**
+     * Submit a trial contract invocation to get back return values, expected
+     * ledger footprint, expected authorizations, and expected costs.
+     *
+     * @example
+     * const contractId = '0000000000000000000000000000000000000000000000000000000000000001';
+     * const contract = new SorobanClient.Contract(contractId);
+     *
+     * // Right now, this is just the default fee for this example.
+     * const fee = 100;
+     *
+     * const transaction = new SorobanClient.TransactionBuilder(account, {
+     *     fee,
+     *     // Uncomment the following line to build transactions for the live network. Be
+     *     // sure to also change the horizon hostname.
+     *     // networkPassphrase: SorobanClient.Networks.PUBLIC,
+     *     networkPassphrase: SorobanClient.Networks.STANDALONE
+     *   })
+     *   // Add a contract.increment soroban contract invocation operation
+     *   .addOperation(contract.call("increment"))
+     *   // Make this transaction valid for the next 30 seconds only
+     *   .setTimeout(30)
+     *   // Uncomment to add a memo (https://developers.stellar.org/docs/glossary/transactions/)
+     *   // .addMemo(SorobanClient.Memo.text('Hello world!'))
+     *   .build();
+     *
+     * // Sign this transaction with the secret key
+     * // NOTE: signing is transaction is network specific. Test network transactions
+     * // won't work in the public network. To switch networks, use the Network object
+     * // as explained above (look for SorobanClient.Network).
+     * const sourceKeypair = SorobanClient.Keypair.fromSecret(sourceSecretKey);
+     * transaction.sign(sourceKeypair);
+     *
+     * server.simulateTransaction(transaction).then(sim => {
+     *   console.log("cost:", sim.cost);
+     *   console.log("results:", sim.results);
+     *   console.log("error:", sim.error);
+     *   console.log("latestLedger:", sim.latestLedger);
+     * });
+     *
+     * @param {Transaction | FeeBumpTransaction} transaction - The transaction to
+     *    simulate. It should include exactly one operation, which must be a
+     *    {@link InvokeHostFunctionOp}. Any provided footprint will be ignored.
+     * @returns {Promise<SorobanRpc.SimulateTransactionResponse>} Returns a
+     *    promise to the {@link SorobanRpc.SimulateTransactionResponse} object
+     *    with the cost, result, footprint, auth, and error of the transaction.
+     */
+  }, {
+    key: "simulateTransaction",
+    value: function () {
+      var _simulateTransaction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(transaction) {
+        return _regeneratorRuntime().wrap(function _callee9$(_context9) {
+          while (1) switch (_context9.prev = _context9.next) {
+            case 0:
+              _context9.next = 2;
+              return jsonrpc.post(this.serverURL.toString(), "simulateTransaction", transaction.toXDR());
+            case 2:
+              return _context9.abrupt("return", _context9.sent);
+            case 3:
+            case "end":
+              return _context9.stop();
+          }
+        }, _callee9, this);
+      }));
+      function simulateTransaction(_x7) {
+        return _simulateTransaction.apply(this, arguments);
+      }
+      return simulateTransaction;
+    }()
+    /**
+     * Submit a trial contract invocation, first run a simulation of the contract
+     * invocation as defined on the incoming transaction, and apply the results
+     * to a new copy of the transaction which is then returned. Setting the ledger
+     * footprint and authorization, so the resulting transaction is ready for signing & sending.
+     *
+     * The returned transaction will also have an updated fee that is the sum of fee set
+     * on incoming transaction with the contract resource fees estimated from simulation. It is
+     * adviseable to check the fee on returned transaction and validate or take appropriate
+     * measures for interaction with user to confirm it is acceptable.
+     *
+     * You can call the {simulateTransaction(transaction)} method directly first if you
+     * want to inspect estimated fees for a given transaction in detail first if that is
+     * of importance.
+     *
+     * @example
+     * const contractId = '0000000000000000000000000000000000000000000000000000000000000001';
+     * const contract = new SorobanClient.Contract(contractId);
+     *
+     * // Right now, this is just the default fee for this example.
+     * const fee = 100;
+     *
+     * const transaction = new SorobanClient.TransactionBuilder(account, {
+     *     fee,
+     *     // Uncomment the following line to build transactions for the live network. Be
+     *     // sure to also change the horizon hostname.
+     *     // networkPassphrase: SorobanClient.Networks.PUBLIC,
+     *     networkPassphrase: SorobanClient.Networks.TESTNET
+     *   })
+     *   // Add a contract.increment soroban contract invocation operation
+     *   .addOperation(contract.call("increment"))
+     *   // Make this transaction valid for the next 30 seconds only
+     *   .setTimeout(30)
+     *   // Uncomment to add a memo (https://developers.stellar.org/docs/glossary/transactions/)
+     *   // .addMemo(SorobanClient.Memo.text('Hello world!'))
+     *   .build();
+     *
+     * preparedTransaction = await server.prepareTransaction(transaction);
+     *
+     * // Sign this transaction with the secret key
+     * // NOTE: signing is transaction is network specific. Test network transactions
+     * // won't work in the public network. To switch networks, use the Network object
+     * // as explained above (look for SorobanClient.Network).
+     * const sourceKeypair = SorobanClient.Keypair.fromSecret(sourceSecretKey);
+     * preparedTransaction.sign(sourceKeypair);
+     *
+     * server.sendTransaction(transaction).then(result => {
+     *   console.log("hash:", result.hash);
+     *   console.log("status:", result.status);
+     *   console.log("errorResultXdr:", result.errorResultXdr);
+     * });
+     *
+     * @param {Transaction | FeeBumpTransaction} transaction - The transaction to
+     *    prepare. It should include exactly one operation, which must be a
+     *    {@link InvokeHostFunctionOp}. Any provided footprint will be overwritten.
+     * @param {string} [networkPassphrase] - Explicitly provide a network
+     *    passphrase. If not passed, the current network passphrase will be requested
+     *    from the server via `getNetwork`.
+     * @returns {Promise<Transaction | FeeBumpTransaction>} Returns a copy of the
+     *    transaction, with the expected ledger footprint and authorizations added
+     *    and the transaction fee will automatically be adjusted to the sum of
+     *    the incoming transaction fee and the contract minimum resource fees
+     *    discovered from the simulation,
+     *
+     */
+  }, {
+    key: "prepareTransaction",
+    value: function () {
+      var _prepareTransaction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(transaction, networkPassphrase) {
+        var _yield$Promise$all, _yield$Promise$all2, passphrase, simResponse;
+        return _regeneratorRuntime().wrap(function _callee10$(_context10) {
+          while (1) switch (_context10.prev = _context10.next) {
+            case 0:
+              _context10.next = 2;
+              return Promise.all([networkPassphrase ? Promise.resolve({
+                passphrase: networkPassphrase
+              }) : this.getNetwork(), this.simulateTransaction(transaction)]);
+            case 2:
+              _yield$Promise$all = _context10.sent;
+              _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
+              passphrase = _yield$Promise$all2[0].passphrase;
+              simResponse = _yield$Promise$all2[1];
+              if (!simResponse.error) {
+                _context10.next = 8;
+                break;
+              }
+              throw simResponse.error;
+            case 8:
+              if (!(!simResponse.results || simResponse.results.length < 1)) {
+                _context10.next = 10;
+                break;
+              }
+              throw new Error("transaction simulation failed");
+            case 10:
+              return _context10.abrupt("return", (0, _transaction.assembleTransaction)(transaction, passphrase, simResponse));
+            case 11:
+            case "end":
+              return _context10.stop();
+          }
+        }, _callee10, this);
+      }));
+      function prepareTransaction(_x8, _x9) {
+        return _prepareTransaction.apply(this, arguments);
+      }
+      return prepareTransaction;
+    }()
+    /**
+     * Submit a real transaction to the Stellar network. This is the only way to
+     * make changes "on-chain". Unlike Horizon, Soroban-RPC does not wait for
+     * transaction completion. It simply validates the transaction and enqueues
+     * it. Clients should call {@link Server#getTransactionStatus} to learn about
+     * transaction success/failure.
+     *
+     * @example
+     * const contractId = '0000000000000000000000000000000000000000000000000000000000000001';
+     * const contract = new SorobanClient.Contract(contractId);
+     *
+     * // Right now, this is just the default fee for this example.
+     * const fee = 100;
+     *
+     * const transaction = new SorobanClient.TransactionBuilder(account, {
+     *     fee,
+     *     // Uncomment the following line to build transactions for the live network. Be
+     *     // sure to also change the horizon hostname.
+     *     // networkPassphrase: SorobanClient.Networks.PUBLIC,
+     *     networkPassphrase: SorobanClient.Networks.STANDALONE
+     *   })
+     *   // Add a contract.increment soroban contract invocation operation
+     *   // Note: For real transactions you will need to include the footprint
+     *   // and auth in the operation, as returned from simulateTransaction.
+     *   .addOperation(contract.call("increment"))
+     *   // Make this transaction valid for the next 30 seconds only
+     *   .setTimeout(30)
+     *   // Uncomment to add a memo (https://developers.stellar.org/docs/glossary/transactions/)
+     *   // .addMemo(SorobanClient.Memo.text('Hello world!'))
+     *   .build();
+     *
+     * // Sign this transaction with the secret key
+     * // NOTE: signing is transaction is network specific. Test network transactions
+     * // won't work in the public network. To switch networks, use the Network object
+     * // as explained above (look for SorobanClient.Network).
+     * const sourceKeypair = SorobanClient.Keypair.fromSecret(sourceSecretKey);
+     * transaction.sign(sourceKeypair);
+     *
+     * server.sendTransaction(transaction).then(result => {
+     *   console.log("hash:", result.hash);
+     *   console.log("status:", result.status);
+     *   console.log("errorResultXdr:", result.errorResultXdr);
+     * });
+     *
+     * @param {Transaction | FeeBumpTransaction} transaction - The transaction to
+     *    submit.
+     * @returns {Promise<SorobanRpc.SendTransactionResponse>} Returns a promise to
+     *    the {@link SorobanRpc.SendTransactionResponse} object with the
+     *    transaction id, status, and any error if available.
+     */
+  }, {
+    key: "sendTransaction",
+    value: function () {
+      var _sendTransaction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(transaction) {
+        return _regeneratorRuntime().wrap(function _callee11$(_context11) {
+          while (1) switch (_context11.prev = _context11.next) {
+            case 0:
+              _context11.next = 2;
+              return jsonrpc.post(this.serverURL.toString(), "sendTransaction", transaction.toXDR());
+            case 2:
+              return _context11.abrupt("return", _context11.sent);
+            case 3:
+            case "end":
+              return _context11.stop();
+          }
+        }, _callee11, this);
+      }));
+      function sendTransaction(_x10) {
+        return _sendTransaction.apply(this, arguments);
+      }
+      return sendTransaction;
+    }()
+    /**
+     * Use the friendbot faucet to create and fund a new account. The method will
+     * return an Account object for the created account, or if the account already
+     * existed. If friendbot is not configured on this network, this method will
+     * throw an error.  If the request fails, this method will throw an error.
+     *
+     * @example
+     * server.requestAirdrop("GBZC6Y2Y7Q3ZQ2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4").then(accountCreated => {
+     *   console.log("accountCreated:", accountCreated);
+     * }).catch(error => {
+     *   console.error("error:", error);
+     * });
+     *
+     * @param {string | Account} address - The address or account we want to create and fund.
+     * @param {string} [friendbotUrl] - The optional explicit address for
+     *    friendbot. If not provided, the client will call the Soroban-RPC `getNetwork`
+     *    method to attempt to find this network's friendbot url.
+     * @returns {Promise<Account>} Returns a promise to the {@link Account} object with populated sequence number.
+     */
+  }, {
+    key: "requestAirdrop",
+    value: function () {
+      var _requestAirdrop = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(address, friendbotUrl) {
+        var account, response, meta, sequence, _error$response, _error$response$detai;
+        return _regeneratorRuntime().wrap(function _callee12$(_context12) {
+          while (1) switch (_context12.prev = _context12.next) {
+            case 0:
+              account = typeof address === "string" ? address : address.accountId();
+              _context12.t0 = friendbotUrl;
+              if (_context12.t0) {
+                _context12.next = 6;
+                break;
+              }
+              _context12.next = 5;
+              return this.getNetwork();
+            case 5:
+              _context12.t0 = _context12.sent.friendbotUrl;
+            case 6:
+              friendbotUrl = _context12.t0;
+              if (friendbotUrl) {
+                _context12.next = 9;
+                break;
+              }
+              throw new Error("No friendbot URL configured for current network");
+            case 9:
+              _context12.prev = 9;
+              _context12.next = 12;
+              return _axios.default.post("".concat(friendbotUrl, "?addr=").concat(encodeURIComponent(account)));
+            case 12:
+              response = _context12.sent;
+              meta = _stellarBase.xdr.TransactionMeta.fromXDR(response.data.result_meta_xdr, "base64");
+              sequence = findCreatedAccountSequenceInTransactionMeta(meta);
+              return _context12.abrupt("return", new _stellarBase.Account(account, sequence));
+            case 18:
+              _context12.prev = 18;
+              _context12.t1 = _context12["catch"](9);
+              if (!(((_error$response = _context12.t1.response) === null || _error$response === void 0 ? void 0 : _error$response.status) === 400)) {
+                _context12.next = 23;
+                break;
+              }
+              if (!((_error$response$detai = _context12.t1.response.detail) !== null && _error$response$detai !== void 0 && _error$response$detai.includes("createAccountAlreadyExist"))) {
+                _context12.next = 23;
+                break;
+              }
+              return _context12.abrupt("return", this.getAccount(account));
+            case 23:
+              throw _context12.t1;
+            case 24:
+            case "end":
+              return _context12.stop();
+          }
+        }, _callee12, this, [[9, 18]]);
+      }));
+      function requestAirdrop(_x11, _x12) {
+        return _requestAirdrop.apply(this, arguments);
+      }
+      return requestAirdrop;
+    }()
+  }]);
+  return Server;
+}();
+exports.Server = Server;
+function findCreatedAccountSequenceInTransactionMeta(meta) {
+  var operations = [];
+  switch (meta.switch()) {
+    case 0:
+      operations = meta.operations();
+      break;
+    case 1:
+      operations = meta.v1().operations();
+      break;
+    case 2:
+      operations = meta.v2().operations();
+      break;
+    case 3:
+      operations = meta.v3().operations();
+      break;
+    default:
+      throw new Error("Unexpected transaction meta switch value");
+  }
+  var _iterator = _createForOfIteratorHelper(operations),
+    _step;
+  try {
+    for (_iterator.s(); !(_step = _iterator.n()).done;) {
+      var op = _step.value;
+      var _iterator2 = _createForOfIteratorHelper(op.changes()),
+        _step2;
+      try {
+        for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
+          var c = _step2.value;
+          if (c.switch() !== _stellarBase.xdr.LedgerEntryChangeType.ledgerEntryCreated()) {
+            continue;
+          }
+          var data = c.created().data();
+          if (data.switch() !== _stellarBase.xdr.LedgerEntryType.account()) {
+            continue;
+          }
+          var account = data.account();
+          var seqNum = account.seqNum();
+          return bigIntFromBytes(!seqNum.unsigned, seqNum.high, seqNum.low).toString();
+        }
+      } catch (err) {
+        _iterator2.e(err);
+      } finally {
+        _iterator2.f();
+      }
+    }
+  } catch (err) {
+    _iterator.e(err);
+  } finally {
+    _iterator.f();
+  }
+  throw new Error("No account created in transaction");
+}
+function bigIntFromBytes(signed) {
+  var sign = BigInt(1);
+  for (var _len = arguments.length, bytes = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+    bytes[_key - 1] = arguments[_key];
+  }
+  if (signed && bytes[0] === 0x80) {
+    // top bit is set, negative number.
+    sign = BigInt(-1);
+    // tslint:disable-next-line:no-bitwise
+    bytes[0] &= 0x7f;
+  }
+  var b = BigInt(0);
+  for (var _i2 = 0, _bytes = bytes; _i2 < _bytes.length; _i2++) {
+    var byte = _bytes[_i2];
+    // tslint:disable-next-line:no-bitwise
+    b <<= BigInt(8);
+    // tslint:disable-next-line:no-bitwise
+    b |= BigInt(byte);
+  }
+  return b * sign;
+}
+(function (_Server) {})(Server || (exports.Server = Server = {}));
+
+
+ + + + +
+ +
+ +
+ Generated by JSDoc 4.0.2 on Thu May 18 2023 23:02:00 GMT+0000 (Coordinated Universal Time) using the Minami theme. +
+ + + + +