Skip to content

Commit 9a47fa1

Browse files
committed
update crossChainSwapHandle
1 parent 1c5a986 commit 9a47fa1

File tree

3 files changed

+852
-379
lines changed

3 files changed

+852
-379
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"@web3-name-sdk/core": "^0.2.0",
3535
"@zetachain/protocol-contracts": "^9.0.0",
3636
"@zetachain/networks": "^10.0.0",
37-
"@zetachain/toolkit": "^13.0.0-rc8",
37+
"@zetachain/toolkit": "^13.0.0-rc9",
3838
"autoprefixer": "^10.4.19",
3939
"bech32": "^2.0.0",
4040
"class-variance-authority": "^0.7.0",

src/components/Swap/hooks/useSendTransaction.ts

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -462,19 +462,25 @@ const useSendTransaction = (
462462
}
463463
const d = destinationTokenSelected;
464464
const zrc20 = d.coin_type === "ZRC20" ? d.contract : d.zrc20;
465-
const params = {
466-
chain: from,
465+
let tx;
466+
tx = await client.evmDepositAndCall({
467467
amount: sourceAmount,
468-
recipient: omnichainSwapContractAddress,
469-
message: [
470-
["address", "bytes", "bool"],
471-
[zrc20, recipient, withdraw],
472-
],
473468
erc20: sourceTokenSelected.contract,
474-
};
475-
console.log("swap", params);
476-
const tx = await client.deposit(params);
477-
469+
receiver: omnichainSwapContractAddress,
470+
revertOptions: {
471+
callOnRevert: false,
472+
onRevertGasLimit: 7000000,
473+
revertAddress: "0x0000000000000000000000000000000000000000",
474+
revertMessage: "0x",
475+
},
476+
txOptions: {
477+
gasLimit: 7000000,
478+
gasPrice: ethers.BigNumber.from("10000000000"),
479+
},
480+
types: ["address", "bytes", "bool"],
481+
values: [zrc20, recipient, withdraw.toString()],
482+
});
483+
console.log(tx);
478484
if (tx && track) {
479485
track({
480486
hash: tx.hash,

0 commit comments

Comments
 (0)