Private Swaps
Integrate private Swaps in your DEX
Bellow is a simple example on how to implement private Swaps in the frontend:
let deposit_calls = await sdk.generate_approve_and_deposit_calls(amount_out, token_out_addr)
const multiCall = await account.execute([
{
contractAddress: "yourcontractaddress",
entrypoint: 'swapExample',
calldata: CallData.compile({
token_in: token_in_addr,
token_out: token_out_addr,
amount_in: cairo.uint256(amount_in),
amount_out: cairo.uint256(amount_out)
}),
},
...deposit_calls
]);
await account.waitForTransaction(multiCall.transaction_hash);
await sdk.withdraw(multiCall.transaction_hash, [recipient_addr])
Last updated