multichain-address-validator 0.7.0 → 0.7.2
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/dist/chain-validators.js
CHANGED
|
@@ -44,7 +44,22 @@ const chainValidators = {
|
|
|
44
44
|
},
|
|
45
45
|
eos: { validator: EOSValidator },
|
|
46
46
|
ethereum: {
|
|
47
|
-
alternatives: [
|
|
47
|
+
alternatives: [
|
|
48
|
+
'arbitrum',
|
|
49
|
+
'avalanche',
|
|
50
|
+
'avalanche-c',
|
|
51
|
+
'base',
|
|
52
|
+
'binance',
|
|
53
|
+
'BinanceSmartChain',
|
|
54
|
+
'bnb',
|
|
55
|
+
'bsc',
|
|
56
|
+
'eth',
|
|
57
|
+
'EthereumClassic',
|
|
58
|
+
'EthereumPow',
|
|
59
|
+
'erc20',
|
|
60
|
+
'flare',
|
|
61
|
+
'sonic',
|
|
62
|
+
],
|
|
48
63
|
validator: ETHValidator
|
|
49
64
|
},
|
|
50
65
|
hedera: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getValidatorForChain } from './chain-validators.js';
|
|
2
2
|
export function validate(address, chain) {
|
|
3
3
|
const validator = getValidatorForChain(chain);
|
|
4
|
-
if (validator) {
|
|
5
|
-
|
|
4
|
+
if (!validator) {
|
|
5
|
+
throw new Error(`Missing validator for chain: ${chain}`);
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
return validator.isValidAddress(address);
|
|
8
8
|
}
|
package/package-lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "multichain-address-validator",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "multichain-address-validator",
|
|
9
|
-
"version": "0.0
|
|
9
|
+
"version": "0.7.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@noble/hashes": "^1.4.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "multichain-address-validator",
|
|
3
3
|
"description": "Multichain address validator for Bitcoin and other blockchains.",
|
|
4
|
+
"version": "0.7.2",
|
|
4
5
|
"keywords": [
|
|
5
6
|
"0x",
|
|
6
7
|
"zrx",
|
|
@@ -315,7 +316,6 @@
|
|
|
315
316
|
"ZenCash",
|
|
316
317
|
"zen"
|
|
317
318
|
],
|
|
318
|
-
"version": "0.7.0",
|
|
319
319
|
"author": "Chris <28301107+christsim@users.noreply.github.com>",
|
|
320
320
|
"homepage": "https://github.com/christsim/multichain-address-validator",
|
|
321
321
|
"license": "MIT",
|
package/src/chain-validators.ts
CHANGED
|
@@ -75,7 +75,22 @@ const chainValidators: ChainValidators = {
|
|
|
75
75
|
},
|
|
76
76
|
eos: {validator: EOSValidator},
|
|
77
77
|
ethereum: {
|
|
78
|
-
alternatives: [
|
|
78
|
+
alternatives: [
|
|
79
|
+
'arbitrum',
|
|
80
|
+
'avalanche',
|
|
81
|
+
'avalanche-c',
|
|
82
|
+
'base',
|
|
83
|
+
'binance',
|
|
84
|
+
'BinanceSmartChain',
|
|
85
|
+
'bnb',
|
|
86
|
+
'bsc',
|
|
87
|
+
'eth',
|
|
88
|
+
'EthereumClassic',
|
|
89
|
+
'EthereumPow',
|
|
90
|
+
'erc20',
|
|
91
|
+
'flare',
|
|
92
|
+
'sonic',
|
|
93
|
+
],
|
|
79
94
|
validator: ETHValidator
|
|
80
95
|
},
|
|
81
96
|
hedera: {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {Address, Chain} from './types.js'
|
|
1
|
+
import {Address, Chain, NetworkType} from './types.js'
|
|
2
2
|
import {getValidatorForChain} from './chain-validators.js'
|
|
3
3
|
|
|
4
4
|
export function validate(address: Address, chain: Chain) {
|
|
5
5
|
const validator = getValidatorForChain(chain)
|
|
6
|
-
if (validator) {
|
|
7
|
-
|
|
6
|
+
if (!validator) {
|
|
7
|
+
throw new Error(`Missing validator for chain: ${chain}`);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
return validator.isValidAddress(address);
|
|
11
11
|
}
|
|
12
|
+
|
|
13
|
+
export type { Address, Chain, NetworkType }
|