@talismn/crypto 0.0.0-pr1827-20250314021218 → 0.1.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.
@@ -1,2 +1,3 @@
1
1
  export declare const encodeAddressBase58: (publicKey: Uint8Array) => string;
2
+ /** Detect if address is base58 encoded (NOTE: also returns true for ss58 addresses) */
2
3
  export declare function isBase58Address(address: string): boolean;
@@ -2,6 +2,10 @@ import { KeypairCurve } from "../types";
2
2
  export declare const deriveKeypair: (seed: Uint8Array, derivationPath: string, curve: KeypairCurve) => import("../types").Keypair;
3
3
  export declare const getPublicKeyFromSecret: (secretKey: Uint8Array, curve: KeypairCurve) => Uint8Array;
4
4
  export declare const addressFromSuri: (suri: string, type: KeypairCurve) => string;
5
+ /**
6
+ * @dev we only expect suri to contain a mnemonic and derivation path.
7
+ * for other cases see https://polkadot.js.org/docs/keyring/start/suri/
8
+ */
5
9
  export declare const parseSuri: (suri: string) => {
6
10
  mnemonic: string;
7
11
  derivationPath: string;
@@ -109,10 +109,11 @@ const getDevSeed = curve => {
109
109
  const encodeAddressBase58 = publicKey => {
110
110
  return base.base58.encode(publicKey);
111
111
  };
112
+ /** Detect if address is base58 encoded (NOTE: also returns true for ss58 addresses) */
112
113
  function isBase58Address(address) {
113
114
  try {
114
115
  base.base58.decode(address);
115
- return true; // note that it will return true for a ss58 address too
116
+ return true;
116
117
  } catch (error) {
117
118
  return false;
118
119
  }
@@ -445,8 +446,10 @@ const addressFromSuri = (suri, type) => {
445
446
  return addressFromPublicKey(publicKey, encoding);
446
447
  };
447
448
 
448
- // @dev: we only expect suri to contain a mnemonic and derivation path
449
- // for other cases see https://polkadot.js.org/docs/keyring/start/suri/
449
+ /**
450
+ * @dev we only expect suri to contain a mnemonic and derivation path.
451
+ * for other cases see https://polkadot.js.org/docs/keyring/start/suri/
452
+ */
450
453
  const parseSuri = suri => {
451
454
  // extract password if any
452
455
  const indexOfPassword = suri.indexOf("///");
@@ -109,10 +109,11 @@ const getDevSeed = curve => {
109
109
  const encodeAddressBase58 = publicKey => {
110
110
  return base.base58.encode(publicKey);
111
111
  };
112
+ /** Detect if address is base58 encoded (NOTE: also returns true for ss58 addresses) */
112
113
  function isBase58Address(address) {
113
114
  try {
114
115
  base.base58.decode(address);
115
- return true; // note that it will return true for a ss58 address too
116
+ return true;
116
117
  } catch (error) {
117
118
  return false;
118
119
  }
@@ -445,8 +446,10 @@ const addressFromSuri = (suri, type) => {
445
446
  return addressFromPublicKey(publicKey, encoding);
446
447
  };
447
448
 
448
- // @dev: we only expect suri to contain a mnemonic and derivation path
449
- // for other cases see https://polkadot.js.org/docs/keyring/start/suri/
449
+ /**
450
+ * @dev we only expect suri to contain a mnemonic and derivation path.
451
+ * for other cases see https://polkadot.js.org/docs/keyring/start/suri/
452
+ */
450
453
  const parseSuri = suri => {
451
454
  // extract password if any
452
455
  const indexOfPassword = suri.indexOf("///");
@@ -108,10 +108,11 @@ const getDevSeed = curve => {
108
108
  const encodeAddressBase58 = publicKey => {
109
109
  return base58.encode(publicKey);
110
110
  };
111
+ /** Detect if address is base58 encoded (NOTE: also returns true for ss58 addresses) */
111
112
  function isBase58Address(address) {
112
113
  try {
113
114
  base58.decode(address);
114
- return true; // note that it will return true for a ss58 address too
115
+ return true;
115
116
  } catch (error) {
116
117
  return false;
117
118
  }
@@ -444,8 +445,10 @@ const addressFromSuri = (suri, type) => {
444
445
  return addressFromPublicKey(publicKey, encoding);
445
446
  };
446
447
 
447
- // @dev: we only expect suri to contain a mnemonic and derivation path
448
- // for other cases see https://polkadot.js.org/docs/keyring/start/suri/
448
+ /**
449
+ * @dev we only expect suri to contain a mnemonic and derivation path.
450
+ * for other cases see https://polkadot.js.org/docs/keyring/start/suri/
451
+ */
449
452
  const parseSuri = suri => {
450
453
  // extract password if any
451
454
  const indexOfPassword = suri.indexOf("///");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@talismn/crypto",
3
- "version": "0.0.0-pr1827-20250314021218",
3
+ "version": "0.1.0",
4
4
  "author": "Talisman",
5
5
  "homepage": "https://talisman.xyz",
6
6
  "license": "GPL-3.0-or-later",
@@ -36,7 +36,7 @@
36
36
  "jest": "^29.7.0",
37
37
  "ts-jest": "^29.2.5",
38
38
  "typescript": "^5.6.3",
39
- "@talismn/eslint-config": "0.0.0-pr1827-20250314021218",
39
+ "@talismn/eslint-config": "0.0.3",
40
40
  "@talismn/tsconfig": "0.0.2"
41
41
  },
42
42
  "preconstruct": {