
Triggering On-Chain Actions with Swig
This guide explains how to interact with the on-chain capabilities of our pre-built hackathon agents, which come with the Swig Smart Wallet plugin already integrated.
Important: Prerequisites for On-Chain Actions
Before you can trigger any Swig-related actions, there are two key steps you must follow:
1. Authority Assignment
When a user starts chatting, the backend automatically assigns a SWIG token limit authority to their wallet address, only if the user has an active session in their mini-app.
⚠️ Note: If the user is not logged into their mini-app via the registered Webhook URL, the SWIG authority will not be assigned to the agent on their behalf.
2. Agent's SWIG Wallet
To discover an agent's SWIG wallet address, simply start a chat with the agent and ask.
💡 Tip: Try asking your agent directly, for example, "What is your SWIG wallet address?"
❗ Having trouble extracting an agent's SWIG address via chat? If you encounter any issues, feel free to contact the hackathon coordinator directly for assistance.
Our Agents' On-Chain Capabilities
Think of our hackathon agents as more than just chatbots, they are on-chain entities. Each agent comes pre-equipped with its own Swig smart wallet on Solana, empowering it to:
✅ Own and manage assets like SOL and SPL tokens.
✅ Send rewards or payments to users.
✅ Hold on-chain items, such as NFTs that represent memories or achievements.
✅ Have a persistent, on-chain identity and transaction history.
Your mission is to leverage these capabilities to create truly interactive and immersive experiences.
How to Trigger On-Chain Actions
The primary way you will instruct an agent to perform an on-chain action is by using your webhook to transform the agent's responses into natural language prompts.
The flow is simple:
Your webhook receives a conversation event.
Your custom logic determines that an on-chain action should occur (e.g., rewarding a user for a correct answer).
Your server responds to the webhook, transforming the agent's next message to include a prompt that triggers a Swig action.
Available Actions
Trigger actions by using natural language prompts containing these keywords. Note that transfer and authority actions will not work if disabled in the configuration.
CREATE_SWIG
Create a new Swig smart wallet.
Triggers:
create swig
make swig
new swig
setup swig
initialize swig
start swig
build swig
Example: "Can you create a new swig wallet for me?"
GET_SWIG_BALANCE
Check the SOL balance of the Swig wallet.
Triggers:
swig balance
check swig
balance of swig
how much in swig
swig wallet balance
Example: "What's the balance of my swig wallet?"
GET_SWIG_TOKEN_BALANCE
Check the balance of a specific SPL token.
Triggers:
swig token balance
swig spl balance
token balance in swig
spl balance in swig
check swig token balance
get swig token balance
show swig token balance
Example: "Get swig token balance for [mint]"
GET_SWIG_AUTHORITIES
Get all authorities on the Swig wallet.
Triggers:
swig authorities
authorities on swig
swig signers
signers on swig
who can sign
list authorities
show authorities
get authorities
Example: "List swig signers."
ADD_SWIG_AUTHORITY
Add an authority to an existing Swig wallet.
Triggers:
add authority
add signer
grant access
add to swig
Example: "Add authority [address] to my swig wallet."
TRANSFER_TO_SWIG
Transfer SOL from the agent's main wallet to its Swig wallet.
Triggers:
transfer to swig
send to swig
fund swig
deposit to swig
transfer funds to swig
Example: "Fund the swig with 0.1 SOL."
TRANSFER_TOKEN_TO_SWIG
Transfer SPL tokens from the agent's main wallet to its Swig wallet.
Triggers:
transfer token to swig
send token to swig
transfer spl to swig
send spl to swig
fund swig with token
deposit token to swig
Example: "Transfer 100 tokens mint [mint] to swig."
SWIG_TRANSFER_TO_ADDRESS
Transfer SOL from the Swig wallet to any address.
Triggers:
transfer from swig
send from swig
transfer using swig
send using swig
swig transfer to
swig send to
use swig to transfer
use swig to send
Example: "Transfer 1.5 SOL from swig to [address]."
SWIG_TRANSFER_TOKEN_TO_ADDRESS
Transfer SPL tokens from the Swig wallet to any address.
Triggers:
transfer token from swig
send token from swig
transfer spl from swig
send spl from swig
swig transfer token to
swig send token to
use swig to transfer token
use swig to send token
Example: "Send 50 spl tokens [mint] from swig to [address]."
SWIG_TRANSFER_TO_AUTHORITY
Transfer SOL from the Swig wallet to another authority.
Triggers:
transfer from swig to authority
send from swig to authority
transfer to swig authority
send to swig authority
swig transfer to authority
swig send to authority
Example: "Transfer 0.5 SOL from swig to authority [address]."
SWIG_TRANSFER_TOKEN_TO_AUTHORITY
Transfer SPL tokens from the Swig wallet to another authority.
Triggers:
transfer token from swig to authority
send token from swig to authority
transfer spl from swig to authority
send spl from swig to authority
transfer token to swig authority
send token to swig authority
swig transfer token to authority
swig send token to authority
Example: "Transfer 100 tokens [mint] from swig to authority [address]."
Essential Resources
For those who wish to understand the underlying technology, the official Swig documentation is an excellent resource.
See it in Action
GitHub Repo & Example: https://github.com/anagrambuild/swig-elizaos-plugin
Clone the repository and check out the complete, working example in the
examples/eliza
folder to understand the full implementation.
Learn the Concepts
General Swig Docs: https://build.onswig.com/
Use these docs to understand the core concepts of Swig smart wallets, programmable rules, and the overall ecosystem.
Code Efficiently
Typedocs (TypeScript Reference):
For a Supercharged Editor Experience (Recommended):
We highly recommends using this documentation directly within AI-powered editors like Cursor. You can feed the Typedocs URL to the editor for enhanced context and autocompletion.
Alternatively, you can set up a local MCP server to stream the Swig docs directly into your editor. Learn how here:
MCP Documentation: https://mintlify.com/blog/what-is-mcp-and-how-to-get-started
Last updated