accounts
Version:
Tempo Accounts SDK
59 lines • 2.85 kB
TypeScript
import { Address, Hex } from 'ox';
import type { Client, Transport } from 'viem';
import type { PrepareTransactionRequestReturnType } from 'viem/actions';
import type { Transaction as TempoTransaction } from 'viem/tempo';
import type * as Store from '../Store.js';
import type * as Rpc from '../zod/rpc.js';
type Call = {
to?: Address.Address | undefined;
data?: Hex.Hex | undefined;
};
/** Creates a transaction helper for a matching locally-signable access key. */
export declare function create(options: create.Options): Promise<create.ReturnType>;
export declare namespace create {
/** Options for {@link create}. */
type Options = {
/** Root account address. */
address: Address.Address;
/** Calls to match against access key scopes. */
calls?: readonly Call[] | undefined;
/** Chain ID the access key must be authorized on. */
chainId: number;
/** Client used to prepare, submit, and check access-key transactions. */
client: Client<Transport>;
/** Reactive state store. */
store: Store.Store;
};
/** Parameters accepted when preparing an access-key transaction. */
type PrepareParameters = Omit<TempoTransaction.TransactionRequestTempo, 'account' | 'keyAuthorization' | 'type'>;
/** Prepared transaction request returned by viem. */
type PreparedRequest = PrepareTransactionRequestReturnType;
/** Parameters accepted by `eth_fillTransaction`. */
type FillParameters = Rpc.eth_fillTransaction.Decoded['params'][0];
/** Result returned by `eth_fillTransaction`. */
type FillReturnType = Rpc.eth_fillTransaction.Encoded['returns'];
/** Result returned by `eth_sendTransactionSync`. */
type SendSyncReturnType = Rpc.eth_sendTransactionSync.Encoded['returns'];
/** Prepared access-key transaction with execution methods. */
type Prepared = {
/** Prepared request that will be signed by the selected access key. */
request: PreparedRequest;
/** Signs the prepared transaction. */
sign(): Promise<Hex.Hex>;
/** Signs and submits the transaction asynchronously. */
send(): Promise<Hex.Hex>;
/** Signs, submits, and waits for the transaction to be accepted. */
sendSync(): Promise<SendSyncReturnType>;
};
/** Access-key transaction helper. */
type Transaction = {
/** Fills a transaction through the selected access key account. */
fill(parameters: FillParameters): Promise<FillReturnType>;
/** Prepares a transaction through the selected access key account. */
prepare(parameters: PrepareParameters): Promise<Prepared>;
};
/** Access-key transaction helper, if one is available. */
type ReturnType = Transaction | undefined;
}
export {};
//# sourceMappingURL=AccessKeyTransaction.d.ts.map