@cryptorubic/web3 1.1.0-alpha-stellar.54 → 1.1.0-alpha-stellar.56

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.1.0-alpha-stellar.54",
3
+ "version": "1.1.0-alpha-stellar.56",
4
4
  "dependencies": {
5
5
  "@ethersproject/bignumber": "^5.8.0",
6
6
  "@mysten/sui": "^1.24.0",
@@ -1,4 +1,6 @@
1
1
  export interface StellarRpcProvider {
2
2
  horizon: string;
3
3
  soroban: string;
4
+ horizonHeaders?: Record<string, string>;
5
+ sorobanHeaders?: Record<string, string>;
4
6
  }
@@ -19,13 +19,15 @@ class StellarAdapter extends abstract_adapter_1.AbstractAdapter {
19
19
  this.signer = new stellar_adapter_signer_1.StellarAdapterSigner(this.publicRef, httpClient, logger, clientParams);
20
20
  this.horizonClient = new stellar_sdk_1.Horizon.Server(rpc[0].horizon, {
21
21
  allowHttp: true,
22
- appName: 'rubic.exchange'
22
+ appName: 'rubic.exchange',
23
+ headers: rpc[0].horizonHeaders
23
24
  });
24
25
  }
25
26
  initWeb3Client() {
26
27
  this.public = new stellar_sdk_2.rpc.Server(this.rpc[0].soroban, {
27
28
  allowHttp: true,
28
- timeout: 5000
29
+ timeout: 5000,
30
+ headers: this.rpc[0].sorobanHeaders
29
31
  });
30
32
  }
31
33
  async getBlockNumber() {
@@ -113,9 +115,9 @@ class StellarAdapter extends abstract_adapter_1.AbstractAdapter {
113
115
  return userBalance.gte(token.weiAmount);
114
116
  }
115
117
  async needTrustline(token, walletAddress) {
116
- if (token.isNative) {
118
+ const isCorrectWalletAddress = await web3_pure_1.Web3Pure.isAddressCorrect(core_1.BLOCKCHAIN_NAME.STELLAR, walletAddress);
119
+ if (token.isNative || !isCorrectWalletAddress)
117
120
  return false;
118
- }
119
121
  try {
120
122
  const trustline = await this.public.getTrustline(walletAddress, this.convertTokenAddressToAsset(token.address));
121
123
  return new bignumber_js_1.default(trustline.limit().toString()).lt(token.weiAmount);