Deploy your first AI agent with autonomous onchain banking capabilities in 10 minutes. This guide walks through creating a Solana PDA account, configuring token delegations, and executing your first onchain transaction.
import { MoltFi } from '@moltfi/sdk';
import { Connection, Keypair, PublicKey, clusterApiUrl } from '@solana/web3.js';
const moltfi = new MoltFi({
apiKey: process.env.MOLTFI_API_KEY,
network: 'mainnet-beta', // or 'devnet' for testing
rpcUrl: process.env.SOLANA_RPC_URL || clusterApiUrl('mainnet-beta')
});
// Connect to Solana
const connection = new Connection(
process.env.SOLANA_RPC_URL || clusterApiUrl('mainnet-beta'),
'confirmed'
);
import moltfi
import os
from solana.rpc.api import Client
from solders.keypair import Keypair
client = moltfi.Client(
api_key=os.environ.get('MOLTFI_API_KEY'),
network='mainnet-beta',
rpc_url=os.environ.get('SOLANA_RPC_URL')
)
# Connect to Solana
solana_client = Client(os.environ.get('SOLANA_RPC_URL'))
use moltfi::MoltFi;
use solana_client::rpc_client::RpcClient;
use solana_sdk::commitment_config::CommitmentConfig;
fn main() {
let moltfi = MoltFi::new(
std::env::var("MOLTFI_API_KEY").unwrap(),
"mainnet-beta",
None,
);
let rpc_client = RpcClient::new_with_commitment(
std::env::var("SOLANA_RPC_URL").unwrap(),
CommitmentConfig::confirmed(),
);
}
const moltfi = new MoltFi({
apiKey: process.env.MOLTFI_SANDBOX_KEY,
network: 'devnet',
rpcUrl: clusterApiUrl('devnet')
});
// Everything works identically
// Use devnet USDC and SOL from faucets