import { KeypairCurve } from "@talismn/crypto"; //#region src/types/account.d.ts export type LedgerPolkadotCurve = "ed25519" | "ethereum"; export type AccountBase = { address: string; name: string; createdAt: number; }; export type AccountKeypair = AccountBase & { type: "keypair"; curve: KeypairCurve; mnemonicId?: string; derivationPath?: string; }; export type AccountContact = AccountBase & { type: "contact"; genesisHash?: `0x${string}`; }; export type AccountWatchOnly = AccountBase & { type: "watch-only"; isPortfolio: boolean; }; export type AccountLedgerPolkadot = AccountBase & { type: "ledger-polkadot"; curve: LedgerPolkadotCurve; app: string; accountIndex: number; addressOffset: number; genesisHash?: `0x${string}`; }; export type AccountLedgerEthereum = AccountBase & { type: "ledger-ethereum"; derivationPath: string; }; export type AccountLedgerSolana = AccountBase & { type: "ledger-solana"; derivationPath: string; }; export type AccountPolkadotVault = AccountBase & { type: "polkadot-vault"; genesisHash: `0x${string}` | null; }; export type AccountSignet = AccountBase & { type: "signet"; genesisHash: `0x${string}`; url: string; }; export type Account = AccountKeypair | AccountContact | AccountWatchOnly | AccountLedgerEthereum | AccountLedgerPolkadot | AccountLedgerSolana | AccountPolkadotVault | AccountSignet; export type AccountType = Account["type"]; //#endregion //#region src/types/keyring.d.ts export type AddMnemonicOptions = { mnemonic: string; name: string; confirmed: boolean; }; export type UpdateMnemonicOptions = { name?: string; confirmed?: boolean; }; type DeriveFromNewMnemonic = { type: "new-mnemonic"; mnemonic: string; mnemonicName: string; confirmed: boolean; curve: KeypairCurve; derivationPath: string; }; type DeriveFromExistingMnemonic = { type: "existing-mnemonic"; mnemonicId: string; curve: KeypairCurve; derivationPath: string; }; type DeriveFromMnemonicOptions = DeriveFromNewMnemonic | DeriveFromExistingMnemonic; export type AddAccountDeriveOptions = Omit & DeriveFromMnemonicOptions; export type AddAccountKeypairOptions = Omit & { curve: KeypairCurve; secretKey: Uint8Array; }; export type AddAccountExternalOptions = Omit | Omit | Omit | Omit | Omit | Omit | Omit; export type UpdateAccountOptions = { name?: string; isPortfolio?: boolean; genesisHash?: `0x${string}`; }; //#endregion //#region src/types/mnemonic.d.ts export type Mnemonic = { id: string; name: string; confirmed: boolean; createdAt: number; }; //#endregion //#region src/types/utils.d.ts export type AccountOfType = Extract; export declare const isAccountOfType: (account: Account | null | undefined, type: Type) => account is AccountOfType; export declare const isAccountInTypes: (account: Account | null | undefined, types: Types) => account is AccountOfType; declare const ACCOUNT_TYPES_OWNED: readonly ["keypair", "ledger-ethereum", "ledger-polkadot", "ledger-solana", "polkadot-vault"]; declare const ACCOUNT_TYPES_EXTERNAL: readonly ["contact", "watch-only", "ledger-ethereum", "ledger-polkadot", "ledger-solana", "polkadot-vault", "signet"]; declare const ACCOUNT_TYPES_ADDRESS_ETHEREUM: readonly ["contact", "watch-only", "keypair", "ledger-ethereum", "ledger-polkadot"]; declare const ACCOUNT_TYPES_PLATFORM_ETHEREUM: readonly ["contact", "watch-only", "keypair", "ledger-ethereum"]; declare const ACCOUNT_TYPES_PLATFORM_POLKADOT: readonly ["contact", "watch-only", "keypair", "ledger-polkadot", "polkadot-vault", "signet"]; declare const ACCOUNT_TYPES_ADDRESS_SS58: readonly ["contact", "watch-only", "keypair", "ledger-polkadot", "polkadot-vault", "signet"]; declare const ACCOUNT_TYPES_PLATFORM_SOLANA: readonly ["contact", "watch-only", "keypair", "ledger-solana"]; declare const ACCOUNT_TYPES_BITCOIN: readonly ["contact", "watch-only"]; export declare const isAccountExternal: (account: Account | null | undefined) => account is AccountOfType<(typeof ACCOUNT_TYPES_EXTERNAL)[number]>; export declare const isAccountOwned: (account: Account | null | undefined) => account is AccountOfType<(typeof ACCOUNT_TYPES_OWNED)[number]>; export declare const isAccountPortfolio: (account: Account | null | undefined) => account is Account; export declare const isAccountNotContact: (acc: Account) => acc is AccountKeypair | AccountLedgerEthereum | AccountLedgerPolkadot | AccountLedgerSolana | AccountPolkadotVault | AccountSignet | AccountWatchOnly; type AccountAddressEthereum = Extract & { address: `0x${string}`; }; export declare const isAccountAddressEthereum: (account: Account | null | undefined) => account is AccountAddressEthereum; type AccountPlatformEthereum = Extract & { address: `0x${string}`; }; export declare const isAccountPlatformEthereum: (account: Account | null | undefined) => account is AccountPlatformEthereum; type AccountPlatformSolana = Extract; export declare const isAccountPlatformSolana: (account: Account | null | undefined) => account is AccountPlatformSolana; type AccountPlatformPolkadot = Extract; export declare const isAccountPlatformPolkadot: (account: Account | null | undefined) => account is AccountPlatformPolkadot; type AccountAddressSs58 = Extract & { genesisHash?: `0x${string}`; }; export declare const isAccountAddressSs58: (account: Account | null | undefined) => account is AccountAddressSs58; export declare const isAccountLedgerPolkadot: (account: Account | null | undefined) => account is AccountLedgerPolkadot; export declare const isAccountLedgerPolkadotGeneric: (account: Account | null | undefined) => account is AccountLedgerPolkadot & { genesisHash: undefined; }; export declare const isAccountLedgerPolkadotLegacy: (account: Account | null | undefined) => account is AccountLedgerPolkadot & { genesisHash: `0x${string}`; }; type AccountBitcoin = Extract; export declare const isAccountBitcoin: (account: Account | null | undefined) => account is AccountBitcoin; export declare const getAccountGenesisHash: (account: Account | null | undefined) => `0x${string}` | undefined; export declare const getAccountSignetUrl: (account: Account | null | undefined) => string | undefined; export declare const getAccountPlatform: (account: Account | null | undefined) => import("@talismn/crypto").AccountPlatform | undefined; //#endregion //#region src/keyring/types.d.ts type MnemonicStorage = Mnemonic & { entropy: string; }; type AccountKeypairStorage = AccountKeypair & { secretKey: string; }; type AccountStorage = AccountKeypairStorage | AccountContact | AccountWatchOnly | AccountLedgerEthereum | AccountLedgerPolkadot | AccountLedgerSolana | AccountPolkadotVault | AccountSignet; //#endregion //#region src/keyring/Keyring.d.ts export type KeyringStorage = { passwordCheck: string | null; mnemonics: MnemonicStorage[]; accounts: AccountStorage[]; }; export declare class Keyring { #private; protected constructor(data: KeyringStorage); static create(): Keyring; static load(data: KeyringStorage): Keyring; private checkPassword; /** Returns true if a password has been set on this keyring. */ hasPassword(): boolean; /** * Verify a password against the keyring's passwordCheck blob. * Returns true on success, false on wrong password. * Throws if no password has been set (caller should check hasPassword() first). */ verifyPassword(password: string): Promise; /** * Initialize the password on a fresh keyring that has no password set. * Throws if a password is already set (use changePassword flow instead). */ initializePassword(password: string): Promise; toJson(): KeyringStorage; export(password: string, jsonPassword: string): Promise; getMnemonics(): Mnemonic[]; addMnemonic({ name, mnemonic, confirmed }: AddMnemonicOptions, password: string): Promise; getMnemonic(id: string): Mnemonic | null; updateMnemonic(id: string, { name, confirmed }: UpdateMnemonicOptions): Mnemonic; removeMnemonic(id: string): void; getMnemonicText(id: string, password: string): Promise; getExistingMnemonicId(mnemonic: string): string | null; getAccounts(): Account[]; getAccount(address: string): Account | null; updateAccount(address: string, { name, isPortfolio, genesisHash }: UpdateAccountOptions): Account; removeAccount(address: string): void; addAccountExternal(options: AddAccountExternalOptions): Account; /** * Needs to be called before deriving an account from a mnemonic. * * This will ensure that it is present (or add it if possible) in the keyring before actually creating the account. * * @param options * @param password * @returns the id of the mnemonic */ private ensureMnemonic; addAccountDerive(options: AddAccountDeriveOptions, password: string): Promise; addAccountKeypair({ curve, name, secretKey }: AddAccountKeypairOptions, password: string): Promise; getAccountSecretKey(address: string, password: string): Promise; getDerivedAddress(mnemonicId: string, derivationPath: string, curve: KeypairCurve, password: string): Promise; } //#endregion //# sourceMappingURL=index.d.ts.map