@cryptorubic/web3 0.7.12-alpha-morph-api.1 → 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 +3 -3
- package/src/lib/adapter/adapters/evm-adapter.js +3 -1
- package/src/lib/adapter/adapters/models/approve-adapter.d.ts +6 -2
- package/src/lib/adapter/adapters/models/approve-adapter.js +4 -0
- package/src/lib/adapter/constants/chain-configs/chain-configs.js +23 -0
- package/src/lib/adapter/constants/viem-blockchain-mapping.js +4 -2
- package/src/lib/utils/web3-types/sui-web3-pure.js +1 -1
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cryptorubic/web3",
|
|
3
|
-
"version": "0.7.12-alpha-morph-api.
|
|
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.
|
|
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.
|
|
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",
|
|
@@ -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
|
-
|
|
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
|
+
}
|
|
@@ -1390,6 +1390,29 @@ exports.viemConfig = {
|
|
|
1390
1390
|
}
|
|
1391
1391
|
}
|
|
1392
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
|
+
}),
|
|
1393
1416
|
MORPH: (0, viem_1.defineChain)({
|
|
1394
1417
|
id: 2818,
|
|
1395
1418
|
name: 'Morph',
|
|
@@ -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]:
|
|
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.
|
|
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-
|
|
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';
|