@cryptorubic/web3 0.4.3 → 0.5.1

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.
@@ -23,7 +23,7 @@ class TronAdapter extends abstract_adapter_1.AbstractAdapter {
23
23
  const calls = contractsData.map(({ contractAddress, methodsData }) => {
24
24
  return methodsData.map(({ methodName, methodArguments }) => [
25
25
  contractAddress,
26
- tron_web3_pure_1.TronWeb3Pure.encodeFunctionCall(contractAbi, methodName, methodArguments),
26
+ tron_web3_pure_1.TronWeb3Pure.encodeFunctionCall(contractAbi, methodName, methodArguments)
27
27
  ]);
28
28
  });
29
29
  try {
@@ -42,7 +42,7 @@ class TronAdapter extends abstract_adapter_1.AbstractAdapter {
42
42
  output: success
43
43
  ? tron_web3_pure_1.TronWeb3Pure.decodeMethodOutput(methodOutputAbi, returnData)
44
44
  : null,
45
- success,
45
+ success
46
46
  };
47
47
  }));
48
48
  }
@@ -69,13 +69,13 @@ class TronAdapter extends abstract_adapter_1.AbstractAdapter {
69
69
  const output = (await this.read(contractData.contractAddress, contractAbi, methodData.methodName, methodData.methodArguments));
70
70
  return {
71
71
  output,
72
- success: true,
72
+ success: true
73
73
  };
74
74
  }
75
75
  catch {
76
76
  return {
77
77
  output: null,
78
- success: false,
78
+ success: false
79
79
  };
80
80
  }
81
81
  }));
@@ -93,9 +93,9 @@ class TronAdapter extends abstract_adapter_1.AbstractAdapter {
93
93
  methodsData: [
94
94
  {
95
95
  methodArguments: [userAddress],
96
- methodName: 'balanceOf',
97
- },
98
- ],
96
+ methodName: 'balanceOf'
97
+ }
98
+ ]
99
99
  })));
100
100
  const results = await Promise.all(promises);
101
101
  const tokensBalances = results[0].map((tokenResults) => {
@@ -115,8 +115,8 @@ class TronAdapter extends abstract_adapter_1.AbstractAdapter {
115
115
  contractAddress,
116
116
  methodsData: tokenFields.map((methodName) => ({
117
117
  methodArguments: [],
118
- methodName,
119
- })),
118
+ methodName
119
+ }))
120
120
  }));
121
121
  const results = contractsData.length
122
122
  ? await this.multicallContractsMethods(trc_20_contract_abi_1.TRC20_CONTRACT_ABI, contractsData)
@@ -129,9 +129,7 @@ class TronAdapter extends abstract_adapter_1.AbstractAdapter {
129
129
  }
130
130
  return {
131
131
  ...acc,
132
- [tokenFields[fieldIndex]]: field.success
133
- ? field.output
134
- : undefined,
132
+ [tokenFields[fieldIndex]]: field.success ? field.output : undefined
135
133
  };
136
134
  }, {});
137
135
  return new core_1.Token({
@@ -139,7 +137,7 @@ class TronAdapter extends abstract_adapter_1.AbstractAdapter {
139
137
  blockchain: core_1.BLOCKCHAIN_NAME.TRON,
140
138
  decimals: Number(possibleToken?.decimals),
141
139
  name: possibleToken?.name,
142
- symbol: possibleToken?.symbol,
140
+ symbol: possibleToken?.symbol
143
141
  });
144
142
  });
145
143
  if (nativeTokenIndex === -1) {
@@ -184,7 +182,7 @@ class TronAdapter extends abstract_adapter_1.AbstractAdapter {
184
182
  signature,
185
183
  to: contractAddress,
186
184
  ...(callValue && { callValue }),
187
- ...(feeLimit && { feeLimit }),
185
+ ...(feeLimit && { feeLimit })
188
186
  };
189
187
  }
190
188
  static flattenTypesToString(abiInputs) {
@@ -208,7 +206,7 @@ class TronAdapter extends abstract_adapter_1.AbstractAdapter {
208
206
  const amountWei = amount ?? new bignumber_js_1.default(2).pow(256).minus(1).toFixed();
209
207
  return tron_web3_pure_1.TronWeb3Pure.encodeMethodCall(tokenAddress, trc_20_contract_abi_1.TRC20_CONTRACT_ABI, 'approve', [
210
208
  { type: 'address', value: spenderAddress },
211
- { type: 'uint256', value: amountWei },
209
+ { type: 'uint256', value: amountWei }
212
210
  ]);
213
211
  }
214
212
  async getAllowance(fromTokenAddress, walletAddress, spender) {
@@ -216,8 +214,8 @@ class TronAdapter extends abstract_adapter_1.AbstractAdapter {
216
214
  this.public.contract(trc_20_contract_abi_1.TRC20_CONTRACT_ABI, fromTokenAddress),
217
215
  this.read(fromTokenAddress, trc_20_contract_abi_1.TRC20_CONTRACT_ABI, 'decimals'),
218
216
  this.read(fromTokenAddress, trc_20_contract_abi_1.TRC20_CONTRACT_ABI, 'allowance', [
219
- spender,
220
- ]),
217
+ spender
218
+ ])
221
219
  ]);
222
220
  const allowanceWeiBN = new bignumber_js_1.default(allowance);
223
221
  const allowanceNonWei = core_1.Token.fromWei(allowanceWeiBN, Number(decimals));
@@ -16,8 +16,8 @@ class TonApiService {
16
16
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/address/${walletAddress}/parse`, {
17
17
  headers: {
18
18
  apiKey: this.apiKey,
19
- referer: 'https://api.rubic.exchange',
20
- },
19
+ referer: 'https://api.rubic.exchange'
20
+ }
21
21
  });
22
22
  if ('error' in res) {
23
23
  throw new Error(`[TonWeb3Pure] Error in getAllFormatsOfAddress - ${res.error}`);
@@ -32,8 +32,8 @@ class TonApiService {
32
32
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/wallet/${walletAddress}/seqno`, {
33
33
  headers: {
34
34
  apiKey: this.apiKey,
35
- referer: 'https://api.rubic.exchange',
36
- },
35
+ referer: 'https://api.rubic.exchange'
36
+ }
37
37
  });
38
38
  if ('error' in res) {
39
39
  throw new Error(`[TonApiService] Error in fetchWalletSeqno - ${res.error}`);
@@ -44,8 +44,8 @@ class TonApiService {
44
44
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/blockchain/transactions/${txHash}`, {
45
45
  headers: {
46
46
  apiKey: this.apiKey,
47
- referer: 'https://api.rubic.exchange',
48
- },
47
+ referer: 'https://api.rubic.exchange'
48
+ }
49
49
  });
50
50
  if ('error' in res) {
51
51
  throw new Error(`[TonApiService] Error in fetchTxInfo - ${res.error}`);
@@ -56,8 +56,8 @@ class TonApiService {
56
56
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/blockchain/messages/${txHash}/transaction`, {
57
57
  headers: {
58
58
  apiKey: this.apiKey,
59
- referer: 'https://api.rubic.exchange',
60
- },
59
+ referer: 'https://api.rubic.exchange'
60
+ }
61
61
  });
62
62
  if ('error' in res) {
63
63
  throw new Error(`[TonApiService] Error in fetchTxInfoByMessageHash - ${res.error}`);
@@ -69,8 +69,8 @@ class TonApiService {
69
69
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/events/${txHash}`, {
70
70
  headers: {
71
71
  apiKey: this.apiKey,
72
- referer: 'https://api.rubic.exchange',
73
- },
72
+ referer: 'https://api.rubic.exchange'
73
+ }
74
74
  });
75
75
  if ('error' in res) {
76
76
  throw new Error(`[TonApiService] Error in checkIsTxCompleted - ${res.error}`);
@@ -85,8 +85,8 @@ class TonApiService {
85
85
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/status`, {
86
86
  headers: {
87
87
  apiKey: this.apiKey,
88
- referer: 'https://api.rubic.exchange',
89
- },
88
+ referer: 'https://api.rubic.exchange'
89
+ }
90
90
  });
91
91
  if ('error' in res || !res.rest_online) {
92
92
  return false;
@@ -98,8 +98,8 @@ class TonApiService {
98
98
  params: {
99
99
  limit: 1,
100
100
  offset: 0,
101
- sort: 'desc',
102
- },
101
+ sort: 'desc'
102
+ }
103
103
  });
104
104
  if ('detail' in res) {
105
105
  throw new Error(`[TonApiService] Error in fetchWalletSeqno - ${res.detail[0]?.msg}`);
@@ -118,8 +118,8 @@ class TonApiService {
118
118
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/blockchain/accounts/${address}/methods/${methodName}${argsParam}`, {
119
119
  headers: {
120
120
  apiKey: this.apiKey,
121
- referer: 'https://api.rubic.exchange',
122
- },
121
+ referer: 'https://api.rubic.exchange'
122
+ }
123
123
  });
124
124
  if ('error' in res) {
125
125
  throw new Error(`[TonApiService] Error in callContractMethod - ${res.error}`);
@@ -130,8 +130,8 @@ class TonApiService {
130
130
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/jettons/${tokenAddress}`, {
131
131
  headers: {
132
132
  apiKey: this.apiKey,
133
- referer: 'https://api.rubic.exchange',
134
- },
133
+ referer: 'https://api.rubic.exchange'
134
+ }
135
135
  });
136
136
  if ('error' in res) {
137
137
  throw new Error(`[TonApiService] Error in fetchTokenInfo - ${res.error}`);
@@ -147,8 +147,8 @@ class TonApiService {
147
147
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/accounts/${walletAddress}/jettons/${tokenAddress}`, {
148
148
  headers: {
149
149
  apiKey: this.apiKey,
150
- referer: 'https://api.rubic.exchange',
151
- },
150
+ referer: 'https://api.rubic.exchange'
151
+ }
152
152
  });
153
153
  if ('error' in res) {
154
154
  throw new Error(`[TonApiService] Error in fetchTokenInfoForWallet - ${res.error}`);
@@ -159,8 +159,8 @@ class TonApiService {
159
159
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/accounts/${walletAddress}/jettons`, {
160
160
  headers: {
161
161
  apiKey: this.apiKey,
162
- referer: 'https://api.rubic.exchange',
163
- },
162
+ referer: 'https://api.rubic.exchange'
163
+ }
164
164
  });
165
165
  if ('error' in res) {
166
166
  throw new Error(`[TonApiService] Error in fetchAllNonNullableTokensInfoForWallet - ${res.error}`);
@@ -174,8 +174,8 @@ class TonApiService {
174
174
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/accounts/${walletAddress}`, {
175
175
  headers: {
176
176
  apiKey: this.apiKey,
177
- referer: 'https://api.rubic.exchange',
178
- },
177
+ referer: 'https://api.rubic.exchange'
178
+ }
179
179
  });
180
180
  if ('error' in res) {
181
181
  throw new Error(`[TonApiService] Error in fetchAccountInfo - ${res.error}`);
@@ -70,7 +70,7 @@ class BlockchainAdapterFactoryService {
70
70
  if (viem_blockchain_mapping_1.viemBlockchainMapping?.[blockchain]) {
71
71
  return new evm_adapter_1.EvmAdapter({
72
72
  blockchain: blockchain,
73
- rpcList: rpcs,
73
+ rpcList: rpcs
74
74
  }, this.createLogger?.(`EVM_ADAPTER_${blockchain}`));
75
75
  }
76
76
  }
@@ -99,7 +99,7 @@ class BlockchainAdapterFactoryService {
99
99
  const chain = viem_blockchain_mapping_1.viemBlockchainMapping[blockchain];
100
100
  adapter.wallet = (0, viem_1.createWalletClient)({
101
101
  chain: chain,
102
- transport: (0, viem_1.custom)(provider),
102
+ transport: (0, viem_1.custom)(provider)
103
103
  });
104
104
  adapter.walletAddress = walletProvider[core_1.CHAIN_TYPE.EVM].address;
105
105
  });