accounts
Version:
Tempo Accounts SDK
77 lines • 2.89 kB
TypeScript
import { type WebCryptoP256 } from 'ox';
import type { Hex } from 'viem';
import type { Address, JsonRpcAccount } from 'viem/accounts';
import { Account as TempoAccount } from 'viem/tempo';
import type { OneOf } from '../internal/types.js';
import type * as core_Store from './Store.js';
/** Account stored in the provider state. */
export type Store = {
/** Account address. */
address: Address;
/** Display label used during registration (e.g. email). */
label?: string | undefined;
} & OneOf<{} | Pick<TempoAccount.Account, 'keyType' | 'sign'> | {
keyType: 'secp256k1';
privateKey: Hex;
} | {
keyType: 'p256';
privateKey: Hex;
} | {
keyType: 'webAuthn';
credential: {
id: string;
publicKey: Hex;
rpId: string;
};
} | {
keyType: 'webCrypto';
keyPair: Awaited<ReturnType<typeof WebCryptoP256.createKeyPair>>;
} | {
keyType: 'webAuthn_headless';
privateKey: Hex;
rpId: string;
origin: string;
}>;
/** Resolves a viem Account from the store by address (or active account). */
export declare function find(options: find.Options & {
signable: true;
}): TempoAccount.Account;
export declare function find(options: find.Options): TempoAccount.Account | JsonRpcAccount;
export declare namespace find {
type Options = {
/** Whether to prefer an access key for this account. @default true */
accessKey?: boolean | undefined;
/** Address to find. Defaults to the active account. */
address?: Address | undefined;
/** Calls to match against access key scopes. When provided, access keys whose scopes don't cover these calls are skipped. */
calls?: readonly {
to?: Address | undefined;
data?: Hex | undefined;
}[] | undefined;
/** Chain ID the access key must be authorized on. Defaults to the active chain. */
chainId?: number | undefined;
/** Whether to hydrate signing capability. @default false */
signable?: boolean | undefined;
/** Reactive state store. */
store: core_Store.Store;
};
}
/** Overloaded signature for `find` without `store` (pre-bound by the provider). */
export type Find = {
(options: Omit<find.Options, 'store'> & {
signable: true;
}): TempoAccount.Account;
(options?: Omit<find.Options, 'store'>): TempoAccount.Account | JsonRpcAccount;
};
/** Hydrates a store account to a viem Account. */
export declare function hydrate(account: Store, options: {
signable: true;
}): TempoAccount.Account;
export declare function hydrate(account: Store, options?: hydrate.Options): TempoAccount.Account | JsonRpcAccount;
export declare namespace hydrate {
type Options = {
/** Whether to hydrate signing capability. @default false */
signable?: boolean | undefined;
};
}
//# sourceMappingURL=Account.d.ts.map