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,72 @@
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.TradesCallBuilder = 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 TradesCallBuilder = exports.TradesCallBuilder = function (_CallBuilder) {
22
+ function TradesCallBuilder(serverUrl) {
23
+ var _this;
24
+ _classCallCheck(this, TradesCallBuilder);
25
+ _this = _callSuper(this, TradesCallBuilder, [serverUrl, "trades"]);
26
+ _this.url.segment("trades");
27
+ return _this;
28
+ }
29
+ _inherits(TradesCallBuilder, _CallBuilder);
30
+ return _createClass(TradesCallBuilder, [{
31
+ key: "forAssetPair",
32
+ value: function forAssetPair(base, counter) {
33
+ if (!base.isNative()) {
34
+ this.url.setQuery("base_asset_type", base.getAssetType());
35
+ this.url.setQuery("base_asset_code", base.getCode());
36
+ this.url.setQuery("base_asset_issuer", base.getIssuer());
37
+ } else {
38
+ this.url.setQuery("base_asset_type", "native");
39
+ }
40
+ if (!counter.isNative()) {
41
+ this.url.setQuery("counter_asset_type", counter.getAssetType());
42
+ this.url.setQuery("counter_asset_code", counter.getCode());
43
+ this.url.setQuery("counter_asset_issuer", counter.getIssuer());
44
+ } else {
45
+ this.url.setQuery("counter_asset_type", "native");
46
+ }
47
+ return this;
48
+ }
49
+ }, {
50
+ key: "forOffer",
51
+ value: function forOffer(offerId) {
52
+ this.url.setQuery("offer_id", offerId);
53
+ return this;
54
+ }
55
+ }, {
56
+ key: "forType",
57
+ value: function forType(tradeType) {
58
+ this.url.setQuery("trade_type", tradeType);
59
+ return this;
60
+ }
61
+ }, {
62
+ key: "forAccount",
63
+ value: function forAccount(accountId) {
64
+ return this.forEndpoint("accounts", accountId);
65
+ }
66
+ }, {
67
+ key: "forLiquidityPool",
68
+ value: function forLiquidityPool(liquidityPoolId) {
69
+ return this.forEndpoint("liquidity_pools", liquidityPoolId);
70
+ }
71
+ }]);
72
+ }(_call_builder.CallBuilder);
@@ -0,0 +1,57 @@
1
+ import { CallBuilder } from "./call_builder";
2
+ import { ServerApi } from "./server_api";
3
+ /**
4
+ * Creates a new {@link TransactionCallBuilder} pointed to server defined by serverUrl.
5
+ * Do not create this object directly, use {@link Server#transactions}.
6
+ *
7
+ * @class TransactionCallBuilder
8
+ * @augments CallBuilder
9
+ * @see [All Transactions](https://developers.stellar.org/api/resources/transactions/)
10
+ * @class
11
+ * @param {string} serverUrl Horizon server URL.
12
+ */
13
+ export declare class TransactionCallBuilder extends CallBuilder<ServerApi.CollectionPage<ServerApi.TransactionRecord>> {
14
+ constructor(serverUrl: URI);
15
+ /**
16
+ * The transaction details endpoint provides information on a single transaction. The transaction hash provided in the hash argument specifies which transaction to load.
17
+ * @see [Transaction Details](https://developers.stellar.org/api/resources/transactions/single/)
18
+ * @param {string} transactionId Transaction ID
19
+ * @returns {CallBuilder} a CallBuilder instance
20
+ */
21
+ transaction(transactionId: string): CallBuilder<ServerApi.TransactionRecord>;
22
+ /**
23
+ * This endpoint represents all transactions that affected a given account.
24
+ * @see [Transactions for Account](https://developers.stellar.org/api/resources/accounts/transactions/)
25
+ * @param {string} accountId For example: `GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD`
26
+ * @returns {TransactionCallBuilder} current TransactionCallBuilder instance
27
+ */
28
+ forAccount(accountId: string): this;
29
+ /**
30
+ * This endpoint represents all transactions that reference a given claimable_balance.
31
+ * @see [Operations for Claimable Balance](https://developers.stellar.org/api/resources/claimablebalances/transactions/)
32
+ * @param {string} claimableBalanceId Claimable Balance ID
33
+ * @returns {TransactionCallBuilder} this TransactionCallBuilder instance
34
+ */
35
+ forClaimableBalance(claimableBalanceId: string): this;
36
+ /**
37
+ * This endpoint represents all transactions in a given ledger.
38
+ * @see [Transactions for Ledger](https://developers.stellar.org/api/resources/ledgers/transactions/)
39
+ * @param {number|string} sequence Ledger sequence
40
+ * @returns {TransactionCallBuilder} current TransactionCallBuilder instance
41
+ */
42
+ forLedger(sequence: number | string): this;
43
+ /**
44
+ * This endpoint represents all transactions involving a particular liquidity pool.
45
+ *
46
+ * @param {string} poolId liquidity pool ID
47
+ * @returns {TransactionCallBuilder} this TransactionCallBuilder instance
48
+ */
49
+ forLiquidityPool(poolId: string): this;
50
+ /**
51
+ * Adds a parameter defining whether to include failed transactions. By default only successful transactions are
52
+ * returned.
53
+ * @param {boolean} value Set to `true` to include failed transactions.
54
+ * @returns {TransactionCallBuilder} current TransactionCallBuilder instance
55
+ */
56
+ includeFailed(value: boolean): this;
57
+ }
@@ -0,0 +1,64 @@
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.TransactionCallBuilder = 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 TransactionCallBuilder = exports.TransactionCallBuilder = function (_CallBuilder) {
22
+ function TransactionCallBuilder(serverUrl) {
23
+ var _this;
24
+ _classCallCheck(this, TransactionCallBuilder);
25
+ _this = _callSuper(this, TransactionCallBuilder, [serverUrl, "transactions"]);
26
+ _this.url.segment("transactions");
27
+ return _this;
28
+ }
29
+ _inherits(TransactionCallBuilder, _CallBuilder);
30
+ return _createClass(TransactionCallBuilder, [{
31
+ key: "transaction",
32
+ value: function transaction(transactionId) {
33
+ var builder = new _call_builder.CallBuilder(this.url.clone());
34
+ builder.filter.push([transactionId]);
35
+ return builder;
36
+ }
37
+ }, {
38
+ key: "forAccount",
39
+ value: function forAccount(accountId) {
40
+ return this.forEndpoint("accounts", accountId);
41
+ }
42
+ }, {
43
+ key: "forClaimableBalance",
44
+ value: function forClaimableBalance(claimableBalanceId) {
45
+ return this.forEndpoint("claimable_balances", claimableBalanceId);
46
+ }
47
+ }, {
48
+ key: "forLedger",
49
+ value: function forLedger(sequence) {
50
+ return this.forEndpoint("ledgers", sequence.toString());
51
+ }
52
+ }, {
53
+ key: "forLiquidityPool",
54
+ value: function forLiquidityPool(poolId) {
55
+ return this.forEndpoint("liquidity_pools", poolId);
56
+ }
57
+ }, {
58
+ key: "includeFailed",
59
+ value: function includeFailed(value) {
60
+ this.url.setQuery("include_failed", value.toString());
61
+ return this;
62
+ }
63
+ }]);
64
+ }(_call_builder.CallBuilder);
@@ -0,0 +1,5 @@
1
+ export interface AccountRecordSigners {
2
+ key: string;
3
+ weight: number;
4
+ type: string;
5
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,19 @@
1
+ import { AssetType } from "@stellar/stellar-base";
2
+ import { HorizonApi } from "../horizon_api";
3
+ export interface AssetRecord extends HorizonApi.BaseResponse {
4
+ asset_type: AssetType.credit4 | AssetType.credit12;
5
+ asset_code: string;
6
+ asset_issuer: string;
7
+ paging_token: string;
8
+ accounts: HorizonApi.AssetAccounts;
9
+ balances: HorizonApi.AssetBalances;
10
+ num_claimable_balances: number;
11
+ num_liquidity_pools: number;
12
+ num_contracts: number;
13
+ num_accounts: number;
14
+ amount: string;
15
+ claimable_balances_amount: string;
16
+ liquidity_pools_amount: string;
17
+ contracts_amount: string;
18
+ flags: HorizonApi.Flags;
19
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,285 @@
1
+ import { HorizonApi } from "../horizon_api";
2
+ import { OfferAsset } from "./offer";
3
+ export declare enum EffectType {
4
+ account_created = 0,
5
+ account_removed = 1,
6
+ account_credited = 2,
7
+ account_debited = 3,
8
+ account_thresholds_updated = 4,
9
+ account_home_domain_updated = 5,
10
+ account_flags_updated = 6,
11
+ account_inflation_destination_updated = 7,
12
+ signer_created = 10,
13
+ signer_removed = 11,
14
+ signer_updated = 12,
15
+ trustline_created = 20,
16
+ trustline_removed = 21,
17
+ trustline_updated = 22,
18
+ trustline_authorized = 23,
19
+ trustline_deauthorized = 24,
20
+ trustline_authorized_to_maintain_liabilities = 25,// deprecated, use trustline_flags_updated
21
+ trustline_flags_updated = 26,
22
+ offer_created = 30,
23
+ offer_removed = 31,
24
+ offer_updated = 32,
25
+ trade = 33,
26
+ data_created = 40,
27
+ data_removed = 41,
28
+ data_updated = 42,
29
+ sequence_bumped = 43,
30
+ claimable_balance_created = 50,
31
+ claimable_balance_claimant_created = 51,
32
+ claimable_balance_claimed = 52,
33
+ account_sponsorship_created = 60,
34
+ account_sponsorship_updated = 61,
35
+ account_sponsorship_removed = 62,
36
+ trustline_sponsorship_created = 63,
37
+ trustline_sponsorship_updated = 64,
38
+ trustline_sponsorship_removed = 65,
39
+ data_sponsorship_created = 66,
40
+ data_sponsorship_updated = 67,
41
+ data_sponsorship_removed = 68,
42
+ claimable_balance_sponsorship_created = 69,
43
+ claimable_balance_sponsorship_updated = 70,
44
+ claimable_balance_sponsorship_removed = 71,
45
+ signer_sponsorship_created = 72,
46
+ signer_sponsorship_updated = 73,
47
+ signer_sponsorship_removed = 74,
48
+ claimable_balance_clawed_back = 80,
49
+ liquidity_pool_deposited = 90,
50
+ liquidity_pool_withdrew = 91,
51
+ liquidity_pool_trade = 92,
52
+ liquidity_pool_created = 93,
53
+ liquidity_pool_removed = 94,
54
+ liquidity_pool_revoked = 95,
55
+ contract_credited = 96,
56
+ contract_debited = 97
57
+ }
58
+ export interface BaseEffectRecord extends HorizonApi.BaseResponse {
59
+ id: string;
60
+ account: string;
61
+ paging_token: string;
62
+ type_i: EffectType;
63
+ type: string;
64
+ created_at: string;
65
+ }
66
+ export interface AccountCreated extends BaseEffectRecord {
67
+ type_i: EffectType.account_created;
68
+ starting_balance: string;
69
+ }
70
+ export interface AccountCredited extends BaseEffectRecord, OfferAsset {
71
+ type_i: EffectType.account_credited;
72
+ amount: string;
73
+ }
74
+ export interface AccountDebited extends BaseEffectRecord {
75
+ type_i: EffectType.account_debited;
76
+ amount: string;
77
+ }
78
+ export interface AccountThresholdsUpdated extends BaseEffectRecord {
79
+ type_i: EffectType.account_thresholds_updated;
80
+ low_threshold: number;
81
+ med_threshold: number;
82
+ high_threshold: number;
83
+ }
84
+ export interface AccountHomeDomainUpdated extends BaseEffectRecord {
85
+ type_i: EffectType.account_home_domain_updated;
86
+ home_domain: string;
87
+ }
88
+ export interface AccountFlagsUpdated extends BaseEffectRecord {
89
+ type_i: EffectType.account_flags_updated;
90
+ auth_required_flag: boolean;
91
+ auth_revokable_flag: boolean;
92
+ }
93
+ interface DataEvents extends BaseEffectRecord {
94
+ name: boolean;
95
+ value: boolean;
96
+ }
97
+ export interface DataCreated extends DataEvents {
98
+ type_i: EffectType.data_created;
99
+ }
100
+ export interface DataUpdated extends DataEvents {
101
+ type_i: EffectType.data_updated;
102
+ }
103
+ export interface DataRemoved extends DataEvents {
104
+ type_i: EffectType.data_removed;
105
+ }
106
+ export interface SequenceBumped extends BaseEffectRecord {
107
+ type_i: EffectType.sequence_bumped;
108
+ new_seq: number | string;
109
+ }
110
+ interface SignerEvents extends BaseEffectRecord {
111
+ weight: number;
112
+ key: string;
113
+ public_key: string;
114
+ }
115
+ export interface SignerCreated extends SignerEvents {
116
+ type_i: EffectType.signer_created;
117
+ }
118
+ export interface SignerRemoved extends SignerEvents {
119
+ type_i: EffectType.signer_removed;
120
+ }
121
+ export interface SignerUpdated extends SignerEvents {
122
+ type_i: EffectType.signer_updated;
123
+ }
124
+ interface TrustlineEvents extends BaseEffectRecord, OfferAsset {
125
+ limit: string;
126
+ liquidity_pool_id?: string;
127
+ }
128
+ export interface TrustlineCreated extends TrustlineEvents {
129
+ type_i: EffectType.trustline_created;
130
+ }
131
+ export interface TrustlineRemoved extends TrustlineEvents {
132
+ type_i: EffectType.trustline_removed;
133
+ }
134
+ export interface TrustlineUpdated extends TrustlineEvents {
135
+ type_i: EffectType.trustline_updated;
136
+ }
137
+ export interface TrustlineAuthorized extends BaseEffectRecord {
138
+ type_i: EffectType.trustline_authorized;
139
+ asset_type: OfferAsset["asset_type"];
140
+ asset_code: OfferAsset["asset_code"];
141
+ trustor: string;
142
+ }
143
+ export interface TrustlineDeauthorized extends Omit<TrustlineAuthorized, "type_i"> {
144
+ type_i: EffectType.trustline_deauthorized;
145
+ }
146
+ export interface TrustlineAuthorizedToMaintainLiabilities extends Omit<TrustlineAuthorized, "type_i"> {
147
+ type_i: EffectType.trustline_authorized_to_maintain_liabilities;
148
+ }
149
+ export interface ClaimableBalanceCreated extends BaseEffectRecord {
150
+ type_i: EffectType.claimable_balance_created;
151
+ amount: string;
152
+ balance_type_i: string;
153
+ asset: string;
154
+ }
155
+ export interface ClaimableBalanceClaimed extends Omit<ClaimableBalanceCreated, "type_i"> {
156
+ type_i: EffectType.claimable_balance_claimed;
157
+ }
158
+ export interface ClaimableBalanceClaimantCreated extends Omit<ClaimableBalanceCreated, "type_i"> {
159
+ type_i: EffectType.claimable_balance_claimant_created;
160
+ }
161
+ interface SponsershipFields {
162
+ sponsor: string;
163
+ new_sponsor: string;
164
+ former_sponsor: string;
165
+ }
166
+ interface AccountSponsorshipEvents extends BaseEffectRecord, SponsershipFields {
167
+ }
168
+ export type AccountSponsorshipCreated = Omit<AccountSponsorshipEvents, "new_sponsor" | "former_sponsor"> & {
169
+ type_i: EffectType.account_sponsorship_created;
170
+ };
171
+ export type AccountSponsorshipUpdated = Omit<AccountSponsorshipEvents, "sponsor"> & {
172
+ type_i: EffectType.account_sponsorship_updated;
173
+ };
174
+ export type AccountSponsorshipRemoved = Omit<AccountSponsorshipEvents, "new_sponsor" | "sponsor"> & {
175
+ type_i: EffectType.account_sponsorship_removed;
176
+ };
177
+ interface TrustlineSponsorshipEvents extends BaseEffectRecord, SponsershipFields {
178
+ asset?: string;
179
+ liquidity_pool_id?: string;
180
+ }
181
+ export type TrustlineSponsorshipCreated = Omit<TrustlineSponsorshipEvents, "new_sponsor" | "former_sponsor"> & {
182
+ type_i: EffectType.trustline_sponsorship_created;
183
+ };
184
+ export type TrustlineSponsorshipUpdated = Omit<TrustlineSponsorshipEvents, "sponsor"> & {
185
+ type_i: EffectType.trustline_sponsorship_updated;
186
+ };
187
+ export type TrustlineSponsorshipRemoved = Omit<TrustlineSponsorshipEvents, "new_sponsor" | "sponsor"> & {
188
+ type_i: EffectType.trustline_sponsorship_removed;
189
+ };
190
+ interface DataSponsorshipEvents extends BaseEffectRecord, SponsershipFields {
191
+ data_name: string;
192
+ }
193
+ export type DateSponsorshipCreated = Omit<DataSponsorshipEvents, "new_sponsor" | "former_sponsor"> & {
194
+ type_i: EffectType.data_sponsorship_created;
195
+ };
196
+ export type DateSponsorshipUpdated = Omit<DataSponsorshipEvents, "sponsor"> & {
197
+ type_i: EffectType.data_sponsorship_updated;
198
+ };
199
+ export type DateSponsorshipRemoved = Omit<DataSponsorshipEvents, "new_sponsor" | "sponsor"> & {
200
+ type_i: EffectType.data_sponsorship_removed;
201
+ };
202
+ interface ClaimableBalanceSponsorshipEvents extends BaseEffectRecord, SponsershipFields {
203
+ balance_type_i: string;
204
+ }
205
+ export type ClaimableBalanceSponsorshipCreated = Omit<ClaimableBalanceSponsorshipEvents, "new_sponsor" | "former_sponsor"> & {
206
+ type_i: EffectType.claimable_balance_sponsorship_created;
207
+ };
208
+ export type ClaimableBalanceSponsorshipUpdated = Omit<ClaimableBalanceSponsorshipEvents, "sponsor"> & {
209
+ type_i: EffectType.claimable_balance_sponsorship_updated;
210
+ };
211
+ export type ClaimableBalanceSponsorshipRemoved = Omit<ClaimableBalanceSponsorshipEvents, "new_sponsor" | "sponsor"> & {
212
+ type_i: EffectType.claimable_balance_sponsorship_removed;
213
+ };
214
+ interface SignerSponsorshipEvents extends BaseEffectRecord, SponsershipFields {
215
+ signer: string;
216
+ }
217
+ export type SignerSponsorshipCreated = Omit<SignerSponsorshipEvents, "new_sponsor" | "former_sponsor"> & {
218
+ type_i: EffectType.signer_sponsorship_created;
219
+ };
220
+ export type SignerSponsorshipUpdated = Omit<SignerSponsorshipEvents, "sponsor"> & {
221
+ type_i: EffectType.signer_sponsorship_updated;
222
+ };
223
+ export type SignerSponsorshipRemoved = Omit<SignerSponsorshipEvents, "new_sponsor" | "sponsor"> & {
224
+ type_i: EffectType.signer_sponsorship_removed;
225
+ };
226
+ export interface ClaimableBalanceClawedBack extends HorizonApi.BaseResponse {
227
+ balance_id: string;
228
+ }
229
+ export interface LiquidityPoolEffectRecord extends HorizonApi.BaseResponse {
230
+ id: string;
231
+ fee_bp: number;
232
+ type: HorizonApi.LiquidityPoolType;
233
+ total_trustlines: string;
234
+ total_shares: string;
235
+ reserves: HorizonApi.Reserve[];
236
+ }
237
+ export interface LiquidityPoolDeposited extends BaseEffectRecord {
238
+ type_i: EffectType.liquidity_pool_deposited;
239
+ liquidity_pool: LiquidityPoolEffectRecord;
240
+ reserves_deposited: HorizonApi.Reserve[];
241
+ shares_received: string;
242
+ }
243
+ export interface LiquidityPoolWithdrew extends BaseEffectRecord {
244
+ type_i: EffectType.liquidity_pool_withdrew;
245
+ liquidity_pool: LiquidityPoolEffectRecord;
246
+ reserves_received: HorizonApi.Reserve[];
247
+ shares_redeemed: string;
248
+ }
249
+ export interface LiquidityPoolTrade extends BaseEffectRecord {
250
+ type_i: EffectType.liquidity_pool_trade;
251
+ liquidity_pool: LiquidityPoolEffectRecord;
252
+ sold: HorizonApi.Reserve;
253
+ bought: HorizonApi.Reserve;
254
+ }
255
+ export interface LiquidityPoolCreated extends BaseEffectRecord {
256
+ type_i: EffectType.liquidity_pool_created;
257
+ liquidity_pool: LiquidityPoolEffectRecord;
258
+ }
259
+ export interface LiquidityPoolRemoved extends BaseEffectRecord {
260
+ type_i: EffectType.liquidity_pool_removed;
261
+ liquidity_pool_id: string;
262
+ }
263
+ export interface LiquidityPoolRevoked extends BaseEffectRecord {
264
+ type_i: EffectType.liquidity_pool_revoked;
265
+ liquidity_pool: LiquidityPoolEffectRecord;
266
+ reserves_revoked: [
267
+ {
268
+ asset: string;
269
+ amount: string;
270
+ claimable_balance_id: string;
271
+ }
272
+ ];
273
+ shares_revoked: string;
274
+ }
275
+ export interface ContractCredited extends BaseEffectRecord, OfferAsset {
276
+ type_i: EffectType.contract_credited;
277
+ contract: string;
278
+ amount: string;
279
+ }
280
+ export interface ContractDebited extends BaseEffectRecord, OfferAsset {
281
+ type_i: EffectType.contract_debited;
282
+ contract: string;
283
+ amount: string;
284
+ }
285
+ export {};
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EffectType = void 0;
7
+ var EffectType = exports.EffectType = function (EffectType) {
8
+ EffectType[EffectType["account_created"] = 0] = "account_created";
9
+ EffectType[EffectType["account_removed"] = 1] = "account_removed";
10
+ EffectType[EffectType["account_credited"] = 2] = "account_credited";
11
+ EffectType[EffectType["account_debited"] = 3] = "account_debited";
12
+ EffectType[EffectType["account_thresholds_updated"] = 4] = "account_thresholds_updated";
13
+ EffectType[EffectType["account_home_domain_updated"] = 5] = "account_home_domain_updated";
14
+ EffectType[EffectType["account_flags_updated"] = 6] = "account_flags_updated";
15
+ EffectType[EffectType["account_inflation_destination_updated"] = 7] = "account_inflation_destination_updated";
16
+ EffectType[EffectType["signer_created"] = 10] = "signer_created";
17
+ EffectType[EffectType["signer_removed"] = 11] = "signer_removed";
18
+ EffectType[EffectType["signer_updated"] = 12] = "signer_updated";
19
+ EffectType[EffectType["trustline_created"] = 20] = "trustline_created";
20
+ EffectType[EffectType["trustline_removed"] = 21] = "trustline_removed";
21
+ EffectType[EffectType["trustline_updated"] = 22] = "trustline_updated";
22
+ EffectType[EffectType["trustline_authorized"] = 23] = "trustline_authorized";
23
+ EffectType[EffectType["trustline_deauthorized"] = 24] = "trustline_deauthorized";
24
+ EffectType[EffectType["trustline_authorized_to_maintain_liabilities"] = 25] = "trustline_authorized_to_maintain_liabilities";
25
+ EffectType[EffectType["trustline_flags_updated"] = 26] = "trustline_flags_updated";
26
+ EffectType[EffectType["offer_created"] = 30] = "offer_created";
27
+ EffectType[EffectType["offer_removed"] = 31] = "offer_removed";
28
+ EffectType[EffectType["offer_updated"] = 32] = "offer_updated";
29
+ EffectType[EffectType["trade"] = 33] = "trade";
30
+ EffectType[EffectType["data_created"] = 40] = "data_created";
31
+ EffectType[EffectType["data_removed"] = 41] = "data_removed";
32
+ EffectType[EffectType["data_updated"] = 42] = "data_updated";
33
+ EffectType[EffectType["sequence_bumped"] = 43] = "sequence_bumped";
34
+ EffectType[EffectType["claimable_balance_created"] = 50] = "claimable_balance_created";
35
+ EffectType[EffectType["claimable_balance_claimant_created"] = 51] = "claimable_balance_claimant_created";
36
+ EffectType[EffectType["claimable_balance_claimed"] = 52] = "claimable_balance_claimed";
37
+ EffectType[EffectType["account_sponsorship_created"] = 60] = "account_sponsorship_created";
38
+ EffectType[EffectType["account_sponsorship_updated"] = 61] = "account_sponsorship_updated";
39
+ EffectType[EffectType["account_sponsorship_removed"] = 62] = "account_sponsorship_removed";
40
+ EffectType[EffectType["trustline_sponsorship_created"] = 63] = "trustline_sponsorship_created";
41
+ EffectType[EffectType["trustline_sponsorship_updated"] = 64] = "trustline_sponsorship_updated";
42
+ EffectType[EffectType["trustline_sponsorship_removed"] = 65] = "trustline_sponsorship_removed";
43
+ EffectType[EffectType["data_sponsorship_created"] = 66] = "data_sponsorship_created";
44
+ EffectType[EffectType["data_sponsorship_updated"] = 67] = "data_sponsorship_updated";
45
+ EffectType[EffectType["data_sponsorship_removed"] = 68] = "data_sponsorship_removed";
46
+ EffectType[EffectType["claimable_balance_sponsorship_created"] = 69] = "claimable_balance_sponsorship_created";
47
+ EffectType[EffectType["claimable_balance_sponsorship_updated"] = 70] = "claimable_balance_sponsorship_updated";
48
+ EffectType[EffectType["claimable_balance_sponsorship_removed"] = 71] = "claimable_balance_sponsorship_removed";
49
+ EffectType[EffectType["signer_sponsorship_created"] = 72] = "signer_sponsorship_created";
50
+ EffectType[EffectType["signer_sponsorship_updated"] = 73] = "signer_sponsorship_updated";
51
+ EffectType[EffectType["signer_sponsorship_removed"] = 74] = "signer_sponsorship_removed";
52
+ EffectType[EffectType["claimable_balance_clawed_back"] = 80] = "claimable_balance_clawed_back";
53
+ EffectType[EffectType["liquidity_pool_deposited"] = 90] = "liquidity_pool_deposited";
54
+ EffectType[EffectType["liquidity_pool_withdrew"] = 91] = "liquidity_pool_withdrew";
55
+ EffectType[EffectType["liquidity_pool_trade"] = 92] = "liquidity_pool_trade";
56
+ EffectType[EffectType["liquidity_pool_created"] = 93] = "liquidity_pool_created";
57
+ EffectType[EffectType["liquidity_pool_removed"] = 94] = "liquidity_pool_removed";
58
+ EffectType[EffectType["liquidity_pool_revoked"] = 95] = "liquidity_pool_revoked";
59
+ EffectType[EffectType["contract_credited"] = 96] = "contract_credited";
60
+ EffectType[EffectType["contract_debited"] = 97] = "contract_debited";
61
+ return EffectType;
62
+ }({});
@@ -0,0 +1,20 @@
1
+ import { AssetType } from "@stellar/stellar-base";
2
+ import { HorizonApi } from "../horizon_api";
3
+ export interface OfferAsset {
4
+ asset_type: AssetType;
5
+ asset_code?: string;
6
+ asset_issuer?: string;
7
+ }
8
+ export interface OfferRecord extends HorizonApi.BaseResponse {
9
+ id: number | string;
10
+ paging_token: string;
11
+ seller: string;
12
+ selling: OfferAsset;
13
+ buying: OfferAsset;
14
+ amount: string;
15
+ price_r: HorizonApi.PriceRShorthand;
16
+ price: string;
17
+ last_modified_ledger: number;
18
+ last_modified_time: string;
19
+ sponsor?: string;
20
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,13 @@
1
+ import { BaseEffectRecord } from "./effects";
2
+ export interface Trade extends BaseEffectRecord {
3
+ seller: string;
4
+ offer_id: number | string;
5
+ bought_amount: string;
6
+ bought_asset_type: string;
7
+ bought_asset_code: string;
8
+ bought_asset_issuer: string;
9
+ sold_amount: string;
10
+ sold_asset_type: string;
11
+ sold_asset_code: string;
12
+ sold_asset_issuer: string;
13
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });