@cryptorubic/web3 0.5.2-alpha-id-1249.0 → 0.5.2-id-1249.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.5.2-alpha-id-1249.0",
3
+ "version": "0.5.2-id-1249.1",
4
4
  "dependencies": {
5
5
  "tslib": "^2.3.0",
6
6
  "bignumber.js": "9.1.2",
7
- "@cryptorubic/core": "0.5.2-alpha-id-1249.0",
7
+ "@cryptorubic/core": "0.5.2-id-1249.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.5.2-alpha-id-1249.0",
14
+ "@cryptorubic/tron-types": "0.5.2-id-1249.1",
15
15
  "bitcoin-address-validation": "^2.2.3",
16
16
  "axios": "0.27.2",
17
17
  "crc-32": "^1.2.2",
@@ -32,14 +32,17 @@ class SuiAdapter extends abstract_adapter_1.AbstractAdapter {
32
32
  return [nativeToken];
33
33
  }
34
34
  const allTokensMeta = await Promise.all(filteredTokenAddresses.map((coinType) => this.public.getCoinMetadata({ coinType })));
35
- const tokens = allTokensMeta.map((metadata) => {
35
+ const tokens = allTokensMeta.map((metadata, metaIndex) => {
36
36
  if (metadata) {
37
+ if (!metadata) {
38
+ return null;
39
+ }
37
40
  const token = new core_1.Token({
38
41
  decimals: metadata.decimals,
39
42
  symbol: metadata.symbol,
40
43
  name: metadata.name,
41
44
  blockchain: core_1.BLOCKCHAIN_NAME.SUI,
42
- address: metadata.id
45
+ address: filteredTokenAddresses[metaIndex]
43
46
  });
44
47
  return token;
45
48
  }
@@ -1,5 +1,8 @@
1
1
  import { CommonWeb3Pure } from './common-web3-pure';
2
2
  export declare class SuiWeb3Pure extends CommonWeb3Pure {
3
3
  readonly nativeTokenAddress = "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";
4
+ readonly emptyAddress = "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";
5
+ static compareAddress(addressA: string, addressB: string): boolean;
6
+ isAddressCorrect(address: string): Promise<boolean>;
4
7
  constructor();
5
8
  }
@@ -1,15 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SuiWeb3Pure = void 0;
4
- const changenow_api_blockchain_1 = require("../constants/changenow-api-blockchain");
5
4
  const common_web3_pure_1 = require("./common-web3-pure");
5
+ const core_1 = require("@cryptorubic/core");
6
+ const bignumber_js_1 = require("bignumber.js");
6
7
  class SuiWeb3Pure extends common_web3_pure_1.CommonWeb3Pure {
8
+ static compareAddress(addressA, addressB) {
9
+ const pureAddressA = addressA.split(':')[0];
10
+ const pureAddressB = addressB.split(':')[0];
11
+ return (0, core_1.compareAddresses)(new bignumber_js_1.default(pureAddressA).toFixed(), new bignumber_js_1.default(pureAddressB).toFixed());
12
+ }
13
+ async isAddressCorrect(address) {
14
+ if (this.regEx) {
15
+ return this.regEx.test(address);
16
+ }
17
+ throw new Error(`Validation function is not implemented for ${this.constructor.name}`);
18
+ }
7
19
  constructor() {
8
20
  super({
9
- cnApiKey: changenow_api_blockchain_1.changenowApiBlockchain.SUI,
10
- regex: /^[1-9A-HJ-NP-Za-km-z]{32,44}$/
21
+ regex: /(^0[xX][a-fA-F0-9]{64}::[a-z0-9]*::[A-Z0-9]*$)|(^0[xX][a-fA-F0-9]{64}$)/
11
22
  });
12
23
  this.nativeTokenAddress = '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI';
24
+ this.emptyAddress = '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI';
13
25
  }
14
26
  }
15
27
  exports.SuiWeb3Pure = SuiWeb3Pure;