메인 콘텐츠로 건너뛰기

Documentation Index

Fetch the complete documentation index at: https://docs.magicblock.gg/llms.txt

Use this file to discover all available pages before exploring further.


빠른 접근

Magic Actions Example

GitHub에서 참조 구현 살펴보기

Router 연결 설정

Magic Router를 사용해 트랜잭션을 ER과 베이스 레이어로 라우팅하고 전송합니다.
import { Connection } from "@magicblock-labs/ephemeral-rollups-kit";

// Initialize connection
const connection = await Connection.create(
  "https://devnet-router.magicblock.app",
  "wss://devnet-router.magicblock.app"
);

// ... create transaction

// Send and confirm transaction
const txHash = await connection.sendAndConfirmTransaction(
  transactionMessage,
  [userKeypair],
  { commitment: "confirmed", skipPreflight: true }
);

트랜잭션 흐름

  1. 카운터를 ER에 위임합니다
const delegateTx = await program.methods
  .delegate()
  .accounts({
    payer: anchor.Wallet.local().publicKey,
    pda: pda,
  })
  .transaction();
  1. ER에서 카운터를 실시간으로 증가시킵니다
const incrementTx = await program.methods
  .increment()
  .accounts({
    counter: pda,
  })
  .transaction();
  1. Magic Action과 함께 커밋합니다
const commitTx = await program.methods
  .commitAndUpdateLeaderboard()
  .accounts({ payer: wallet.publicKey /* your accounts */ })
  .transaction();

예시

Quickstart Ephemeral Rollups

ER 사용을 처음부터 끝까지 살펴보는 가이드

Magic Router

Router 개요와 흐름