pharos-agent-kit
Version:
Connect AI Agents to Pharos protocols
111 lines • 4 kB
TypeScript
import { WalletClient as ViemWalletClient, TransactionRequest, ReadContractParameters, ReadContractReturnType, Abi, ContractFunctionName, ContractFunctionArgs, Address, WriteContractParameters, Account, Chain } from "viem";
import { PharosWalletProvider } from "./pharosWalletProvider";
import { Network } from "../network";
/**
* Configuration for gas multipliers.
*/
export interface ViemWalletProviderGasConfig {
/**
* An internal multiplier on gas limit estimation.
*/
gasLimitMultiplier?: number;
/**
* An internal multiplier on fee per gas estimation.
*/
feePerGasMultiplier?: number;
}
/**
* A wallet provider that uses the Viem library.
*/
export declare class ViemWalletProvider extends PharosWalletProvider {
#private;
/**
* Constructs a new ViemWalletProvider.
*
* @param walletClient - The wallet client.
* @param gasConfig - Configuration for gas multipliers.
*/
constructor(walletClient: ViemWalletClient, gasConfig?: ViemWalletProviderGasConfig);
/**
* Signs a message.
*
* @param message - The message to sign.
* @returns The signed message.
*/
signMessage(message: string): Promise<`0x${string}`>;
/**
* Signs a typed data object.
*
* @param typedData - The typed data object to sign.
* @returns The signed typed data object.
*/
signTypedData(typedData: any): Promise<`0x${string}`>;
/**
* Signs a transaction.
*
* @param transaction - The transaction to sign.
* @returns The signed transaction.
*/
signTransaction(transaction: TransactionRequest): Promise<`0x${string}`>;
/**
* Sends a transaction.
*
* @param transaction - The transaction to send.
* @returns The hash of the transaction.
*/
sendTransaction(transaction: TransactionRequest): Promise<`0x${string}`>;
/**
* Gets the address of the wallet.
*
* @returns The address of the wallet.
*/
getAddress(): string;
/**
* Gets the network of the wallet.
*
* @returns The network of the wallet.
*/
getNetwork(): Network;
/**
* Gets the name of the wallet provider.
*
* @returns The name of the wallet provider.
*/
getName(): string;
/**
* Gets the balance of the wallet.
*
* @returns The balance of the wallet.
*/
getBalance(): Promise<bigint>;
/**
* Waits for a transaction receipt.
*
* @param txHash - The hash of the transaction to wait for.
* @returns The transaction receipt.
*/
waitForTransactionReceipt(txHash: `0x${string}`): Promise<any>;
/**
* Reads a contract.
*
* @param params - The parameters to read the contract.
* @returns The response from the contract.
*/
readContract<const abi extends Abi | readonly unknown[], functionName extends ContractFunctionName<abi, "pure" | "view">, const args extends ContractFunctionArgs<abi, "pure" | "view", functionName>>(params: ReadContractParameters<abi, functionName, args>): Promise<ReadContractReturnType<abi, functionName, args>>;
/**
* Writes to a contract.
*
* @param params - The parameters to write to the contract.
* @returns The transaction hash.
*/
writeContract<const abi extends Abi | readonly unknown[], functionName extends ContractFunctionName<abi, "nonpayable" | "payable">, const args extends ContractFunctionArgs<abi, "nonpayable" | "payable", functionName>>(params: WriteContractParameters<abi, functionName, args, Chain | undefined, Account | undefined, undefined>): Promise<`0x${string}`>;
/**
* Transfer the native asset of the network.
*
* @param to - The destination address.
* @param value - The amount to transfer in whole units (e.g. ETH)
* @returns The transaction hash.
*/
nativeTransfer(to: Address, value: string): Promise<`0x${string}`>;
}
//# sourceMappingURL=viemWalletProvider.d.ts.map