@stellar/stellar-sdk 11.0.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/CHANGELOG.md +1275 -0
- package/LICENSE +228 -0
- package/README.md +274 -0
- package/dist/stellar-sdk.js +56470 -0
- package/dist/stellar-sdk.min.js +2 -0
- package/dist/stellar-sdk.min.js.LICENSE.txt +71 -0
- package/lib/browser.d.ts +6 -0
- package/lib/browser.js +37 -0
- package/lib/config.d.ts +52 -0
- package/lib/config.js +49 -0
- package/lib/contract_spec.d.ts +130 -0
- package/lib/contract_spec.js +549 -0
- package/lib/errors.d.ts +59 -0
- package/lib/errors.js +105 -0
- package/lib/federation/api.d.ts +11 -0
- package/lib/federation/api.js +7 -0
- package/lib/federation/index.d.ts +2 -0
- package/lib/federation/index.js +24 -0
- package/lib/federation/server.d.ts +118 -0
- package/lib/federation/server.js +253 -0
- package/lib/friendbot/index.d.ts +5 -0
- package/lib/friendbot/index.js +7 -0
- package/lib/horizon/account_call_builder.d.ts +55 -0
- package/lib/horizon/account_call_builder.js +64 -0
- package/lib/horizon/account_response.d.ts +58 -0
- package/lib/horizon/account_response.js +50 -0
- package/lib/horizon/assets_call_builder.d.ts +27 -0
- package/lib/horizon/assets_call_builder.js +45 -0
- package/lib/horizon/call_builder.d.ts +128 -0
- package/lib/horizon/call_builder.js +360 -0
- package/lib/horizon/claimable_balances_call_builder.d.ts +49 -0
- package/lib/horizon/claimable_balances_call_builder.js +58 -0
- package/lib/horizon/effect_call_builder.d.ts +53 -0
- package/lib/horizon/effect_call_builder.js +58 -0
- package/lib/horizon/friendbot_builder.d.ts +5 -0
- package/lib/horizon/friendbot_builder.js +33 -0
- package/lib/horizon/horizon_api.d.ts +523 -0
- package/lib/horizon/horizon_api.js +96 -0
- package/lib/horizon/horizon_axios_client.d.ts +30 -0
- package/lib/horizon/horizon_axios_client.js +48 -0
- package/lib/horizon/index.d.ts +7 -0
- package/lib/horizon/index.js +78 -0
- package/lib/horizon/ledger_call_builder.d.ts +22 -0
- package/lib/horizon/ledger_call_builder.js +39 -0
- package/lib/horizon/liquidity_pool_call_builder.d.ts +38 -0
- package/lib/horizon/liquidity_pool_call_builder.js +61 -0
- package/lib/horizon/offer_call_builder.d.ts +64 -0
- package/lib/horizon/offer_call_builder.js +81 -0
- package/lib/horizon/operation_call_builder.d.ts +68 -0
- package/lib/horizon/operation_call_builder.js +71 -0
- package/lib/horizon/orderbook_call_builder.d.ts +16 -0
- package/lib/horizon/orderbook_call_builder.js +46 -0
- package/lib/horizon/path_call_builder.d.ts +31 -0
- package/lib/horizon/path_call_builder.js +42 -0
- package/lib/horizon/payment_call_builder.d.ts +36 -0
- package/lib/horizon/payment_call_builder.js +48 -0
- package/lib/horizon/server.d.ts +361 -0
- package/lib/horizon/server.js +507 -0
- package/lib/horizon/server_api.d.ts +279 -0
- package/lib/horizon/server_api.js +19 -0
- package/lib/horizon/strict_receive_path_call_builder.d.ts +34 -0
- package/lib/horizon/strict_receive_path_call_builder.js +51 -0
- package/lib/horizon/strict_send_path_call_builder.d.ts +34 -0
- package/lib/horizon/strict_send_path_call_builder.js +51 -0
- package/lib/horizon/trade_aggregation_call_builder.d.ts +48 -0
- package/lib/horizon/trade_aggregation_call_builder.js +82 -0
- package/lib/horizon/trades_call_builder.d.ts +50 -0
- package/lib/horizon/trades_call_builder.js +74 -0
- package/lib/horizon/transaction_call_builder.d.ts +58 -0
- package/lib/horizon/transaction_call_builder.js +66 -0
- package/lib/horizon/types/account.d.ts +5 -0
- package/lib/horizon/types/account.js +5 -0
- package/lib/horizon/types/assets.d.ts +19 -0
- package/lib/horizon/types/assets.js +5 -0
- package/lib/horizon/types/effects.d.ts +285 -0
- package/lib/horizon/types/effects.js +62 -0
- package/lib/horizon/types/offer.d.ts +20 -0
- package/lib/horizon/types/offer.js +5 -0
- package/lib/horizon/types/trade.d.ts +13 -0
- package/lib/horizon/types/trade.js +5 -0
- package/lib/index.d.ts +14 -0
- package/lib/index.js +79 -0
- package/lib/soroban/api.d.ts +247 -0
- package/lib/soroban/api.js +32 -0
- package/lib/soroban/axios.d.ts +3 -0
- package/lib/soroban/axios.js +16 -0
- package/lib/soroban/browser.d.ts +6 -0
- package/lib/soroban/browser.js +37 -0
- package/lib/soroban/index.d.ts +8 -0
- package/lib/soroban/index.js +72 -0
- package/lib/soroban/jsonrpc.d.ts +33 -0
- package/lib/soroban/jsonrpc.js +93 -0
- package/lib/soroban/parsers.d.ts +17 -0
- package/lib/soroban/parsers.js +111 -0
- package/lib/soroban/server.d.ts +427 -0
- package/lib/soroban/server.js +598 -0
- package/lib/soroban/transaction.d.ts +20 -0
- package/lib/soroban/transaction.js +55 -0
- package/lib/soroban/utils.d.ts +1 -0
- package/lib/soroban/utils.js +9 -0
- package/lib/stellartoml/index.d.ts +121 -0
- package/lib/stellartoml/index.js +78 -0
- package/lib/utils.d.ts +12 -0
- package/lib/utils.js +32 -0
- package/lib/webauth/errors.d.ts +4 -0
- package/lib/webauth/errors.js +37 -0
- package/lib/webauth/index.d.ts +2 -0
- package/lib/webauth/index.js +27 -0
- package/lib/webauth/utils.d.ts +294 -0
- package/lib/webauth/utils.js +332 -0
- package/package.json +153 -0
- package/types/dom-monkeypatch.d.ts +126 -0
|
@@ -0,0 +1,523 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { AssetType, MemoType } from "@stellar/stellar-base";
|
|
3
|
+
export declare namespace HorizonApi {
|
|
4
|
+
interface ResponseLink {
|
|
5
|
+
href: string;
|
|
6
|
+
templated?: boolean;
|
|
7
|
+
}
|
|
8
|
+
interface BaseResponse<T extends string = never> {
|
|
9
|
+
_links: {
|
|
10
|
+
[key in T | "self"]: ResponseLink;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
interface SubmitTransactionResponse {
|
|
14
|
+
hash: string;
|
|
15
|
+
ledger: number;
|
|
16
|
+
successful: boolean;
|
|
17
|
+
envelope_xdr: string;
|
|
18
|
+
result_xdr: string;
|
|
19
|
+
result_meta_xdr: string;
|
|
20
|
+
paging_token: string;
|
|
21
|
+
}
|
|
22
|
+
interface FeeBumpTransactionResponse {
|
|
23
|
+
hash: string;
|
|
24
|
+
signatures: string[];
|
|
25
|
+
}
|
|
26
|
+
interface InnerTransactionResponse {
|
|
27
|
+
hash: string;
|
|
28
|
+
signatures: string[];
|
|
29
|
+
max_fee: string;
|
|
30
|
+
}
|
|
31
|
+
interface TransactionPreconditions {
|
|
32
|
+
timebounds?: {
|
|
33
|
+
min_time: string;
|
|
34
|
+
max_time: string;
|
|
35
|
+
};
|
|
36
|
+
ledgerbounds?: {
|
|
37
|
+
min_ledger: number;
|
|
38
|
+
max_ledger: number;
|
|
39
|
+
};
|
|
40
|
+
min_account_sequence?: string;
|
|
41
|
+
min_account_sequence_age?: string;
|
|
42
|
+
min_account_sequence_ledger_gap?: number;
|
|
43
|
+
extra_signers?: string[];
|
|
44
|
+
}
|
|
45
|
+
interface TransactionResponse extends SubmitTransactionResponse, BaseResponse<"account" | "ledger" | "operations" | "effects" | "succeeds" | "precedes"> {
|
|
46
|
+
created_at: string;
|
|
47
|
+
fee_meta_xdr: string;
|
|
48
|
+
fee_charged: number | string;
|
|
49
|
+
max_fee: number | string;
|
|
50
|
+
id: string;
|
|
51
|
+
memo_type: MemoType;
|
|
52
|
+
memo?: string;
|
|
53
|
+
memo_bytes?: string;
|
|
54
|
+
operation_count: number;
|
|
55
|
+
paging_token: string;
|
|
56
|
+
signatures: string[];
|
|
57
|
+
source_account: string;
|
|
58
|
+
source_account_sequence: string;
|
|
59
|
+
fee_account: string;
|
|
60
|
+
inner_transaction?: InnerTransactionResponse;
|
|
61
|
+
fee_bump_transaction?: FeeBumpTransactionResponse;
|
|
62
|
+
preconditions?: TransactionPreconditions;
|
|
63
|
+
}
|
|
64
|
+
interface BalanceLineNative {
|
|
65
|
+
balance: string;
|
|
66
|
+
asset_type: AssetType.native;
|
|
67
|
+
buying_liabilities: string;
|
|
68
|
+
selling_liabilities: string;
|
|
69
|
+
}
|
|
70
|
+
interface BalanceLineLiquidityPool {
|
|
71
|
+
liquidity_pool_id: string;
|
|
72
|
+
asset_type: AssetType.liquidityPoolShares;
|
|
73
|
+
balance: string;
|
|
74
|
+
limit: string;
|
|
75
|
+
last_modified_ledger: number;
|
|
76
|
+
is_authorized: boolean;
|
|
77
|
+
is_authorized_to_maintain_liabilities: boolean;
|
|
78
|
+
is_clawback_enabled: boolean;
|
|
79
|
+
sponsor?: string;
|
|
80
|
+
}
|
|
81
|
+
interface BalanceLineAsset<T extends AssetType.credit4 | AssetType.credit12 = AssetType.credit4 | AssetType.credit12> {
|
|
82
|
+
balance: string;
|
|
83
|
+
limit: string;
|
|
84
|
+
asset_type: T;
|
|
85
|
+
asset_code: string;
|
|
86
|
+
asset_issuer: string;
|
|
87
|
+
buying_liabilities: string;
|
|
88
|
+
selling_liabilities: string;
|
|
89
|
+
last_modified_ledger: number;
|
|
90
|
+
is_authorized: boolean;
|
|
91
|
+
is_authorized_to_maintain_liabilities: boolean;
|
|
92
|
+
is_clawback_enabled: boolean;
|
|
93
|
+
sponsor?: string;
|
|
94
|
+
}
|
|
95
|
+
type BalanceLine<T extends AssetType = AssetType> = T extends AssetType.native ? BalanceLineNative : T extends AssetType.credit4 | AssetType.credit12 ? BalanceLineAsset<T> : T extends AssetType.liquidityPoolShares ? BalanceLineLiquidityPool : BalanceLineNative | BalanceLineAsset | BalanceLineLiquidityPool;
|
|
96
|
+
interface AssetAccounts {
|
|
97
|
+
authorized: number;
|
|
98
|
+
authorized_to_maintain_liabilities: number;
|
|
99
|
+
unauthorized: number;
|
|
100
|
+
}
|
|
101
|
+
interface AssetBalances {
|
|
102
|
+
authorized: string;
|
|
103
|
+
authorized_to_maintain_liabilities: string;
|
|
104
|
+
unauthorized: string;
|
|
105
|
+
}
|
|
106
|
+
interface PriceR {
|
|
107
|
+
numerator: number;
|
|
108
|
+
denominator: number;
|
|
109
|
+
}
|
|
110
|
+
interface PriceRShorthand {
|
|
111
|
+
n: number;
|
|
112
|
+
d: number;
|
|
113
|
+
}
|
|
114
|
+
interface AccountThresholds {
|
|
115
|
+
low_threshold: number;
|
|
116
|
+
med_threshold: number;
|
|
117
|
+
high_threshold: number;
|
|
118
|
+
}
|
|
119
|
+
interface Flags {
|
|
120
|
+
auth_immutable: boolean;
|
|
121
|
+
auth_required: boolean;
|
|
122
|
+
auth_revocable: boolean;
|
|
123
|
+
auth_clawback_enabled: boolean;
|
|
124
|
+
}
|
|
125
|
+
interface AccountSigner {
|
|
126
|
+
key: string;
|
|
127
|
+
weight: number;
|
|
128
|
+
type: string;
|
|
129
|
+
sponsor?: string;
|
|
130
|
+
}
|
|
131
|
+
interface AccountResponse extends BaseResponse<"transactions" | "operations" | "payments" | "effects" | "offers" | "trades" | "data"> {
|
|
132
|
+
id: string;
|
|
133
|
+
paging_token: string;
|
|
134
|
+
account_id: string;
|
|
135
|
+
sequence: string;
|
|
136
|
+
sequence_ledger?: number;
|
|
137
|
+
sequence_time?: string;
|
|
138
|
+
subentry_count: number;
|
|
139
|
+
thresholds: AccountThresholds;
|
|
140
|
+
last_modified_ledger: number;
|
|
141
|
+
last_modified_time: string;
|
|
142
|
+
flags: Flags;
|
|
143
|
+
balances: BalanceLine[];
|
|
144
|
+
signers: AccountSigner[];
|
|
145
|
+
data: {
|
|
146
|
+
[key: string]: string;
|
|
147
|
+
};
|
|
148
|
+
sponsor?: string;
|
|
149
|
+
num_sponsoring: number;
|
|
150
|
+
num_sponsored: number;
|
|
151
|
+
}
|
|
152
|
+
enum LiquidityPoolType {
|
|
153
|
+
constantProduct = "constant_product"
|
|
154
|
+
}
|
|
155
|
+
enum OperationResponseType {
|
|
156
|
+
createAccount = "create_account",
|
|
157
|
+
payment = "payment",
|
|
158
|
+
pathPayment = "path_payment_strict_receive",
|
|
159
|
+
createPassiveOffer = "create_passive_sell_offer",
|
|
160
|
+
manageOffer = "manage_sell_offer",
|
|
161
|
+
setOptions = "set_options",
|
|
162
|
+
changeTrust = "change_trust",
|
|
163
|
+
allowTrust = "allow_trust",
|
|
164
|
+
accountMerge = "account_merge",
|
|
165
|
+
inflation = "inflation",
|
|
166
|
+
manageData = "manage_data",
|
|
167
|
+
bumpSequence = "bump_sequence",
|
|
168
|
+
manageBuyOffer = "manage_buy_offer",
|
|
169
|
+
pathPaymentStrictSend = "path_payment_strict_send",
|
|
170
|
+
createClaimableBalance = "create_claimable_balance",
|
|
171
|
+
claimClaimableBalance = "claim_claimable_balance",
|
|
172
|
+
beginSponsoringFutureReserves = "begin_sponsoring_future_reserves",
|
|
173
|
+
endSponsoringFutureReserves = "end_sponsoring_future_reserves",
|
|
174
|
+
revokeSponsorship = "revoke_sponsorship",
|
|
175
|
+
clawback = "clawback",
|
|
176
|
+
clawbackClaimableBalance = "clawback_claimable_balance",
|
|
177
|
+
setTrustLineFlags = "set_trust_line_flags",
|
|
178
|
+
liquidityPoolDeposit = "liquidity_pool_deposit",
|
|
179
|
+
liquidityPoolWithdraw = "liquidity_pool_withdraw",
|
|
180
|
+
invokeHostFunction = "invoke_host_function",
|
|
181
|
+
bumpFootprintExpiration = "bump_footprint_expiration",
|
|
182
|
+
restoreFootprint = "restore_footprint"
|
|
183
|
+
}
|
|
184
|
+
enum OperationResponseTypeI {
|
|
185
|
+
createAccount = 0,
|
|
186
|
+
payment = 1,
|
|
187
|
+
pathPayment = 2,
|
|
188
|
+
createPassiveOffer = 3,
|
|
189
|
+
manageOffer = 4,
|
|
190
|
+
setOptions = 5,
|
|
191
|
+
changeTrust = 6,
|
|
192
|
+
allowTrust = 7,
|
|
193
|
+
accountMerge = 8,
|
|
194
|
+
inflation = 9,
|
|
195
|
+
manageData = 10,
|
|
196
|
+
bumpSequence = 11,
|
|
197
|
+
manageBuyOffer = 12,
|
|
198
|
+
pathPaymentStrictSend = 13,
|
|
199
|
+
createClaimableBalance = 14,
|
|
200
|
+
claimClaimableBalance = 15,
|
|
201
|
+
beginSponsoringFutureReserves = 16,
|
|
202
|
+
endSponsoringFutureReserves = 17,
|
|
203
|
+
revokeSponsorship = 18,
|
|
204
|
+
clawback = 19,
|
|
205
|
+
clawbackClaimableBalance = 20,
|
|
206
|
+
setTrustLineFlags = 21,
|
|
207
|
+
liquidityPoolDeposit = 22,
|
|
208
|
+
liquidityPoolWithdraw = 23,
|
|
209
|
+
invokeHostFunction = 24,
|
|
210
|
+
bumpFootprintExpiration = 25,
|
|
211
|
+
restoreFootprint = 26
|
|
212
|
+
}
|
|
213
|
+
interface BaseOperationResponse<T extends OperationResponseType = OperationResponseType, TI extends OperationResponseTypeI = OperationResponseTypeI> extends BaseResponse<"succeeds" | "precedes" | "effects" | "transaction"> {
|
|
214
|
+
id: string;
|
|
215
|
+
paging_token: string;
|
|
216
|
+
source_account: string;
|
|
217
|
+
type: T;
|
|
218
|
+
type_i: TI;
|
|
219
|
+
created_at: string;
|
|
220
|
+
transaction_hash: string;
|
|
221
|
+
transaction_successful: boolean;
|
|
222
|
+
}
|
|
223
|
+
interface CreateAccountOperationResponse extends BaseOperationResponse<OperationResponseType.createAccount, OperationResponseTypeI.createAccount> {
|
|
224
|
+
account: string;
|
|
225
|
+
funder: string;
|
|
226
|
+
starting_balance: string;
|
|
227
|
+
}
|
|
228
|
+
interface PaymentOperationResponse extends BaseOperationResponse<OperationResponseType.payment, OperationResponseTypeI.payment> {
|
|
229
|
+
from: string;
|
|
230
|
+
to: string;
|
|
231
|
+
asset_type: AssetType;
|
|
232
|
+
asset_code?: string;
|
|
233
|
+
asset_issuer?: string;
|
|
234
|
+
amount: string;
|
|
235
|
+
}
|
|
236
|
+
interface PathPaymentOperationResponse extends BaseOperationResponse<OperationResponseType.pathPayment, OperationResponseTypeI.pathPayment> {
|
|
237
|
+
amount: string;
|
|
238
|
+
asset_code?: string;
|
|
239
|
+
asset_issuer?: string;
|
|
240
|
+
asset_type: AssetType;
|
|
241
|
+
from: string;
|
|
242
|
+
path: Array<{
|
|
243
|
+
asset_code: string;
|
|
244
|
+
asset_issuer: string;
|
|
245
|
+
asset_type: AssetType;
|
|
246
|
+
}>;
|
|
247
|
+
source_amount: string;
|
|
248
|
+
source_asset_code?: string;
|
|
249
|
+
source_asset_issuer?: string;
|
|
250
|
+
source_asset_type: AssetType;
|
|
251
|
+
source_max: string;
|
|
252
|
+
to: string;
|
|
253
|
+
}
|
|
254
|
+
interface PathPaymentStrictSendOperationResponse extends BaseOperationResponse<OperationResponseType.pathPaymentStrictSend, OperationResponseTypeI.pathPaymentStrictSend> {
|
|
255
|
+
amount: string;
|
|
256
|
+
asset_code?: string;
|
|
257
|
+
asset_issuer?: string;
|
|
258
|
+
asset_type: AssetType;
|
|
259
|
+
destination_min: string;
|
|
260
|
+
from: string;
|
|
261
|
+
path: Array<{
|
|
262
|
+
asset_code: string;
|
|
263
|
+
asset_issuer: string;
|
|
264
|
+
asset_type: AssetType;
|
|
265
|
+
}>;
|
|
266
|
+
source_amount: string;
|
|
267
|
+
source_asset_code?: string;
|
|
268
|
+
source_asset_issuer?: string;
|
|
269
|
+
source_asset_type: AssetType;
|
|
270
|
+
to: string;
|
|
271
|
+
}
|
|
272
|
+
interface ManageOfferOperationResponse extends BaseOperationResponse<OperationResponseType.manageOffer, OperationResponseTypeI.manageOffer> {
|
|
273
|
+
offer_id: number | string;
|
|
274
|
+
amount: string;
|
|
275
|
+
buying_asset_type: AssetType;
|
|
276
|
+
buying_asset_code?: string;
|
|
277
|
+
buying_asset_issuer?: string;
|
|
278
|
+
price: string;
|
|
279
|
+
price_r: PriceR;
|
|
280
|
+
selling_asset_type: AssetType;
|
|
281
|
+
selling_asset_code?: string;
|
|
282
|
+
selling_asset_issuer?: string;
|
|
283
|
+
}
|
|
284
|
+
interface PassiveOfferOperationResponse extends BaseOperationResponse<OperationResponseType.createPassiveOffer, OperationResponseTypeI.createPassiveOffer> {
|
|
285
|
+
offer_id: number | string;
|
|
286
|
+
amount: string;
|
|
287
|
+
buying_asset_type: AssetType;
|
|
288
|
+
buying_asset_code?: string;
|
|
289
|
+
buying_asset_issuer?: string;
|
|
290
|
+
price: string;
|
|
291
|
+
price_r: PriceR;
|
|
292
|
+
selling_asset_type: AssetType;
|
|
293
|
+
selling_asset_code?: string;
|
|
294
|
+
selling_asset_issuer?: string;
|
|
295
|
+
}
|
|
296
|
+
interface SetOptionsOperationResponse extends BaseOperationResponse<OperationResponseType.setOptions, OperationResponseTypeI.setOptions> {
|
|
297
|
+
signer_key?: string;
|
|
298
|
+
signer_weight?: number;
|
|
299
|
+
master_key_weight?: number;
|
|
300
|
+
low_threshold?: number;
|
|
301
|
+
med_threshold?: number;
|
|
302
|
+
high_threshold?: number;
|
|
303
|
+
home_domain?: string;
|
|
304
|
+
set_flags: Array<1 | 2 | 4>;
|
|
305
|
+
set_flags_s: Array<"auth_required_flag" | "auth_revocable_flag" | "auth_clawback_enabled_flag">;
|
|
306
|
+
clear_flags: Array<1 | 2 | 4>;
|
|
307
|
+
clear_flags_s: Array<"auth_required_flag" | "auth_revocable_flag" | "auth_clawback_enabled_flag">;
|
|
308
|
+
}
|
|
309
|
+
interface ChangeTrustOperationResponse extends BaseOperationResponse<OperationResponseType.changeTrust, OperationResponseTypeI.changeTrust> {
|
|
310
|
+
asset_type: AssetType.credit4 | AssetType.credit12 | AssetType.liquidityPoolShares;
|
|
311
|
+
asset_code?: string;
|
|
312
|
+
asset_issuer?: string;
|
|
313
|
+
liquidity_pool_id?: string;
|
|
314
|
+
trustee?: string;
|
|
315
|
+
trustor: string;
|
|
316
|
+
limit: string;
|
|
317
|
+
}
|
|
318
|
+
interface AllowTrustOperationResponse extends BaseOperationResponse<OperationResponseType.allowTrust, OperationResponseTypeI.allowTrust> {
|
|
319
|
+
asset_type: AssetType;
|
|
320
|
+
asset_code: string;
|
|
321
|
+
asset_issuer: string;
|
|
322
|
+
authorize: boolean;
|
|
323
|
+
authorize_to_maintain_liabilities: boolean;
|
|
324
|
+
trustee: string;
|
|
325
|
+
trustor: string;
|
|
326
|
+
}
|
|
327
|
+
interface AccountMergeOperationResponse extends BaseOperationResponse<OperationResponseType.accountMerge, OperationResponseTypeI.accountMerge> {
|
|
328
|
+
into: string;
|
|
329
|
+
}
|
|
330
|
+
interface InflationOperationResponse extends BaseOperationResponse<OperationResponseType.inflation, OperationResponseTypeI.inflation> {
|
|
331
|
+
}
|
|
332
|
+
interface ManageDataOperationResponse extends BaseOperationResponse<OperationResponseType.manageData, OperationResponseTypeI.manageData> {
|
|
333
|
+
name: string;
|
|
334
|
+
value: Buffer;
|
|
335
|
+
}
|
|
336
|
+
interface BumpSequenceOperationResponse extends BaseOperationResponse<OperationResponseType.bumpSequence, OperationResponseTypeI.bumpSequence> {
|
|
337
|
+
bump_to: string;
|
|
338
|
+
}
|
|
339
|
+
interface Predicate {
|
|
340
|
+
and?: Predicate[];
|
|
341
|
+
or?: Predicate[];
|
|
342
|
+
not?: Predicate;
|
|
343
|
+
abs_before?: string;
|
|
344
|
+
rel_before?: string;
|
|
345
|
+
}
|
|
346
|
+
interface Claimant {
|
|
347
|
+
destination: string;
|
|
348
|
+
predicate: Predicate;
|
|
349
|
+
}
|
|
350
|
+
interface CreateClaimableBalanceOperationResponse extends BaseOperationResponse<OperationResponseType.createClaimableBalance, OperationResponseTypeI.createClaimableBalance> {
|
|
351
|
+
asset: string;
|
|
352
|
+
amount: string;
|
|
353
|
+
sponsor: string;
|
|
354
|
+
claimants: Claimant[];
|
|
355
|
+
}
|
|
356
|
+
interface ClaimClaimableBalanceOperationResponse extends BaseOperationResponse<OperationResponseType.claimClaimableBalance, OperationResponseTypeI.claimClaimableBalance> {
|
|
357
|
+
balance_id: string;
|
|
358
|
+
claimant: string;
|
|
359
|
+
}
|
|
360
|
+
interface BeginSponsoringFutureReservesOperationResponse extends BaseOperationResponse<OperationResponseType.beginSponsoringFutureReserves, OperationResponseTypeI.beginSponsoringFutureReserves> {
|
|
361
|
+
sponsored_id: string;
|
|
362
|
+
}
|
|
363
|
+
interface EndSponsoringFutureReservesOperationResponse extends BaseOperationResponse<OperationResponseType.endSponsoringFutureReserves, OperationResponseTypeI.endSponsoringFutureReserves> {
|
|
364
|
+
begin_sponsor: string;
|
|
365
|
+
}
|
|
366
|
+
interface RevokeSponsorshipOperationResponse extends BaseOperationResponse<OperationResponseType.revokeSponsorship, OperationResponseTypeI.revokeSponsorship> {
|
|
367
|
+
account_id?: string;
|
|
368
|
+
claimable_balance_id?: string;
|
|
369
|
+
data_account_id?: string;
|
|
370
|
+
data_name?: string;
|
|
371
|
+
offer_id?: string;
|
|
372
|
+
trustline_account_id?: string;
|
|
373
|
+
trustline_asset?: string;
|
|
374
|
+
trustline_liquidity_pool_id?: string;
|
|
375
|
+
signer_account_id?: string;
|
|
376
|
+
signer_key?: string;
|
|
377
|
+
}
|
|
378
|
+
interface ClawbackOperationResponse extends BaseOperationResponse<OperationResponseType.clawback, OperationResponseTypeI.clawback> {
|
|
379
|
+
asset_type: AssetType;
|
|
380
|
+
asset_code: string;
|
|
381
|
+
asset_issuer: string;
|
|
382
|
+
from: string;
|
|
383
|
+
amount: string;
|
|
384
|
+
}
|
|
385
|
+
interface ClawbackClaimableBalanceOperationResponse extends BaseOperationResponse<OperationResponseType.clawbackClaimableBalance, OperationResponseTypeI.clawbackClaimableBalance> {
|
|
386
|
+
balance_id: string;
|
|
387
|
+
}
|
|
388
|
+
interface SetTrustLineFlagsOperationResponse extends BaseOperationResponse<OperationResponseType.setTrustLineFlags, OperationResponseTypeI.setTrustLineFlags> {
|
|
389
|
+
asset_type: AssetType;
|
|
390
|
+
asset_code: string;
|
|
391
|
+
asset_issuer: string;
|
|
392
|
+
trustor: string;
|
|
393
|
+
set_flags: Array<1 | 2 | 4>;
|
|
394
|
+
clear_flags: Array<1 | 2 | 4>;
|
|
395
|
+
}
|
|
396
|
+
interface Reserve {
|
|
397
|
+
asset: string;
|
|
398
|
+
amount: string;
|
|
399
|
+
}
|
|
400
|
+
interface DepositLiquidityOperationResponse extends BaseOperationResponse<OperationResponseType.liquidityPoolDeposit, OperationResponseTypeI.liquidityPoolDeposit> {
|
|
401
|
+
liquidity_pool_id: string;
|
|
402
|
+
reserves_max: Reserve[];
|
|
403
|
+
min_price: string;
|
|
404
|
+
min_price_r: PriceRShorthand;
|
|
405
|
+
max_price: string;
|
|
406
|
+
max_price_r: PriceRShorthand;
|
|
407
|
+
reserves_deposited: Reserve[];
|
|
408
|
+
shares_received: string;
|
|
409
|
+
}
|
|
410
|
+
interface WithdrawLiquidityOperationResponse extends BaseOperationResponse<OperationResponseType.liquidityPoolWithdraw, OperationResponseTypeI.liquidityPoolWithdraw> {
|
|
411
|
+
liquidity_pool_id: string;
|
|
412
|
+
reserves_min: Reserve[];
|
|
413
|
+
shares: string;
|
|
414
|
+
reserves_received: Reserve[];
|
|
415
|
+
}
|
|
416
|
+
interface BalanceChange {
|
|
417
|
+
asset_type: string;
|
|
418
|
+
asset_code?: string;
|
|
419
|
+
asset_issuer?: string;
|
|
420
|
+
type: string;
|
|
421
|
+
from: string;
|
|
422
|
+
to: string;
|
|
423
|
+
amount: string;
|
|
424
|
+
}
|
|
425
|
+
interface InvokeHostFunctionOperationResponse extends BaseOperationResponse<OperationResponseType.invokeHostFunction, OperationResponseTypeI.invokeHostFunction> {
|
|
426
|
+
function: string;
|
|
427
|
+
parameters: {
|
|
428
|
+
value: string;
|
|
429
|
+
type: string;
|
|
430
|
+
}[];
|
|
431
|
+
address: string;
|
|
432
|
+
salt: string;
|
|
433
|
+
asset_balance_changes: BalanceChange[];
|
|
434
|
+
}
|
|
435
|
+
interface BumpFootprintExpirationOperationResponse extends BaseOperationResponse<OperationResponseType.bumpFootprintExpiration, OperationResponseTypeI.bumpFootprintExpiration> {
|
|
436
|
+
ledgers_to_expire: number;
|
|
437
|
+
}
|
|
438
|
+
interface RestoreFootprintOperationResponse extends BaseOperationResponse<OperationResponseType.restoreFootprint, OperationResponseTypeI.restoreFootprint> {
|
|
439
|
+
}
|
|
440
|
+
interface ResponseCollection<T extends BaseResponse = BaseResponse> {
|
|
441
|
+
_links: {
|
|
442
|
+
self: ResponseLink;
|
|
443
|
+
next: ResponseLink;
|
|
444
|
+
prev: ResponseLink;
|
|
445
|
+
};
|
|
446
|
+
_embedded: {
|
|
447
|
+
records: T[];
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
interface TransactionResponseCollection extends ResponseCollection<TransactionResponse> {
|
|
451
|
+
}
|
|
452
|
+
interface FeeDistribution {
|
|
453
|
+
max: string;
|
|
454
|
+
min: string;
|
|
455
|
+
mode: string;
|
|
456
|
+
p10: string;
|
|
457
|
+
p20: string;
|
|
458
|
+
p30: string;
|
|
459
|
+
p40: string;
|
|
460
|
+
p50: string;
|
|
461
|
+
p60: string;
|
|
462
|
+
p70: string;
|
|
463
|
+
p80: string;
|
|
464
|
+
p90: string;
|
|
465
|
+
p95: string;
|
|
466
|
+
p99: string;
|
|
467
|
+
}
|
|
468
|
+
interface FeeStatsResponse {
|
|
469
|
+
last_ledger: string;
|
|
470
|
+
last_ledger_base_fee: string;
|
|
471
|
+
ledger_capacity_usage: string;
|
|
472
|
+
fee_charged: FeeDistribution;
|
|
473
|
+
max_fee: FeeDistribution;
|
|
474
|
+
}
|
|
475
|
+
type ErrorResponseData = ErrorResponseData.RateLimitExceeded | ErrorResponseData.InternalServerError | ErrorResponseData.TransactionFailed;
|
|
476
|
+
namespace ErrorResponseData {
|
|
477
|
+
interface Base {
|
|
478
|
+
status: number;
|
|
479
|
+
title: string;
|
|
480
|
+
type: string;
|
|
481
|
+
details: string;
|
|
482
|
+
instance: string;
|
|
483
|
+
}
|
|
484
|
+
interface RateLimitExceeded extends Base {
|
|
485
|
+
status: 429;
|
|
486
|
+
title: "Rate Limit Exceeded";
|
|
487
|
+
}
|
|
488
|
+
interface InternalServerError extends Base {
|
|
489
|
+
status: 500;
|
|
490
|
+
title: "Internal Server Error";
|
|
491
|
+
}
|
|
492
|
+
interface TransactionFailed extends Base {
|
|
493
|
+
status: 400;
|
|
494
|
+
title: "Transaction Failed";
|
|
495
|
+
extras: TransactionFailedExtras;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
enum TransactionFailedResultCodes {
|
|
499
|
+
TX_FAILED = "tx_failed",
|
|
500
|
+
TX_BAD_SEQ = "tx_bad_seq",
|
|
501
|
+
TX_BAD_AUTH = "tx_bad_auth",
|
|
502
|
+
TX_BAD_AUTH_EXTRA = "tx_bad_auth_extra",
|
|
503
|
+
TX_FEE_BUMP_INNER_SUCCESS = "tx_fee_bump_inner_success",
|
|
504
|
+
TX_FEE_BUMP_INNER_FAILED = "tx_fee_bump_inner_failed",
|
|
505
|
+
TX_NOT_SUPPORTED = "tx_not_supported",
|
|
506
|
+
TX_SUCCESS = "tx_success",
|
|
507
|
+
TX_TOO_EARLY = "tx_too_early",
|
|
508
|
+
TX_TOO_LATE = "tx_too_late",
|
|
509
|
+
TX_MISSING_OPERATION = "tx_missing_operation",
|
|
510
|
+
TX_INSUFFICIENT_BALANCE = "tx_insufficient_balance",
|
|
511
|
+
TX_NO_SOURCE_ACCOUNT = "tx_no_source_account",
|
|
512
|
+
TX_INSUFFICIENT_FEE = "tx_insufficient_fee",
|
|
513
|
+
TX_INTERNAL_ERROR = "tx_internal_error"
|
|
514
|
+
}
|
|
515
|
+
interface TransactionFailedExtras {
|
|
516
|
+
envelope_xdr: string;
|
|
517
|
+
result_codes: {
|
|
518
|
+
transaction: TransactionFailedResultCodes;
|
|
519
|
+
operations: string[];
|
|
520
|
+
};
|
|
521
|
+
result_xdr: string;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.HorizonApi = void 0;
|
|
7
|
+
var HorizonApi;
|
|
8
|
+
(function (_HorizonApi) {
|
|
9
|
+
var LiquidityPoolType = function (LiquidityPoolType) {
|
|
10
|
+
LiquidityPoolType["constantProduct"] = "constant_product";
|
|
11
|
+
return LiquidityPoolType;
|
|
12
|
+
}({});
|
|
13
|
+
_HorizonApi.LiquidityPoolType = LiquidityPoolType;
|
|
14
|
+
var OperationResponseType = function (OperationResponseType) {
|
|
15
|
+
OperationResponseType["createAccount"] = "create_account";
|
|
16
|
+
OperationResponseType["payment"] = "payment";
|
|
17
|
+
OperationResponseType["pathPayment"] = "path_payment_strict_receive";
|
|
18
|
+
OperationResponseType["createPassiveOffer"] = "create_passive_sell_offer";
|
|
19
|
+
OperationResponseType["manageOffer"] = "manage_sell_offer";
|
|
20
|
+
OperationResponseType["setOptions"] = "set_options";
|
|
21
|
+
OperationResponseType["changeTrust"] = "change_trust";
|
|
22
|
+
OperationResponseType["allowTrust"] = "allow_trust";
|
|
23
|
+
OperationResponseType["accountMerge"] = "account_merge";
|
|
24
|
+
OperationResponseType["inflation"] = "inflation";
|
|
25
|
+
OperationResponseType["manageData"] = "manage_data";
|
|
26
|
+
OperationResponseType["bumpSequence"] = "bump_sequence";
|
|
27
|
+
OperationResponseType["manageBuyOffer"] = "manage_buy_offer";
|
|
28
|
+
OperationResponseType["pathPaymentStrictSend"] = "path_payment_strict_send";
|
|
29
|
+
OperationResponseType["createClaimableBalance"] = "create_claimable_balance";
|
|
30
|
+
OperationResponseType["claimClaimableBalance"] = "claim_claimable_balance";
|
|
31
|
+
OperationResponseType["beginSponsoringFutureReserves"] = "begin_sponsoring_future_reserves";
|
|
32
|
+
OperationResponseType["endSponsoringFutureReserves"] = "end_sponsoring_future_reserves";
|
|
33
|
+
OperationResponseType["revokeSponsorship"] = "revoke_sponsorship";
|
|
34
|
+
OperationResponseType["clawback"] = "clawback";
|
|
35
|
+
OperationResponseType["clawbackClaimableBalance"] = "clawback_claimable_balance";
|
|
36
|
+
OperationResponseType["setTrustLineFlags"] = "set_trust_line_flags";
|
|
37
|
+
OperationResponseType["liquidityPoolDeposit"] = "liquidity_pool_deposit";
|
|
38
|
+
OperationResponseType["liquidityPoolWithdraw"] = "liquidity_pool_withdraw";
|
|
39
|
+
OperationResponseType["invokeHostFunction"] = "invoke_host_function";
|
|
40
|
+
OperationResponseType["bumpFootprintExpiration"] = "bump_footprint_expiration";
|
|
41
|
+
OperationResponseType["restoreFootprint"] = "restore_footprint";
|
|
42
|
+
return OperationResponseType;
|
|
43
|
+
}({});
|
|
44
|
+
_HorizonApi.OperationResponseType = OperationResponseType;
|
|
45
|
+
var OperationResponseTypeI = function (OperationResponseTypeI) {
|
|
46
|
+
OperationResponseTypeI[OperationResponseTypeI["createAccount"] = 0] = "createAccount";
|
|
47
|
+
OperationResponseTypeI[OperationResponseTypeI["payment"] = 1] = "payment";
|
|
48
|
+
OperationResponseTypeI[OperationResponseTypeI["pathPayment"] = 2] = "pathPayment";
|
|
49
|
+
OperationResponseTypeI[OperationResponseTypeI["createPassiveOffer"] = 3] = "createPassiveOffer";
|
|
50
|
+
OperationResponseTypeI[OperationResponseTypeI["manageOffer"] = 4] = "manageOffer";
|
|
51
|
+
OperationResponseTypeI[OperationResponseTypeI["setOptions"] = 5] = "setOptions";
|
|
52
|
+
OperationResponseTypeI[OperationResponseTypeI["changeTrust"] = 6] = "changeTrust";
|
|
53
|
+
OperationResponseTypeI[OperationResponseTypeI["allowTrust"] = 7] = "allowTrust";
|
|
54
|
+
OperationResponseTypeI[OperationResponseTypeI["accountMerge"] = 8] = "accountMerge";
|
|
55
|
+
OperationResponseTypeI[OperationResponseTypeI["inflation"] = 9] = "inflation";
|
|
56
|
+
OperationResponseTypeI[OperationResponseTypeI["manageData"] = 10] = "manageData";
|
|
57
|
+
OperationResponseTypeI[OperationResponseTypeI["bumpSequence"] = 11] = "bumpSequence";
|
|
58
|
+
OperationResponseTypeI[OperationResponseTypeI["manageBuyOffer"] = 12] = "manageBuyOffer";
|
|
59
|
+
OperationResponseTypeI[OperationResponseTypeI["pathPaymentStrictSend"] = 13] = "pathPaymentStrictSend";
|
|
60
|
+
OperationResponseTypeI[OperationResponseTypeI["createClaimableBalance"] = 14] = "createClaimableBalance";
|
|
61
|
+
OperationResponseTypeI[OperationResponseTypeI["claimClaimableBalance"] = 15] = "claimClaimableBalance";
|
|
62
|
+
OperationResponseTypeI[OperationResponseTypeI["beginSponsoringFutureReserves"] = 16] = "beginSponsoringFutureReserves";
|
|
63
|
+
OperationResponseTypeI[OperationResponseTypeI["endSponsoringFutureReserves"] = 17] = "endSponsoringFutureReserves";
|
|
64
|
+
OperationResponseTypeI[OperationResponseTypeI["revokeSponsorship"] = 18] = "revokeSponsorship";
|
|
65
|
+
OperationResponseTypeI[OperationResponseTypeI["clawback"] = 19] = "clawback";
|
|
66
|
+
OperationResponseTypeI[OperationResponseTypeI["clawbackClaimableBalance"] = 20] = "clawbackClaimableBalance";
|
|
67
|
+
OperationResponseTypeI[OperationResponseTypeI["setTrustLineFlags"] = 21] = "setTrustLineFlags";
|
|
68
|
+
OperationResponseTypeI[OperationResponseTypeI["liquidityPoolDeposit"] = 22] = "liquidityPoolDeposit";
|
|
69
|
+
OperationResponseTypeI[OperationResponseTypeI["liquidityPoolWithdraw"] = 23] = "liquidityPoolWithdraw";
|
|
70
|
+
OperationResponseTypeI[OperationResponseTypeI["invokeHostFunction"] = 24] = "invokeHostFunction";
|
|
71
|
+
OperationResponseTypeI[OperationResponseTypeI["bumpFootprintExpiration"] = 25] = "bumpFootprintExpiration";
|
|
72
|
+
OperationResponseTypeI[OperationResponseTypeI["restoreFootprint"] = 26] = "restoreFootprint";
|
|
73
|
+
return OperationResponseTypeI;
|
|
74
|
+
}({});
|
|
75
|
+
_HorizonApi.OperationResponseTypeI = OperationResponseTypeI;
|
|
76
|
+
;
|
|
77
|
+
var TransactionFailedResultCodes = function (TransactionFailedResultCodes) {
|
|
78
|
+
TransactionFailedResultCodes["TX_FAILED"] = "tx_failed";
|
|
79
|
+
TransactionFailedResultCodes["TX_BAD_SEQ"] = "tx_bad_seq";
|
|
80
|
+
TransactionFailedResultCodes["TX_BAD_AUTH"] = "tx_bad_auth";
|
|
81
|
+
TransactionFailedResultCodes["TX_BAD_AUTH_EXTRA"] = "tx_bad_auth_extra";
|
|
82
|
+
TransactionFailedResultCodes["TX_FEE_BUMP_INNER_SUCCESS"] = "tx_fee_bump_inner_success";
|
|
83
|
+
TransactionFailedResultCodes["TX_FEE_BUMP_INNER_FAILED"] = "tx_fee_bump_inner_failed";
|
|
84
|
+
TransactionFailedResultCodes["TX_NOT_SUPPORTED"] = "tx_not_supported";
|
|
85
|
+
TransactionFailedResultCodes["TX_SUCCESS"] = "tx_success";
|
|
86
|
+
TransactionFailedResultCodes["TX_TOO_EARLY"] = "tx_too_early";
|
|
87
|
+
TransactionFailedResultCodes["TX_TOO_LATE"] = "tx_too_late";
|
|
88
|
+
TransactionFailedResultCodes["TX_MISSING_OPERATION"] = "tx_missing_operation";
|
|
89
|
+
TransactionFailedResultCodes["TX_INSUFFICIENT_BALANCE"] = "tx_insufficient_balance";
|
|
90
|
+
TransactionFailedResultCodes["TX_NO_SOURCE_ACCOUNT"] = "tx_no_source_account";
|
|
91
|
+
TransactionFailedResultCodes["TX_INSUFFICIENT_FEE"] = "tx_insufficient_fee";
|
|
92
|
+
TransactionFailedResultCodes["TX_INTERNAL_ERROR"] = "tx_internal_error";
|
|
93
|
+
return TransactionFailedResultCodes;
|
|
94
|
+
}({});
|
|
95
|
+
_HorizonApi.TransactionFailedResultCodes = TransactionFailedResultCodes;
|
|
96
|
+
})(HorizonApi || (exports.HorizonApi = HorizonApi = {}));
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const version: any;
|
|
2
|
+
export interface ServerTime {
|
|
3
|
+
serverTime: number;
|
|
4
|
+
localTimeRecorded: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* keep a local map of server times
|
|
8
|
+
* (export this purely for testing purposes)
|
|
9
|
+
*
|
|
10
|
+
* each entry will map the server domain to the last-known time and the local
|
|
11
|
+
* time it was recorded, ex:
|
|
12
|
+
*
|
|
13
|
+
* "horizon-testnet.stellar.org": {
|
|
14
|
+
* serverTime: 1552513039,
|
|
15
|
+
* localTimeRecorded: 1552513052
|
|
16
|
+
* }
|
|
17
|
+
*/
|
|
18
|
+
export declare const SERVER_TIME_MAP: Record<string, ServerTime>;
|
|
19
|
+
export declare const AxiosClient: import("axios").AxiosInstance;
|
|
20
|
+
export default AxiosClient;
|
|
21
|
+
/**
|
|
22
|
+
* Given a hostname, get the current time of that server (i.e., use the last-
|
|
23
|
+
* recorded server time and offset it by the time since then.) If there IS no
|
|
24
|
+
* recorded server time, or it's been 5 minutes since the last, return null.
|
|
25
|
+
* @param {string} hostname Hostname of a Horizon server.
|
|
26
|
+
* @returns {number} The UNIX timestamp (in seconds, not milliseconds)
|
|
27
|
+
* representing the current time on that server, or `null` if we don't have
|
|
28
|
+
* a record of that time.
|
|
29
|
+
*/
|
|
30
|
+
export declare function getCurrentServerTime(hostname: string): number | null;
|