@cryptorubic/web3 0.6.0 → 0.6.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.
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@cryptorubic/web3",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "dependencies": {
5
5
  "tslib": "^2.3.0",
6
6
  "bignumber.js": "9.1.2",
7
- "@cryptorubic/core": "0.6.0",
7
+ "@cryptorubic/core": "0.6.1",
8
8
  "viem": "^2.19.1",
9
9
  "web3-utils": "^4.3.1",
10
10
  "@ton/ton": "^15.1.0",
11
11
  "@solana/web3.js": "1.95.3",
12
12
  "@solflare-wallet/utl-sdk": "^1.4.0",
13
13
  "@ethersproject/bignumber": "^5.7.0",
14
- "@cryptorubic/tron-types": "0.6.0",
14
+ "@cryptorubic/tron-types": "0.6.1",
15
15
  "bitcoin-address-validation": "^2.2.3",
16
16
  "axios": "0.27.2",
17
17
  "crc-32": "^1.2.2",
@@ -16,7 +16,7 @@ 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'
19
+ referer: 'app.rubic.exchange'
20
20
  }
21
21
  });
22
22
  if ('error' in res) {
@@ -32,7 +32,7 @@ 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'
35
+ referer: 'app.rubic.exchange'
36
36
  }
37
37
  });
38
38
  if ('error' in res) {
@@ -44,7 +44,7 @@ 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'
47
+ referer: 'app.rubic.exchange'
48
48
  }
49
49
  });
50
50
  if ('error' in res) {
@@ -56,7 +56,7 @@ 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'
59
+ referer: 'app.rubic.exchange'
60
60
  }
61
61
  });
62
62
  if ('error' in res) {
@@ -69,7 +69,7 @@ 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'
72
+ referer: 'app.rubic.exchange'
73
73
  }
74
74
  });
75
75
  if ('error' in res) {
@@ -85,7 +85,7 @@ 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'
88
+ referer: 'app.rubic.exchange'
89
89
  }
90
90
  });
91
91
  if ('error' in res || !res.rest_online) {
@@ -118,7 +118,7 @@ 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'
121
+ referer: 'app.rubic.exchange'
122
122
  }
123
123
  });
124
124
  if ('error' in res) {
@@ -127,16 +127,21 @@ class TonApiService {
127
127
  return res.decoded;
128
128
  }
129
129
  async fetchTokenInfo(tokenAddress) {
130
- const res = await this.httpClient.get(`${this.tonApiUrl}/v2/jettons/${tokenAddress}`, {
131
- headers: {
132
- apiKey: this.apiKey,
133
- referer: 'https://api.rubic.exchange'
130
+ try {
131
+ const res = await this.httpClient.get(`${this.tonApiUrl}/v2/jettons/${tokenAddress}`, {
132
+ headers: {
133
+ apiKey: this.apiKey,
134
+ referer: 'app.rubic.exchange'
135
+ }
136
+ });
137
+ if ('error' in res) {
138
+ throw new Error(`[TonApiService] Error in fetchTokenInfo - ${res.error}`);
134
139
  }
135
- });
136
- if ('error' in res) {
137
- throw new Error(`[TonApiService] Error in fetchTokenInfo - ${res.error}`);
140
+ return res.metadata;
141
+ }
142
+ catch (err) {
143
+ throw new Error(`[TonApiService] Error in fetchTokenInfo - ${err}`);
138
144
  }
139
- return res.metadata;
140
145
  }
141
146
  /**
142
147
  *
@@ -147,7 +152,7 @@ class TonApiService {
147
152
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/accounts/${walletAddress}/jettons/${tokenAddress}`, {
148
153
  headers: {
149
154
  apiKey: this.apiKey,
150
- referer: 'https://api.rubic.exchange'
155
+ referer: 'app.rubic.exchange'
151
156
  }
152
157
  });
153
158
  if ('error' in res) {
@@ -159,7 +164,7 @@ class TonApiService {
159
164
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/accounts/${walletAddress}/jettons`, {
160
165
  headers: {
161
166
  apiKey: this.apiKey,
162
- referer: 'https://api.rubic.exchange'
167
+ referer: 'app.rubic.exchange'
163
168
  }
164
169
  });
165
170
  if ('error' in res) {
@@ -174,7 +179,7 @@ class TonApiService {
174
179
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/accounts/${walletAddress}`, {
175
180
  headers: {
176
181
  apiKey: this.apiKey,
177
- referer: 'https://api.rubic.exchange'
182
+ referer: 'app.rubic.exchange'
178
183
  }
179
184
  });
180
185
  if ('error' in res) {