@stellar/stellar-sdk 16.0.1 → 16.2.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.
- package/README.md +41 -2
- package/dist/stellar-sdk-axios.js +5401 -3690
- package/dist/stellar-sdk-axios.js.map +1 -1
- package/dist/stellar-sdk-axios.min.js +12 -11
- package/dist/stellar-sdk-axios.min.js.map +1 -1
- package/dist/stellar-sdk.js +4850 -3681
- package/dist/stellar-sdk.js.map +1 -1
- package/dist/stellar-sdk.min.js +17 -17
- package/dist/stellar-sdk.min.js.map +1 -1
- package/lib/axios/cjs/base/auth.js +147 -30
- package/lib/axios/cjs/base/auth.js.map +1 -1
- package/lib/axios/cjs/base/index.js +113 -0
- package/lib/axios/cjs/base/index.js.map +1 -0
- package/lib/axios/cjs/base/keypair.js +39 -0
- package/lib/axios/cjs/base/keypair.js.map +1 -1
- package/lib/axios/cjs/base/scval.js +34 -0
- package/lib/axios/cjs/base/scval.js.map +1 -1
- package/lib/axios/cjs/bindings/client.js +170 -0
- package/lib/axios/cjs/bindings/client.js.map +1 -1
- package/lib/axios/cjs/bindings/config.js +1 -1
- package/lib/axios/cjs/bindings/generator.js +45 -16
- package/lib/axios/cjs/bindings/generator.js.map +1 -1
- package/lib/axios/cjs/bindings/types.js +151 -1
- package/lib/axios/cjs/bindings/types.js.map +1 -1
- package/lib/axios/cjs/bindings/utils.js +10 -0
- package/lib/axios/cjs/bindings/utils.js.map +1 -1
- package/lib/axios/cjs/cli/index.js +19 -22
- package/lib/axios/cjs/cli/index.js.map +1 -1
- package/lib/axios/cjs/cli/util.js +1 -20
- package/lib/axios/cjs/cli/util.js.map +1 -1
- package/lib/axios/cjs/contract/assembled_transaction.js +39 -17
- package/lib/axios/cjs/contract/assembled_transaction.js.map +1 -1
- package/lib/axios/cjs/contract/basic_node_signer.js +8 -42
- package/lib/axios/cjs/contract/basic_node_signer.js.map +1 -1
- package/lib/axios/cjs/contract/client.js +56 -3
- package/lib/axios/cjs/contract/client.js.map +1 -1
- package/lib/axios/cjs/contract/event_spec.js +164 -0
- package/lib/axios/cjs/contract/event_spec.js.map +1 -0
- package/lib/axios/cjs/contract/index.js +2 -0
- package/lib/axios/cjs/contract/index.js.map +1 -1
- package/lib/axios/cjs/contract/sent_transaction.js +0 -20
- package/lib/axios/cjs/contract/sent_transaction.js.map +1 -1
- package/lib/axios/cjs/contract/signer.js +96 -0
- package/lib/axios/cjs/contract/signer.js.map +1 -0
- package/lib/axios/cjs/contract/spec.js +107 -3
- package/lib/axios/cjs/contract/spec.js.map +1 -1
- package/lib/axios/cjs/contract/types.js.map +1 -1
- package/lib/axios/cjs/errors/transaction_failed.js +62 -0
- package/lib/axios/cjs/errors/transaction_failed.js.map +1 -0
- package/lib/axios/cjs/errors/wrap_http_error.js +20 -0
- package/lib/axios/cjs/errors/wrap_http_error.js.map +1 -0
- package/lib/axios/cjs/federation/server.js +15 -35
- package/lib/axios/cjs/federation/server.js.map +1 -1
- package/lib/axios/cjs/horizon/account_response.js +0 -20
- package/lib/axios/cjs/horizon/account_response.js.map +1 -1
- package/lib/axios/cjs/horizon/horizon_api.js +5 -0
- package/lib/axios/cjs/horizon/horizon_api.js.map +1 -1
- package/lib/axios/cjs/horizon/horizon_axios_client.js +1 -1
- package/lib/axios/cjs/horizon/server.js +20 -26
- package/lib/axios/cjs/horizon/server.js.map +1 -1
- package/lib/axios/cjs/index.js +66 -65
- package/lib/axios/cjs/index.js.map +1 -1
- package/lib/axios/cjs/rpc/api.js.map +1 -1
- package/lib/axios/cjs/rpc/axios.js +1 -1
- package/lib/axios/cjs/rpc/server.js +181 -13
- package/lib/axios/cjs/rpc/server.js.map +1 -1
- package/lib/axios/cjs/rpc/transaction.js +2 -20
- package/lib/axios/cjs/rpc/transaction.js.map +1 -1
- package/lib/axios/cjs/webauth/challenge_transaction.js +7 -22
- package/lib/axios/cjs/webauth/challenge_transaction.js.map +1 -1
- package/lib/axios/cjs/webauth/utils.js +1 -20
- package/lib/axios/cjs/webauth/utils.js.map +1 -1
- package/lib/axios/esm/base/auth.d.ts +181 -13
- package/lib/axios/esm/base/auth.js +146 -31
- package/lib/axios/esm/base/auth.js.map +1 -1
- package/lib/axios/esm/base/index.d.ts +2 -2
- package/lib/axios/esm/base/index.js +44 -0
- package/lib/axios/esm/base/index.js.map +1 -0
- package/lib/axios/esm/base/keypair.d.ts +27 -0
- package/lib/axios/esm/base/keypair.js +39 -0
- package/lib/axios/esm/base/keypair.js.map +1 -1
- package/lib/axios/esm/base/scval.d.ts +4 -0
- package/lib/axios/esm/base/scval.js +34 -0
- package/lib/axios/esm/base/scval.js.map +1 -1
- package/lib/axios/esm/bindings/client.d.ts +39 -0
- package/lib/axios/esm/bindings/client.js +171 -1
- package/lib/axios/esm/bindings/client.js.map +1 -1
- package/lib/axios/esm/bindings/config.js +1 -1
- package/lib/axios/esm/bindings/generator.d.ts +34 -0
- package/lib/axios/esm/bindings/generator.js +45 -16
- package/lib/axios/esm/bindings/generator.js.map +1 -1
- package/lib/axios/esm/bindings/types.d.ts +42 -0
- package/lib/axios/esm/bindings/types.js +153 -3
- package/lib/axios/esm/bindings/types.js.map +1 -1
- package/lib/axios/esm/bindings/utils.d.ts +10 -0
- package/lib/axios/esm/bindings/utils.js +9 -1
- package/lib/axios/esm/bindings/utils.js.map +1 -1
- package/lib/axios/esm/cli/index.js +19 -22
- package/lib/axios/esm/cli/index.js.map +1 -1
- package/lib/axios/esm/cli/util.d.ts +1 -1
- package/lib/axios/esm/cli/util.js +1 -20
- package/lib/axios/esm/cli/util.js.map +1 -1
- package/lib/axios/esm/contract/assembled_transaction.d.ts +7 -5
- package/lib/axios/esm/contract/assembled_transaction.js +39 -17
- package/lib/axios/esm/contract/assembled_transaction.js.map +1 -1
- package/lib/axios/esm/contract/basic_node_signer.d.ts +3 -0
- package/lib/axios/esm/contract/basic_node_signer.js +8 -42
- package/lib/axios/esm/contract/basic_node_signer.js.map +1 -1
- package/lib/axios/esm/contract/client.d.ts +49 -3
- package/lib/axios/esm/contract/client.js +56 -3
- package/lib/axios/esm/contract/client.js.map +1 -1
- package/lib/axios/esm/contract/event_spec.d.ts +78 -0
- package/lib/axios/esm/contract/event_spec.js +159 -0
- package/lib/axios/esm/contract/event_spec.js.map +1 -0
- package/lib/axios/esm/contract/index.d.ts +3 -0
- package/lib/axios/esm/contract/index.js +1 -0
- package/lib/axios/esm/contract/index.js.map +1 -1
- package/lib/axios/esm/contract/sent_transaction.js +0 -20
- package/lib/axios/esm/contract/sent_transaction.js.map +1 -1
- package/lib/axios/esm/contract/signer.d.ts +104 -0
- package/lib/axios/esm/contract/signer.js +91 -0
- package/lib/axios/esm/contract/signer.js.map +1 -0
- package/lib/axios/esm/contract/spec.d.ts +84 -0
- package/lib/axios/esm/contract/spec.js +107 -3
- package/lib/axios/esm/contract/spec.js.map +1 -1
- package/lib/axios/esm/contract/types.d.ts +25 -8
- package/lib/axios/esm/contract/types.js.map +1 -1
- package/lib/axios/esm/errors/index.d.ts +1 -0
- package/lib/axios/esm/errors/transaction_failed.d.ts +55 -0
- package/lib/axios/esm/errors/transaction_failed.js +60 -0
- package/lib/axios/esm/errors/transaction_failed.js.map +1 -0
- package/lib/axios/esm/errors/wrap_http_error.d.ts +20 -0
- package/lib/axios/esm/errors/wrap_http_error.js +18 -0
- package/lib/axios/esm/errors/wrap_http_error.js.map +1 -0
- package/lib/axios/esm/federation/server.js +15 -35
- package/lib/axios/esm/federation/server.js.map +1 -1
- package/lib/axios/esm/horizon/account_response.js +0 -20
- package/lib/axios/esm/horizon/account_response.js.map +1 -1
- package/lib/axios/esm/horizon/horizon_api.d.ts +12 -1
- package/lib/axios/esm/horizon/horizon_api.js +5 -0
- package/lib/axios/esm/horizon/horizon_api.js.map +1 -1
- package/lib/axios/esm/horizon/horizon_axios_client.js +1 -1
- package/lib/axios/esm/horizon/server.d.ts +10 -4
- package/lib/axios/esm/horizon/server.js +20 -26
- package/lib/axios/esm/horizon/server.js.map +1 -1
- package/lib/axios/esm/index.js +27 -29
- package/lib/axios/esm/index.js.map +1 -1
- package/lib/axios/esm/rpc/api.d.ts +21 -0
- package/lib/axios/esm/rpc/api.js.map +1 -1
- package/lib/axios/esm/rpc/axios.js +1 -1
- package/lib/axios/esm/rpc/server.d.ts +115 -3
- package/lib/axios/esm/rpc/server.js +181 -13
- package/lib/axios/esm/rpc/server.js.map +1 -1
- package/lib/axios/esm/rpc/transaction.js +2 -20
- package/lib/axios/esm/rpc/transaction.js.map +1 -1
- package/lib/axios/esm/webauth/challenge_transaction.js +7 -22
- package/lib/axios/esm/webauth/challenge_transaction.js.map +1 -1
- package/lib/axios/esm/webauth/utils.js +1 -20
- package/lib/axios/esm/webauth/utils.js.map +1 -1
- package/lib/cjs/base/auth.js +147 -30
- package/lib/cjs/base/auth.js.map +1 -1
- package/lib/cjs/base/index.js +113 -0
- package/lib/cjs/base/index.js.map +1 -0
- package/lib/cjs/base/keypair.js +39 -0
- package/lib/cjs/base/keypair.js.map +1 -1
- package/lib/cjs/base/scval.js +34 -0
- package/lib/cjs/base/scval.js.map +1 -1
- package/lib/cjs/bindings/client.js +170 -0
- package/lib/cjs/bindings/client.js.map +1 -1
- package/lib/cjs/bindings/config.js +1 -1
- package/lib/cjs/bindings/generator.js +45 -16
- package/lib/cjs/bindings/generator.js.map +1 -1
- package/lib/cjs/bindings/types.js +151 -1
- package/lib/cjs/bindings/types.js.map +1 -1
- package/lib/cjs/bindings/utils.js +10 -0
- package/lib/cjs/bindings/utils.js.map +1 -1
- package/lib/cjs/cli/index.js +19 -22
- package/lib/cjs/cli/index.js.map +1 -1
- package/lib/cjs/cli/util.js +1 -20
- package/lib/cjs/cli/util.js.map +1 -1
- package/lib/cjs/contract/assembled_transaction.js +39 -17
- package/lib/cjs/contract/assembled_transaction.js.map +1 -1
- package/lib/cjs/contract/basic_node_signer.js +8 -42
- package/lib/cjs/contract/basic_node_signer.js.map +1 -1
- package/lib/cjs/contract/client.js +56 -3
- package/lib/cjs/contract/client.js.map +1 -1
- package/lib/cjs/contract/event_spec.js +164 -0
- package/lib/cjs/contract/event_spec.js.map +1 -0
- package/lib/cjs/contract/index.js +2 -0
- package/lib/cjs/contract/index.js.map +1 -1
- package/lib/cjs/contract/sent_transaction.js +0 -20
- package/lib/cjs/contract/sent_transaction.js.map +1 -1
- package/lib/cjs/contract/signer.js +96 -0
- package/lib/cjs/contract/signer.js.map +1 -0
- package/lib/cjs/contract/spec.js +107 -3
- package/lib/cjs/contract/spec.js.map +1 -1
- package/lib/cjs/contract/types.js.map +1 -1
- package/lib/cjs/errors/transaction_failed.js +62 -0
- package/lib/cjs/errors/transaction_failed.js.map +1 -0
- package/lib/cjs/errors/wrap_http_error.js +20 -0
- package/lib/cjs/errors/wrap_http_error.js.map +1 -0
- package/lib/cjs/federation/server.js +15 -35
- package/lib/cjs/federation/server.js.map +1 -1
- package/lib/cjs/horizon/account_response.js +0 -20
- package/lib/cjs/horizon/account_response.js.map +1 -1
- package/lib/cjs/horizon/horizon_api.js +5 -0
- package/lib/cjs/horizon/horizon_api.js.map +1 -1
- package/lib/cjs/horizon/horizon_axios_client.js +1 -1
- package/lib/cjs/horizon/server.js +20 -26
- package/lib/cjs/horizon/server.js.map +1 -1
- package/lib/cjs/index.js +66 -65
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/rpc/api.js.map +1 -1
- package/lib/cjs/rpc/axios.js +1 -1
- package/lib/cjs/rpc/server.js +181 -13
- package/lib/cjs/rpc/server.js.map +1 -1
- package/lib/cjs/rpc/transaction.js +2 -20
- package/lib/cjs/rpc/transaction.js.map +1 -1
- package/lib/cjs/webauth/challenge_transaction.js +7 -22
- package/lib/cjs/webauth/challenge_transaction.js.map +1 -1
- package/lib/cjs/webauth/utils.js +1 -20
- package/lib/cjs/webauth/utils.js.map +1 -1
- package/lib/esm/base/auth.d.ts +181 -13
- package/lib/esm/base/auth.js +146 -31
- package/lib/esm/base/auth.js.map +1 -1
- package/lib/esm/base/index.d.ts +2 -2
- package/lib/esm/base/index.js +44 -0
- package/lib/esm/base/index.js.map +1 -0
- package/lib/esm/base/keypair.d.ts +27 -0
- package/lib/esm/base/keypair.js +39 -0
- package/lib/esm/base/keypair.js.map +1 -1
- package/lib/esm/base/scval.d.ts +4 -0
- package/lib/esm/base/scval.js +34 -0
- package/lib/esm/base/scval.js.map +1 -1
- package/lib/esm/bindings/client.d.ts +39 -0
- package/lib/esm/bindings/client.js +171 -1
- package/lib/esm/bindings/client.js.map +1 -1
- package/lib/esm/bindings/config.js +1 -1
- package/lib/esm/bindings/generator.d.ts +34 -0
- package/lib/esm/bindings/generator.js +45 -16
- package/lib/esm/bindings/generator.js.map +1 -1
- package/lib/esm/bindings/types.d.ts +42 -0
- package/lib/esm/bindings/types.js +153 -3
- package/lib/esm/bindings/types.js.map +1 -1
- package/lib/esm/bindings/utils.d.ts +10 -0
- package/lib/esm/bindings/utils.js +9 -1
- package/lib/esm/bindings/utils.js.map +1 -1
- package/lib/esm/cli/index.js +19 -22
- package/lib/esm/cli/index.js.map +1 -1
- package/lib/esm/cli/util.d.ts +1 -1
- package/lib/esm/cli/util.js +1 -20
- package/lib/esm/cli/util.js.map +1 -1
- package/lib/esm/contract/assembled_transaction.d.ts +7 -5
- package/lib/esm/contract/assembled_transaction.js +39 -17
- package/lib/esm/contract/assembled_transaction.js.map +1 -1
- package/lib/esm/contract/basic_node_signer.d.ts +3 -0
- package/lib/esm/contract/basic_node_signer.js +8 -42
- package/lib/esm/contract/basic_node_signer.js.map +1 -1
- package/lib/esm/contract/client.d.ts +49 -3
- package/lib/esm/contract/client.js +56 -3
- package/lib/esm/contract/client.js.map +1 -1
- package/lib/esm/contract/event_spec.d.ts +78 -0
- package/lib/esm/contract/event_spec.js +159 -0
- package/lib/esm/contract/event_spec.js.map +1 -0
- package/lib/esm/contract/index.d.ts +3 -0
- package/lib/esm/contract/index.js +1 -0
- package/lib/esm/contract/index.js.map +1 -1
- package/lib/esm/contract/sent_transaction.js +0 -20
- package/lib/esm/contract/sent_transaction.js.map +1 -1
- package/lib/esm/contract/signer.d.ts +104 -0
- package/lib/esm/contract/signer.js +91 -0
- package/lib/esm/contract/signer.js.map +1 -0
- package/lib/esm/contract/spec.d.ts +84 -0
- package/lib/esm/contract/spec.js +107 -3
- package/lib/esm/contract/spec.js.map +1 -1
- package/lib/esm/contract/types.d.ts +25 -8
- package/lib/esm/contract/types.js.map +1 -1
- package/lib/esm/errors/index.d.ts +1 -0
- package/lib/esm/errors/transaction_failed.d.ts +55 -0
- package/lib/esm/errors/transaction_failed.js +60 -0
- package/lib/esm/errors/transaction_failed.js.map +1 -0
- package/lib/esm/errors/wrap_http_error.d.ts +20 -0
- package/lib/esm/errors/wrap_http_error.js +18 -0
- package/lib/esm/errors/wrap_http_error.js.map +1 -0
- package/lib/esm/federation/server.js +15 -35
- package/lib/esm/federation/server.js.map +1 -1
- package/lib/esm/horizon/account_response.js +0 -20
- package/lib/esm/horizon/account_response.js.map +1 -1
- package/lib/esm/horizon/horizon_api.d.ts +12 -1
- package/lib/esm/horizon/horizon_api.js +5 -0
- package/lib/esm/horizon/horizon_api.js.map +1 -1
- package/lib/esm/horizon/horizon_axios_client.js +1 -1
- package/lib/esm/horizon/server.d.ts +10 -4
- package/lib/esm/horizon/server.js +20 -26
- package/lib/esm/horizon/server.js.map +1 -1
- package/lib/esm/index.js +27 -29
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/rpc/api.d.ts +21 -0
- package/lib/esm/rpc/api.js.map +1 -1
- package/lib/esm/rpc/axios.js +1 -1
- package/lib/esm/rpc/server.d.ts +115 -3
- package/lib/esm/rpc/server.js +181 -13
- package/lib/esm/rpc/server.js.map +1 -1
- package/lib/esm/rpc/transaction.js +2 -20
- package/lib/esm/rpc/transaction.js.map +1 -1
- package/lib/esm/webauth/challenge_transaction.js +7 -22
- package/lib/esm/webauth/challenge_transaction.js.map +1 -1
- package/lib/esm/webauth/utils.js +1 -20
- package/lib/esm/webauth/utils.js.map +1 -1
- package/package.json +35 -30
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Transaction, xdr } from "../base/index.js";
|
|
2
|
+
import type { SignAuthEntryLike, SignTransactionLike } from "./signer.js";
|
|
2
3
|
import { Server } from "../rpc/index.js";
|
|
3
4
|
export type XDR_BASE64 = string;
|
|
4
5
|
/**
|
|
@@ -122,9 +123,10 @@ export type ClientOptions = {
|
|
|
122
123
|
* method (see {@link MethodOptions}) or when you call
|
|
123
124
|
* {@link contract.AssembledTransaction.signAndSend | signAndSend}.
|
|
124
125
|
*
|
|
125
|
-
* Matches signature of `signTransaction` from Freighter.
|
|
126
|
+
* Matches signature of `signTransaction` from Freighter. May instead be a
|
|
127
|
+
* {@link Signer} or a {@link Keypair}, which are converted internally.
|
|
126
128
|
*/
|
|
127
|
-
signTransaction?:
|
|
129
|
+
signTransaction?: SignTransactionLike;
|
|
128
130
|
/**
|
|
129
131
|
* A function to sign a specific auth entry for a transaction, using the
|
|
130
132
|
* private key corresponding to the provided `publicKey`. This is only needed
|
|
@@ -133,9 +135,10 @@ export type ClientOptions = {
|
|
|
133
135
|
* provide it later either when you initialize a method (see {@link MethodOptions})
|
|
134
136
|
* or when you call {@link contract.AssembledTransaction.signAuthEntries | signAuthEntries}.
|
|
135
137
|
*
|
|
136
|
-
* Matches signature of `signAuthEntry` from Freighter.
|
|
138
|
+
* Matches signature of `signAuthEntry` from Freighter. May instead be a
|
|
139
|
+
* {@link Signer} or a {@link Keypair}, which are converted internally.
|
|
137
140
|
*/
|
|
138
|
-
signAuthEntry?:
|
|
141
|
+
signAuthEntry?: SignAuthEntryLike;
|
|
139
142
|
/** The address of the contract the client will interact with. */
|
|
140
143
|
contractId: string;
|
|
141
144
|
/**
|
|
@@ -209,6 +212,18 @@ export type MethodOptions = {
|
|
|
209
212
|
* @defaultValue false
|
|
210
213
|
*/
|
|
211
214
|
restore?: boolean;
|
|
215
|
+
/**
|
|
216
|
+
* If true, simulation records v2 address credentials (CAP-71) instead of
|
|
217
|
+
* the legacy v1 address credentials. Best-effort: it only affects the
|
|
218
|
+
* recording auth modes and is silently ignored on protocol versions whose
|
|
219
|
+
* host cannot emit v2 credentials.
|
|
220
|
+
*
|
|
221
|
+
* @deprecated This flag is transitional. Once the network returns v2
|
|
222
|
+
* credentials by default (protocol 28), it becomes a no-op — do not rely on
|
|
223
|
+
* omitting it to keep receiving the legacy v1 format.
|
|
224
|
+
* @defaultValue false
|
|
225
|
+
*/
|
|
226
|
+
useUpgradedAuth?: boolean;
|
|
212
227
|
/**
|
|
213
228
|
* The public key of the source account for this transaction.
|
|
214
229
|
*
|
|
@@ -220,22 +235,24 @@ export type MethodOptions = {
|
|
|
220
235
|
* the given `publicKey`. You do not need to provide this, for read-only
|
|
221
236
|
* calls, which only need to be simulated.
|
|
222
237
|
*
|
|
223
|
-
* Matches signature of `signTransaction` from Freighter.
|
|
238
|
+
* Matches signature of `signTransaction` from Freighter. May instead be a
|
|
239
|
+
* {@link Signer} or a {@link Keypair}, which are converted internally.
|
|
224
240
|
*
|
|
225
241
|
* Default: the one provided to the {@link Client} in {@link ClientOptions}
|
|
226
242
|
*/
|
|
227
|
-
signTransaction?:
|
|
243
|
+
signTransaction?: SignTransactionLike;
|
|
228
244
|
/**
|
|
229
245
|
* A function to sign a specific auth entry for a transaction, using the
|
|
230
246
|
* private key corresponding to the provided `publicKey`. This is only needed
|
|
231
247
|
* for multi-auth transactions, in which one transaction is signed by
|
|
232
248
|
* multiple parties.
|
|
233
249
|
*
|
|
234
|
-
* Matches signature of `signAuthEntry` from Freighter.
|
|
250
|
+
* Matches signature of `signAuthEntry` from Freighter. May instead be a
|
|
251
|
+
* {@link Signer} or a {@link Keypair}, which are converted internally.
|
|
235
252
|
*
|
|
236
253
|
* Default: the one provided to the {@link Client} in {@link ClientOptions}
|
|
237
254
|
*/
|
|
238
|
-
signAuthEntry?:
|
|
255
|
+
signAuthEntry?: SignAuthEntryLike;
|
|
239
256
|
};
|
|
240
257
|
export type AssembledTransactionOptions<T = string> = MethodOptions & ClientOptions & {
|
|
241
258
|
method: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../../src/contract/types.ts"],"sourcesContent":["/* Type aliases below intentionally use non-PascalCase names (e.g. `XDR_BASE64`,\n `u32`) to preserve the public API — renaming them would be a breaking change. */\n\nimport { Transaction, xdr } from \"../base/index.js\";\nimport type { SentTransaction } from \"./sent_transaction.js\";\nimport type { Client } from \"./client.js\";\nimport { Server } from \"../rpc/index.js\";\n\nexport type XDR_BASE64 = string;\n/**\n * An unsigned 32-bit integer.\n */\nexport type u32 = number;\n/**\n * A signed 32-bit integer.\n */\nexport type i32 = number;\n/**\n * An unsigned 64-bit integer.\n */\nexport type u64 = bigint;\n/**\n * A signed 64-bit integer.\n */\nexport type i64 = bigint;\n/**\n * An unsigned 128-bit integer.\n */\nexport type u128 = bigint;\n/**\n * A signed 128-bit integer.\n */\nexport type i128 = bigint;\n/**\n * An unsigned 256-bit integer.\n */\nexport type u256 = bigint;\n/**\n * A signed 256-bit integer.\n */\nexport type i256 = bigint;\nexport type Option<T> = T | undefined;\n/**\n * @deprecated Use {@link Timepoint} instead.\n */\nexport type Typepoint = bigint;\n/**\n * An unsigned 64-bit integer.\n */\nexport type Timepoint = bigint;\n/**\n * An unsigned 64-bit integer.\n */\nexport type Duration = bigint;\n\n/**\n * A \"regular\" transaction, as opposed to a FeeBumpTransaction.\n */\nexport type Tx = Transaction;\n\nexport interface WalletError {\n message: string; // general description message returned to the client app\n code: number; // unique error code\n ext?: Array<string>; // optional extended details\n}\n\n/**\n * A function to request a wallet to sign a built transaction\n *\n * This function takes an XDR provided by the requester and applies a signature to it.\n * It returns a base64-encoded string XDR-encoded Transaction Envelope with Decorated Signatures\n * and the signer address back to the requester.\n *\n * @param xdr - The XDR string representing the transaction to be signed.\n * @param opts - Options for signing the transaction.\n * - `networkPassphrase`: The network's passphrase on which the transaction is intended to be signed.\n * - `address`: The public key of the account that should be used to sign.\n * - `submit`: If set to true, submits the transaction immediately after signing.\n * - `submitUrl`: The URL of the network to which the transaction should be submitted, if applicable.\n *\n * @returns A promise resolving to an object with the signed transaction XDR and optional signer address and error.\n */\nexport type SignTransaction = (\n xdr: string,\n opts?: {\n networkPassphrase?: string;\n address?: string;\n submit?: boolean;\n submitUrl?: string;\n },\n) => Promise<\n {\n signedTxXdr: string;\n signerAddress?: string;\n } & { error?: WalletError }\n>;\n\n/**\n * A function to request a wallet to sign an authorization entry preimage.\n *\n * Similar to signing a transaction, this function takes an authorization entry preimage provided by the\n * requester and applies a signature to it.\n * It returns a signed hash of the same authorization entry and the signer address back to the requester.\n *\n * @param authEntry - The authorization entry preimage to be signed.\n * @param opts - Options for signing the authorization entry.\n * - `networkPassphrase`: The network's passphrase on which the authorization entry is intended to be signed.\n * - `address`: The public key of the account that should be used to sign.\n *\n * @returns A promise resolving to an object with the signed authorization entry and optional signer address and error.\n */\nexport type SignAuthEntry = (\n authEntry: string,\n opts?: {\n networkPassphrase?: string;\n address?: string;\n },\n) => Promise<\n {\n signedAuthEntry: string;\n signerAddress?: string;\n } & { error?: WalletError }\n>;\n\n/**\n * Options for a smart contract client.\n */\nexport type ClientOptions = {\n /**\n * The public key of the source account for this transaction. You can\n * override this for specific methods later; see {@link MethodOptions}.\n */\n publicKey?: string;\n /**\n * A function to sign the transaction using the private key corresponding to\n * the given `publicKey`. You do not need to provide this, for read-only\n * calls, which only need to be simulated. If you do not provide it during\n * initialization, you can provide it later, either when you initialize a\n * method (see {@link MethodOptions}) or when you call\n * {@link contract.AssembledTransaction.signAndSend | signAndSend}.\n *\n * Matches signature of `signTransaction` from Freighter.\n */\n signTransaction?: SignTransaction;\n /**\n * A function to sign a specific auth entry for a transaction, using the\n * private key corresponding to the provided `publicKey`. This is only needed\n * for multi-auth transactions, in which one transaction is signed by\n * multiple parties. If you do not provide it during initialization, you can\n * provide it later either when you initialize a method (see {@link MethodOptions})\n * or when you call {@link contract.AssembledTransaction.signAuthEntries | signAuthEntries}.\n *\n * Matches signature of `signAuthEntry` from Freighter.\n */\n signAuthEntry?: SignAuthEntry;\n /** The address of the contract the client will interact with. */\n contractId: string;\n /**\n * The network passphrase for the Stellar network this contract is deployed\n * to.\n */\n networkPassphrase: string;\n /**\n * The URL of the RPC instance that will be used to interact with this\n * contract.\n */\n rpcUrl: string;\n /**\n * If true, will allow HTTP requests to the RPC. If false, will\n * only allow HTTPS requests.\n * @defaultValue false\n */\n allowHttp?: boolean;\n /** Optional headers to include in requests to the RPC. */\n headers?: Record<string, string>;\n /**\n * This gets filled in automatically from the ContractSpec when you\n * instantiate a {@link Client}.\n *\n * Background: If the contract you're calling uses the `#[contracterror]`\n * macro to create an `Error` enum, then those errors get included in the\n * on-chain XDR that also describes your contract's methods. Each error will\n * have a specific number.\n *\n * A Client makes method calls with an {@link contract.AssembledTransaction | AssembledTransaction}.\n * When one of these method calls encounters an error, `AssembledTransaction`\n * will first attempt to parse the error as an \"official\" `contracterror`\n * error, by using this passed-in `errorTypes` object. See `parseError`\n * on {@link contract.AssembledTransaction}. If `errorTypes` is blank or no\n * matching error is found, then it will throw the raw error.\n * @defaultValue `{}`\n */\n errorTypes?: Record<number, { message: string }>;\n /**\n * The Server instance to use for RPC calls. If not provided, one will be\n * created automatically from `rpcUrl` and `serverOptions`.\n */\n server?: Server;\n};\n\n/**\n * Options for a smart contract method invocation.\n */\nexport type MethodOptions = {\n /**\n * The fee to pay for the transaction.\n * @defaultValue 100\n */\n fee?: string;\n\n /**\n * The timebounds which should be set for transactions generated by this\n * contract client. {@link contract.DEFAULT_TIMEOUT}\n * @defaultValue 300\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the\n * AssembledTransaction.\n * @defaultValue true\n */\n simulate?: boolean;\n\n /**\n * If true, will automatically attempt to restore the transaction if there\n * are archived entries that need renewal.\n * @defaultValue false\n */\n restore?: boolean;\n\n /**\n * The public key of the source account for this transaction.\n *\n * Default: the one provided to the {@link Client} in {@link ClientOptions}\n */\n publicKey?: string;\n /**\n * A function to sign the transaction using the private key corresponding to\n * the given `publicKey`. You do not need to provide this, for read-only\n * calls, which only need to be simulated.\n *\n * Matches signature of `signTransaction` from Freighter.\n *\n * Default: the one provided to the {@link Client} in {@link ClientOptions}\n */\n signTransaction?: SignTransaction;\n /**\n * A function to sign a specific auth entry for a transaction, using the\n * private key corresponding to the provided `publicKey`. This is only needed\n * for multi-auth transactions, in which one transaction is signed by\n * multiple parties.\n *\n * Matches signature of `signAuthEntry` from Freighter.\n *\n * Default: the one provided to the {@link Client} in {@link ClientOptions}\n */\n signAuthEntry?: SignAuthEntry;\n};\n\nexport type AssembledTransactionOptions<T = string> = MethodOptions &\n ClientOptions & {\n method: string;\n args?: any[];\n parseResultXdr: (xdr: xdr.ScVal) => T;\n\n /**\n * The address of the account that should sign the transaction. Useful when\n * a wallet holds multiple addresses to ensure signing with the intended one.\n */\n address?: string;\n\n /**\n * This option will be passed through to the SEP43-compatible wallet extension. If true, and if the wallet supports it, the transaction will be signed and immediately submitted to the network by the wallet, bypassing the submit logic in {@link SentTransaction}.\n * @defaultValue false\n */\n submit?: boolean;\n\n /**\n * The URL of the network to which the transaction should be submitted.\n * Only applicable when 'submit' is set to true.\n */\n submitUrl?: string;\n };\n\n/**\n * The default timebounds, in seconds, during which a transaction will be valid.\n * This is attached to the transaction _before_ transaction simulation (it is\n * needed for simulation to succeed). It is also re-calculated and re-added\n * _before_ transaction signing.\n * @defaultValue 300\n */\nexport const DEFAULT_TIMEOUT = 5 * 60;\n\n/**\n * An impossible account on the Stellar network\n * @defaultValue GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF\n */\nexport const NULL_ACCOUNT =\n \"GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF\";\n"],"names":[],"mappings":"AAoSO,MAAM,kBAAkB,CAAA,GAAI;AAM5B,MAAM,YAAA,GACX;;;;"}
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../../src/contract/types.ts"],"sourcesContent":["/* Type aliases below intentionally use non-PascalCase names (e.g. `XDR_BASE64`,\n `u32`) to preserve the public API — renaming them would be a breaking change. */\n\nimport { Transaction, xdr } from \"../base/index.js\";\nimport type { SentTransaction } from \"./sent_transaction.js\";\nimport type { Client } from \"./client.js\";\nimport type { SignAuthEntryLike, SignTransactionLike } from \"./signer.js\";\nimport { Server } from \"../rpc/index.js\";\n\nexport type XDR_BASE64 = string;\n/**\n * An unsigned 32-bit integer.\n */\nexport type u32 = number;\n/**\n * A signed 32-bit integer.\n */\nexport type i32 = number;\n/**\n * An unsigned 64-bit integer.\n */\nexport type u64 = bigint;\n/**\n * A signed 64-bit integer.\n */\nexport type i64 = bigint;\n/**\n * An unsigned 128-bit integer.\n */\nexport type u128 = bigint;\n/**\n * A signed 128-bit integer.\n */\nexport type i128 = bigint;\n/**\n * An unsigned 256-bit integer.\n */\nexport type u256 = bigint;\n/**\n * A signed 256-bit integer.\n */\nexport type i256 = bigint;\nexport type Option<T> = T | undefined;\n/**\n * @deprecated Use {@link Timepoint} instead.\n */\nexport type Typepoint = bigint;\n/**\n * An unsigned 64-bit integer.\n */\nexport type Timepoint = bigint;\n/**\n * An unsigned 64-bit integer.\n */\nexport type Duration = bigint;\n\n/**\n * A \"regular\" transaction, as opposed to a FeeBumpTransaction.\n */\nexport type Tx = Transaction;\n\nexport interface WalletError {\n message: string; // general description message returned to the client app\n code: number; // unique error code\n ext?: Array<string>; // optional extended details\n}\n\n/**\n * A function to request a wallet to sign a built transaction\n *\n * This function takes an XDR provided by the requester and applies a signature to it.\n * It returns a base64-encoded string XDR-encoded Transaction Envelope with Decorated Signatures\n * and the signer address back to the requester.\n *\n * @param xdr - The XDR string representing the transaction to be signed.\n * @param opts - Options for signing the transaction.\n * - `networkPassphrase`: The network's passphrase on which the transaction is intended to be signed.\n * - `address`: The public key of the account that should be used to sign.\n * - `submit`: If set to true, submits the transaction immediately after signing.\n * - `submitUrl`: The URL of the network to which the transaction should be submitted, if applicable.\n *\n * @returns A promise resolving to an object with the signed transaction XDR and optional signer address and error.\n */\nexport type SignTransaction = (\n xdr: string,\n opts?: {\n networkPassphrase?: string;\n address?: string;\n submit?: boolean;\n submitUrl?: string;\n },\n) => Promise<\n {\n signedTxXdr: string;\n signerAddress?: string;\n } & { error?: WalletError }\n>;\n\n/**\n * A function to request a wallet to sign an authorization entry preimage.\n *\n * Similar to signing a transaction, this function takes an authorization entry preimage provided by the\n * requester and applies a signature to it.\n * It returns a signed hash of the same authorization entry and the signer address back to the requester.\n *\n * @param authEntry - The authorization entry preimage to be signed.\n * @param opts - Options for signing the authorization entry.\n * - `networkPassphrase`: The network's passphrase on which the authorization entry is intended to be signed.\n * - `address`: The public key of the account that should be used to sign.\n *\n * @returns A promise resolving to an object with the signed authorization entry and optional signer address and error.\n */\nexport type SignAuthEntry = (\n authEntry: string,\n opts?: {\n networkPassphrase?: string;\n address?: string;\n },\n) => Promise<\n {\n signedAuthEntry: string;\n signerAddress?: string;\n } & { error?: WalletError }\n>;\n\n/**\n * Options for a smart contract client.\n */\nexport type ClientOptions = {\n /**\n * The public key of the source account for this transaction. You can\n * override this for specific methods later; see {@link MethodOptions}.\n */\n publicKey?: string;\n /**\n * A function to sign the transaction using the private key corresponding to\n * the given `publicKey`. You do not need to provide this, for read-only\n * calls, which only need to be simulated. If you do not provide it during\n * initialization, you can provide it later, either when you initialize a\n * method (see {@link MethodOptions}) or when you call\n * {@link contract.AssembledTransaction.signAndSend | signAndSend}.\n *\n * Matches signature of `signTransaction` from Freighter. May instead be a\n * {@link Signer} or a {@link Keypair}, which are converted internally.\n */\n signTransaction?: SignTransactionLike;\n /**\n * A function to sign a specific auth entry for a transaction, using the\n * private key corresponding to the provided `publicKey`. This is only needed\n * for multi-auth transactions, in which one transaction is signed by\n * multiple parties. If you do not provide it during initialization, you can\n * provide it later either when you initialize a method (see {@link MethodOptions})\n * or when you call {@link contract.AssembledTransaction.signAuthEntries | signAuthEntries}.\n *\n * Matches signature of `signAuthEntry` from Freighter. May instead be a\n * {@link Signer} or a {@link Keypair}, which are converted internally.\n */\n signAuthEntry?: SignAuthEntryLike;\n /** The address of the contract the client will interact with. */\n contractId: string;\n /**\n * The network passphrase for the Stellar network this contract is deployed\n * to.\n */\n networkPassphrase: string;\n /**\n * The URL of the RPC instance that will be used to interact with this\n * contract.\n */\n rpcUrl: string;\n /**\n * If true, will allow HTTP requests to the RPC. If false, will\n * only allow HTTPS requests.\n * @defaultValue false\n */\n allowHttp?: boolean;\n /** Optional headers to include in requests to the RPC. */\n headers?: Record<string, string>;\n /**\n * This gets filled in automatically from the ContractSpec when you\n * instantiate a {@link Client}.\n *\n * Background: If the contract you're calling uses the `#[contracterror]`\n * macro to create an `Error` enum, then those errors get included in the\n * on-chain XDR that also describes your contract's methods. Each error will\n * have a specific number.\n *\n * A Client makes method calls with an {@link contract.AssembledTransaction | AssembledTransaction}.\n * When one of these method calls encounters an error, `AssembledTransaction`\n * will first attempt to parse the error as an \"official\" `contracterror`\n * error, by using this passed-in `errorTypes` object. See `parseError`\n * on {@link contract.AssembledTransaction}. If `errorTypes` is blank or no\n * matching error is found, then it will throw the raw error.\n * @defaultValue `{}`\n */\n errorTypes?: Record<number, { message: string }>;\n /**\n * The Server instance to use for RPC calls. If not provided, one will be\n * created automatically from `rpcUrl` and `serverOptions`.\n */\n server?: Server;\n};\n\n/**\n * Options for a smart contract method invocation.\n */\nexport type MethodOptions = {\n /**\n * The fee to pay for the transaction.\n * @defaultValue 100\n */\n fee?: string;\n\n /**\n * The timebounds which should be set for transactions generated by this\n * contract client. {@link contract.DEFAULT_TIMEOUT}\n * @defaultValue 300\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the\n * AssembledTransaction.\n * @defaultValue true\n */\n simulate?: boolean;\n\n /**\n * If true, will automatically attempt to restore the transaction if there\n * are archived entries that need renewal.\n * @defaultValue false\n */\n restore?: boolean;\n\n /**\n * If true, simulation records v2 address credentials (CAP-71) instead of\n * the legacy v1 address credentials. Best-effort: it only affects the\n * recording auth modes and is silently ignored on protocol versions whose\n * host cannot emit v2 credentials.\n *\n * @deprecated This flag is transitional. Once the network returns v2\n * credentials by default (protocol 28), it becomes a no-op — do not rely on\n * omitting it to keep receiving the legacy v1 format.\n * @defaultValue false\n */\n useUpgradedAuth?: boolean;\n\n /**\n * The public key of the source account for this transaction.\n *\n * Default: the one provided to the {@link Client} in {@link ClientOptions}\n */\n publicKey?: string;\n /**\n * A function to sign the transaction using the private key corresponding to\n * the given `publicKey`. You do not need to provide this, for read-only\n * calls, which only need to be simulated.\n *\n * Matches signature of `signTransaction` from Freighter. May instead be a\n * {@link Signer} or a {@link Keypair}, which are converted internally.\n *\n * Default: the one provided to the {@link Client} in {@link ClientOptions}\n */\n signTransaction?: SignTransactionLike;\n /**\n * A function to sign a specific auth entry for a transaction, using the\n * private key corresponding to the provided `publicKey`. This is only needed\n * for multi-auth transactions, in which one transaction is signed by\n * multiple parties.\n *\n * Matches signature of `signAuthEntry` from Freighter. May instead be a\n * {@link Signer} or a {@link Keypair}, which are converted internally.\n *\n * Default: the one provided to the {@link Client} in {@link ClientOptions}\n */\n signAuthEntry?: SignAuthEntryLike;\n};\n\nexport type AssembledTransactionOptions<T = string> = MethodOptions &\n ClientOptions & {\n method: string;\n args?: any[];\n parseResultXdr: (xdr: xdr.ScVal) => T;\n\n /**\n * The address of the account that should sign the transaction. Useful when\n * a wallet holds multiple addresses to ensure signing with the intended one.\n */\n address?: string;\n\n /**\n * This option will be passed through to the SEP43-compatible wallet extension. If true, and if the wallet supports it, the transaction will be signed and immediately submitted to the network by the wallet, bypassing the submit logic in {@link SentTransaction}.\n * @defaultValue false\n */\n submit?: boolean;\n\n /**\n * The URL of the network to which the transaction should be submitted.\n * Only applicable when 'submit' is set to true.\n */\n submitUrl?: string;\n };\n\n/**\n * The default timebounds, in seconds, during which a transaction will be valid.\n * This is attached to the transaction _before_ transaction simulation (it is\n * needed for simulation to succeed). It is also re-calculated and re-added\n * _before_ transaction signing.\n * @defaultValue 300\n */\nexport const DEFAULT_TIMEOUT = 5 * 60;\n\n/**\n * An impossible account on the Stellar network\n * @defaultValue GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF\n */\nexport const NULL_ACCOUNT =\n \"GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF\";\n"],"names":[],"mappings":"AAsTO,MAAM,kBAAkB,CAAA,GAAI;AAM5B,MAAM,YAAA,GACX;;;;"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { xdr } from "../base/index.js";
|
|
2
|
+
import { HorizonApi } from "../horizon/horizon_api.js";
|
|
3
|
+
import { BadResponseError } from "./bad_response.js";
|
|
4
|
+
/**
|
|
5
|
+
* TransactionFailedError is raised when a transaction submitted to Horizon
|
|
6
|
+
* is rejected with a `transaction_failed` error response (HTTP 400). It
|
|
7
|
+
* provides convenient accessors for the result codes and the decoded
|
|
8
|
+
* {@link xdr.TransactionResult}, which are otherwise nested deep inside the
|
|
9
|
+
* raw Horizon response.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```js
|
|
13
|
+
* try {
|
|
14
|
+
* await server.submitTransaction(tx);
|
|
15
|
+
* } catch (err) {
|
|
16
|
+
* if (err instanceof TransactionFailedError) {
|
|
17
|
+
* const { transaction, operations } = err.getResultCodes();
|
|
18
|
+
* console.log(transaction); // e.g. "tx_failed"
|
|
19
|
+
* console.log(operations); // e.g. ["op_underfunded"]
|
|
20
|
+
* console.log(err.getTransactionResult()?.result().switch().name);
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @param message - Human-readable error message.
|
|
26
|
+
* @param response - Response details, received from the Horizon server, whose
|
|
27
|
+
* `data` field contains a `transaction_failed` error response with `extras`.
|
|
28
|
+
*/
|
|
29
|
+
export declare class TransactionFailedError extends BadResponseError {
|
|
30
|
+
/**
|
|
31
|
+
* Returns the transaction- and operation-level result codes reported by
|
|
32
|
+
* Horizon, e.g. `{ transaction: "tx_failed", operations: ["op_underfunded"] }`.
|
|
33
|
+
*
|
|
34
|
+
* Horizon omits `operations` when the transaction failed a
|
|
35
|
+
* transaction-level check (e.g. `tx_bad_seq`) and no operations were
|
|
36
|
+
* evaluated; this accessor normalizes that to an empty array.
|
|
37
|
+
*
|
|
38
|
+
* @returns The `result_codes` object from the response's `extras`.
|
|
39
|
+
*/
|
|
40
|
+
getResultCodes(): {
|
|
41
|
+
transaction: HorizonApi.TransactionFailedResultCodes;
|
|
42
|
+
operations: string[];
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Decodes and returns the {@link xdr.TransactionResult} from the response's
|
|
46
|
+
* `extras.result_xdr`, providing structured access to per-operation results.
|
|
47
|
+
*
|
|
48
|
+
* @returns The decoded transaction result, or `null` if the response did not
|
|
49
|
+
* include a `result_xdr`.
|
|
50
|
+
* @throws If the server returned a `result_xdr` that is not valid base64-encoded
|
|
51
|
+
* {@link xdr.TransactionResult} XDR.
|
|
52
|
+
*/
|
|
53
|
+
getTransactionResult(): xdr.TransactionResult | null;
|
|
54
|
+
private extras;
|
|
55
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import '../node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/int.js';
|
|
2
|
+
import '../node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/hyper.js';
|
|
3
|
+
import '../node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/unsigned-int.js';
|
|
4
|
+
import '../node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/unsigned-hyper.js';
|
|
5
|
+
import '../node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/xdr-type.js';
|
|
6
|
+
import 'buffer';
|
|
7
|
+
import types from '../base/generated/curr_generated.js';
|
|
8
|
+
import '@noble/hashes/sha2.js';
|
|
9
|
+
import '../base/signing.js';
|
|
10
|
+
import '../base/keypair.js';
|
|
11
|
+
import 'base32.js';
|
|
12
|
+
import '../base/util/continued_fraction.js';
|
|
13
|
+
import '../base/util/bignumber.js';
|
|
14
|
+
import '../base/transaction_builder.js';
|
|
15
|
+
import '../base/muxed_account.js';
|
|
16
|
+
import '../base/scval.js';
|
|
17
|
+
import '../base/numbers/uint128.js';
|
|
18
|
+
import '../base/numbers/uint256.js';
|
|
19
|
+
import '../base/numbers/int128.js';
|
|
20
|
+
import '../base/numbers/int256.js';
|
|
21
|
+
import { BadResponseError } from './bad_response.js';
|
|
22
|
+
|
|
23
|
+
class TransactionFailedError extends BadResponseError {
|
|
24
|
+
/**
|
|
25
|
+
* Returns the transaction- and operation-level result codes reported by
|
|
26
|
+
* Horizon, e.g. `{ transaction: "tx_failed", operations: ["op_underfunded"] }`.
|
|
27
|
+
*
|
|
28
|
+
* Horizon omits `operations` when the transaction failed a
|
|
29
|
+
* transaction-level check (e.g. `tx_bad_seq`) and no operations were
|
|
30
|
+
* evaluated; this accessor normalizes that to an empty array.
|
|
31
|
+
*
|
|
32
|
+
* @returns The `result_codes` object from the response's `extras`.
|
|
33
|
+
*/
|
|
34
|
+
getResultCodes() {
|
|
35
|
+
const { transaction, operations = [] } = this.extras().result_codes;
|
|
36
|
+
return { transaction, operations };
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Decodes and returns the {@link xdr.TransactionResult} from the response's
|
|
40
|
+
* `extras.result_xdr`, providing structured access to per-operation results.
|
|
41
|
+
*
|
|
42
|
+
* @returns The decoded transaction result, or `null` if the response did not
|
|
43
|
+
* include a `result_xdr`.
|
|
44
|
+
* @throws If the server returned a `result_xdr` that is not valid base64-encoded
|
|
45
|
+
* {@link xdr.TransactionResult} XDR.
|
|
46
|
+
*/
|
|
47
|
+
getTransactionResult() {
|
|
48
|
+
const resultXdr = this.extras().result_xdr;
|
|
49
|
+
if (!resultXdr) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return types.TransactionResult.fromXDR(resultXdr, "base64");
|
|
53
|
+
}
|
|
54
|
+
extras() {
|
|
55
|
+
return this.response.data.extras;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { TransactionFailedError };
|
|
60
|
+
//# sourceMappingURL=transaction_failed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction_failed.js","sources":["../../../../src/errors/transaction_failed.ts"],"sourcesContent":["import { xdr } from \"../base/index.js\";\nimport { HorizonApi } from \"../horizon/horizon_api.js\";\nimport { BadResponseError } from \"./bad_response.js\";\n\n/**\n * TransactionFailedError is raised when a transaction submitted to Horizon\n * is rejected with a `transaction_failed` error response (HTTP 400). It\n * provides convenient accessors for the result codes and the decoded\n * {@link xdr.TransactionResult}, which are otherwise nested deep inside the\n * raw Horizon response.\n *\n * @example\n * ```js\n * try {\n * await server.submitTransaction(tx);\n * } catch (err) {\n * if (err instanceof TransactionFailedError) {\n * const { transaction, operations } = err.getResultCodes();\n * console.log(transaction); // e.g. \"tx_failed\"\n * console.log(operations); // e.g. [\"op_underfunded\"]\n * console.log(err.getTransactionResult()?.result().switch().name);\n * }\n * }\n * ```\n *\n * @param message - Human-readable error message.\n * @param response - Response details, received from the Horizon server, whose\n * `data` field contains a `transaction_failed` error response with `extras`.\n */\nexport class TransactionFailedError extends BadResponseError {\n /**\n * Returns the transaction- and operation-level result codes reported by\n * Horizon, e.g. `{ transaction: \"tx_failed\", operations: [\"op_underfunded\"] }`.\n *\n * Horizon omits `operations` when the transaction failed a\n * transaction-level check (e.g. `tx_bad_seq`) and no operations were\n * evaluated; this accessor normalizes that to an empty array.\n *\n * @returns The `result_codes` object from the response's `extras`.\n */\n public getResultCodes(): {\n transaction: HorizonApi.TransactionFailedResultCodes;\n operations: string[];\n } {\n const { transaction, operations = [] } = this.extras().result_codes;\n return { transaction, operations };\n }\n\n /**\n * Decodes and returns the {@link xdr.TransactionResult} from the response's\n * `extras.result_xdr`, providing structured access to per-operation results.\n *\n * @returns The decoded transaction result, or `null` if the response did not\n * include a `result_xdr`.\n * @throws If the server returned a `result_xdr` that is not valid base64-encoded\n * {@link xdr.TransactionResult} XDR.\n */\n public getTransactionResult(): xdr.TransactionResult | null {\n const resultXdr = this.extras().result_xdr;\n if (!resultXdr) {\n return null;\n }\n return xdr.TransactionResult.fromXDR(resultXdr, \"base64\");\n }\n\n private extras(): HorizonApi.TransactionFailedExtras {\n return (\n this.response.data as HorizonApi.ErrorResponseData.TransactionFailed\n ).extras;\n }\n}\n"],"names":["xdr"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA6BO,MAAM,+BAA+B,gBAAA,CAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWpD,cAAA,GAGL;AACA,IAAA,MAAM,EAAE,aAAa,UAAA,GAAa,IAAG,GAAI,IAAA,CAAK,QAAO,CAAE,YAAA;AACvD,IAAA,OAAO,EAAE,aAAa,UAAA,EAAW;AAAA,EACnC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWO,oBAAA,GAAqD;AAC1D,IAAA,MAAM,SAAA,GAAY,IAAA,CAAK,MAAA,EAAO,CAAE,UAAA;AAChC,IAAA,IAAI,CAAC,SAAA,EAAW;AACd,MAAA,OAAO,IAAA;AAAA,IACT;AACA,IAAA,OAAOA,KAAA,CAAI,iBAAA,CAAkB,OAAA,CAAQ,SAAA,EAAW,QAAQ,CAAA;AAAA,EAC1D;AAAA,EAEQ,MAAA,GAA6C;AACnD,IAAA,OACE,IAAA,CAAK,SAAS,IAAA,CACd,MAAA;AAAA,EACJ;AACF;;;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { NetworkError } from "./network.js";
|
|
2
|
+
/**
|
|
3
|
+
* Normalizes a rejection from the HTTP client into an SDK error. HTTP-level
|
|
4
|
+
* failures from the http client are Error instances carrying a `.response`,
|
|
5
|
+
* so an instanceof check alone would leak them through raw.
|
|
6
|
+
*
|
|
7
|
+
* If the rejection carries an HTTP response (directly or via `.response`),
|
|
8
|
+
* `wrap` is called with the normalized response details to build the SDK
|
|
9
|
+
* error, and the original error is kept reachable via `cause`. Otherwise the
|
|
10
|
+
* original error is returned as-is (coerced to an `Error` if needed).
|
|
11
|
+
*
|
|
12
|
+
* @param error - The rejection value from the HTTP client.
|
|
13
|
+
* @param wrap - Builds the SDK error from the normalized response details.
|
|
14
|
+
* @returns The SDK error, or the original error if it was not HTTP-level.
|
|
15
|
+
*/
|
|
16
|
+
export declare function wrapHttpError(error: any, wrap: (details: {
|
|
17
|
+
data: any;
|
|
18
|
+
status: number;
|
|
19
|
+
statusText: string;
|
|
20
|
+
}) => NetworkError): Error;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function wrapHttpError(error, wrap) {
|
|
2
|
+
const response = error?.response ?? error;
|
|
3
|
+
if (response && typeof response.status === "number") {
|
|
4
|
+
const wrapped = wrap({
|
|
5
|
+
data: response.data,
|
|
6
|
+
status: response.status,
|
|
7
|
+
statusText: response.statusText
|
|
8
|
+
});
|
|
9
|
+
if (error instanceof Error) {
|
|
10
|
+
wrapped.cause = error;
|
|
11
|
+
}
|
|
12
|
+
return wrapped;
|
|
13
|
+
}
|
|
14
|
+
return error instanceof Error ? error : new Error(String(error));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { wrapHttpError };
|
|
18
|
+
//# sourceMappingURL=wrap_http_error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrap_http_error.js","sources":["../../../../src/errors/wrap_http_error.ts"],"sourcesContent":["import { NetworkError } from \"./network.js\";\n\n/**\n * Normalizes a rejection from the HTTP client into an SDK error. HTTP-level\n * failures from the http client are Error instances carrying a `.response`,\n * so an instanceof check alone would leak them through raw.\n *\n * If the rejection carries an HTTP response (directly or via `.response`),\n * `wrap` is called with the normalized response details to build the SDK\n * error, and the original error is kept reachable via `cause`. Otherwise the\n * original error is returned as-is (coerced to an `Error` if needed).\n *\n * @param error - The rejection value from the HTTP client.\n * @param wrap - Builds the SDK error from the normalized response details.\n * @returns The SDK error, or the original error if it was not HTTP-level.\n */\nexport function wrapHttpError(\n error: any,\n wrap: (details: {\n data: any;\n status: number;\n statusText: string;\n }) => NetworkError,\n): Error {\n const response = error?.response ?? error;\n if (response && typeof response.status === \"number\") {\n const wrapped = wrap({\n data: response.data,\n status: response.status,\n statusText: response.statusText,\n });\n // keep the underlying http client error (headers, config, etc.) reachable\n if (error instanceof Error) {\n wrapped.cause = error;\n }\n return wrapped;\n }\n return error instanceof Error ? error : new Error(String(error));\n}\n"],"names":[],"mappings":"AAgBO,SAAS,aAAA,CACd,OACA,IAAA,EAKO;AACP,EAAA,MAAM,QAAA,GAAW,OAAO,QAAA,IAAY,KAAA;AACpC,EAAA,IAAI,QAAA,IAAY,OAAO,QAAA,CAAS,MAAA,KAAW,QAAA,EAAU;AACnD,IAAA,MAAM,UAAU,IAAA,CAAK;AAAA,MACnB,MAAM,QAAA,CAAS,IAAA;AAAA,MACf,QAAQ,QAAA,CAAS,MAAA;AAAA,MACjB,YAAY,QAAA,CAAS;AAAA,KACtB,CAAA;AAED,IAAA,IAAI,iBAAiB,KAAA,EAAO;AAC1B,MAAA,OAAA,CAAQ,KAAA,GAAQ,KAAA;AAAA,IAClB;AACA,IAAA,OAAO,OAAA;AAAA,EACT;AACA,EAAA,OAAO,iBAAiB,KAAA,GAAQ,KAAA,GAAQ,IAAI,KAAA,CAAM,MAAA,CAAO,KAAK,CAAC,CAAA;AACjE;;;;"}
|
|
@@ -1,27 +1,9 @@
|
|
|
1
|
-
import '../node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/int.js';
|
|
2
|
-
import '../node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/hyper.js';
|
|
3
|
-
import '../node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/unsigned-int.js';
|
|
4
|
-
import '../node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/unsigned-hyper.js';
|
|
5
|
-
import '../node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/xdr-type.js';
|
|
6
|
-
import 'buffer';
|
|
7
|
-
import '../base/generated/curr_generated.js';
|
|
8
|
-
import '@noble/hashes/sha2.js';
|
|
9
|
-
import '../base/signing.js';
|
|
10
|
-
import '../base/keypair.js';
|
|
11
|
-
import { StrKey } from '../base/strkey.js';
|
|
12
|
-
import '../base/util/continued_fraction.js';
|
|
13
|
-
import '../base/util/bignumber.js';
|
|
14
|
-
import '../base/transaction_builder.js';
|
|
15
|
-
import '../base/muxed_account.js';
|
|
16
|
-
import '../base/scval.js';
|
|
17
|
-
import '../base/numbers/uint128.js';
|
|
18
|
-
import '../base/numbers/uint256.js';
|
|
19
|
-
import '../base/numbers/int128.js';
|
|
20
|
-
import '../base/numbers/int256.js';
|
|
21
1
|
import { Config } from '../config.js';
|
|
22
2
|
import { BadResponseError } from '../errors/bad_response.js';
|
|
3
|
+
import { wrapHttpError } from '../errors/wrap_http_error.js';
|
|
23
4
|
import { Resolver } from '../stellartoml/index.js';
|
|
24
5
|
import { validateDomain } from './utils.js';
|
|
6
|
+
import { StrKey } from '../base/strkey.js';
|
|
25
7
|
import { axiosClient } from '../http-client/axios-client.js';
|
|
26
8
|
|
|
27
9
|
const FEDERATION_RESPONSE_MAX_SIZE = 100 * 1024;
|
|
@@ -201,23 +183,21 @@ class FederationServer {
|
|
|
201
183
|
throw new Error("memo value should be of type string");
|
|
202
184
|
}
|
|
203
185
|
return response.data;
|
|
204
|
-
}).catch((
|
|
205
|
-
if (
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
`federation response exceeds allowed size of ${FEDERATION_RESPONSE_MAX_SIZE}`
|
|
209
|
-
);
|
|
210
|
-
} else {
|
|
211
|
-
return Promise.reject(response);
|
|
212
|
-
}
|
|
213
|
-
} else {
|
|
214
|
-
return Promise.reject(
|
|
215
|
-
new BadResponseError(
|
|
216
|
-
`Server query failed. Server responded: ${response.status} ${response.statusText}`,
|
|
217
|
-
response.data
|
|
218
|
-
)
|
|
186
|
+
}).catch((error) => {
|
|
187
|
+
if (error instanceof Error && error.message.match(/^maxContentLength size/)) {
|
|
188
|
+
throw new Error(
|
|
189
|
+
`federation response exceeds allowed size of ${FEDERATION_RESPONSE_MAX_SIZE}`
|
|
219
190
|
);
|
|
220
191
|
}
|
|
192
|
+
return Promise.reject(
|
|
193
|
+
wrapHttpError(
|
|
194
|
+
error,
|
|
195
|
+
(details) => new BadResponseError(
|
|
196
|
+
`Server query failed. Server responded: ${details.status} ${details.statusText}`,
|
|
197
|
+
details
|
|
198
|
+
)
|
|
199
|
+
)
|
|
200
|
+
);
|
|
221
201
|
});
|
|
222
202
|
}
|
|
223
203
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sources":["../../../../src/federation/server.ts"],"sourcesContent":["import { StrKey } from \"../base/index.js\";\n\nimport { Config } from \"../config.js\";\nimport { BadResponseError } from \"../errors/index.js\";\nimport { Resolver } from \"../stellartoml/index.js\";\n\nimport type { Api } from \"./api.js\";\nimport { httpClient } from \"../http-client/index.js\";\nimport { validateDomain } from \"./utils.js\";\n\n/**\n * The maximum size of response from a federation server\n * @defaultValue 102400\n */\nexport const FEDERATION_RESPONSE_MAX_SIZE: number = 100 * 1024;\n\n/**\n * Federation.Server handles a network connection to a\n * [federation server](https://developers.stellar.org/docs/learn/encyclopedia/federation)\n * instance and exposes an interface for requests to that instance.\n *\n * @param serverURL - The federation server URL (ex. `https://acme.com/federation`).\n * @param domain - Domain this server represents\n * @param opts - (optional) Options object\n * @returns */\nexport class FederationServer {\n /**\n * The federation server URL (ex. `https://acme.com/federation`).\n */\n private readonly serverURL: URL; // TODO: public or private? readonly?\n\n /**\n * Domain this server represents.\n */\n private readonly domain: string; // TODO: public or private? readonly?\n\n /**\n * Allow a timeout, default: 0. Allows user to avoid nasty lag due to TOML resolve issue.\n */\n private readonly timeout: number; // TODO: public or private? readonly?\n\n /**\n * A helper method for handling user inputs that contain `destination` value.\n * It accepts two types of values:\n *\n * * For Stellar address (ex. `bob*stellar.org`) it splits Stellar address and then tries to find information about\n * federation server in `stellar.toml` file for a given domain. It returns a `Promise` which resolves if federation\n * server exists and user has been found and rejects in all other cases.\n * * For Account ID (ex. `GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS`) it returns a `Promise` which\n * resolves if Account ID is valid and rejects in all other cases. Please note that this method does not check\n * if the account actually exists in a ledger.\n *\n * @example\n * ```ts\n * StellarSdk.FederationServer.resolve('bob*stellar.org')\n * .then(federationRecord => {\n * // {\n * // account_id: 'GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS',\n * // memo_type: 'id',\n * // memo: 100\n * // }\n * });\n * ```\n *\n * @see <a href=\"https://developers.stellar.org/docs/learn/encyclopedia/federation\" target=\"_blank\">Federation doc</a>\n * @see <a href=\"https://developers.stellar.org/docs/issuing-assets/publishing-asset-info\" target=\"_blank\">Stellar.toml doc</a>\n * @param value - Stellar Address (ex. `bob*stellar.org`)\n * @param opts - (optional) Options object\n * @returns A promise that resolves to the federation record\n * @throws Will throw an error if the provided account ID is not a valid Ed25519 public key.\n */\n public static async resolve(\n value: string,\n opts: Api.Options = {},\n ): Promise<Api.Record> {\n // Check if `value` is in account ID format\n if (value.indexOf(\"*\") < 0) {\n if (!StrKey.isValidEd25519PublicKey(value)) {\n return Promise.reject(new Error(\"Invalid Account ID\"));\n }\n return Promise.resolve({ account_id: value });\n }\n\n const addressParts = value.split(\"*\");\n const [, domain] = addressParts;\n\n if (addressParts.length !== 2 || !domain) {\n return Promise.reject(new Error(\"Invalid Stellar address\"));\n }\n\n const federationServer = await FederationServer.createForDomain(\n domain,\n opts,\n );\n return federationServer.resolveAddress(value);\n }\n\n /**\n * Creates a `FederationServer` instance based on information from\n * [stellar.toml](https://developers.stellar.org/docs/issuing-assets/publishing-asset-info)\n * file for a given domain.\n *\n * If `stellar.toml` file does not exist for a given domain or it does not\n * contain information about a federation server Promise will reject.\n *\n * @example\n * ```ts\n * StellarSdk.FederationServer.createForDomain('acme.com')\n * .then(federationServer => {\n * // federationServer.resolveAddress('bob').then(...)\n * })\n * .catch(error => {\n * // stellar.toml does not exist or it does not contain information about federation server.\n * });\n * ```\n *\n * @see <a href=\"https://developers.stellar.org/docs/issuing-assets/publishing-asset-info\" target=\"_blank\">Stellar.toml doc</a>\n * @param domain - Domain to get federation server for\n * @param opts - (optional) Options object\n * @returns A promise that resolves to the federation record\n * @throws Will throw an error if the domain's stellar.toml file does not contain a federation server field.\n */\n public static async createForDomain(\n domain: string,\n opts: Api.Options = {},\n ): Promise<FederationServer> {\n validateDomain(domain);\n const tomlObject = await Resolver.resolve(domain, opts);\n if (!tomlObject.FEDERATION_SERVER) {\n return Promise.reject(\n new Error(\"stellar.toml does not contain FEDERATION_SERVER field\"),\n );\n }\n return new FederationServer(tomlObject.FEDERATION_SERVER, domain, opts);\n }\n\n public constructor(\n serverURL: string,\n domain: string,\n opts: Api.Options = {},\n ) {\n this.serverURL = new URL(serverURL);\n this.domain = domain;\n validateDomain(domain);\n\n const allowHttp =\n typeof opts.allowHttp === \"undefined\"\n ? Config.isAllowHttp()\n : opts.allowHttp;\n\n this.timeout =\n typeof opts.timeout === \"undefined\" ? Config.getTimeout() : opts.timeout;\n\n if (this.serverURL.protocol !== \"https:\" && !allowHttp) {\n throw new Error(\"Cannot connect to insecure federation server\");\n }\n }\n\n /**\n * Get the federation record if the user was found for a given Stellar address\n * @see <a href=\"https://developers.stellar.org/docs/encyclopedia/federation\" target=\"_blank\">Federation doc</a>\n * @param address - Stellar address (ex. `bob*stellar.org`). If `FederationServer` was instantiated with `domain` param only username (ex. `bob`) can be passed.\n * @returns A promise that resolves to the federation record\n * @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\n */\n public async resolveAddress(address: string): Promise<Api.Record> {\n let stellarAddress = address;\n if (address.indexOf(\"*\") < 0) {\n if (!this.domain) {\n return Promise.reject(\n new Error(\n \"Unknown domain. Make sure `address` contains a domain (ex. `bob*stellar.org`) or pass `domain` parameter when instantiating the server object.\",\n ),\n );\n }\n stellarAddress = `${address}*${this.domain}`;\n }\n const url = new URL(this.serverURL);\n url.search = \"\";\n url.searchParams.set(\"type\", \"name\");\n url.searchParams.set(\"q\", stellarAddress);\n return this._sendRequest(url);\n }\n\n /**\n * Given an account ID, get their federation record if the user was found\n * @see <a href=\"https://developers.stellar.org/docs/encyclopedia/federation\" target=\"_blank\">Federation doc</a>\n * @param accountId - Account ID (ex. `GBYNR2QJXLBCBTRN44MRORCMI4YO7FZPFBCNOKTOBCAAFC7KC3LNPRYS`)\n * @returns A promise that resolves to the federation record\n * @throws Will throw an error if the federation server returns an invalid memo value.\n * @throws Will throw an error if the federation server's response exceeds the allowed maximum size.\n * @throws Will throw an error if the server query fails with an improper response.\n */\n public async resolveAccountId(accountId: string): Promise<Api.Record> {\n const url = new URL(this.serverURL);\n url.search = \"\";\n url.searchParams.set(\"type\", \"id\");\n url.searchParams.set(\"q\", accountId);\n return this._sendRequest(url);\n }\n\n /**\n * Given a transactionId, get the federation record if the sender of the transaction was found\n * @see <a href=\"https://developers.stellar.org/docs/glossary/federation/\" target=\"_blank\">Federation doc</a>\n * @param transactionId - Transaction ID (ex. `3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889`)\n * @returns A promise that resolves to the federation record\n * @throws Will throw an error if the federation server returns an invalid memo value.\n * @throws Will throw an error if the federation server's response exceeds the allowed maximum size.\n * @throws Will throw an error if the server query fails with an improper response.\n */\n public async resolveTransactionId(\n transactionId: string,\n ): Promise<Api.Record> {\n const url = new URL(this.serverURL);\n url.search = \"\";\n url.searchParams.set(\"type\", \"txid\");\n url.searchParams.set(\"q\", transactionId);\n return this._sendRequest(url);\n }\n\n private async _sendRequest(url: URL) {\n const timeout = this.timeout;\n\n return httpClient\n .get(url.toString(), {\n maxContentLength: FEDERATION_RESPONSE_MAX_SIZE,\n timeout,\n })\n .then((response) => {\n if (\n typeof response.data.memo !== \"undefined\" &&\n typeof response.data.memo !== \"string\"\n ) {\n throw new Error(\"memo value should be of type string\");\n }\n return response.data;\n })\n .catch((response) => {\n if (response instanceof Error) {\n if (response.message.match(/^maxContentLength size/)) {\n throw new Error(\n `federation response exceeds allowed size of ${FEDERATION_RESPONSE_MAX_SIZE}`,\n );\n } else {\n return Promise.reject(response);\n }\n } else {\n return Promise.reject(\n new BadResponseError(\n `Server query failed. Server responded: ${response.status} ${response.statusText}`,\n response.data,\n ),\n );\n }\n });\n }\n}\n"],"names":["httpClient"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAcO,MAAM,+BAAuC,GAAA,GAAM;AAWnD,MAAM,gBAAA,CAAiB;AAAA;AAAA;AAAA;AAAA,EAIX,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,OAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgCjB,aAAoB,OAAA,CAClB,KAAA,EACA,IAAA,GAAoB,EAAC,EACA;AAErB,IAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,GAAG,CAAA,GAAI,CAAA,EAAG;AAC1B,MAAA,IAAI,CAAC,MAAA,CAAO,uBAAA,CAAwB,KAAK,CAAA,EA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AAK,IAAA,KAAS,QAAA,EAC9B;AACA,QAAA,MAAM,IAAI,MAAM,qCAAqC,CAAA;AAAA,MACvD;AACA,MAAA,OAAO,QAAA,CAAS,IAAA;AAAA,IAClB,CAAC,CAAA,CACA,KAAA,CAAM,CAAC,QAAA,KAAa;AACnB,MAAA,IAAI,oBAAoB,KAAA,EAAO;AAC7B,QAAA,IAAI,QAAA,CAAS,OAAA,CAAQ,KAAA,CAAM,wBAAwB,CAAA,EAAG;AACpD,UAAA,MAAM,IAAI,KAAA;AAAA,YACR,+CAA+C,4BAA4B,CAAA;AAAA,WAC7E;AAAA,QACF,CAAA,MAAO;AACL,UAAA,OAAO,OAAA,CAAQ,OAAO,QAAQ,CAAA;AAAA,QAChC;AAAA,MACF,CAAA,MAAO;AACL,QAAA,OAAO,OAAA,CAAQ,MAAA;AAAA,UACb,IAAI,gBAAA;AAAA,YACF,CAAA,uCAAA,EAA0C,QAAA,CAAS,MAAM,CAAA,CAAA,EAAI,SAAS,UAAU,CAAA,CAAA;AAAA,YAChF,QAAA,CAAS;AAAA;AACX,SACF;AAAA,MACF;AAAA,IACF,CAAC,CAAA;AAAA,EACL;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"server.js","sources":["../../../../src/federation/server.ts"],"sourcesContent":["import { StrKey } from \"../base/index.js\";\n\nimport { Config } from \"../config.js\";\nimport { BadResponseError } from \"../errors/index.js\";\nimport { wrapHttpError } from \"../errors/wrap_http_error.js\";\nimport { Resolver } from \"../stellartoml/index.js\";\n\nimport type { Api } from \"./api.js\";\nimport { httpClient } from \"../http-client/index.js\";\nimport { validateDomain } from \"./utils.js\";\n\n/**\n * The maximum size of response from a federation server\n * @defaultValue 102400\n */\nexport const FEDERATION_RESPONSE_MAX_SIZE: number = 100 * 1024;\n\n/**\n * Federation.Server handles a network connection to a\n * [federation server](https://developers.stellar.org/docs/learn/encyclopedia/federation)\n * instance and exposes an interface for requests to that instance.\n *\n * @param serverURL - The federation server URL (ex. `https://acme.com/federation`).\n * @param domain - Domain this server represents\n * @param opts - (optional) Options object\n * @returns */\nexport class FederationServer {\n /**\n * The federation server URL (ex. `https://acme.com/federation`).\n */\n private readonly serverURL: URL; // TODO: public or private? readonly?\n\n /**\n * Domain this server represents.\n */\n private readonly domain: string; // TODO: public or private? readonly?\n\n /**\n * Allow a timeout, default: 0. Allows user to avoid nasty lag due to TOML resolve issue.\n */\n private readonly timeout: number; // TODO: public or private? readonly?\n\n /**\n * A helper method for handling user inputs that contain `destination` value.\n * It accepts two types of values:\n *\n * * For Stellar address (ex. `bob*stellar.org`) it splits Stellar address and then tries to find information about\n * federation server in `stellar.toml` file for a given domain. It returns a `Promise` which resolves if federation\n * server exists and user has been found and rejects in all other cases.\n * * For Account ID (ex. `GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS`) it returns a `Promise` which\n * resolves if Account ID is valid and rejects in all other cases. Please note that this method does not check\n * if the account actually exists in a ledger.\n *\n * @example\n * ```ts\n * StellarSdk.FederationServer.resolve('bob*stellar.org')\n * .then(federationRecord => {\n * // {\n * // account_id: 'GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS',\n * // memo_type: 'id',\n * // memo: 100\n * // }\n * });\n * ```\n *\n * @see <a href=\"https://developers.stellar.org/docs/learn/encyclopedia/federation\" target=\"_blank\">Federation doc</a>\n * @see <a href=\"https://developers.stellar.org/docs/issuing-assets/publishing-asset-info\" target=\"_blank\">Stellar.toml doc</a>\n * @param value - Stellar Address (ex. `bob*stellar.org`)\n * @param opts - (optional) Options object\n * @returns A promise that resolves to the federation record\n * @throws Will throw an error if the provided account ID is not a valid Ed25519 public key.\n */\n public static async resolve(\n value: string,\n opts: Api.Options = {},\n ): Promise<Api.Record> {\n // Check if `value` is in account ID format\n if (value.indexOf(\"*\") < 0) {\n if (!StrKey.isValidEd25519PublicKey(value)) {\n return Promise.reject(new Error(\"Invalid Account ID\"));\n }\n return Promise.resolve({ account_id: value });\n }\n\n const addressParts = value.split(\"*\");\n const [, domain] = addressParts;\n\n if (addressParts.length !== 2 || !domain) {\n return Promise.reject(new Error(\"Invalid Stellar address\"));\n }\n\n const federationServer = await FederationServer.createForDomain(\n domain,\n opts,\n );\n return federationServer.resolveAddress(value);\n }\n\n /**\n * Creates a `FederationServer` instance based on information from\n * [stellar.toml](https://developers.stellar.org/docs/issuing-assets/publishing-asset-info)\n * file for a given domain.\n *\n * If `stellar.toml` file does not exist for a given domain or it does not\n * contain information about a federation server Promise will reject.\n *\n * @example\n * ```ts\n * StellarSdk.FederationServer.createForDomain('acme.com')\n * .then(federationServer => {\n * // federationServer.resolveAddress('bob').then(...)\n * })\n * .catch(error => {\n * // stellar.toml does not exist or it does not contain information about federation server.\n * });\n * ```\n *\n * @see <a href=\"https://developers.stellar.org/docs/issuing-assets/publishing-asset-info\" target=\"_blank\">Stellar.toml doc</a>\n * @param domain - Domain to get federation server for\n * @param opts - (optional) Options object\n * @returns A promise that resolves to the federation record\n * @throws Will throw an error if the domain's stellar.toml file does not contain a federation server field.\n */\n public static async createForDomain(\n domain: string,\n opts: Api.Options = {},\n ): Promise<FederationServer> {\n validateDomain(domain);\n const tomlObject = await Resolver.resolve(domain, opts);\n if (!tomlObject.FEDERATION_SERVER) {\n return Promise.reject(\n new Error(\"stellar.toml does not contain FEDERATION_SERVER field\"),\n );\n }\n return new FederationServer(tomlObject.FEDERATION_SERVER, domain, opts);\n }\n\n public constructor(\n serverURL: string,\n domain: string,\n opts: Api.Options = {},\n ) {\n this.serverURL = new URL(serverURL);\n this.domain = domain;\n validateDomain(domain);\n\n const allowHttp =\n typeof opts.allowHttp === \"undefined\"\n ? Config.isAllowHttp()\n : opts.allowHttp;\n\n this.timeout =\n typeof opts.timeout === \"undefined\" ? Config.getTimeout() : opts.timeout;\n\n if (this.serverURL.protocol !== \"https:\" && !allowHttp) {\n throw new Error(\"Cannot connect to insecure federation server\");\n }\n }\n\n /**\n * Get the federation record if the user was found for a given Stellar address\n * @see <a href=\"https://developers.stellar.org/docs/encyclopedia/federation\" target=\"_blank\">Federation doc</a>\n * @param address - Stellar address (ex. `bob*stellar.org`). If `FederationServer` was instantiated with `domain` param only username (ex. `bob`) can be passed.\n * @returns A promise that resolves to the federation record\n * @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\n */\n public async resolveAddress(address: string): Promise<Api.Record> {\n let stellarAddress = address;\n if (address.indexOf(\"*\") < 0) {\n if (!this.domain) {\n return Promise.reject(\n new Error(\n \"Unknown domain. Make sure `address` contains a domain (ex. `bob*stellar.org`) or pass `domain` parameter when instantiating the server object.\",\n ),\n );\n }\n stellarAddress = `${address}*${this.domain}`;\n }\n const url = new URL(this.serverURL);\n url.search = \"\";\n url.searchParams.set(\"type\", \"name\");\n url.searchParams.set(\"q\", stellarAddress);\n return this._sendRequest(url);\n }\n\n /**\n * Given an account ID, get their federation record if the user was found\n * @see <a href=\"https://developers.stellar.org/docs/encyclopedia/federation\" target=\"_blank\">Federation doc</a>\n * @param accountId - Account ID (ex. `GBYNR2QJXLBCBTRN44MRORCMI4YO7FZPFBCNOKTOBCAAFC7KC3LNPRYS`)\n * @returns A promise that resolves to the federation record\n * @throws Will throw an error if the federation server returns an invalid memo value.\n * @throws Will throw an error if the federation server's response exceeds the allowed maximum size.\n * @throws Will throw an error if the server query fails with an improper response.\n */\n public async resolveAccountId(accountId: string): Promise<Api.Record> {\n const url = new URL(this.serverURL);\n url.search = \"\";\n url.searchParams.set(\"type\", \"id\");\n url.searchParams.set(\"q\", accountId);\n return this._sendRequest(url);\n }\n\n /**\n * Given a transactionId, get the federation record if the sender of the transaction was found\n * @see <a href=\"https://developers.stellar.org/docs/glossary/federation/\" target=\"_blank\">Federation doc</a>\n * @param transactionId - Transaction ID (ex. `3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889`)\n * @returns A promise that resolves to the federation record\n * @throws Will throw an error if the federation server returns an invalid memo value.\n * @throws Will throw an error if the federation server's response exceeds the allowed maximum size.\n * @throws Will throw an error if the server query fails with an improper response.\n */\n public async resolveTransactionId(\n transactionId: string,\n ): Promise<Api.Record> {\n const url = new URL(this.serverURL);\n url.search = \"\";\n url.searchParams.set(\"type\", \"txid\");\n url.searchParams.set(\"q\", transactionId);\n return this._sendRequest(url);\n }\n\n private async _sendRequest(url: URL) {\n const timeout = this.timeout;\n\n return httpClient\n .get(url.toString(), {\n maxContentLength: FEDERATION_RESPONSE_MAX_SIZE,\n timeout,\n })\n .then((response) => {\n if (\n typeof response.data.memo !== \"undefined\" &&\n typeof response.data.memo !== \"string\"\n ) {\n throw new Error(\"memo value should be of type string\");\n }\n return response.data;\n })\n .catch((error) => {\n if (\n error instanceof Error &&\n error.message.match(/^maxContentLength size/)\n ) {\n throw new Error(\n `federation response exceeds allowed size of ${FEDERATION_RESPONSE_MAX_SIZE}`,\n );\n }\n return Promise.reject(\n wrapHttpError(\n error,\n (details) =>\n new BadResponseError(\n `Server query failed. Server responded: ${details.status} ${details.statusText}`,\n details,\n ),\n ),\n );\n });\n }\n}\n"],"names":["httpClient"],"mappings":";;;;;;;;AAeO,MAAM,+BAAuC,GAAA,GAAM;AAWnD,MAAM,gBAAA,CAAiB;AAAA;AAAA;AAAA;AAAA,EAIX,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,OAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgCjB,aAAoB,OAAA,CAClB,KAAA,EACA,IAAA,GAAoB,EAAC,EACA;AAErB,IAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,GAAG,CAAA,GAAI,CAAA,EAAG;AAC1B,MAAA,IAAI,CAAC,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A,KAAS,eAC9B,OAAO,QAAA,CAAS,IAAA,CAAK,IAAA,KAAS,QAAA,EAC9B;AACA,QAAA,MAAM,IAAI,MAAM,qCAAqC,CAAA;AAAA,MACvD;AACA,MAAA,OAAO,QAAA,CAAS,IAAA;AAAA,IAClB,CAAC,CAAA,CACA,KAAA,CAAM,CAAC,KAAA,KAAU;AAChB,MAAA,IACE,iBAAiB,KAAA,IACjB,KAAA,CAAM,OAAA,CAAQ,KAAA,CAAM,wBAAwB,CAAA,EAC5C;AACA,QAAA,MAAM,IAAI,KAAA;AAAA,UACR,+CAA+C,4BAA4B,CAAA;AAAA,SAC7E;AAAA,MACF;AACA,MAAA,OAAO,OAAA,CAAQ,MAAA;AAAA,QACb,aAAA;AAAA,UACE,KAAA;AAAA,UACA,CAAC,YACC,IAAI,gBAAA;AAAA,YACF,CAAA,uCAAA,EAA0C,OAAA,CAAQ,MAAM,CAAA,CAAA,EAAI,QAAQ,UAAU,CAAA,CAAA;AAAA,YAC9E;AAAA;AACF;AACJ,OACF;AAAA,IACF,CAAC,CAAA;AAAA,EACL;AACF;;;;"}
|
|
@@ -1,24 +1,4 @@
|
|
|
1
|
-
import '../node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/int.js';
|
|
2
|
-
import '../node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/hyper.js';
|
|
3
|
-
import '../node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/unsigned-int.js';
|
|
4
|
-
import '../node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/unsigned-hyper.js';
|
|
5
|
-
import '../node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/xdr-type.js';
|
|
6
|
-
import 'buffer';
|
|
7
|
-
import '../base/generated/curr_generated.js';
|
|
8
|
-
import '@noble/hashes/sha2.js';
|
|
9
|
-
import '../base/signing.js';
|
|
10
|
-
import '../base/keypair.js';
|
|
11
|
-
import 'base32.js';
|
|
12
|
-
import '../base/util/continued_fraction.js';
|
|
13
|
-
import '../base/util/bignumber.js';
|
|
14
|
-
import '../base/transaction_builder.js';
|
|
15
1
|
import { Account } from '../base/account.js';
|
|
16
|
-
import '../base/muxed_account.js';
|
|
17
|
-
import '../base/scval.js';
|
|
18
|
-
import '../base/numbers/uint128.js';
|
|
19
|
-
import '../base/numbers/uint256.js';
|
|
20
|
-
import '../base/numbers/int128.js';
|
|
21
|
-
import '../base/numbers/int256.js';
|
|
22
2
|
|
|
23
3
|
class AccountResponse {
|
|
24
4
|
id;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account_response.js","sources":["../../../../src/horizon/account_response.ts"],"sourcesContent":["/* tslint:disable:variable-name */\n\nimport { Account as BaseAccount } from \"../base/index.js\";\nimport type { TransactionBuilder, TransactionSource } from \"../base/index.js\";\nimport { HorizonApi } from \"./horizon_api.js\";\nimport { ServerApi } from \"./server_api.js\";\n\n/**\n * Do not create this object directly, use {@link Horizon.Server.loadAccount | Horizon.Server#loadAccount}.\n *\n * Returns information and links relating to a single account.\n * The balances section in the returned JSON will also list all the trust lines this account has set up.\n * It also contains {@link BaseAccount} object and exposes it's methods so can be used in {@link TransactionBuilder}.\n *\n * @see {@link https://developers.stellar.org/docs/data/horizon/api-reference/resources/accounts/object | Account Details}\n * @param response - Response from horizon account endpoint.\n * @returns AccountResponse instance\n */\nexport class AccountResponse implements TransactionSource {\n public readonly id!: string;\n public readonly paging_token!: string;\n public readonly account_id!: string;\n public sequence!: string;\n public readonly sequence_ledger?: number;\n public readonly sequence_time?: string;\n public readonly subentry_count!: number;\n public readonly home_domain?: string;\n public readonly inflation_destination?: string;\n public readonly last_modified_ledger!: number;\n public readonly last_modified_time!: string;\n public readonly thresholds!: HorizonApi.AccountThresholds;\n public readonly flags!: HorizonApi.Flags;\n public readonly balances!: HorizonApi.BalanceLine[];\n public readonly signers!: ServerApi.AccountRecordSigners[];\n public readonly num_sponsoring!: number;\n public readonly num_sponsored!: number;\n public readonly sponsor?: string;\n public readonly data!: (options: {\n value: string;\n }) => Promise<{ value: string }>;\n public readonly data_attr!: Record<string, string>;\n public readonly effects!: ServerApi.CallCollectionFunction<ServerApi.EffectRecord>;\n public readonly offers!: ServerApi.CallCollectionFunction<ServerApi.OfferRecord>;\n public readonly operations!: ServerApi.CallCollectionFunction<ServerApi.OperationRecord>;\n public readonly payments!: ServerApi.CallCollectionFunction<ServerApi.PaymentOperationRecord>;\n public readonly trades!: ServerApi.CallCollectionFunction<ServerApi.TradeRecord>;\n public readonly transactions!: ServerApi.CallCollectionFunction<ServerApi.TransactionRecord>;\n private readonly _baseAccount: BaseAccount;\n\n constructor(response: ServerApi.AccountRecord) {\n this._baseAccount = new BaseAccount(response.account_id, response.sequence);\n // Extract response fields\n this.effects = response.effects;\n this.offers = response.offers;\n this.operations = response.operations;\n this.payments = response.payments;\n this.trades = response.trades;\n this.data = response.data;\n this.transactions = response.transactions;\n this.id = response.id;\n this.paging_token = response.paging_token;\n this.account_id = response.account_id;\n this.sequence = response.sequence;\n this.sequence_ledger = response.sequence_ledger;\n this.sequence_time = response.sequence_time;\n this.subentry_count = response.subentry_count;\n this.home_domain = response.home_domain;\n this.inflation_destination = response.inflation_destination;\n this.last_modified_ledger = response.last_modified_ledger;\n this.last_modified_time = response.last_modified_time;\n this.thresholds = response.thresholds;\n this.flags = response.flags;\n this.balances = response.balances;\n this.signers = response.signers;\n this.data_attr = response.data_attr;\n this.sponsor = response.sponsor;\n this.num_sponsoring = response.num_sponsoring;\n this.num_sponsored = response.num_sponsored;\n }\n\n /**\n * Get Stellar account public key ex. `GB3KJPLFUYN5VL6R3GU3EGCGVCKFDSD7BEDX42HWG5BWFKB3KQGJJRMA`\n * @returns accountId\n */\n public accountId(): string {\n return this._baseAccount.accountId();\n }\n\n /**\n * Get the current sequence number\n * @returns sequenceNumber\n */\n public sequenceNumber(): string {\n return this._baseAccount.sequenceNumber();\n }\n\n /**\n * Increments sequence number in this object by one.\n * @returns */\n public incrementSequenceNumber(): void {\n this._baseAccount.incrementSequenceNumber();\n this.sequence = this._baseAccount.sequenceNumber();\n }\n}\n"],"names":["BaseAccount"],"mappings":"
|
|
1
|
+
{"version":3,"file":"account_response.js","sources":["../../../../src/horizon/account_response.ts"],"sourcesContent":["/* tslint:disable:variable-name */\n\nimport { Account as BaseAccount } from \"../base/index.js\";\nimport type { TransactionBuilder, TransactionSource } from \"../base/index.js\";\nimport { HorizonApi } from \"./horizon_api.js\";\nimport { ServerApi } from \"./server_api.js\";\n\n/**\n * Do not create this object directly, use {@link Horizon.Server.loadAccount | Horizon.Server#loadAccount}.\n *\n * Returns information and links relating to a single account.\n * The balances section in the returned JSON will also list all the trust lines this account has set up.\n * It also contains {@link BaseAccount} object and exposes it's methods so can be used in {@link TransactionBuilder}.\n *\n * @see {@link https://developers.stellar.org/docs/data/horizon/api-reference/resources/accounts/object | Account Details}\n * @param response - Response from horizon account endpoint.\n * @returns AccountResponse instance\n */\nexport class AccountResponse implements TransactionSource {\n public readonly id!: string;\n public readonly paging_token!: string;\n public readonly account_id!: string;\n public sequence!: string;\n public readonly sequence_ledger?: number;\n public readonly sequence_time?: string;\n public readonly subentry_count!: number;\n public readonly home_domain?: string;\n public readonly inflation_destination?: string;\n public readonly last_modified_ledger!: number;\n public readonly last_modified_time!: string;\n public readonly thresholds!: HorizonApi.AccountThresholds;\n public readonly flags!: HorizonApi.Flags;\n public readonly balances!: HorizonApi.BalanceLine[];\n public readonly signers!: ServerApi.AccountRecordSigners[];\n public readonly num_sponsoring!: number;\n public readonly num_sponsored!: number;\n public readonly sponsor?: string;\n public readonly data!: (options: {\n value: string;\n }) => Promise<{ value: string }>;\n public readonly data_attr!: Record<string, string>;\n public readonly effects!: ServerApi.CallCollectionFunction<ServerApi.EffectRecord>;\n public readonly offers!: ServerApi.CallCollectionFunction<ServerApi.OfferRecord>;\n public readonly operations!: ServerApi.CallCollectionFunction<ServerApi.OperationRecord>;\n public readonly payments!: ServerApi.CallCollectionFunction<ServerApi.PaymentOperationRecord>;\n public readonly trades!: ServerApi.CallCollectionFunction<ServerApi.TradeRecord>;\n public readonly transactions!: ServerApi.CallCollectionFunction<ServerApi.TransactionRecord>;\n private readonly _baseAccount: BaseAccount;\n\n constructor(response: ServerApi.AccountRecord) {\n this._baseAccount = new BaseAccount(response.account_id, response.sequence);\n // Extract response fields\n this.effects = response.effects;\n this.offers = response.offers;\n this.operations = response.operations;\n this.payments = response.payments;\n this.trades = response.trades;\n this.data = response.data;\n this.transactions = response.transactions;\n this.id = response.id;\n this.paging_token = response.paging_token;\n this.account_id = response.account_id;\n this.sequence = response.sequence;\n this.sequence_ledger = response.sequence_ledger;\n this.sequence_time = response.sequence_time;\n this.subentry_count = response.subentry_count;\n this.home_domain = response.home_domain;\n this.inflation_destination = response.inflation_destination;\n this.last_modified_ledger = response.last_modified_ledger;\n this.last_modified_time = response.last_modified_time;\n this.thresholds = response.thresholds;\n this.flags = response.flags;\n this.balances = response.balances;\n this.signers = response.signers;\n this.data_attr = response.data_attr;\n this.sponsor = response.sponsor;\n this.num_sponsoring = response.num_sponsoring;\n this.num_sponsored = response.num_sponsored;\n }\n\n /**\n * Get Stellar account public key ex. `GB3KJPLFUYN5VL6R3GU3EGCGVCKFDSD7BEDX42HWG5BWFKB3KQGJJRMA`\n * @returns accountId\n */\n public accountId(): string {\n return this._baseAccount.accountId();\n }\n\n /**\n * Get the current sequence number\n * @returns sequenceNumber\n */\n public sequenceNumber(): string {\n return this._baseAccount.sequenceNumber();\n }\n\n /**\n * Increments sequence number in this object by one.\n * @returns */\n public incrementSequenceNumber(): void {\n this._baseAccount.incrementSequenceNumber();\n this.sequence = this._baseAccount.sequenceNumber();\n }\n}\n"],"names":["BaseAccount"],"mappings":";;AAkBO,MAAM,eAAA,CAA6C;AAAA,EACxC,EAAA;AAAA,EACA,YAAA;AAAA,EACA,UAAA;AAAA,EACT,QAAA;AAAA,EACS,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,CAAS,WAAA;AAC5B,IAAA,IAAA,CAAK,wBAAwB,QAAA,CAAS,qBAAA;AACtC,IAAA,IAAA,CAAK,uBAAuB,QAAA,CAAS,oBAAA;AACrC,IAAA,IAAA,CAAK,qBAAqB,QAAA,CAAS,kBAAA;AACnC,IAAA,IAAA,CAAK,aAAa,QAAA,CAAS,UAAA;AAC3B,IAAA,IAAA,CAAK,QAAQ,QAAA,CAAS,KAAA;AACtB,IAAA,IAAA,CAAK,WAAW,QAAA,CAAS,QAAA;AACzB,IAAA,IAAA,CAAK,UAAU,QAAA,CAAS,OAAA;AACxB,IAAA,IAAA,CAAK,YAAY,QAAA,CAAS,SAAA;AAC1B,IAAA,IAAA,CAAK,UAAU,QAAA,CAAS,OAAA;AACxB,IAAA,IAAA,CAAK,iBAAiB,QAAA,CAAS,cAAA;AAC/B,IAAA,IAAA,CAAK,gBAAgB,QAAA,CAAS,aAAA;AAAA,EAChC;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,SAAA,GAAoB;AACzB,IAAA,OAAO,IAAA,CAAK,aAAa,SAAA,EAAU;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,cAAA,GAAyB;AAC9B,IAAA,OAAO,IAAA,CAAK,aAAa,cAAA,EAAe;AAAA,EAC1C;AAAA;AAAA;AAAA;AAAA,EAKO,uBAAA,GAAgC;AACrC,IAAA,IAAA,CAAK,aAAa,uBAAA,EAAwB;AAC1C,IAAA,IAAA,CAAK,QAAA,GAAW,IAAA,CAAK,YAAA,CAAa,cAAA,EAAe;AAAA,EACnD;AACF;;;;"}
|
|
@@ -517,12 +517,23 @@ export declare namespace HorizonApi {
|
|
|
517
517
|
TX_INSUFFICIENT_BALANCE = "tx_insufficient_balance",
|
|
518
518
|
TX_NO_SOURCE_ACCOUNT = "tx_no_source_account",
|
|
519
519
|
TX_INSUFFICIENT_FEE = "tx_insufficient_fee",
|
|
520
|
-
TX_INTERNAL_ERROR = "tx_internal_error"
|
|
520
|
+
TX_INTERNAL_ERROR = "tx_internal_error",
|
|
521
|
+
TX_BAD_SPONSORSHIP = "tx_bad_sponsorship",
|
|
522
|
+
TX_BAD_MIN_SEQ_AGE_OR_GAP = "tx_bad_min_seq_age_or_gap",
|
|
523
|
+
TX_MALFORMED = "tx_malformed",
|
|
524
|
+
TX_SOROBAN_INVALID = "tx_soroban_invalid",
|
|
525
|
+
TX_FROZEN_KEY_ACCESSED = "tx_frozen_key_accessed"
|
|
521
526
|
}
|
|
522
527
|
interface TransactionFailedExtras {
|
|
523
528
|
envelope_xdr: string;
|
|
524
529
|
result_codes: {
|
|
525
530
|
transaction: TransactionFailedResultCodes;
|
|
531
|
+
/** Omitted by Horizon when the transaction failed a transaction-level
|
|
532
|
+
* check (e.g. `tx_bad_seq`) and no operations were evaluated. Typed as
|
|
533
|
+
* required for backwards compatibility; treat as possibly undefined
|
|
534
|
+
* when reading the raw response, or use
|
|
535
|
+
* `TransactionFailedError.getResultCodes()` which normalizes it.
|
|
536
|
+
* TODO(next major): make this `operations?: string[]`. */
|
|
526
537
|
operations: string[];
|
|
527
538
|
};
|
|
528
539
|
result_xdr: string;
|
|
@@ -77,6 +77,11 @@ var HorizonApi;
|
|
|
77
77
|
TransactionFailedResultCodes2["TX_NO_SOURCE_ACCOUNT"] = "tx_no_source_account";
|
|
78
78
|
TransactionFailedResultCodes2["TX_INSUFFICIENT_FEE"] = "tx_insufficient_fee";
|
|
79
79
|
TransactionFailedResultCodes2["TX_INTERNAL_ERROR"] = "tx_internal_error";
|
|
80
|
+
TransactionFailedResultCodes2["TX_BAD_SPONSORSHIP"] = "tx_bad_sponsorship";
|
|
81
|
+
TransactionFailedResultCodes2["TX_BAD_MIN_SEQ_AGE_OR_GAP"] = "tx_bad_min_seq_age_or_gap";
|
|
82
|
+
TransactionFailedResultCodes2["TX_MALFORMED"] = "tx_malformed";
|
|
83
|
+
TransactionFailedResultCodes2["TX_SOROBAN_INVALID"] = "tx_soroban_invalid";
|
|
84
|
+
TransactionFailedResultCodes2["TX_FROZEN_KEY_ACCESSED"] = "tx_frozen_key_accessed";
|
|
80
85
|
})(HorizonApi2.TransactionFailedResultCodes || (HorizonApi2.TransactionFailedResultCodes = {}));
|
|
81
86
|
})(HorizonApi || (HorizonApi = {}));
|
|
82
87
|
|