Deposit calls usage

Integrate the deposit calls

The Deposit calls are generated by splitting the input amount between the Typhoon pools.

How to integrate the deposit calls to your Dapp

To integrate the deposit calls to your dapp is very simple, just add it to your multicall like that:


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]) 

The code above shows an example on how to make a private swap.

Last updated