Quickstart
What you need to integrate with ConfidentialSwap. For the call sequence see Market makers; for every address see Addresses.
Dependencies
- An EVM client: viem or ethers, to read and write the contracts.
- The Zama FHEVM SDK:
@zama-fhe/sdk, to encrypt inputs and decrypt results client-side. - Contract ABIs + addresses: the
ConfidentialSwapproxy and the confidential (ERC-7984) tokens, per network, on Addresses. The ABI is the compiledConfidentialSwap(public surface =IConfidentialSwap). - A funded account: native ETH for gas (Sepolia ETH on the testnet) and confidential token balances for the assets you trade; see Test tokens — fastest is the Faucet, which mints and wraps them in one transaction.
npm install @zama-fhe/sdk viemSubmit a quote
The most direct way to participate programmatically is to quote an open intent.
You need MARKET_MAKER_ROLE (ask a protocol admin to grant it) and the swap
contract authorized as an operator on the tokens you settle. Construct the
Zama SDK once, then for an intent you want to fill:
import { toHex } from "viem";
// Price the trade with your own strategy, then encrypt the gross output amount
// (euint64), bound to the swap contract and your address.
const { handles, inputProof } = await sdk.relayer.encrypt({
contractAddress: SWAP,
userAddress: me,
values: [{ value: quoteAmount, type: "euint64" }],
});
// Submit it before the intent's quotingEndsAtBlock.
await walletClient.writeContract({
address: SWAP,
abi: confidentialSwapAbi,
functionName: "quoteIntent",
args: [intentId, toHex(handles[0]), toHex(inputProof)],
});To price first, decrypt the intent's direction and input amount; after quoting, resolve the auction and settle if you win. The full agent flow (watch, decrypt, quote, resolve, settle) and the role/permission model are on Market makers.