carbon-js-sdk 0.3.32 → 0.3.34

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 (104) hide show
  1. package/lib/CarbonSDK.js +1 -1
  2. package/lib/clients/ETHClient.js +2 -2
  3. package/lib/clients/HydrogenClient.js +9 -9
  4. package/lib/clients/InsightsQueryClient.js +45 -45
  5. package/lib/clients/N3Client.js +28 -25
  6. package/lib/clients/NEOClient.js +15 -14
  7. package/lib/clients/TokenClient.js +24 -27
  8. package/lib/clients/ZILClient.d.ts +1 -1
  9. package/lib/clients/ZILClient.js +52 -51
  10. package/lib/codec/bank/query.d.ts +2 -0
  11. package/lib/codec/bank/query.js +35 -6
  12. package/lib/constant/ibc.d.ts +5 -2
  13. package/lib/constant/ibc.js +164 -18
  14. package/lib/constant/network.d.ts +1 -1
  15. package/lib/constant/network.js +18 -18
  16. package/lib/constant/node.js +16 -11
  17. package/lib/constant/token.js +348 -348
  18. package/lib/eth/abis/index.d.ts +7 -7
  19. package/lib/eth/index.d.ts +1 -1
  20. package/lib/index.d.ts +1 -1
  21. package/lib/insights/common.d.ts +29 -29
  22. package/lib/insights/common.js +29 -29
  23. package/lib/modules/admin.js +29 -30
  24. package/lib/modules/bank.js +1 -2
  25. package/lib/modules/broker.js +1 -2
  26. package/lib/modules/cdp.d.ts +3 -3
  27. package/lib/modules/cdp.js +33 -34
  28. package/lib/modules/coin.js +0 -1
  29. package/lib/modules/fee.js +2 -2
  30. package/lib/modules/gov.js +12 -13
  31. package/lib/modules/ibc.js +2 -3
  32. package/lib/modules/leverage.js +1 -2
  33. package/lib/modules/liquiditypool.d.ts +1 -1
  34. package/lib/modules/liquiditypool.js +2 -3
  35. package/lib/modules/market.js +1 -2
  36. package/lib/modules/oracle.js +0 -1
  37. package/lib/modules/order.js +4 -5
  38. package/lib/modules/position.js +1 -2
  39. package/lib/modules/profile.js +0 -1
  40. package/lib/modules/staking.js +1 -2
  41. package/lib/modules/subaccount.js +0 -1
  42. package/lib/modules/xchain.js +1 -1
  43. package/lib/provider/account/EthLedgerAccount/EthLedgerAccount.d.ts +2 -2
  44. package/lib/provider/account/EthLedgerAccount/EthLedgerAccount.js +9 -7
  45. package/lib/provider/account/EthLedgerAccount/EthLedgerSigner.d.ts +2 -2
  46. package/lib/provider/account/EthLedgerAccount/EthLedgerSigner.js +5 -4
  47. package/lib/provider/account/EthLedgerAccount/index.d.ts +2 -2
  48. package/lib/provider/account/NeoLedgerAccount/NeoLedgerAccount.js +5 -3
  49. package/lib/provider/account/NeoLedgerAccount/NeonLedger.js +1 -2
  50. package/lib/provider/amino/types/gov.js +3 -4
  51. package/lib/provider/amino/types/order.js +2 -6
  52. package/lib/provider/amino/utils.js +6 -16
  53. package/lib/provider/chainProvider/GetSigningCosmosClientOptions.d.ts +1 -1
  54. package/lib/provider/chainProvider/GetSigningCosmosClientOptions.js +1 -1
  55. package/lib/provider/chainProvider/index.d.ts +2 -2
  56. package/lib/provider/keplr/KeplrAccount.d.ts +1 -2
  57. package/lib/provider/keplr/KeplrAccount.js +7 -5
  58. package/lib/provider/keplr/KeplrStore.d.ts +2 -8
  59. package/lib/provider/keplr/KeplrStore.js +1 -7
  60. package/lib/provider/leap/LeapAccount.d.ts +1 -2
  61. package/lib/provider/leap/LeapAccount.js +7 -5
  62. package/lib/provider/metamask/MetaMask.d.ts +3 -3
  63. package/lib/provider/metamask/MetaMask.js +98 -93
  64. package/lib/provider/metamask/index.d.ts +1 -1
  65. package/lib/provider/o3/O3Wallet.js +12 -8
  66. package/lib/provider/zilpay/Zilpay.js +9 -9
  67. package/lib/util/address.js +2 -8
  68. package/lib/util/api.js +7 -7
  69. package/lib/util/blockchain.d.ts +5 -2
  70. package/lib/util/blockchain.js +55 -44
  71. package/lib/util/external.js +1 -2
  72. package/lib/util/fetch.js +1 -2
  73. package/lib/util/generic.js +3 -3
  74. package/lib/util/gov.js +1 -2
  75. package/lib/util/ibc.js +7 -7
  76. package/lib/util/token.js +3 -3
  77. package/lib/util/tx.js +5 -5
  78. package/lib/util/type.js +6 -10
  79. package/lib/wallet/CarbonSigner.d.ts +3 -3
  80. package/lib/wallet/CarbonSigningClient.js +4 -5
  81. package/lib/wallet/CarbonWallet.js +7 -10
  82. package/lib/websocket/channel.d.ts +1 -1
  83. package/lib/websocket/channel.js +30 -30
  84. package/lib/websocket/connector.d.ts +3 -3
  85. package/lib/websocket/connector.js +20 -20
  86. package/lib/websocket/index.d.ts +1 -1
  87. package/lib/websocket/models.d.ts +3 -3
  88. package/package.json +5 -3
  89. package/lib/codec/ibc/applications/fee/v1/ack.d.ts +0 -24
  90. package/lib/codec/ibc/applications/fee/v1/ack.js +0 -125
  91. package/lib/codec/ibc/applications/fee/v1/fee.d.ts +0 -68
  92. package/lib/codec/ibc/applications/fee/v1/fee.js +0 -289
  93. package/lib/codec/ibc/applications/fee/v1/genesis.d.ts +0 -93
  94. package/lib/codec/ibc/applications/fee/v1/genesis.js +0 -390
  95. package/lib/codec/ibc/applications/fee/v1/metadata.d.ts +0 -25
  96. package/lib/codec/ibc/applications/fee/v1/metadata.js +0 -71
  97. package/lib/codec/ibc/applications/fee/v1/query.d.ts +0 -312
  98. package/lib/codec/ibc/applications/fee/v1/query.js +0 -1187
  99. package/lib/codec/ibc/applications/fee/v1/tx.d.ts +0 -171
  100. package/lib/codec/ibc/applications/fee/v1/tx.js +0 -524
  101. package/lib/codec/ibc/applications/interchain_accounts/controller/v1/tx.d.ts +0 -78
  102. package/lib/codec/ibc/applications/interchain_accounts/controller/v1/tx.js +0 -296
  103. package/lib/codec/ibc/applications/interchain_accounts/genesis/v1/genesis.d.ts +0 -80
  104. package/lib/codec/ibc/applications/interchain_accounts/genesis/v1/genesis.js +0 -439
package/lib/CarbonSDK.js CHANGED
@@ -216,7 +216,7 @@ class CarbonSDK {
216
216
  const errorTyped = err;
217
217
  // In the case where account does not exist on chain, still allow wallet connection.
218
218
  // Else, throw an error as per normal
219
- if (!errorTyped.message.includes('Account does not exist on chain. Send some tokens there before trying to query sequence.')) {
219
+ if (!errorTyped.message.includes("Account does not exist on chain. Send some tokens there before trying to query sequence.")) {
220
220
  throw new Error(errorTyped.message);
221
221
  }
222
222
  }
@@ -88,7 +88,7 @@ class ETHClient {
88
88
  }
89
89
  bridgeTokens(params) {
90
90
  return __awaiter(this, void 0, void 0, function* () {
91
- const { fromToken, toToken, amount, toAddress, fromAddress, recoveryAddress, signer, gasPriceGwei, gasLimit, feeAmount, signCompleteCallback } = params;
91
+ const { fromToken, toToken, amount, toAddress, fromAddress, recoveryAddress, signer, gasPriceGwei, gasLimit, feeAmount, signCompleteCallback, } = params;
92
92
  const networkConfig = this.getNetworkConfig();
93
93
  const rpcProvider = this.getProvider();
94
94
  if (!recoveryAddress.match(/^swth[a-z0-9]{39}$/)) {
@@ -118,7 +118,7 @@ class ETHClient {
118
118
  ], [
119
119
  amount.toString(10),
120
120
  feeAmount.toString(10),
121
- amount.toString(10)
121
+ amount.toString(10),
122
122
  ], // callAmount
123
123
  {
124
124
  gasLimit: gasLimit.toString(10),
@@ -18,13 +18,13 @@ const util_1 = require("../util");
18
18
  const dayjs_1 = __importDefault(require("dayjs"));
19
19
  exports.HydrogenEndpoints = {
20
20
  // Status api
21
- 'stats': '/stats',
21
+ stats: "/stats",
22
22
  // Transfer Payloads api
23
- 'transfer_payloads': '/transfer_payloads',
23
+ transfer_payloads: "/transfer_payloads",
24
24
  // Relays api
25
- 'relays': '/relays',
25
+ relays: "/relays",
26
26
  // Fee service api
27
- 'fee_quote': '/fee_quote',
27
+ fee_quote: "/fee_quote",
28
28
  };
29
29
  const formatDateField = (value) => {
30
30
  if (typeof value !== "string")
@@ -77,7 +77,7 @@ class HydrogenClient {
77
77
  getStats() {
78
78
  return __awaiter(this, void 0, void 0, function* () {
79
79
  this.checkState();
80
- const request = this.apiManager.path('stats');
80
+ const request = this.apiManager.path("stats");
81
81
  const response = yield request.get();
82
82
  return response.data;
83
83
  });
@@ -85,7 +85,7 @@ class HydrogenClient {
85
85
  getTransfers(req) {
86
86
  return __awaiter(this, void 0, void 0, function* () {
87
87
  this.checkState();
88
- const request = this.apiManager.path('transfer_payloads', {}, Object.assign(Object.assign({}, req), { include_tx: false }));
88
+ const request = this.apiManager.path("transfer_payloads", {}, Object.assign(Object.assign({}, req), { include_tx: false }));
89
89
  const response = yield request.get();
90
90
  const result = response.data;
91
91
  return Object.assign(Object.assign({}, result), { data: result.data.map(formatCrossChainTransfer) });
@@ -94,7 +94,7 @@ class HydrogenClient {
94
94
  getDetailedTransfers(req) {
95
95
  return __awaiter(this, void 0, void 0, function* () {
96
96
  this.checkState();
97
- const request = this.apiManager.path('transfer_payloads', {}, Object.assign(Object.assign({}, req), { include_tx: true }));
97
+ const request = this.apiManager.path("transfer_payloads", {}, Object.assign(Object.assign({}, req), { include_tx: true }));
98
98
  const response = yield request.get();
99
99
  const result = response.data;
100
100
  return Object.assign(Object.assign({}, result), { data: result.data.map(formatCrossChainTransferDetailed) });
@@ -103,7 +103,7 @@ class HydrogenClient {
103
103
  getRelaysTransfers(req) {
104
104
  return __awaiter(this, void 0, void 0, function* () {
105
105
  this.checkState();
106
- const request = this.apiManager.path('relays', {}, Object.assign(Object.assign({}, req), { include_tx: true }));
106
+ const request = this.apiManager.path("relays", {}, Object.assign(Object.assign({}, req), { include_tx: true }));
107
107
  const response = yield request.get();
108
108
  const result = response.data;
109
109
  return Object.assign(Object.assign({}, result), { data: result.data.map(formatRelaysTransfers) });
@@ -112,7 +112,7 @@ class HydrogenClient {
112
112
  getFeeQuote(req) {
113
113
  return __awaiter(this, void 0, void 0, function* () {
114
114
  this.checkState();
115
- const request = this.apiManager.path('fee_quote', {}, Object.assign({}, req));
115
+ const request = this.apiManager.path("fee_quote", {}, Object.assign({}, req));
116
116
  const response = yield request.get();
117
117
  const result = response.data;
118
118
  return formatFeeQuote(result);
@@ -29,7 +29,7 @@ class InsightsQueryClient {
29
29
  console.error(e);
30
30
  }
31
31
  if (response.status >= 400 && response.status < 600) {
32
- throw new util_1.APIUtils.RequestError(result, ((_b = (_a = result.data) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.message) || 'unknown error');
32
+ throw new util_1.APIUtils.RequestError(result, ((_b = (_a = result.data) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.message) || "unknown error");
33
33
  }
34
34
  return result;
35
35
  });
@@ -37,14 +37,14 @@ class InsightsQueryClient {
37
37
  // Chain api
38
38
  Stake(req = {}) {
39
39
  return __awaiter(this, void 0, void 0, function* () {
40
- const request = this.apiManager.path('chain/stake', {}, req);
40
+ const request = this.apiManager.path("chain/stake", {}, req);
41
41
  const response = yield request.get();
42
42
  return response.data;
43
43
  });
44
44
  }
45
45
  Transaction(req = {}) {
46
46
  return __awaiter(this, void 0, void 0, function* () {
47
- const request = this.apiManager.path('chain/transaction', {}, req);
47
+ const request = this.apiManager.path("chain/transaction", {}, req);
48
48
  const response = yield request.get();
49
49
  return response.data;
50
50
  });
@@ -52,9 +52,9 @@ class InsightsQueryClient {
52
52
  AvgBlockTime(req) {
53
53
  return __awaiter(this, void 0, void 0, function* () {
54
54
  const queryParams = {
55
- hours: req.hours
55
+ hours: req.hours,
56
56
  };
57
- const request = this.apiManager.path('chain/blocktime', {}, queryParams);
57
+ const request = this.apiManager.path("chain/blocktime", {}, queryParams);
58
58
  const response = yield request.get();
59
59
  return response.data;
60
60
  });
@@ -62,28 +62,28 @@ class InsightsQueryClient {
62
62
  // User api
63
63
  ActiveAccounts(req = {}) {
64
64
  return __awaiter(this, void 0, void 0, function* () {
65
- const request = this.apiManager.path('user/active', {}, req);
65
+ const request = this.apiManager.path("user/active", {}, req);
66
66
  const response = yield request.get();
67
67
  return response.data;
68
68
  });
69
69
  }
70
70
  UserProfile(req) {
71
71
  return __awaiter(this, void 0, void 0, function* () {
72
- const request = this.apiManager.path('user/profile', {}, req);
72
+ const request = this.apiManager.path("user/profile", {}, req);
73
73
  const response = yield request.get();
74
74
  return response.data;
75
75
  });
76
76
  }
77
77
  UserGrowth(req = {}) {
78
78
  return __awaiter(this, void 0, void 0, function* () {
79
- const request = this.apiManager.path('user/growth', {}, req);
79
+ const request = this.apiManager.path("user/growth", {}, req);
80
80
  const response = yield request.get();
81
81
  return response.data;
82
82
  });
83
83
  }
84
84
  TotalUsers(req = {}) {
85
85
  return __awaiter(this, void 0, void 0, function* () {
86
- const request = this.apiManager.path('user/total', {}, req);
86
+ const request = this.apiManager.path("user/total", {}, req);
87
87
  const response = yield request.get();
88
88
  return response.data;
89
89
  });
@@ -91,7 +91,7 @@ class InsightsQueryClient {
91
91
  // Pool api
92
92
  Pools(req = {}) {
93
93
  return __awaiter(this, void 0, void 0, function* () {
94
- const request = this.apiManager.path('pool/list', {}, req);
94
+ const request = this.apiManager.path("pool/list", {}, req);
95
95
  const response = yield request.get();
96
96
  return response.data;
97
97
  });
@@ -99,11 +99,11 @@ class InsightsQueryClient {
99
99
  PoolHistory(query) {
100
100
  var _a, _b, _c;
101
101
  return __awaiter(this, void 0, void 0, function* () {
102
- const request = this.apiManager.path('pool/history', {}, {
103
- sort: (_a = query.sort) !== null && _a !== void 0 ? _a : 'DESC',
102
+ const request = this.apiManager.path("pool/history", {}, {
103
+ sort: (_a = query.sort) !== null && _a !== void 0 ? _a : "DESC",
104
104
  limit: (_b = query.limit) !== null && _b !== void 0 ? _b : 100,
105
105
  offset: (_c = query.offset) !== null && _c !== void 0 ? _c : 0,
106
- poolId: query.poolId
106
+ poolId: query.poolId,
107
107
  });
108
108
  const response = yield request.get();
109
109
  return response.data;
@@ -117,7 +117,7 @@ class InsightsQueryClient {
117
117
  from: req.from,
118
118
  until: req.until,
119
119
  };
120
- const request = this.apiManager.path('pool/volume', routeParams, queryParams);
120
+ const request = this.apiManager.path("pool/volume", routeParams, queryParams);
121
121
  const response = yield request.get();
122
122
  return response.data;
123
123
  });
@@ -130,30 +130,30 @@ class InsightsQueryClient {
130
130
  from: req.from,
131
131
  until: req.until,
132
132
  };
133
- const request = this.apiManager.path('pools/volume', {}, queryParams);
133
+ const request = this.apiManager.path("pools/volume", {}, queryParams);
134
134
  const response = yield request.get();
135
135
  return response.data;
136
136
  });
137
137
  }
138
138
  CompetitionList(req = {}) {
139
139
  return __awaiter(this, void 0, void 0, function* () {
140
- const request = this.apiManager.path('competition/list', {}, req);
140
+ const request = this.apiManager.path("competition/list", {}, req);
141
141
  const response = yield request.get();
142
142
  return response.data;
143
143
  });
144
144
  }
145
145
  VolumeCompetitionLeaderboard(req) {
146
146
  return __awaiter(this, void 0, void 0, function* () {
147
- const queryParams = Object.assign(Object.assign(Object.assign({ competitionId: req.competitionId }, req.from && { from: req.from }), req.until && { until: req.until }), req.market && { market: req.market });
148
- const request = this.apiManager.path('competition/leaderboard', {}, queryParams);
147
+ const queryParams = Object.assign(Object.assign(Object.assign({ competitionId: req.competitionId }, (req.from && { from: req.from })), (req.until && { until: req.until })), (req.market && { market: req.market }));
148
+ const request = this.apiManager.path("competition/leaderboard", {}, queryParams);
149
149
  const response = yield request.get();
150
150
  return response.data;
151
151
  });
152
152
  }
153
153
  PNLCompetitionLeaderboard(req) {
154
154
  return __awaiter(this, void 0, void 0, function* () {
155
- const queryParams = Object.assign({ competitionId: req.competitionId }, req.market && { market: req.market });
156
- const request = this.apiManager.path('competition/leaderboardpnl', {}, queryParams);
155
+ const queryParams = Object.assign({ competitionId: req.competitionId }, (req.market && { market: req.market }));
156
+ const request = this.apiManager.path("competition/leaderboardpnl", {}, queryParams);
157
157
  const response = yield request.get();
158
158
  return response.data;
159
159
  });
@@ -166,7 +166,7 @@ class InsightsQueryClient {
166
166
  from: req.from,
167
167
  until: req.until,
168
168
  };
169
- const request = this.apiManager.path('pools/liquidity', {}, queryParams);
169
+ const request = this.apiManager.path("pools/liquidity", {}, queryParams);
170
170
  const response = yield request.get();
171
171
  return response.data;
172
172
  });
@@ -179,7 +179,7 @@ class InsightsQueryClient {
179
179
  from: req.from,
180
180
  until: req.until,
181
181
  };
182
- const request = this.apiManager.path('market/volume', {}, queryParams);
182
+ const request = this.apiManager.path("market/volume", {}, queryParams);
183
183
  const response = yield request.get();
184
184
  return response.data;
185
185
  });
@@ -187,7 +187,7 @@ class InsightsQueryClient {
187
187
  // Node api
188
188
  Nodes(req = {}) {
189
189
  return __awaiter(this, void 0, void 0, function* () {
190
- const request = this.apiManager.path('node/list', {}, req);
190
+ const request = this.apiManager.path("node/list", {}, req);
191
191
  const response = yield request.get();
192
192
  return response.data;
193
193
  });
@@ -195,21 +195,21 @@ class InsightsQueryClient {
195
195
  // Balance api
196
196
  BalanceTotal(req) {
197
197
  return __awaiter(this, void 0, void 0, function* () {
198
- const request = this.apiManager.path('balance/total', {}, req);
198
+ const request = this.apiManager.path("balance/total", {}, req);
199
199
  const response = yield request.get();
200
200
  return response.data;
201
201
  });
202
202
  }
203
203
  BalanceList(req) {
204
204
  return __awaiter(this, void 0, void 0, function* () {
205
- const request = this.apiManager.path('balance/list', {}, req);
205
+ const request = this.apiManager.path("balance/list", {}, req);
206
206
  const response = yield request.get();
207
207
  return response.data;
208
208
  });
209
209
  }
210
210
  BalanceChange(req) {
211
211
  return __awaiter(this, void 0, void 0, function* () {
212
- const request = this.apiManager.path('balance/change', req);
212
+ const request = this.apiManager.path("balance/change", req);
213
213
  const response = yield request.get();
214
214
  return response.data;
215
215
  });
@@ -224,21 +224,21 @@ class InsightsQueryClient {
224
224
  interval: req.interval,
225
225
  limit: req.limit,
226
226
  };
227
- const request = this.apiManager.path('balance/history', routeParams, queryParams);
227
+ const request = this.apiManager.path("balance/history", routeParams, queryParams);
228
228
  const response = yield request.get();
229
229
  return response.data;
230
230
  });
231
231
  }
232
232
  BalanceSupply() {
233
233
  return __awaiter(this, void 0, void 0, function* () {
234
- const request = this.apiManager.path('balance/supply');
234
+ const request = this.apiManager.path("balance/supply");
235
235
  const response = yield request.get();
236
236
  return response.data;
237
237
  });
238
238
  }
239
239
  BalanceDistribution(req = {}) {
240
240
  return __awaiter(this, void 0, void 0, function* () {
241
- const request = this.apiManager.path('balance/distribution', {}, req);
241
+ const request = this.apiManager.path("balance/distribution", {}, req);
242
242
  const response = yield request.get();
243
243
  return response.data;
244
244
  });
@@ -247,10 +247,10 @@ class InsightsQueryClient {
247
247
  LiquidationEngine(query) {
248
248
  var _a, _b, _c;
249
249
  return __awaiter(this, void 0, void 0, function* () {
250
- const request = this.apiManager.path('position/liquidation/engine', {}, {
251
- sort: (_a = query.sort) !== null && _a !== void 0 ? _a : 'DESC',
250
+ const request = this.apiManager.path("position/liquidation/engine", {}, {
251
+ sort: (_a = query.sort) !== null && _a !== void 0 ? _a : "DESC",
252
252
  limit: (_b = query.limit) !== null && _b !== void 0 ? _b : 100,
253
- offset: (_c = query.offset) !== null && _c !== void 0 ? _c : 0
253
+ offset: (_c = query.offset) !== null && _c !== void 0 ? _c : 0,
254
254
  });
255
255
  const response = yield request.get();
256
256
  return response.data;
@@ -259,10 +259,10 @@ class InsightsQueryClient {
259
259
  LiquidationAndADL(query) {
260
260
  var _a, _b, _c;
261
261
  return __awaiter(this, void 0, void 0, function* () {
262
- const request = this.apiManager.path('position/liquidation', {}, {
263
- sort: (_a = query.sort) !== null && _a !== void 0 ? _a : 'DESC',
262
+ const request = this.apiManager.path("position/liquidation", {}, {
263
+ sort: (_a = query.sort) !== null && _a !== void 0 ? _a : "DESC",
264
264
  limit: (_b = query.limit) !== null && _b !== void 0 ? _b : 100,
265
- offset: (_c = query.offset) !== null && _c !== void 0 ? _c : 0
265
+ offset: (_c = query.offset) !== null && _c !== void 0 ? _c : 0,
266
266
  });
267
267
  const response = yield request.get();
268
268
  return response.data;
@@ -271,11 +271,11 @@ class InsightsQueryClient {
271
271
  PositionsView(req, query) {
272
272
  var _a, _b, _c, _d;
273
273
  return __awaiter(this, void 0, void 0, function* () {
274
- const request = this.apiManager.path('position/view', req, {
275
- sort: (_a = query.sort) !== null && _a !== void 0 ? _a : 'DESC',
274
+ const request = this.apiManager.path("position/view", req, {
275
+ sort: (_a = query.sort) !== null && _a !== void 0 ? _a : "DESC",
276
276
  limit: (_b = query.limit) !== null && _b !== void 0 ? _b : 100,
277
277
  offset: (_c = query.offset) !== null && _c !== void 0 ? _c : 0,
278
- market: (_d = query.market) !== null && _d !== void 0 ? _d : ''
278
+ market: (_d = query.market) !== null && _d !== void 0 ? _d : "",
279
279
  });
280
280
  const response = yield request.get();
281
281
  return response.data;
@@ -284,12 +284,12 @@ class InsightsQueryClient {
284
284
  Leaderboard(req, query) {
285
285
  var _a, _b, _c, _d, _e;
286
286
  return __awaiter(this, void 0, void 0, function* () {
287
- const request = this.apiManager.path('position/leaderboard', req, {
288
- market: (_a = query.market) !== null && _a !== void 0 ? _a : '',
289
- sort: (_b = query.sort) !== null && _b !== void 0 ? _b : 'DESC',
287
+ const request = this.apiManager.path("position/leaderboard", req, {
288
+ market: (_a = query.market) !== null && _a !== void 0 ? _a : "",
289
+ sort: (_b = query.sort) !== null && _b !== void 0 ? _b : "DESC",
290
290
  limit: (_c = query.limit) !== null && _c !== void 0 ? _c : 100,
291
291
  offset: (_d = query.offset) !== null && _d !== void 0 ? _d : 0,
292
- address: (_e = query.address) !== null && _e !== void 0 ? _e : '',
292
+ address: (_e = query.address) !== null && _e !== void 0 ? _e : "",
293
293
  });
294
294
  const response = yield request.get();
295
295
  return response.data;
@@ -298,7 +298,7 @@ class InsightsQueryClient {
298
298
  //Coin Gecko Tokens
299
299
  DenomToGeckoIdMap() {
300
300
  return __awaiter(this, void 0, void 0, function* () {
301
- const request = this.apiManager.path('info/denom_gecko_map');
301
+ const request = this.apiManager.path("info/denom_gecko_map");
302
302
  const response = yield request.get();
303
303
  return response.data;
304
304
  });
@@ -306,8 +306,8 @@ class InsightsQueryClient {
306
306
  FundingHistory(query) {
307
307
  var _a, _b, _c;
308
308
  return __awaiter(this, void 0, void 0, function* () {
309
- const request = this.apiManager.path('market/funding', {}, {
310
- market: (_a = query.market) !== null && _a !== void 0 ? _a : '',
309
+ const request = this.apiManager.path("market/funding", {}, {
310
+ market: (_a = query.market) !== null && _a !== void 0 ? _a : "",
311
311
  limit: (_b = query.limit) !== null && _b !== void 0 ? _b : 100,
312
312
  offset: (_c = query.offset) !== null && _c !== void 0 ? _c : 0,
313
313
  });
@@ -18,7 +18,6 @@ const address_1 = require("../util/address");
18
18
  const blockchain_1 = require("../util/blockchain");
19
19
  const neon_core_next_1 = require("@cityofzion/neon-core-next");
20
20
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
21
- ;
22
21
  class N3Client {
23
22
  constructor(configProvider, blockchain) {
24
23
  var _a;
@@ -50,7 +49,7 @@ class N3Client {
50
49
  };
51
50
  }
52
51
  static instance(opts) {
53
- const { configProvider, blockchain = blockchain_1.Blockchain.Neo3, } = opts;
52
+ const { configProvider, blockchain = blockchain_1.Blockchain.Neo3 } = opts;
54
53
  if (!N3Client.SUPPORTED_BLOCKCHAINS.includes(blockchain))
55
54
  throw new Error(`unsupported blockchain - ${blockchain}`);
56
55
  return new N3Client(configProvider, blockchain);
@@ -109,17 +108,21 @@ class N3Client {
109
108
  const txn = new neon_core_next_1.tx.Transaction({
110
109
  script,
111
110
  validUntilBlock: currentHeight + 100,
112
- signers: [{
111
+ signers: [
112
+ {
113
113
  account: signer.scriptHash,
114
114
  scopes: neon_core_next_1.tx.WitnessScope.Global,
115
- }]
115
+ },
116
+ ],
116
117
  });
117
118
  const networkFee = yield this.getNetworkFee(txn, 0);
118
119
  txn.networkFee = networkFee;
119
- const systemFee = yield this.getSystemFee(txn, 0, [{
120
+ const systemFee = yield this.getSystemFee(txn, 0, [
121
+ {
120
122
  account: signer.scriptHash,
121
123
  scopes: neon_core_next_1.tx.WitnessScope.Global.toString(),
122
- }]);
124
+ },
125
+ ]);
123
126
  txn.systemFee = systemFee;
124
127
  if (amount.lt(feeAmount)) {
125
128
  return false;
@@ -149,7 +152,7 @@ class N3Client {
149
152
  }
150
153
  lockO3Deposit(params) {
151
154
  return __awaiter(this, void 0, void 0, function* () {
152
- const { feeAmount, toAddressHex, amount, token, o3Wallet, signCompleteCallback, } = params;
155
+ const { feeAmount, toAddressHex, amount, token, o3Wallet, signCompleteCallback } = params;
153
156
  if (!o3Wallet.isConnected()) {
154
157
  throw new Error("O3 wallet not connected. Please reconnect and try again.");
155
158
  }
@@ -158,7 +161,7 @@ class N3Client {
158
161
  const lockProxyScriptHash = neon_core_next_1.u.reverseHex(token.bridgeAddress);
159
162
  const tokenScriptHash = neon_core_next_1.u.reverseHex(token.tokenAddress);
160
163
  const fromAddressHex = o3Wallet.address;
161
- const publicKeyOutput = yield o3Wallet.getPublicKeyOutput();
164
+ const publicKeyOutput = (yield o3Wallet.getPublicKeyOutput());
162
165
  const accountScriptHash = address_1.N3Address.publicKeyToScriptHash(publicKeyOutput.publicKey);
163
166
  const feeAddress = feeAmount.isZero() ? "" : neon_core_next_1.u.HexString.fromHex(networkConfig.feeAddress).toBase64();
164
167
  const args = [
@@ -175,17 +178,19 @@ class N3Client {
175
178
  scriptHash: lockProxyScriptHash,
176
179
  args,
177
180
  network: o3Wallet.neoNetwork,
178
- signers: [{
181
+ signers: [
182
+ {
179
183
  account: accountScriptHash,
180
184
  scopes: neon_core_next_1.tx.WitnessScope.Global,
181
- }],
185
+ },
186
+ ],
182
187
  });
183
188
  return result.txid;
184
189
  });
185
190
  }
186
191
  lockLedgerDeposit(params) {
187
192
  return __awaiter(this, void 0, void 0, function* () {
188
- const { feeAmount, toAddressHex, amount, token, ledger, signCompleteCallback, } = params;
193
+ const { feeAmount, toAddressHex, amount, token, ledger, signCompleteCallback } = params;
189
194
  const scriptHash = neon_core_next_1.u.reverseHex(token.bridgeAddress);
190
195
  const tokenScriptHash = neon_core_next_1.u.reverseHex(token.tokenAddress);
191
196
  const fromAddressHex = ledger.displayAddress;
@@ -209,9 +214,7 @@ class N3Client {
209
214
  const transactionByteSize = txn.serialize().length / 2 + 109;
210
215
  // Hardcoded. Running a witness is always the same cost for the basic account.
211
216
  const witnessProcessingFee = new bignumber_js_1.default(1000390);
212
- const networkFeeEstimate = feePerByte
213
- .times(transactionByteSize)
214
- .plus(witnessProcessingFee);
217
+ const networkFeeEstimate = feePerByte.times(transactionByteSize).plus(witnessProcessingFee);
215
218
  if (networkFee && networkFee >= networkFeeEstimate.toNumber()) {
216
219
  return neon_core_next_1.u.BigInteger.fromNumber(networkFee);
217
220
  }
@@ -250,29 +253,29 @@ class N3Client {
250
253
  return __awaiter(this, void 0, void 0, function* () {
251
254
  const result = yield this.rpcClient.executeAll([
252
255
  new neon_core_next_1.rpc.Query({
253
- method: 'invokefunction',
254
- params: [address, 'decimals'],
256
+ method: "invokefunction",
257
+ params: [address, "decimals"],
255
258
  }),
256
259
  new neon_core_next_1.rpc.Query({
257
- method: 'invokefunction',
258
- params: [address, 'symbol'],
260
+ method: "invokefunction",
261
+ params: [address, "symbol"],
259
262
  }),
260
263
  new neon_core_next_1.rpc.Query({
261
- method: 'getcontractstate',
264
+ method: "getcontractstate",
262
265
  params: [address],
263
266
  }),
264
267
  ]);
265
268
  const [decimalRaw, symbolRaw, nameRaw] = result;
266
269
  let decimals = 0;
267
- let symbol = '';
268
- let name = '';
269
- if (typeof decimalRaw.stack[0].value === 'string') {
270
+ let symbol = "";
271
+ let name = "";
272
+ if (typeof decimalRaw.stack[0].value === "string") {
270
273
  decimals = Number(decimalRaw.stack[0].value);
271
274
  }
272
- if (typeof symbolRaw.stack[0].value === 'string') {
273
- symbol = Buffer.from(symbolRaw.stack[0].value, 'base64').toString('ascii');
275
+ if (typeof symbolRaw.stack[0].value === "string") {
276
+ symbol = Buffer.from(symbolRaw.stack[0].value, "base64").toString("ascii");
274
277
  }
275
- if (typeof nameRaw.manifest.name === 'string') {
278
+ if (typeof nameRaw.manifest.name === "string") {
276
279
  name = nameRaw.manifest.name;
277
280
  }
278
281
  return { name, symbol, address, decimals };
@@ -49,13 +49,13 @@ class NEOClient {
49
49
  this.blockchain = blockchain;
50
50
  }
51
51
  static instance(opts) {
52
- const { configProvider, blockchain = blockchain_1.Blockchain.Neo, } = opts;
52
+ const { configProvider, blockchain = blockchain_1.Blockchain.Neo } = opts;
53
53
  if (!NEOClient.SUPPORTED_BLOCKCHAINS.includes(blockchain))
54
54
  throw new Error(`unsupported blockchain - ${blockchain}`);
55
55
  return new NEOClient(configProvider, blockchain);
56
56
  }
57
57
  static parseHexNum(hex, exp = 0) {
58
- if (!hex || typeof (hex) !== "string")
58
+ if (!hex || typeof hex !== "string")
59
59
  return "0";
60
60
  const res = hex.length % 2 !== 0 ? `0${hex}` : hex;
61
61
  return new bignumber_js_1.default(res ? Neon.u.reverseHex(res) : "00", 16).shiftedBy(-exp).toString();
@@ -64,7 +64,7 @@ class NEOClient {
64
64
  return __awaiter(this, void 0, void 0, function* () {
65
65
  const tokenQueryResults = yield sdk.token.getAllTokens();
66
66
  const account = new Neon.wallet.Account(address);
67
- const tokens = tokenQueryResults.filter(token => (0, blockchain_1.blockchainForChainId)(token.chainId.toNumber()) == this.blockchain &&
67
+ const tokens = tokenQueryResults.filter((token) => (0, blockchain_1.blockchainForChainId)(token.chainId.toNumber()) == this.blockchain &&
68
68
  token.tokenAddress.length == 40 &&
69
69
  token.bridgeAddress.length == 40);
70
70
  const client = new Neon.rpc.RPCClient(url, "2.5.2"); // TODO: should we change the RPC version??
@@ -79,10 +79,11 @@ class NEOClient {
79
79
  const sb = new Neon.sc.ScriptBuilder();
80
80
  sb.emitAppCall(Neon.u.reverseHex(token.tokenAddress), "balanceOf", [Neon.u.reverseHex(account.scriptHash)]);
81
81
  try {
82
- const response = yield client.invokeScript(sb.str);
83
- acc[token.denom.toUpperCase()] = ((_a = response.stack[0]) === null || _a === void 0 ? void 0 : _a.type) === "Integer" // Happens on polychain devnet
84
- ? (_b = response.stack[0]) === null || _b === void 0 ? void 0 : _b.value
85
- : NEOClient.parseHexNum((_c = response.stack[0]) === null || _c === void 0 ? void 0 : _c.value);
82
+ const response = (yield client.invokeScript(sb.str));
83
+ acc[token.denom.toUpperCase()] =
84
+ ((_a = response.stack[0]) === null || _a === void 0 ? void 0 : _a.type) === "Integer" // Happens on polychain devnet
85
+ ? (_b = response.stack[0]) === null || _b === void 0 ? void 0 : _b.value
86
+ : NEOClient.parseHexNum((_c = response.stack[0]) === null || _c === void 0 ? void 0 : _c.value);
86
87
  }
87
88
  catch (err) {
88
89
  console.error("Could not retrieve external balance for ", token.denom);
@@ -130,7 +131,7 @@ class NEOClient {
130
131
  amount.toNumber(),
131
132
  feeAmount.toNumber(),
132
133
  feeAddress,
133
- nonce
134
+ nonce,
134
135
  ]);
135
136
  const rpcUrl = yield this.getProviderUrl();
136
137
  const apiProvider = networkConfig.network === CarbonSDK_1.default.Network.MainNet
@@ -142,17 +143,17 @@ class NEOClient {
142
143
  account,
143
144
  script: sb.str,
144
145
  gas: 0,
145
- fees: 0
146
+ fees: 0,
146
147
  });
147
148
  });
148
149
  }
149
150
  lockO3Deposit(params) {
150
151
  return __awaiter(this, void 0, void 0, function* () {
151
- const { feeAmount, address, amount, token, o3Wallet, signCompleteCallback, } = params;
152
+ const { feeAmount, address, amount, token, o3Wallet, signCompleteCallback } = params;
152
153
  if (!o3Wallet.isConnected()) {
153
154
  throw new Error("O3 wallet not connected. Please reconnect and try again.");
154
155
  }
155
- const publicKeyOutput = yield o3Wallet.getPublicKeyOutput();
156
+ const publicKeyOutput = (yield o3Wallet.getPublicKeyOutput());
156
157
  const networkConfig = this.getNetworkConfig();
157
158
  const scriptHash = Neon.u.reverseHex(token.bridgeAddress);
158
159
  const fromAssetHash = Neon.u.reverseHex(token.tokenAddress);
@@ -187,7 +188,7 @@ class NEOClient {
187
188
  lockLedgerDeposit(params) {
188
189
  var _a;
189
190
  return __awaiter(this, void 0, void 0, function* () {
190
- const { feeAmount, address, amount, token, ledger, signCompleteCallback, } = params;
191
+ const { feeAmount, address, amount, token, ledger, signCompleteCallback } = params;
191
192
  const compressedPublicKey = Neon.wallet.getPublicKeyEncoded(ledger.publicKey);
192
193
  const networkConfig = this.getNetworkConfig();
193
194
  const scriptHash = Neon.u.reverseHex(token.bridgeAddress);
@@ -276,7 +277,7 @@ class NEOClient {
276
277
  const props = {
277
278
  scriptHash: wrapperContractScriptHash,
278
279
  operation: "mintTokens",
279
- args: []
280
+ args: [],
280
281
  };
281
282
  const script = Neon.sc.createScript(props);
282
283
  const networkConfig = this.getNetworkConfig();
@@ -288,7 +289,7 @@ class NEOClient {
288
289
  url: rpcUrl,
289
290
  account,
290
291
  intents: intent,
291
- script: script
292
+ script: script,
292
293
  };
293
294
  // Neon API
294
295
  const response = yield neon_js_1.api.doInvoke(config);