Skip to main content

MoxieWalletClient

Description

MoxieWalletClient is a class that provides methods to interact with the Senpi agent's embedded wallet.

You can also access the MoxieWalletClient instance from the state.moxieWalletClient object.

Pre-requisites

To use this class, you need to provide the following environment variables:

PRIVATE_KEY=       # Private key for executing tx with Senpi Agent Lib, simulating agent wallet
RPC_URL= # RPC URL for executing tx with Senpi Agent Lib

Usage

import { MoxieWalletClient } from "@moxie-protocol/moxie-agent-lib";

const moxieWalletClient = new MoxieWalletClient(
address,
state.authorizationHeader
);

Type Signature

class MoxieWalletClient {
constructor(address: string, bearerToken?: string);

async signMessage(
message: string
): Promise<MoxieWalletSignMessageResponseType>;

async signTypedData(
domain: Record<string, any>,
types: Record<string, any>,
message: Record<string, any>,
primaryType: string
): Promise<MoxieWalletSignTypedDataResponseType>;

async sendTransaction(
chainId: string,
transactionDetails: TransactionDetails
): Promise<MoxieWalletSendTransactionResponseType>;
}

Methods

NameTypeDescription
signMessageasync (message: string) => Promise<MoxieWalletSignMessageResponseType>Sign a message with the agent's wallet
signTypedDataasync (domain: Record<string, any>, types: Record<string, any>, message: Record<string, any>, primaryType: string) => Promise<MoxieWalletSignTypedDataResponseType>Sign a typed data with the agent's wallet
sendTransactionasync (chainId: string, transactionDetails: TransactionDetails) => Promise<MoxieWalletSendTransactionResponseType>Send a transaction with the agent's wallet