import type { SerializedAuthorization, SignedSponsoredTransaction, SponsoredTransactionStatusResult } from '@dynamic-labs/ethereum-gasless-core'; import { BaseWallet } from '@dynamic-labs/types'; /** * Local alias for `viem`'s `Hex` type. `@dynamic-labs/webview-messages` is a * chain-agnostic package and ESLint forbids it from depending on viem, so we * mirror the `Hex` shape inline instead of importing it. */ type Hex = `0x${string}`; /** * Wire-only projection of `SponsoredTransactionCall`. `bigint` does not survive * `postMessage`, so the host serializes `value: bigint` to a string before the * request crosses `messageTransport` and the controller deserializes it. */ export type SponsoredTransactionCallWire = { data: Hex; target: Hex; value: string; }; /** * Wire-only base shape for the send / relay / sign messages. Mirrors the * unsigned-calls variant of the underlying SDK functions, with `bigint` values * serialized to strings for transport. */ export type EthereumGaslessUnsignedCallsArgs = { wallet: BaseWallet; calls: SponsoredTransactionCallWire[]; authorization?: SerializedAuthorization; autoDelegate?: boolean; /** * Optional bitmap nonce, serialized to a string for transport. `bigint` does * not survive `postMessage`, so the host stringifies the supplied nonce and * the controller deserializes it back to `bigint`. */ nonce?: string; validForSeconds?: number; }; export type EthereumGaslessMessages = { ethereumGasless_send: (params: EthereumGaslessUnsignedCallsArgs) => Promise<{ transactionHash: Hex; }>; ethereumGasless_relay: (params: EthereumGaslessUnsignedCallsArgs) => Promise<{ requestId: string; }>; ethereumGasless_sign: (params: EthereumGaslessUnsignedCallsArgs) => Promise; ethereumGasless_waitFor: (params: { requestId: string; }) => Promise<{ transactionHash: Hex; }>; ethereumGasless_getStatus: (params: { requestId: string; }) => Promise; ethereumGasless_sign7702Authorization: (params: { wallet: BaseWallet; chainId?: number; }) => Promise; ethereumGasless_activate7702Delegation: (params: { wallet: BaseWallet; authorization?: SerializedAuthorization; }) => Promise<{ transactionHash: Hex; }>; ethereumGasless_is7702DelegationActive: (params: { wallet: BaseWallet; }) => Promise; ethereumGasless_isEnabled: () => Promise; }; export {};