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