@cryptorubic/web3 0.13.0 → 0.13.2-alpha-rub-748.0
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/README.md +1 -1
- package/package.json +1 -1
- package/src/lib/adapter/constants/chain-configs/chain-configs.d.ts +1 -1
- package/src/lib/adapter/constants/chain-configs/chain-configs.js +27 -0
- package/src/lib/adapter/constants/viem-blockchain-mapping.d.ts +1 -1
- package/src/lib/adapter/constants/viem-blockchain-mapping.js +3 -2
- package/src/lib/utils/constants/web3-pure-store.js +7 -9
- package/src/lib/utils/web3-types/near-web3-pure.d.ts +6 -0
- package/src/lib/utils/web3-types/near-web3-pure.js +24 -0
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
# web3
|
|
1
|
+
# web3
|
package/package.json
CHANGED
|
@@ -1428,5 +1428,32 @@ exports.viemConfig = {
|
|
|
1428
1428
|
address: '0xcA11bde05977b3631167028862bE2a173976CA11'
|
|
1429
1429
|
}
|
|
1430
1430
|
}
|
|
1431
|
+
}),
|
|
1432
|
+
PLASMA: (0, viem_1.defineChain)({
|
|
1433
|
+
id: 9745,
|
|
1434
|
+
name: 'Plasma',
|
|
1435
|
+
network: 'Plasma',
|
|
1436
|
+
nativeCurrency: {
|
|
1437
|
+
name: 'Plasma',
|
|
1438
|
+
symbol: 'XPL',
|
|
1439
|
+
decimals: 18
|
|
1440
|
+
},
|
|
1441
|
+
rpcUrls: {
|
|
1442
|
+
default: {
|
|
1443
|
+
http: ['https://rpc.plasma.to']
|
|
1444
|
+
}
|
|
1445
|
+
},
|
|
1446
|
+
blockExplorers: {
|
|
1447
|
+
default: {
|
|
1448
|
+
name: 'plasmascan',
|
|
1449
|
+
url: 'https://plasmascan.to/'
|
|
1450
|
+
}
|
|
1451
|
+
},
|
|
1452
|
+
testnet: false,
|
|
1453
|
+
contracts: {
|
|
1454
|
+
multicall3: {
|
|
1455
|
+
address: '0xcA11bde05977b3631167028862bE2a173976CA11'
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1431
1458
|
})
|
|
1432
1459
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.viemBlockchainMapping = void 0;
|
|
4
|
+
const core_1 = require("@cryptorubic/core");
|
|
4
5
|
const chains_1 = require("viem/chains");
|
|
5
6
|
const chain_configs_1 = require("./chain-configs/chain-configs");
|
|
6
|
-
const core_1 = require("@cryptorubic/core");
|
|
7
7
|
exports.viemBlockchainMapping = {
|
|
8
8
|
[core_1.BLOCKCHAIN_NAME.ETHEREUM]: chains_1.mainnet,
|
|
9
9
|
[core_1.BLOCKCHAIN_NAME.BINANCE_SMART_CHAIN]: chains_1.bsc,
|
|
@@ -76,5 +76,6 @@ exports.viemBlockchainMapping = {
|
|
|
76
76
|
[core_1.BLOCKCHAIN_NAME.WANCHAIN]: chains_1.wanchain,
|
|
77
77
|
[core_1.BLOCKCHAIN_NAME.UNICHAIN]: chain_configs_1.viemConfig[core_1.BLOCKCHAIN_NAME.UNICHAIN],
|
|
78
78
|
[core_1.BLOCKCHAIN_NAME.MORPH]: chain_configs_1.viemConfig[core_1.BLOCKCHAIN_NAME.MORPH], // viem Morph config without multicall address
|
|
79
|
-
[core_1.BLOCKCHAIN_NAME.HEMI]: chain_configs_1.viemConfig[core_1.BLOCKCHAIN_NAME.HEMI]
|
|
79
|
+
[core_1.BLOCKCHAIN_NAME.HEMI]: chain_configs_1.viemConfig[core_1.BLOCKCHAIN_NAME.HEMI],
|
|
80
|
+
[core_1.BLOCKCHAIN_NAME.PLASMA]: chain_configs_1.viemConfig[core_1.BLOCKCHAIN_NAME.PLASMA]
|
|
80
81
|
};
|
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.web3PureStore = void 0;
|
|
4
4
|
const core_1 = require("@cryptorubic/core");
|
|
5
|
-
const evm_web3_pure_1 = require("../web3-types/evm-web3-pure");
|
|
6
|
-
const tron_web3_pure_1 = require("../web3-types/tron-web3-pure");
|
|
7
5
|
const bitcoin_web3_pure_1 = require("../web3-types/bitcoin-web3-pure");
|
|
8
|
-
const
|
|
6
|
+
const common_web3_pure_1 = require("../web3-types/common-web3-pure");
|
|
7
|
+
const evm_web3_pure_1 = require("../web3-types/evm-web3-pure");
|
|
9
8
|
const icp_web3_pure_1 = require("../web3-types/icp-web3-pure");
|
|
9
|
+
const near_web3_pure_1 = require("../web3-types/near-web3-pure");
|
|
10
10
|
const solana_web3_pure_1 = require("../web3-types/solana-web3-pure");
|
|
11
|
-
const common_web3_pure_1 = require("../web3-types/common-web3-pure");
|
|
12
|
-
const ton_web3_pure_1 = require("../web3-types/ton-web3-pure");
|
|
13
11
|
const sui_web3_pure_1 = require("../web3-types/sui-web3-pure");
|
|
12
|
+
const ton_web3_pure_1 = require("../web3-types/ton-web3-pure");
|
|
13
|
+
const tron_web3_pure_1 = require("../web3-types/tron-web3-pure");
|
|
14
|
+
const changenow_api_blockchain_1 = require("./changenow-api-blockchain");
|
|
14
15
|
exports.web3PureStore = {
|
|
15
16
|
[core_1.CHAIN_TYPE.EVM]: new evm_web3_pure_1.EvmWeb3Pure(),
|
|
16
17
|
[core_1.CHAIN_TYPE.SUI]: new sui_web3_pure_1.SuiWeb3Pure(),
|
|
@@ -21,6 +22,7 @@ exports.web3PureStore = {
|
|
|
21
22
|
[core_1.CHAIN_TYPE.BITCOIN_DIAMOND]: new bitcoin_web3_pure_1.BitcoinWeb3Pure(),
|
|
22
23
|
[core_1.CHAIN_TYPE.BITCOIN_GOLD]: new bitcoin_web3_pure_1.BitcoinWeb3Pure(),
|
|
23
24
|
[core_1.CHAIN_TYPE.BSV]: new bitcoin_web3_pure_1.BitcoinWeb3Pure(),
|
|
25
|
+
[core_1.CHAIN_TYPE.NEAR]: new near_web3_pure_1.NearWeb3Pure(),
|
|
24
26
|
// Common Web3
|
|
25
27
|
[core_1.CHAIN_TYPE.RIPPLE]: new common_web3_pure_1.CommonWeb3Pure({
|
|
26
28
|
cnApiKey: changenow_api_blockchain_1.changenowApiBlockchain.RIPPLE,
|
|
@@ -46,10 +48,6 @@ exports.web3PureStore = {
|
|
|
46
48
|
cnApiKey: changenow_api_blockchain_1.changenowApiBlockchain.MONERO,
|
|
47
49
|
regex: /^[48][a-zA-Z|\d]{94}([a-zA-Z|\d]{11})?$/
|
|
48
50
|
}),
|
|
49
|
-
[core_1.CHAIN_TYPE.NEAR]: new common_web3_pure_1.CommonWeb3Pure({
|
|
50
|
-
cnApiKey: changenow_api_blockchain_1.changenowApiBlockchain.NEAR,
|
|
51
|
-
regex: /(^[a-z0-9_-]{2,64}\.near$)|(^[0-9a-f]{64}$)/
|
|
52
|
-
}),
|
|
53
51
|
[core_1.CHAIN_TYPE.ALGORAND]: new common_web3_pure_1.CommonWeb3Pure({
|
|
54
52
|
cnApiKey: changenow_api_blockchain_1.changenowApiBlockchain.ALGORAND,
|
|
55
53
|
regex: /^[A-Z0-9]{58}/
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NearWeb3Pure = void 0;
|
|
4
|
+
const changenow_api_blockchain_1 = require("../constants/changenow-api-blockchain");
|
|
5
|
+
const common_web3_pure_1 = require("./common-web3-pure");
|
|
6
|
+
class NearWeb3Pure extends common_web3_pure_1.CommonWeb3Pure {
|
|
7
|
+
constructor() {
|
|
8
|
+
super({
|
|
9
|
+
cnApiKey: changenow_api_blockchain_1.changenowApiBlockchain.NEAR,
|
|
10
|
+
regex: /(^(?=.{2,64}$)([a-z0-9][a-z0-9\-_]*(?<![-_])\.)*[a-z0-9][a-z0-9\-_]*(?<![-_])(\.near)$)|(^[0-9a-f]{64}$)/
|
|
11
|
+
});
|
|
12
|
+
this.nativeTokenAddress = 'near';
|
|
13
|
+
}
|
|
14
|
+
async isAddressCorrect(address) {
|
|
15
|
+
if (this.isNativeAddress(address)) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
if (this.regEx) {
|
|
19
|
+
return this.regEx.test(address);
|
|
20
|
+
}
|
|
21
|
+
throw new Error(`Validation function is not implemented for ${this.constructor.name}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.NearWeb3Pure = NearWeb3Pure;
|