multichain-address-validator 0.7.8 → 0.8.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/dist/cjs/chain-validators.js +21 -1
- package/dist/cjs/crypto/segwit_addr.js +8 -3
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/validators/bitcoin_validator.d.ts +5 -0
- package/dist/cjs/validators/bitcoin_validator.js +6 -5
- package/dist/cjs/validators/bittensor_validator.d.ts +2 -0
- package/dist/cjs/validators/bittensor_validator.js +11 -0
- package/dist/cjs/validators/index.d.ts +2 -0
- package/dist/cjs/validators/index.js +5 -1
- package/dist/cjs/validators/polkadot_validator.d.ts +1 -4
- package/dist/cjs/validators/polkadot_validator.js +5 -49
- package/dist/cjs/validators/ss58_validator.d.ts +11 -0
- package/dist/cjs/validators/ss58_validator.js +70 -0
- package/dist/cjs/validators/zcash_validator.d.ts +5 -0
- package/dist/cjs/validators/zcash_validator.js +52 -0
- package/dist/esm/chain-validators.js +22 -2
- package/dist/esm/crypto/segwit_addr.js +8 -3
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/validators/bitcoin_validator.d.ts +5 -0
- package/dist/esm/validators/bitcoin_validator.js +5 -5
- package/dist/esm/validators/bittensor_validator.d.ts +2 -0
- package/dist/esm/validators/bittensor_validator.js +6 -0
- package/dist/esm/validators/index.d.ts +2 -0
- package/dist/esm/validators/index.js +2 -0
- package/dist/esm/validators/polkadot_validator.d.ts +1 -4
- package/dist/esm/validators/polkadot_validator.js +5 -49
- package/dist/esm/validators/ss58_validator.d.ts +11 -0
- package/dist/esm/validators/ss58_validator.js +64 -0
- package/dist/esm/validators/zcash_validator.d.ts +5 -0
- package/dist/esm/validators/zcash_validator.js +47 -0
- package/package-lock.json +1705 -0
- package/package.json +1 -1
- package/src/chain-validators.ts +23 -1
- package/src/crypto/segwit_addr.js +9 -3
- package/src/index.ts +2 -1
- package/src/validators/bitcoin_validator.ts +5 -6
- package/src/validators/bittensor_validator.ts +8 -0
- package/src/validators/index.ts +2 -0
- package/src/validators/polkadot_validator.ts +5 -55
- package/src/validators/ss58_validator.ts +80 -0
- package/src/validators/zcash_validator.ts +57 -0
- package/test/addresses/addresses.ts +4 -0
- package/test/addresses/bittensor.json +27 -0
- package/test/addresses/btc-testnet.json +1 -0
- package/test/addresses/btc.json +5 -1
- package/test/addresses/ltc.json +1 -0
- package/test/addresses/zcash.json +8 -0
- package/test/multichain-address-validator.test.ts +18 -1
package/package.json
CHANGED
package/src/chain-validators.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { NetworkType } from './types.js'
|
|
|
4
4
|
import {
|
|
5
5
|
AlgorandValidator,
|
|
6
6
|
BCHValidator,
|
|
7
|
+
BittensorValidator,
|
|
7
8
|
BTCValidator,
|
|
8
9
|
CardanoValidator,
|
|
9
10
|
EOSValidator,
|
|
@@ -20,7 +21,9 @@ import {
|
|
|
20
21
|
TezosValidator,
|
|
21
22
|
TronValidator,
|
|
22
23
|
XLMValidator,
|
|
24
|
+
ZcashValidator,
|
|
23
25
|
} from './validators/index.js'
|
|
26
|
+
import {SegwitVersion} from './validators/bitcoin_validator'
|
|
24
27
|
|
|
25
28
|
|
|
26
29
|
type ChainValidators = Record<string, {
|
|
@@ -40,10 +43,12 @@ const chainValidators: ChainValidators = {
|
|
|
40
43
|
mainnet: BTCValidator({
|
|
41
44
|
addressTypes: ['00', '05'],
|
|
42
45
|
bech32Hrp: ['bc'],
|
|
46
|
+
allowedSegwitVersions: [SegwitVersion.NativeSegwit],
|
|
43
47
|
}),
|
|
44
48
|
testnet: BTCValidator({
|
|
45
49
|
addressTypes: ['6f', 'c4', '3c', '26'],
|
|
46
50
|
bech32Hrp: ['tb'],
|
|
51
|
+
allowedSegwitVersions: [SegwitVersion.NativeSegwit],
|
|
47
52
|
}),
|
|
48
53
|
},
|
|
49
54
|
},
|
|
@@ -62,6 +67,10 @@ const chainValidators: ChainValidators = {
|
|
|
62
67
|
}),
|
|
63
68
|
}
|
|
64
69
|
},
|
|
70
|
+
bittensor: {
|
|
71
|
+
alternatives: ['tao'],
|
|
72
|
+
validator: BittensorValidator,
|
|
73
|
+
},
|
|
65
74
|
cardano: {
|
|
66
75
|
alternatives: ['ada'],
|
|
67
76
|
validator: CardanoValidator,
|
|
@@ -106,10 +115,12 @@ const chainValidators: ChainValidators = {
|
|
|
106
115
|
mainnet: BTCValidator({
|
|
107
116
|
addressTypes: ['30', '32'],
|
|
108
117
|
bech32Hrp: ['ltc'],
|
|
118
|
+
allowedSegwitVersions: [SegwitVersion.NativeSegwit],
|
|
109
119
|
}),
|
|
110
120
|
testnet: BTCValidator({
|
|
111
121
|
addressTypes: ['6f', 'c4', '3a'],
|
|
112
|
-
bech32Hrp: ['tltc']
|
|
122
|
+
bech32Hrp: ['tltc'],
|
|
123
|
+
allowedSegwitVersions: [SegwitVersion.NativeSegwit],
|
|
113
124
|
})
|
|
114
125
|
}
|
|
115
126
|
},
|
|
@@ -119,6 +130,10 @@ const chainValidators: ChainValidators = {
|
|
|
119
130
|
testnet: MoneroValidator(NetworkType.TestNet),
|
|
120
131
|
}
|
|
121
132
|
},
|
|
133
|
+
monad: {
|
|
134
|
+
alternatives: ['mon'],
|
|
135
|
+
validator: ETHValidator,
|
|
136
|
+
},
|
|
122
137
|
nem: {validator: NemValidator},
|
|
123
138
|
nano: {validator: NanoValidator},
|
|
124
139
|
polkadot: {validator: PolkadotValidator},
|
|
@@ -144,6 +159,13 @@ const chainValidators: ChainValidators = {
|
|
|
144
159
|
alternatives: ['stellar', 'stellarlumens'],
|
|
145
160
|
validator: XLMValidator,
|
|
146
161
|
},
|
|
162
|
+
zcash: {
|
|
163
|
+
alternatives: ['zec'],
|
|
164
|
+
validator: {
|
|
165
|
+
mainnet: ZcashValidator(NetworkType.MainNet),
|
|
166
|
+
testnet: ZcashValidator(NetworkType.TestNet),
|
|
167
|
+
}
|
|
168
|
+
},
|
|
147
169
|
}
|
|
148
170
|
|
|
149
171
|
export function getValidatorForChain(chain: Chain): Validator | undefined {
|
|
@@ -93,12 +93,18 @@ function isValidAddress(address, opts = {}) {
|
|
|
93
93
|
return false;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
if (!opts.allowedSegwitVersions?.length) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
|
|
96
100
|
const correctBech32Hrps = opts.bech32Hrp;
|
|
97
101
|
|
|
98
|
-
for(
|
|
99
|
-
|
|
102
|
+
for(const chrp of correctBech32Hrps) {
|
|
103
|
+
const ret = decode(chrp, address);
|
|
100
104
|
if(ret) {
|
|
101
|
-
|
|
105
|
+
if (opts.allowedSegwitVersions.includes(ret.version)) {
|
|
106
|
+
return encode(chrp, ret.version, ret.program) === address.toLowerCase();
|
|
107
|
+
}
|
|
102
108
|
}
|
|
103
109
|
}
|
|
104
110
|
|
package/src/index.ts
CHANGED
|
@@ -71,24 +71,23 @@ function isValidP2PKHandP2SHAddress(address: string, opts: BTCValidatorOpts) {
|
|
|
71
71
|
return false;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
export enum SegwitVersion {
|
|
75
|
+
NativeSegwit = 0,
|
|
76
|
+
TapRoot = 1,
|
|
77
|
+
}
|
|
74
78
|
|
|
75
79
|
interface BTCValidatorOpts {
|
|
76
80
|
addressTypes: string[],
|
|
77
81
|
expectedLength?: number,
|
|
78
82
|
bech32Hrp?: [string],
|
|
83
|
+
allowedSegwitVersions?: [number],
|
|
79
84
|
hashFunction?: 'blake256' | 'blake256keccak256' | 'keccak256' | 'sha256',
|
|
80
85
|
regex?: RegExp,
|
|
81
86
|
}
|
|
82
87
|
|
|
83
|
-
// const DefaultBTCValidatorOpts: BTCValidatorOpts = {
|
|
84
|
-
// addressTypes: {mainnet: ['00', '05'], testnet: ['6f', 'c4', '3c', '26']},
|
|
85
|
-
// bech32Hrp: {mainnet: ['bc'], testnet: ['tb']},
|
|
86
|
-
// }
|
|
87
|
-
|
|
88
88
|
export default (opts: BTCValidatorOpts) => ({
|
|
89
89
|
isValidAddress(address: Address): boolean {
|
|
90
90
|
const addr = getAddress(address)
|
|
91
|
-
// const _opts = {...DefaultBTCValidatorOpts, ...opts}
|
|
92
91
|
return isValidP2PKHandP2SHAddress(addr, opts) || segwit.isValidAddress(addr, opts);
|
|
93
92
|
}
|
|
94
93
|
})
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import createSS58Validator from './ss58_validator.js'
|
|
2
|
+
|
|
3
|
+
// Bittensor uses SS58 address format (Substrate-based) with network prefix 42
|
|
4
|
+
// Reference: https://docs.learnbittensor.org/evm-tutorials/convert-h160-to-ss58
|
|
5
|
+
// SS58 Registry: https://github.com/paritytech/ss58-registry
|
|
6
|
+
|
|
7
|
+
// Network prefix 42 (0x2A in hex) is used by Bittensor
|
|
8
|
+
export default createSS58Validator({ networkPrefix: 42 })
|
package/src/validators/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export {default as AlgorandValidator} from "./algorand_validator.js"
|
|
2
2
|
export {default as BCHValidator} from "./bch_validator.js"
|
|
3
|
+
export {default as BittensorValidator} from "./bittensor_validator.js"
|
|
3
4
|
export {default as BTCValidator} from "./bitcoin_validator.js"
|
|
4
5
|
export {default as CardanoValidator} from "./cardano_validator.js"
|
|
5
6
|
export {default as EOSValidator} from "./eos_validator.js"
|
|
@@ -16,3 +17,4 @@ export {default as SolanaValidator} from "./solana_validator.js"
|
|
|
16
17
|
export {default as TezosValidator} from "./tezos_validator.js"
|
|
17
18
|
export {default as TronValidator} from "./tron_validator.js"
|
|
18
19
|
export {default as XLMValidator} from "./xlm_validator.js"
|
|
20
|
+
export {default as ZcashValidator} from "./zcash_validator.js"
|
|
@@ -1,57 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {Address} from '../types.js'
|
|
3
|
-
import {getAddress} from '../helpers.js'
|
|
1
|
+
import createSS58Validator from './ss58_validator.js'
|
|
4
2
|
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
{addressLength: 4, accountIndexLength: 2, checkSumLength: 1},
|
|
9
|
-
{addressLength: 5, accountIndexLength: 2, checkSumLength: 2},
|
|
10
|
-
{addressLength: 6, accountIndexLength: 4, checkSumLength: 1},
|
|
11
|
-
{addressLength: 7, accountIndexLength: 4, checkSumLength: 2},
|
|
12
|
-
{addressLength: 8, accountIndexLength: 4, checkSumLength: 3},
|
|
13
|
-
{addressLength: 9, accountIndexLength: 4, checkSumLength: 4},
|
|
14
|
-
{addressLength: 10, accountIndexLength: 8, checkSumLength: 1},
|
|
15
|
-
{addressLength: 11, accountIndexLength: 8, checkSumLength: 2},
|
|
16
|
-
{addressLength: 12, accountIndexLength: 8, checkSumLength: 3},
|
|
17
|
-
{addressLength: 13, accountIndexLength: 8, checkSumLength: 4},
|
|
18
|
-
{addressLength: 14, accountIndexLength: 8, checkSumLength: 5},
|
|
19
|
-
{addressLength: 15, accountIndexLength: 8, checkSumLength: 6},
|
|
20
|
-
{addressLength: 16, accountIndexLength: 8, checkSumLength: 7},
|
|
21
|
-
{addressLength: 17, accountIndexLength: 8, checkSumLength: 8},
|
|
22
|
-
{addressLength: 34, accountIndexLength: 32, checkSumLength: 2},
|
|
23
|
-
];
|
|
3
|
+
// Polkadot uses SS58 address format (Substrate-based)
|
|
4
|
+
// SS58 Registry: https://github.com/paritytech/ss58-registry
|
|
5
|
+
// Accepts any valid SS58 address (no network prefix restriction)
|
|
24
6
|
|
|
25
|
-
|
|
26
|
-
try {
|
|
27
|
-
const preImage = '53533538505245'
|
|
28
|
-
const decoded = cryptoUtils.base58(address);
|
|
29
|
-
const addressType = cryptoUtils.byteArray2hexStr(decoded.slice(0, 1));
|
|
30
|
-
const addressAndChecksum = decoded.slice(1)
|
|
31
|
-
|
|
32
|
-
// get the address format
|
|
33
|
-
const addressFormat = addressFormats.find(af => af.addressLength === addressAndChecksum.length);
|
|
34
|
-
|
|
35
|
-
if (!addressFormat) {
|
|
36
|
-
throw new Error('Invalid address length');
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const decodedAddress = cryptoUtils.byteArray2hexStr(addressAndChecksum.slice(0, addressFormat.accountIndexLength));
|
|
40
|
-
const checksum = cryptoUtils.byteArray2hexStr(addressAndChecksum.slice(-addressFormat.checkSumLength));
|
|
41
|
-
|
|
42
|
-
const calculatedHash = cryptoUtils
|
|
43
|
-
.blake2b(preImage + addressType + decodedAddress, 64)
|
|
44
|
-
.substr(0, addressFormat.checkSumLength * 2)
|
|
45
|
-
.toUpperCase();
|
|
46
|
-
|
|
47
|
-
return calculatedHash == checksum;
|
|
48
|
-
} catch (err) {
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export default {
|
|
54
|
-
isValidAddress(address: Address) {
|
|
55
|
-
return verifyChecksum(getAddress(address))
|
|
56
|
-
},
|
|
57
|
-
}
|
|
7
|
+
export default createSS58Validator()
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import cryptoUtils from '../crypto/utils.js'
|
|
2
|
+
import {Address, Validator} from '../types.js'
|
|
3
|
+
import {getAddress} from '../helpers.js'
|
|
4
|
+
|
|
5
|
+
// SS58 address format (Substrate-based)
|
|
6
|
+
// SS58 Registry: https://github.com/paritytech/ss58-registry
|
|
7
|
+
const addressFormats = [
|
|
8
|
+
{addressLength: 3, accountIndexLength: 1, checkSumLength: 1},
|
|
9
|
+
{addressLength: 4, accountIndexLength: 2, checkSumLength: 1},
|
|
10
|
+
{addressLength: 5, accountIndexLength: 2, checkSumLength: 2},
|
|
11
|
+
{addressLength: 6, accountIndexLength: 4, checkSumLength: 1},
|
|
12
|
+
{addressLength: 7, accountIndexLength: 4, checkSumLength: 2},
|
|
13
|
+
{addressLength: 8, accountIndexLength: 4, checkSumLength: 3},
|
|
14
|
+
{addressLength: 9, accountIndexLength: 4, checkSumLength: 4},
|
|
15
|
+
{addressLength: 10, accountIndexLength: 8, checkSumLength: 1},
|
|
16
|
+
{addressLength: 11, accountIndexLength: 8, checkSumLength: 2},
|
|
17
|
+
{addressLength: 12, accountIndexLength: 8, checkSumLength: 3},
|
|
18
|
+
{addressLength: 13, accountIndexLength: 8, checkSumLength: 4},
|
|
19
|
+
{addressLength: 14, accountIndexLength: 8, checkSumLength: 5},
|
|
20
|
+
{addressLength: 15, accountIndexLength: 8, checkSumLength: 6},
|
|
21
|
+
{addressLength: 16, accountIndexLength: 8, checkSumLength: 7},
|
|
22
|
+
{addressLength: 17, accountIndexLength: 8, checkSumLength: 8},
|
|
23
|
+
{addressLength: 34, accountIndexLength: 32, checkSumLength: 2},
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
interface SS58ValidatorOptions {
|
|
27
|
+
// Network prefix to validate (in decimal). If provided, only addresses with this prefix are valid.
|
|
28
|
+
// Examples: 0 = Polkadot, 2 = Kusama, 42 = Substrate/Bittensor
|
|
29
|
+
networkPrefix?: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Creates an SS58 validator with optional network prefix filtering
|
|
34
|
+
* @param options Configuration options including optional network prefix
|
|
35
|
+
* @returns Validator instance for SS58 addresses
|
|
36
|
+
*/
|
|
37
|
+
export default function createSS58Validator(options: SS58ValidatorOptions = {}): Validator {
|
|
38
|
+
function verifyChecksum(address: string): boolean {
|
|
39
|
+
try {
|
|
40
|
+
const preImage = '53533538505245'
|
|
41
|
+
const decoded = cryptoUtils.base58(address);
|
|
42
|
+
const addressType = cryptoUtils.byteArray2hexStr(decoded.slice(0, 1));
|
|
43
|
+
|
|
44
|
+
// If a specific network prefix is required, validate it
|
|
45
|
+
if (options.networkPrefix !== undefined) {
|
|
46
|
+
const expectedPrefix = options.networkPrefix.toString(16).padStart(2, '0').toUpperCase();
|
|
47
|
+
if (addressType.toUpperCase() !== expectedPrefix) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const addressAndChecksum = decoded.slice(1)
|
|
53
|
+
|
|
54
|
+
// get the address format
|
|
55
|
+
const addressFormat = addressFormats.find(af => af.addressLength === addressAndChecksum.length);
|
|
56
|
+
|
|
57
|
+
if (!addressFormat) {
|
|
58
|
+
throw new Error('Invalid address length');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const decodedAddress = cryptoUtils.byteArray2hexStr(addressAndChecksum.slice(0, addressFormat.accountIndexLength));
|
|
62
|
+
const checksum = cryptoUtils.byteArray2hexStr(addressAndChecksum.slice(-addressFormat.checkSumLength));
|
|
63
|
+
|
|
64
|
+
const calculatedHash = cryptoUtils
|
|
65
|
+
.blake2b(preImage + addressType + decodedAddress, 64)
|
|
66
|
+
.substr(0, addressFormat.checkSumLength * 2)
|
|
67
|
+
.toUpperCase();
|
|
68
|
+
|
|
69
|
+
return calculatedHash == checksum;
|
|
70
|
+
} catch (err) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
isValidAddress(address: Address) {
|
|
77
|
+
return verifyChecksum(getAddress(address))
|
|
78
|
+
},
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import base58 from '../crypto/base58.js'
|
|
2
|
+
import cryptoUtils from '../crypto/utils.js'
|
|
3
|
+
import {Address, NetworkType} from '../types.js'
|
|
4
|
+
import {getAddress} from '../helpers.js'
|
|
5
|
+
|
|
6
|
+
function getDecoded(address: string) {
|
|
7
|
+
try {
|
|
8
|
+
return base58.decode(address);
|
|
9
|
+
} catch (e) {
|
|
10
|
+
// if decoding fails, assume invalid address
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function getChecksum(payload: any) {
|
|
16
|
+
return cryptoUtils.sha256Checksum(payload);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function isValidTransparentAddress(address: string, networkType: NetworkType) {
|
|
20
|
+
// Zcash transparent addresses use 2-byte version prefixes
|
|
21
|
+
// Expected length: 26 bytes (2 bytes version + 20 bytes payload + 4 bytes checksum)
|
|
22
|
+
const expectedLength = 26;
|
|
23
|
+
const decoded = getDecoded(address);
|
|
24
|
+
|
|
25
|
+
if (!decoded || decoded.length !== expectedLength) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const checksum = cryptoUtils.toHex(decoded.slice(expectedLength - 4, expectedLength));
|
|
30
|
+
const body = cryptoUtils.toHex(decoded.slice(0, expectedLength - 4));
|
|
31
|
+
const goodChecksum = getChecksum(body);
|
|
32
|
+
|
|
33
|
+
if (checksum !== goodChecksum) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Get the 2-byte version prefix
|
|
38
|
+
const versionPrefix = cryptoUtils.toHex(decoded.slice(0, 2));
|
|
39
|
+
|
|
40
|
+
// Define valid version prefixes for each network
|
|
41
|
+
// Only supporting transparent addresses (t1/t3 for mainnet, tm/t2 for testnet)
|
|
42
|
+
const validPrefixes = networkType === NetworkType.MainNet
|
|
43
|
+
? ['1cb8', '1cbd'] // t1 (P2PKH) and t3 (P2SH) for mainnet
|
|
44
|
+
: ['1d25', '1cba']; // tm (P2PKH) and t2 (P2SH) for testnet
|
|
45
|
+
|
|
46
|
+
return validPrefixes.includes(versionPrefix);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export default (networkType: NetworkType) => ({
|
|
50
|
+
isValidAddress(address: Address): boolean {
|
|
51
|
+
const addr = getAddress(address);
|
|
52
|
+
|
|
53
|
+
// Only validate transparent addresses (t1/t3 for mainnet, tm/t2 for testnet)
|
|
54
|
+
// Sapling (zs) and Unified (u) addresses are NOT supported
|
|
55
|
+
return isValidTransparentAddress(addr, networkType);
|
|
56
|
+
}
|
|
57
|
+
})
|
|
@@ -2,6 +2,7 @@ import algorand from './algorand.json'
|
|
|
2
2
|
import aptos from './aptos.json'
|
|
3
3
|
import bch from './bch.json'
|
|
4
4
|
import bchTestnet from './bch-testnet.json'
|
|
5
|
+
import bittensor from './bittensor.json'
|
|
5
6
|
import btc from './btc.json'
|
|
6
7
|
import btcTestnet from './btc-testnet.json'
|
|
7
8
|
import cardano from './cardano.json'
|
|
@@ -24,6 +25,7 @@ import sui from './sui.json'
|
|
|
24
25
|
import tezos from './tezos.json'
|
|
25
26
|
import tron from './tron.json'
|
|
26
27
|
import xlm from './xlm.json'
|
|
28
|
+
import zcash from './zcash.json'
|
|
27
29
|
|
|
28
30
|
export type TestAddress = string | { address: string, memo?: string } & { invalid?: boolean, invalidMemo?: boolean }
|
|
29
31
|
|
|
@@ -32,6 +34,7 @@ const testAddresses: Record<string, TestAddress[]> = {
|
|
|
32
34
|
algorand,
|
|
33
35
|
bch,
|
|
34
36
|
'bch-testnet': bchTestnet,
|
|
37
|
+
bittensor,
|
|
35
38
|
btc,
|
|
36
39
|
'btc-testnet': btcTestnet,
|
|
37
40
|
cardano,
|
|
@@ -54,6 +57,7 @@ const testAddresses: Record<string, TestAddress[]> = {
|
|
|
54
57
|
tezos,
|
|
55
58
|
tron,
|
|
56
59
|
xlm,
|
|
60
|
+
zcash,
|
|
57
61
|
} as const;
|
|
58
62
|
|
|
59
63
|
export default testAddresses
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[
|
|
2
|
+
"5CS9x5NsPHpb2THeS92zBYCSSk4MFoQjjx76DB8bEzeJTTSt",
|
|
3
|
+
"5CZmB94iEG4Ld7JkejAWToAw7NKEfV3YZHX7FYaqPGh7isXe",
|
|
4
|
+
"5DA7UsaYbk1UnhhtTxqpwdqjuxhQ2rW7D6GTN1S1S5tC2NRV",
|
|
5
|
+
"5HGjWAeFDfFCWPsjFQdVV2Msvz2XtMktvgocEZcCj68kUMaw",
|
|
6
|
+
"5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy",
|
|
7
|
+
"5HpG9w8EBLe5XCrbczpwq5TSXvedjrBGCwqxK1iQ7qUsSWFc",
|
|
8
|
+
"5CiPPseXPECbkjWCa6MnjNokrgYjMqmKndv2rSnekmSK2DjL",
|
|
9
|
+
"5GNJqTPyNqANBkUVMN1LPPrxXnFouWXoe2wNSmmEoLctxiZY",
|
|
10
|
+
"5Gs5ung9YhbXjrEx469w5V9C6V8nEVM6XS9CzMMq1tq16cMt",
|
|
11
|
+
{
|
|
12
|
+
"address": "1iQPKJmghHbrRhUiMt2cNEuxYbR6S9vYtJKqYvE4PNR9WDB",
|
|
13
|
+
"invalid": true
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"address": "invalid_ss58_address",
|
|
17
|
+
"invalid": true
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"address": "0x1234567890abcdef",
|
|
21
|
+
"invalid": true
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"address": "123",
|
|
25
|
+
"invalid": true
|
|
26
|
+
}
|
|
27
|
+
]
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"GSa5espVLNseXEfKt46zEdS6jrPkmFghBU",
|
|
9
9
|
"tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3q0sl5k7",
|
|
10
10
|
"tb1qqqqqp399et2xygdj5xreqhjjvcmzhxw4aywxecjdzew6hylgvsesrxh6hy",
|
|
11
|
+
"2My6YWQy9Umh52TFwhRA5CXHZQVLFoB39vJ",
|
|
11
12
|
"mxHzYDeCZD8qzvfVzTqPS65p23inGkRvXT",
|
|
12
13
|
"2N3ATmqPqnHR243HiwtqpCFwSsNdTiCvmmv"
|
|
13
14
|
]
|
package/test/addresses/btc.json
CHANGED
|
@@ -10,5 +10,9 @@
|
|
|
10
10
|
"1SQHtwR5oJRKLfiWQ2APsAd9miUc4k2ez",
|
|
11
11
|
"116CGDLddrZhMrTwhCVJXtXQpxygTT1kHd",
|
|
12
12
|
"3NJZLcZEEYBpxYEUGewU4knsQRn1WM5Fkt",
|
|
13
|
-
"bc1q2t63ewm3mvh0ztmnmezxm7s0tefknenxlrlwrk"
|
|
13
|
+
"bc1q2t63ewm3mvh0ztmnmezxm7s0tefknenxlrlwrk",
|
|
14
|
+
{
|
|
15
|
+
"address": "bc1pmr3w69uk09zqez3vy4l0jjws7uwa9fmljag2mwumfx9rr6045g8scr7nn3",
|
|
16
|
+
"invalid": true
|
|
17
|
+
}
|
|
14
18
|
]
|
package/test/addresses/ltc.json
CHANGED
|
@@ -84,6 +84,11 @@ const TestCases: Record<string, TestCase> = {
|
|
|
84
84
|
testAddresses: 'bch-testnet',
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
|
+
'bittensor': {
|
|
88
|
+
alternatives: ['tao'],
|
|
89
|
+
testAddresses: 'bittensor',
|
|
90
|
+
exclude: ['polkadot'],
|
|
91
|
+
},
|
|
87
92
|
'cardano': {
|
|
88
93
|
alternatives: ['ada'],
|
|
89
94
|
testAddresses: 'cardano',
|
|
@@ -112,6 +117,7 @@ const TestCases: Record<string, TestCase> = {
|
|
|
112
117
|
'bsc',
|
|
113
118
|
'eth',
|
|
114
119
|
'flare',
|
|
120
|
+
'monad',
|
|
115
121
|
'optimism',
|
|
116
122
|
'sonic',
|
|
117
123
|
'story',
|
|
@@ -137,6 +143,11 @@ const TestCases: Record<string, TestCase> = {
|
|
|
137
143
|
testAddresses: 'monero-testnet',
|
|
138
144
|
}
|
|
139
145
|
},
|
|
146
|
+
'monad': {
|
|
147
|
+
alternatives: ['mon'],
|
|
148
|
+
testAddresses: 'evm',
|
|
149
|
+
exclude: ['evm'],
|
|
150
|
+
},
|
|
140
151
|
'nano': {
|
|
141
152
|
alternatives: [],
|
|
142
153
|
testAddresses: 'nano',
|
|
@@ -148,6 +159,7 @@ const TestCases: Record<string, TestCase> = {
|
|
|
148
159
|
'polkadot': {
|
|
149
160
|
alternatives: [],
|
|
150
161
|
testAddresses: 'polkadot',
|
|
162
|
+
exclude: ['bittensor'],
|
|
151
163
|
},
|
|
152
164
|
'ripple': {
|
|
153
165
|
alternatives: ['xrp'],
|
|
@@ -169,7 +181,7 @@ const TestCases: Record<string, TestCase> = {
|
|
|
169
181
|
'tezos': {
|
|
170
182
|
alternatives: [],
|
|
171
183
|
testAddresses: 'tezos',
|
|
172
|
-
exclude: ['btc', 'bch', 'btc-testnet', 'ltc-testnet', 'bch-testnet', 'doge', 'doge-testnet', 'ltc', 'tron'],
|
|
184
|
+
exclude: ['btc', 'bch', 'btc-testnet', 'ltc-testnet', 'bch-testnet', 'doge', 'doge-testnet', 'ltc', 'tron', 'zcash'],
|
|
173
185
|
},
|
|
174
186
|
'tron': {
|
|
175
187
|
alternatives: ['trc20'],
|
|
@@ -178,6 +190,11 @@ const TestCases: Record<string, TestCase> = {
|
|
|
178
190
|
'xlm': {
|
|
179
191
|
alternatives: ['stellar', 'stellarlumens'],
|
|
180
192
|
testAddresses: 'xlm',
|
|
193
|
+
},
|
|
194
|
+
'zcash': {
|
|
195
|
+
alternatives: ['zec'],
|
|
196
|
+
testAddresses: 'zcash',
|
|
197
|
+
exclude: ['tezos'],
|
|
181
198
|
}
|
|
182
199
|
}
|
|
183
200
|
|