import { ed25519 } from "@noble/curves/ed25519.js"; import { base58, base64, base64urlnopad, hex, utf8 } from "@scure/base"; //#region src/types/index.d.ts export type KeypairCurve = "ecdsa" | "ed25519" | "sr25519" | "ethereum" | "bitcoin-ed25519" | "bitcoin-ecdsa" | "solana"; export type AddressEncoding = "ss58" | "ethereum" | "bech32m" | "bech32" | "base58check" | "base58solana"; export type Keypair = { type: KeypairCurve; secretKey: Uint8Array; publicKey: Uint8Array; address: string; }; export type AccountPlatform = "ethereum" | "polkadot" | "bitcoin" | "solana"; //#endregion //#region src/address/addressFromPublicKey.d.ts export type EncodeAddressOptions = { ss58Prefix?: number; }; export declare const addressFromPublicKey: (publicKey: Uint8Array, encoding: AddressEncoding, options?: EncodeAddressOptions) => string; //#endregion //#region src/address/encodeAnyAddress.d.ts type EncodeAddressOptions$1 = { ss58Format?: number | undefined; }; export declare const encodeAnyAddress: (address: string, options?: EncodeAddressOptions$1) => string; //#endregion //#region src/address/encoding/addressEncodingFromCurve.d.ts /** NOTE: Try not to use this too much, it will need to change */ export declare const addressEncodingFromCurve: (curve: KeypairCurve) => AddressEncoding; //#endregion //#region src/address/encoding/bitcoin.d.ts export declare const isBitcoinAddress: (address: string) => boolean; export declare function isBech32mAddress(address: string): boolean; export declare function isBech32Address(address: string): boolean; export declare function isBase58CheckAddress(address: string): boolean; /** * Converts a Bech32m encoded address to its corresponding data representation. * @param address - The Bech32m encoded address. * @returns An object containing the version, prefix, and data of the address. * @throws {TypeError} If the address uses the wrong encoding. */ export declare function fromBech32m(address: string): { version: number; prefix: string; data: Uint8Array; }; /** * Converts a Bech32 encoded address to its corresponding data representation. * @param address - The Bech32 encoded address. * @returns An object containing the version, prefix, and data of the address. * @throws {TypeError} If the address uses the wrong encoding. */ export declare function fromBech32(address: string): { version: number; prefix: string; data: Uint8Array; }; /** * Decodes a base58check encoded Bitcoin address and returns the version and hash. * * @param address - The base58check encoded Bitcoin address to decode. * @returns An object containing the version and hash of the decoded address. * @throws {TypeError} If the address is too short or too long. */ export declare function fromBase58Check(address: string): { version: number; hash: Uint8Array; }; //#endregion //#region src/address/encoding/detectAddressEncoding.d.ts export declare const detectAddressEncoding: (address: string) => AddressEncoding; //#endregion //#region src/address/encoding/ethereum.d.ts /** * Encodes a public key using H160 encoding with Ethereum checksum. * Accepts both uncompressed (65 bytes) and compressed (33 bytes) public keys - * polkadot-js keystores store the compressed form as the account address. */ export declare const encodeAddressEthereum: (publicKey: Uint8Array) => `0x${string}`; export declare const checksumEthereumAddress: (address: string) => `0x${string}`; export declare function isEthereumAddress(address: string): address is `0x${string}`; //#endregion //#region src/address/encoding/solana.d.ts export declare const encodeAddressSolana: (publicKey: Uint8Array) => string; export declare function isSolanaAddress(address: string): boolean; /** * Whether the address is a valid ed25519 public key (on-curve). * * Program-derived addresses (PDAs) are off-curve by construction: no private key can exist * for them, so a regular wallet cannot recover tokens sent to an account they own. */ export declare function isOnCurveSolanaAddress(address: string): boolean; //#endregion //#region src/address/encoding/ss58.d.ts export declare const decodeSs58Address: (addressStr: string, ignoreChecksum?: boolean) => [publicKey: Uint8Array, prefix: number]; export declare const encodeAddressSs58: (publicKey: Uint8Array | string, prefix?: number) => string; export declare function isSs58Address(address: string): boolean; //#endregion //#region src/address/frontierEvmMirror.d.ts export declare const frontierH160ToAccountId32: (h160: string) => Uint8Array; export declare const frontierH160ToSs58Mirror: (h160: string, ss58Prefix?: number) => string; export declare const frontierSs58ToPublicKeyHex: (address: string) => `0x${string}`; //#endregion //#region src/address/isAddressEqual.d.ts export declare const isAddressEqual: (address1: string, address2: string) => boolean; //#endregion //#region src/address/isAddressValid.d.ts export declare const isAddressValid: (address: string) => boolean; //#endregion //#region src/address/normalizeAddress.d.ts export declare const normalizeAddress: (address: string) => string; //#endregion //#region src/derivation/deriveSolana.d.ts export declare const getPublicKeySolana: (secretKey: Uint8Array) => Uint8Array & Uint8Array; //#endregion //#region src/derivation/utils.d.ts export declare const deriveKeypair: (seed: Uint8Array, derivationPath: string, curve: KeypairCurve) => Keypair; export declare const getPublicKeyFromSecret: (secretKey: Uint8Array, curve: KeypairCurve) => Uint8Array; export declare const addressFromMnemonic: (mnemonic: string, derivationPath: string, curve: KeypairCurve) => Promise; export declare const removeHexPrefix: (secretKey: string) => string; export declare const parseSecretKey: (secretKey: string, platform: AccountPlatform) => Uint8Array; export declare const isValidDerivationPath: (derivationPath: string, curve: KeypairCurve) => Promise; //#endregion //#region src/encryption/encryptKemAead.d.ts /** * Encrypts plaintext using ML-KEM-768 + XChaCha20-Poly1305 (KEM-AEAD). * * Wire format (subtensor pallet-shield v2): * key_hash (16 bytes) || kem_len (2 bytes LE) || kem_ct (variable) || nonce (24 bytes) || aead_ct (variable) * * @param keyHash 16-byte xxhash128 of the public key (caller must compute, e.g. via Twox128) * @param publicKey ML-KEM-768 encapsulation key bytes * @param plaintext Data to encrypt (typically a signed extrinsic) */ export declare const encryptKemAead: (keyHash: Uint8Array, publicKey: Uint8Array, plaintext: Uint8Array) => Promise & Uint8Array>; //#endregion //#region src/hashing/index.d.ts export declare const blake3: { outputLen: number; blockLen: number; canXOF: boolean; } & import("@noble/hashes/utils.js").HashInfo & { (msg: import("@noble/hashes/utils.js").TArg, opts?: import("@noble/hashes/utils.js").TArg | undefined): import("@noble/hashes/utils.js").TRet; create(opts?: import("@noble/hashes/blake3.js").Blake3Opts | undefined): import("@noble/hashes/blake3.js")._BLAKE3; } & ((msg: import("@noble/hashes/utils.js").TArg>>, opts?: import("@noble/hashes/utils.js").TArg | undefined>) => Uint8Array & Uint8Array) & { oid?: import("@noble/hashes/utils.js").TRet; outputLen: number; blockLen: number; canXOF: boolean; create: (opts?: import("@noble/hashes/blake3.js").Blake3Opts | undefined) => import("@noble/hashes/blake3.js")._BLAKE3; }; export declare const blake2b256: (msg: Uint8Array) => Uint8Array & Uint8Array; export declare const blake2b512: (msg: Uint8Array) => Uint8Array & Uint8Array; export declare const getSafeHash: (bytes: Uint8Array) => string; //#endregion //#region src/keystore/index.d.ts export type PjsKeystoreEncoding = { content: string[]; type: string[]; version: string; }; export type PjsKeystore = { encoded: string; encoding: PjsKeystoreEncoding; }; /** Decrypts a polkadot-js encrypted keystore (`jsonDecrypt` equivalent) */ export declare const decryptPjsKeystore: ({ encoded, encoding }: PjsKeystore, password: string) => Uint8Array; /** Encrypts data as a polkadot-js keystore (`jsonEncrypt` equivalent, always scrypt + v3) */ export declare const encryptPjsKeystore: (data: Uint8Array, contentType: string[], password: string) => PjsKeystore; //#endregion //#region src/mnemonic/index.d.ts export declare const mnemonicToEntropy: (mnemonic: string) => Uint8Array & Uint8Array; export declare const entropyToMnemonic: (entropy: Uint8Array) => string; export declare const entropyToSeed: (entropy: Uint8Array, curve: KeypairCurve, password?: string) => Promise>; export declare const isValidMnemonic: (mnemonic: string) => boolean; export declare const generateMnemonic: (words: 12 | 24) => string; export declare const DEV_MNEMONIC_POLKADOT = "bottom drive obey lake curtain smoke basket hold race lonely fit walk"; export declare const DEV_MNEMONIC_ETHEREUM = "test test test test test test test test test test test junk"; export declare const getDevSeed: (curve: KeypairCurve) => Promise>; //#endregion //#region src/platform/index.d.ts export declare const getAccountPlatformFromCurve: (curve: KeypairCurve) => AccountPlatform; export declare const getAccountPlatformFromEncoding: (encoding: AddressEncoding) => AccountPlatform; export declare const getAccountPlatformFromAddress: (address: string) => AccountPlatform; //#endregion //#region src/signing/index.d.ts /** * Signs a substrate payload with the given curve. * * Output is byte-compatible with polkadot-js `KeyringPair.sign` (without type prefix): * - sr25519/ed25519: 64-byte signature over the raw message * - ecdsa: 65-byte recoverable signature (r||s||v) over blake2b-256(message) * - ethereum: 65-byte recoverable signature (r||s||v) over keccak-256(message) * * Note: callers are responsible for the substrate >256-byte rule (hash the payload * with blake2b-256 before signing) — this matches where polkadot-js applies it. */ export declare const signSubstrate: (curve: KeypairCurve, secretKey: Uint8Array, message: Uint8Array) => Uint8Array; /** MultiSignature enum variant index per signature scheme, used to type-prefix signatures */ export declare const SIGNATURE_TYPE_PREFIX: Partial>; //#endregion //#region src/utils/pbkdf2.d.ts export declare const pbkdf2: (hash: "SHA-256" | "SHA-512", entropy: Uint8Array, salt: Uint8Array, iterations: number, outputLenBytes: number) => Promise>; //#endregion export { base58, base64, base64urlnopad, ed25519, hex, utf8 }; //# sourceMappingURL=index.d.ts.map