@cryptorubic/web3 1.4.6-alpha-2214.0 → 1.4.7

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": "1.4.6-alpha-2214.0",
3
+ "version": "1.4.7",
4
4
  "dependencies": {
5
5
  "@ethersproject/bignumber": "^5.8.0",
6
6
  "@mysten/sui": "^1.24.0",
@@ -5,7 +5,10 @@ class TonApiService {
5
5
  constructor(httpClient, params, logger) {
6
6
  this.httpClient = httpClient;
7
7
  this.logger = logger;
8
- this.apiHeaders = params.tonApiHeaders;
8
+ this.apiHeaders = {
9
+ ...params.tonApiHeaders,
10
+ referer: 'https://app.rubic.exchange'
11
+ };
9
12
  this.tonApiUrl = params?.tonApiUrl || 'https://tonapi.io';
10
13
  this.tonCenterV3Url = params.tonCenterV3Url || 'https://toncenter.com/api/v3';
11
14
  }
@@ -14,10 +17,7 @@ class TonApiService {
14
17
  */
15
18
  async getAllFormatsOfAddress(walletAddress) {
16
19
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/address/${walletAddress}/parse`, {
17
- headers: {
18
- ...this.apiHeaders,
19
- referer: 'https://app.rubic.exchange'
20
- }
20
+ headers: this.apiHeaders
21
21
  });
22
22
  if ('error' in res) {
23
23
  throw new Error(`[TonWeb3Pure] Error in getAllFormatsOfAddress - ${res.error}`);
@@ -30,10 +30,7 @@ class TonApiService {
30
30
  */
31
31
  async fetchWalletSeqno(walletAddress) {
32
32
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/wallet/${walletAddress}/seqno`, {
33
- headers: {
34
- ...this.apiHeaders,
35
- referer: 'https://app.rubic.exchange'
36
- }
33
+ headers: this.apiHeaders
37
34
  });
38
35
  if ('error' in res) {
39
36
  throw new Error(`[TonApiService] Error in fetchWalletSeqno - ${res.error}`);
@@ -42,10 +39,7 @@ class TonApiService {
42
39
  }
43
40
  async fetchTxInfo(txHash) {
44
41
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/blockchain/transactions/${txHash}`, {
45
- headers: {
46
- ...this.apiHeaders,
47
- referer: 'https://app.rubic.exchange'
48
- }
42
+ headers: this.apiHeaders
49
43
  });
50
44
  if ('error' in res) {
51
45
  throw new Error(`[TonApiService] Error in fetchTxInfo - ${res.error}`);
@@ -54,10 +48,7 @@ class TonApiService {
54
48
  }
55
49
  async fetchTxInfoByMessageHash(txHash) {
56
50
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/blockchain/messages/${txHash}/transaction`, {
57
- headers: {
58
- ...this.apiHeaders,
59
- referer: 'https://app.rubic.exchange'
60
- }
51
+ headers: this.apiHeaders
61
52
  });
62
53
  if ('error' in res) {
63
54
  throw new Error(`[TonApiService] Error in fetchTxInfoByMessageHash - ${res.error}`);
@@ -67,10 +58,7 @@ class TonApiService {
67
58
  async checkIsTxCompleted(txHash) {
68
59
  try {
69
60
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/events/${txHash}`, {
70
- headers: {
71
- ...this.apiHeaders,
72
- referer: 'https://app.rubic.exchange'
73
- }
61
+ headers: this.apiHeaders
74
62
  });
75
63
  if ('error' in res) {
76
64
  throw new Error(`[TonApiService] Error in checkIsTxCompleted - ${res.error}`);
@@ -83,10 +71,7 @@ class TonApiService {
83
71
  }
84
72
  async healthcheck() {
85
73
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/status`, {
86
- headers: {
87
- ...this.apiHeaders,
88
- referer: 'https://app.rubic.exchange'
89
- }
74
+ headers: this.apiHeaders
90
75
  });
91
76
  if ('error' in res || !res.rest_online) {
92
77
  return false;
@@ -116,10 +101,7 @@ class TonApiService {
116
101
  argsParam += '?' + methodArgs.map((param) => `args=${param}`).join('&');
117
102
  }
118
103
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/blockchain/accounts/${address}/methods/${methodName}${argsParam}`, {
119
- headers: {
120
- ...this.apiHeaders,
121
- referer: 'https://app.rubic.exchange'
122
- }
104
+ headers: this.apiHeaders
123
105
  });
124
106
  if ('error' in res) {
125
107
  throw new Error(`[TonApiService] Error in callContractMethod - ${res.error}`);
@@ -129,10 +111,7 @@ class TonApiService {
129
111
  async fetchTokenInfo(tokenAddress) {
130
112
  try {
131
113
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/jettons/${tokenAddress}`, {
132
- headers: {
133
- ...this.apiHeaders,
134
- referer: 'https://app.rubic.exchange'
135
- }
114
+ headers: this.apiHeaders
136
115
  });
137
116
  if ('error' in res) {
138
117
  throw new Error(`[TonApiService] Error in fetchTokenInfo - ${res.error}`);
@@ -151,10 +130,7 @@ class TonApiService {
151
130
  async fetchTokenInfoForWallet(walletAddress, tokenAddress) {
152
131
  try {
153
132
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/accounts/${walletAddress}/jettons/${tokenAddress}`, {
154
- headers: {
155
- ...this.apiHeaders,
156
- referer: 'https://app.rubic.exchange'
157
- }
133
+ headers: this.apiHeaders
158
134
  });
159
135
  if ('error' in res) {
160
136
  this.logger?.customError('[TonApiService] ERROR IN fetchTokenInfoForWallet', res.error);
@@ -169,10 +145,7 @@ class TonApiService {
169
145
  }
170
146
  async fetchAllNonNullableTokensInfoForWallet(walletAddress) {
171
147
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/accounts/${walletAddress}/jettons`, {
172
- headers: {
173
- ...this.apiHeaders,
174
- referer: 'https://app.rubic.exchange'
175
- }
148
+ headers: this.apiHeaders
176
149
  });
177
150
  if ('error' in res) {
178
151
  throw new Error(`[TonApiService] Error in fetchAllNonNullableTokensInfoForWallet - ${res.error}`);
@@ -184,10 +157,7 @@ class TonApiService {
184
157
  */
185
158
  async fetchAccountInfo(walletAddress) {
186
159
  const res = await this.httpClient.get(`${this.tonApiUrl}/v2/accounts/${walletAddress}`, {
187
- headers: {
188
- ...this.apiHeaders,
189
- referer: 'https://app.rubic.exchange'
190
- }
160
+ headers: this.apiHeaders
191
161
  });
192
162
  if ('error' in res) {
193
163
  throw new Error(`[TonApiService] Error in fetchAccountInfo - ${res.error}`);