UNPKG

@coinmeca/wallet-sdk

Version:
269 lines 6.57 kB
import { AccessListEIP2930Transaction, AccessListEIP2930TxData, BlobEIP4844Transaction, BlobEIP4844TxData, EOACodeEIP7702Transaction, EOACodeEIP7702TxData, FeeMarketEIP1559Transaction, FeeMarketEIP1559TxData, LegacyTransaction, LegacyTxData } from "@ethereumjs/tx"; export { Address } from "@ethereumjs/util"; export type ChainBase = "evm" | "svm"; export type ChainType = "mainnet" | "mainnet-beta" | "testnet" | "devnet"; export interface Chain { base?: ChainBase; type?: ChainType; logo?: string; chainId: number | string; chainName?: string; nativeCurrency: NativeCurrency; rpcUrls: string[]; blockExplorerUrls?: string[]; iconUrls?: string[]; } export interface Chains { [key: string]: { mainnet?: Chain; testnet?: { [key: string]: Chain | undefined; }; devnet?: { [key: string]: Chain | undefined; }; }; } export interface RequestParams { method: string; params?: any[]; } export type Transaction = LegacyTransaction | AccessListEIP2930Transaction | FeeMarketEIP1559Transaction | BlobEIP4844Transaction | EOACodeEIP7702Transaction; export type TxData = LegacyTxData | AccessListEIP2930TxData | FeeMarketEIP1559TxData | BlobEIP4844TxData | EOACodeEIP7702TxData; export interface TransactionParams { from: string; to: string; value: string; gas?: string; gasPrice?: string; data?: string; nonce?: string; chainId?: number; maxFeePerGas?: string; maxPriorityFeePerGas?: string; type?: string; accessList?: Array<{ address: string; storageKeys: string[]; }>; tokenAddress?: string; tokenAmount?: string; tokenData?: string; validUntil?: string; replayProtection?: boolean; chainReference?: string; signature?: string; } export interface EIP712Domain { name?: string; version?: string; chainId?: number; verifyingContract?: string; salt?: string; } export interface EIP712Property { name: string; type: string; } export interface EIP712Types { EIP712Domain: EIP712Property[]; [key: string]: EIP712Property[]; } export type MessageTypes = { EIP712Domain: EIP712Property[]; [additionalProperties: string]: EIP712Property[]; }; export interface EIP712Message<T = any> { types: EIP712Types; domain: EIP712Domain; primaryType: string; message: T; } export interface NativeCurrency { name: string; symbol: string; decimals: number; } export type ERC20Options = { address: string; symbol?: string; decimals?: number; image?: string; }; export type ERC721Options = { address: string; symbol?: string; image?: string; tokenId?: string; }; export type ERC1155Options = { address: string; symbol?: string; decimals?: number; image?: string; tokenId?: string; }; export interface App { name?: string; url?: string; logo?: string; accounts?: string[]; } export type AssetOptions<Name> = Name extends "ERC20" ? ERC20Options : Name extends "ERC721" ? ERC721Options : Name extends "ERC1155" ? ERC1155Options : never; export interface Asset<Name extends "ERC20" | "ERC721" | "ERC1155"> { type: Name; options: AssetOptions<Name>; } export interface Tokens { fungibles?: { [chainId: number | string]: string[] | undefined; }; nonFungibles?: { [chainId: number | string]: { [address: string]: string[]; }[] | undefined; }; multiTokens?: { [chainId: number | string]: string[] | undefined; }; } export interface TransactionReceipt { hash: string; status: "pending" | "success" | "failure"; chainId?: string | number; time?: number | string; to?: string; from?: string; category?: string; isContract?: boolean; blockNumber?: string | number; gasUsed?: string | number; cumulativeGasUsed?: string | number; effectiveGasPrice?: string | number; contractAddress?: string; no?: number; } export interface Transactions { [chainId: number | string]: TransactionReceipt[] | undefined; } export type AccountKind = "generated" | "imported"; export interface Account { name: string; address: string; index: number; kind?: AccountKind; slot?: number; path?: string; balance?: number; tokens?: Tokens; disable: boolean; tx?: Transactions; } export interface ContactEntry { name?: string; address: string; } export interface Contact { [x: string]: ContactEntry[]; } export interface Kdf { name: "argon2id"; iterations: number; parallelism: number; memorySize: number; hashLength: number; salt: string; } export interface Box { version: 1; binding?: "device" | "platform"; kdf: Kdf; cipher: { name: "AES-GCM"; iv: string; }; data: string; } export interface Ref { kind: AccountKind; slot: number; } export interface Vault { key: string; master: string; generated: number; imported: string[]; accounts: Ref[]; } export interface VaultState extends Vault { schema: 1; } export interface AppsState { schema: 1; apps: App[]; } export interface ChainsState { schema: 1; chains: Chain[]; } export interface ContactState { schema: 1; contact: Contact; } export interface AccountState { schema: 1; account: Account; } export interface BackupAccount { address: string; name?: string; disable?: boolean; kind?: AccountKind; slot?: number; path?: string; tokens?: Tokens; tx?: Transactions; } export interface BackupState { schema: 1; createdAt: number; master: string; generated: number; imported: string[]; accounts: Ref[]; meta: BackupAccount[]; address?: string; chainId?: string | number; chains?: Chain[]; contact?: Contact; } export interface BackupBundleInfo { accounts: number; generated: number; imported: number; } export interface BackupBundleState { schema: 1; kind: "coinmeca.wallet.backup"; createdAt: number; box: Box; info?: BackupBundleInfo; } export interface StorageState { schema: 1; epoch: number; revision: number; data: Record<string, string>; } export interface StorageEnvelopeState { schema: 2; iv: string; data: string; } export interface StorageSnapshotState { schema: 6; epoch: number; revision: number; data: Record<string, string>; } //# sourceMappingURL=types.d.ts.map