Arena SDK Playground
App0.0.19
SDK0.2.4
Wagmi0.2.4
Wallet Info
Code:
const provider = sdkRef.current?.provider;
const accounts = provider?.accounts;
const balance = await provider.request({
method: 'eth_getBalance',
params: [accounts[0], 'latest'],
});Try:
Connected Wallet: Not connected
Result:
User Profile
Code:
const userProfile = await sdkRef.current?.fetchUserProfile();
// Returns: { userImageUrl: string, username: string, ... }Try:
Result:
Send Transaction
Code:
const txHash = await provider.request({
method: 'eth_sendTransaction',
params: [{
from: account,
to: toAddress,
value: parseEther(amount).toString(),
}],
});Try:
Result:
Sign Message
Code:
const hexMessage = `0x${Buffer.from(message, 'utf8').toString('hex')}`;
const signature = await provider.request({
method: 'personal_sign',
params: [hexMessage, account],
});
// Verify
const signerAddr = ethers.verifyMessage(message, signature);Try:
Result:
Sign User Profile
Code:
const profile = await sdkRef.current?.fetchUserProfile();
const profileStr = JSON.stringify(profile);
const hexMessage = `0x${Buffer.from(profileStr, 'utf8').toString('hex')}`;
const sig = await provider.request({
method: 'personal_sign',
params: [hexMessage, account],
});
// Verify
const signerAddr = ethers.verifyMessage(profileStr, sig);Try:
Increment Contract Interaction
Code:
const browserProvider = new ethers.BrowserProvider(provider);
const signer = await browserProvider.getSigner();
const contract = new ethers.Contract(ADDRESS, ABI, signer);
const tx = await contract.increment();
await tx.wait();Try:
Current Value: ?
Result:
Arena Wagmi v2 Connector
Code:
const connector = connectorFactory({ provider });
const { accounts } = await connector.connect();
const provider = await connector.getProvider();
// Use provider with ethers/viem as normalTry:
Chain By Wagmi v2 Connector: null
Address By Wagmi v2 Connector:
null
Balance By Wagmi v2 Connector:
Contract Value By Wagmi v2 Connector: ?