cardano-agent-kit v1.2.14
Cardano Agent Kit š ļø
A TypeScript SDK for interacting with the Cardano blockchain, include integration with Vercel AI, Langchain, Eliza...
š Features
ā Create & Restore Cardano Wallets
ā Get Wallet Balance (ADA + Native Assets)
ā Send ADA (Lovelace) Transactions
ā Sign & Submit Transactions
ā Stake & Delegate ADA to Stake Pools
ā Mint & Burn Tokens / NFTs
ā Fetch Transaction History
ā AI-powered Blockchain Tools (Vercel AI & Langchain integration)
ā Dynamic Toolset Creation for AI Models
ā Exported Actions (e.g., create wallet, send ADA, burn assets)
ā Support for Blockfrost, Koios, Maestro, and U5C Providers
š¦ Installation
Install via npm:
npm install cardano-agent-kitor via yarn:
yarn add cardano-agent-kitš Usage Example
1ļøā£ Import the SDK
import { CardanoToolKit } from 'cardano-agent-kit';2ļøā£ Initialize Wallet
const API_KEY = 'your_blockfrost_api_key';
const TEST_MNEMONIC = [
'churn',
'analyst',
'debate',
'million',
'tattoo',
'enlist',
'crystal',
'slide',
'gallery',
'airport',
'squeeze',
'live',
'dinosaur',
'rough',
'first',
'south',
'cave',
'clerk',
'divorce',
'attend',
'topic',
'idea',
'finger',
'verify',
];
const toolkit = new CardanoToolKit('blockfrost', API_KEY, 'testnet', TEST_MNEMONIC);3ļøā£ Get Wallet Address
const address = await toolkit.getAddress();
console.log('Wallet Address:', address);4ļøā£ Check Wallet Balance
const balance = await toolkit.getBalance();
console.log('Wallet Balance:', balance);5ļøā£ Send ADA (Lovelace)
const recipient = 'addr_test1qz...';
const txHash = await toolkit.sendLovelace(recipient, '1000000'); // 1 ADA
console.log('ā
Transaction Sent! TX Hash:', txHash);6ļøā£ Delegate to a Stake Pool
const stakePoolId = 'pool1a7h89sr6ymj9g2a9tm6e6dddghl64tp39pj78f6cah5ewgd4px0';
const stakingTxHash = await toolkit.registerAndStakeADA(stakePoolId);
console.log('ā
Staking TX Hash:', stakingTxHash);š§ AI-Powered Dynamic Tools
Cardano Agent Kit supports AI-powered blockchain tools using Vercel AI SDK and Langchain.
ā” Create AI-powered Vercel Tools
import { CardanoToolKit, createVercelCardanoTools } from 'cardano-agent-kit';
const toolkit = new CardanoToolKit('blockfrost', API_KEY, 'testnet', TEST_MNEMONIC);
const aiTools = createVercelCardanoTools(toolkit);š¤ Create AI-powered Langchain Tools
import { CardanoToolKit, createLangchainCardanoTools } from 'cardano-agent-kit';
const toolkit = new CardanoToolKit('blockfrost', API_KEY, 'testnet', TEST_MNEMONIC);
const aiTools = createLangchainCardanoTools(toolkit);š Create Dynamic Toolsets
Cardano Agent Kit allows dynamic creation of AI tools for blockchain interactions.
Create AI-powered tools dynamically for Vercel AI
import { CardanoToolKit, createVercelAITools } from 'cardano-agent-kit';
import { getAddress, sendLovelace, getBalance, createWallet, mintAsset, burnAsset, sendAsset } from 'cardano-agent-kit';
const toolkit = new CardanoToolKit('blockfrost', API_KEY, 'testnet', TEST_MNEMONIC);
const aiTools = createVercelAITools(toolkit, [
sendAsset,
mintAsset,
burnAsset,
getAddress,
sendLovelace,
getBalance,
createWallet,
]);Create AI-powered tools dynamically for Langchain
import { CardanoToolKit, createLangchainTools } from 'cardano-agent-kit';
import { getAddress, sendLovelace, getBalance, createWallet, mintAsset, burnAsset, sendAsset } from 'cardano-agent-kit';
const toolkit = new CardanoToolKit('blockfrost', API_KEY, 'testnet', TEST_MNEMONIC);
const aiTools = createLangchainTools(toolkit, [
sendAsset,
mintAsset,
burnAsset,
getAddress,
sendLovelace,
getBalance,
createWallet,
]);š¬ API Reference
Wallet Functions
| Function | Description |
|---|---|
createWallet() | Creates a new wallet and returns its mnemonic. |
getMnemonic() | Returns the wallet mnemonic (if available). |
getPrivateKey() | Returns the Bech32 private key (if available). |
getAddress() | Fetches the primary wallet address. |
getBalance() | Fetches all assets in the wallet (ADA + tokens). |
sendLovelace(address, amount) | Sends ADA to a recipient. |
signAndSendTx(txHex) | Signs and submits a transaction. |
Staking Functions
| Function | Description |
|---|---|
registerAndStakeADA(poolId) | Registers a stake address and delegates to a stake pool. |
Asset Functions
| Function | Description |
|---|---|
mintAsset(name, quantity, recipient, metadata, label) | Mints a new Cardano token/NFT. |
burnAsset(assetUnit, quantity) | Burns a specific amount of an asset. |
sendAsset(recipient, assetUnit, quantity) | Transfers a Cardano asset (NFT or token). |
Transaction Functions
| Function | Description |
|---|---|
getTransactionHistory() | Retrieves the transaction history with details on senders, recipients, and amounts. |
AI-Powered Tools
| Function | Description |
|---|---|
createVercelCardanoTools(toolkit) | Creates AI-powered Cardano tools using Vercel AI SDK. |
createLangchainCardanoTools(toolkit) | Creates AI-powered Cardano tools using Langchain. |
createVercelAITools(toolkit, toolsList) | Dynamically generates AI-powered blockchain tools for Vercel AI. |
createLangchainTools(toolkit, toolsList) | Dynamically generates AI-powered blockchain tools for Langchain. |
š Development
Run Tests
npm testš License
This project is licensed under the MIT License. See the LICENSE file for details.
š¤ Contributing
š” Contributions are welcome!
- Open an issue
- Submit a pull request
š Support
If you find this project useful, please ā star the repository and share it with the Cardano community!
ā What's New?
1ļøā£ AI-powered Blockchain Interactions (Vercel AI & Langchain tools)
2ļøā£ Dynamic Toolset Creation for AI Models
3ļøā£ Enhanced Transaction History Functionality
4ļøā£ Comprehensive API Documentation & Examples
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
12 months ago
12 months ago