Skip to content

Wallet concierge

The Wallet Concierge acts as a personal financial assistant within your Agent. It handles the user financial needs without you needing to worry about the logic.

As seen in this tweet

Features

Balance

Simply ask the concierge to check your balance, and it will provide you with the current amount in your wallet. For example, you can say:

Hey, check my balance.

The concierge will respond with your current balance.

// Balance checking implementation
if (skill === "balance") {
  const { balance } = await walletService.checkBalance(sender.address);
  await context.send(`Your agent wallet has a balance of ${balance}`);
}

Funding

You can request to add funds to your wallet. If you try to exceed the maximum limit, the concierge will notify you. For instance, you might say:

Can you add 5 USDC to my wallet?

The concierge will handle the transaction.

// Funding logic
async function fund(context: Context, amount: number) {
  if (Number(balance) === 10) {
    await context.dm("You have maxed out your funds. Max 10 USDC.");
    return false;
  }
 
  let onRampURL = await walletService.onRampURL(
    amount,
    walletData.agent_address,
  );
  await context.framekit.requestPayment(
    walletData.agent_address,
    amount,
    "USDC",
    onRamp ? onRampURL : undefined,
  );
}

Transfers

You can instruct the concierge to transfer funds to another user. If your balance is insufficient, it will inform you. For example, you might say:

Please send 5 USDC to @username.

The concierge will execute the transfer.

// Transfer implementation
if (skill === "transfer") {
  const { balance } = await walletService.checkBalance(sender.address);
  if (balance === 0) {
    await context.reply("You have no funds to transfer.");
    return;
  }
 
  await context.send(
    `Transferring ${amount} USDC to ${recipient?.preferredName}`,
  );
  const tx = await walletService.transfer(
    sender.address,
    recipient?.address as string,
    amount,
  );
}

Swaps

You can instruct the concierge to swap tokens from one type to another. For example, you might say:

Please swap 0.1 ETH to USDC.

The concierge will execute the swap.

// Swap implementation
if (skill === "swap") {
  await walletService.swap(sender.address, fromToken, toToken, amount);
  await context.send("Swap completed");
  return;
}

Notifications

After a transaction, the concierge will notify you with a receipt and update your balance. It will also inform the recipient if they are on XMTP. For example, after sending funds, you will receive a message confirming the transaction and your new balance.

// Smart notifications
await notifyUser(context, sender.address, recipient?.address, tx, amount);

Installation

Concierge is a Skill already included in Message Kit.

import { run, Agent, concierge } from "@xmtp/message-kit";
 
export const agent: Agent = {
  name: "Wallet Agent",
  tag: "@bot",
  description: "A payment agent with that manages wallets for its users",
  skills: [concierge], 
  config: {
    walletService: true,
  },
};
 
run(agent);

Wallet Service

Wallet Service is a plugin that manages the Concierge uses for performing gasless transactions on behalf of the user.

  • Gasless
  • Onramp
  • Offramp
  • Swaps
  • Transfers

Learn more about the Wallet Service.