Skip to main content

Core Ops

The SDK encapsulates all ZK proving and contract call encoding under simple consistent interfaces. Functions commonly return call payloads that can be dispatched and paid for through connected signers and/or remote relayers or ERC-4337 bundlers and paymasters. Payloads are of form { chainId, to, data }.

Deposit

Fund a/multiple Bermuda account/s with any ERC-20 token:

let payload = await bermuda.deposit({
signer,
token: bermuda.config.USDC,
recipients: [
{ to: '0x...', amount: 100_000_000n },
{ to: '0x...', amount: 42_000_000n }
]
})

Transfer

Transfer any shielded ERC-20 token to a/multiple Bermuda account/s:

let payload = await bermuda.transfer({
spender: aliceAccount,
token: bermuda.config.USDC,
to: '0x...'
amount: 42_000_000n,
note: 'halloc'
})
  • Also supports multiple recipients
  • note is an optional message, usable as payment identifier or else
    • Can also be set inside the recipients array

Withdraw

Withdraw any shielded ERC-20 token to a public Ethereum account:

let payload = await bermuda.withdraw({
spender: bobAccount,
token: bermuda.config.USDC,
amount: 11_000_000n,
to: 'whoami.eth'
})
warning

The transfer and withdraw payloads must be sent through a relayer to prevent doxing.