Web3 API Reference
Web3 API Reference
Complete API reference for Web3 integration with Macro.
Standard Ethereum Provider API
Macro implements EIP-1193. All standard Ethereum provider methods supported.
eth_requestAccounts
Request user's wallet address.
const accounts = await ethereum.request({
method: 'eth_requestAccounts'
});
// Returns: ['0x...']eth_accounts
Get currently connected accounts.
const accounts = await ethereum.request({
method: 'eth_accounts'
});eth_sendTransaction
Send a transaction.
Macro intercepts: Signing Sandbox analyzes before user approval.
personal_sign
Sign a message.
eth_signTypedData_v4
Sign typed structured data (EIP-712).
Macro enhancement: Displays structured data in human-readable table.
wallet_switchEthereumChain
Request network switch.
wallet_addEthereumChain
Add custom network.
Macro-Specific API
Privacy-enhanced methods:
macro_getPrivacyFeatures
Check available privacy features.
macro_sendPrivateTransaction
Send transaction through privacy mixer.
Parameters:
privacy: Routing method (mixer, flashbots, or direct)mixerDelay: Delay before withdrawal (seconds, optional)
macro_privateSwap
Execute MEV-protected swap.
macro_getSigningPolicy
Get current signing policy for connected dApp.
macro_getVPNStatus
Check VPN status.
macro_getCurrentProfile
Get active Privacy Profile info.
Events
Listen for Macro-specific events:
profileChanged
Fires when user switches Privacy Profile.
vpnStatusChanged
Fires when VPN status changes.
signingPolicyUpdated
Fires when user updates signing policy for your dApp.
Error Codes
Macro-specific error codes:
4001
User rejected request in signing sandbox
4100
Unauthorized (not connected)
4200
Request not supported
4900
Disconnected from network
5001
Policy violation (transaction blocked by signing policy)
5002
Privacy feature unavailable
5003
VPN required but not connected
Example handling:
Privacy API Reference
Last updated