본문으로 건너뛰기
Anon Wallet

DApp 통합 안내

Anon Wallet은 window.ethereum에 표준 EIP-1193 제공자를 주입합니다. MetaMask 지원 DApp 대부분은 변경 없이 동작합니다.

감지

window.ethereum에 다음 속성을 설정합니다.

window.ethereum.isAnon    // true
window.ethereum.isMetaMask  // true (for compatibility)

MetaMask 대신 Anon을 특정하려면 isAnon을 확인합니다.

if (window.ethereum?.isAnon) {
  console.log("Anon Wallet detected");
}

계정 요청

const accounts = await window.ethereum.request({
  method: "eth_requestAccounts",
});
// accounts[0] is the user's active public address

DApp 호스트명을 표시하는 승인 팝업이 나타나며 승인 후 계정을 반환합니다.

거래 보내기

const txHash = await window.ethereum.request({
  method: "eth_sendTransaction",
  params: [{
    from: accounts[0],
    to: "0xRecipient...",
    value: "0xde0b6b3a7640000", // 1 ETH in hex wei
    data: "0x",
  }],
});

거래 승인 팝업에서 공개 잔액 또는 쉴드 잔액과 조건이 갖춰진 경우 비공개 잔액을 선택할 수 있습니다.

메시지 서명

// Personal sign
const signature = await window.ethereum.request({
  method: "personal_sign",
  params: ["Hello from my DApp", accounts[0]],
});

// EIP-712 typed data
const signature = await window.ethereum.request({
  method: "eth_signTypedData_v4",
  params: [accounts[0], JSON.stringify(typedData)],
});

네트워크 전환

await window.ethereum.request({
  method: "wallet_switchEthereumChain",
  params: [{ chainId: "0xa4b1" }], // Arbitrum
});

요청 체인이 구성되지 않았다면 추가하도록 안내합니다.

이벤트 리스너

// Account changed
window.ethereum.on("accountsChanged", (accounts) => {
  console.log("Active account:", accounts[0]);
});

// Chain changed
window.ethereum.on("chainChanged", (chainId) => {
  console.log("Chain:", parseInt(chainId, 16));
});

// Connected
window.ethereum.on("connect", ({ chainId }) => {
  console.log("Connected to chain:", chainId);
});

지원 메서드

메서드 지원
eth_requestAccounts ✓
eth_accounts ✓
eth_sendTransaction ✓
eth_signTransaction ✓
personal_sign ✓
eth_signTypedData_v4 ✓
eth_getBalance ✓, 스텔스 강화
eth_call ✓, 스텔스 강화
wallet_switchEthereumChain ✓
wallet_addEthereumChain ✓
wallet_getCapabilities ✓, EIP-5792
wallet_sendCalls ✓, EIP-5792
wallet_getCallsStatus ✓, EIP-5792

EIP-5792 일괄 호출

일괄 거래, 보조 자금 같은 고급 기능에는 wallet_sendCalls를 사용하세요. 일괄 거래를 참고하세요.