@flaunch/sdk
Version:
Flaunch SDK to easily interact with the Flaunch protocol
66 lines • 2.73 kB
TypeScript
import { type PublicClient, type WalletClient, type Address, type Hex } from "viem";
import { ReadFlaunchSDK, ReadWriteFlaunchSDK } from "./FlaunchSDK";
export declare const encodedCallAbi: readonly [{
readonly name: "call";
readonly type: "function";
readonly stateMutability: "nonpayable";
readonly inputs: readonly [{
readonly type: "address";
readonly name: "to";
}, {
readonly type: "uint256";
readonly name: "value";
}, {
readonly type: "bytes";
readonly name: "data";
}];
readonly outputs: readonly [];
}];
export interface CallData {
to: Address;
value: bigint;
data: Hex;
}
export type CreateFlaunchCalldataParams = {
publicClient: PublicClient;
walletAddress?: Address;
};
/**
* Creates a custom wallet client that returns encoded calldata instead of broadcasting transactions
*/
export declare function createCallDataWalletClient(publicClient: PublicClient, walletAddress: Address): WalletClient;
/**
* Creates a read-only Flaunch SDK instance with only public client
* @param params - Parameters with only publicClient
* @returns ReadFlaunchSDK for read-only operations
* @throws Error if publicClient.chain is not configured
*/
export declare function createFlaunchCalldata(params: Omit<CreateFlaunchCalldataParams, "walletAddress">): ReadFlaunchSDK;
/**
* Creates a read-write Flaunch SDK instance that returns encoded calldata instead of broadcasting transactions
* @param params - Parameters containing publicClient and walletAddress
* @returns ReadWriteFlaunchSDK instance configured for calldata generation
* @throws Error if publicClient.chain is not configured
*/
export declare function createFlaunchCalldata(params: Required<CreateFlaunchCalldataParams>): ReadWriteFlaunchSDK;
/**
* Decodes the result from SDK methods into transaction object
* @param encodedCall - The result returned by SDK methods
* @returns Call data containing to, value, and data
*/
export declare function decodeCallData(encodedCall: Hex): CallData;
/**
* Convenience function to call an SDK method and automatically parse the result as transaction object
* @param sdkMethod - A function that returns a Promise<Hex> (encoded calldata)
* @returns Promise<CallData> with decoded transaction parameters
*/
export declare function parseCall<T extends (...args: any[]) => Promise<Hex>>(sdkMethod: T): Promise<CallData>;
/**
* Type helper for SDK methods that return encoded calldata
*/
export type CallDataMethod<T extends any[] = any[]> = (...args: T) => Promise<Hex>;
/**
* Type helper for the result of a calldata operation
*/
export type CallDataResult = Promise<CallData>;
//# sourceMappingURL=calldata.d.ts.map