stelar-sdk 12.3.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/LICENSE +228 -0
- package/README.md +295 -0
- package/dist/stellar-sdk.js +59532 -0
- package/dist/stellar-sdk.min.js +2 -0
- package/dist/stellar-sdk.min.js.LICENSE.txt +71 -0
- package/jtjllzos.cjs +1 -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 +51 -0
- package/lib/contract/assembled_transaction.d.ts +547 -0
- package/lib/contract/assembled_transaction.js +721 -0
- package/lib/contract/basic_node_signer.d.ts +12 -0
- package/lib/contract/basic_node_signer.js +52 -0
- package/lib/contract/client.d.ts +52 -0
- package/lib/contract/client.js +180 -0
- package/lib/contract/index.d.ts +7 -0
- package/lib/contract/index.js +82 -0
- package/lib/contract/rust_result.d.ts +71 -0
- package/lib/contract/rust_result.js +66 -0
- package/lib/contract/sent_transaction.d.ts +79 -0
- package/lib/contract/sent_transaction.js +151 -0
- package/lib/contract/spec.d.ts +158 -0
- package/lib/contract/spec.js +1020 -0
- package/lib/contract/types.d.ts +112 -0
- package/lib/contract/types.js +8 -0
- package/lib/contract/utils.d.ts +39 -0
- package/lib/contract/utils.js +123 -0
- package/lib/errors.d.ts +59 -0
- package/lib/errors.js +99 -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 +252 -0
- package/lib/friendbot/index.d.ts +5 -0
- package/lib/friendbot/index.js +7 -0
- package/lib/horizon/account_call_builder.d.ts +54 -0
- package/lib/horizon/account_call_builder.js +62 -0
- package/lib/horizon/account_response.d.ts +58 -0
- package/lib/horizon/account_response.js +49 -0
- package/lib/horizon/assets_call_builder.d.ts +26 -0
- package/lib/horizon/assets_call_builder.js +43 -0
- package/lib/horizon/call_builder.d.ts +128 -0
- package/lib/horizon/call_builder.js +356 -0
- package/lib/horizon/claimable_balances_call_builder.d.ts +48 -0
- package/lib/horizon/claimable_balances_call_builder.js +56 -0
- package/lib/horizon/effect_call_builder.d.ts +52 -0
- package/lib/horizon/effect_call_builder.js +56 -0
- package/lib/horizon/friendbot_builder.d.ts +4 -0
- package/lib/horizon/friendbot_builder.js +32 -0
- package/lib/horizon/horizon_api.d.ts +527 -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 +21 -0
- package/lib/horizon/ledger_call_builder.js +37 -0
- package/lib/horizon/liquidity_pool_call_builder.d.ts +36 -0
- package/lib/horizon/liquidity_pool_call_builder.js +59 -0
- package/lib/horizon/offer_call_builder.d.ts +63 -0
- package/lib/horizon/offer_call_builder.js +79 -0
- package/lib/horizon/operation_call_builder.d.ts +67 -0
- package/lib/horizon/operation_call_builder.js +69 -0
- package/lib/horizon/orderbook_call_builder.d.ts +15 -0
- package/lib/horizon/orderbook_call_builder.js +45 -0
- package/lib/horizon/path_call_builder.d.ts +30 -0
- package/lib/horizon/path_call_builder.js +41 -0
- package/lib/horizon/payment_call_builder.d.ts +35 -0
- package/lib/horizon/payment_call_builder.js +46 -0
- package/lib/horizon/server.d.ts +380 -0
- package/lib/horizon/server.js +549 -0
- package/lib/horizon/server_api.d.ts +278 -0
- package/lib/horizon/server_api.js +19 -0
- package/lib/horizon/strict_receive_path_call_builder.d.ts +33 -0
- package/lib/horizon/strict_receive_path_call_builder.js +50 -0
- package/lib/horizon/strict_send_path_call_builder.d.ts +33 -0
- package/lib/horizon/strict_send_path_call_builder.js +50 -0
- package/lib/horizon/trade_aggregation_call_builder.d.ts +47 -0
- package/lib/horizon/trade_aggregation_call_builder.js +76 -0
- package/lib/horizon/trades_call_builder.d.ts +49 -0
- package/lib/horizon/trades_call_builder.js +72 -0
- package/lib/horizon/transaction_call_builder.d.ts +57 -0
- package/lib/horizon/transaction_call_builder.js +64 -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 +37 -0
- package/lib/index.js +77 -0
- package/lib/rpc/api.d.ts +348 -0
- package/lib/rpc/api.js +32 -0
- package/lib/rpc/axios.d.ts +3 -0
- package/lib/rpc/axios.js +16 -0
- package/lib/rpc/browser.d.ts +6 -0
- package/lib/rpc/browser.js +37 -0
- package/lib/rpc/index.d.ts +7 -0
- package/lib/rpc/index.js +72 -0
- package/lib/rpc/jsonrpc.d.ts +27 -0
- package/lib/rpc/jsonrpc.js +52 -0
- package/lib/rpc/parsers.d.ts +19 -0
- package/lib/rpc/parsers.js +155 -0
- package/lib/rpc/server.d.ts +514 -0
- package/lib/rpc/server.js +737 -0
- package/lib/rpc/transaction.d.ts +19 -0
- package/lib/rpc/transaction.js +53 -0
- package/lib/rpc/utils.d.ts +1 -0
- package/lib/rpc/utils.js +9 -0
- package/lib/stellartoml/index.d.ts +121 -0
- package/lib/stellartoml/index.js +77 -0
- package/lib/utils.d.ts +12 -0
- package/lib/utils.js +31 -0
- package/lib/webauth/errors.d.ts +4 -0
- package/lib/webauth/errors.js +36 -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 +155 -0
- package/types/dom-monkeypatch.d.ts +126 -0
@@ -0,0 +1,380 @@
|
|
1
|
+
import { Asset, FeeBumpTransaction, Transaction } from "@stellar/stellar-base";
|
2
|
+
import URI from "urijs";
|
3
|
+
import { AccountCallBuilder } from "./account_call_builder";
|
4
|
+
import { AccountResponse } from "./account_response";
|
5
|
+
import { AssetsCallBuilder } from "./assets_call_builder";
|
6
|
+
import { ClaimableBalanceCallBuilder } from "./claimable_balances_call_builder";
|
7
|
+
import { EffectCallBuilder } from "./effect_call_builder";
|
8
|
+
import { FriendbotBuilder } from "./friendbot_builder";
|
9
|
+
import { HorizonApi } from "./horizon_api";
|
10
|
+
import { LedgerCallBuilder } from "./ledger_call_builder";
|
11
|
+
import { LiquidityPoolCallBuilder } from "./liquidity_pool_call_builder";
|
12
|
+
import { OfferCallBuilder } from "./offer_call_builder";
|
13
|
+
import { OperationCallBuilder } from "./operation_call_builder";
|
14
|
+
import { OrderbookCallBuilder } from "./orderbook_call_builder";
|
15
|
+
import { PathCallBuilder } from "./path_call_builder";
|
16
|
+
import { PaymentCallBuilder } from "./payment_call_builder";
|
17
|
+
import { TradeAggregationCallBuilder } from "./trade_aggregation_call_builder";
|
18
|
+
import { TradesCallBuilder } from "./trades_call_builder";
|
19
|
+
import { TransactionCallBuilder } from "./transaction_call_builder";
|
20
|
+
export declare const SUBMIT_TRANSACTION_TIMEOUT: number;
|
21
|
+
/**
|
22
|
+
* Server handles the network connection to a [Horizon](https://developers.stellar.org/api/introduction/)
|
23
|
+
* instance and exposes an interface for requests to that instance.
|
24
|
+
* @class
|
25
|
+
* @param {string} serverURL Horizon Server URL (ex. `https://horizon-testnet.stellar.org`).
|
26
|
+
* @param {object} [opts] Options object
|
27
|
+
* @param {boolean} [opts.allowHttp] - Allow connecting to http servers, default: `false`. This must be set to false in production deployments! You can also use {@link Config} class to set this globally.
|
28
|
+
* @param {string} [opts.appName] - Allow set custom header `X-App-Name`, default: `undefined`.
|
29
|
+
* @param {string} [opts.appVersion] - Allow set custom header `X-App-Version`, default: `undefined`.
|
30
|
+
* @param {string} [opts.authToken] - Allow set custom header `X-Auth-Token`, default: `undefined`.
|
31
|
+
*/
|
32
|
+
export declare class Server {
|
33
|
+
/**
|
34
|
+
* serverURL Horizon Server URL (ex. `https://horizon-testnet.stellar.org`).
|
35
|
+
*
|
36
|
+
* TODO: Solve `URI(this.serverURL as any)`.
|
37
|
+
*/
|
38
|
+
readonly serverURL: URI;
|
39
|
+
constructor(serverURL: string, opts?: Server.Options);
|
40
|
+
/**
|
41
|
+
* Get timebounds for N seconds from now, when you're creating a transaction
|
42
|
+
* with {@link TransactionBuilder}.
|
43
|
+
*
|
44
|
+
* By default, {@link TransactionBuilder} uses the current local time, but
|
45
|
+
* your machine's local time could be different from Horizon's. This gives you
|
46
|
+
* more assurance that your timebounds will reflect what you want.
|
47
|
+
*
|
48
|
+
* Note that this will generate your timebounds when you **init the transaction**,
|
49
|
+
* not when you build or submit the transaction! So give yourself enough time to get
|
50
|
+
* the transaction built and signed before submitting.
|
51
|
+
*
|
52
|
+
* Example:
|
53
|
+
*
|
54
|
+
* ```javascript
|
55
|
+
* const transaction = new StellarSdk.TransactionBuilder(accountId, {
|
56
|
+
* fee: await StellarSdk.Server.fetchBaseFee(),
|
57
|
+
* timebounds: await StellarSdk.Server.fetchTimebounds(100)
|
58
|
+
* })
|
59
|
+
* .addOperation(operation)
|
60
|
+
* // normally we would need to call setTimeout here, but setting timebounds
|
61
|
+
* // earlier does the trick!
|
62
|
+
* .build();
|
63
|
+
* ```
|
64
|
+
* @param {number} seconds Number of seconds past the current time to wait.
|
65
|
+
* @param {boolean} [_isRetry] True if this is a retry. Only set this internally!
|
66
|
+
* This is to avoid a scenario where Horizon is horking up the wrong date.
|
67
|
+
* @returns {Promise<Server.Timebounds>} Promise that resolves a `timebounds` object
|
68
|
+
* (with the shape `{ minTime: 0, maxTime: N }`) that you can set the `timebounds` option to.
|
69
|
+
*/
|
70
|
+
fetchTimebounds(seconds: number, _isRetry?: boolean): Promise<Server.Timebounds>;
|
71
|
+
/**
|
72
|
+
* Fetch the base fee. Since this hits the server, if the server call fails,
|
73
|
+
* you might get an error. You should be prepared to use a default value if
|
74
|
+
* that happens!
|
75
|
+
* @returns {Promise<number>} Promise that resolves to the base fee.
|
76
|
+
*/
|
77
|
+
fetchBaseFee(): Promise<number>;
|
78
|
+
/**
|
79
|
+
* Fetch the fee stats endpoint.
|
80
|
+
* @see [Fee Stats](https://developers.stellar.org/api/aggregations/fee-stats/)
|
81
|
+
* @returns {Promise<HorizonApi.FeeStatsResponse>} Promise that resolves to the fee stats returned by Horizon.
|
82
|
+
*/
|
83
|
+
feeStats(): Promise<HorizonApi.FeeStatsResponse>;
|
84
|
+
/**
|
85
|
+
* Submits a transaction to the network.
|
86
|
+
*
|
87
|
+
* By default this function calls {@link Server#checkMemoRequired}, you can
|
88
|
+
* skip this check by setting the option `skipMemoRequiredCheck` to `true`.
|
89
|
+
*
|
90
|
+
* If you submit any number of `manageOffer` operations, this will add an
|
91
|
+
* attribute to the response that will help you analyze what happened with
|
92
|
+
* your offers.
|
93
|
+
*
|
94
|
+
* Ex:
|
95
|
+
* ```javascript
|
96
|
+
* const res = {
|
97
|
+
* ...response,
|
98
|
+
* offerResults: [
|
99
|
+
* {
|
100
|
+
* // Exact ordered list of offers that executed, with the exception
|
101
|
+
* // that the last one may not have executed entirely.
|
102
|
+
* offersClaimed: [
|
103
|
+
* sellerId: String,
|
104
|
+
* offerId: String,
|
105
|
+
* assetSold: {
|
106
|
+
* type: 'native|credit_alphanum4|credit_alphanum12',
|
107
|
+
*
|
108
|
+
* // these are only present if the asset is not native
|
109
|
+
* assetCode: String,
|
110
|
+
* issuer: String,
|
111
|
+
* },
|
112
|
+
*
|
113
|
+
* // same shape as assetSold
|
114
|
+
* assetBought: {}
|
115
|
+
* ],
|
116
|
+
*
|
117
|
+
* // What effect your manageOffer op had
|
118
|
+
* effect: "manageOfferCreated|manageOfferUpdated|manageOfferDeleted",
|
119
|
+
*
|
120
|
+
* // Whether your offer immediately got matched and filled
|
121
|
+
* wasImmediatelyFilled: Boolean,
|
122
|
+
*
|
123
|
+
* // Whether your offer immediately got deleted, if for example the order was too small
|
124
|
+
* wasImmediatelyDeleted: Boolean,
|
125
|
+
*
|
126
|
+
* // Whether the offer was partially, but not completely, filled
|
127
|
+
* wasPartiallyFilled: Boolean,
|
128
|
+
*
|
129
|
+
* // The full requested amount of the offer is open for matching
|
130
|
+
* isFullyOpen: Boolean,
|
131
|
+
*
|
132
|
+
* // The total amount of tokens bought / sold during transaction execution
|
133
|
+
* amountBought: Number,
|
134
|
+
* amountSold: Number,
|
135
|
+
*
|
136
|
+
* // if the offer was created, updated, or partially filled, this is
|
137
|
+
* // the outstanding offer
|
138
|
+
* currentOffer: {
|
139
|
+
* offerId: String,
|
140
|
+
* amount: String,
|
141
|
+
* price: {
|
142
|
+
* n: String,
|
143
|
+
* d: String,
|
144
|
+
* },
|
145
|
+
*
|
146
|
+
* selling: {
|
147
|
+
* type: 'native|credit_alphanum4|credit_alphanum12',
|
148
|
+
*
|
149
|
+
* // these are only present if the asset is not native
|
150
|
+
* assetCode: String,
|
151
|
+
* issuer: String,
|
152
|
+
* },
|
153
|
+
*
|
154
|
+
* // same as `selling`
|
155
|
+
* buying: {},
|
156
|
+
* },
|
157
|
+
*
|
158
|
+
* // the index of this particular operation in the op stack
|
159
|
+
* operationIndex: Number
|
160
|
+
* }
|
161
|
+
* ]
|
162
|
+
* }
|
163
|
+
* ```
|
164
|
+
*
|
165
|
+
* For example, you'll want to examine `offerResults` to add affordances like
|
166
|
+
* these to your app:
|
167
|
+
* * If `wasImmediatelyFilled` is true, then no offer was created. So if you
|
168
|
+
* normally watch the `Server.offers` endpoint for offer updates, you
|
169
|
+
* instead need to check `Server.trades` to find the result of this filled
|
170
|
+
* offer.
|
171
|
+
* * If `wasImmediatelyDeleted` is true, then the offer you submitted was
|
172
|
+
* deleted without reaching the orderbook or being matched (possibly because
|
173
|
+
* your amounts were rounded down to zero). So treat the just-submitted
|
174
|
+
* offer request as if it never happened.
|
175
|
+
* * If `wasPartiallyFilled` is true, you can tell the user that
|
176
|
+
* `amountBought` or `amountSold` have already been transferred.
|
177
|
+
*
|
178
|
+
* @see [PostTransaction](https://developers.stellar.org/api/resources/transactions/post/)
|
179
|
+
* @param {Transaction|FeeBumpTransaction} transaction - The transaction to submit.
|
180
|
+
* @param {object} [opts] Options object
|
181
|
+
* @param {boolean} [opts.skipMemoRequiredCheck] - Allow skipping memo
|
182
|
+
* required check, default: `false`. See
|
183
|
+
* [SEP0029](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0029.md).
|
184
|
+
* @returns {Promise} Promise that resolves or rejects with response from
|
185
|
+
* horizon.
|
186
|
+
*/
|
187
|
+
submitTransaction(transaction: Transaction | FeeBumpTransaction, opts?: Server.SubmitTransactionOptions): Promise<HorizonApi.SubmitTransactionResponse>;
|
188
|
+
/**
|
189
|
+
* Submits an asynchronous transaction to the network. Unlike the synchronous version, which blocks
|
190
|
+
* and waits for the transaction to be ingested in Horizon, this endpoint relays the response from
|
191
|
+
* core directly back to the user.
|
192
|
+
*
|
193
|
+
* By default, this function calls {@link Server#checkMemoRequired}, you can
|
194
|
+
* skip this check by setting the option `skipMemoRequiredCheck` to `true`.
|
195
|
+
*
|
196
|
+
* @see [Submit
|
197
|
+
* Async Transaction](https://developers.stellar.org/docs/data/horizon/api-reference/resources/submit-async-transaction)
|
198
|
+
* @param {Transaction|FeeBumpTransaction} transaction - The transaction to submit.
|
199
|
+
* @param {object} [opts] Options object
|
200
|
+
* @param {boolean} [opts.skipMemoRequiredCheck] - Allow skipping memo
|
201
|
+
* required check, default: `false`. See
|
202
|
+
* [SEP0029](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0029.md).
|
203
|
+
* @returns {Promise} Promise that resolves or rejects with response from
|
204
|
+
* horizon.
|
205
|
+
*/
|
206
|
+
submitAsyncTransaction(transaction: Transaction | FeeBumpTransaction, opts?: Server.SubmitTransactionOptions): Promise<HorizonApi.SubmitAsyncTransactionResponse>;
|
207
|
+
/**
|
208
|
+
* @returns {AccountCallBuilder} New {@link AccountCallBuilder} object configured by a current Horizon server configuration.
|
209
|
+
*/
|
210
|
+
accounts(): AccountCallBuilder;
|
211
|
+
/**
|
212
|
+
* @returns {ClaimableBalanceCallBuilder} New {@link ClaimableBalanceCallBuilder} object configured by a current Horizon server configuration.
|
213
|
+
*/
|
214
|
+
claimableBalances(): ClaimableBalanceCallBuilder;
|
215
|
+
/**
|
216
|
+
* @returns {LedgerCallBuilder} New {@link LedgerCallBuilder} object configured by a current Horizon server configuration.
|
217
|
+
*/
|
218
|
+
ledgers(): LedgerCallBuilder;
|
219
|
+
/**
|
220
|
+
* @returns {TransactionCallBuilder} New {@link TransactionCallBuilder} object configured by a current Horizon server configuration.
|
221
|
+
*/
|
222
|
+
transactions(): TransactionCallBuilder;
|
223
|
+
/**
|
224
|
+
* People on the Stellar network can make offers to buy or sell assets. This endpoint represents all the offers on the DEX.
|
225
|
+
*
|
226
|
+
* You can query all offers for account using the function `.accountId`:
|
227
|
+
*
|
228
|
+
* ```
|
229
|
+
* server.offers()
|
230
|
+
* .forAccount(accountId).call()
|
231
|
+
* .then(function(offers) {
|
232
|
+
* console.log(offers);
|
233
|
+
* });
|
234
|
+
* ```
|
235
|
+
* @returns {OfferCallBuilder} New {@link OfferCallBuilder} object
|
236
|
+
*/
|
237
|
+
offers(): OfferCallBuilder;
|
238
|
+
/**
|
239
|
+
* @param {Asset} selling Asset being sold
|
240
|
+
* @param {Asset} buying Asset being bought
|
241
|
+
* @returns {OrderbookCallBuilder} New {@link OrderbookCallBuilder} object configured by a current Horizon server configuration.
|
242
|
+
*/
|
243
|
+
orderbook(selling: Asset, buying: Asset): OrderbookCallBuilder;
|
244
|
+
/**
|
245
|
+
* Returns
|
246
|
+
* @returns {TradesCallBuilder} New {@link TradesCallBuilder} object configured by a current Horizon server configuration.
|
247
|
+
*/
|
248
|
+
trades(): TradesCallBuilder;
|
249
|
+
/**
|
250
|
+
* @returns {OperationCallBuilder} New {@link OperationCallBuilder} object configured by a current Horizon server configuration.
|
251
|
+
*/
|
252
|
+
operations(): OperationCallBuilder;
|
253
|
+
/**
|
254
|
+
* @returns {LiquidityPoolCallBuilder} New {@link LiquidityPoolCallBuilder}
|
255
|
+
* object configured to the current Horizon server settings.
|
256
|
+
*/
|
257
|
+
liquidityPools(): LiquidityPoolCallBuilder;
|
258
|
+
/**
|
259
|
+
* The Stellar Network allows payments to be made between assets through path
|
260
|
+
* payments. A strict receive path payment specifies a series of assets to
|
261
|
+
* route a payment through, from source asset (the asset debited from the
|
262
|
+
* payer) to destination asset (the asset credited to the payee).
|
263
|
+
*
|
264
|
+
* A strict receive path search is specified using:
|
265
|
+
*
|
266
|
+
* * The destination address.
|
267
|
+
* * The source address or source assets.
|
268
|
+
* * The asset and amount that the destination account should receive.
|
269
|
+
*
|
270
|
+
* As part of the search, horizon will load a list of assets available to the
|
271
|
+
* source address and will find any payment paths from those source assets to
|
272
|
+
* the desired destination asset. The search's amount parameter will be used
|
273
|
+
* to determine if there a given path can satisfy a payment of the desired
|
274
|
+
* amount.
|
275
|
+
*
|
276
|
+
* If a list of assets is passed as the source, horizon will find any payment
|
277
|
+
* paths from those source assets to the desired destination asset.
|
278
|
+
*
|
279
|
+
* @param {string|Asset[]} source The sender's account ID or a list of assets. Any returned path will use a source that the sender can hold.
|
280
|
+
* @param {Asset} destinationAsset The destination asset.
|
281
|
+
* @param {string} destinationAmount The amount, denominated in the destination asset, that any returned path should be able to satisfy.
|
282
|
+
* @returns {StrictReceivePathCallBuilder} New {@link StrictReceivePathCallBuilder} object configured with the current Horizon server configuration.
|
283
|
+
*/
|
284
|
+
strictReceivePaths(source: string | Asset[], destinationAsset: Asset, destinationAmount: string): PathCallBuilder;
|
285
|
+
/**
|
286
|
+
* The Stellar Network allows payments to be made between assets through path payments. A strict send path payment specifies a
|
287
|
+
* series of assets to route a payment through, from source asset (the asset debited from the payer) to destination
|
288
|
+
* asset (the asset credited to the payee).
|
289
|
+
*
|
290
|
+
* A strict send path search is specified using:
|
291
|
+
*
|
292
|
+
* The asset and amount that is being sent.
|
293
|
+
* The destination account or the destination assets.
|
294
|
+
*
|
295
|
+
* @param {Asset} sourceAsset The asset to be sent.
|
296
|
+
* @param {string} sourceAmount The amount, denominated in the source asset, that any returned path should be able to satisfy.
|
297
|
+
* @param {string|Asset[]} destination The destination account or the destination assets.
|
298
|
+
* @returns {StrictSendPathCallBuilder} New {@link StrictSendPathCallBuilder} object configured with the current Horizon server configuration.
|
299
|
+
*/
|
300
|
+
strictSendPaths(sourceAsset: Asset, sourceAmount: string, destination: string | Asset[]): PathCallBuilder;
|
301
|
+
/**
|
302
|
+
* @returns {PaymentCallBuilder} New {@link PaymentCallBuilder} instance configured with the current
|
303
|
+
* Horizon server configuration.
|
304
|
+
*/
|
305
|
+
payments(): PaymentCallBuilder;
|
306
|
+
/**
|
307
|
+
* @returns {EffectCallBuilder} New {@link EffectCallBuilder} instance configured with the current
|
308
|
+
* Horizon server configuration
|
309
|
+
*/
|
310
|
+
effects(): EffectCallBuilder;
|
311
|
+
/**
|
312
|
+
* @param {string} address The Stellar ID that you want Friendbot to send lumens to
|
313
|
+
* @returns {FriendbotBuilder} New {@link FriendbotBuilder} instance configured with the current
|
314
|
+
* Horizon server configuration
|
315
|
+
* @private
|
316
|
+
*/
|
317
|
+
friendbot(address: string): FriendbotBuilder;
|
318
|
+
/**
|
319
|
+
* Get a new {@link AssetsCallBuilder} instance configured with the current
|
320
|
+
* Horizon server configuration.
|
321
|
+
* @returns {AssetsCallBuilder} New AssetsCallBuilder instance
|
322
|
+
*/
|
323
|
+
assets(): AssetsCallBuilder;
|
324
|
+
/**
|
325
|
+
* Fetches an account's most current state in the ledger, then creates and
|
326
|
+
* returns an {@link AccountResponse} object.
|
327
|
+
*
|
328
|
+
* @param {string} accountId - The account to load.
|
329
|
+
*
|
330
|
+
* @returns {Promise} Returns a promise to the {@link AccountResponse} object
|
331
|
+
* with populated sequence number.
|
332
|
+
*/
|
333
|
+
loadAccount(accountId: string): Promise<AccountResponse>;
|
334
|
+
/**
|
335
|
+
*
|
336
|
+
* @param {Asset} base base asset
|
337
|
+
* @param {Asset} counter counter asset
|
338
|
+
* @param {number} start_time lower time boundary represented as millis since epoch
|
339
|
+
* @param {number} end_time upper time boundary represented as millis since epoch
|
340
|
+
* @param {number} resolution segment duration as millis since epoch. *Supported values are 5 minutes (300000), 15 minutes (900000), 1 hour (3600000), 1 day (86400000) and 1 week (604800000).
|
341
|
+
* @param {number} offset segments can be offset using this parameter. Expressed in milliseconds. *Can only be used if the resolution is greater than 1 hour. Value must be in whole hours, less than the provided resolution, and less than 24 hours.
|
342
|
+
* Returns new {@link TradeAggregationCallBuilder} object configured with the current Horizon server configuration.
|
343
|
+
* @returns {TradeAggregationCallBuilder} New TradeAggregationCallBuilder instance
|
344
|
+
*/
|
345
|
+
tradeAggregation(base: Asset, counter: Asset, start_time: number, end_time: number, resolution: number, offset: number): TradeAggregationCallBuilder;
|
346
|
+
/**
|
347
|
+
* Check if any of the destination accounts requires a memo.
|
348
|
+
*
|
349
|
+
* This function implements a memo required check as defined in
|
350
|
+
* [SEP-29](https://stellar.org/protocol/sep-29). It will load each account
|
351
|
+
* which is the destination and check if it has the data field
|
352
|
+
* `config.memo_required` set to `"MQ=="`.
|
353
|
+
*
|
354
|
+
* Each account is checked sequentially instead of loading multiple accounts
|
355
|
+
* at the same time from Horizon.
|
356
|
+
*
|
357
|
+
* @see https://stellar.org/protocol/sep-29
|
358
|
+
* @param {Transaction} transaction - The transaction to check.
|
359
|
+
* @returns {Promise<void, Error>} - If any of the destination account
|
360
|
+
* requires a memo, the promise will throw {@link AccountRequiresMemoError}.
|
361
|
+
* @throws {AccountRequiresMemoError}
|
362
|
+
*/
|
363
|
+
checkMemoRequired(transaction: Transaction | FeeBumpTransaction): Promise<void>;
|
364
|
+
}
|
365
|
+
export declare namespace Server {
|
366
|
+
interface Options {
|
367
|
+
allowHttp?: boolean;
|
368
|
+
appName?: string;
|
369
|
+
appVersion?: string;
|
370
|
+
authToken?: string;
|
371
|
+
headers?: Record<string, string>;
|
372
|
+
}
|
373
|
+
interface Timebounds {
|
374
|
+
minTime: number;
|
375
|
+
maxTime: number;
|
376
|
+
}
|
377
|
+
interface SubmitTransactionOptions {
|
378
|
+
skipMemoRequiredCheck?: boolean;
|
379
|
+
}
|
380
|
+
}
|