@cryptorubic/web3 0.0.23 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cryptorubic/web3",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "dependencies": {
5
5
  "tslib": "^2.3.0"
6
6
  },
@@ -14,8 +14,9 @@ class TonApiService {
14
14
  async getAllFormatsOfAddress(walletAddress) {
15
15
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/address/${walletAddress}/parse`, {
16
16
  headers: {
17
- apiKey: this.apiKey
18
- }
17
+ apiKey: this.apiKey,
18
+ referer: 'https://api.rubic.exchange',
19
+ },
19
20
  });
20
21
  if ('error' in res) {
21
22
  throw new Error(`[TonWeb3Pure] Error in getAllFormatsOfAddress - ${res.error}`);
@@ -28,7 +29,10 @@ class TonApiService {
28
29
  */
29
30
  async fetchWalletSeqno(walletAddress) {
30
31
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/wallet/${walletAddress}/seqno`, {
31
- headers: { apiKey: this.apiKey }
32
+ headers: {
33
+ apiKey: this.apiKey,
34
+ referer: 'https://api.rubic.exchange',
35
+ },
32
36
  });
33
37
  if ('error' in res) {
34
38
  throw new Error(`[TonApiService] Error in fetchWalletSeqno - ${res.error}`);
@@ -37,7 +41,10 @@ class TonApiService {
37
41
  }
38
42
  async fetchTxInfo(txHash) {
39
43
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/blockchain/transactions/${txHash}`, {
40
- headers: { apiKey: this.apiKey }
44
+ headers: {
45
+ apiKey: this.apiKey,
46
+ referer: 'https://api.rubic.exchange',
47
+ },
41
48
  });
42
49
  if ('error' in res) {
43
50
  throw new Error(`[TonApiService] Error in fetchTxInfo - ${res.error}`);
@@ -45,7 +52,12 @@ class TonApiService {
45
52
  return res;
46
53
  }
47
54
  async fetchTxInfoByMessageHash(txHash) {
48
- const res = await this.httpClient.get(`${this.tonApiUrl}/v2/blockchain/messages/${txHash}/transaction`, { headers: { apiKey: this.apiKey } });
55
+ const res = await this.httpClient.get(`${this.tonApiUrl}/v2/blockchain/messages/${txHash}/transaction`, {
56
+ headers: {
57
+ apiKey: this.apiKey,
58
+ referer: 'https://api.rubic.exchange',
59
+ },
60
+ });
49
61
  if ('error' in res) {
50
62
  throw new Error(`[TonApiService] Error in fetchTxInfoByMessageHash - ${res.error}`);
51
63
  }
@@ -54,7 +66,10 @@ class TonApiService {
54
66
  async checkIsTxCompleted(txHash) {
55
67
  try {
56
68
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/events/${txHash}`, {
57
- headers: { apiKey: this.apiKey }
69
+ headers: {
70
+ apiKey: this.apiKey,
71
+ referer: 'https://api.rubic.exchange',
72
+ },
58
73
  });
59
74
  if ('error' in res) {
60
75
  throw new Error(`[TonApiService] Error in checkIsTxCompleted - ${res.error}`);
@@ -67,7 +82,10 @@ class TonApiService {
67
82
  }
68
83
  async healthcheck() {
69
84
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/status`, {
70
- headers: { apiKey: this.apiKey }
85
+ headers: {
86
+ apiKey: this.apiKey,
87
+ referer: 'https://api.rubic.exchange',
88
+ },
71
89
  });
72
90
  if ('error' in res || !res.rest_online) {
73
91
  return false;
@@ -96,7 +114,12 @@ class TonApiService {
96
114
  if (methodArgs.length) {
97
115
  argsParam += '?' + methodArgs.map((param) => `args=${param}`).join('&');
98
116
  }
99
- const res = await this.httpClient.get(`${this.tonApiUrl}/v2/blockchain/accounts/${address}/methods/${methodName}${argsParam}`, { headers: { apiKey: this.apiKey } });
117
+ const res = await this.httpClient.get(`${this.tonApiUrl}/v2/blockchain/accounts/${address}/methods/${methodName}${argsParam}`, {
118
+ headers: {
119
+ apiKey: this.apiKey,
120
+ referer: 'https://api.rubic.exchange',
121
+ },
122
+ });
100
123
  if ('error' in res) {
101
124
  throw new Error(`[TonApiService] Error in callContractMethod - ${res.error}`);
102
125
  }
@@ -104,7 +127,10 @@ class TonApiService {
104
127
  }
105
128
  async fetchTokenInfo(tokenAddress) {
106
129
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/jettons/${tokenAddress}`, {
107
- headers: { apiKey: this.apiKey }
130
+ headers: {
131
+ apiKey: this.apiKey,
132
+ referer: 'https://api.rubic.exchange',
133
+ },
108
134
  });
109
135
  if ('error' in res) {
110
136
  throw new Error(`[TonApiService] Error in fetchTokenInfo - ${res.error}`);
@@ -117,7 +143,12 @@ class TonApiService {
117
143
  * @returns balance, decimals, name, symbol, walletJettonAddress, jettonAddress
118
144
  */
119
145
  async fetchTokenInfoForWallet(walletAddress, tokenAddress) {
120
- const res = await this.httpClient.get(`${this.tonApiUrl}/v2/accounts/${walletAddress}/jettons/${tokenAddress}`, { headers: { apiKey: this.apiKey } });
146
+ const res = await this.httpClient.get(`${this.tonApiUrl}/v2/accounts/${walletAddress}/jettons/${tokenAddress}`, {
147
+ headers: {
148
+ apiKey: this.apiKey,
149
+ referer: 'https://api.rubic.exchange',
150
+ },
151
+ });
121
152
  if ('error' in res) {
122
153
  throw new Error(`[TonApiService] Error in fetchTokenInfoForWallet - ${res.error}`);
123
154
  }
@@ -125,7 +156,10 @@ class TonApiService {
125
156
  }
126
157
  async fetchAllNonNullableTokensInfoForWallet(walletAddress) {
127
158
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/accounts/${walletAddress}/jettons`, {
128
- headers: { apiKey: this.apiKey }
159
+ headers: {
160
+ apiKey: this.apiKey,
161
+ referer: 'https://api.rubic.exchange',
162
+ },
129
163
  });
130
164
  if ('error' in res) {
131
165
  throw new Error(`[TonApiService] Error in fetchAllNonNullableTokensInfoForWallet - ${res.error}`);
@@ -137,7 +171,10 @@ class TonApiService {
137
171
  */
138
172
  async fetchAccountInfo(walletAddress) {
139
173
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/accounts/${walletAddress}`, {
140
- headers: { apiKey: this.apiKey }
174
+ headers: {
175
+ apiKey: this.apiKey,
176
+ referer: 'https://api.rubic.exchange',
177
+ },
141
178
  });
142
179
  if ('error' in res) {
143
180
  throw new Error(`[TonApiService] Error in fetchAccountInfo - ${res.error}`);
@@ -66,7 +66,7 @@ exports.viemBlockchainMapping = {
66
66
  [core_1.BLOCKCHAIN_NAME.MODE]: chains_1.mode,
67
67
  [core_1.BLOCKCHAIN_NAME.ZK_FAIR]: chains_1.zkFair,
68
68
  [core_1.BLOCKCHAIN_NAME.ZK_LINK]: chain_configs_1.viemConfig[core_1.BLOCKCHAIN_NAME.ZK_LINK],
69
- [core_1.BLOCKCHAIN_NAME.XLAYER]: chains_1.xLayer,
69
+ [core_1.BLOCKCHAIN_NAME.XLAYER]: chain_configs_1.viemConfig[core_1.BLOCKCHAIN_NAME.XLAYER], // viem xLayer config without multicall address
70
70
  [core_1.BLOCKCHAIN_NAME.BAHAMUT]: chain_configs_1.viemConfig[core_1.BLOCKCHAIN_NAME.BAHAMUT],
71
71
  [core_1.BLOCKCHAIN_NAME.BITLAYER]: chain_configs_1.viemConfig[core_1.BLOCKCHAIN_NAME.BITLAYER],
72
72
  [core_1.BLOCKCHAIN_NAME.GRAVITY]: chains_1.gravity