@stellar/stellar-sdk 12.2.0 → 13.0.0-beta.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 +57 -0
- package/README.md +30 -8
- package/dist/stellar-sdk-minimal.js +45947 -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 +56586 -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 +49760 -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 +28423 -27354
- 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 +23 -17
- package/lib/contract/assembled_transaction.js +177 -154
- 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 +7 -1
- package/lib/contract/sent_transaction.js +2 -2
- 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 +17 -10
- 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/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/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 -4
- package/lib/index.js +7 -1
- 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 +85 -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 +278 -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 +19 -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 +36 -0
- package/lib/minimal/index.js +83 -0
- package/lib/minimal/rpc/api.d.ts +359 -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 +72 -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 +584 -0
- package/lib/minimal/rpc/server.js +823 -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 +19 -0
- package/lib/minimal/utils.js +31 -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 +85 -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 +278 -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 +19 -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 +36 -0
- package/lib/no-axios/index.js +83 -0
- package/lib/no-axios/rpc/api.d.ts +359 -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 +72 -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 +584 -0
- package/lib/no-axios/rpc/server.js +823 -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 +19 -0
- package/lib/no-axios/utils.js +31 -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 +85 -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 +278 -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 +19 -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 +36 -0
- package/lib/no-eventsource/index.js +83 -0
- package/lib/no-eventsource/rpc/api.d.ts +359 -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 +72 -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 +584 -0
- package/lib/no-eventsource/rpc/server.js +823 -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 +19 -0
- package/lib/no-eventsource/utils.js +31 -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 +73 -8
- 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 +1 -1
- package/lib/rpc/jsonrpc.d.ts +9 -1
- package/lib/rpc/parsers.d.ts +32 -10
- package/lib/rpc/parsers.js +40 -11
- package/lib/rpc/server.d.ts +197 -100
- package/lib/rpc/server.js +251 -110
- 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 +11 -4
- 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
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { HorizonApi } from "../horizon/horizon_api";
|
|
2
|
+
/**
|
|
3
|
+
* NetworkError is raised when an interaction with a Horizon server has caused
|
|
4
|
+
* some kind of problem.
|
|
5
|
+
* @category Errors
|
|
6
|
+
*
|
|
7
|
+
* @param {string} message Human-readable error message
|
|
8
|
+
* @param {any} response Response details, received from the Horizon server.
|
|
9
|
+
* @param {HorizonApi.ErrorResponseData} [response.data] The data returned by Horizon as part of the error: {@link https://developers.stellar.org/docs/data/horizon/api-reference/errors/response | Error Response}
|
|
10
|
+
* @param {number} [response.status] HTTP status code describing the basic issue with a submitted transaction {@link https://developers.stellar.org/docs/data/horizon/api-reference/errors/http-status-codes/standard | Standard Status Codes}
|
|
11
|
+
* @param {string} [response.statusText] A human-readable description of what the status code means: {@link https://developers.stellar.org/docs/data/horizon/api-reference/errors/http-status-codes/horizon-specific | Horizon-Specific Status Codes}
|
|
12
|
+
* @param {string} [response.url] URL which can provide more information about the problem that occurred.
|
|
13
|
+
*/
|
|
14
|
+
export declare class NetworkError extends Error {
|
|
15
|
+
response: {
|
|
16
|
+
data?: HorizonApi.ErrorResponseData;
|
|
17
|
+
status?: number;
|
|
18
|
+
statusText?: string;
|
|
19
|
+
url?: string;
|
|
20
|
+
};
|
|
21
|
+
__proto__: NetworkError;
|
|
22
|
+
constructor(message: string, response: any);
|
|
23
|
+
/**
|
|
24
|
+
* Returns the error response sent by the Horizon server.
|
|
25
|
+
* @returns {any}
|
|
26
|
+
*/
|
|
27
|
+
getResponse(): {
|
|
28
|
+
data?: HorizonApi.ErrorResponseData;
|
|
29
|
+
status?: number;
|
|
30
|
+
statusText?: string;
|
|
31
|
+
url?: string;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -4,7 +4,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.NetworkError = void 0;
|
|
8
8
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
9
9
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
10
10
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
@@ -38,62 +38,4 @@ var NetworkError = exports.NetworkError = function (_Error) {
|
|
|
38
38
|
return this.response;
|
|
39
39
|
}
|
|
40
40
|
}]);
|
|
41
|
-
}(_wrapNativeSuper(Error));
|
|
42
|
-
var NotFoundError = exports.NotFoundError = function (_NetworkError) {
|
|
43
|
-
function NotFoundError(message, response) {
|
|
44
|
-
var _this2;
|
|
45
|
-
_classCallCheck(this, NotFoundError);
|
|
46
|
-
var trueProto = (this instanceof NotFoundError ? this.constructor : void 0).prototype;
|
|
47
|
-
_this2 = _callSuper(this, NotFoundError, [message, response]);
|
|
48
|
-
_this2.__proto__ = trueProto;
|
|
49
|
-
_this2.constructor = NotFoundError;
|
|
50
|
-
_this2.name = "NotFoundError";
|
|
51
|
-
return _this2;
|
|
52
|
-
}
|
|
53
|
-
_inherits(NotFoundError, _NetworkError);
|
|
54
|
-
return _createClass(NotFoundError);
|
|
55
|
-
}(NetworkError);
|
|
56
|
-
var BadRequestError = exports.BadRequestError = function (_NetworkError2) {
|
|
57
|
-
function BadRequestError(message, response) {
|
|
58
|
-
var _this3;
|
|
59
|
-
_classCallCheck(this, BadRequestError);
|
|
60
|
-
var trueProto = (this instanceof BadRequestError ? this.constructor : void 0).prototype;
|
|
61
|
-
_this3 = _callSuper(this, BadRequestError, [message, response]);
|
|
62
|
-
_this3.__proto__ = trueProto;
|
|
63
|
-
_this3.constructor = BadRequestError;
|
|
64
|
-
_this3.name = "BadRequestError";
|
|
65
|
-
return _this3;
|
|
66
|
-
}
|
|
67
|
-
_inherits(BadRequestError, _NetworkError2);
|
|
68
|
-
return _createClass(BadRequestError);
|
|
69
|
-
}(NetworkError);
|
|
70
|
-
var BadResponseError = exports.BadResponseError = function (_NetworkError3) {
|
|
71
|
-
function BadResponseError(message, response) {
|
|
72
|
-
var _this4;
|
|
73
|
-
_classCallCheck(this, BadResponseError);
|
|
74
|
-
var trueProto = (this instanceof BadResponseError ? this.constructor : void 0).prototype;
|
|
75
|
-
_this4 = _callSuper(this, BadResponseError, [message, response]);
|
|
76
|
-
_this4.__proto__ = trueProto;
|
|
77
|
-
_this4.constructor = BadResponseError;
|
|
78
|
-
_this4.name = "BadResponseError";
|
|
79
|
-
return _this4;
|
|
80
|
-
}
|
|
81
|
-
_inherits(BadResponseError, _NetworkError3);
|
|
82
|
-
return _createClass(BadResponseError);
|
|
83
|
-
}(NetworkError);
|
|
84
|
-
var AccountRequiresMemoError = exports.AccountRequiresMemoError = function (_Error2) {
|
|
85
|
-
function AccountRequiresMemoError(message, accountId, operationIndex) {
|
|
86
|
-
var _this5;
|
|
87
|
-
_classCallCheck(this, AccountRequiresMemoError);
|
|
88
|
-
var trueProto = (this instanceof AccountRequiresMemoError ? this.constructor : void 0).prototype;
|
|
89
|
-
_this5 = _callSuper(this, AccountRequiresMemoError, [message]);
|
|
90
|
-
_this5.__proto__ = trueProto;
|
|
91
|
-
_this5.constructor = AccountRequiresMemoError;
|
|
92
|
-
_this5.name = "AccountRequiresMemoError";
|
|
93
|
-
_this5.accountId = accountId;
|
|
94
|
-
_this5.operationIndex = operationIndex;
|
|
95
|
-
return _this5;
|
|
96
|
-
}
|
|
97
|
-
_inherits(AccountRequiresMemoError, _Error2);
|
|
98
|
-
return _createClass(AccountRequiresMemoError);
|
|
99
41
|
}(_wrapNativeSuper(Error));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NetworkError } from "./network";
|
|
2
|
+
/**
|
|
3
|
+
* NotFoundError is raised when the resource requested from Horizon is
|
|
4
|
+
* unavailable.
|
|
5
|
+
* @augments NetworkError
|
|
6
|
+
* @inheritdoc
|
|
7
|
+
* @category Errors
|
|
8
|
+
*
|
|
9
|
+
* @param {string} message Human-readable error message
|
|
10
|
+
* @param {any} response Response details, received from the Horizon server
|
|
11
|
+
*/
|
|
12
|
+
export declare class NotFoundError extends NetworkError {
|
|
13
|
+
constructor(message: string, response: any);
|
|
14
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.NotFoundError = void 0;
|
|
8
|
+
var _network = require("./network");
|
|
9
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
10
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
12
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
13
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
14
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
15
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
16
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
17
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
18
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
19
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
20
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
21
|
+
var NotFoundError = exports.NotFoundError = function (_NetworkError) {
|
|
22
|
+
function NotFoundError(message, response) {
|
|
23
|
+
var _this;
|
|
24
|
+
_classCallCheck(this, NotFoundError);
|
|
25
|
+
var trueProto = (this instanceof NotFoundError ? this.constructor : void 0).prototype;
|
|
26
|
+
_this = _callSuper(this, NotFoundError, [message, response]);
|
|
27
|
+
_this.__proto__ = trueProto;
|
|
28
|
+
_this.constructor = NotFoundError;
|
|
29
|
+
_this.name = "NotFoundError";
|
|
30
|
+
return _this;
|
|
31
|
+
}
|
|
32
|
+
_inherits(NotFoundError, _NetworkError);
|
|
33
|
+
return _createClass(NotFoundError);
|
|
34
|
+
}(_network.NetworkError);
|
package/lib/federation/api.d.ts
CHANGED
|
@@ -1,11 +1,32 @@
|
|
|
1
1
|
export declare namespace Api {
|
|
2
|
+
/**
|
|
3
|
+
* Record returned from a federation server.
|
|
4
|
+
*/
|
|
2
5
|
interface Record {
|
|
6
|
+
/**
|
|
7
|
+
* The Stellar public key resolved from the federation lookup
|
|
8
|
+
*/
|
|
3
9
|
account_id: string;
|
|
10
|
+
/**
|
|
11
|
+
* The type of memo, if any, required to send payments to this user
|
|
12
|
+
*/
|
|
4
13
|
memo_type?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The memo value, if any, required to send payments to this user
|
|
16
|
+
*/
|
|
5
17
|
memo?: string;
|
|
6
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Options for configuring connections to federation servers. You can also use {@link Config} class to set this globally.
|
|
21
|
+
*/
|
|
7
22
|
interface Options {
|
|
23
|
+
/**
|
|
24
|
+
* Allow connecting to http servers, default: `false`. This must be set to false in production deployments!
|
|
25
|
+
*/
|
|
8
26
|
allowHttp?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Allow a timeout, default: 0. Allows user to avoid nasty lag due to TOML resolve issue.
|
|
29
|
+
*/
|
|
9
30
|
timeout?: number;
|
|
10
31
|
}
|
|
11
32
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { FederationServer as Server, FEDERATION_RESPONSE_MAX_SIZE } from './server';
|
|
2
|
-
export *
|
|
2
|
+
export * from './api';
|
package/lib/federation/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
Server: true,
|
|
8
|
+
FEDERATION_RESPONSE_MAX_SIZE: true
|
|
9
|
+
};
|
|
8
10
|
Object.defineProperty(exports, "FEDERATION_RESPONSE_MAX_SIZE", {
|
|
9
11
|
enumerable: true,
|
|
10
12
|
get: function get() {
|
|
@@ -18,7 +20,15 @@ Object.defineProperty(exports, "Server", {
|
|
|
18
20
|
}
|
|
19
21
|
});
|
|
20
22
|
var _server = require("./server");
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
var _api = require("./api");
|
|
24
|
+
Object.keys(_api).forEach(function (key) {
|
|
25
|
+
if (key === "default" || key === "__esModule") return;
|
|
26
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
27
|
+
if (key in exports && exports[key] === _api[key]) return;
|
|
28
|
+
Object.defineProperty(exports, key, {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function get() {
|
|
31
|
+
return _api[key];
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -1,36 +1,33 @@
|
|
|
1
1
|
import { Api } from "./api";
|
|
2
|
+
/** @module Federation */
|
|
3
|
+
/**
|
|
4
|
+
* The maximum size of response from a federation server
|
|
5
|
+
* @default 102400
|
|
6
|
+
*/
|
|
2
7
|
export declare const FEDERATION_RESPONSE_MAX_SIZE: number;
|
|
3
8
|
/**
|
|
4
|
-
*
|
|
5
|
-
* [federation server](https://developers.stellar.org/docs/
|
|
9
|
+
* Federation.Server handles a network connection to a
|
|
10
|
+
* [federation server](https://developers.stellar.org/docs/learn/encyclopedia/federation)
|
|
6
11
|
* instance and exposes an interface for requests to that instance.
|
|
7
|
-
*
|
|
12
|
+
*
|
|
13
|
+
* @alias module:Federation.Server
|
|
14
|
+
* @memberof module:Federation
|
|
8
15
|
* @param {string} serverURL The federation server URL (ex. `https://acme.com/federation`).
|
|
9
16
|
* @param {string} domain Domain this server represents
|
|
10
|
-
* @param {
|
|
11
|
-
* @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.
|
|
12
|
-
* @param {number} [opts.timeout] - Allow a timeout, default: 0. Allows user to avoid nasty lag due to TOML resolve issue. You can also use {@link Config} class to set this globally.
|
|
17
|
+
* @param {Api.Options} [opts] Options object
|
|
13
18
|
* @returns {void}
|
|
14
19
|
*/
|
|
15
20
|
export declare class FederationServer {
|
|
16
21
|
/**
|
|
17
22
|
* The federation server URL (ex. `https://acme.com/federation`).
|
|
18
|
-
*
|
|
19
|
-
* @memberof FederationServer
|
|
20
23
|
*/
|
|
21
24
|
private readonly serverURL;
|
|
22
25
|
/**
|
|
23
26
|
* Domain this server represents.
|
|
24
|
-
*
|
|
25
|
-
* @type {string}
|
|
26
|
-
* @memberof FederationServer
|
|
27
27
|
*/
|
|
28
28
|
private readonly domain;
|
|
29
29
|
/**
|
|
30
30
|
* Allow a timeout, default: 0. Allows user to avoid nasty lag due to TOML resolve issue.
|
|
31
|
-
*
|
|
32
|
-
* @type {number}
|
|
33
|
-
* @memberof FederationServer
|
|
34
31
|
*/
|
|
35
32
|
private readonly timeout;
|
|
36
33
|
/**
|
|
@@ -44,8 +41,7 @@ export declare class FederationServer {
|
|
|
44
41
|
* resolves if Account ID is valid and rejects in all other cases. Please note that this method does not check
|
|
45
42
|
* if the account actually exists in a ledger.
|
|
46
43
|
*
|
|
47
|
-
*
|
|
48
|
-
* ```js
|
|
44
|
+
* @example
|
|
49
45
|
* StellarSdk.FederationServer.resolve('bob*stellar.org')
|
|
50
46
|
* .then(federationRecord => {
|
|
51
47
|
* // {
|
|
@@ -54,28 +50,24 @@ export declare class FederationServer {
|
|
|
54
50
|
* // memo: 100
|
|
55
51
|
* // }
|
|
56
52
|
* });
|
|
57
|
-
* ```
|
|
58
53
|
*
|
|
59
|
-
* @see <a href="https://developers.stellar.org/docs/
|
|
60
|
-
* @see <a href="https://developers.stellar.org/docs/issuing-assets/publishing-asset-info
|
|
54
|
+
* @see <a href="https://developers.stellar.org/docs/learn/encyclopedia/federation" target="_blank">Federation doc</a>
|
|
55
|
+
* @see <a href="https://developers.stellar.org/docs/issuing-assets/publishing-asset-info" target="_blank">Stellar.toml doc</a>
|
|
61
56
|
* @param {string} value Stellar Address (ex. `bob*stellar.org`)
|
|
62
57
|
* @param {object} [opts] Options object
|
|
63
|
-
* @
|
|
64
|
-
* @
|
|
65
|
-
* @returns {Promise} `Promise` that resolves to a JSON object with this shape:
|
|
66
|
-
* * `account_id` - Account ID of the destination,
|
|
67
|
-
* * `memo_type` (optional) - Memo type that needs to be attached to a transaction,
|
|
68
|
-
* * `memo` (optional) - Memo value that needs to be attached to a transaction.
|
|
58
|
+
* @returns {Promise<module:Federation.Api.Record>} A promise that resolves to the federation record
|
|
59
|
+
* @throws Will throw an error if the provided account ID is not a valid Ed25519 public key.
|
|
69
60
|
*/
|
|
70
61
|
static resolve(value: string, opts?: Api.Options): Promise<Api.Record>;
|
|
71
62
|
/**
|
|
72
63
|
* Creates a `FederationServer` instance based on information from
|
|
73
|
-
* [stellar.toml](https://developers.stellar.org/docs/issuing-assets/publishing-asset-info
|
|
64
|
+
* [stellar.toml](https://developers.stellar.org/docs/issuing-assets/publishing-asset-info)
|
|
74
65
|
* file for a given domain.
|
|
75
66
|
*
|
|
76
67
|
* If `stellar.toml` file does not exist for a given domain or it does not
|
|
77
68
|
* contain information about a federation server Promise will reject.
|
|
78
|
-
*
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
79
71
|
* StellarSdk.FederationServer.createForDomain('acme.com')
|
|
80
72
|
* .then(federationServer => {
|
|
81
73
|
* // federationServer.resolveAddress('bob').then(...)
|
|
@@ -83,35 +75,41 @@ export declare class FederationServer {
|
|
|
83
75
|
* .catch(error => {
|
|
84
76
|
* // stellar.toml does not exist or it does not contain information about federation server.
|
|
85
77
|
* });
|
|
86
|
-
*
|
|
87
|
-
* @see <a href="https://developers.stellar.org/docs/issuing-assets/publishing-asset-info
|
|
78
|
+
*
|
|
79
|
+
* @see <a href="https://developers.stellar.org/docs/issuing-assets/publishing-asset-info" target="_blank">Stellar.toml doc</a>
|
|
88
80
|
* @param {string} domain Domain to get federation server for
|
|
89
|
-
* @param {
|
|
90
|
-
* @
|
|
91
|
-
* @
|
|
92
|
-
* @returns {Promise} `Promise` that resolves to a FederationServer object
|
|
81
|
+
* @param {module:Federation.Api.Options} [opts] Options object
|
|
82
|
+
* @returns {Promise<module:Federation.Api.Record>} A promise that resolves to the federation record
|
|
83
|
+
* @throws Will throw an error if the domain's stellar.toml file does not contain a federation server field.
|
|
93
84
|
*/
|
|
94
85
|
static createForDomain(domain: string, opts?: Api.Options): Promise<FederationServer>;
|
|
95
86
|
constructor(serverURL: string, domain: string, opts?: Api.Options);
|
|
96
87
|
/**
|
|
97
88
|
* Get the federation record if the user was found for a given Stellar address
|
|
98
|
-
* @see <a href="https://developers.stellar.org/docs/
|
|
89
|
+
* @see <a href="https://developers.stellar.org/docs/encyclopedia/federation" target="_blank">Federation doc</a>
|
|
99
90
|
* @param {string} address Stellar address (ex. `bob*stellar.org`). If `FederationServer` was instantiated with `domain` param only username (ex. `bob`) can be passed.
|
|
100
|
-
* @returns {Promise}
|
|
91
|
+
* @returns {Promise<module:Federation.Api.Record>} A promise that resolves to the federation record
|
|
92
|
+
* @throws Will throw an error if the federated address does not contain a domain, or if the server object was not instantiated with a `domain` parameter
|
|
101
93
|
*/
|
|
102
94
|
resolveAddress(address: string): Promise<Api.Record>;
|
|
103
95
|
/**
|
|
104
96
|
* Given an account ID, get their federation record if the user was found
|
|
105
|
-
* @see <a href="https://developers.stellar.org/docs/
|
|
97
|
+
* @see <a href="https://developers.stellar.org/docs/encyclopedia/federation" target="_blank">Federation doc</a>
|
|
106
98
|
* @param {string} accountId Account ID (ex. `GBYNR2QJXLBCBTRN44MRORCMI4YO7FZPFBCNOKTOBCAAFC7KC3LNPRYS`)
|
|
107
|
-
* @returns {Promise} A promise that resolves to the federation record
|
|
99
|
+
* @returns {Promise<module:Federation.Api.Record>} A promise that resolves to the federation record
|
|
100
|
+
* @throws Will throw an error if the federation server returns an invalid memo value.
|
|
101
|
+
* @throws Will throw an error if the federation server's response exceeds the allowed maximum size.
|
|
102
|
+
* @throws {BadResponseError} Will throw an error if the server query fails with an improper response.
|
|
108
103
|
*/
|
|
109
104
|
resolveAccountId(accountId: string): Promise<Api.Record>;
|
|
110
105
|
/**
|
|
111
106
|
* Given a transactionId, get the federation record if the sender of the transaction was found
|
|
112
107
|
* @see <a href="https://developers.stellar.org/docs/glossary/federation/" target="_blank">Federation doc</a>
|
|
113
108
|
* @param {string} transactionId Transaction ID (ex. `3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889`)
|
|
114
|
-
* @returns {Promise} A promise that resolves to the federation record
|
|
109
|
+
* @returns {Promise<module:Federation.Api.Record>} A promise that resolves to the federation record
|
|
110
|
+
* @throws Will throw an error if the federation server returns an invalid memo value.
|
|
111
|
+
* @throws Will throw an error if the federation server's response exceeds the allowed maximum size.
|
|
112
|
+
* @throws {BadResponseError} Will throw an error if the server query fails with an improper response.
|
|
115
113
|
*/
|
|
116
114
|
resolveTransactionId(transactionId: string): Promise<Api.Record>;
|
|
117
115
|
private _sendRequest;
|
package/lib/federation/server.js
CHANGED
|
@@ -4,12 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.FederationServer = exports.FEDERATION_RESPONSE_MAX_SIZE = void 0;
|
|
7
|
-
var _axios = _interopRequireDefault(require("axios"));
|
|
8
7
|
var _stellarBase = require("@stellar/stellar-base");
|
|
9
8
|
var _urijs = _interopRequireDefault(require("urijs"));
|
|
10
9
|
var _config = require("../config");
|
|
11
10
|
var _errors = require("../errors");
|
|
12
11
|
var _stellartoml = require("../stellartoml");
|
|
12
|
+
var _httpClient = require("../http-client");
|
|
13
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
14
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
15
15
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
@@ -133,7 +133,7 @@ var FederationServer = exports.FederationServer = function () {
|
|
|
133
133
|
while (1) switch (_context4.prev = _context4.next) {
|
|
134
134
|
case 0:
|
|
135
135
|
timeout = this.timeout;
|
|
136
|
-
return _context4.abrupt("return",
|
|
136
|
+
return _context4.abrupt("return", _httpClient.httpClient.get(url.toString(), {
|
|
137
137
|
maxContentLength: FEDERATION_RESPONSE_MAX_SIZE,
|
|
138
138
|
timeout: timeout
|
|
139
139
|
}).then(function (response) {
|
|
@@ -2,12 +2,14 @@ import { Asset } from "@stellar/stellar-base";
|
|
|
2
2
|
import { CallBuilder } from "./call_builder";
|
|
3
3
|
import { ServerApi } from "./server_api";
|
|
4
4
|
/**
|
|
5
|
-
* Creates a new {@link AccountCallBuilder} pointed to server defined by serverUrl
|
|
6
|
-
*
|
|
5
|
+
* Creates a new {@link AccountCallBuilder} pointed to server defined by `serverUrl`.
|
|
6
|
+
*
|
|
7
|
+
* Do not create this object directly, use {@link Horizon.Server#accounts}.
|
|
8
|
+
*
|
|
9
|
+
* @see {@link https://developers.stellar.org/docs/data/horizon/api-reference/resources/list-all-accounts|All Accounts}
|
|
7
10
|
*
|
|
8
|
-
* @see [All Accounts](https://developers.stellar.org/api/resources/accounts/)
|
|
9
|
-
* @class AccountCallBuilder
|
|
10
11
|
* @augments CallBuilder
|
|
12
|
+
* @private
|
|
11
13
|
* @class
|
|
12
14
|
* @param {string} serverUrl Horizon server URL.
|
|
13
15
|
*/
|
|
@@ -17,21 +19,21 @@ export declare class AccountCallBuilder extends CallBuilder<ServerApi.Collection
|
|
|
17
19
|
* Returns information and links relating to a single account.
|
|
18
20
|
* The balances section in the returned JSON will also list all the trust lines this account has set up.
|
|
19
21
|
*
|
|
20
|
-
* @see
|
|
22
|
+
* @see {@link https://developers.stellar.org/docs/data/horizon/api-reference/resources/retrieve-an-account|Account Details}
|
|
21
23
|
* @param {string} id For example: `GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD`
|
|
22
24
|
* @returns {CallBuilder} a new CallBuilder instance for the /accounts/:id endpoint
|
|
23
25
|
*/
|
|
24
26
|
accountId(id: string): CallBuilder<ServerApi.AccountRecord>;
|
|
25
27
|
/**
|
|
26
28
|
* This endpoint filters accounts by signer account.
|
|
27
|
-
* @see
|
|
29
|
+
* @see {@link https://developers.stellar.org/docs/data/horizon/api-reference/resources/list-all-accounts|Accounts}
|
|
28
30
|
* @param {string} id For example: `GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD`
|
|
29
31
|
* @returns {AccountCallBuilder} current AccountCallBuilder instance
|
|
30
32
|
*/
|
|
31
33
|
forSigner(id: string): this;
|
|
32
34
|
/**
|
|
33
35
|
* This endpoint filters all accounts who are trustees to an asset.
|
|
34
|
-
* @see
|
|
36
|
+
* @see {@link https://developers.stellar.org/docs/data/horizon/api-reference/resources/list-all-accounts|Accounts}
|
|
35
37
|
* @see Asset
|
|
36
38
|
* @param {Asset} asset For example: `new Asset('USD','GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD')`
|
|
37
39
|
* @returns {AccountCallBuilder} current AccountCallBuilder instance
|
|
@@ -39,7 +41,7 @@ export declare class AccountCallBuilder extends CallBuilder<ServerApi.Collection
|
|
|
39
41
|
forAsset(asset: Asset): this;
|
|
40
42
|
/**
|
|
41
43
|
* This endpoint filters accounts where the given account is sponsoring the account or any of its sub-entries..
|
|
42
|
-
* @see
|
|
44
|
+
* @see {@link https://developers.stellar.org/docs/data/horizon/api-reference/resources/list-all-accounts|Accounts}
|
|
43
45
|
* @param {string} id For example: `GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD`
|
|
44
46
|
* @returns {AccountCallBuilder} current AccountCallBuilder instance
|
|
45
47
|
*/
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { HorizonApi } from "./horizon_api";
|
|
2
2
|
import { ServerApi } from "./server_api";
|
|
3
3
|
/**
|
|
4
|
-
* Do not create this object directly, use {@link Server#loadAccount}.
|
|
4
|
+
* Do not create this object directly, use {@link module:Horizon.Server#loadAccount | Horizon.Server#loadAccount}.
|
|
5
5
|
*
|
|
6
6
|
* Returns information and links relating to a single account.
|
|
7
7
|
* The balances section in the returned JSON will also list all the trust lines this account has set up.
|
|
8
8
|
* It also contains {@link BaseAccount} object and exposes it's methods so can be used in {@link TransactionBuilder}.
|
|
9
9
|
*
|
|
10
|
-
* @
|
|
10
|
+
* @memberof module:Horizon
|
|
11
|
+
* @private
|
|
12
|
+
*
|
|
13
|
+
* @see {@link https://developers.stellar.org/docs/data/horizon/api-reference/resources/accounts/object|Account Details}
|
|
11
14
|
* @param {string} response Response from horizon account endpoint.
|
|
12
15
|
* @returns {AccountResponse} AccountResponse instance
|
|
13
16
|
*/
|
|
@@ -3,10 +3,11 @@ import { ServerApi } from "./server_api";
|
|
|
3
3
|
/**
|
|
4
4
|
* Creates a new {@link AssetsCallBuilder} pointed to server defined by serverUrl.
|
|
5
5
|
*
|
|
6
|
-
* Do not create this object directly, use {@link Server#assets}.
|
|
7
|
-
*
|
|
6
|
+
* Do not create this object directly, use {@link Horizon.Server#assets}.
|
|
7
|
+
*
|
|
8
8
|
* @class
|
|
9
9
|
* @augments CallBuilder
|
|
10
|
+
* @private
|
|
10
11
|
* @param {string} serverUrl Horizon server URL.
|
|
11
12
|
*/
|
|
12
13
|
export declare class AssetsCallBuilder extends CallBuilder<ServerApi.CollectionPage<ServerApi.AssetRecord>> {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -9,8 +8,8 @@ var _urijs = _interopRequireDefault(require("urijs"));
|
|
|
9
8
|
var _URITemplate = _interopRequireDefault(require("urijs/src/URITemplate"));
|
|
10
9
|
var _errors = require("../errors");
|
|
11
10
|
var _horizon_axios_client = require("./horizon_axios_client");
|
|
12
|
-
var _ref, _anyGlobal$EventSourc, _anyGlobal$window;
|
|
13
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
14
13
|
function _regeneratorRuntime() { "use strict"; _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
15
14
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
16
15
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
@@ -21,7 +20,11 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
21
20
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
22
21
|
var JOINABLE = ["transaction"];
|
|
23
22
|
var anyGlobal = global;
|
|
24
|
-
var EventSource
|
|
23
|
+
var EventSource;
|
|
24
|
+
if (typeof true !== 'undefined' && true) {
|
|
25
|
+
var _ref, _anyGlobal$EventSourc, _anyGlobal$window;
|
|
26
|
+
EventSource = (_ref = (_anyGlobal$EventSourc = anyGlobal.EventSource) !== null && _anyGlobal$EventSourc !== void 0 ? _anyGlobal$EventSourc : (_anyGlobal$window = anyGlobal.window) === null || _anyGlobal$window === void 0 ? void 0 : _anyGlobal$window.EventSource) !== null && _ref !== void 0 ? _ref : require("eventsource");
|
|
27
|
+
}
|
|
25
28
|
var CallBuilder = exports.CallBuilder = function () {
|
|
26
29
|
function CallBuilder(serverUrl) {
|
|
27
30
|
var neighborRoot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
@@ -45,6 +48,9 @@ var CallBuilder = exports.CallBuilder = function () {
|
|
|
45
48
|
value: function stream() {
|
|
46
49
|
var _this2 = this;
|
|
47
50
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
51
|
+
if (EventSource === undefined) {
|
|
52
|
+
throw new Error("Streaming requires eventsource to be enabled. If you need this functionality, compile with USE_EVENTSOURCE=true.");
|
|
53
|
+
}
|
|
48
54
|
this.checkFilter();
|
|
49
55
|
this.url.setQuery("X-Client-Name", "js-stellar-sdk");
|
|
50
56
|
this.url.setQuery("X-Client-Version", _horizon_axios_client.version);
|
|
@@ -54,10 +60,10 @@ var CallBuilder = exports.CallBuilder = function () {
|
|
|
54
60
|
timeout = setTimeout(function () {
|
|
55
61
|
var _es;
|
|
56
62
|
(_es = es) === null || _es === void 0 || _es.close();
|
|
57
|
-
es =
|
|
63
|
+
es = _createEventSource();
|
|
58
64
|
}, options.reconnectTimeout || 15 * 1000);
|
|
59
65
|
};
|
|
60
|
-
var
|
|
66
|
+
var _createEventSource = function createEventSource() {
|
|
61
67
|
try {
|
|
62
68
|
es = new EventSource(_this2.url.toString());
|
|
63
69
|
} catch (err) {
|
|
@@ -76,7 +82,7 @@ var CallBuilder = exports.CallBuilder = function () {
|
|
|
76
82
|
}
|
|
77
83
|
clearTimeout(timeout);
|
|
78
84
|
es.close();
|
|
79
|
-
|
|
85
|
+
_createEventSource();
|
|
80
86
|
closed = true;
|
|
81
87
|
};
|
|
82
88
|
var onMessage = function onMessage(message) {
|
|
@@ -109,7 +115,7 @@ var CallBuilder = exports.CallBuilder = function () {
|
|
|
109
115
|
}
|
|
110
116
|
return es;
|
|
111
117
|
};
|
|
112
|
-
|
|
118
|
+
_createEventSource();
|
|
113
119
|
return function () {
|
|
114
120
|
var _es2;
|
|
115
121
|
clearTimeout(timeout);
|
|
@@ -321,10 +327,11 @@ var CallBuilder = exports.CallBuilder = function () {
|
|
|
321
327
|
key: "_handleNetworkError",
|
|
322
328
|
value: (function () {
|
|
323
329
|
var _handleNetworkError2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee6(error) {
|
|
330
|
+
var _error$response$statu, _error$response$statu2;
|
|
324
331
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
325
332
|
while (1) switch (_context6.prev = _context6.next) {
|
|
326
333
|
case 0:
|
|
327
|
-
if (!(error.response && error.response.status
|
|
334
|
+
if (!(error.response && error.response.status)) {
|
|
328
335
|
_context6.next = 8;
|
|
329
336
|
break;
|
|
330
337
|
}
|
|
@@ -332,9 +339,9 @@ var CallBuilder = exports.CallBuilder = function () {
|
|
|
332
339
|
_context6.next = _context6.t0 === 404 ? 4 : 5;
|
|
333
340
|
break;
|
|
334
341
|
case 4:
|
|
335
|
-
return _context6.abrupt("return", Promise.reject(new _errors.NotFoundError(error.response.statusText, error.response.data)));
|
|
342
|
+
return _context6.abrupt("return", Promise.reject(new _errors.NotFoundError((_error$response$statu = error.response.statusText) !== null && _error$response$statu !== void 0 ? _error$response$statu : "Not Found", error.response.data)));
|
|
336
343
|
case 5:
|
|
337
|
-
return _context6.abrupt("return", Promise.reject(new _errors.NetworkError(error.response.statusText, error.response.data)));
|
|
344
|
+
return _context6.abrupt("return", Promise.reject(new _errors.NetworkError((_error$response$statu2 = error.response.statusText) !== null && _error$response$statu2 !== void 0 ? _error$response$statu2 : "Unknown", error.response.data)));
|
|
338
345
|
case 6:
|
|
339
346
|
_context6.next = 9;
|
|
340
347
|
break;
|