@stellar/stellar-sdk 13.0.0-rc.1 → 13.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CHANGELOG.md +31 -1
  2. package/dist/stellar-sdk-minimal.js +363 -93
  3. package/dist/stellar-sdk-minimal.min.js +1 -1
  4. package/dist/stellar-sdk-no-axios.js +380 -96
  5. package/dist/stellar-sdk-no-axios.min.js +1 -1
  6. package/dist/stellar-sdk-no-eventsource.js +363 -93
  7. package/dist/stellar-sdk-no-eventsource.min.js +1 -1
  8. package/dist/stellar-sdk.js +380 -96
  9. package/dist/stellar-sdk.min.js +1 -1
  10. package/lib/contract/assembled_transaction.d.ts +75 -3
  11. package/lib/contract/assembled_transaction.js +123 -34
  12. package/lib/contract/basic_node_signer.d.ts +3 -2
  13. package/lib/contract/basic_node_signer.js +16 -8
  14. package/lib/contract/client.d.ts +13 -1
  15. package/lib/contract/client.js +159 -48
  16. package/lib/contract/types.d.ts +72 -8
  17. package/lib/contract/types.js +1 -0
  18. package/lib/horizon/call_builder.d.ts +1 -1
  19. package/lib/horizon/horizon_axios_client.js +1 -1
  20. package/lib/horizon/server_api.d.ts +1 -0
  21. package/lib/horizon/server_api.js +5 -0
  22. package/lib/horizon/types/effects.d.ts +51 -51
  23. package/lib/horizon/types/trade.d.ts +3 -2
  24. package/lib/http-client/types.d.ts +1 -0
  25. package/lib/minimal/contract/assembled_transaction.d.ts +75 -3
  26. package/lib/minimal/contract/assembled_transaction.js +123 -34
  27. package/lib/minimal/contract/basic_node_signer.d.ts +3 -2
  28. package/lib/minimal/contract/basic_node_signer.js +16 -8
  29. package/lib/minimal/contract/client.d.ts +13 -1
  30. package/lib/minimal/contract/client.js +159 -48
  31. package/lib/minimal/contract/types.d.ts +72 -8
  32. package/lib/minimal/contract/types.js +1 -0
  33. package/lib/minimal/horizon/call_builder.d.ts +1 -1
  34. package/lib/minimal/horizon/horizon_axios_client.js +1 -1
  35. package/lib/minimal/horizon/server_api.d.ts +1 -0
  36. package/lib/minimal/horizon/server_api.js +5 -0
  37. package/lib/minimal/horizon/types/effects.d.ts +51 -51
  38. package/lib/minimal/horizon/types/trade.d.ts +3 -2
  39. package/lib/minimal/http-client/types.d.ts +1 -0
  40. package/lib/minimal/rpc/axios.js +1 -1
  41. package/lib/minimal/stellartoml/index.d.ts +1 -0
  42. package/lib/minimal/stellartoml/index.js +2 -0
  43. package/lib/no-axios/contract/assembled_transaction.d.ts +75 -3
  44. package/lib/no-axios/contract/assembled_transaction.js +123 -34
  45. package/lib/no-axios/contract/basic_node_signer.d.ts +3 -2
  46. package/lib/no-axios/contract/basic_node_signer.js +16 -8
  47. package/lib/no-axios/contract/client.d.ts +13 -1
  48. package/lib/no-axios/contract/client.js +159 -48
  49. package/lib/no-axios/contract/types.d.ts +72 -8
  50. package/lib/no-axios/contract/types.js +1 -0
  51. package/lib/no-axios/horizon/call_builder.d.ts +1 -1
  52. package/lib/no-axios/horizon/horizon_axios_client.js +1 -1
  53. package/lib/no-axios/horizon/server_api.d.ts +1 -0
  54. package/lib/no-axios/horizon/server_api.js +5 -0
  55. package/lib/no-axios/horizon/types/effects.d.ts +51 -51
  56. package/lib/no-axios/horizon/types/trade.d.ts +3 -2
  57. package/lib/no-axios/http-client/types.d.ts +1 -0
  58. package/lib/no-axios/rpc/axios.js +1 -1
  59. package/lib/no-axios/stellartoml/index.d.ts +1 -0
  60. package/lib/no-axios/stellartoml/index.js +2 -0
  61. package/lib/no-eventsource/contract/assembled_transaction.d.ts +75 -3
  62. package/lib/no-eventsource/contract/assembled_transaction.js +123 -34
  63. package/lib/no-eventsource/contract/basic_node_signer.d.ts +3 -2
  64. package/lib/no-eventsource/contract/basic_node_signer.js +16 -8
  65. package/lib/no-eventsource/contract/client.d.ts +13 -1
  66. package/lib/no-eventsource/contract/client.js +159 -48
  67. package/lib/no-eventsource/contract/types.d.ts +72 -8
  68. package/lib/no-eventsource/contract/types.js +1 -0
  69. package/lib/no-eventsource/horizon/call_builder.d.ts +1 -1
  70. package/lib/no-eventsource/horizon/horizon_axios_client.js +1 -1
  71. package/lib/no-eventsource/horizon/server_api.d.ts +1 -0
  72. package/lib/no-eventsource/horizon/server_api.js +5 -0
  73. package/lib/no-eventsource/horizon/types/effects.d.ts +51 -51
  74. package/lib/no-eventsource/horizon/types/trade.d.ts +3 -2
  75. package/lib/no-eventsource/http-client/types.d.ts +1 -0
  76. package/lib/no-eventsource/rpc/axios.js +1 -1
  77. package/lib/no-eventsource/stellartoml/index.d.ts +1 -0
  78. package/lib/no-eventsource/stellartoml/index.js +2 -0
  79. package/lib/rpc/axios.js +1 -1
  80. package/lib/stellartoml/index.d.ts +1 -0
  81. package/lib/stellartoml/index.js +2 -0
  82. package/package.json +1 -1
@@ -55,86 +55,86 @@ export declare enum EffectType {
55
55
  contract_credited = 96,
56
56
  contract_debited = 97
57
57
  }
58
- export interface BaseEffectRecord extends HorizonApi.BaseResponse {
58
+ export interface BaseEffectRecord<T extends string = string> extends HorizonApi.BaseResponse {
59
59
  id: string;
60
60
  account: string;
61
61
  paging_token: string;
62
62
  type_i: EffectType;
63
- type: string;
63
+ type: T;
64
64
  created_at: string;
65
65
  }
66
- export interface AccountCreated extends BaseEffectRecord {
66
+ export interface AccountCreated extends BaseEffectRecord<'account_created'> {
67
67
  type_i: EffectType.account_created;
68
68
  starting_balance: string;
69
69
  }
70
- export interface AccountCredited extends BaseEffectRecord, OfferAsset {
70
+ export interface AccountCredited extends BaseEffectRecord<'account_credited'>, OfferAsset {
71
71
  type_i: EffectType.account_credited;
72
72
  amount: string;
73
73
  }
74
- export interface AccountDebited extends BaseEffectRecord {
74
+ export interface AccountDebited extends BaseEffectRecord<'account_debited'>, OfferAsset {
75
75
  type_i: EffectType.account_debited;
76
76
  amount: string;
77
77
  }
78
- export interface AccountThresholdsUpdated extends BaseEffectRecord {
78
+ export interface AccountThresholdsUpdated extends BaseEffectRecord<'account_thresholds_updated'> {
79
79
  type_i: EffectType.account_thresholds_updated;
80
80
  low_threshold: number;
81
81
  med_threshold: number;
82
82
  high_threshold: number;
83
83
  }
84
- export interface AccountHomeDomainUpdated extends BaseEffectRecord {
84
+ export interface AccountHomeDomainUpdated extends BaseEffectRecord<'account_home_domain_updated'> {
85
85
  type_i: EffectType.account_home_domain_updated;
86
86
  home_domain: string;
87
87
  }
88
- export interface AccountFlagsUpdated extends BaseEffectRecord {
88
+ export interface AccountFlagsUpdated extends BaseEffectRecord<'account_flags_updated'> {
89
89
  type_i: EffectType.account_flags_updated;
90
90
  auth_required_flag: boolean;
91
91
  auth_revokable_flag: boolean;
92
92
  }
93
- interface DataEvents extends BaseEffectRecord {
93
+ interface DataEvents<T extends string> extends BaseEffectRecord<T> {
94
94
  name: boolean;
95
95
  value: boolean;
96
96
  }
97
- export interface DataCreated extends DataEvents {
97
+ export interface DataCreated extends DataEvents<'data_created'> {
98
98
  type_i: EffectType.data_created;
99
99
  }
100
- export interface DataUpdated extends DataEvents {
100
+ export interface DataUpdated extends DataEvents<'data_updated'> {
101
101
  type_i: EffectType.data_updated;
102
102
  }
103
- export interface DataRemoved extends DataEvents {
103
+ export interface DataRemoved extends DataEvents<'data_removed'> {
104
104
  type_i: EffectType.data_removed;
105
105
  }
106
- export interface SequenceBumped extends BaseEffectRecord {
106
+ export interface SequenceBumped extends BaseEffectRecord<'sequence_bumped'> {
107
107
  type_i: EffectType.sequence_bumped;
108
108
  new_seq: number | string;
109
109
  }
110
- interface SignerEvents extends BaseEffectRecord {
110
+ interface SignerEvents<T extends string> extends BaseEffectRecord<T> {
111
111
  weight: number;
112
112
  key: string;
113
113
  public_key: string;
114
114
  }
115
- export interface SignerCreated extends SignerEvents {
115
+ export interface SignerCreated extends SignerEvents<'signer_created'> {
116
116
  type_i: EffectType.signer_created;
117
117
  }
118
- export interface SignerRemoved extends SignerEvents {
118
+ export interface SignerRemoved extends SignerEvents<'signer_removed'> {
119
119
  type_i: EffectType.signer_removed;
120
120
  }
121
- export interface SignerUpdated extends SignerEvents {
121
+ export interface SignerUpdated extends SignerEvents<'signer_updated'> {
122
122
  type_i: EffectType.signer_updated;
123
123
  }
124
- interface TrustlineEvents extends BaseEffectRecord, OfferAsset {
124
+ interface TrustlineEvents<T extends string> extends BaseEffectRecord<T>, OfferAsset {
125
125
  limit: string;
126
126
  liquidity_pool_id?: string;
127
127
  }
128
- export interface TrustlineCreated extends TrustlineEvents {
128
+ export interface TrustlineCreated extends TrustlineEvents<'trustline_created'> {
129
129
  type_i: EffectType.trustline_created;
130
130
  }
131
- export interface TrustlineRemoved extends TrustlineEvents {
131
+ export interface TrustlineRemoved extends TrustlineEvents<'trustline_removed'> {
132
132
  type_i: EffectType.trustline_removed;
133
133
  }
134
- export interface TrustlineUpdated extends TrustlineEvents {
134
+ export interface TrustlineUpdated extends TrustlineEvents<'trustline_updated'> {
135
135
  type_i: EffectType.trustline_updated;
136
136
  }
137
- export interface TrustlineAuthorized extends BaseEffectRecord {
137
+ export interface TrustlineAuthorized extends BaseEffectRecord<'trustline_authorized'> {
138
138
  type_i: EffectType.trustline_authorized;
139
139
  asset_type: OfferAsset["asset_type"];
140
140
  asset_code: OfferAsset["asset_code"];
@@ -146,7 +146,7 @@ export interface TrustlineDeauthorized extends Omit<TrustlineAuthorized, "type_i
146
146
  export interface TrustlineAuthorizedToMaintainLiabilities extends Omit<TrustlineAuthorized, "type_i"> {
147
147
  type_i: EffectType.trustline_authorized_to_maintain_liabilities;
148
148
  }
149
- export interface ClaimableBalanceCreated extends BaseEffectRecord {
149
+ export interface ClaimableBalanceCreated extends BaseEffectRecord<'claimable_balance_created'> {
150
150
  type_i: EffectType.claimable_balance_created;
151
151
  amount: string;
152
152
  balance_type_i: string;
@@ -163,64 +163,64 @@ interface SponsershipFields {
163
163
  new_sponsor: string;
164
164
  former_sponsor: string;
165
165
  }
166
- interface AccountSponsorshipEvents extends BaseEffectRecord, SponsershipFields {
166
+ interface AccountSponsorshipEvents<T extends string> extends BaseEffectRecord<T>, SponsershipFields {
167
167
  }
168
- export type AccountSponsorshipCreated = Omit<AccountSponsorshipEvents, "new_sponsor" | "former_sponsor"> & {
168
+ export type AccountSponsorshipCreated = Omit<AccountSponsorshipEvents<'account_sponsorship_created'>, "new_sponsor" | "former_sponsor"> & {
169
169
  type_i: EffectType.account_sponsorship_created;
170
170
  };
171
- export type AccountSponsorshipUpdated = Omit<AccountSponsorshipEvents, "sponsor"> & {
171
+ export type AccountSponsorshipUpdated = Omit<AccountSponsorshipEvents<'account_sponsorship_updated'>, "sponsor"> & {
172
172
  type_i: EffectType.account_sponsorship_updated;
173
173
  };
174
- export type AccountSponsorshipRemoved = Omit<AccountSponsorshipEvents, "new_sponsor" | "sponsor"> & {
174
+ export type AccountSponsorshipRemoved = Omit<AccountSponsorshipEvents<'account_sponsorship_removed'>, "new_sponsor" | "sponsor"> & {
175
175
  type_i: EffectType.account_sponsorship_removed;
176
176
  };
177
- interface TrustlineSponsorshipEvents extends BaseEffectRecord, SponsershipFields {
177
+ interface TrustlineSponsorshipEvents<T extends string> extends BaseEffectRecord<T>, SponsershipFields {
178
178
  asset?: string;
179
179
  liquidity_pool_id?: string;
180
180
  }
181
- export type TrustlineSponsorshipCreated = Omit<TrustlineSponsorshipEvents, "new_sponsor" | "former_sponsor"> & {
181
+ export type TrustlineSponsorshipCreated = Omit<TrustlineSponsorshipEvents<'trustline_sponsorship_created'>, "new_sponsor" | "former_sponsor"> & {
182
182
  type_i: EffectType.trustline_sponsorship_created;
183
183
  };
184
- export type TrustlineSponsorshipUpdated = Omit<TrustlineSponsorshipEvents, "sponsor"> & {
184
+ export type TrustlineSponsorshipUpdated = Omit<TrustlineSponsorshipEvents<'trustline_sponsorship_updated'>, "sponsor"> & {
185
185
  type_i: EffectType.trustline_sponsorship_updated;
186
186
  };
187
- export type TrustlineSponsorshipRemoved = Omit<TrustlineSponsorshipEvents, "new_sponsor" | "sponsor"> & {
187
+ export type TrustlineSponsorshipRemoved = Omit<TrustlineSponsorshipEvents<'trustline_sponsorship_removed'>, "new_sponsor" | "sponsor"> & {
188
188
  type_i: EffectType.trustline_sponsorship_removed;
189
189
  };
190
- interface DataSponsorshipEvents extends BaseEffectRecord, SponsershipFields {
190
+ interface DataSponsorshipEvents<T extends string> extends BaseEffectRecord<T>, SponsershipFields {
191
191
  data_name: string;
192
192
  }
193
- export type DateSponsorshipCreated = Omit<DataSponsorshipEvents, "new_sponsor" | "former_sponsor"> & {
193
+ export type DateSponsorshipCreated = Omit<DataSponsorshipEvents<'data_sponsorship_created'>, "new_sponsor" | "former_sponsor"> & {
194
194
  type_i: EffectType.data_sponsorship_created;
195
195
  };
196
- export type DateSponsorshipUpdated = Omit<DataSponsorshipEvents, "sponsor"> & {
196
+ export type DateSponsorshipUpdated = Omit<DataSponsorshipEvents<'data_sponsorship_updated'>, "sponsor"> & {
197
197
  type_i: EffectType.data_sponsorship_updated;
198
198
  };
199
- export type DateSponsorshipRemoved = Omit<DataSponsorshipEvents, "new_sponsor" | "sponsor"> & {
199
+ export type DateSponsorshipRemoved = Omit<DataSponsorshipEvents<'data_sponsorship_removed'>, "new_sponsor" | "sponsor"> & {
200
200
  type_i: EffectType.data_sponsorship_removed;
201
201
  };
202
- interface ClaimableBalanceSponsorshipEvents extends BaseEffectRecord, SponsershipFields {
202
+ interface ClaimableBalanceSponsorshipEvents<T extends string> extends BaseEffectRecord<T>, SponsershipFields {
203
203
  balance_type_i: string;
204
204
  }
205
- export type ClaimableBalanceSponsorshipCreated = Omit<ClaimableBalanceSponsorshipEvents, "new_sponsor" | "former_sponsor"> & {
205
+ export type ClaimableBalanceSponsorshipCreated = Omit<ClaimableBalanceSponsorshipEvents<'claimable_balance_sponsorship_created'>, "new_sponsor" | "former_sponsor"> & {
206
206
  type_i: EffectType.claimable_balance_sponsorship_created;
207
207
  };
208
- export type ClaimableBalanceSponsorshipUpdated = Omit<ClaimableBalanceSponsorshipEvents, "sponsor"> & {
208
+ export type ClaimableBalanceSponsorshipUpdated = Omit<ClaimableBalanceSponsorshipEvents<'claimable_balance_sponsorship_updated'>, "sponsor"> & {
209
209
  type_i: EffectType.claimable_balance_sponsorship_updated;
210
210
  };
211
- export type ClaimableBalanceSponsorshipRemoved = Omit<ClaimableBalanceSponsorshipEvents, "new_sponsor" | "sponsor"> & {
211
+ export type ClaimableBalanceSponsorshipRemoved = Omit<ClaimableBalanceSponsorshipEvents<'claimable_balance_sponsorship_removed'>, "new_sponsor" | "sponsor"> & {
212
212
  type_i: EffectType.claimable_balance_sponsorship_removed;
213
213
  };
214
- interface SignerSponsorshipEvents extends BaseEffectRecord, SponsershipFields {
214
+ interface SignerSponsorshipEvents<T extends string> extends BaseEffectRecord<T>, SponsershipFields {
215
215
  signer: string;
216
216
  }
217
- export type SignerSponsorshipCreated = Omit<SignerSponsorshipEvents, "new_sponsor" | "former_sponsor"> & {
217
+ export type SignerSponsorshipCreated = Omit<SignerSponsorshipEvents<'signer_sponsorship_created'>, "new_sponsor" | "former_sponsor"> & {
218
218
  type_i: EffectType.signer_sponsorship_created;
219
219
  };
220
- export type SignerSponsorshipUpdated = Omit<SignerSponsorshipEvents, "sponsor"> & {
220
+ export type SignerSponsorshipUpdated = Omit<SignerSponsorshipEvents<'signer_sponsorship_updated'>, "sponsor"> & {
221
221
  type_i: EffectType.signer_sponsorship_updated;
222
222
  };
223
- export type SignerSponsorshipRemoved = Omit<SignerSponsorshipEvents, "new_sponsor" | "sponsor"> & {
223
+ export type SignerSponsorshipRemoved = Omit<SignerSponsorshipEvents<'signer_sponsorship_removed'>, "new_sponsor" | "sponsor"> & {
224
224
  type_i: EffectType.signer_sponsorship_removed;
225
225
  };
226
226
  export interface ClaimableBalanceClawedBack extends HorizonApi.BaseResponse {
@@ -234,33 +234,33 @@ export interface LiquidityPoolEffectRecord extends HorizonApi.BaseResponse {
234
234
  total_shares: string;
235
235
  reserves: HorizonApi.Reserve[];
236
236
  }
237
- export interface LiquidityPoolDeposited extends BaseEffectRecord {
237
+ export interface LiquidityPoolDeposited extends BaseEffectRecord<'liquidity_pool_deposited'> {
238
238
  type_i: EffectType.liquidity_pool_deposited;
239
239
  liquidity_pool: LiquidityPoolEffectRecord;
240
240
  reserves_deposited: HorizonApi.Reserve[];
241
241
  shares_received: string;
242
242
  }
243
- export interface LiquidityPoolWithdrew extends BaseEffectRecord {
243
+ export interface LiquidityPoolWithdrew extends BaseEffectRecord<'liquidity_pool_withdrew'> {
244
244
  type_i: EffectType.liquidity_pool_withdrew;
245
245
  liquidity_pool: LiquidityPoolEffectRecord;
246
246
  reserves_received: HorizonApi.Reserve[];
247
247
  shares_redeemed: string;
248
248
  }
249
- export interface LiquidityPoolTrade extends BaseEffectRecord {
249
+ export interface LiquidityPoolTrade extends BaseEffectRecord<'liquidity_pool_trade'> {
250
250
  type_i: EffectType.liquidity_pool_trade;
251
251
  liquidity_pool: LiquidityPoolEffectRecord;
252
252
  sold: HorizonApi.Reserve;
253
253
  bought: HorizonApi.Reserve;
254
254
  }
255
- export interface LiquidityPoolCreated extends BaseEffectRecord {
255
+ export interface LiquidityPoolCreated extends BaseEffectRecord<'liquidity_pool_created'> {
256
256
  type_i: EffectType.liquidity_pool_created;
257
257
  liquidity_pool: LiquidityPoolEffectRecord;
258
258
  }
259
- export interface LiquidityPoolRemoved extends BaseEffectRecord {
259
+ export interface LiquidityPoolRemoved extends BaseEffectRecord<'liquidity_pool_removed'> {
260
260
  type_i: EffectType.liquidity_pool_removed;
261
261
  liquidity_pool_id: string;
262
262
  }
263
- export interface LiquidityPoolRevoked extends BaseEffectRecord {
263
+ export interface LiquidityPoolRevoked extends BaseEffectRecord<'liquidity_pool_revoked'> {
264
264
  type_i: EffectType.liquidity_pool_revoked;
265
265
  liquidity_pool: LiquidityPoolEffectRecord;
266
266
  reserves_revoked: [
@@ -272,12 +272,12 @@ export interface LiquidityPoolRevoked extends BaseEffectRecord {
272
272
  ];
273
273
  shares_revoked: string;
274
274
  }
275
- export interface ContractCredited extends BaseEffectRecord, OfferAsset {
275
+ export interface ContractCredited extends BaseEffectRecord<'contract_credited'>, OfferAsset {
276
276
  type_i: EffectType.contract_credited;
277
277
  contract: string;
278
278
  amount: string;
279
279
  }
280
- export interface ContractDebited extends BaseEffectRecord, OfferAsset {
280
+ export interface ContractDebited extends BaseEffectRecord<'contract_debited'>, OfferAsset {
281
281
  type_i: EffectType.contract_debited;
282
282
  contract: string;
283
283
  amount: string;
@@ -1,5 +1,6 @@
1
- import { BaseEffectRecord } from "./effects";
2
- export interface Trade extends BaseEffectRecord {
1
+ import { BaseEffectRecord, EffectType } from "./effects";
2
+ export interface Trade extends BaseEffectRecord<'trade'> {
3
+ type_i: EffectType.trade;
3
4
  seller: string;
4
5
  offer_id: number | string;
5
6
  bought_amount: string;
@@ -27,6 +27,7 @@ export interface HttpClientRequestConfig<D = any> {
27
27
  headers?: HeadersInit;
28
28
  params?: Record<string, any>;
29
29
  maxContentLength?: number;
30
+ maxRedirects?: number;
30
31
  cancelToken?: CancelToken;
31
32
  adapter?: (config: HttpClientRequestConfig) => Promise<HttpClientResponse>;
32
33
  }
@@ -359,6 +359,56 @@ export declare class AssembledTransaction<T> {
359
359
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
360
360
  stackTraceLimit: number;
361
361
  };
362
+ SimulationFailed: {
363
+ new (message?: string): {
364
+ name: string;
365
+ message: string;
366
+ stack?: string;
367
+ };
368
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
369
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
370
+ stackTraceLimit: number;
371
+ };
372
+ InternalWalletError: {
373
+ new (message?: string): {
374
+ name: string;
375
+ message: string;
376
+ stack?: string;
377
+ };
378
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
379
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
380
+ stackTraceLimit: number;
381
+ };
382
+ ExternalServiceError: {
383
+ new (message?: string): {
384
+ name: string;
385
+ message: string;
386
+ stack?: string;
387
+ };
388
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
389
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
390
+ stackTraceLimit: number;
391
+ };
392
+ InvalidClientRequest: {
393
+ new (message?: string): {
394
+ name: string;
395
+ message: string;
396
+ stack?: string;
397
+ };
398
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
399
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
400
+ stackTraceLimit: number;
401
+ };
402
+ UserRejected: {
403
+ new (message?: string): {
404
+ name: string;
405
+ message: string;
406
+ stack?: string;
407
+ };
408
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
409
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
410
+ stackTraceLimit: number;
411
+ };
362
412
  };
363
413
  /**
364
414
  * Serialize the AssembledTransaction to a JSON string. This is useful for
@@ -383,10 +433,11 @@ export declare class AssembledTransaction<T> {
383
433
  * Deserialize the AssembledTransaction from a base64-encoded XDR string.
384
434
  */
385
435
  static fromXDR<T>(options: Omit<AssembledTransactionOptions<T>, "args" | "method" | "parseResultXdr">, encodedXDR: string, spec: Spec): AssembledTransaction<T>;
436
+ private handleWalletError;
386
437
  private constructor();
387
438
  /**
388
- * Construct a new AssembledTransaction. This is the only way to create a new
389
- * AssembledTransaction; the main constructor is private.
439
+ * Construct a new AssembledTransaction. This is the main way to create a new
440
+ * AssembledTransaction; the constructor is private.
390
441
  *
391
442
  * This is an asynchronous constructor for two reasons:
392
443
  *
@@ -397,6 +448,9 @@ export declare class AssembledTransaction<T> {
397
448
  * If you don't want to simulate the transaction, you can set `simulate` to
398
449
  * `false` in the options.
399
450
  *
451
+ * If you need to create an operation other than `invokeHostFunction`, you
452
+ * can use {@link AssembledTransaction.buildWithOp} instead.
453
+ *
400
454
  * @example
401
455
  * const tx = await AssembledTransaction.build({
402
456
  * ...,
@@ -404,6 +458,24 @@ export declare class AssembledTransaction<T> {
404
458
  * })
405
459
  */
406
460
  static build<T>(options: AssembledTransactionOptions<T>): Promise<AssembledTransaction<T>>;
461
+ /**
462
+ * Construct a new AssembledTransaction, specifying an Operation other than
463
+ * `invokeHostFunction` (the default used by {@link AssembledTransaction.build}).
464
+ *
465
+ * Note: `AssembledTransaction` currently assumes these operations can be
466
+ * simulated. This is not true for classic operations; only for those used by
467
+ * Soroban Smart Contracts like `invokeHostFunction` and `createCustomContract`.
468
+ *
469
+ * @example
470
+ * const tx = await AssembledTransaction.buildWithOp(
471
+ * Operation.createCustomContract({ ... });
472
+ * {
473
+ * ...,
474
+ * simulate: false,
475
+ * }
476
+ * )
477
+ */
478
+ static buildWithOp<T>(operation: xdr.Operation, options: AssembledTransactionOptions<T>): Promise<AssembledTransaction<T>>;
407
479
  private static buildFootprintRestoreTransaction;
408
480
  simulate: ({ restore }?: {
409
481
  restore?: boolean;
@@ -511,7 +583,7 @@ export declare class AssembledTransaction<T> {
511
583
  * If you have a pro use-case and need to override the default `authorizeEntry` function, rather than using the one in @stellar/stellar-base, you can do that! Your function needs to take at least the first argument, `entry: xdr.SorobanAuthorizationEntry`, and return a `Promise<xdr.SorobanAuthorizationEntry>`.
512
584
  *
513
585
  * Note that you if you pass this, then `signAuthEntry` will be ignored.
514
- */
586
+ */
515
587
  authorizeEntry?: typeof stellarBaseAuthorizeEntry;
516
588
  }) => Promise<void>;
517
589
  /**
@@ -132,7 +132,10 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
132
132
  signTransaction,
133
133
  sigsNeeded,
134
134
  timeoutInSeconds,
135
+ signOpts,
136
+ _yield$signTransactio,
135
137
  signature,
138
+ error,
136
139
  _args2 = arguments;
137
140
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
138
141
  while (1) switch (_context2.prev = _context2.next) {
@@ -171,14 +174,21 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
171
174
  timebounds: undefined,
172
175
  sorobanData: _this.simulationData.transactionData
173
176
  }).setTimeout(timeoutInSeconds).build();
174
- _context2.next = 14;
175
- return signTransaction(_this.built.toXDR(), {
177
+ signOpts = {
176
178
  networkPassphrase: _this.options.networkPassphrase
177
- });
178
- case 14:
179
- signature = _context2.sent;
179
+ };
180
+ if (_this.options.address) signOpts.address = _this.options.address;
181
+ if (_this.options.submit !== undefined) signOpts.submit = _this.options.submit;
182
+ if (_this.options.submitUrl) signOpts.submitUrl = _this.options.submitUrl;
183
+ _context2.next = 18;
184
+ return signTransaction(_this.built.toXDR(), signOpts);
185
+ case 18:
186
+ _yield$signTransactio = _context2.sent;
187
+ signature = _yield$signTransactio.signedTxXdr;
188
+ error = _yield$signTransactio.error;
189
+ _this.handleWalletError(error);
180
190
  _this.signed = _stellarBase.TransactionBuilder.fromXDR(signature, _this.options.networkPassphrase);
181
- case 16:
191
+ case 23:
182
192
  case "end":
183
193
  return _context2.stop();
184
194
  }
@@ -190,27 +200,37 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
190
200
  force,
191
201
  _ref6$signTransaction,
192
202
  signTransaction,
203
+ originalSubmit,
193
204
  _args3 = arguments;
194
205
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
195
206
  while (1) switch (_context3.prev = _context3.next) {
196
207
  case 0:
197
208
  _ref6 = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {}, _ref6$force = _ref6.force, force = _ref6$force === void 0 ? false : _ref6$force, _ref6$signTransaction = _ref6.signTransaction, signTransaction = _ref6$signTransaction === void 0 ? _this.options.signTransaction : _ref6$signTransaction;
198
209
  if (_this.signed) {
199
- _context3.next = 4;
210
+ _context3.next = 10;
200
211
  break;
201
212
  }
202
- _context3.next = 4;
213
+ originalSubmit = _this.options.submit;
214
+ if (_this.options.submit) {
215
+ _this.options.submit = false;
216
+ }
217
+ _context3.prev = 4;
218
+ _context3.next = 7;
203
219
  return _this.sign({
204
220
  force: force,
205
221
  signTransaction: signTransaction
206
222
  });
207
- case 4:
223
+ case 7:
224
+ _context3.prev = 7;
225
+ _this.options.submit = originalSubmit;
226
+ return _context3.finish(7);
227
+ case 10:
208
228
  return _context3.abrupt("return", _this.send());
209
- case 5:
229
+ case 11:
210
230
  case "end":
211
231
  return _context3.stop();
212
232
  }
213
- }, _callee3);
233
+ }, _callee3, null, [[4,, 7, 10]]);
214
234
  })));
215
235
  _defineProperty(this, "needsNonInvokerSigningBy", function () {
216
236
  var _rawInvokeHostFunctio;
@@ -325,18 +345,21 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
325
345
  _context6.t1 = entry;
326
346
  _context6.t2 = function () {
327
347
  var _ref11 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee5(preimage) {
348
+ var _yield$sign, signedAuthEntry, error;
328
349
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
329
350
  while (1) switch (_context5.prev = _context5.next) {
330
351
  case 0:
331
- _context5.t0 = Buffer;
332
- _context5.next = 3;
352
+ _context5.next = 2;
333
353
  return sign(preimage.toXDR("base64"), {
334
- accountToSign: address
354
+ address: address
335
355
  });
336
- case 3:
337
- _context5.t1 = _context5.sent;
338
- return _context5.abrupt("return", _context5.t0.from.call(_context5.t0, _context5.t1, "base64"));
339
- case 5:
356
+ case 2:
357
+ _yield$sign = _context5.sent;
358
+ signedAuthEntry = _yield$sign.signedAuthEntry;
359
+ error = _yield$sign.error;
360
+ _this.handleWalletError(error);
361
+ return _context5.abrupt("return", Buffer.from(signedAuthEntry, "base64"));
362
+ case 7:
340
363
  case "end":
341
364
  return _context5.stop();
342
365
  }
@@ -424,6 +447,26 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
424
447
  if (!this.built) throw new Error("Transaction has not yet been simulated; " + "call `AssembledTransaction.simulate` first.");
425
448
  return (_this$built2 = this.built) === null || _this$built2 === void 0 ? void 0 : _this$built2.toEnvelope().toXDR('base64');
426
449
  }
450
+ }, {
451
+ key: "handleWalletError",
452
+ value: function handleWalletError(error) {
453
+ if (!error) return;
454
+ var message = error.message,
455
+ code = error.code;
456
+ var fullMessage = "".concat(message).concat(error.ext ? " (".concat(error.ext.join(', '), ")") : '');
457
+ switch (code) {
458
+ case -1:
459
+ throw new AssembledTransaction.Errors.InternalWalletError(fullMessage);
460
+ case -2:
461
+ throw new AssembledTransaction.Errors.ExternalServiceError(fullMessage);
462
+ case -3:
463
+ throw new AssembledTransaction.Errors.InvalidClientRequest(fullMessage);
464
+ case -4:
465
+ throw new AssembledTransaction.Errors.UserRejected(fullMessage);
466
+ default:
467
+ throw new Error("Unhandled error: ".concat(fullMessage));
468
+ }
469
+ }
427
470
  }, {
428
471
  key: "simulationData",
429
472
  get: function get() {
@@ -439,7 +482,7 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
439
482
  throw new AssembledTransaction.Errors.NotYetSimulated("Transaction has not yet been simulated");
440
483
  }
441
484
  if (_api.Api.isSimulationError(simulation)) {
442
- throw new Error("Transaction simulation failed: \"".concat(simulation.error, "\""));
485
+ throw new AssembledTransaction.Errors.SimulationFailed("Transaction simulation failed: \"".concat(simulation.error, "\""));
443
486
  }
444
487
  if (_api.Api.isSimulationRestore(simulation)) {
445
488
  throw new AssembledTransaction.Errors.ExpiredState("You need to restore some contract state before you can invoke this method.\n" + 'You can set `restore` to true in the method options in order to ' + 'automatically restore the contract state when needed.');
@@ -615,41 +658,47 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
615
658
  }
616
659
  }, {
617
660
  key: "build",
661
+ value: function build(options) {
662
+ var _options$args;
663
+ var contract = new _stellarBase.Contract(options.contractId);
664
+ return AssembledTransaction.buildWithOp(contract.call.apply(contract, [options.method].concat(_toConsumableArray((_options$args = options.args) !== null && _options$args !== void 0 ? _options$args : []))), options);
665
+ }
666
+ }, {
667
+ key: "buildWithOp",
618
668
  value: (function () {
619
- var _build = _asyncToGenerator(_regeneratorRuntime().mark(function _callee9(options) {
620
- var _options$fee, _options$args, _options$timeoutInSec;
621
- var tx, contract, account;
669
+ var _buildWithOp = _asyncToGenerator(_regeneratorRuntime().mark(function _callee9(operation, options) {
670
+ var _options$fee, _options$timeoutInSec;
671
+ var tx, account;
622
672
  return _regeneratorRuntime().wrap(function _callee9$(_context10) {
623
673
  while (1) switch (_context10.prev = _context10.next) {
624
674
  case 0:
625
675
  tx = new AssembledTransaction(options);
626
- contract = new _stellarBase.Contract(options.contractId);
627
- _context10.next = 4;
676
+ _context10.next = 3;
628
677
  return (0, _utils.getAccount)(options, tx.server);
629
- case 4:
678
+ case 3:
630
679
  account = _context10.sent;
631
680
  tx.raw = new _stellarBase.TransactionBuilder(account, {
632
681
  fee: (_options$fee = options.fee) !== null && _options$fee !== void 0 ? _options$fee : _stellarBase.BASE_FEE,
633
682
  networkPassphrase: options.networkPassphrase
634
- }).addOperation(contract.call.apply(contract, [options.method].concat(_toConsumableArray((_options$args = options.args) !== null && _options$args !== void 0 ? _options$args : [])))).setTimeout((_options$timeoutInSec = options.timeoutInSeconds) !== null && _options$timeoutInSec !== void 0 ? _options$timeoutInSec : _types.DEFAULT_TIMEOUT);
683
+ }).setTimeout((_options$timeoutInSec = options.timeoutInSeconds) !== null && _options$timeoutInSec !== void 0 ? _options$timeoutInSec : _types.DEFAULT_TIMEOUT).addOperation(operation);
635
684
  if (!options.simulate) {
636
- _context10.next = 9;
685
+ _context10.next = 8;
637
686
  break;
638
687
  }
639
- _context10.next = 9;
688
+ _context10.next = 8;
640
689
  return tx.simulate();
641
- case 9:
690
+ case 8:
642
691
  return _context10.abrupt("return", tx);
643
- case 10:
692
+ case 9:
644
693
  case "end":
645
694
  return _context10.stop();
646
695
  }
647
696
  }, _callee9);
648
697
  }));
649
- function build(_x4) {
650
- return _build.apply(this, arguments);
698
+ function buildWithOp(_x4, _x5) {
699
+ return _buildWithOp.apply(this, arguments);
651
700
  }
652
- return build;
701
+ return buildWithOp;
653
702
  }())
654
703
  }, {
655
704
  key: "buildFootprintRestoreTransaction",
@@ -677,7 +726,7 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
677
726
  }
678
727
  }, _callee10);
679
728
  }));
680
- function buildFootprintRestoreTransaction(_x5, _x6, _x7, _x8) {
729
+ function buildFootprintRestoreTransaction(_x6, _x7, _x8, _x9) {
681
730
  return _buildFootprintRestoreTransaction.apply(this, arguments);
682
731
  }
683
732
  return buildFootprintRestoreTransaction;
@@ -748,5 +797,45 @@ _defineProperty(AssembledTransaction, "Errors", {
748
797
  }
749
798
  _inherits(FakeAccountError, _Error8);
750
799
  return _createClass(FakeAccountError);
800
+ }(_wrapNativeSuper(Error)),
801
+ SimulationFailed: function (_Error9) {
802
+ function SimulationFailedError() {
803
+ _classCallCheck(this, SimulationFailedError);
804
+ return _callSuper(this, SimulationFailedError, arguments);
805
+ }
806
+ _inherits(SimulationFailedError, _Error9);
807
+ return _createClass(SimulationFailedError);
808
+ }(_wrapNativeSuper(Error)),
809
+ InternalWalletError: function (_Error10) {
810
+ function InternalWalletError() {
811
+ _classCallCheck(this, InternalWalletError);
812
+ return _callSuper(this, InternalWalletError, arguments);
813
+ }
814
+ _inherits(InternalWalletError, _Error10);
815
+ return _createClass(InternalWalletError);
816
+ }(_wrapNativeSuper(Error)),
817
+ ExternalServiceError: function (_Error11) {
818
+ function ExternalServiceError() {
819
+ _classCallCheck(this, ExternalServiceError);
820
+ return _callSuper(this, ExternalServiceError, arguments);
821
+ }
822
+ _inherits(ExternalServiceError, _Error11);
823
+ return _createClass(ExternalServiceError);
824
+ }(_wrapNativeSuper(Error)),
825
+ InvalidClientRequest: function (_Error12) {
826
+ function InvalidClientRequestError() {
827
+ _classCallCheck(this, InvalidClientRequestError);
828
+ return _callSuper(this, InvalidClientRequestError, arguments);
829
+ }
830
+ _inherits(InvalidClientRequestError, _Error12);
831
+ return _createClass(InvalidClientRequestError);
832
+ }(_wrapNativeSuper(Error)),
833
+ UserRejected: function (_Error13) {
834
+ function UserRejectedError() {
835
+ _classCallCheck(this, UserRejectedError);
836
+ return _callSuper(this, UserRejectedError, arguments);
837
+ }
838
+ _inherits(UserRejectedError, _Error13);
839
+ return _createClass(UserRejectedError);
751
840
  }(_wrapNativeSuper(Error))
752
841
  });