@ledgerhq/coin-tron 0.2.2 → 0.2.3

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 (80) hide show
  1. package/.turbo/turbo-build.log +2 -2
  2. package/CHANGELOG.md +14 -0
  3. package/lib/bridge/broadcast.js +3 -12
  4. package/lib/bridge/broadcast.js.map +1 -1
  5. package/lib/bridge/estimateMaxSpendable.js +9 -12
  6. package/lib/bridge/estimateMaxSpendable.js.map +1 -1
  7. package/lib/bridge/getEstimateFees.js +7 -17
  8. package/lib/bridge/getEstimateFees.js.map +1 -1
  9. package/lib/bridge/getTransactionStatus.js +18 -26
  10. package/lib/bridge/getTransactionStatus.js.map +1 -1
  11. package/lib/bridge/preload.js +3 -12
  12. package/lib/bridge/preload.js.map +1 -1
  13. package/lib/bridge/prepareTransaction.js +4 -13
  14. package/lib/bridge/prepareTransaction.js.map +1 -1
  15. package/lib/bridge/serialization.js +8 -8
  16. package/lib/bridge/serialization.js.map +1 -1
  17. package/lib/bridge/signOperation.js +39 -53
  18. package/lib/bridge/signOperation.js.map +1 -1
  19. package/lib/bridge/synchronization.integ.test.js +10 -15
  20. package/lib/bridge/synchronization.integ.test.js.map +1 -1
  21. package/lib/bridge/synchronization.js +25 -23
  22. package/lib/bridge/synchronization.js.map +1 -1
  23. package/lib/bridge/transaction.js +20 -4
  24. package/lib/bridge/transaction.js.map +1 -1
  25. package/lib/logic/utils.test.js +21 -10
  26. package/lib/logic/utils.test.js.map +1 -1
  27. package/lib/network/format.js +4 -5
  28. package/lib/network/format.js.map +1 -1
  29. package/lib/network/index.integ.test.js +3 -12
  30. package/lib/network/index.integ.test.js.map +1 -1
  31. package/lib/network/index.js +296 -321
  32. package/lib/network/index.js.map +1 -1
  33. package/lib/network/index.test.js +4 -14
  34. package/lib/network/index.test.js.map +1 -1
  35. package/lib/signer/getAddress.js +4 -13
  36. package/lib/signer/getAddress.js.map +1 -1
  37. package/lib/test/bridgeDatasetTest.js +33 -7
  38. package/lib/test/bridgeDatasetTest.js.map +1 -1
  39. package/lib/test/cli.js +7 -2
  40. package/lib/test/cli.js.map +1 -1
  41. package/lib-es/bridge/broadcast.js +3 -12
  42. package/lib-es/bridge/broadcast.js.map +1 -1
  43. package/lib-es/bridge/estimateMaxSpendable.js +9 -12
  44. package/lib-es/bridge/estimateMaxSpendable.js.map +1 -1
  45. package/lib-es/bridge/getEstimateFees.js +7 -17
  46. package/lib-es/bridge/getEstimateFees.js.map +1 -1
  47. package/lib-es/bridge/getTransactionStatus.js +18 -26
  48. package/lib-es/bridge/getTransactionStatus.js.map +1 -1
  49. package/lib-es/bridge/preload.js +3 -12
  50. package/lib-es/bridge/preload.js.map +1 -1
  51. package/lib-es/bridge/prepareTransaction.js +4 -13
  52. package/lib-es/bridge/prepareTransaction.js.map +1 -1
  53. package/lib-es/bridge/serialization.js +8 -8
  54. package/lib-es/bridge/serialization.js.map +1 -1
  55. package/lib-es/bridge/signOperation.js +39 -53
  56. package/lib-es/bridge/signOperation.js.map +1 -1
  57. package/lib-es/bridge/synchronization.integ.test.js +10 -15
  58. package/lib-es/bridge/synchronization.integ.test.js.map +1 -1
  59. package/lib-es/bridge/synchronization.js +25 -23
  60. package/lib-es/bridge/synchronization.js.map +1 -1
  61. package/lib-es/bridge/transaction.js +20 -4
  62. package/lib-es/bridge/transaction.js.map +1 -1
  63. package/lib-es/logic/utils.test.js +21 -10
  64. package/lib-es/logic/utils.test.js.map +1 -1
  65. package/lib-es/network/format.js +4 -5
  66. package/lib-es/network/format.js.map +1 -1
  67. package/lib-es/network/index.integ.test.js +3 -12
  68. package/lib-es/network/index.integ.test.js.map +1 -1
  69. package/lib-es/network/index.js +296 -321
  70. package/lib-es/network/index.js.map +1 -1
  71. package/lib-es/network/index.test.js +4 -14
  72. package/lib-es/network/index.test.js.map +1 -1
  73. package/lib-es/signer/getAddress.js +4 -13
  74. package/lib-es/signer/getAddress.js.map +1 -1
  75. package/lib-es/test/bridgeDatasetTest.js +33 -7
  76. package/lib-es/test/bridgeDatasetTest.js.map +1 -1
  77. package/lib-es/test/cli.js +7 -2
  78. package/lib-es/test/cli.js.map +1 -1
  79. package/package.json +4 -4
  80. package/tsconfig.json +0 -1
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
@@ -36,74 +27,68 @@ const format_1 = require("./format");
36
27
  const types_1 = require("./types");
37
28
  const querystring_1 = require("querystring");
38
29
  const getBaseApiUrl = () => (0, config_1.getCoinConfig)().explorer.url;
39
- function post(endPoint, body) {
40
- return __awaiter(this, void 0, void 0, function* () {
41
- const { data } = yield (0, live_network_1.default)({
42
- method: "POST",
43
- url: `${getBaseApiUrl()}${endPoint}`,
44
- data: body,
45
- });
46
- // Ugly but trongrid send a 200 status event if there are errors
47
- if ("Error" in data) {
48
- (0, logs_1.log)("tron-error", (0, querystring_1.stringify)(data.Error), {
49
- endPoint,
50
- body,
51
- });
52
- throw new Error((0, querystring_1.stringify)(data.Error));
53
- }
54
- return data;
30
+ async function post(endPoint, body) {
31
+ const { data } = await (0, live_network_1.default)({
32
+ method: "POST",
33
+ url: `${getBaseApiUrl()}${endPoint}`,
34
+ data: body,
55
35
  });
36
+ // Ugly but trongrid send a 200 status event if there are errors
37
+ if ("Error" in data) {
38
+ (0, logs_1.log)("tron-error", (0, querystring_1.stringify)(data.Error), {
39
+ endPoint,
40
+ body,
41
+ });
42
+ throw new Error((0, querystring_1.stringify)(data.Error));
43
+ }
44
+ return data;
56
45
  }
57
- function fetch(endPoint) {
58
- return __awaiter(this, void 0, void 0, function* () {
59
- return fetchWithBaseUrl(`${getBaseApiUrl()}${endPoint}`);
60
- });
46
+ async function fetch(endPoint) {
47
+ return fetchWithBaseUrl(`${getBaseApiUrl()}${endPoint}`);
61
48
  }
62
- function fetchWithBaseUrl(url) {
63
- return __awaiter(this, void 0, void 0, function* () {
64
- const { data } = yield (0, live_network_1.default)({ url });
65
- // Ugly but trongrid send a 200 status event if there are errors
66
- if ("Error" in data) {
67
- (0, logs_1.log)("tron-error", (0, querystring_1.stringify)(data.Error), {
68
- url,
69
- });
70
- throw new Error((0, querystring_1.stringify)(data.Error));
71
- }
72
- return data;
73
- });
49
+ async function fetchWithBaseUrl(url) {
50
+ const { data } = await (0, live_network_1.default)({ url });
51
+ // Ugly but trongrid send a 200 status event if there are errors
52
+ if ("Error" in data) {
53
+ (0, logs_1.log)("tron-error", (0, querystring_1.stringify)(data.Error), {
54
+ url,
55
+ });
56
+ throw new Error((0, querystring_1.stringify)(data.Error));
57
+ }
58
+ return data;
74
59
  }
75
- const freezeTronTransaction = (account, transaction) => __awaiter(void 0, void 0, void 0, function* () {
60
+ const freezeTronTransaction = async (account, transaction) => {
76
61
  const txData = {
77
62
  frozen_balance: transaction.amount.toNumber(),
78
63
  resource: transaction.resource,
79
64
  owner_address: (0, format_1.decode58Check)(account.freshAddress),
80
65
  };
81
66
  const url = `/wallet/freezebalancev2`;
82
- const result = yield post(url, txData);
67
+ const result = await post(url, txData);
83
68
  return result;
84
- });
69
+ };
85
70
  exports.freezeTronTransaction = freezeTronTransaction;
86
- const unfreezeTronTransaction = (account, transaction) => __awaiter(void 0, void 0, void 0, function* () {
71
+ const unfreezeTronTransaction = async (account, transaction) => {
87
72
  const txData = {
88
73
  owner_address: (0, format_1.decode58Check)(account.freshAddress),
89
74
  resource: transaction.resource,
90
75
  unfreeze_balance: transaction.amount.toNumber(),
91
76
  };
92
77
  const url = `/wallet/unfreezebalancev2`;
93
- const result = yield post(url, txData);
78
+ const result = await post(url, txData);
94
79
  return result;
95
- });
80
+ };
96
81
  exports.unfreezeTronTransaction = unfreezeTronTransaction;
97
- const withdrawExpireUnfreezeTronTransaction = (account, _transaction) => __awaiter(void 0, void 0, void 0, function* () {
82
+ const withdrawExpireUnfreezeTronTransaction = async (account, _transaction) => {
98
83
  const txData = {
99
84
  owner_address: (0, format_1.decode58Check)(account.freshAddress),
100
85
  };
101
86
  const url = `/wallet/withdrawexpireunfreeze`;
102
- const result = yield post(url, txData);
87
+ const result = await post(url, txData);
103
88
  return result;
104
- });
89
+ };
105
90
  exports.withdrawExpireUnfreezeTronTransaction = withdrawExpireUnfreezeTronTransaction;
106
- const unDelegateResourceTransaction = (account, transaction) => __awaiter(void 0, void 0, void 0, function* () {
91
+ const unDelegateResourceTransaction = async (account, transaction) => {
107
92
  const txData = {
108
93
  balance: transaction.amount.toNumber(),
109
94
  resource: transaction.resource,
@@ -111,43 +96,41 @@ const unDelegateResourceTransaction = (account, transaction) => __awaiter(void 0
111
96
  receiver_address: (0, format_1.decode58Check)(transaction.recipient),
112
97
  };
113
98
  const url = `/wallet/undelegateresource`;
114
- const result = yield post(url, txData);
99
+ const result = await post(url, txData);
115
100
  return result;
116
- });
101
+ };
117
102
  exports.unDelegateResourceTransaction = unDelegateResourceTransaction;
118
- const legacyUnfreezeTronTransaction = (account, transaction) => __awaiter(void 0, void 0, void 0, function* () {
103
+ const legacyUnfreezeTronTransaction = async (account, transaction) => {
119
104
  const txData = {
120
105
  resource: transaction.resource,
121
106
  owner_address: (0, format_1.decode58Check)(account.freshAddress),
122
107
  receiver_address: transaction.recipient ? (0, format_1.decode58Check)(transaction.recipient) : undefined,
123
108
  };
124
109
  const url = `/wallet/unfreezebalance`;
125
- const result = yield post(url, txData);
110
+ const result = await post(url, txData);
126
111
  return result;
127
- });
112
+ };
128
113
  exports.legacyUnfreezeTronTransaction = legacyUnfreezeTronTransaction;
129
- function getDelegatedResource(account, transaction, resource) {
130
- return __awaiter(this, void 0, void 0, function* () {
131
- const url = `/wallet/getdelegatedresourcev2`;
132
- const { delegatedResource = [], } = yield post(url, {
133
- fromAddress: (0, format_1.decode58Check)(account.freshAddress),
134
- toAddress: (0, format_1.decode58Check)(transaction.recipient),
135
- });
136
- const { frozen_balance_for_bandwidth, frozen_balance_for_energy } = delegatedResource.reduce((accum, cur) => {
137
- if (cur.frozen_balance_for_bandwidth) {
138
- accum.frozen_balance_for_bandwidth += cur.frozen_balance_for_bandwidth;
139
- }
140
- if (cur.frozen_balance_for_energy) {
141
- accum.frozen_balance_for_energy += cur.frozen_balance_for_energy;
142
- }
143
- return accum;
144
- }, { frozen_balance_for_bandwidth: 0, frozen_balance_for_energy: 0 });
145
- const amount = resource === "BANDWIDTH" ? frozen_balance_for_bandwidth : frozen_balance_for_energy;
146
- return new bignumber_js_1.BigNumber(amount);
114
+ async function getDelegatedResource(account, transaction, resource) {
115
+ const url = `/wallet/getdelegatedresourcev2`;
116
+ const { delegatedResource = [], } = await post(url, {
117
+ fromAddress: (0, format_1.decode58Check)(account.freshAddress),
118
+ toAddress: (0, format_1.decode58Check)(transaction.recipient),
147
119
  });
120
+ const { frozen_balance_for_bandwidth, frozen_balance_for_energy } = delegatedResource.reduce((accum, cur) => {
121
+ if (cur.frozen_balance_for_bandwidth) {
122
+ accum.frozen_balance_for_bandwidth += cur.frozen_balance_for_bandwidth;
123
+ }
124
+ if (cur.frozen_balance_for_energy) {
125
+ accum.frozen_balance_for_energy += cur.frozen_balance_for_energy;
126
+ }
127
+ return accum;
128
+ }, { frozen_balance_for_bandwidth: 0, frozen_balance_for_energy: 0 });
129
+ const amount = resource === "BANDWIDTH" ? frozen_balance_for_bandwidth : frozen_balance_for_energy;
130
+ return new bignumber_js_1.BigNumber(amount);
148
131
  }
149
132
  // Send trx or trc10/trc20 tokens
150
- const createTronTransaction = (account, transaction, subAccount) => __awaiter(void 0, void 0, void 0, function* () {
133
+ const createTronTransaction = async (account, transaction, subAccount) => {
151
134
  const [tokenType, tokenId] = subAccount && subAccount.type === "TokenAccount"
152
135
  ? (0, drop_1.default)(subAccount.token.id.split("/"), 1)
153
136
  : [undefined, undefined];
@@ -163,7 +146,7 @@ const createTronTransaction = (account, transaction, subAccount) => __awaiter(vo
163
146
  owner_address: (0, format_1.decode58Check)(account.freshAddress),
164
147
  };
165
148
  const url = `/wallet/triggersmartcontract`;
166
- const { transaction: preparedTransaction } = yield post(url, txData);
149
+ const { transaction: preparedTransaction } = await post(url, txData);
167
150
  return extendTronTxExpirationTimeBy10mn(preparedTransaction);
168
151
  }
169
152
  else {
@@ -175,11 +158,11 @@ const createTronTransaction = (account, transaction, subAccount) => __awaiter(vo
175
158
  asset_name: tokenId && Buffer.from(tokenId).toString("hex"),
176
159
  };
177
160
  const url = subAccount ? `/wallet/transferasset` : `/wallet/createtransaction`;
178
- const preparedTransaction = yield post(url, txData);
161
+ const preparedTransaction = await post(url, txData);
179
162
  // for the ledger Vault we need to increase the expiration
180
163
  return extendTronTxExpirationTimeBy10mn(preparedTransaction);
181
164
  }
182
- });
165
+ };
183
166
  exports.createTronTransaction = createTronTransaction;
184
167
  function extendTronTxExpirationTimeBy10mn(preparedTransaction) {
185
168
  const VAULT_EXPIRATION_TIME = 600;
@@ -191,116 +174,104 @@ function extendTronTxExpirationTimeBy10mn(preparedTransaction) {
191
174
  //FIXME: test it and rewrite it
192
175
  return tronWeb.transactionBuilder.extendExpiration(preparedTransaction, VAULT_EXPIRATION_TIME);
193
176
  }
194
- const broadcastTron = (trxTransaction) => __awaiter(void 0, void 0, void 0, function* () {
195
- const result = yield post(`/wallet/broadcasttransaction`, trxTransaction);
177
+ const broadcastTron = async (trxTransaction) => {
178
+ const result = await post(`/wallet/broadcasttransaction`, trxTransaction);
196
179
  if (result.code === "TRANSACTION_EXPIRATION_ERROR") {
197
180
  throw new errors_1.TronTransactionExpired();
198
181
  }
199
182
  return result;
200
- });
183
+ };
201
184
  exports.broadcastTron = broadcastTron;
202
- function fetchTronAccount(addr) {
203
- return __awaiter(this, void 0, void 0, function* () {
204
- try {
205
- const data = yield fetch(`/v1/accounts/${addr}`);
206
- return data.data;
207
- }
208
- catch (e) {
209
- return [];
210
- }
211
- });
185
+ async function fetchTronAccount(addr) {
186
+ try {
187
+ const data = await fetch(`/v1/accounts/${addr}`);
188
+ return data.data;
189
+ }
190
+ catch (e) {
191
+ return [];
192
+ }
212
193
  }
213
- function fetchCurrentBlockHeight() {
214
- return __awaiter(this, void 0, void 0, function* () {
215
- const data = yield fetch(`/wallet/getnowblock`);
216
- return data.block_header.raw_data.number;
217
- });
194
+ async function fetchCurrentBlockHeight() {
195
+ const data = await fetch(`/wallet/getnowblock`);
196
+ return data.block_header.raw_data.number;
218
197
  }
219
198
  // For the moment, fetching transaction info is the only way to get fees from a transaction
220
- function fetchTronTxDetail(txId) {
221
- return __awaiter(this, void 0, void 0, function* () {
222
- const { fee, blockNumber, withdraw_amount, unfreeze_amount } = yield fetch(`/wallet/gettransactioninfobyid?value=${encodeURIComponent(txId)}`);
223
- return {
224
- fee,
225
- blockNumber,
226
- withdraw_amount,
227
- unfreeze_amount,
228
- };
229
- });
199
+ async function fetchTronTxDetail(txId) {
200
+ const { fee, blockNumber, withdraw_amount, unfreeze_amount } = await fetch(`/wallet/gettransactioninfobyid?value=${encodeURIComponent(txId)}`);
201
+ return {
202
+ fee,
203
+ blockNumber,
204
+ withdraw_amount,
205
+ unfreeze_amount,
206
+ };
230
207
  }
231
- function getAllTransactions(initialUrl, shouldFetchMoreTxs, getTxs) {
232
- return __awaiter(this, void 0, void 0, function* () {
233
- let all = [];
234
- let url = initialUrl;
235
- while (url && shouldFetchMoreTxs(all)) {
236
- const { nextUrl, results } = yield getTxs(url);
237
- url = nextUrl;
238
- all = all.concat(results);
239
- }
240
- return all;
241
- });
208
+ async function getAllTransactions(initialUrl, shouldFetchMoreTxs, getTxs) {
209
+ let all = [];
210
+ let url = initialUrl;
211
+ while (url && shouldFetchMoreTxs(all)) {
212
+ const { nextUrl, results } = await getTxs(url);
213
+ url = nextUrl;
214
+ all = all.concat(results);
215
+ }
216
+ return all;
242
217
  }
243
- const getTransactions = (cacheTransactionInfoById) => (url) => __awaiter(void 0, void 0, void 0, function* () {
244
- var _a, _b;
245
- const transactions = yield fetchWithBaseUrl(url);
246
- const nextUrl = (_b = (_a = transactions.meta.links) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.replace(/https:\/\/api(\.[a-z]*)?.trongrid.io/, getBaseApiUrl());
247
- const results = yield (0, live_promise_1.promiseAllBatched)(3, transactions.data || [], (tx) => __awaiter(void 0, void 0, void 0, function* () {
218
+ const getTransactions = (cacheTransactionInfoById) => async (url) => {
219
+ const transactions = await fetchWithBaseUrl(url);
220
+ const nextUrl = transactions.meta.links?.next?.replace(/https:\/\/api(\.[a-z]*)?.trongrid.io/, getBaseApiUrl());
221
+ const results = await (0, live_promise_1.promiseAllBatched)(3, transactions.data || [], async (tx) => {
248
222
  if ((0, types_1.isMalformedTransactionTronAPI)(tx)) {
249
223
  return tx;
250
224
  }
251
225
  const txID = tx.txID;
252
- const detail = cacheTransactionInfoById[txID] || (yield fetchTronTxDetail(txID));
226
+ const detail = cacheTransactionInfoById[txID] || (await fetchTronTxDetail(txID));
253
227
  cacheTransactionInfoById[txID] = detail;
254
- return Object.assign(Object.assign({}, tx), { detail });
255
- }));
228
+ return { ...tx, detail };
229
+ });
256
230
  return {
257
231
  results,
258
232
  nextUrl,
259
233
  };
260
- });
261
- const getTrc20 = (url) => __awaiter(void 0, void 0, void 0, function* () {
262
- var _a, _b;
263
- const transactions = yield fetchWithBaseUrl(url);
234
+ };
235
+ const getTrc20 = async (url) => {
236
+ const transactions = await fetchWithBaseUrl(url);
264
237
  return {
265
238
  results: transactions.data,
266
- nextUrl: (_b = (_a = transactions.meta.links) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.replace(/https:\/\/api(\.[a-z]*)?.trongrid.io/, getBaseApiUrl()),
239
+ nextUrl: transactions.meta.links?.next?.replace(/https:\/\/api(\.[a-z]*)?.trongrid.io/, getBaseApiUrl()),
267
240
  };
268
- });
269
- function fetchTronAccountTxs(addr, shouldFetchMoreTxs, cacheTransactionInfoById) {
270
- return __awaiter(this, void 0, void 0, function* () {
271
- const entireTxs = (yield getAllTransactions(`${getBaseApiUrl()}/v1/accounts/${addr}/transactions?limit=100`, shouldFetchMoreTxs, getTransactions(cacheTransactionInfoById)))
272
- .filter((tx) => (0, types_1.isTransactionTronAPI)(tx))
273
- .filter(tx => {
274
- // custom smart contract tx has internal txs
275
- const hasInternalTxs = tx.txID && tx.internal_transactions && tx.internal_transactions.length > 0;
276
- // and also a duplicated malformed tx that we have to ignore
277
- const isDuplicated = tx.tx_id;
278
- const type = tx.raw_data.contract[0].type;
279
- if (hasInternalTxs) {
280
- // log once
281
- (0, logs_1.log)("tron-error", `unsupported transaction ${tx.txID}`);
282
- }
283
- return !isDuplicated && !hasInternalTxs && type !== "TriggerSmartContract";
284
- })
285
- .map(tx => (0, format_1.formatTrongridTxResponse)(tx));
286
- // we need to fetch and filter trc20 transactions from another endpoint
287
- const entireTrc20Txs = (yield getAllTransactions(`${getBaseApiUrl()}/v1/accounts/${addr}/transactions/trc20?get_detail=true`, shouldFetchMoreTxs, getTrc20)).map(tx => (0, format_1.formatTrongridTrc20TxResponse)(tx));
288
- const txInfos = (0, compact_1.default)(entireTxs.concat(entireTrc20Txs)).sort((a, b) => b.date.getTime() - a.date.getTime());
289
- return txInfos;
290
- });
241
+ };
242
+ async function fetchTronAccountTxs(addr, shouldFetchMoreTxs, cacheTransactionInfoById) {
243
+ const entireTxs = (await getAllTransactions(`${getBaseApiUrl()}/v1/accounts/${addr}/transactions?limit=100`, shouldFetchMoreTxs, getTransactions(cacheTransactionInfoById)))
244
+ .filter((tx) => (0, types_1.isTransactionTronAPI)(tx))
245
+ .filter(tx => {
246
+ // custom smart contract tx has internal txs
247
+ const hasInternalTxs = tx.txID && tx.internal_transactions && tx.internal_transactions.length > 0;
248
+ // and also a duplicated malformed tx that we have to ignore
249
+ const isDuplicated = tx.tx_id;
250
+ const type = tx.raw_data.contract[0].type;
251
+ if (hasInternalTxs) {
252
+ // log once
253
+ (0, logs_1.log)("tron-error", `unsupported transaction ${tx.txID}`);
254
+ }
255
+ return !isDuplicated && !hasInternalTxs && type !== "TriggerSmartContract";
256
+ })
257
+ .map(tx => (0, format_1.formatTrongridTxResponse)(tx));
258
+ // we need to fetch and filter trc20 transactions from another endpoint
259
+ const entireTrc20Txs = (await getAllTransactions(`${getBaseApiUrl()}/v1/accounts/${addr}/transactions/trc20?get_detail=true`, shouldFetchMoreTxs, getTrc20)).map(tx => (0, format_1.formatTrongridTrc20TxResponse)(tx));
260
+ const txInfos = (0, compact_1.default)(entireTxs.concat(entireTrc20Txs)).sort((a, b) => b.date.getTime() - a.date.getTime());
261
+ return txInfos;
291
262
  }
292
- const getContractUserEnergyRatioConsumption = (address) => __awaiter(void 0, void 0, void 0, function* () {
293
- const result = yield (0, exports.fetchTronContract)(address);
263
+ const getContractUserEnergyRatioConsumption = async (address) => {
264
+ const result = await (0, exports.fetchTronContract)(address);
294
265
  if (result) {
295
266
  const { consume_user_resource_percent } = result;
296
267
  return consume_user_resource_percent;
297
268
  }
298
269
  return 0;
299
- });
270
+ };
300
271
  exports.getContractUserEnergyRatioConsumption = getContractUserEnergyRatioConsumption;
301
- const fetchTronContract = (addr) => __awaiter(void 0, void 0, void 0, function* () {
272
+ const fetchTronContract = async (addr) => {
302
273
  try {
303
- const data = yield post(`/wallet/getcontract`, {
274
+ const data = await post(`/wallet/getcontract`, {
304
275
  value: (0, format_1.decode58Check)(addr),
305
276
  });
306
277
  return Object.keys(data).length !== 0 ? data : undefined;
@@ -308,10 +279,10 @@ const fetchTronContract = (addr) => __awaiter(void 0, void 0, void 0, function*
308
279
  catch (e) {
309
280
  return undefined;
310
281
  }
311
- });
282
+ };
312
283
  exports.fetchTronContract = fetchTronContract;
313
- const getTronAccountNetwork = (address) => __awaiter(void 0, void 0, void 0, function* () {
314
- const result = yield fetch(`/wallet/getaccountresource?address=${encodeURIComponent((0, format_1.decode58Check)(address))}`);
284
+ const getTronAccountNetwork = async (address) => {
285
+ const result = await fetch(`/wallet/getaccountresource?address=${encodeURIComponent((0, format_1.decode58Check)(address))}`);
315
286
  const { freeNetUsed = 0, freeNetLimit = 0, NetUsed = 0, NetLimit = 0, EnergyUsed = 0, EnergyLimit = 0, } = result;
316
287
  return {
317
288
  family: "tron",
@@ -322,11 +293,11 @@ const getTronAccountNetwork = (address) => __awaiter(void 0, void 0, void 0, fun
322
293
  energyUsed: new bignumber_js_1.BigNumber(EnergyUsed),
323
294
  energyLimit: new bignumber_js_1.BigNumber(EnergyLimit),
324
295
  };
325
- });
296
+ };
326
297
  exports.getTronAccountNetwork = getTronAccountNetwork;
327
- const validateAddress = (address) => __awaiter(void 0, void 0, void 0, function* () {
298
+ const validateAddress = async (address) => {
328
299
  try {
329
- const result = yield post(`/wallet/validateaddress`, {
300
+ const result = await post(`/wallet/validateaddress`, {
330
301
  address: (0, format_1.decode58Check)(address),
331
302
  });
332
303
  return result.result || false;
@@ -338,68 +309,75 @@ const validateAddress = (address) => __awaiter(void 0, void 0, void 0, function*
338
309
  });
339
310
  return false;
340
311
  }
341
- });
312
+ };
342
313
  exports.validateAddress = validateAddress;
343
314
  // cache for account names (name is unchanged over time)
344
- const accountNamesCache = (0, cache_1.makeLRUCache)((addr) => __awaiter(void 0, void 0, void 0, function* () { return (0, exports.getAccountName)(addr); }), (addr) => addr, (0, cache_1.hours)(3, 300));
315
+ const accountNamesCache = (0, cache_1.makeLRUCache)(async (addr) => (0, exports.getAccountName)(addr), (addr) => addr, (0, cache_1.hours)(3, 300));
345
316
  // cache for super representative brokerages (brokerage is unchanged over time)
346
- const srBrokeragesCache = (0, cache_1.makeLRUCache)((addr) => __awaiter(void 0, void 0, void 0, function* () { return (0, exports.getBrokerage)(addr); }), (addr) => addr, (0, cache_1.hours)(3, 300));
347
- const getAccountName = (addr) => __awaiter(void 0, void 0, void 0, function* () {
348
- const tronAcc = yield fetchTronAccount(addr);
317
+ const srBrokeragesCache = (0, cache_1.makeLRUCache)(async (addr) => (0, exports.getBrokerage)(addr), (addr) => addr, (0, cache_1.hours)(3, 300));
318
+ const getAccountName = async (addr) => {
319
+ const tronAcc = await fetchTronAccount(addr);
349
320
  const acc = tronAcc[0];
350
321
  const accountName = acc && acc.account_name ? (0, utils_1.hexToAscii)(acc.account_name) : undefined;
351
322
  accountNamesCache.hydrate(addr, accountName); // put it in cache
352
323
  return accountName;
353
- });
324
+ };
354
325
  exports.getAccountName = getAccountName;
355
- const getBrokerage = (addr) => __awaiter(void 0, void 0, void 0, function* () {
356
- const { brokerage } = yield fetch(`/wallet/getBrokerage?address=${encodeURIComponent(addr)}`);
326
+ const getBrokerage = async (addr) => {
327
+ const { brokerage } = await fetch(`/wallet/getBrokerage?address=${encodeURIComponent(addr)}`);
357
328
  srBrokeragesCache.hydrate(addr, brokerage); // put it in cache
358
329
  return brokerage;
359
- });
330
+ };
360
331
  exports.getBrokerage = getBrokerage;
361
- const superRepresentativesCache = (0, cache_1.makeLRUCache)(() => __awaiter(void 0, void 0, void 0, function* () {
362
- const superRepresentatives = yield fetchSuperRepresentatives();
332
+ const superRepresentativesCache = (0, cache_1.makeLRUCache)(async () => {
333
+ const superRepresentatives = await fetchSuperRepresentatives();
363
334
  (0, logs_1.log)("tron/superRepresentatives", "loaded " + superRepresentatives.length + " super representatives");
364
335
  return superRepresentatives;
365
- }), () => "", (0, cache_1.hours)(1, 300));
366
- const getTronSuperRepresentatives = () => __awaiter(void 0, void 0, void 0, function* () {
367
- return yield superRepresentativesCache();
368
- });
336
+ }, () => "", (0, cache_1.hours)(1, 300));
337
+ const getTronSuperRepresentatives = async () => {
338
+ return await superRepresentativesCache();
339
+ };
369
340
  exports.getTronSuperRepresentatives = getTronSuperRepresentatives;
370
341
  const hydrateSuperRepresentatives = (list) => {
371
342
  (0, logs_1.log)("tron/superRepresentatives", "hydrate " + list.length + " super representatives");
372
343
  superRepresentativesCache.hydrate("", list);
373
344
  };
374
345
  exports.hydrateSuperRepresentatives = hydrateSuperRepresentatives;
375
- const fetchSuperRepresentatives = () => __awaiter(void 0, void 0, void 0, function* () {
376
- const result = yield fetch(`/wallet/listwitnesses`);
346
+ const fetchSuperRepresentatives = async () => {
347
+ const result = await fetch(`/wallet/listwitnesses`);
377
348
  const sorted = result.witnesses.sort((a, b) => b.voteCount - a.voteCount);
378
- const superRepresentatives = yield (0, live_promise_1.promiseAllBatched)(3, sorted, (w) => __awaiter(void 0, void 0, void 0, function* () {
349
+ const superRepresentatives = await (0, live_promise_1.promiseAllBatched)(3, sorted, async (w) => {
379
350
  const encodedAddress = (0, format_1.encode58Check)(w.address);
380
- const accountName = yield accountNamesCache(encodedAddress);
381
- const brokerage = yield srBrokeragesCache(encodedAddress);
382
- return Object.assign(Object.assign({}, w), { address: encodedAddress, name: accountName, brokerage, voteCount: w.voteCount || 0, isJobs: w.isJobs || false });
383
- }));
351
+ const accountName = await accountNamesCache(encodedAddress);
352
+ const brokerage = await srBrokeragesCache(encodedAddress);
353
+ return {
354
+ ...w,
355
+ address: encodedAddress,
356
+ name: accountName,
357
+ brokerage,
358
+ voteCount: w.voteCount || 0,
359
+ isJobs: w.isJobs || false,
360
+ };
361
+ });
384
362
  (0, exports.hydrateSuperRepresentatives)(superRepresentatives); // put it in cache
385
363
  return superRepresentatives;
386
- });
387
- const getNextVotingDate = () => __awaiter(void 0, void 0, void 0, function* () {
388
- const { num } = yield fetch(`/wallet/getnextmaintenancetime`);
364
+ };
365
+ const getNextVotingDate = async () => {
366
+ const { num } = await fetch(`/wallet/getnextmaintenancetime`);
389
367
  return new Date(num);
390
- });
368
+ };
391
369
  exports.getNextVotingDate = getNextVotingDate;
392
- const getTronSuperRepresentativeData = (max) => __awaiter(void 0, void 0, void 0, function* () {
393
- const list = yield (0, exports.getTronSuperRepresentatives)();
394
- const nextVotingDate = yield (0, exports.getNextVotingDate)();
370
+ const getTronSuperRepresentativeData = async (max) => {
371
+ const list = await (0, exports.getTronSuperRepresentatives)();
372
+ const nextVotingDate = await (0, exports.getNextVotingDate)();
395
373
  return {
396
374
  list: max ? (0, take_1.default)(list, max) : list,
397
375
  totalVotes: (0, sumBy_1.default)(list, "voteCount"),
398
376
  nextVotingDate,
399
377
  };
400
- });
378
+ };
401
379
  exports.getTronSuperRepresentativeData = getTronSuperRepresentativeData;
402
- const voteTronSuperRepresentatives = (account, transaction) => __awaiter(void 0, void 0, void 0, function* () {
380
+ const voteTronSuperRepresentatives = async (account, transaction) => {
403
381
  const payload = {
404
382
  owner_address: (0, format_1.decode58Check)(account.freshAddress),
405
383
  votes: transaction.votes.map(v => ({
@@ -407,149 +385,146 @@ const voteTronSuperRepresentatives = (account, transaction) => __awaiter(void 0,
407
385
  vote_count: v.voteCount,
408
386
  })),
409
387
  };
410
- return yield post(`/wallet/votewitnessaccount`, payload);
411
- });
388
+ return await post(`/wallet/votewitnessaccount`, payload);
389
+ };
412
390
  exports.voteTronSuperRepresentatives = voteTronSuperRepresentatives;
413
- function getTronResources(acc_1, txs_1) {
414
- return __awaiter(this, arguments, void 0, function* (acc, txs, cacheTransactionInfoById = {}) {
415
- if (!acc) {
416
- return utils_1.defaultTronResources;
391
+ async function getTronResources(acc, txs, cacheTransactionInfoById = {}) {
392
+ if (!acc) {
393
+ return utils_1.defaultTronResources;
394
+ }
395
+ const delegatedFrozenBandwidth = (0, get_1.default)(acc, "delegated_frozenV2_balance_for_bandwidth", undefined);
396
+ const delegatedFrozenEnergy = (0, get_1.default)(acc, "account_resource.delegated_frozenV2_balance_for_energy", undefined);
397
+ const frozenBalances = (0, get_1.default)(acc, "frozenV2", undefined);
398
+ const legacyFrozenBandwidth = (0, get_1.default)(acc, "frozen[0]", undefined);
399
+ const legacyFrozenEnergy = (0, get_1.default)(acc, "account_resource.frozen_balance_for_energy", undefined);
400
+ const legacyFrozen = {
401
+ bandwidth: legacyFrozenBandwidth
402
+ ? {
403
+ amount: new bignumber_js_1.BigNumber(legacyFrozenBandwidth.frozen_balance),
404
+ expiredAt: new Date(legacyFrozenBandwidth.expire_time),
405
+ }
406
+ : undefined,
407
+ energy: legacyFrozenEnergy
408
+ ? {
409
+ amount: new bignumber_js_1.BigNumber(legacyFrozenEnergy.frozen_balance),
410
+ expiredAt: new Date(legacyFrozenEnergy.expire_time),
411
+ }
412
+ : undefined,
413
+ };
414
+ const { frozenEnergy, frozenBandwidth } = frozenBalances.reduce((accum, cur) => {
415
+ const amount = new bignumber_js_1.BigNumber(cur?.amount ?? 0);
416
+ if (cur.type === "ENERGY") {
417
+ accum.frozenEnergy = accum.frozenEnergy.plus(amount);
417
418
  }
418
- const delegatedFrozenBandwidth = (0, get_1.default)(acc, "delegated_frozenV2_balance_for_bandwidth", undefined);
419
- const delegatedFrozenEnergy = (0, get_1.default)(acc, "account_resource.delegated_frozenV2_balance_for_energy", undefined);
420
- const frozenBalances = (0, get_1.default)(acc, "frozenV2", undefined);
421
- const legacyFrozenBandwidth = (0, get_1.default)(acc, "frozen[0]", undefined);
422
- const legacyFrozenEnergy = (0, get_1.default)(acc, "account_resource.frozen_balance_for_energy", undefined);
423
- const legacyFrozen = {
424
- bandwidth: legacyFrozenBandwidth
425
- ? {
426
- amount: new bignumber_js_1.BigNumber(legacyFrozenBandwidth.frozen_balance),
427
- expiredAt: new Date(legacyFrozenBandwidth.expire_time),
428
- }
429
- : undefined,
430
- energy: legacyFrozenEnergy
431
- ? {
432
- amount: new bignumber_js_1.BigNumber(legacyFrozenEnergy.frozen_balance),
433
- expiredAt: new Date(legacyFrozenEnergy.expire_time),
434
- }
435
- : undefined,
436
- };
437
- const { frozenEnergy, frozenBandwidth } = frozenBalances.reduce((accum, cur) => {
438
- var _a;
439
- const amount = new bignumber_js_1.BigNumber((_a = cur === null || cur === void 0 ? void 0 : cur.amount) !== null && _a !== void 0 ? _a : 0);
440
- if (cur.type === "ENERGY") {
441
- accum.frozenEnergy = accum.frozenEnergy.plus(amount);
419
+ else if (cur.type === undefined) {
420
+ accum.frozenBandwidth = accum.frozenBandwidth.plus(amount);
421
+ }
422
+ return accum;
423
+ }, {
424
+ frozenEnergy: new bignumber_js_1.BigNumber(0),
425
+ frozenBandwidth: new bignumber_js_1.BigNumber(0),
426
+ });
427
+ const unFrozenBalances = (0, get_1.default)(acc, "unfrozenV2", undefined);
428
+ const unFrozen = unFrozenBalances
429
+ ? unFrozenBalances.reduce((accum, cur) => {
430
+ if (cur && cur.type === "ENERGY") {
431
+ accum.energy.push({
432
+ amount: new bignumber_js_1.BigNumber(cur.unfreeze_amount),
433
+ expireTime: new Date(cur.unfreeze_expire_time),
434
+ });
442
435
  }
443
- else if (cur.type === undefined) {
444
- accum.frozenBandwidth = accum.frozenBandwidth.plus(amount);
436
+ else if (cur) {
437
+ accum.bandwidth.push({
438
+ amount: new bignumber_js_1.BigNumber(cur.unfreeze_amount),
439
+ expireTime: new Date(cur.unfreeze_expire_time),
440
+ });
445
441
  }
446
442
  return accum;
447
- }, {
448
- frozenEnergy: new bignumber_js_1.BigNumber(0),
449
- frozenBandwidth: new bignumber_js_1.BigNumber(0),
450
- });
451
- const unFrozenBalances = (0, get_1.default)(acc, "unfrozenV2", undefined);
452
- const unFrozen = unFrozenBalances
453
- ? unFrozenBalances.reduce((accum, cur) => {
454
- if (cur && cur.type === "ENERGY") {
455
- accum.energy.push({
456
- amount: new bignumber_js_1.BigNumber(cur.unfreeze_amount),
457
- expireTime: new Date(cur.unfreeze_expire_time),
458
- });
459
- }
460
- else if (cur) {
461
- accum.bandwidth.push({
462
- amount: new bignumber_js_1.BigNumber(cur.unfreeze_amount),
463
- expireTime: new Date(cur.unfreeze_expire_time),
464
- });
465
- }
466
- return accum;
467
- }, { bandwidth: [], energy: [] })
468
- : { bandwidth: [], energy: [] };
469
- const encodedAddress = (0, format_1.encode58Check)(acc.address);
470
- const tronNetworkInfo = yield (0, exports.getTronAccountNetwork)(encodedAddress);
471
- const unwithdrawnReward = yield (0, exports.getUnwithdrawnReward)(encodedAddress);
472
- const energy = tronNetworkInfo.energyLimit.minus(tronNetworkInfo.energyUsed);
473
- const bandwidth = (0, utils_1.extractBandwidthInfo)(tronNetworkInfo);
474
- const frozen = {
475
- bandwidth: frozenBandwidth.isGreaterThan(0)
476
- ? {
477
- amount: frozenBandwidth,
478
- }
479
- : undefined,
480
- energy: frozenEnergy.isGreaterThan(0)
481
- ? {
482
- amount: frozenEnergy,
483
- }
484
- : undefined,
485
- };
486
- const delegatedFrozen = {
487
- bandwidth: delegatedFrozenBandwidth
488
- ? {
489
- amount: new bignumber_js_1.BigNumber(delegatedFrozenBandwidth),
490
- }
491
- : undefined,
492
- energy: delegatedFrozenEnergy
493
- ? {
494
- amount: new bignumber_js_1.BigNumber(delegatedFrozenEnergy),
495
- }
496
- : undefined,
497
- };
498
- const tronPower = new bignumber_js_1.BigNumber((0, get_1.default)(frozen, "bandwidth.amount", 0))
499
- .plus((0, get_1.default)(frozen, "energy.amount", 0))
500
- .plus((0, get_1.default)(delegatedFrozen, "bandwidth.amount", 0))
501
- .plus((0, get_1.default)(delegatedFrozen, "energy.amount", 0))
502
- .plus((0, get_1.default)(legacyFrozen, "energy.amount", 0))
503
- .plus((0, get_1.default)(legacyFrozen, "bandwidth.amount", 0))
504
- .dividedBy(1000000)
505
- .integerValue(bignumber_js_1.BigNumber.ROUND_FLOOR)
506
- .toNumber();
507
- const votes = (0, get_1.default)(acc, "votes", []).map((v) => ({
508
- address: v.vote_address,
509
- voteCount: v.vote_count,
510
- }));
511
- const lastWithdrawnRewardDate = acc.latest_withdraw_time
512
- ? new Date(acc.latest_withdraw_time)
513
- : undefined;
514
- // TODO: rely on the account object when trongrid will provide this info.
515
- const getLastVotedDate = (txs) => {
516
- const lastOp = txs.find(({ type }) => type === "VoteWitnessContract");
517
- return lastOp ? lastOp.date : null;
518
- };
519
- const lastVotedDate = txs ? getLastVotedDate(txs) : undefined;
520
- return {
521
- energy,
522
- bandwidth,
523
- frozen,
524
- unFrozen,
525
- delegatedFrozen,
526
- legacyFrozen,
527
- votes,
528
- tronPower,
529
- unwithdrawnReward,
530
- lastWithdrawnRewardDate,
531
- lastVotedDate,
532
- cacheTransactionInfoById,
533
- };
534
- });
443
+ }, { bandwidth: [], energy: [] })
444
+ : { bandwidth: [], energy: [] };
445
+ const encodedAddress = (0, format_1.encode58Check)(acc.address);
446
+ const tronNetworkInfo = await (0, exports.getTronAccountNetwork)(encodedAddress);
447
+ const unwithdrawnReward = await (0, exports.getUnwithdrawnReward)(encodedAddress);
448
+ const energy = tronNetworkInfo.energyLimit.minus(tronNetworkInfo.energyUsed);
449
+ const bandwidth = (0, utils_1.extractBandwidthInfo)(tronNetworkInfo);
450
+ const frozen = {
451
+ bandwidth: frozenBandwidth.isGreaterThan(0)
452
+ ? {
453
+ amount: frozenBandwidth,
454
+ }
455
+ : undefined,
456
+ energy: frozenEnergy.isGreaterThan(0)
457
+ ? {
458
+ amount: frozenEnergy,
459
+ }
460
+ : undefined,
461
+ };
462
+ const delegatedFrozen = {
463
+ bandwidth: delegatedFrozenBandwidth
464
+ ? {
465
+ amount: new bignumber_js_1.BigNumber(delegatedFrozenBandwidth),
466
+ }
467
+ : undefined,
468
+ energy: delegatedFrozenEnergy
469
+ ? {
470
+ amount: new bignumber_js_1.BigNumber(delegatedFrozenEnergy),
471
+ }
472
+ : undefined,
473
+ };
474
+ const tronPower = new bignumber_js_1.BigNumber((0, get_1.default)(frozen, "bandwidth.amount", 0))
475
+ .plus((0, get_1.default)(frozen, "energy.amount", 0))
476
+ .plus((0, get_1.default)(delegatedFrozen, "bandwidth.amount", 0))
477
+ .plus((0, get_1.default)(delegatedFrozen, "energy.amount", 0))
478
+ .plus((0, get_1.default)(legacyFrozen, "energy.amount", 0))
479
+ .plus((0, get_1.default)(legacyFrozen, "bandwidth.amount", 0))
480
+ .dividedBy(1000000)
481
+ .integerValue(bignumber_js_1.BigNumber.ROUND_FLOOR)
482
+ .toNumber();
483
+ const votes = (0, get_1.default)(acc, "votes", []).map((v) => ({
484
+ address: v.vote_address,
485
+ voteCount: v.vote_count,
486
+ }));
487
+ const lastWithdrawnRewardDate = acc.latest_withdraw_time
488
+ ? new Date(acc.latest_withdraw_time)
489
+ : undefined;
490
+ // TODO: rely on the account object when trongrid will provide this info.
491
+ const getLastVotedDate = (txs) => {
492
+ const lastOp = txs.find(({ type }) => type === "VoteWitnessContract");
493
+ return lastOp ? lastOp.date : null;
494
+ };
495
+ const lastVotedDate = txs ? getLastVotedDate(txs) : undefined;
496
+ return {
497
+ energy,
498
+ bandwidth,
499
+ frozen,
500
+ unFrozen,
501
+ delegatedFrozen,
502
+ legacyFrozen,
503
+ votes,
504
+ tronPower,
505
+ unwithdrawnReward,
506
+ lastWithdrawnRewardDate,
507
+ lastVotedDate,
508
+ cacheTransactionInfoById,
509
+ };
535
510
  }
536
- const getUnwithdrawnReward = (addr) => __awaiter(void 0, void 0, void 0, function* () {
511
+ const getUnwithdrawnReward = async (addr) => {
537
512
  try {
538
- const { reward = 0 } = yield fetch(`/wallet/getReward?address=${encodeURIComponent((0, format_1.decode58Check)(addr))}`);
513
+ const { reward = 0 } = await fetch(`/wallet/getReward?address=${encodeURIComponent((0, format_1.decode58Check)(addr))}`);
539
514
  return new bignumber_js_1.BigNumber(reward);
540
515
  }
541
516
  catch (e) {
542
517
  return Promise.resolve(new bignumber_js_1.BigNumber(0));
543
518
  }
544
- });
519
+ };
545
520
  exports.getUnwithdrawnReward = getUnwithdrawnReward;
546
- const claimRewardTronTransaction = (account) => __awaiter(void 0, void 0, void 0, function* () {
521
+ const claimRewardTronTransaction = async (account) => {
547
522
  const url = `/wallet/withdrawbalance`;
548
523
  const data = {
549
524
  owner_address: (0, format_1.decode58Check)(account.freshAddress),
550
525
  };
551
- const result = yield post(url, data);
526
+ const result = await post(url, data);
552
527
  return result;
553
- });
528
+ };
554
529
  exports.claimRewardTronTransaction = claimRewardTronTransaction;
555
530
  //# sourceMappingURL=index.js.map