Page cover image

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.

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:

  1. Your webhook receives a conversation event.

  2. Your custom logic determines that an on-chain action should occur (e.g., rewarding a user for a correct answer).

  3. 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.

Action Name
Description
Triggers & Example Prompt

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

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

Last updated