Skip to main content
Glama
payment.ts1.12 kB
import { Agent } from '../../agent'; import { PaymentParams, TransactionResponse } from '../../types'; export async function sendPayment(agent: Agent, params: PaymentParams): Promise<TransactionResponse> { try { const payment: any = { TransactionType: 'Payment', Account: agent.walletAddress, Destination: params.destination, Amount: typeof params.amount === 'string' ? agent.xrpToDrops(params.amount) : params.amount, ...(params.destinationTag && { DestinationTag: params.destinationTag }) }; const prepared = await agent.client.autofill(payment); const signed = agent.wallet.sign(prepared); const result: any = await agent.client.submitAndWait(signed.tx_blob); return { hash: result.result.hash, status: result.result.meta?.TransactionResult || 'unknown', result: result.result }; } catch (error) { return { status: 'error', message: error instanceof Error ? error.message : 'Unknown error occurred' }; } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tamago-labs/xrpl-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server