@talismn/keyring 0.1.3 → 0.1.4
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.
|
@@ -8,6 +8,7 @@ declare const ACCOUNT_TYPES_OWNED: readonly ["keypair", "ledger-ethereum", "ledg
|
|
|
8
8
|
declare const ACCOUNT_TYPES_EXTERNAL: readonly ["contact", "watch-only", "ledger-ethereum", "ledger-polkadot", "polkadot-vault", "signet"];
|
|
9
9
|
declare const ACCOUNT_TYPES_ETHEREUM: readonly ["contact", "watch-only", "keypair", "ledger-ethereum"];
|
|
10
10
|
declare const ACCOUNT_TYPES_POLKADOT: readonly ["contact", "watch-only", "keypair", "ledger-polkadot", "polkadot-vault", "signet"];
|
|
11
|
+
declare const ACCOUNT_TYPES_BITCOIN: readonly ["contact", "watch-only"];
|
|
11
12
|
export declare const isAccountExternal: (account: Account | null | undefined) => account is AccountOfType<(typeof ACCOUNT_TYPES_EXTERNAL)[number]>;
|
|
12
13
|
export declare const isAccountOwned: (account: Account | null | undefined) => account is AccountOfType<(typeof ACCOUNT_TYPES_OWNED)[number]>;
|
|
13
14
|
export declare const isAccountPortfolio: (account: Account | null | undefined) => account is Account;
|
|
@@ -30,6 +31,10 @@ export declare const isAccountLedgerPolkadotGeneric: (account: Account | null |
|
|
|
30
31
|
export declare const isAccountLedgerPolkadotLegacy: (account: Account | null | undefined) => account is AccountLedgerPolkadot & {
|
|
31
32
|
genesisHash: `0x${string}`;
|
|
32
33
|
};
|
|
34
|
+
type AccountBitcoin = Extract<Account, {
|
|
35
|
+
type: (typeof ACCOUNT_TYPES_BITCOIN)[number];
|
|
36
|
+
}>;
|
|
37
|
+
export declare const isAccountBitcoin: (account: Account | null | undefined) => account is AccountBitcoin;
|
|
33
38
|
export declare const getAccountGenesisHash: (account: Account | null | undefined) => `0x${string}` | undefined;
|
|
34
39
|
export declare const getAccountSignetUrl: (account: Account | null | undefined) => string | undefined;
|
|
35
40
|
export declare const getAccountPlatform: (account: Account | null | undefined) => import("@talismn/crypto").Platform | undefined;
|
|
@@ -32,6 +32,9 @@ const isAccountLedgerPolkadotGeneric = account => {
|
|
|
32
32
|
const isAccountLedgerPolkadotLegacy = account => {
|
|
33
33
|
return isAccountOfType(account, "ledger-polkadot") && !!account.genesisHash;
|
|
34
34
|
};
|
|
35
|
+
const isAccountBitcoin = account => {
|
|
36
|
+
return !!account && crypto$1.isBitcoinAddress(account.address);
|
|
37
|
+
};
|
|
35
38
|
const getAccountGenesisHash = account => {
|
|
36
39
|
if (!account) return undefined;
|
|
37
40
|
return "genesisHash" in account ? account.genesisHash || undefined : undefined;
|
|
@@ -411,6 +414,7 @@ exports.Keyring = Keyring;
|
|
|
411
414
|
exports.getAccountGenesisHash = getAccountGenesisHash;
|
|
412
415
|
exports.getAccountPlatform = getAccountPlatform;
|
|
413
416
|
exports.getAccountSignetUrl = getAccountSignetUrl;
|
|
417
|
+
exports.isAccountBitcoin = isAccountBitcoin;
|
|
414
418
|
exports.isAccountEthereum = isAccountEthereum;
|
|
415
419
|
exports.isAccountExternal = isAccountExternal;
|
|
416
420
|
exports.isAccountInTypes = isAccountInTypes;
|
|
@@ -32,6 +32,9 @@ const isAccountLedgerPolkadotGeneric = account => {
|
|
|
32
32
|
const isAccountLedgerPolkadotLegacy = account => {
|
|
33
33
|
return isAccountOfType(account, "ledger-polkadot") && !!account.genesisHash;
|
|
34
34
|
};
|
|
35
|
+
const isAccountBitcoin = account => {
|
|
36
|
+
return !!account && crypto$1.isBitcoinAddress(account.address);
|
|
37
|
+
};
|
|
35
38
|
const getAccountGenesisHash = account => {
|
|
36
39
|
if (!account) return undefined;
|
|
37
40
|
return "genesisHash" in account ? account.genesisHash || undefined : undefined;
|
|
@@ -411,6 +414,7 @@ exports.Keyring = Keyring;
|
|
|
411
414
|
exports.getAccountGenesisHash = getAccountGenesisHash;
|
|
412
415
|
exports.getAccountPlatform = getAccountPlatform;
|
|
413
416
|
exports.getAccountSignetUrl = getAccountSignetUrl;
|
|
417
|
+
exports.isAccountBitcoin = isAccountBitcoin;
|
|
414
418
|
exports.isAccountEthereum = isAccountEthereum;
|
|
415
419
|
exports.isAccountExternal = isAccountExternal;
|
|
416
420
|
exports.isAccountInTypes = isAccountInTypes;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isEthereumAddress, detectAddressEncoding, platformFromCurve, platformFromAddress, pbkdf2, stringToBytes, bytesToString, isValidMnemonic, mnemonicToEntropy, entropyToMnemonic, isAddressEqual, normalizeAddress, entropyToSeed, deriveKeypair, getPublicKeyFromSecret, addressEncodingFromCurve, addressFromPublicKey, blake3 } from '@talismn/crypto';
|
|
1
|
+
import { isEthereumAddress, detectAddressEncoding, isBitcoinAddress, platformFromCurve, platformFromAddress, pbkdf2, stringToBytes, bytesToString, isValidMnemonic, mnemonicToEntropy, entropyToMnemonic, isAddressEqual, normalizeAddress, entropyToSeed, deriveKeypair, getPublicKeyFromSecret, addressEncodingFromCurve, addressFromPublicKey, blake3 } from '@talismn/crypto';
|
|
2
2
|
|
|
3
3
|
const isAccountOfType = (account, type) => {
|
|
4
4
|
return account?.type === type;
|
|
@@ -30,6 +30,9 @@ const isAccountLedgerPolkadotGeneric = account => {
|
|
|
30
30
|
const isAccountLedgerPolkadotLegacy = account => {
|
|
31
31
|
return isAccountOfType(account, "ledger-polkadot") && !!account.genesisHash;
|
|
32
32
|
};
|
|
33
|
+
const isAccountBitcoin = account => {
|
|
34
|
+
return !!account && isBitcoinAddress(account.address);
|
|
35
|
+
};
|
|
33
36
|
const getAccountGenesisHash = account => {
|
|
34
37
|
if (!account) return undefined;
|
|
35
38
|
return "genesisHash" in account ? account.genesisHash || undefined : undefined;
|
|
@@ -405,4 +408,4 @@ const accountFromStorage = data => {
|
|
|
405
408
|
return Object.freeze(copy);
|
|
406
409
|
};
|
|
407
410
|
|
|
408
|
-
export { Keyring, getAccountGenesisHash, getAccountPlatform, getAccountSignetUrl, isAccountEthereum, isAccountExternal, isAccountInTypes, isAccountLedgerPolkadotGeneric, isAccountLedgerPolkadotLegacy, isAccountNotContact, isAccountOfType, isAccountOwned, isAccountPolkadot, isAccountPortfolio };
|
|
411
|
+
export { Keyring, getAccountGenesisHash, getAccountPlatform, getAccountSignetUrl, isAccountBitcoin, isAccountEthereum, isAccountExternal, isAccountInTypes, isAccountLedgerPolkadotGeneric, isAccountLedgerPolkadotLegacy, isAccountNotContact, isAccountOfType, isAccountOwned, isAccountPolkadot, isAccountPortfolio };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@talismn/keyring",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"author": "Talisman",
|
|
5
5
|
"homepage": "https://talisman.xyz",
|
|
6
6
|
"license": "GPL-3.0-or-later",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"node": ">=18"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@talismn/crypto": "0.1.
|
|
25
|
+
"@talismn/crypto": "0.1.3"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/jest": "^29.5.14",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"jest-fixed-jsdom": "^0.0.9",
|
|
32
32
|
"ts-jest": "^29.2.5",
|
|
33
33
|
"typescript": "^5.6.3",
|
|
34
|
-
"@talismn/
|
|
35
|
-
"@talismn/
|
|
34
|
+
"@talismn/tsconfig": "0.0.2",
|
|
35
|
+
"@talismn/eslint-config": "0.0.3"
|
|
36
36
|
},
|
|
37
37
|
"preconstruct": {
|
|
38
38
|
"entrypoints": [
|