@cryptorubic/web3 0.7.12-alpha-morph-api.0 → 0.7.12-alpha-morph-api.3

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.7.12-alpha-morph-api.0",
3
+ "version": "0.7.12-alpha-morph-api.3",
4
4
  "dependencies": {
5
5
  "tslib": "^2.3.0",
6
6
  "bignumber.js": "9.1.2",
7
- "@cryptorubic/core": "0.7.12-alpha-morph-api.0",
7
+ "@cryptorubic/core": "0.7.12-alpha-morph-api.3",
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.7.12-alpha-morph-api.0",
14
+ "@cryptorubic/tron-types": "0.7.12-alpha-morph-api.3",
15
15
  "bitcoin-address-validation": "^2.2.3",
16
16
  "axios": "0.27.2",
17
17
  "crc-32": "^1.2.2",
@@ -47,7 +47,9 @@ class EvmAdapter extends abstract_adapter_1.AbstractAdapter {
47
47
  // @ts-ignore
48
48
  chain,
49
49
  transport: (0, viem_1.fallback)(transports, {
50
- rank: true
50
+ rank: {
51
+ interval: 1800000
52
+ }
51
53
  })
52
54
  });
53
55
  }
@@ -1,6 +1,9 @@
1
- import { TokenAmount } from '@cryptorubic/core';
1
+ import { BlockchainName, TokenAmount } from '@cryptorubic/core';
2
2
  import { AllowanceInfo } from './common-types';
3
- export interface ApproveAdapter<T> {
3
+ import { AbstractAdapter } from '../abstract-adapter';
4
+ import { EvmTransactionConfig } from '../../../utils/models/evm-transaction-config';
5
+ import { TronTransactionConfig } from '@cryptorubic/tron-types';
6
+ export interface ApproveAdapter<T> extends AbstractAdapter<any, any, BlockchainName> {
4
7
  /**
5
8
  * @param fromTokenAddress erc20 address of checked token
6
9
  * @param walletAddress owner wallet address
@@ -31,3 +34,4 @@ export interface ApproveAdapter<T> {
31
34
  */
32
35
  approve(walletAddress: string, tokenAddress: string, spenderAddress: string, amount?: string): Promise<string>;
33
36
  }
37
+ export declare function isApprovableAdapter(adapter: AbstractAdapter<any, any, BlockchainName>): adapter is ApproveAdapter<EvmTransactionConfig | TronTransactionConfig>;
@@ -1,2 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isApprovableAdapter = isApprovableAdapter;
4
+ function isApprovableAdapter(adapter) {
5
+ return 'needApprove' in adapter && 'approve' in adapter && 'getAllowance' in adapter && 'encodeApprove' in adapter;
6
+ }
@@ -1389,5 +1389,55 @@ exports.viemConfig = {
1389
1389
  address: '0xcA11bde05977b3631167028862bE2a173976CA11'
1390
1390
  }
1391
1391
  }
1392
+ }),
1393
+ UNICHAIN: (0, viem_1.defineChain)({
1394
+ blockExplorers: {
1395
+ default: {
1396
+ apiUrl: 'https://uniscan.xyz/',
1397
+ name: 'Unichain Explorer',
1398
+ url: 'https://uniscan.xyz/'
1399
+ }
1400
+ },
1401
+ id: 130,
1402
+ name: 'Unichain',
1403
+ nativeCurrency: { decimals: 18, name: 'Ethereum', symbol: 'ETH' },
1404
+ rpcUrls: {
1405
+ default: {
1406
+ http: ['https://mainnet.unichain.org/']
1407
+ }
1408
+ },
1409
+ testnet: false,
1410
+ contracts: {
1411
+ multicall3: {
1412
+ address: '0xcA11bde05977b3631167028862bE2a173976CA11'
1413
+ }
1414
+ }
1415
+ }),
1416
+ MORPH: (0, viem_1.defineChain)({
1417
+ id: 2818,
1418
+ name: 'Morph',
1419
+ nativeCurrency: {
1420
+ decimals: 18,
1421
+ name: 'Ether',
1422
+ symbol: 'ETH'
1423
+ },
1424
+ rpcUrls: {
1425
+ default: {
1426
+ http: ['https://rpc.morphl2.io'],
1427
+ webSocket: ['wss://rpc.morphl2.io:8443']
1428
+ }
1429
+ },
1430
+ blockExplorers: {
1431
+ default: {
1432
+ name: 'Morph Explorer',
1433
+ url: 'https://explorer.morphl2.io'
1434
+ }
1435
+ },
1436
+ testnet: false,
1437
+ contracts: {
1438
+ multicall3: {
1439
+ address: '0xcA11bde05977b3631167028862bE2a173976CA11'
1440
+ }
1441
+ }
1392
1442
  })
1393
1443
  };
@@ -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]: chain_configs_1.viemConfig[core_1.BLOCKCHAIN_NAME.XLAYER], // viem xLayer config without multicall address
69
+ [core_1.BLOCKCHAIN_NAME.XLAYER]: chains_1.xLayer,
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.SEI]: chains_1.sei,
@@ -75,5 +75,7 @@ exports.viemBlockchainMapping = {
75
75
  [core_1.BLOCKCHAIN_NAME.CORE]: chain_configs_1.viemConfig[core_1.BLOCKCHAIN_NAME.CORE],
76
76
  [core_1.BLOCKCHAIN_NAME.BERACHAIN]: chain_configs_1.viemConfig[core_1.BLOCKCHAIN_NAME.BERACHAIN],
77
77
  [core_1.BLOCKCHAIN_NAME.SONEIUM]: chain_configs_1.viemConfig[core_1.BLOCKCHAIN_NAME.SONEIUM],
78
- [core_1.BLOCKCHAIN_NAME.MORPH]: chains_1.morph
78
+ [core_1.BLOCKCHAIN_NAME.WANCHAIN]: chains_1.wanchain,
79
+ [core_1.BLOCKCHAIN_NAME.UNICHAIN]: chain_configs_1.viemConfig[core_1.BLOCKCHAIN_NAME.UNICHAIN],
80
+ [core_1.BLOCKCHAIN_NAME.MORPH]: chain_configs_1.viemConfig[core_1.BLOCKCHAIN_NAME.MORPH] // viem Morph config without multicall address
79
81
  };
@@ -18,7 +18,7 @@ class SuiWeb3Pure extends common_web3_pure_1.CommonWeb3Pure {
18
18
  }
19
19
  constructor() {
20
20
  super({
21
- regex: /(^0[xX][a-fA-F0-9]{64}::[a-z0-9]*::[A-Z0-9]*$)|(^0[xX][a-fA-F0-9]{64}$)/
21
+ regex: /(^0[xX][a-fA-F0-9]{0,64}::[a-zA-Z0-9_]*::[A-Z0-9_]*$)|(^0[xX][a-fA-F0-9]{64}$)/
22
22
  });
23
23
  this.nativeTokenAddress = '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI';
24
24
  this.emptyAddress = '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI';