@biconomy/abstractjs
Version:
SDK for Biconomy integration with support for account abstraction, smart accounts, ERC-4337.
96 lines • 3.84 kB
TypeScript
import { type Hex, type PublicClient } from "viem";
import { type ChainConfiguration, type NonceInfo } from ".";
import type { Url } from "../clients/createHttpClient";
import type { GetQuotePayload } from "../clients/decorators/mee";
import { type DeployGasTankParams, type GasTankDeployPayload } from "./decorators/deployGasTank";
import { type GetGasTankAddressPayload } from "./decorators/getGasTankAddress";
import { type GetGasTankBalanceParams, type GetGasTankBalancePayload } from "./decorators/getGasTankBalance";
import { type SponsorSupertransactionParams } from "./decorators/sponsorSupertransaction";
import { type WithdrawFromGasTankParams, type WithdrawFromGasTankPayload } from "./decorators/withdrawFromGasTank";
/**
* Parameters required to create a gas tank account
*/
export type GasTankAccountParams = {
/** EOA account privateKey to create nexus instance */
privateKey: Hex;
/** Chain configuration for account */
chainConfiguration: ChainConfiguration;
/** Parameters for mee client */
options?: {
mee: {
/** Mee node url. Default to biconomy network */
url?: Url;
/** Mee API key. */
apiKey?: string;
};
};
};
/**
* Represents a gas tank smart account
*/
export type GasTankAccount = {
/**
* Viem PublicClient for gas tank account
* @returns Promise resolving to the gas tank public client
*/
publicClient: PublicClient;
/**
* Get a gas tank deployment status
* @returns Promise resolving to the gas tank deployment status
*/
isDeployed: () => Promise<boolean>;
/**
* Get a gas tank address
* @returns Promise resolving to the gas tank address
*/
getAddress: () => Promise<GetGasTankAddressPayload>;
/**
* Get a gas tank balance
* @param params - Parameters for retrieving the gas tank balance
* @returns Promise resolving to the gas tank balance
*/
getBalance: (params: Pick<GetGasTankBalanceParams, "tokenAddress">) => Promise<GetGasTankBalancePayload>;
/**
* Get gas tank nonce
* @param params - Parameters for retrieving the gas tank nonce
* @returns Promise resolving to the gas tank nonce
*/
getNonce: () => Promise<NonceInfo>;
/**
* Sign the quote for sponsorship
* @param params - Parameters for retrieving the signedSponsoredQuote
* @returns Promise resolving to the sponsored quote
*/
signSponsorship: (params: Pick<SponsorSupertransactionParams, "quote">) => Promise<GetQuotePayload>;
/**
* Deploy gas tank account
* @param params - Parameters for deploying gas tank
* @returns Promise resolving to the gas tank deployment
*/
deploy: (params: Omit<DeployGasTankParams, "chainId" | "meeClient">) => Promise<GasTankDeployPayload>;
/**
* Withdraw funds from gasTank
* @param params - Parameters to withdraw funds from gas tank
* @returns Promise resolving to the gas tank withdrawal
*/
withdraw: (params: Omit<WithdrawFromGasTankParams, "chainId" | "meeClient">) => Promise<WithdrawFromGasTankPayload>;
};
/**
* Creates a gas tank account for sponsorship
*
* @param parameters - {@link GasTankAccountParams} Configuration for gas tank account
* @param parameters.signer - The signer instance used for account
* @param parameters.chain - chain for the gas tank account
* @param parameters.privateKey - EOA private key for the gas tank account
*
* @returns Promise resolving to {@link GasTankAccount} instance
*
* @example
* const account = await toGasTankAccount({
* privateKey: '0xprivate_key,
* chain: base,
* transport: http()
* });
*/
export declare function toGasTankAccount(params: GasTankAccountParams): Promise<GasTankAccount>;
//# sourceMappingURL=toGasTankAccount.d.ts.map