Skip to main content
Glama
bank-service.ts1.66 kB
import { Coin } from '@allthatjazzleo/proto-signing'; import { BaseService } from './base-service.js'; import { TransactionResponse } from '../types.js'; export interface BankSendParams { recipientAddress: string; coins: Coin[]; memo?: string; } export class BankService extends BaseService { /** * Send tokens to another address */ async sendTokens({ recipientAddress, coins, memo = '' }: BankSendParams): Promise<TransactionResponse> { try { const result = await this.stargateClient.sendTokens( this.address, recipientAddress, coins, 'auto', memo ); return { transactionHash: result.transactionHash, explorerUrl: `${this.network.explorerUrl}/tx/${result.transactionHash}`, success: result.code === 0, gasUsed: result.gasUsed.toString(), gasWanted: result.gasWanted.toString(), }; } catch (error) { throw new Error(`Failed to send tokens: ${error instanceof Error ? error.message : String(error)}`); } } /** * Query account balance */ async getBalance(address?: string) { const targetAddress = address || this.address; if (!targetAddress) { throw new Error('No address provided and no default address set.'); } try { const balances = await this.stargateClient.getAllBalances(targetAddress); return { balances: balances, explorerUrl: `${this.network.explorerUrl}/address/${targetAddress}`, }; } catch (error) { throw new Error(`Failed to query balance: ${error instanceof Error ? error.message : String(error)}`); } } }

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/allthatjazzleo/mantrachain-mcp'

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