@stellar/stellar-sdk 14.3.2 → 14.4.0

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.
Files changed (143) hide show
  1. package/CHANGELOG.md +21 -1
  2. package/dist/stellar-sdk-minimal.js +7222 -7108
  3. package/dist/stellar-sdk-minimal.min.js +1 -1
  4. package/dist/stellar-sdk-no-axios.js +3460 -3346
  5. package/dist/stellar-sdk-no-axios.min.js +1 -1
  6. package/dist/stellar-sdk-no-eventsource.js +7213 -7099
  7. package/dist/stellar-sdk-no-eventsource.min.js +1 -1
  8. package/dist/stellar-sdk.js +8051 -7937
  9. package/dist/stellar-sdk.min.js +1 -1
  10. package/lib/config.d.ts +2 -6
  11. package/lib/contract/assembled_transaction.d.ts +16 -132
  12. package/lib/contract/assembled_transaction.js +14 -114
  13. package/lib/contract/errors.d.ts +26 -0
  14. package/lib/contract/errors.js +126 -0
  15. package/lib/contract/sent_transaction.d.ts +1 -1
  16. package/lib/contract/spec.d.ts +2 -2
  17. package/lib/contract/spec.js +40 -28
  18. package/lib/contract/types.d.ts +35 -9
  19. package/lib/contract/utils.d.ts +1 -1
  20. package/lib/contract/utils.js +18 -53
  21. package/lib/contract/wasm_spec_parser.d.ts +7 -0
  22. package/lib/contract/wasm_spec_parser.js +15 -0
  23. package/lib/errors/network.d.ts +1 -1
  24. package/lib/federation/server.d.ts +7 -7
  25. package/lib/horizon/horizon_axios_client.js +1 -1
  26. package/lib/horizon/server.d.ts +1 -1
  27. package/lib/horizon/server.js +2 -2
  28. package/lib/index.d.ts +0 -3
  29. package/lib/minimal/config.d.ts +2 -6
  30. package/lib/minimal/contract/assembled_transaction.d.ts +16 -132
  31. package/lib/minimal/contract/assembled_transaction.js +14 -114
  32. package/lib/minimal/contract/errors.d.ts +26 -0
  33. package/lib/minimal/contract/errors.js +126 -0
  34. package/lib/minimal/contract/sent_transaction.d.ts +1 -1
  35. package/lib/minimal/contract/spec.d.ts +2 -2
  36. package/lib/minimal/contract/spec.js +40 -28
  37. package/lib/minimal/contract/types.d.ts +35 -9
  38. package/lib/minimal/contract/utils.d.ts +1 -1
  39. package/lib/minimal/contract/utils.js +18 -53
  40. package/lib/minimal/contract/wasm_spec_parser.d.ts +7 -0
  41. package/lib/minimal/contract/wasm_spec_parser.js +15 -0
  42. package/lib/minimal/errors/network.d.ts +1 -1
  43. package/lib/minimal/federation/server.d.ts +7 -7
  44. package/lib/minimal/horizon/horizon_axios_client.js +1 -1
  45. package/lib/minimal/horizon/server.d.ts +1 -1
  46. package/lib/minimal/horizon/server.js +2 -2
  47. package/lib/minimal/index.d.ts +0 -3
  48. package/lib/minimal/rpc/api.d.ts +27 -3
  49. package/lib/minimal/rpc/axios.js +1 -1
  50. package/lib/minimal/rpc/jsonrpc.d.ts +2 -1
  51. package/lib/minimal/rpc/jsonrpc.js +1 -1
  52. package/lib/minimal/rpc/parsers.js +8 -5
  53. package/lib/minimal/rpc/server.d.ts +46 -7
  54. package/lib/minimal/rpc/server.js +290 -211
  55. package/lib/minimal/rpc/utils.js +1 -1
  56. package/lib/minimal/webauth/challenge_transaction.d.ts +235 -0
  57. package/lib/minimal/webauth/challenge_transaction.js +307 -0
  58. package/lib/minimal/webauth/index.d.ts +1 -0
  59. package/lib/minimal/webauth/index.js +13 -1
  60. package/lib/minimal/webauth/utils.d.ts +28 -273
  61. package/lib/minimal/webauth/utils.js +12 -288
  62. package/lib/no-axios/config.d.ts +2 -6
  63. package/lib/no-axios/contract/assembled_transaction.d.ts +16 -132
  64. package/lib/no-axios/contract/assembled_transaction.js +14 -114
  65. package/lib/no-axios/contract/errors.d.ts +26 -0
  66. package/lib/no-axios/contract/errors.js +126 -0
  67. package/lib/no-axios/contract/sent_transaction.d.ts +1 -1
  68. package/lib/no-axios/contract/spec.d.ts +2 -2
  69. package/lib/no-axios/contract/spec.js +40 -28
  70. package/lib/no-axios/contract/types.d.ts +35 -9
  71. package/lib/no-axios/contract/utils.d.ts +1 -1
  72. package/lib/no-axios/contract/utils.js +18 -53
  73. package/lib/no-axios/contract/wasm_spec_parser.d.ts +7 -0
  74. package/lib/no-axios/contract/wasm_spec_parser.js +15 -0
  75. package/lib/no-axios/errors/network.d.ts +1 -1
  76. package/lib/no-axios/federation/server.d.ts +7 -7
  77. package/lib/no-axios/horizon/horizon_axios_client.js +1 -1
  78. package/lib/no-axios/horizon/server.d.ts +1 -1
  79. package/lib/no-axios/horizon/server.js +2 -2
  80. package/lib/no-axios/index.d.ts +0 -3
  81. package/lib/no-axios/rpc/api.d.ts +27 -3
  82. package/lib/no-axios/rpc/axios.js +1 -1
  83. package/lib/no-axios/rpc/jsonrpc.d.ts +2 -1
  84. package/lib/no-axios/rpc/jsonrpc.js +1 -1
  85. package/lib/no-axios/rpc/parsers.js +8 -5
  86. package/lib/no-axios/rpc/server.d.ts +46 -7
  87. package/lib/no-axios/rpc/server.js +290 -211
  88. package/lib/no-axios/rpc/utils.js +1 -1
  89. package/lib/no-axios/webauth/challenge_transaction.d.ts +235 -0
  90. package/lib/no-axios/webauth/challenge_transaction.js +307 -0
  91. package/lib/no-axios/webauth/index.d.ts +1 -0
  92. package/lib/no-axios/webauth/index.js +13 -1
  93. package/lib/no-axios/webauth/utils.d.ts +28 -273
  94. package/lib/no-axios/webauth/utils.js +12 -288
  95. package/lib/no-eventsource/config.d.ts +2 -6
  96. package/lib/no-eventsource/contract/assembled_transaction.d.ts +16 -132
  97. package/lib/no-eventsource/contract/assembled_transaction.js +14 -114
  98. package/lib/no-eventsource/contract/errors.d.ts +26 -0
  99. package/lib/no-eventsource/contract/errors.js +126 -0
  100. package/lib/no-eventsource/contract/sent_transaction.d.ts +1 -1
  101. package/lib/no-eventsource/contract/spec.d.ts +2 -2
  102. package/lib/no-eventsource/contract/spec.js +40 -28
  103. package/lib/no-eventsource/contract/types.d.ts +35 -9
  104. package/lib/no-eventsource/contract/utils.d.ts +1 -1
  105. package/lib/no-eventsource/contract/utils.js +18 -53
  106. package/lib/no-eventsource/contract/wasm_spec_parser.d.ts +7 -0
  107. package/lib/no-eventsource/contract/wasm_spec_parser.js +15 -0
  108. package/lib/no-eventsource/errors/network.d.ts +1 -1
  109. package/lib/no-eventsource/federation/server.d.ts +7 -7
  110. package/lib/no-eventsource/horizon/horizon_axios_client.js +1 -1
  111. package/lib/no-eventsource/horizon/server.d.ts +1 -1
  112. package/lib/no-eventsource/horizon/server.js +2 -2
  113. package/lib/no-eventsource/index.d.ts +0 -3
  114. package/lib/no-eventsource/rpc/api.d.ts +27 -3
  115. package/lib/no-eventsource/rpc/axios.js +1 -1
  116. package/lib/no-eventsource/rpc/jsonrpc.d.ts +2 -1
  117. package/lib/no-eventsource/rpc/jsonrpc.js +1 -1
  118. package/lib/no-eventsource/rpc/parsers.js +8 -5
  119. package/lib/no-eventsource/rpc/server.d.ts +46 -7
  120. package/lib/no-eventsource/rpc/server.js +290 -211
  121. package/lib/no-eventsource/rpc/utils.js +1 -1
  122. package/lib/no-eventsource/webauth/challenge_transaction.d.ts +235 -0
  123. package/lib/no-eventsource/webauth/challenge_transaction.js +307 -0
  124. package/lib/no-eventsource/webauth/index.d.ts +1 -0
  125. package/lib/no-eventsource/webauth/index.js +13 -1
  126. package/lib/no-eventsource/webauth/utils.d.ts +28 -273
  127. package/lib/no-eventsource/webauth/utils.js +12 -288
  128. package/lib/rpc/api.d.ts +27 -3
  129. package/lib/rpc/axios.js +1 -1
  130. package/lib/rpc/jsonrpc.d.ts +2 -1
  131. package/lib/rpc/jsonrpc.js +1 -1
  132. package/lib/rpc/parsers.js +8 -5
  133. package/lib/rpc/server.d.ts +46 -7
  134. package/lib/rpc/server.js +290 -211
  135. package/lib/rpc/utils.js +1 -1
  136. package/lib/webauth/challenge_transaction.d.ts +235 -0
  137. package/lib/webauth/challenge_transaction.js +307 -0
  138. package/lib/webauth/index.d.ts +1 -0
  139. package/lib/webauth/index.js +13 -1
  140. package/lib/webauth/utils.d.ts +28 -273
  141. package/lib/webauth/utils.js +12 -288
  142. package/package.json +14 -14
  143. package/types/dom-monkeypatch.d.ts +1 -1
@@ -155,6 +155,7 @@ export declare class RpcServer {
155
155
  * @see
156
156
  * {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgerEntries | getLedgerEntries docs}
157
157
  *
158
+ * @deprecated Use {@link getAssetBalance}, instead
158
159
  * @example
159
160
  * const accountId = "GBZC6Y2Y7Q3ZQ2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4";
160
161
  * const asset = new Asset(
@@ -187,6 +188,36 @@ export declare class RpcServer {
187
188
  * });
188
189
  */
189
190
  getClaimableBalance(id: string): Promise<xdr.ClaimableBalanceEntry>;
191
+ /**
192
+ * Fetch the balance of an asset held by an account or contract.
193
+ *
194
+ * The `address` argument may be provided as a string (as a {@link StrKey}),
195
+ * {@link Address}, or {@link Contract}.
196
+ *
197
+ * @param {string|Address|Contract} address The account or contract whose
198
+ * balance should be fetched.
199
+ * @param {Asset} asset The asset whose balance you want to inspect.
200
+ * @param {string} [networkPassphrase] optionally, when requesting the
201
+ * balance of a contract, the network passphrase to which this token
202
+ * applies. If omitted and necessary, a request about network information
203
+ * will be made (see {@link getNetwork}), since contract IDs for assets are
204
+ * specific to a network. You can refer to {@link Networks} for a list of
205
+ * built-in passphrases, e.g., `Networks.TESTNET`.
206
+ * @returns {Promise<Api.BalanceResponse>} Resolves with balance entry details
207
+ * when available.
208
+ *
209
+ * @throws {Error} If the supplied `address` is not a valid account or
210
+ * contract strkey.
211
+ *
212
+ * @example
213
+ * const usdc = new Asset(
214
+ * "USDC",
215
+ * "GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5"
216
+ * );
217
+ * const balance = await server.getAssetBalance("GD...", usdc);
218
+ * console.log(balance.balanceEntry?.amount);
219
+ */
220
+ getAssetBalance(address: string | Address | Contract, asset: Asset, networkPassphrase?: string): Promise<Api.BalanceResponse>;
190
221
  /**
191
222
  * General node health check.
192
223
  *
@@ -320,6 +351,7 @@ export declare class RpcServer {
320
351
  * transaction completion and return a definitive state of success or failure.
321
352
  *
322
353
  * @param {string} hash the transaction you're polling for
354
+ * @param {[RpcServer.PollingOptions]} [opts] polling options
323
355
  * @param {number} [opts.attempts] (optional) the number of attempts to make
324
356
  * before returning the last-seen status. By default or on invalid inputs,
325
357
  * try 5 times.
@@ -644,7 +676,7 @@ export declare class RpcServer {
644
676
  * account, or the existing account if it's already funded with the
645
677
  * populated sequence number (note that the account will not be "topped
646
678
  * off" if it already exists)
647
- * @throws If Friendbot is not configured on this network or request failure
679
+ * @throws {Error} If Friendbot is not configured on this network or request failure
648
680
  *
649
681
  * @see {@link https://developers.stellar.org/docs/learn/fundamentals/networks#friendbot | Friendbot docs}
650
682
  * @see {@link module:Friendbot.Api.Response}
@@ -679,8 +711,8 @@ export declare class RpcServer {
679
711
  *
680
712
  * This is a convenience wrapper around {@link Server.getLedgerEntries}.
681
713
  *
682
- * @param {string} address the contract (string `C...`) or account ID
683
- * (`G...`) whose balance of `sac` you want to know
714
+ * @param {string} address the contract (string `C...`) whose balance of
715
+ * `sac` you want to know
684
716
  * @param {Asset} sac the built-in SAC token (e.g. `USDC:GABC...`) that
685
717
  * you are querying from the given `contract`.
686
718
  * @param {string} [networkPassphrase] optionally, the network passphrase to
@@ -698,6 +730,7 @@ export declare class RpcServer {
698
730
  * @see getLedgerEntries
699
731
  * @see https://developers.stellar.org/docs/tokens/stellar-asset-contract
700
732
  *
733
+ * @deprecated Use {@link getAssetBalance}, instead
701
734
  * @example
702
735
  * // assume `address` is some contract or account with an XLM balance
703
736
  * // assume server is an instantiated `Server` instance.
@@ -733,7 +766,9 @@ export declare class RpcServer {
733
766
  * // Fetch ledgers starting from a specific sequence number
734
767
  * server.getLedgers({
735
768
  * startLedger: 36233,
736
- * limit: 10
769
+ * pagination: {
770
+ * limit: 10
771
+ * }
737
772
  * }).then((response) => {
738
773
  * console.log("Ledgers:", response.ledgers);
739
774
  * console.log("Latest Ledger:", response.latestLedger);
@@ -744,12 +779,16 @@ export declare class RpcServer {
744
779
  * // Paginate through ledgers using cursor
745
780
  * const firstPage = await server.getLedgers({
746
781
  * startLedger: 36233,
747
- * limit: 5
782
+ * pagination: {
783
+ * limit: 5
784
+ * }
748
785
  * });
749
786
  *
750
787
  * const nextPage = await server.getLedgers({
751
- * cursor: firstPage.cursor,
752
- * limit: 5
788
+ * pagination: {
789
+ * cursor: firstPage.cursor,
790
+ * limit: 5
791
+ * }
753
792
  * });
754
793
  */
755
794
  getLedgers(request: Api.GetLedgersRequest): Promise<Api.GetLedgersResponse>;