@stellar/stellar-sdk 12.3.0 → 13.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +68 -0
- package/README.md +29 -7
- package/dist/stellar-sdk-minimal.js +46009 -0
- package/dist/stellar-sdk-minimal.min.js +2 -0
- package/dist/stellar-sdk-minimal.min.js.LICENSE.txt +69 -0
- package/dist/stellar-sdk-no-axios.js +56648 -0
- package/dist/stellar-sdk-no-axios.min.js +2 -0
- package/dist/stellar-sdk-no-axios.min.js.LICENSE.txt +71 -0
- package/dist/stellar-sdk-no-eventsource.js +49822 -0
- package/dist/stellar-sdk-no-eventsource.min.js +2 -0
- package/dist/stellar-sdk-no-eventsource.min.js.LICENSE.txt +69 -0
- package/dist/stellar-sdk.js +28279 -27350
- package/dist/stellar-sdk.min.js +1 -1
- package/lib/browser.d.ts +2 -2
- package/lib/browser.js +5 -7
- package/lib/config.d.ts +31 -19
- package/lib/contract/assembled_transaction.d.ts +22 -14
- package/lib/contract/assembled_transaction.js +159 -128
- package/lib/contract/basic_node_signer.d.ts +6 -1
- package/lib/contract/client.d.ts +24 -24
- package/lib/contract/rust_result.d.ts +22 -12
- package/lib/contract/sent_transaction.d.ts +9 -4
- package/lib/contract/sent_transaction.js +6 -6
- package/lib/contract/spec.d.ts +8 -14
- package/lib/contract/types.d.ts +81 -13
- package/lib/contract/utils.d.ts +8 -1
- package/lib/errors/account_requires_memo.d.ts +24 -0
- package/lib/errors/account_requires_memo.js +38 -0
- package/lib/errors/bad_request.d.ts +14 -0
- package/lib/errors/bad_request.js +34 -0
- package/lib/errors/bad_response.d.ts +17 -0
- package/lib/errors/bad_response.js +34 -0
- package/lib/errors/index.d.ts +5 -0
- package/lib/errors/index.js +60 -0
- package/lib/errors/network.d.ts +33 -0
- package/lib/{errors.js → errors/network.js} +1 -59
- package/lib/errors/not_found.d.ts +14 -0
- package/lib/errors/not_found.js +34 -0
- package/lib/federation/api.d.ts +21 -0
- package/lib/federation/index.d.ts +1 -1
- package/lib/federation/index.js +16 -6
- package/lib/federation/server.d.ts +36 -38
- package/lib/federation/server.js +2 -2
- package/lib/horizon/account_call_builder.d.ts +10 -8
- package/lib/horizon/account_response.d.ts +5 -2
- package/lib/horizon/assets_call_builder.d.ts +3 -2
- package/lib/horizon/call_builder.js +9 -3
- package/lib/horizon/claimable_balances_call_builder.d.ts +10 -8
- package/lib/horizon/effect_call_builder.d.ts +8 -7
- package/lib/horizon/horizon_axios_client.d.ts +13 -6
- package/lib/horizon/horizon_axios_client.js +16 -4
- package/lib/horizon/index.d.ts +2 -1
- package/lib/horizon/index.js +1 -1
- package/lib/horizon/ledger_call_builder.d.ts +6 -4
- package/lib/horizon/liquidity_pool_call_builder.d.ts +3 -2
- package/lib/horizon/offer_call_builder.d.ts +12 -10
- package/lib/horizon/operation_call_builder.d.ts +11 -9
- package/lib/horizon/orderbook_call_builder.d.ts +7 -2
- package/lib/horizon/path_call_builder.d.ts +7 -2
- package/lib/horizon/payment_call_builder.d.ts +10 -6
- package/lib/horizon/server.d.ts +64 -55
- package/lib/horizon/server.js +6 -5
- package/lib/horizon/server_api.d.ts +0 -15
- package/lib/horizon/strict_receive_path_call_builder.d.ts +7 -2
- package/lib/horizon/strict_send_path_call_builder.d.ts +7 -2
- package/lib/horizon/trade_aggregation_call_builder.d.ts +4 -2
- package/lib/horizon/trades_call_builder.d.ts +8 -5
- package/lib/horizon/transaction_call_builder.d.ts +10 -7
- package/lib/horizon/types/assets.d.ts +0 -2
- package/lib/http-client/axios-client.d.ts +2 -0
- package/lib/http-client/axios-client.js +10 -0
- package/lib/http-client/fetch-client.d.ts +11 -0
- package/lib/http-client/fetch-client.js +229 -0
- package/lib/http-client/index.d.ts +5 -0
- package/lib/http-client/index.js +33 -0
- package/lib/http-client/types.d.ts +69 -0
- package/lib/http-client/types.js +34 -0
- package/lib/index.d.ts +3 -8
- package/lib/index.js +8 -5
- package/lib/minimal/browser.d.ts +6 -0
- package/lib/minimal/browser.js +35 -0
- package/lib/minimal/config.d.ts +64 -0
- package/lib/minimal/config.js +51 -0
- package/lib/minimal/contract/assembled_transaction.d.ts +555 -0
- package/lib/minimal/contract/assembled_transaction.js +752 -0
- package/lib/minimal/contract/basic_node_signer.d.ts +17 -0
- package/lib/minimal/contract/basic_node_signer.js +52 -0
- package/lib/minimal/contract/client.d.ts +52 -0
- package/lib/minimal/contract/client.js +180 -0
- package/lib/minimal/contract/index.d.ts +7 -0
- package/lib/minimal/contract/index.js +82 -0
- package/lib/minimal/contract/rust_result.d.ts +81 -0
- package/lib/minimal/contract/rust_result.js +66 -0
- package/lib/minimal/contract/sent_transaction.d.ts +84 -0
- package/lib/minimal/contract/sent_transaction.js +151 -0
- package/lib/minimal/contract/spec.d.ts +152 -0
- package/lib/minimal/contract/spec.js +1020 -0
- package/lib/minimal/contract/types.d.ts +180 -0
- package/lib/minimal/contract/types.js +8 -0
- package/lib/minimal/contract/utils.d.ts +46 -0
- package/lib/minimal/contract/utils.js +123 -0
- package/lib/minimal/errors/account_requires_memo.d.ts +24 -0
- package/lib/minimal/errors/account_requires_memo.js +38 -0
- package/lib/minimal/errors/bad_request.d.ts +14 -0
- package/lib/minimal/errors/bad_request.js +34 -0
- package/lib/minimal/errors/bad_response.d.ts +17 -0
- package/lib/minimal/errors/bad_response.js +34 -0
- package/lib/minimal/errors/index.d.ts +5 -0
- package/lib/minimal/errors/index.js +60 -0
- package/lib/minimal/errors/network.d.ts +33 -0
- package/lib/minimal/errors/network.js +41 -0
- package/lib/minimal/errors/not_found.d.ts +14 -0
- package/lib/minimal/errors/not_found.js +34 -0
- package/lib/minimal/federation/api.d.ts +32 -0
- package/lib/minimal/federation/api.js +7 -0
- package/lib/minimal/federation/index.d.ts +2 -0
- package/lib/minimal/federation/index.js +34 -0
- package/lib/minimal/federation/server.d.ts +116 -0
- package/lib/minimal/federation/server.js +252 -0
- package/lib/minimal/friendbot/index.d.ts +5 -0
- package/lib/minimal/friendbot/index.js +7 -0
- package/lib/minimal/horizon/account_call_builder.d.ts +56 -0
- package/lib/minimal/horizon/account_call_builder.js +62 -0
- package/lib/minimal/horizon/account_response.d.ts +61 -0
- package/lib/minimal/horizon/account_response.js +49 -0
- package/lib/minimal/horizon/assets_call_builder.d.ts +27 -0
- package/lib/minimal/horizon/assets_call_builder.js +43 -0
- package/lib/minimal/horizon/call_builder.d.ts +128 -0
- package/lib/minimal/horizon/call_builder.js +362 -0
- package/lib/minimal/horizon/claimable_balances_call_builder.d.ts +50 -0
- package/lib/minimal/horizon/claimable_balances_call_builder.js +56 -0
- package/lib/minimal/horizon/effect_call_builder.d.ts +53 -0
- package/lib/minimal/horizon/effect_call_builder.js +56 -0
- package/lib/minimal/horizon/friendbot_builder.d.ts +4 -0
- package/lib/minimal/horizon/friendbot_builder.js +32 -0
- package/lib/minimal/horizon/horizon_api.d.ts +527 -0
- package/lib/minimal/horizon/horizon_api.js +96 -0
- package/lib/minimal/horizon/horizon_axios_client.d.ts +37 -0
- package/lib/minimal/horizon/horizon_axios_client.js +60 -0
- package/lib/minimal/horizon/index.d.ts +8 -0
- package/lib/minimal/horizon/index.js +78 -0
- package/lib/minimal/horizon/ledger_call_builder.d.ts +23 -0
- package/lib/minimal/horizon/ledger_call_builder.js +37 -0
- package/lib/minimal/horizon/liquidity_pool_call_builder.d.ts +37 -0
- package/lib/minimal/horizon/liquidity_pool_call_builder.js +59 -0
- package/lib/minimal/horizon/offer_call_builder.d.ts +65 -0
- package/lib/minimal/horizon/offer_call_builder.js +79 -0
- package/lib/minimal/horizon/operation_call_builder.d.ts +69 -0
- package/lib/minimal/horizon/operation_call_builder.js +69 -0
- package/lib/minimal/horizon/orderbook_call_builder.d.ts +20 -0
- package/lib/minimal/horizon/orderbook_call_builder.js +45 -0
- package/lib/minimal/horizon/path_call_builder.d.ts +35 -0
- package/lib/minimal/horizon/path_call_builder.js +41 -0
- package/lib/minimal/horizon/payment_call_builder.d.ts +39 -0
- package/lib/minimal/horizon/payment_call_builder.js +46 -0
- package/lib/minimal/horizon/server.d.ts +389 -0
- package/lib/minimal/horizon/server.js +550 -0
- package/lib/minimal/horizon/server_api.d.ts +263 -0
- package/lib/minimal/horizon/server_api.js +19 -0
- package/lib/minimal/horizon/strict_receive_path_call_builder.d.ts +38 -0
- package/lib/minimal/horizon/strict_receive_path_call_builder.js +50 -0
- package/lib/minimal/horizon/strict_send_path_call_builder.d.ts +38 -0
- package/lib/minimal/horizon/strict_send_path_call_builder.js +50 -0
- package/lib/minimal/horizon/trade_aggregation_call_builder.d.ts +49 -0
- package/lib/minimal/horizon/trade_aggregation_call_builder.js +76 -0
- package/lib/minimal/horizon/trades_call_builder.d.ts +52 -0
- package/lib/minimal/horizon/trades_call_builder.js +72 -0
- package/lib/minimal/horizon/transaction_call_builder.d.ts +60 -0
- package/lib/minimal/horizon/transaction_call_builder.js +64 -0
- package/lib/minimal/horizon/types/account.d.ts +5 -0
- package/lib/minimal/horizon/types/account.js +5 -0
- package/lib/minimal/horizon/types/assets.d.ts +17 -0
- package/lib/minimal/horizon/types/assets.js +5 -0
- package/lib/minimal/horizon/types/effects.d.ts +285 -0
- package/lib/minimal/horizon/types/effects.js +62 -0
- package/lib/minimal/horizon/types/offer.d.ts +20 -0
- package/lib/minimal/horizon/types/offer.js +5 -0
- package/lib/minimal/horizon/types/trade.d.ts +13 -0
- package/lib/minimal/horizon/types/trade.js +5 -0
- package/lib/minimal/http-client/axios-client.d.ts +2 -0
- package/lib/minimal/http-client/axios-client.js +10 -0
- package/lib/minimal/http-client/fetch-client.d.ts +11 -0
- package/lib/minimal/http-client/fetch-client.js +229 -0
- package/lib/minimal/http-client/index.d.ts +5 -0
- package/lib/minimal/http-client/index.js +33 -0
- package/lib/minimal/http-client/types.d.ts +69 -0
- package/lib/minimal/http-client/types.js +34 -0
- package/lib/minimal/index.d.ts +32 -0
- package/lib/minimal/index.js +80 -0
- package/lib/minimal/rpc/api.d.ts +362 -0
- package/lib/minimal/rpc/api.js +32 -0
- package/lib/minimal/rpc/axios.d.ts +4 -0
- package/lib/minimal/rpc/axios.js +15 -0
- package/lib/minimal/rpc/browser.d.ts +4 -0
- package/lib/minimal/rpc/browser.js +27 -0
- package/lib/minimal/rpc/index.d.ts +8 -0
- package/lib/minimal/rpc/index.js +86 -0
- package/lib/minimal/rpc/jsonrpc.d.ts +35 -0
- package/lib/minimal/rpc/jsonrpc.js +52 -0
- package/lib/minimal/rpc/parsers.d.ts +39 -0
- package/lib/minimal/rpc/parsers.js +155 -0
- package/lib/minimal/rpc/server.d.ts +622 -0
- package/lib/minimal/rpc/server.js +877 -0
- package/lib/minimal/rpc/transaction.d.ts +21 -0
- package/lib/minimal/rpc/transaction.js +53 -0
- package/lib/minimal/rpc/utils.d.ts +1 -0
- package/lib/minimal/rpc/utils.js +9 -0
- package/lib/minimal/stellartoml/index.d.ts +131 -0
- package/lib/minimal/stellartoml/index.js +77 -0
- package/lib/minimal/utils.d.ts +20 -0
- package/lib/minimal/utils.js +38 -0
- package/lib/minimal/webauth/errors.d.ts +13 -0
- package/lib/minimal/webauth/errors.js +36 -0
- package/lib/minimal/webauth/index.d.ts +2 -0
- package/lib/minimal/webauth/index.js +27 -0
- package/lib/minimal/webauth/utils.d.ts +307 -0
- package/lib/minimal/webauth/utils.js +332 -0
- package/lib/no-axios/browser.d.ts +6 -0
- package/lib/no-axios/browser.js +35 -0
- package/lib/no-axios/config.d.ts +64 -0
- package/lib/no-axios/config.js +51 -0
- package/lib/no-axios/contract/assembled_transaction.d.ts +555 -0
- package/lib/no-axios/contract/assembled_transaction.js +752 -0
- package/lib/no-axios/contract/basic_node_signer.d.ts +17 -0
- package/lib/no-axios/contract/basic_node_signer.js +52 -0
- package/lib/no-axios/contract/client.d.ts +52 -0
- package/lib/no-axios/contract/client.js +180 -0
- package/lib/no-axios/contract/index.d.ts +7 -0
- package/lib/no-axios/contract/index.js +82 -0
- package/lib/no-axios/contract/rust_result.d.ts +81 -0
- package/lib/no-axios/contract/rust_result.js +66 -0
- package/lib/no-axios/contract/sent_transaction.d.ts +84 -0
- package/lib/no-axios/contract/sent_transaction.js +151 -0
- package/lib/no-axios/contract/spec.d.ts +152 -0
- package/lib/no-axios/contract/spec.js +1020 -0
- package/lib/no-axios/contract/types.d.ts +180 -0
- package/lib/no-axios/contract/types.js +8 -0
- package/lib/no-axios/contract/utils.d.ts +46 -0
- package/lib/no-axios/contract/utils.js +123 -0
- package/lib/no-axios/errors/account_requires_memo.d.ts +24 -0
- package/lib/no-axios/errors/account_requires_memo.js +38 -0
- package/lib/no-axios/errors/bad_request.d.ts +14 -0
- package/lib/no-axios/errors/bad_request.js +34 -0
- package/lib/no-axios/errors/bad_response.d.ts +17 -0
- package/lib/no-axios/errors/bad_response.js +34 -0
- package/lib/no-axios/errors/index.d.ts +5 -0
- package/lib/no-axios/errors/index.js +60 -0
- package/lib/no-axios/errors/network.d.ts +33 -0
- package/lib/no-axios/errors/network.js +41 -0
- package/lib/no-axios/errors/not_found.d.ts +14 -0
- package/lib/no-axios/errors/not_found.js +34 -0
- package/lib/no-axios/federation/api.d.ts +32 -0
- package/lib/no-axios/federation/api.js +7 -0
- package/lib/no-axios/federation/index.d.ts +2 -0
- package/lib/no-axios/federation/index.js +34 -0
- package/lib/no-axios/federation/server.d.ts +116 -0
- package/lib/no-axios/federation/server.js +252 -0
- package/lib/no-axios/friendbot/index.d.ts +5 -0
- package/lib/no-axios/friendbot/index.js +7 -0
- package/lib/no-axios/horizon/account_call_builder.d.ts +56 -0
- package/lib/no-axios/horizon/account_call_builder.js +62 -0
- package/lib/no-axios/horizon/account_response.d.ts +61 -0
- package/lib/no-axios/horizon/account_response.js +49 -0
- package/lib/no-axios/horizon/assets_call_builder.d.ts +27 -0
- package/lib/no-axios/horizon/assets_call_builder.js +43 -0
- package/lib/no-axios/horizon/call_builder.d.ts +128 -0
- package/lib/no-axios/horizon/call_builder.js +362 -0
- package/lib/no-axios/horizon/claimable_balances_call_builder.d.ts +50 -0
- package/lib/no-axios/horizon/claimable_balances_call_builder.js +56 -0
- package/lib/no-axios/horizon/effect_call_builder.d.ts +53 -0
- package/lib/no-axios/horizon/effect_call_builder.js +56 -0
- package/lib/no-axios/horizon/friendbot_builder.d.ts +4 -0
- package/lib/no-axios/horizon/friendbot_builder.js +32 -0
- package/lib/no-axios/horizon/horizon_api.d.ts +527 -0
- package/lib/no-axios/horizon/horizon_api.js +96 -0
- package/lib/no-axios/horizon/horizon_axios_client.d.ts +37 -0
- package/lib/no-axios/horizon/horizon_axios_client.js +60 -0
- package/lib/no-axios/horizon/index.d.ts +8 -0
- package/lib/no-axios/horizon/index.js +78 -0
- package/lib/no-axios/horizon/ledger_call_builder.d.ts +23 -0
- package/lib/no-axios/horizon/ledger_call_builder.js +37 -0
- package/lib/no-axios/horizon/liquidity_pool_call_builder.d.ts +37 -0
- package/lib/no-axios/horizon/liquidity_pool_call_builder.js +59 -0
- package/lib/no-axios/horizon/offer_call_builder.d.ts +65 -0
- package/lib/no-axios/horizon/offer_call_builder.js +79 -0
- package/lib/no-axios/horizon/operation_call_builder.d.ts +69 -0
- package/lib/no-axios/horizon/operation_call_builder.js +69 -0
- package/lib/no-axios/horizon/orderbook_call_builder.d.ts +20 -0
- package/lib/no-axios/horizon/orderbook_call_builder.js +45 -0
- package/lib/no-axios/horizon/path_call_builder.d.ts +35 -0
- package/lib/no-axios/horizon/path_call_builder.js +41 -0
- package/lib/no-axios/horizon/payment_call_builder.d.ts +39 -0
- package/lib/no-axios/horizon/payment_call_builder.js +46 -0
- package/lib/no-axios/horizon/server.d.ts +389 -0
- package/lib/no-axios/horizon/server.js +550 -0
- package/lib/no-axios/horizon/server_api.d.ts +263 -0
- package/lib/no-axios/horizon/server_api.js +19 -0
- package/lib/no-axios/horizon/strict_receive_path_call_builder.d.ts +38 -0
- package/lib/no-axios/horizon/strict_receive_path_call_builder.js +50 -0
- package/lib/no-axios/horizon/strict_send_path_call_builder.d.ts +38 -0
- package/lib/no-axios/horizon/strict_send_path_call_builder.js +50 -0
- package/lib/no-axios/horizon/trade_aggregation_call_builder.d.ts +49 -0
- package/lib/no-axios/horizon/trade_aggregation_call_builder.js +76 -0
- package/lib/no-axios/horizon/trades_call_builder.d.ts +52 -0
- package/lib/no-axios/horizon/trades_call_builder.js +72 -0
- package/lib/no-axios/horizon/transaction_call_builder.d.ts +60 -0
- package/lib/no-axios/horizon/transaction_call_builder.js +64 -0
- package/lib/no-axios/horizon/types/account.d.ts +5 -0
- package/lib/no-axios/horizon/types/account.js +5 -0
- package/lib/no-axios/horizon/types/assets.d.ts +17 -0
- package/lib/no-axios/horizon/types/assets.js +5 -0
- package/lib/no-axios/horizon/types/effects.d.ts +285 -0
- package/lib/no-axios/horizon/types/effects.js +62 -0
- package/lib/no-axios/horizon/types/offer.d.ts +20 -0
- package/lib/no-axios/horizon/types/offer.js +5 -0
- package/lib/no-axios/horizon/types/trade.d.ts +13 -0
- package/lib/no-axios/horizon/types/trade.js +5 -0
- package/lib/no-axios/http-client/axios-client.d.ts +2 -0
- package/lib/no-axios/http-client/axios-client.js +10 -0
- package/lib/no-axios/http-client/fetch-client.d.ts +11 -0
- package/lib/no-axios/http-client/fetch-client.js +229 -0
- package/lib/no-axios/http-client/index.d.ts +5 -0
- package/lib/no-axios/http-client/index.js +33 -0
- package/lib/no-axios/http-client/types.d.ts +69 -0
- package/lib/no-axios/http-client/types.js +34 -0
- package/lib/no-axios/index.d.ts +32 -0
- package/lib/no-axios/index.js +80 -0
- package/lib/no-axios/rpc/api.d.ts +362 -0
- package/lib/no-axios/rpc/api.js +32 -0
- package/lib/no-axios/rpc/axios.d.ts +4 -0
- package/lib/no-axios/rpc/axios.js +15 -0
- package/lib/no-axios/rpc/browser.d.ts +4 -0
- package/lib/no-axios/rpc/browser.js +27 -0
- package/lib/no-axios/rpc/index.d.ts +8 -0
- package/lib/no-axios/rpc/index.js +86 -0
- package/lib/no-axios/rpc/jsonrpc.d.ts +35 -0
- package/lib/no-axios/rpc/jsonrpc.js +52 -0
- package/lib/no-axios/rpc/parsers.d.ts +39 -0
- package/lib/no-axios/rpc/parsers.js +155 -0
- package/lib/no-axios/rpc/server.d.ts +622 -0
- package/lib/no-axios/rpc/server.js +877 -0
- package/lib/no-axios/rpc/transaction.d.ts +21 -0
- package/lib/no-axios/rpc/transaction.js +53 -0
- package/lib/no-axios/rpc/utils.d.ts +1 -0
- package/lib/no-axios/rpc/utils.js +9 -0
- package/lib/no-axios/stellartoml/index.d.ts +131 -0
- package/lib/no-axios/stellartoml/index.js +77 -0
- package/lib/no-axios/utils.d.ts +20 -0
- package/lib/no-axios/utils.js +38 -0
- package/lib/no-axios/webauth/errors.d.ts +13 -0
- package/lib/no-axios/webauth/errors.js +36 -0
- package/lib/no-axios/webauth/index.d.ts +2 -0
- package/lib/no-axios/webauth/index.js +27 -0
- package/lib/no-axios/webauth/utils.d.ts +307 -0
- package/lib/no-axios/webauth/utils.js +332 -0
- package/lib/no-eventsource/browser.d.ts +6 -0
- package/lib/no-eventsource/browser.js +35 -0
- package/lib/no-eventsource/config.d.ts +64 -0
- package/lib/no-eventsource/config.js +51 -0
- package/lib/no-eventsource/contract/assembled_transaction.d.ts +555 -0
- package/lib/no-eventsource/contract/assembled_transaction.js +752 -0
- package/lib/no-eventsource/contract/basic_node_signer.d.ts +17 -0
- package/lib/no-eventsource/contract/basic_node_signer.js +52 -0
- package/lib/no-eventsource/contract/client.d.ts +52 -0
- package/lib/no-eventsource/contract/client.js +180 -0
- package/lib/no-eventsource/contract/index.d.ts +7 -0
- package/lib/no-eventsource/contract/index.js +82 -0
- package/lib/no-eventsource/contract/rust_result.d.ts +81 -0
- package/lib/no-eventsource/contract/rust_result.js +66 -0
- package/lib/no-eventsource/contract/sent_transaction.d.ts +84 -0
- package/lib/no-eventsource/contract/sent_transaction.js +151 -0
- package/lib/no-eventsource/contract/spec.d.ts +152 -0
- package/lib/no-eventsource/contract/spec.js +1020 -0
- package/lib/no-eventsource/contract/types.d.ts +180 -0
- package/lib/no-eventsource/contract/types.js +8 -0
- package/lib/no-eventsource/contract/utils.d.ts +46 -0
- package/lib/no-eventsource/contract/utils.js +123 -0
- package/lib/no-eventsource/errors/account_requires_memo.d.ts +24 -0
- package/lib/no-eventsource/errors/account_requires_memo.js +38 -0
- package/lib/no-eventsource/errors/bad_request.d.ts +14 -0
- package/lib/no-eventsource/errors/bad_request.js +34 -0
- package/lib/no-eventsource/errors/bad_response.d.ts +17 -0
- package/lib/no-eventsource/errors/bad_response.js +34 -0
- package/lib/no-eventsource/errors/index.d.ts +5 -0
- package/lib/no-eventsource/errors/index.js +60 -0
- package/lib/no-eventsource/errors/network.d.ts +33 -0
- package/lib/no-eventsource/errors/network.js +41 -0
- package/lib/no-eventsource/errors/not_found.d.ts +14 -0
- package/lib/no-eventsource/errors/not_found.js +34 -0
- package/lib/no-eventsource/federation/api.d.ts +32 -0
- package/lib/no-eventsource/federation/api.js +7 -0
- package/lib/no-eventsource/federation/index.d.ts +2 -0
- package/lib/no-eventsource/federation/index.js +34 -0
- package/lib/no-eventsource/federation/server.d.ts +116 -0
- package/lib/no-eventsource/federation/server.js +252 -0
- package/lib/no-eventsource/friendbot/index.d.ts +5 -0
- package/lib/no-eventsource/friendbot/index.js +7 -0
- package/lib/no-eventsource/horizon/account_call_builder.d.ts +56 -0
- package/lib/no-eventsource/horizon/account_call_builder.js +62 -0
- package/lib/no-eventsource/horizon/account_response.d.ts +61 -0
- package/lib/no-eventsource/horizon/account_response.js +49 -0
- package/lib/no-eventsource/horizon/assets_call_builder.d.ts +27 -0
- package/lib/no-eventsource/horizon/assets_call_builder.js +43 -0
- package/lib/no-eventsource/horizon/call_builder.d.ts +128 -0
- package/lib/no-eventsource/horizon/call_builder.js +362 -0
- package/lib/no-eventsource/horizon/claimable_balances_call_builder.d.ts +50 -0
- package/lib/no-eventsource/horizon/claimable_balances_call_builder.js +56 -0
- package/lib/no-eventsource/horizon/effect_call_builder.d.ts +53 -0
- package/lib/no-eventsource/horizon/effect_call_builder.js +56 -0
- package/lib/no-eventsource/horizon/friendbot_builder.d.ts +4 -0
- package/lib/no-eventsource/horizon/friendbot_builder.js +32 -0
- package/lib/no-eventsource/horizon/horizon_api.d.ts +527 -0
- package/lib/no-eventsource/horizon/horizon_api.js +96 -0
- package/lib/no-eventsource/horizon/horizon_axios_client.d.ts +37 -0
- package/lib/no-eventsource/horizon/horizon_axios_client.js +60 -0
- package/lib/no-eventsource/horizon/index.d.ts +8 -0
- package/lib/no-eventsource/horizon/index.js +78 -0
- package/lib/no-eventsource/horizon/ledger_call_builder.d.ts +23 -0
- package/lib/no-eventsource/horizon/ledger_call_builder.js +37 -0
- package/lib/no-eventsource/horizon/liquidity_pool_call_builder.d.ts +37 -0
- package/lib/no-eventsource/horizon/liquidity_pool_call_builder.js +59 -0
- package/lib/no-eventsource/horizon/offer_call_builder.d.ts +65 -0
- package/lib/no-eventsource/horizon/offer_call_builder.js +79 -0
- package/lib/no-eventsource/horizon/operation_call_builder.d.ts +69 -0
- package/lib/no-eventsource/horizon/operation_call_builder.js +69 -0
- package/lib/no-eventsource/horizon/orderbook_call_builder.d.ts +20 -0
- package/lib/no-eventsource/horizon/orderbook_call_builder.js +45 -0
- package/lib/no-eventsource/horizon/path_call_builder.d.ts +35 -0
- package/lib/no-eventsource/horizon/path_call_builder.js +41 -0
- package/lib/no-eventsource/horizon/payment_call_builder.d.ts +39 -0
- package/lib/no-eventsource/horizon/payment_call_builder.js +46 -0
- package/lib/no-eventsource/horizon/server.d.ts +389 -0
- package/lib/no-eventsource/horizon/server.js +550 -0
- package/lib/no-eventsource/horizon/server_api.d.ts +263 -0
- package/lib/no-eventsource/horizon/server_api.js +19 -0
- package/lib/no-eventsource/horizon/strict_receive_path_call_builder.d.ts +38 -0
- package/lib/no-eventsource/horizon/strict_receive_path_call_builder.js +50 -0
- package/lib/no-eventsource/horizon/strict_send_path_call_builder.d.ts +38 -0
- package/lib/no-eventsource/horizon/strict_send_path_call_builder.js +50 -0
- package/lib/no-eventsource/horizon/trade_aggregation_call_builder.d.ts +49 -0
- package/lib/no-eventsource/horizon/trade_aggregation_call_builder.js +76 -0
- package/lib/no-eventsource/horizon/trades_call_builder.d.ts +52 -0
- package/lib/no-eventsource/horizon/trades_call_builder.js +72 -0
- package/lib/no-eventsource/horizon/transaction_call_builder.d.ts +60 -0
- package/lib/no-eventsource/horizon/transaction_call_builder.js +64 -0
- package/lib/no-eventsource/horizon/types/account.d.ts +5 -0
- package/lib/no-eventsource/horizon/types/account.js +5 -0
- package/lib/no-eventsource/horizon/types/assets.d.ts +17 -0
- package/lib/no-eventsource/horizon/types/assets.js +5 -0
- package/lib/no-eventsource/horizon/types/effects.d.ts +285 -0
- package/lib/no-eventsource/horizon/types/effects.js +62 -0
- package/lib/no-eventsource/horizon/types/offer.d.ts +20 -0
- package/lib/no-eventsource/horizon/types/offer.js +5 -0
- package/lib/no-eventsource/horizon/types/trade.d.ts +13 -0
- package/lib/no-eventsource/horizon/types/trade.js +5 -0
- package/lib/no-eventsource/http-client/axios-client.d.ts +2 -0
- package/lib/no-eventsource/http-client/axios-client.js +10 -0
- package/lib/no-eventsource/http-client/fetch-client.d.ts +11 -0
- package/lib/no-eventsource/http-client/fetch-client.js +229 -0
- package/lib/no-eventsource/http-client/index.d.ts +5 -0
- package/lib/no-eventsource/http-client/index.js +33 -0
- package/lib/no-eventsource/http-client/types.d.ts +69 -0
- package/lib/no-eventsource/http-client/types.js +34 -0
- package/lib/no-eventsource/index.d.ts +32 -0
- package/lib/no-eventsource/index.js +80 -0
- package/lib/no-eventsource/rpc/api.d.ts +362 -0
- package/lib/no-eventsource/rpc/api.js +32 -0
- package/lib/no-eventsource/rpc/axios.d.ts +4 -0
- package/lib/no-eventsource/rpc/axios.js +15 -0
- package/lib/no-eventsource/rpc/browser.d.ts +4 -0
- package/lib/no-eventsource/rpc/browser.js +27 -0
- package/lib/no-eventsource/rpc/index.d.ts +8 -0
- package/lib/no-eventsource/rpc/index.js +86 -0
- package/lib/no-eventsource/rpc/jsonrpc.d.ts +35 -0
- package/lib/no-eventsource/rpc/jsonrpc.js +52 -0
- package/lib/no-eventsource/rpc/parsers.d.ts +39 -0
- package/lib/no-eventsource/rpc/parsers.js +155 -0
- package/lib/no-eventsource/rpc/server.d.ts +622 -0
- package/lib/no-eventsource/rpc/server.js +877 -0
- package/lib/no-eventsource/rpc/transaction.d.ts +21 -0
- package/lib/no-eventsource/rpc/transaction.js +53 -0
- package/lib/no-eventsource/rpc/utils.d.ts +1 -0
- package/lib/no-eventsource/rpc/utils.js +9 -0
- package/lib/no-eventsource/stellartoml/index.d.ts +131 -0
- package/lib/no-eventsource/stellartoml/index.js +77 -0
- package/lib/no-eventsource/utils.d.ts +20 -0
- package/lib/no-eventsource/utils.js +38 -0
- package/lib/no-eventsource/webauth/errors.d.ts +13 -0
- package/lib/no-eventsource/webauth/errors.js +36 -0
- package/lib/no-eventsource/webauth/index.d.ts +2 -0
- package/lib/no-eventsource/webauth/index.js +27 -0
- package/lib/no-eventsource/webauth/utils.d.ts +307 -0
- package/lib/no-eventsource/webauth/utils.js +332 -0
- package/lib/rpc/api.d.ts +25 -11
- package/lib/rpc/axios.d.ts +3 -2
- package/lib/rpc/axios.js +3 -4
- package/lib/rpc/browser.d.ts +0 -2
- package/lib/rpc/browser.js +1 -11
- package/lib/rpc/index.d.ts +2 -1
- package/lib/rpc/index.js +15 -1
- package/lib/rpc/jsonrpc.d.ts +9 -1
- package/lib/rpc/parsers.d.ts +31 -11
- package/lib/rpc/parsers.js +14 -14
- package/lib/rpc/server.d.ts +207 -99
- package/lib/rpc/server.js +273 -133
- package/lib/rpc/transaction.d.ts +11 -9
- package/lib/stellartoml/index.d.ts +21 -11
- package/lib/stellartoml/index.js +3 -3
- package/lib/utils.d.ts +12 -4
- package/lib/utils.js +7 -0
- package/lib/webauth/errors.d.ts +9 -0
- package/lib/webauth/utils.d.ts +67 -54
- package/package.json +73 -21
- package/lib/errors.d.ts +0 -59
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.AssembledTransaction = void 0;
|
|
7
7
|
var _stellarBase = require("@stellar/stellar-base");
|
|
8
|
-
var
|
|
8
|
+
var _rpc = require("../rpc");
|
|
9
9
|
var _api = require("../rpc/api");
|
|
10
10
|
var _transaction = require("../rpc/transaction");
|
|
11
11
|
var _rust_result = require("./rust_result");
|
|
@@ -130,6 +130,7 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
|
|
|
130
130
|
force,
|
|
131
131
|
_ref4$signTransaction,
|
|
132
132
|
signTransaction,
|
|
133
|
+
sigsNeeded,
|
|
133
134
|
timeoutInSeconds,
|
|
134
135
|
signature,
|
|
135
136
|
_args2 = arguments;
|
|
@@ -155,26 +156,29 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
|
|
|
155
156
|
}
|
|
156
157
|
throw new AssembledTransaction.Errors.NoSigner("You must provide a signTransaction function, either when calling " + "`signAndSend` or when initializing your Client");
|
|
157
158
|
case 7:
|
|
158
|
-
|
|
159
|
-
|
|
159
|
+
sigsNeeded = _this.needsNonInvokerSigningBy().filter(function (id) {
|
|
160
|
+
return !id.startsWith('C');
|
|
161
|
+
});
|
|
162
|
+
if (!sigsNeeded.length) {
|
|
163
|
+
_context2.next = 10;
|
|
160
164
|
break;
|
|
161
165
|
}
|
|
162
|
-
throw new AssembledTransaction.Errors.NeedsMoreSignatures("Transaction requires
|
|
163
|
-
case
|
|
166
|
+
throw new AssembledTransaction.Errors.NeedsMoreSignatures("Transaction requires signatures from ".concat(sigsNeeded, ". ") + "See `needsNonInvokerSigningBy` for details.");
|
|
167
|
+
case 10:
|
|
164
168
|
timeoutInSeconds = (_this$options$timeout2 = _this.options.timeoutInSeconds) !== null && _this$options$timeout2 !== void 0 ? _this$options$timeout2 : _types.DEFAULT_TIMEOUT;
|
|
165
169
|
_this.built = _stellarBase.TransactionBuilder.cloneFrom(_this.built, {
|
|
166
170
|
fee: _this.built.fee,
|
|
167
171
|
timebounds: undefined,
|
|
168
172
|
sorobanData: _this.simulationData.transactionData
|
|
169
173
|
}).setTimeout(timeoutInSeconds).build();
|
|
170
|
-
_context2.next =
|
|
174
|
+
_context2.next = 14;
|
|
171
175
|
return signTransaction(_this.built.toXDR(), {
|
|
172
176
|
networkPassphrase: _this.options.networkPassphrase
|
|
173
177
|
});
|
|
174
|
-
case
|
|
178
|
+
case 14:
|
|
175
179
|
signature = _context2.sent;
|
|
176
180
|
_this.signed = _stellarBase.TransactionBuilder.fromXDR(signature, _this.options.networkPassphrase);
|
|
177
|
-
case
|
|
181
|
+
case 16:
|
|
178
182
|
case "end":
|
|
179
183
|
return _context2.stop();
|
|
180
184
|
}
|
|
@@ -223,7 +227,7 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
|
|
|
223
227
|
return _toConsumableArray(new Set(((_rawInvokeHostFunctio = rawInvokeHostFunctionOp.auth) !== null && _rawInvokeHostFunctio !== void 0 ? _rawInvokeHostFunctio : []).filter(function (entry) {
|
|
224
228
|
return entry.credentials().switch() === _stellarBase.xdr.SorobanCredentialsType.sorobanCredentialsAddress() && (includeAlreadySigned || entry.credentials().address().signature().switch().name === "scvVoid");
|
|
225
229
|
}).map(function (entry) {
|
|
226
|
-
return _stellarBase.
|
|
230
|
+
return _stellarBase.Address.fromScAddress(entry.credentials().address().address()).toString();
|
|
227
231
|
})));
|
|
228
232
|
});
|
|
229
233
|
_defineProperty(this, "signAuthEntries", _asyncToGenerator(_regeneratorRuntime().mark(function _callee6() {
|
|
@@ -233,22 +237,22 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
|
|
|
233
237
|
expiration,
|
|
234
238
|
_ref9$signAuthEntry,
|
|
235
239
|
signAuthEntry,
|
|
236
|
-
_ref9$
|
|
237
|
-
|
|
240
|
+
_ref9$address,
|
|
241
|
+
address,
|
|
242
|
+
_ref9$authorizeEntry,
|
|
243
|
+
authorizeEntry,
|
|
238
244
|
needsNonInvokerSigningBy,
|
|
239
245
|
rawInvokeHostFunctionOp,
|
|
240
246
|
authEntries,
|
|
241
247
|
_iterator,
|
|
242
248
|
_step,
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
249
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
249
|
+
_loop,
|
|
250
|
+
_ret,
|
|
251
|
+
_args7 = arguments;
|
|
252
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context7) {
|
|
253
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
250
254
|
case 0:
|
|
251
|
-
_ref9 =
|
|
255
|
+
_ref9 = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {}, _ref9$expiration = _ref9.expiration, expiration = _ref9$expiration === void 0 ? _asyncToGenerator(_regeneratorRuntime().mark(function _callee4() {
|
|
252
256
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
253
257
|
while (1) switch (_context4.prev = _context4.next) {
|
|
254
258
|
case 0:
|
|
@@ -262,111 +266,138 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
|
|
|
262
266
|
return _context4.stop();
|
|
263
267
|
}
|
|
264
268
|
}, _callee4);
|
|
265
|
-
}))() : _ref9$expiration, _ref9$signAuthEntry = _ref9.signAuthEntry, signAuthEntry = _ref9$signAuthEntry === void 0 ? _this.options.signAuthEntry : _ref9$signAuthEntry, _ref9$
|
|
269
|
+
}))() : _ref9$expiration, _ref9$signAuthEntry = _ref9.signAuthEntry, signAuthEntry = _ref9$signAuthEntry === void 0 ? _this.options.signAuthEntry : _ref9$signAuthEntry, _ref9$address = _ref9.address, address = _ref9$address === void 0 ? _this.options.publicKey : _ref9$address, _ref9$authorizeEntry = _ref9.authorizeEntry, authorizeEntry = _ref9$authorizeEntry === void 0 ? _stellarBase.authorizeEntry : _ref9$authorizeEntry;
|
|
266
270
|
if (_this.built) {
|
|
267
|
-
|
|
271
|
+
_context7.next = 3;
|
|
268
272
|
break;
|
|
269
273
|
}
|
|
270
274
|
throw new Error("Transaction has not yet been assembled or simulated");
|
|
271
275
|
case 3:
|
|
276
|
+
if (!(authorizeEntry === _stellarBase.authorizeEntry)) {
|
|
277
|
+
_context7.next = 11;
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
272
280
|
needsNonInvokerSigningBy = _this.needsNonInvokerSigningBy();
|
|
273
|
-
if (needsNonInvokerSigningBy) {
|
|
274
|
-
|
|
281
|
+
if (!(needsNonInvokerSigningBy.length === 0)) {
|
|
282
|
+
_context7.next = 7;
|
|
275
283
|
break;
|
|
276
284
|
}
|
|
277
285
|
throw new AssembledTransaction.Errors.NoUnsignedNonInvokerAuthEntries("No unsigned non-invoker auth entries; maybe you already signed?");
|
|
278
|
-
case
|
|
279
|
-
if (!(needsNonInvokerSigningBy.indexOf(
|
|
280
|
-
|
|
286
|
+
case 7:
|
|
287
|
+
if (!(needsNonInvokerSigningBy.indexOf(address !== null && address !== void 0 ? address : "") === -1)) {
|
|
288
|
+
_context7.next = 9;
|
|
281
289
|
break;
|
|
282
290
|
}
|
|
283
|
-
throw new AssembledTransaction.Errors.NoSignatureNeeded("No auth entries for public key \"".concat(
|
|
284
|
-
case
|
|
291
|
+
throw new AssembledTransaction.Errors.NoSignatureNeeded("No auth entries for public key \"".concat(address, "\""));
|
|
292
|
+
case 9:
|
|
285
293
|
if (signAuthEntry) {
|
|
286
|
-
|
|
294
|
+
_context7.next = 11;
|
|
287
295
|
break;
|
|
288
296
|
}
|
|
289
|
-
throw new AssembledTransaction.Errors.NoSigner("You must provide `signAuthEntry`
|
|
290
|
-
case
|
|
297
|
+
throw new AssembledTransaction.Errors.NoSigner("You must provide `signAuthEntry` or a custom `authorizeEntry`");
|
|
298
|
+
case 11:
|
|
291
299
|
rawInvokeHostFunctionOp = _this.built.operations[0];
|
|
292
300
|
authEntries = (_rawInvokeHostFunctio2 = rawInvokeHostFunctionOp.auth) !== null && _rawInvokeHostFunctio2 !== void 0 ? _rawInvokeHostFunctio2 : [];
|
|
293
301
|
_iterator = _createForOfIteratorHelper(authEntries.entries());
|
|
294
|
-
|
|
302
|
+
_context7.prev = 14;
|
|
303
|
+
_loop = _regeneratorRuntime().mark(function _loop() {
|
|
304
|
+
var _step$value, i, entry, credentials, authEntryAddress, sign;
|
|
305
|
+
return _regeneratorRuntime().wrap(function _loop$(_context6) {
|
|
306
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
307
|
+
case 0:
|
|
308
|
+
_step$value = _slicedToArray(_step.value, 2), i = _step$value[0], entry = _step$value[1];
|
|
309
|
+
credentials = _stellarBase.xdr.SorobanCredentials.fromXDR(entry.credentials().toXDR());
|
|
310
|
+
if (!(credentials.switch() !== _stellarBase.xdr.SorobanCredentialsType.sorobanCredentialsAddress())) {
|
|
311
|
+
_context6.next = 4;
|
|
312
|
+
break;
|
|
313
|
+
}
|
|
314
|
+
return _context6.abrupt("return", 0);
|
|
315
|
+
case 4:
|
|
316
|
+
authEntryAddress = _stellarBase.Address.fromScAddress(credentials.address().address()).toString();
|
|
317
|
+
if (!(authEntryAddress !== address)) {
|
|
318
|
+
_context6.next = 7;
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
321
|
+
return _context6.abrupt("return", 0);
|
|
322
|
+
case 7:
|
|
323
|
+
sign = signAuthEntry !== null && signAuthEntry !== void 0 ? signAuthEntry : Promise.resolve;
|
|
324
|
+
_context6.t0 = authorizeEntry;
|
|
325
|
+
_context6.t1 = entry;
|
|
326
|
+
_context6.t2 = function () {
|
|
327
|
+
var _ref11 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee5(preimage) {
|
|
328
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
329
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
330
|
+
case 0:
|
|
331
|
+
_context5.t0 = Buffer;
|
|
332
|
+
_context5.next = 3;
|
|
333
|
+
return sign(preimage.toXDR("base64"), {
|
|
334
|
+
accountToSign: address
|
|
335
|
+
});
|
|
336
|
+
case 3:
|
|
337
|
+
_context5.t1 = _context5.sent;
|
|
338
|
+
return _context5.abrupt("return", _context5.t0.from.call(_context5.t0, _context5.t1, "base64"));
|
|
339
|
+
case 5:
|
|
340
|
+
case "end":
|
|
341
|
+
return _context5.stop();
|
|
342
|
+
}
|
|
343
|
+
}, _callee5);
|
|
344
|
+
}));
|
|
345
|
+
return function (_x) {
|
|
346
|
+
return _ref11.apply(this, arguments);
|
|
347
|
+
};
|
|
348
|
+
}();
|
|
349
|
+
_context6.next = 13;
|
|
350
|
+
return expiration;
|
|
351
|
+
case 13:
|
|
352
|
+
_context6.t3 = _context6.sent;
|
|
353
|
+
_context6.t4 = _this.options.networkPassphrase;
|
|
354
|
+
_context6.next = 17;
|
|
355
|
+
return (0, _context6.t0)(_context6.t1, _context6.t2, _context6.t3, _context6.t4);
|
|
356
|
+
case 17:
|
|
357
|
+
authEntries[i] = _context6.sent;
|
|
358
|
+
case 18:
|
|
359
|
+
case "end":
|
|
360
|
+
return _context6.stop();
|
|
361
|
+
}
|
|
362
|
+
}, _loop);
|
|
363
|
+
});
|
|
295
364
|
_iterator.s();
|
|
296
|
-
case
|
|
365
|
+
case 17:
|
|
297
366
|
if ((_step = _iterator.n()).done) {
|
|
298
|
-
|
|
299
|
-
break;
|
|
300
|
-
}
|
|
301
|
-
_step$value = _slicedToArray(_step.value, 2), i = _step$value[0], entry = _step$value[1];
|
|
302
|
-
if (!(entry.credentials().switch() !== _stellarBase.xdr.SorobanCredentialsType.sorobanCredentialsAddress())) {
|
|
303
|
-
_context6.next = 19;
|
|
367
|
+
_context7.next = 24;
|
|
304
368
|
break;
|
|
305
369
|
}
|
|
306
|
-
return
|
|
370
|
+
return _context7.delegateYield(_loop(), "t0", 19);
|
|
307
371
|
case 19:
|
|
308
|
-
|
|
309
|
-
if (!(
|
|
310
|
-
|
|
372
|
+
_ret = _context7.t0;
|
|
373
|
+
if (!(_ret === 0)) {
|
|
374
|
+
_context7.next = 22;
|
|
311
375
|
break;
|
|
312
376
|
}
|
|
313
|
-
return
|
|
377
|
+
return _context7.abrupt("continue", 22);
|
|
314
378
|
case 22:
|
|
315
|
-
|
|
316
|
-
_context6.t1 = entry;
|
|
317
|
-
_context6.t2 = function () {
|
|
318
|
-
var _ref11 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee5(preimage) {
|
|
319
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
320
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
321
|
-
case 0:
|
|
322
|
-
_context5.t0 = Buffer;
|
|
323
|
-
_context5.next = 3;
|
|
324
|
-
return signAuthEntry(preimage.toXDR("base64"));
|
|
325
|
-
case 3:
|
|
326
|
-
_context5.t1 = _context5.sent;
|
|
327
|
-
return _context5.abrupt("return", _context5.t0.from.call(_context5.t0, _context5.t1, "base64"));
|
|
328
|
-
case 5:
|
|
329
|
-
case "end":
|
|
330
|
-
return _context5.stop();
|
|
331
|
-
}
|
|
332
|
-
}, _callee5);
|
|
333
|
-
}));
|
|
334
|
-
return function (_x) {
|
|
335
|
-
return _ref11.apply(this, arguments);
|
|
336
|
-
};
|
|
337
|
-
}();
|
|
338
|
-
_context6.next = 27;
|
|
339
|
-
return expiration;
|
|
340
|
-
case 27:
|
|
341
|
-
_context6.t3 = _context6.sent;
|
|
342
|
-
_context6.t4 = _this.options.networkPassphrase;
|
|
343
|
-
_context6.next = 31;
|
|
344
|
-
return (0, _context6.t0)(_context6.t1, _context6.t2, _context6.t3, _context6.t4);
|
|
345
|
-
case 31:
|
|
346
|
-
authEntries[i] = _context6.sent;
|
|
347
|
-
case 32:
|
|
348
|
-
_context6.next = 15;
|
|
379
|
+
_context7.next = 17;
|
|
349
380
|
break;
|
|
350
|
-
case
|
|
351
|
-
|
|
381
|
+
case 24:
|
|
382
|
+
_context7.next = 29;
|
|
352
383
|
break;
|
|
353
|
-
case
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
_iterator.e(
|
|
357
|
-
case
|
|
358
|
-
|
|
384
|
+
case 26:
|
|
385
|
+
_context7.prev = 26;
|
|
386
|
+
_context7.t1 = _context7["catch"](14);
|
|
387
|
+
_iterator.e(_context7.t1);
|
|
388
|
+
case 29:
|
|
389
|
+
_context7.prev = 29;
|
|
359
390
|
_iterator.f();
|
|
360
|
-
return
|
|
361
|
-
case
|
|
391
|
+
return _context7.finish(29);
|
|
392
|
+
case 32:
|
|
362
393
|
case "end":
|
|
363
|
-
return
|
|
394
|
+
return _context7.stop();
|
|
364
395
|
}
|
|
365
|
-
}, _callee6, null, [[
|
|
396
|
+
}, _callee6, null, [[14, 26, 29, 32]]);
|
|
366
397
|
})));
|
|
367
398
|
this.options = options;
|
|
368
399
|
this.options.simulate = (_this$options$simulat = this.options.simulate) !== null && _this$options$simulat !== void 0 ? _this$options$simulat : true;
|
|
369
|
-
this.server = new
|
|
400
|
+
this.server = new _rpc.Server(this.options.rpcUrl, {
|
|
370
401
|
allowHttp: (_this$options$allowHt = this.options.allowHttp) !== null && _this$options$allowHt !== void 0 ? _this$options$allowHt : false
|
|
371
402
|
});
|
|
372
403
|
}
|
|
@@ -454,23 +485,23 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
|
|
|
454
485
|
value: (function () {
|
|
455
486
|
var _send = _asyncToGenerator(_regeneratorRuntime().mark(function _callee7() {
|
|
456
487
|
var sent;
|
|
457
|
-
return _regeneratorRuntime().wrap(function _callee7$(
|
|
458
|
-
while (1) switch (
|
|
488
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context8) {
|
|
489
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
459
490
|
case 0:
|
|
460
491
|
if (this.signed) {
|
|
461
|
-
|
|
492
|
+
_context8.next = 2;
|
|
462
493
|
break;
|
|
463
494
|
}
|
|
464
495
|
throw new Error("The transaction has not yet been signed. Run `sign` first, or use `signAndSend` instead.");
|
|
465
496
|
case 2:
|
|
466
|
-
|
|
467
|
-
return _sent_transaction.SentTransaction.init(
|
|
497
|
+
_context8.next = 4;
|
|
498
|
+
return _sent_transaction.SentTransaction.init(this);
|
|
468
499
|
case 4:
|
|
469
|
-
sent =
|
|
470
|
-
return
|
|
500
|
+
sent = _context8.sent;
|
|
501
|
+
return _context8.abrupt("return", sent);
|
|
471
502
|
case 6:
|
|
472
503
|
case "end":
|
|
473
|
-
return
|
|
504
|
+
return _context8.stop();
|
|
474
505
|
}
|
|
475
506
|
}, _callee7, this);
|
|
476
507
|
}));
|
|
@@ -492,47 +523,47 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
|
|
|
492
523
|
var _restoreFootprint = _asyncToGenerator(_regeneratorRuntime().mark(function _callee8(restorePreamble, account) {
|
|
493
524
|
var _account;
|
|
494
525
|
var restoreTx, sentTransaction;
|
|
495
|
-
return _regeneratorRuntime().wrap(function _callee8$(
|
|
496
|
-
while (1) switch (
|
|
526
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context9) {
|
|
527
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
497
528
|
case 0:
|
|
498
529
|
if (this.options.signTransaction) {
|
|
499
|
-
|
|
530
|
+
_context9.next = 2;
|
|
500
531
|
break;
|
|
501
532
|
}
|
|
502
533
|
throw new Error("For automatic restore to work you must provide a signTransaction function when initializing your Client");
|
|
503
534
|
case 2:
|
|
504
535
|
if (!((_account = account) !== null && _account !== void 0)) {
|
|
505
|
-
|
|
536
|
+
_context9.next = 6;
|
|
506
537
|
break;
|
|
507
538
|
}
|
|
508
|
-
|
|
509
|
-
|
|
539
|
+
_context9.t0 = _account;
|
|
540
|
+
_context9.next = 9;
|
|
510
541
|
break;
|
|
511
542
|
case 6:
|
|
512
|
-
|
|
543
|
+
_context9.next = 8;
|
|
513
544
|
return (0, _utils.getAccount)(this.options, this.server);
|
|
514
545
|
case 8:
|
|
515
|
-
|
|
546
|
+
_context9.t0 = _context9.sent;
|
|
516
547
|
case 9:
|
|
517
|
-
account =
|
|
518
|
-
|
|
548
|
+
account = _context9.t0;
|
|
549
|
+
_context9.next = 12;
|
|
519
550
|
return AssembledTransaction.buildFootprintRestoreTransaction(_objectSpread({}, this.options), restorePreamble.transactionData, account, restorePreamble.minResourceFee);
|
|
520
551
|
case 12:
|
|
521
|
-
restoreTx =
|
|
522
|
-
|
|
552
|
+
restoreTx = _context9.sent;
|
|
553
|
+
_context9.next = 15;
|
|
523
554
|
return restoreTx.signAndSend();
|
|
524
555
|
case 15:
|
|
525
|
-
sentTransaction =
|
|
556
|
+
sentTransaction = _context9.sent;
|
|
526
557
|
if (sentTransaction.getTransactionResponse) {
|
|
527
|
-
|
|
558
|
+
_context9.next = 18;
|
|
528
559
|
break;
|
|
529
560
|
}
|
|
530
561
|
throw new AssembledTransaction.Errors.RestorationFailure("The attempt at automatic restore failed. \n".concat(JSON.stringify(sentTransaction)));
|
|
531
562
|
case 18:
|
|
532
|
-
return
|
|
563
|
+
return _context9.abrupt("return", sentTransaction.getTransactionResponse);
|
|
533
564
|
case 19:
|
|
534
565
|
case "end":
|
|
535
|
-
return
|
|
566
|
+
return _context9.stop();
|
|
536
567
|
}
|
|
537
568
|
}, _callee8, this);
|
|
538
569
|
}));
|
|
@@ -588,30 +619,30 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
|
|
|
588
619
|
var _build = _asyncToGenerator(_regeneratorRuntime().mark(function _callee9(options) {
|
|
589
620
|
var _options$fee, _options$args, _options$timeoutInSec;
|
|
590
621
|
var tx, contract, account;
|
|
591
|
-
return _regeneratorRuntime().wrap(function _callee9$(
|
|
592
|
-
while (1) switch (
|
|
622
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context10) {
|
|
623
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
593
624
|
case 0:
|
|
594
625
|
tx = new AssembledTransaction(options);
|
|
595
626
|
contract = new _stellarBase.Contract(options.contractId);
|
|
596
|
-
|
|
627
|
+
_context10.next = 4;
|
|
597
628
|
return (0, _utils.getAccount)(options, tx.server);
|
|
598
629
|
case 4:
|
|
599
|
-
account =
|
|
630
|
+
account = _context10.sent;
|
|
600
631
|
tx.raw = new _stellarBase.TransactionBuilder(account, {
|
|
601
632
|
fee: (_options$fee = options.fee) !== null && _options$fee !== void 0 ? _options$fee : _stellarBase.BASE_FEE,
|
|
602
633
|
networkPassphrase: options.networkPassphrase
|
|
603
634
|
}).addOperation(contract.call.apply(contract, [options.method].concat(_toConsumableArray((_options$args = options.args) !== null && _options$args !== void 0 ? _options$args : [])))).setTimeout((_options$timeoutInSec = options.timeoutInSeconds) !== null && _options$timeoutInSec !== void 0 ? _options$timeoutInSec : _types.DEFAULT_TIMEOUT);
|
|
604
635
|
if (!options.simulate) {
|
|
605
|
-
|
|
636
|
+
_context10.next = 9;
|
|
606
637
|
break;
|
|
607
638
|
}
|
|
608
|
-
|
|
639
|
+
_context10.next = 9;
|
|
609
640
|
return tx.simulate();
|
|
610
641
|
case 9:
|
|
611
|
-
return
|
|
642
|
+
return _context10.abrupt("return", tx);
|
|
612
643
|
case 10:
|
|
613
644
|
case "end":
|
|
614
|
-
return
|
|
645
|
+
return _context10.stop();
|
|
615
646
|
}
|
|
616
647
|
}, _callee9);
|
|
617
648
|
}));
|
|
@@ -626,23 +657,23 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
|
|
|
626
657
|
var _buildFootprintRestoreTransaction = _asyncToGenerator(_regeneratorRuntime().mark(function _callee10(options, sorobanData, account, fee) {
|
|
627
658
|
var _options$timeoutInSec2;
|
|
628
659
|
var tx;
|
|
629
|
-
return _regeneratorRuntime().wrap(function _callee10$(
|
|
630
|
-
while (1) switch (
|
|
660
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context11) {
|
|
661
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
631
662
|
case 0:
|
|
632
663
|
tx = new AssembledTransaction(options);
|
|
633
664
|
tx.raw = new _stellarBase.TransactionBuilder(account, {
|
|
634
665
|
fee: fee,
|
|
635
666
|
networkPassphrase: options.networkPassphrase
|
|
636
667
|
}).setSorobanData(sorobanData instanceof _stellarBase.SorobanDataBuilder ? sorobanData.build() : sorobanData).addOperation(_stellarBase.Operation.restoreFootprint({})).setTimeout((_options$timeoutInSec2 = options.timeoutInSeconds) !== null && _options$timeoutInSec2 !== void 0 ? _options$timeoutInSec2 : _types.DEFAULT_TIMEOUT);
|
|
637
|
-
|
|
668
|
+
_context11.next = 4;
|
|
638
669
|
return tx.simulate({
|
|
639
670
|
restore: false
|
|
640
671
|
});
|
|
641
672
|
case 4:
|
|
642
|
-
return
|
|
673
|
+
return _context11.abrupt("return", tx);
|
|
643
674
|
case 5:
|
|
644
675
|
case "end":
|
|
645
|
-
return
|
|
676
|
+
return _context11.stop();
|
|
646
677
|
}
|
|
647
678
|
}, _callee10);
|
|
648
679
|
}));
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { Keypair } from "@stellar/stellar-base";
|
|
2
2
|
/**
|
|
3
|
-
* For use with {@link Client} and {@link AssembledTransaction}.
|
|
3
|
+
* For use with {@link Client} and {@link module:contract.AssembledTransaction}.
|
|
4
4
|
* Implements `signTransaction` and `signAuthEntry` with signatures expected by
|
|
5
5
|
* those classes. This is useful for testing and maybe some simple Node
|
|
6
6
|
* applications. Feel free to use this as a starting point for your own
|
|
7
7
|
* Wallet/TransactionSigner implementation.
|
|
8
|
+
*
|
|
9
|
+
* @memberof module:contract
|
|
10
|
+
*
|
|
11
|
+
* @param {Keypair} keypair {@link Keypair} to use to sign the transaction or auth entry
|
|
12
|
+
* @param {string} networkPassphrase passphrase of network to sign for
|
|
8
13
|
*/
|
|
9
14
|
export declare const basicNodeSigner: (keypair: Keypair, networkPassphrase: string) => {
|
|
10
15
|
signTransaction: (tx: string) => Promise<string>;
|
package/lib/contract/client.d.ts
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
import { Spec } from "./spec";
|
|
2
2
|
import { AssembledTransaction } from "./assembled_transaction";
|
|
3
3
|
import type { ClientOptions } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* Generate a class from the contract spec that where each contract method
|
|
6
|
+
* gets included with an identical name.
|
|
7
|
+
*
|
|
8
|
+
* Each method returns an {@link module:contract.AssembledTransaction | AssembledTransaction} that can
|
|
9
|
+
* be used to modify, simulate, decode results, and possibly sign, & submit the
|
|
10
|
+
* transaction.
|
|
11
|
+
*
|
|
12
|
+
* @memberof module:contract
|
|
13
|
+
*
|
|
14
|
+
* @class
|
|
15
|
+
* @param {module:contract.Spec} spec {@link Spec} to construct a Client for
|
|
16
|
+
* @param {ClientOptions} options see {@link ClientOptions}
|
|
17
|
+
*/
|
|
4
18
|
export declare class Client {
|
|
5
|
-
/** {@link Spec} to construct a Client for */
|
|
6
19
|
readonly spec: Spec;
|
|
7
|
-
/** see {@link ClientOptions} */
|
|
8
20
|
readonly options: ClientOptions;
|
|
9
|
-
|
|
10
|
-
* Generate a class from the contract spec that where each contract method
|
|
11
|
-
* gets included with an identical name.
|
|
12
|
-
*
|
|
13
|
-
* Each method returns an {@link AssembledTransaction} that can be used to
|
|
14
|
-
* modify, simulate, decode results, and possibly sign, & submit the
|
|
15
|
-
* transaction.
|
|
16
|
-
*/
|
|
17
|
-
constructor(
|
|
18
|
-
/** {@link Spec} to construct a Client for */
|
|
19
|
-
spec: Spec,
|
|
20
|
-
/** see {@link ClientOptions} */
|
|
21
|
-
options: ClientOptions);
|
|
21
|
+
constructor(spec: Spec, options: ClientOptions);
|
|
22
22
|
/**
|
|
23
23
|
* Generates a Client instance from the provided ClientOptions and the contract's wasm hash.
|
|
24
24
|
* The wasmHash can be provided in either hex or base64 format.
|
|
25
25
|
*
|
|
26
|
-
* @param wasmHash The hash of the contract's wasm binary, in either hex or base64 format.
|
|
27
|
-
* @param options The ClientOptions object containing the necessary configuration, including the rpcUrl.
|
|
28
|
-
* @param format The format of the provided wasmHash, either "hex" or "base64". Defaults to "hex".
|
|
29
|
-
* @returns A Promise that resolves to a Client instance.
|
|
26
|
+
* @param {Buffer | string} wasmHash The hash of the contract's wasm binary, in either hex or base64 format.
|
|
27
|
+
* @param {ClientOptions} options The ClientOptions object containing the necessary configuration, including the rpcUrl.
|
|
28
|
+
* @param {('hex' | 'base64')} [format='hex'] The format of the provided wasmHash, either "hex" or "base64". Defaults to "hex".
|
|
29
|
+
* @returns {Promise<module:contract.Client>} A Promise that resolves to a Client instance.
|
|
30
30
|
* @throws {TypeError} If the provided options object does not contain an rpcUrl.
|
|
31
31
|
*/
|
|
32
32
|
static fromWasmHash(wasmHash: Buffer | string, options: ClientOptions, format?: "hex" | "base64"): Promise<Client>;
|
|
33
33
|
/**
|
|
34
34
|
* Generates a Client instance from the provided ClientOptions and the contract's wasm binary.
|
|
35
35
|
*
|
|
36
|
-
* @param wasm The contract's wasm binary as a Buffer.
|
|
37
|
-
* @param options The ClientOptions object containing the necessary configuration.
|
|
38
|
-
* @returns A Promise that resolves to a Client instance.
|
|
36
|
+
* @param {Buffer} wasm The contract's wasm binary as a Buffer.
|
|
37
|
+
* @param {ClientOptions} options The ClientOptions object containing the necessary configuration.
|
|
38
|
+
* @returns {Promise<module:contract.Client>} A Promise that resolves to a Client instance.
|
|
39
39
|
* @throws {Error} If the contract spec cannot be obtained from the provided wasm binary.
|
|
40
40
|
*/
|
|
41
41
|
static fromWasm(wasm: Buffer, options: ClientOptions): Promise<Client>;
|
|
42
42
|
/**
|
|
43
43
|
* Generates a Client instance from the provided ClientOptions, which must include the contractId and rpcUrl.
|
|
44
44
|
*
|
|
45
|
-
* @param options The ClientOptions object containing the necessary configuration, including the contractId and rpcUrl.
|
|
46
|
-
* @returns A Promise that resolves to a Client instance.
|
|
45
|
+
* @param {ClientOptions} options The ClientOptions object containing the necessary configuration, including the contractId and rpcUrl.
|
|
46
|
+
* @returns {Promise<module:contract.Client>} A Promise that resolves to a Client instance.
|
|
47
47
|
* @throws {TypeError} If the provided options object does not contain both rpcUrl and contractId.
|
|
48
48
|
*/
|
|
49
49
|
static from(options: ClientOptions): Promise<Client>;
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* methods that return Results, to maintain their distinction from methods
|
|
4
4
|
* that simply either return a value or throw.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* #### Why is this needed?
|
|
7
7
|
*
|
|
8
|
-
* This is used by `ContractSpec` and
|
|
9
|
-
*
|
|
8
|
+
* This is used by {@link module:contract.Spec | `ContractSpec`} and
|
|
9
|
+
* {@link module:contract.AssembledTransaction | `AssembledTransaction`} when
|
|
10
|
+
* parsing values return by contracts.
|
|
10
11
|
*
|
|
11
12
|
* Contract methods can be implemented to return simple values, in which case
|
|
12
13
|
* they can also throw errors. This matches JavaScript's most idiomatic
|
|
@@ -27,6 +28,8 @@
|
|
|
27
28
|
* In the future, if this feels too un-idiomatic for JavaScript, we can always
|
|
28
29
|
* remove this and flatten all JS calls to `try...catch`. Easier to remove this
|
|
29
30
|
* logic later than it would be to add it.
|
|
31
|
+
*
|
|
32
|
+
* @memberof module:contract
|
|
30
33
|
*/
|
|
31
34
|
export interface Result<T, E extends ErrorMessage = ErrorMessage> {
|
|
32
35
|
unwrap(): T;
|
|
@@ -36,17 +39,22 @@ export interface Result<T, E extends ErrorMessage = ErrorMessage> {
|
|
|
36
39
|
}
|
|
37
40
|
/**
|
|
38
41
|
* Error interface containing the error message. Matches Rust's implementation.
|
|
39
|
-
* Part of implementing {@link Result}, a minimal
|
|
40
|
-
* `Result` type. Used for contract methods that return
|
|
41
|
-
* their distinction from methods that simply either return
|
|
42
|
+
* Part of implementing {@link module:contract.Result | Result}, a minimal
|
|
43
|
+
* implementation of Rust's `Result` type. Used for contract methods that return
|
|
44
|
+
* Results, to maintain their distinction from methods that simply either return
|
|
45
|
+
* a value or throw.
|
|
46
|
+
*
|
|
47
|
+
* @memberof module:contract
|
|
42
48
|
*/
|
|
43
49
|
export interface ErrorMessage {
|
|
44
50
|
message: string;
|
|
45
51
|
}
|
|
46
52
|
/**
|
|
47
|
-
* Part of implementing {@link Result}, a minimal
|
|
48
|
-
* `Result` type. Used for contract methods that return
|
|
49
|
-
* their distinction from methods that simply either return
|
|
53
|
+
* Part of implementing {@link module:contract.Result | Result}, a minimal
|
|
54
|
+
* implementation of Rust's `Result` type. Used for contract methods that return
|
|
55
|
+
* Results, to maintain their distinction from methods that simply either return
|
|
56
|
+
* a value or throw.
|
|
57
|
+
* @private
|
|
50
58
|
*/
|
|
51
59
|
export declare class Ok<T> implements Result<T, never> {
|
|
52
60
|
readonly value: T;
|
|
@@ -57,9 +65,11 @@ export declare class Ok<T> implements Result<T, never> {
|
|
|
57
65
|
isErr(): boolean;
|
|
58
66
|
}
|
|
59
67
|
/**
|
|
60
|
-
* Part of implementing {@link Result}, a minimal
|
|
61
|
-
* `Result` type. Used for contract methods that return
|
|
62
|
-
* their distinction from methods that simply either return
|
|
68
|
+
* Part of implementing {@link module:contract.Result | Result}, a minimal
|
|
69
|
+
* implementation of Rust's `Result` type. Used for contract methods that return
|
|
70
|
+
* Results, to maintain their distinction from methods that simply either return
|
|
71
|
+
* a value or throw.
|
|
72
|
+
* @private
|
|
63
73
|
*/
|
|
64
74
|
export declare class Err<E extends ErrorMessage> implements Result<never, E> {
|
|
65
75
|
readonly error: E;
|