Client-side guide to building with Magic Actions
import { Connection } from "@solana/web3.js"; import { sendMagicTransaction } from "@magicblock-labs/ephemeral-rollups-sdk"; const routerConnection = new Connection( "https://devnet-router.magicblock.app", { wsEndpoint: "wss://devnet-router.magicblock.app" } );
const delegateTx = await program.methods .delegate() .accounts({ payer: wallet.publicKey, pda: yourAccountPda }) .transaction(); await sendMagicTransaction(routerConnection, delegateTx, [wallet.payer]);
const executeTx = await program.methods .yourEphemeralInstruction() .accounts({ /* your accounts */ }) .transaction(); await sendMagicTransaction(routerConnection, executeTx, [wallet.payer]);
const commitTx = await program.methods .commitWithAction() .accounts({ payer: wallet.publicKey /* your accounts */ }) .transaction(); await sendMagicTransaction(routerConnection, commitTx, [wallet.payer]);
Was this page helpful?