@talismn/crypto 0.1.5 → 0.2.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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isValidAddress: (address: string) => boolean;
|
|
@@ -401,6 +401,15 @@ const isAddressEqual = (address1, address2) => {
|
|
|
401
401
|
}
|
|
402
402
|
};
|
|
403
403
|
|
|
404
|
+
const isValidAddress = address => {
|
|
405
|
+
try {
|
|
406
|
+
normalizeAddress(address);
|
|
407
|
+
return true;
|
|
408
|
+
} catch {
|
|
409
|
+
return false;
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
|
|
404
413
|
// Inspired from MIT licensed @polkadot-labs/hdkd helpers
|
|
405
414
|
// https://github.com/polkadot-labs/hdkd/blob/3ef6e02827212d934b59a4e566d8aa61d3ba7b27/packages/hdkd-helpers/src/parseDerivations.ts#L1
|
|
406
415
|
|
|
@@ -735,6 +744,7 @@ exports.isBech32mAddress = isBech32mAddress;
|
|
|
735
744
|
exports.isBitcoinAddress = isBitcoinAddress;
|
|
736
745
|
exports.isEthereumAddress = isEthereumAddress;
|
|
737
746
|
exports.isSs58Address = isSs58Address;
|
|
747
|
+
exports.isValidAddress = isValidAddress;
|
|
738
748
|
exports.isValidDerivationPath = isValidDerivationPath;
|
|
739
749
|
exports.isValidMnemonic = isValidMnemonic;
|
|
740
750
|
exports.mnemonicToEntropy = mnemonicToEntropy;
|
|
@@ -401,6 +401,15 @@ const isAddressEqual = (address1, address2) => {
|
|
|
401
401
|
}
|
|
402
402
|
};
|
|
403
403
|
|
|
404
|
+
const isValidAddress = address => {
|
|
405
|
+
try {
|
|
406
|
+
normalizeAddress(address);
|
|
407
|
+
return true;
|
|
408
|
+
} catch {
|
|
409
|
+
return false;
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
|
|
404
413
|
// Inspired from MIT licensed @polkadot-labs/hdkd helpers
|
|
405
414
|
// https://github.com/polkadot-labs/hdkd/blob/3ef6e02827212d934b59a4e566d8aa61d3ba7b27/packages/hdkd-helpers/src/parseDerivations.ts#L1
|
|
406
415
|
|
|
@@ -735,6 +744,7 @@ exports.isBech32mAddress = isBech32mAddress;
|
|
|
735
744
|
exports.isBitcoinAddress = isBitcoinAddress;
|
|
736
745
|
exports.isEthereumAddress = isEthereumAddress;
|
|
737
746
|
exports.isSs58Address = isSs58Address;
|
|
747
|
+
exports.isValidAddress = isValidAddress;
|
|
738
748
|
exports.isValidDerivationPath = isValidDerivationPath;
|
|
739
749
|
exports.isValidMnemonic = isValidMnemonic;
|
|
740
750
|
exports.mnemonicToEntropy = mnemonicToEntropy;
|
|
@@ -396,6 +396,15 @@ const isAddressEqual = (address1, address2) => {
|
|
|
396
396
|
}
|
|
397
397
|
};
|
|
398
398
|
|
|
399
|
+
const isValidAddress = address => {
|
|
400
|
+
try {
|
|
401
|
+
normalizeAddress(address);
|
|
402
|
+
return true;
|
|
403
|
+
} catch {
|
|
404
|
+
return false;
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
|
|
399
408
|
// Inspired from MIT licensed @polkadot-labs/hdkd helpers
|
|
400
409
|
// https://github.com/polkadot-labs/hdkd/blob/3ef6e02827212d934b59a4e566d8aa61d3ba7b27/packages/hdkd-helpers/src/parseDerivations.ts#L1
|
|
401
410
|
|
|
@@ -690,4 +699,4 @@ const platformFromAddress = address => {
|
|
|
690
699
|
return platformFromEncoding(encoding);
|
|
691
700
|
};
|
|
692
701
|
|
|
693
|
-
export { DEV_MNEMONIC_ETHEREUM, DEV_MNEMONIC_POLKADOT, addressEncodingFromCurve, addressFromPublicKey, addressFromSuri, blake2b256, blake2b512, blake3, checksumEthereumAddress, decodeSs58Address, deriveKeypair, detectAddressEncoding, encodeAddressBase58, encodeAddressEthereum, encodeAddressSs58, entropyToMnemonic, entropyToSeed, fromBase58Check, fromBech32, fromBech32m, generateMnemonic, getDevSeed, getPublicKeyFromSecret, getSafeHash, isAddressEqual, isBase58Address, isBase58CheckAddress, isBech32Address, isBech32mAddress, isBitcoinAddress, isEthereumAddress, isSs58Address, isValidDerivationPath, isValidMnemonic, mnemonicToEntropy, normalizeAddress, parseSecretKey, parseSuri, pbkdf2, platformFromAddress, platformFromCurve, platformFromEncoding, removeHexPrefix };
|
|
702
|
+
export { DEV_MNEMONIC_ETHEREUM, DEV_MNEMONIC_POLKADOT, addressEncodingFromCurve, addressFromPublicKey, addressFromSuri, blake2b256, blake2b512, blake3, checksumEthereumAddress, decodeSs58Address, deriveKeypair, detectAddressEncoding, encodeAddressBase58, encodeAddressEthereum, encodeAddressSs58, entropyToMnemonic, entropyToSeed, fromBase58Check, fromBech32, fromBech32m, generateMnemonic, getDevSeed, getPublicKeyFromSecret, getSafeHash, isAddressEqual, isBase58Address, isBase58CheckAddress, isBech32Address, isBech32mAddress, isBitcoinAddress, isEthereumAddress, isSs58Address, isValidAddress, isValidDerivationPath, isValidMnemonic, mnemonicToEntropy, normalizeAddress, parseSecretKey, parseSuri, pbkdf2, platformFromAddress, platformFromCurve, platformFromEncoding, removeHexPrefix };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@talismn/crypto",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"author": "Talisman",
|
|
5
5
|
"homepage": "https://talisman.xyz",
|
|
6
6
|
"license": "GPL-3.0-or-later",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"jest": "^29.7.0",
|
|
39
39
|
"ts-jest": "^29.2.5",
|
|
40
40
|
"typescript": "^5.6.3",
|
|
41
|
-
"@talismn/
|
|
42
|
-
"@talismn/
|
|
41
|
+
"@talismn/eslint-config": "0.0.3",
|
|
42
|
+
"@talismn/tsconfig": "0.0.2"
|
|
43
43
|
},
|
|
44
44
|
"preconstruct": {
|
|
45
45
|
"entrypoints": [
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
]
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
|
-
"test": "jest",
|
|
56
|
+
"test": "jest --detectOpenHandles",
|
|
57
57
|
"lint": "eslint src --max-warnings 0",
|
|
58
58
|
"clean": "rm -rf dist plugins/dist .turbo node_modules"
|
|
59
59
|
}
|