API Reference
OffshoreCash
Constructor
typescript
new OffshoreCash(config: {
rpcUrl: string; // Ethereum Mainnet RPC URL
chainId: 1; // Only chainId 1 (Mainnet) is supported
mainPoolAddress?: string; // Default: 0x7dc44f4d7d13853a14b26169c8479bec3939649d
})Methods
createDeposit(options)
Creates a deposit commitment and note.
| Parameter | Type | Description |
|---|---|---|
| amount | string | Deposit amount in ETH |
| token | string | Token symbol (currently only 'ETH') |
Returns: { commitment, note, secret, nullifier }
deposit(options)
Creates and submits a deposit transaction.
withdraw(options)
Generates a ZK proof and submits withdrawal via relayer.
| Parameter | Type | Description |
|---|---|---|
| note | string | Deposit note |
| recipient | string | Withdrawal address |
| amount? | string | Partial amount (optional) |
| relayerUrl | string | Relayer endpoint URL |
Returns: { txHash, changeNote? }
getDepositStatus(note)
Checks if a deposit exists in the Merkle tree.
Returns: { found, leafIndex, amount, token }