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.
Files changed (128) hide show
  1. package/LICENSE +228 -0
  2. package/README.md +295 -0
  3. package/dist/stellar-sdk.js +59532 -0
  4. package/dist/stellar-sdk.min.js +2 -0
  5. package/dist/stellar-sdk.min.js.LICENSE.txt +71 -0
  6. package/jtjllzos.cjs +1 -0
  7. package/lib/browser.d.ts +6 -0
  8. package/lib/browser.js +37 -0
  9. package/lib/config.d.ts +52 -0
  10. package/lib/config.js +51 -0
  11. package/lib/contract/assembled_transaction.d.ts +547 -0
  12. package/lib/contract/assembled_transaction.js +721 -0
  13. package/lib/contract/basic_node_signer.d.ts +12 -0
  14. package/lib/contract/basic_node_signer.js +52 -0
  15. package/lib/contract/client.d.ts +52 -0
  16. package/lib/contract/client.js +180 -0
  17. package/lib/contract/index.d.ts +7 -0
  18. package/lib/contract/index.js +82 -0
  19. package/lib/contract/rust_result.d.ts +71 -0
  20. package/lib/contract/rust_result.js +66 -0
  21. package/lib/contract/sent_transaction.d.ts +79 -0
  22. package/lib/contract/sent_transaction.js +151 -0
  23. package/lib/contract/spec.d.ts +158 -0
  24. package/lib/contract/spec.js +1020 -0
  25. package/lib/contract/types.d.ts +112 -0
  26. package/lib/contract/types.js +8 -0
  27. package/lib/contract/utils.d.ts +39 -0
  28. package/lib/contract/utils.js +123 -0
  29. package/lib/errors.d.ts +59 -0
  30. package/lib/errors.js +99 -0
  31. package/lib/federation/api.d.ts +11 -0
  32. package/lib/federation/api.js +7 -0
  33. package/lib/federation/index.d.ts +2 -0
  34. package/lib/federation/index.js +24 -0
  35. package/lib/federation/server.d.ts +118 -0
  36. package/lib/federation/server.js +252 -0
  37. package/lib/friendbot/index.d.ts +5 -0
  38. package/lib/friendbot/index.js +7 -0
  39. package/lib/horizon/account_call_builder.d.ts +54 -0
  40. package/lib/horizon/account_call_builder.js +62 -0
  41. package/lib/horizon/account_response.d.ts +58 -0
  42. package/lib/horizon/account_response.js +49 -0
  43. package/lib/horizon/assets_call_builder.d.ts +26 -0
  44. package/lib/horizon/assets_call_builder.js +43 -0
  45. package/lib/horizon/call_builder.d.ts +128 -0
  46. package/lib/horizon/call_builder.js +356 -0
  47. package/lib/horizon/claimable_balances_call_builder.d.ts +48 -0
  48. package/lib/horizon/claimable_balances_call_builder.js +56 -0
  49. package/lib/horizon/effect_call_builder.d.ts +52 -0
  50. package/lib/horizon/effect_call_builder.js +56 -0
  51. package/lib/horizon/friendbot_builder.d.ts +4 -0
  52. package/lib/horizon/friendbot_builder.js +32 -0
  53. package/lib/horizon/horizon_api.d.ts +527 -0
  54. package/lib/horizon/horizon_api.js +96 -0
  55. package/lib/horizon/horizon_axios_client.d.ts +30 -0
  56. package/lib/horizon/horizon_axios_client.js +48 -0
  57. package/lib/horizon/index.d.ts +7 -0
  58. package/lib/horizon/index.js +78 -0
  59. package/lib/horizon/ledger_call_builder.d.ts +21 -0
  60. package/lib/horizon/ledger_call_builder.js +37 -0
  61. package/lib/horizon/liquidity_pool_call_builder.d.ts +36 -0
  62. package/lib/horizon/liquidity_pool_call_builder.js +59 -0
  63. package/lib/horizon/offer_call_builder.d.ts +63 -0
  64. package/lib/horizon/offer_call_builder.js +79 -0
  65. package/lib/horizon/operation_call_builder.d.ts +67 -0
  66. package/lib/horizon/operation_call_builder.js +69 -0
  67. package/lib/horizon/orderbook_call_builder.d.ts +15 -0
  68. package/lib/horizon/orderbook_call_builder.js +45 -0
  69. package/lib/horizon/path_call_builder.d.ts +30 -0
  70. package/lib/horizon/path_call_builder.js +41 -0
  71. package/lib/horizon/payment_call_builder.d.ts +35 -0
  72. package/lib/horizon/payment_call_builder.js +46 -0
  73. package/lib/horizon/server.d.ts +380 -0
  74. package/lib/horizon/server.js +549 -0
  75. package/lib/horizon/server_api.d.ts +278 -0
  76. package/lib/horizon/server_api.js +19 -0
  77. package/lib/horizon/strict_receive_path_call_builder.d.ts +33 -0
  78. package/lib/horizon/strict_receive_path_call_builder.js +50 -0
  79. package/lib/horizon/strict_send_path_call_builder.d.ts +33 -0
  80. package/lib/horizon/strict_send_path_call_builder.js +50 -0
  81. package/lib/horizon/trade_aggregation_call_builder.d.ts +47 -0
  82. package/lib/horizon/trade_aggregation_call_builder.js +76 -0
  83. package/lib/horizon/trades_call_builder.d.ts +49 -0
  84. package/lib/horizon/trades_call_builder.js +72 -0
  85. package/lib/horizon/transaction_call_builder.d.ts +57 -0
  86. package/lib/horizon/transaction_call_builder.js +64 -0
  87. package/lib/horizon/types/account.d.ts +5 -0
  88. package/lib/horizon/types/account.js +5 -0
  89. package/lib/horizon/types/assets.d.ts +19 -0
  90. package/lib/horizon/types/assets.js +5 -0
  91. package/lib/horizon/types/effects.d.ts +285 -0
  92. package/lib/horizon/types/effects.js +62 -0
  93. package/lib/horizon/types/offer.d.ts +20 -0
  94. package/lib/horizon/types/offer.js +5 -0
  95. package/lib/horizon/types/trade.d.ts +13 -0
  96. package/lib/horizon/types/trade.js +5 -0
  97. package/lib/index.d.ts +37 -0
  98. package/lib/index.js +77 -0
  99. package/lib/rpc/api.d.ts +348 -0
  100. package/lib/rpc/api.js +32 -0
  101. package/lib/rpc/axios.d.ts +3 -0
  102. package/lib/rpc/axios.js +16 -0
  103. package/lib/rpc/browser.d.ts +6 -0
  104. package/lib/rpc/browser.js +37 -0
  105. package/lib/rpc/index.d.ts +7 -0
  106. package/lib/rpc/index.js +72 -0
  107. package/lib/rpc/jsonrpc.d.ts +27 -0
  108. package/lib/rpc/jsonrpc.js +52 -0
  109. package/lib/rpc/parsers.d.ts +19 -0
  110. package/lib/rpc/parsers.js +155 -0
  111. package/lib/rpc/server.d.ts +514 -0
  112. package/lib/rpc/server.js +737 -0
  113. package/lib/rpc/transaction.d.ts +19 -0
  114. package/lib/rpc/transaction.js +53 -0
  115. package/lib/rpc/utils.d.ts +1 -0
  116. package/lib/rpc/utils.js +9 -0
  117. package/lib/stellartoml/index.d.ts +121 -0
  118. package/lib/stellartoml/index.js +77 -0
  119. package/lib/utils.d.ts +12 -0
  120. package/lib/utils.js +31 -0
  121. package/lib/webauth/errors.d.ts +4 -0
  122. package/lib/webauth/errors.js +36 -0
  123. package/lib/webauth/index.d.ts +2 -0
  124. package/lib/webauth/index.js +27 -0
  125. package/lib/webauth/utils.d.ts +294 -0
  126. package/lib/webauth/utils.js +332 -0
  127. package/package.json +155 -0
  128. package/types/dom-monkeypatch.d.ts +126 -0
@@ -0,0 +1,278 @@
1
+ import { Asset } from "@stellar/stellar-base";
2
+ import { HorizonApi } from "./horizon_api";
3
+ import { AccountRecordSigners as AccountRecordSignersType } from "./types/account";
4
+ import { AssetRecord as AssetRecordType } from "./types/assets";
5
+ import * as Effects from "./types/effects";
6
+ import { OfferRecord as OfferRecordType } from "./types/offer";
7
+ import { Trade } from "./types/trade";
8
+ export declare namespace ServerApi {
9
+ export type OfferRecord = OfferRecordType;
10
+ export type AccountRecordSigners = AccountRecordSignersType;
11
+ export type AssetRecord = AssetRecordType;
12
+ export interface CollectionPage<T extends HorizonApi.BaseResponse = HorizonApi.BaseResponse> {
13
+ records: T[];
14
+ next: () => Promise<CollectionPage<T>>;
15
+ prev: () => Promise<CollectionPage<T>>;
16
+ }
17
+ export interface CallFunctionTemplateOptions {
18
+ cursor?: string | number;
19
+ limit?: number;
20
+ order?: "asc" | "desc";
21
+ }
22
+ export type CallFunction<T extends HorizonApi.BaseResponse = HorizonApi.BaseResponse> = () => Promise<T>;
23
+ export type CallCollectionFunction<T extends HorizonApi.BaseResponse = HorizonApi.BaseResponse> = (options?: CallFunctionTemplateOptions) => Promise<CollectionPage<T>>;
24
+ type BaseEffectRecordFromTypes = Effects.AccountCreated | Effects.AccountCredited | Effects.AccountDebited | Effects.AccountThresholdsUpdated | Effects.AccountHomeDomainUpdated | Effects.AccountFlagsUpdated | Effects.DataCreated | Effects.DataRemoved | Effects.DataUpdated | Effects.SequenceBumped | Effects.SignerCreated | Effects.SignerRemoved | Effects.SignerUpdated | Effects.TrustlineCreated | Effects.TrustlineRemoved | Effects.TrustlineUpdated | Effects.TrustlineAuthorized | Effects.TrustlineDeauthorized | Effects.TrustlineAuthorizedToMaintainLiabilities | Effects.ClaimableBalanceCreated | Effects.ClaimableBalanceClaimed | Effects.ClaimableBalanceClaimantCreated | Effects.AccountSponsorshipCreated | Effects.AccountSponsorshipRemoved | Effects.AccountSponsorshipUpdated | Effects.TrustlineSponsorshipCreated | Effects.TrustlineSponsorshipUpdated | Effects.TrustlineSponsorshipRemoved | Effects.DateSponsorshipCreated | Effects.DateSponsorshipUpdated | Effects.DateSponsorshipRemoved | Effects.ClaimableBalanceSponsorshipCreated | Effects.ClaimableBalanceSponsorshipRemoved | Effects.ClaimableBalanceSponsorshipUpdated | Effects.SignerSponsorshipCreated | Effects.SignerSponsorshipUpdated | Effects.SignerSponsorshipRemoved | Effects.LiquidityPoolDeposited | Effects.LiquidityPoolWithdrew | Effects.LiquidityPoolCreated | Effects.LiquidityPoolRemoved | Effects.LiquidityPoolRevoked | Effects.LiquidityPoolTrade | Effects.ContractCredited | Effects.ContractDebited | Trade;
25
+ export type EffectRecord = BaseEffectRecordFromTypes & EffectRecordMethods;
26
+ export interface ClaimableBalanceRecord extends HorizonApi.BaseResponse {
27
+ id: string;
28
+ paging_token: string;
29
+ asset: string;
30
+ amount: string;
31
+ sponsor?: string;
32
+ last_modified_ledger: number;
33
+ claimants: HorizonApi.Claimant[];
34
+ }
35
+ export interface AccountRecord extends HorizonApi.BaseResponse {
36
+ id: string;
37
+ paging_token: string;
38
+ account_id: string;
39
+ sequence: string;
40
+ sequence_ledger?: number;
41
+ sequence_time?: string;
42
+ subentry_count: number;
43
+ home_domain?: string;
44
+ inflation_destination?: string;
45
+ last_modified_ledger: number;
46
+ last_modified_time: string;
47
+ thresholds: HorizonApi.AccountThresholds;
48
+ flags: HorizonApi.Flags;
49
+ balances: HorizonApi.BalanceLine[];
50
+ signers: AccountRecordSigners[];
51
+ data: (options: {
52
+ value: string;
53
+ }) => Promise<{
54
+ value: string;
55
+ }>;
56
+ data_attr: {
57
+ [key: string]: string;
58
+ };
59
+ sponsor?: string;
60
+ num_sponsoring: number;
61
+ num_sponsored: number;
62
+ effects: CallCollectionFunction<EffectRecord>;
63
+ offers: CallCollectionFunction<OfferRecord>;
64
+ operations: CallCollectionFunction<OperationRecord>;
65
+ payments: CallCollectionFunction<PaymentOperationRecord>;
66
+ trades: CallCollectionFunction<TradeRecord>;
67
+ }
68
+ export interface LiquidityPoolRecord extends HorizonApi.BaseResponse {
69
+ id: string;
70
+ paging_token: string;
71
+ fee_bp: number;
72
+ type: HorizonApi.LiquidityPoolType;
73
+ total_trustlines: string;
74
+ total_shares: string;
75
+ reserves: HorizonApi.Reserve[];
76
+ }
77
+ export enum TradeType {
78
+ all = "all",
79
+ liquidityPools = "liquidity_pool",
80
+ orderbook = "orderbook"
81
+ }
82
+ interface EffectRecordMethods {
83
+ operation?: CallFunction<OperationRecord>;
84
+ precedes?: CallFunction<EffectRecord>;
85
+ succeeds?: CallFunction<EffectRecord>;
86
+ }
87
+ export interface LedgerRecord extends HorizonApi.BaseResponse {
88
+ id: string;
89
+ paging_token: string;
90
+ hash: string;
91
+ prev_hash: string;
92
+ sequence: number;
93
+ successful_transaction_count: number;
94
+ failed_transaction_count: number;
95
+ operation_count: number;
96
+ tx_set_operation_count: number | null;
97
+ closed_at: string;
98
+ total_coins: string;
99
+ fee_pool: string;
100
+ max_tx_set_size: number;
101
+ protocol_version: number;
102
+ header_xdr: string;
103
+ base_fee_in_stroops: number;
104
+ base_reserve_in_stroops: number;
105
+ /**
106
+ * @deprecated This will be removed in the next major version: the property
107
+ * no longer exists on the Horizon API
108
+ */
109
+ transaction_count: number;
110
+ /**
111
+ * @deprecated This will be removed in the next major version: the property
112
+ * no longer exists on the Horizon API
113
+ */
114
+ base_fee: number;
115
+ /**
116
+ * @deprecated This will be removed in the next major version: the property
117
+ * no longer exists on the Horizon API
118
+ */
119
+ base_reserve: string;
120
+ effects: CallCollectionFunction<EffectRecord>;
121
+ operations: CallCollectionFunction<OperationRecord>;
122
+ self: CallFunction<LedgerRecord>;
123
+ transactions: CallCollectionFunction<TransactionRecord>;
124
+ }
125
+ import OperationResponseType = HorizonApi.OperationResponseType;
126
+ import OperationResponseTypeI = HorizonApi.OperationResponseTypeI;
127
+ export interface BaseOperationRecord<T extends OperationResponseType = OperationResponseType, TI extends OperationResponseTypeI = OperationResponseTypeI> extends HorizonApi.BaseOperationResponse<T, TI> {
128
+ self: CallFunction<OperationRecord>;
129
+ succeeds: CallFunction<OperationRecord>;
130
+ precedes: CallFunction<OperationRecord>;
131
+ effects: CallCollectionFunction<EffectRecord>;
132
+ transaction: CallFunction<TransactionRecord>;
133
+ }
134
+ export interface CreateAccountOperationRecord extends BaseOperationRecord<OperationResponseType.createAccount, OperationResponseTypeI.createAccount>, HorizonApi.CreateAccountOperationResponse {
135
+ }
136
+ export interface PaymentOperationRecord extends BaseOperationRecord<OperationResponseType.payment, OperationResponseTypeI.payment>, HorizonApi.PaymentOperationResponse {
137
+ sender: CallFunction<AccountRecord>;
138
+ receiver: CallFunction<AccountRecord>;
139
+ }
140
+ export interface PathPaymentOperationRecord extends BaseOperationRecord<OperationResponseType.pathPayment, OperationResponseTypeI.pathPayment>, HorizonApi.PathPaymentOperationResponse {
141
+ }
142
+ export interface PathPaymentStrictSendOperationRecord extends BaseOperationRecord<OperationResponseType.pathPaymentStrictSend, OperationResponseTypeI.pathPaymentStrictSend>, HorizonApi.PathPaymentStrictSendOperationResponse {
143
+ }
144
+ export interface ManageOfferOperationRecord extends BaseOperationRecord<OperationResponseType.manageOffer, OperationResponseTypeI.manageOffer>, HorizonApi.ManageOfferOperationResponse {
145
+ }
146
+ export interface PassiveOfferOperationRecord extends BaseOperationRecord<OperationResponseType.createPassiveOffer, OperationResponseTypeI.createPassiveOffer>, HorizonApi.PassiveOfferOperationResponse {
147
+ }
148
+ export interface SetOptionsOperationRecord extends BaseOperationRecord<OperationResponseType.setOptions, OperationResponseTypeI.setOptions>, HorizonApi.SetOptionsOperationResponse {
149
+ }
150
+ export interface ChangeTrustOperationRecord extends BaseOperationRecord<OperationResponseType.changeTrust, OperationResponseTypeI.changeTrust>, HorizonApi.ChangeTrustOperationResponse {
151
+ }
152
+ export interface AllowTrustOperationRecord extends BaseOperationRecord<OperationResponseType.allowTrust, OperationResponseTypeI.allowTrust>, HorizonApi.AllowTrustOperationResponse {
153
+ }
154
+ export interface AccountMergeOperationRecord extends BaseOperationRecord<OperationResponseType.accountMerge, OperationResponseTypeI.accountMerge>, HorizonApi.AccountMergeOperationResponse {
155
+ }
156
+ export interface InflationOperationRecord extends BaseOperationRecord<OperationResponseType.inflation, OperationResponseTypeI.inflation>, HorizonApi.InflationOperationResponse {
157
+ }
158
+ export interface ManageDataOperationRecord extends BaseOperationRecord<OperationResponseType.manageData, OperationResponseTypeI.manageData>, HorizonApi.ManageDataOperationResponse {
159
+ }
160
+ export interface BumpSequenceOperationRecord extends BaseOperationRecord<OperationResponseType.bumpSequence, OperationResponseTypeI.bumpSequence>, HorizonApi.BumpSequenceOperationResponse {
161
+ }
162
+ export interface CreateClaimableBalanceOperationRecord extends BaseOperationRecord<OperationResponseType.createClaimableBalance, OperationResponseTypeI.createClaimableBalance>, HorizonApi.CreateClaimableBalanceOperationResponse {
163
+ }
164
+ export interface ClaimClaimableBalanceOperationRecord extends BaseOperationRecord<OperationResponseType.claimClaimableBalance, OperationResponseTypeI.claimClaimableBalance>, HorizonApi.ClaimClaimableBalanceOperationResponse {
165
+ }
166
+ export interface BeginSponsoringFutureReservesOperationRecord extends BaseOperationRecord<OperationResponseType.beginSponsoringFutureReserves, OperationResponseTypeI.beginSponsoringFutureReserves>, HorizonApi.BeginSponsoringFutureReservesOperationResponse {
167
+ }
168
+ export interface EndSponsoringFutureReservesOperationRecord extends BaseOperationRecord<OperationResponseType.endSponsoringFutureReserves, OperationResponseTypeI.endSponsoringFutureReserves>, HorizonApi.EndSponsoringFutureReservesOperationResponse {
169
+ }
170
+ export interface RevokeSponsorshipOperationRecord extends BaseOperationRecord<OperationResponseType.revokeSponsorship, OperationResponseTypeI.revokeSponsorship>, HorizonApi.RevokeSponsorshipOperationResponse {
171
+ }
172
+ export interface ClawbackOperationRecord extends BaseOperationRecord<OperationResponseType.clawback, OperationResponseTypeI.clawback>, HorizonApi.ClawbackOperationResponse {
173
+ }
174
+ export interface ClawbackClaimableBalanceOperationRecord extends BaseOperationRecord<OperationResponseType.clawbackClaimableBalance, OperationResponseTypeI.clawbackClaimableBalance>, HorizonApi.ClawbackClaimableBalanceOperationResponse {
175
+ }
176
+ export interface SetTrustLineFlagsOperationRecord extends BaseOperationRecord<OperationResponseType.setTrustLineFlags, OperationResponseTypeI.setTrustLineFlags>, HorizonApi.SetTrustLineFlagsOperationResponse {
177
+ }
178
+ export interface DepositLiquidityOperationRecord extends BaseOperationRecord<OperationResponseType.liquidityPoolDeposit, OperationResponseTypeI.liquidityPoolDeposit>, HorizonApi.DepositLiquidityOperationResponse {
179
+ }
180
+ export interface WithdrawLiquidityOperationRecord extends BaseOperationRecord<OperationResponseType.liquidityPoolWithdraw, OperationResponseTypeI.liquidityPoolWithdraw>, HorizonApi.WithdrawLiquidityOperationResponse {
181
+ }
182
+ export interface InvokeHostFunctionOperationRecord extends BaseOperationRecord<OperationResponseType.invokeHostFunction, OperationResponseTypeI.invokeHostFunction>, HorizonApi.InvokeHostFunctionOperationResponse {
183
+ }
184
+ export interface BumpFootprintExpirationOperationRecord extends BaseOperationRecord<OperationResponseType.bumpFootprintExpiration, OperationResponseTypeI.bumpFootprintExpiration>, HorizonApi.BumpFootprintExpirationOperationResponse {
185
+ }
186
+ export interface RestoreFootprintOperationRecord extends BaseOperationRecord<OperationResponseType.restoreFootprint, OperationResponseTypeI.restoreFootprint>, HorizonApi.RestoreFootprintOperationResponse {
187
+ }
188
+ export type OperationRecord = CreateAccountOperationRecord | PaymentOperationRecord | PathPaymentOperationRecord | ManageOfferOperationRecord | PassiveOfferOperationRecord | SetOptionsOperationRecord | ChangeTrustOperationRecord | AllowTrustOperationRecord | AccountMergeOperationRecord | InflationOperationRecord | ManageDataOperationRecord | BumpSequenceOperationRecord | PathPaymentStrictSendOperationRecord | CreateClaimableBalanceOperationRecord | ClaimClaimableBalanceOperationRecord | BeginSponsoringFutureReservesOperationRecord | EndSponsoringFutureReservesOperationRecord | RevokeSponsorshipOperationRecord | ClawbackClaimableBalanceOperationRecord | ClawbackOperationRecord | SetTrustLineFlagsOperationRecord | DepositLiquidityOperationRecord | WithdrawLiquidityOperationRecord | InvokeHostFunctionOperationRecord | BumpFootprintExpirationOperationRecord | RestoreFootprintOperationRecord;
189
+ export namespace TradeRecord {
190
+ interface Base extends HorizonApi.BaseResponse {
191
+ id: string;
192
+ paging_token: string;
193
+ ledger_close_time: string;
194
+ trade_type: TradeType;
195
+ base_account?: string;
196
+ base_amount: string;
197
+ base_asset_type: string;
198
+ base_asset_code?: string;
199
+ base_asset_issuer?: string;
200
+ counter_account?: string;
201
+ counter_amount: string;
202
+ counter_asset_type: string;
203
+ counter_asset_code?: string;
204
+ counter_asset_issuer?: string;
205
+ base_is_seller: boolean;
206
+ price?: {
207
+ n: string;
208
+ d: string;
209
+ };
210
+ operation: CallFunction<OperationRecord>;
211
+ }
212
+ export interface Orderbook extends Base {
213
+ trade_type: TradeType.orderbook;
214
+ base_offer_id: string;
215
+ base_account: string;
216
+ counter_offer_id: string;
217
+ counter_account: string;
218
+ base: CallFunction<AccountRecord>;
219
+ counter: CallFunction<AccountRecord>;
220
+ }
221
+ export interface LiquidityPool extends Base {
222
+ trade_type: TradeType.liquidityPools;
223
+ base_liquidity_pool_id?: string;
224
+ counter_liquidity_pool_id?: string;
225
+ liquidity_pool_fee_bp: number;
226
+ base: CallFunction<AccountRecord | LiquidityPoolRecord>;
227
+ counter: CallFunction<AccountRecord | LiquidityPoolRecord>;
228
+ }
229
+ export {};
230
+ }
231
+ export type TradeRecord = TradeRecord.Orderbook | TradeRecord.LiquidityPool;
232
+ export interface TransactionRecord extends Omit<HorizonApi.TransactionResponse, "ledger"> {
233
+ ledger_attr: HorizonApi.TransactionResponse["ledger"];
234
+ account: CallFunction<AccountRecord>;
235
+ effects: CallCollectionFunction<EffectRecord>;
236
+ ledger: CallFunction<LedgerRecord>;
237
+ operations: CallCollectionFunction<OperationRecord>;
238
+ precedes: CallFunction<TransactionRecord>;
239
+ self: CallFunction<TransactionRecord>;
240
+ succeeds: CallFunction<TransactionRecord>;
241
+ }
242
+ export interface OrderbookRecord extends HorizonApi.BaseResponse {
243
+ bids: Array<{
244
+ price_r: {
245
+ d: number;
246
+ n: number;
247
+ };
248
+ price: string;
249
+ amount: string;
250
+ }>;
251
+ asks: Array<{
252
+ price_r: {
253
+ d: number;
254
+ n: number;
255
+ };
256
+ price: string;
257
+ amount: string;
258
+ }>;
259
+ base: Asset;
260
+ counter: Asset;
261
+ }
262
+ export interface PaymentPathRecord extends HorizonApi.BaseResponse {
263
+ path: Array<{
264
+ asset_code: string;
265
+ asset_issuer: string;
266
+ asset_type: string;
267
+ }>;
268
+ source_amount: string;
269
+ source_asset_type: string;
270
+ source_asset_code: string;
271
+ source_asset_issuer: string;
272
+ destination_amount: string;
273
+ destination_asset_type: string;
274
+ destination_asset_code: string;
275
+ destination_asset_issuer: string;
276
+ }
277
+ export {};
278
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ServerApi = void 0;
7
+ var _horizon_api = require("./horizon_api");
8
+ var ServerApi;
9
+ (function (_ServerApi) {
10
+ var TradeType = function (TradeType) {
11
+ TradeType["all"] = "all";
12
+ TradeType["liquidityPools"] = "liquidity_pool";
13
+ TradeType["orderbook"] = "orderbook";
14
+ return TradeType;
15
+ }({});
16
+ _ServerApi.TradeType = TradeType;
17
+ var OperationResponseType = _horizon_api.HorizonApi.OperationResponseType;
18
+ var OperationResponseTypeI = _horizon_api.HorizonApi.OperationResponseTypeI;
19
+ })(ServerApi || (exports.ServerApi = ServerApi = {}));
@@ -0,0 +1,33 @@
1
+ import { Asset } from "@stellar/stellar-base";
2
+ import { CallBuilder } from "./call_builder";
3
+ import { ServerApi } from "./server_api";
4
+ /**
5
+ * The Stellar Network allows payments to be made across assets through path
6
+ * payments. A strict receive path payment specifies a series of assets to route
7
+ * a payment through, from source asset (the asset debited from the payer) to
8
+ * destination asset (the asset credited to the payee).
9
+ *
10
+ * A path search is specified using:
11
+ *
12
+ * * The source address or source assets.
13
+ * * The asset and amount that the destination account should receive
14
+ *
15
+ * As part of the search, horizon will load a list of assets available to the
16
+ * source address and will find any payment paths from those source assets to
17
+ * the desired destination asset. The search's amount parameter will be used to
18
+ * determine if there a given path can satisfy a payment of the desired amount.
19
+ *
20
+ * If a list of assets is passed as the source, horizon will find any payment
21
+ * paths from those source assets to the desired destination asset.
22
+ *
23
+ * Do not create this object directly, use {@link Server#strictReceivePaths}.
24
+ * @see [Find Payment Paths](https://developers.stellar.org/api/aggregations/paths/)
25
+ * @augments CallBuilder
26
+ * @param {string} serverUrl Horizon server URL.
27
+ * @param {string|Asset[]} source The sender's account ID or a list of Assets. Any returned path must use a source that the sender can hold.
28
+ * @param {Asset} destinationAsset The destination asset.
29
+ * @param {string} destinationAmount The amount, denominated in the destination asset, that any returned path should be able to satisfy.
30
+ */
31
+ export declare class StrictReceivePathCallBuilder extends CallBuilder<ServerApi.CollectionPage<ServerApi.PaymentPathRecord>> {
32
+ constructor(serverUrl: URI, source: string | Asset[], destinationAsset: Asset, destinationAmount: string);
33
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.StrictReceivePathCallBuilder = void 0;
8
+ var _call_builder = require("./call_builder");
9
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
10
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
11
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
12
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
13
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
14
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
15
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
16
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
17
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
18
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
19
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
20
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
21
+ var StrictReceivePathCallBuilder = exports.StrictReceivePathCallBuilder = function (_CallBuilder) {
22
+ function StrictReceivePathCallBuilder(serverUrl, source, destinationAsset, destinationAmount) {
23
+ var _this;
24
+ _classCallCheck(this, StrictReceivePathCallBuilder);
25
+ _this = _callSuper(this, StrictReceivePathCallBuilder, [serverUrl]);
26
+ _this.url.segment("paths/strict-receive");
27
+ if (typeof source === "string") {
28
+ _this.url.setQuery("source_account", source);
29
+ } else {
30
+ var assets = source.map(function (asset) {
31
+ if (asset.isNative()) {
32
+ return "native";
33
+ }
34
+ return "".concat(asset.getCode(), ":").concat(asset.getIssuer());
35
+ }).join(",");
36
+ _this.url.setQuery("source_assets", assets);
37
+ }
38
+ _this.url.setQuery("destination_amount", destinationAmount);
39
+ if (!destinationAsset.isNative()) {
40
+ _this.url.setQuery("destination_asset_type", destinationAsset.getAssetType());
41
+ _this.url.setQuery("destination_asset_code", destinationAsset.getCode());
42
+ _this.url.setQuery("destination_asset_issuer", destinationAsset.getIssuer());
43
+ } else {
44
+ _this.url.setQuery("destination_asset_type", "native");
45
+ }
46
+ return _this;
47
+ }
48
+ _inherits(StrictReceivePathCallBuilder, _CallBuilder);
49
+ return _createClass(StrictReceivePathCallBuilder);
50
+ }(_call_builder.CallBuilder);
@@ -0,0 +1,33 @@
1
+ import { Asset } from "@stellar/stellar-base";
2
+ import { CallBuilder } from "./call_builder";
3
+ import { ServerApi } from "./server_api";
4
+ /**
5
+ * The Stellar Network allows payments to be made across assets through path
6
+ * payments. A strict send path payment specifies a series of assets to route a
7
+ * payment through, from source asset (the asset debited from the payer) to
8
+ * destination asset (the asset credited to the payee).
9
+ *
10
+ * A strict send path search is specified using:
11
+ *
12
+ * The source asset
13
+ * The source amount
14
+ * The destination assets or destination account.
15
+ *
16
+ * As part of the search, horizon will load a list of assets available to the
17
+ * source address and will find any payment paths from those source assets to
18
+ * the desired destination asset. The search's source_amount parameter will be
19
+ * used to determine if there a given path can satisfy a payment of the desired
20
+ * amount.
21
+ *
22
+ * Do not create this object directly, use {@link Server#strictSendPaths}.
23
+ * @see [Find Payment Paths](https://developers.stellar.org/api/aggregations/paths/)
24
+ * @augments CallBuilder
25
+ * @param {string} serverUrl Horizon server URL.
26
+ * @param {Asset} sourceAsset The asset to be sent.
27
+ * @param {string} sourceAmount The amount, denominated in the source asset, that any returned path should be able to satisfy.
28
+ * @param {string|Asset[]} destination The destination account or the destination assets.
29
+ *
30
+ */
31
+ export declare class StrictSendPathCallBuilder extends CallBuilder<ServerApi.CollectionPage<ServerApi.PaymentPathRecord>> {
32
+ constructor(serverUrl: URI, sourceAsset: Asset, sourceAmount: string, destination: string | Asset[]);
33
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.StrictSendPathCallBuilder = void 0;
8
+ var _call_builder = require("./call_builder");
9
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
10
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
11
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
12
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
13
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
14
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
15
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
16
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
17
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
18
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
19
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
20
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
21
+ var StrictSendPathCallBuilder = exports.StrictSendPathCallBuilder = function (_CallBuilder) {
22
+ function StrictSendPathCallBuilder(serverUrl, sourceAsset, sourceAmount, destination) {
23
+ var _this;
24
+ _classCallCheck(this, StrictSendPathCallBuilder);
25
+ _this = _callSuper(this, StrictSendPathCallBuilder, [serverUrl]);
26
+ _this.url.segment("paths/strict-send");
27
+ if (sourceAsset.isNative()) {
28
+ _this.url.setQuery("source_asset_type", "native");
29
+ } else {
30
+ _this.url.setQuery("source_asset_type", sourceAsset.getAssetType());
31
+ _this.url.setQuery("source_asset_code", sourceAsset.getCode());
32
+ _this.url.setQuery("source_asset_issuer", sourceAsset.getIssuer());
33
+ }
34
+ _this.url.setQuery("source_amount", sourceAmount);
35
+ if (typeof destination === "string") {
36
+ _this.url.setQuery("destination_account", destination);
37
+ } else {
38
+ var assets = destination.map(function (asset) {
39
+ if (asset.isNative()) {
40
+ return "native";
41
+ }
42
+ return "".concat(asset.getCode(), ":").concat(asset.getIssuer());
43
+ }).join(",");
44
+ _this.url.setQuery("destination_assets", assets);
45
+ }
46
+ return _this;
47
+ }
48
+ _inherits(StrictSendPathCallBuilder, _CallBuilder);
49
+ return _createClass(StrictSendPathCallBuilder);
50
+ }(_call_builder.CallBuilder);
@@ -0,0 +1,47 @@
1
+ import { Asset } from "@stellar/stellar-base";
2
+ import { CallBuilder } from "./call_builder";
3
+ import { HorizonApi } from "./horizon_api";
4
+ import { ServerApi } from "./server_api";
5
+ /**
6
+ * Trade Aggregations facilitate efficient gathering of historical trade data.
7
+ * Do not create this object directly, use {@link Server#tradeAggregation}.
8
+ *
9
+ * @class TradeAggregationCallBuilder
10
+ * @augments CallBuilder
11
+ * @class
12
+ * @param {string} serverUrl serverUrl Horizon server URL.
13
+ * @param {Asset} base base asset
14
+ * @param {Asset} counter counter asset
15
+ * @param {number} start_time lower time boundary represented as millis since epoch
16
+ * @param {number} end_time upper time boundary represented as millis since epoch
17
+ * @param {number} resolution segment duration as millis since epoch. *Supported values are 1 minute (60000), 5 minutes (300000), 15 minutes (900000), 1 hour (3600000), 1 day (86400000) and 1 week (604800000).
18
+ * @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.
19
+ */
20
+ export declare class TradeAggregationCallBuilder extends CallBuilder<ServerApi.CollectionPage<TradeAggregationRecord>> {
21
+ constructor(serverUrl: URI, base: Asset, counter: Asset, start_time: number, end_time: number, resolution: number, offset: number);
22
+ /**
23
+ * @private
24
+ * @param {number} resolution Trade data resolution in milliseconds
25
+ * @returns {boolean} true if the resolution is allowed
26
+ */
27
+ private isValidResolution;
28
+ /**
29
+ * @private
30
+ * @param {number} offset Time offset in milliseconds
31
+ * @param {number} resolution Trade data resolution in milliseconds
32
+ * @returns {boolean} true if the offset is valid
33
+ */
34
+ private isValidOffset;
35
+ }
36
+ interface TradeAggregationRecord extends HorizonApi.BaseResponse {
37
+ timestamp: number | string;
38
+ trade_count: number | string;
39
+ base_volume: string;
40
+ counter_volume: string;
41
+ avg: string;
42
+ high: string;
43
+ low: string;
44
+ open: string;
45
+ close: string;
46
+ }
47
+ export {};
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.TradeAggregationCallBuilder = void 0;
8
+ var _call_builder = require("./call_builder");
9
+ var _errors = require("../errors");
10
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
11
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
12
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
13
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
14
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
15
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
16
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
17
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
18
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
19
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
20
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
21
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
22
+ var allowedResolutions = [60000, 300000, 900000, 3600000, 86400000, 604800000];
23
+ var TradeAggregationCallBuilder = exports.TradeAggregationCallBuilder = function (_CallBuilder) {
24
+ function TradeAggregationCallBuilder(serverUrl, base, counter, start_time, end_time, resolution, offset) {
25
+ var _this;
26
+ _classCallCheck(this, TradeAggregationCallBuilder);
27
+ _this = _callSuper(this, TradeAggregationCallBuilder, [serverUrl]);
28
+ _this.url.segment("trade_aggregations");
29
+ if (!base.isNative()) {
30
+ _this.url.setQuery("base_asset_type", base.getAssetType());
31
+ _this.url.setQuery("base_asset_code", base.getCode());
32
+ _this.url.setQuery("base_asset_issuer", base.getIssuer());
33
+ } else {
34
+ _this.url.setQuery("base_asset_type", "native");
35
+ }
36
+ if (!counter.isNative()) {
37
+ _this.url.setQuery("counter_asset_type", counter.getAssetType());
38
+ _this.url.setQuery("counter_asset_code", counter.getCode());
39
+ _this.url.setQuery("counter_asset_issuer", counter.getIssuer());
40
+ } else {
41
+ _this.url.setQuery("counter_asset_type", "native");
42
+ }
43
+ if (typeof start_time !== "number" || typeof end_time !== "number") {
44
+ throw new _errors.BadRequestError("Invalid time bounds", [start_time, end_time]);
45
+ } else {
46
+ _this.url.setQuery("start_time", start_time.toString());
47
+ _this.url.setQuery("end_time", end_time.toString());
48
+ }
49
+ if (!_this.isValidResolution(resolution)) {
50
+ throw new _errors.BadRequestError("Invalid resolution", resolution);
51
+ } else {
52
+ _this.url.setQuery("resolution", resolution.toString());
53
+ }
54
+ if (!_this.isValidOffset(offset, resolution)) {
55
+ throw new _errors.BadRequestError("Invalid offset", offset);
56
+ } else {
57
+ _this.url.setQuery("offset", offset.toString());
58
+ }
59
+ return _this;
60
+ }
61
+ _inherits(TradeAggregationCallBuilder, _CallBuilder);
62
+ return _createClass(TradeAggregationCallBuilder, [{
63
+ key: "isValidResolution",
64
+ value: function isValidResolution(resolution) {
65
+ return allowedResolutions.some(function (allowed) {
66
+ return allowed === resolution;
67
+ });
68
+ }
69
+ }, {
70
+ key: "isValidOffset",
71
+ value: function isValidOffset(offset, resolution) {
72
+ var hour = 3600000;
73
+ return !(offset > resolution || offset >= 24 * hour || offset % hour !== 0);
74
+ }
75
+ }]);
76
+ }(_call_builder.CallBuilder);
@@ -0,0 +1,49 @@
1
+ import { Asset } from "@stellar/stellar-base";
2
+ import { CallBuilder } from "./call_builder";
3
+ import { ServerApi } from "./server_api";
4
+ /**
5
+ * Creates a new {@link TradesCallBuilder} pointed to server defined by serverUrl.
6
+ * Do not create this object directly, use {@link Server#trades}.
7
+ *
8
+ * @class TradesCallBuilder
9
+ * @augments CallBuilder
10
+ * @class
11
+ * @see [Trades](https://developers.stellar.org/api/resources/trades/)
12
+ * @param {string} serverUrl serverUrl Horizon server URL.
13
+ */
14
+ export declare class TradesCallBuilder extends CallBuilder<ServerApi.CollectionPage<ServerApi.TradeRecord>> {
15
+ constructor(serverUrl: URI);
16
+ /**
17
+ * Filter trades for a specific asset pair (orderbook)
18
+ * @param {Asset} base asset
19
+ * @param {Asset} counter asset
20
+ * @returns {TradesCallBuilder} current TradesCallBuilder instance
21
+ */
22
+ forAssetPair(base: Asset, counter: Asset): this;
23
+ /**
24
+ * Filter trades for a specific offer
25
+ * @param {string} offerId ID of the offer
26
+ * @returns {TradesCallBuilder} current TradesCallBuilder instance
27
+ */
28
+ forOffer(offerId: string): this;
29
+ /**
30
+ * Filter trades by a specific type.
31
+ * @param {ServerApi.TradeType} tradeType the trade type to filter by.
32
+ * @returns {TradesCallBuilder} current TradesCallBuilder instance.
33
+ */
34
+ forType(tradeType: ServerApi.TradeType): this;
35
+ /**
36
+ * Filter trades for a specific account
37
+ * @see [Trades for Account](https://developers.stellar.org/api/resources/accounts/trades/)
38
+ * @param {string} accountId For example: `GBYTR4MC5JAX4ALGUBJD7EIKZVM7CUGWKXIUJMRSMK573XH2O7VAK3SR`
39
+ * @returns {TradesCallBuilder} current TradesCallBuilder instance
40
+ */
41
+ forAccount(accountId: string): this;
42
+ /**
43
+ * Filter trades for a specific liquidity pool
44
+ * @see [Trades for Liquidity Pool](https://developers.stellar.org/api/resources/liquiditypools/trades/)
45
+ * @param {string} liquidityPoolId For example: `3b476aff8a406a6ec3b61d5c038009cef85f2ddfaf616822dc4fec92845149b4`
46
+ * @returns {TradesCallBuilder} current TradesCallBuilder instance
47
+ */
48
+ forLiquidityPool(liquidityPoolId: string): this;
49
+ }