import { createWalletClient, custom } from "viem";
const getWalletClient = async () => {
const [account] = await window.ethereum.request({
method: "eth_requestAccounts",
});
const walletClient = createWalletClient({
chain: arbitrum,
account,
transport: custom(window.ethereum!),
});
return walletClient;
};
const wallet = await getWalletClient();
const [address] = await wallet.requestAddresses();
const destinationPayload = encodeFunctionData({
abi: ABI, // Replace with your ABI
functionName: "mint",
args: [address, 1000000000000],
}); // Replace with your own function name and parameters
const payload: any = {
// ... remaining params
targetCalldata: destinationPayload
};
const depositData = await aarcCoreSDK.getDepositAddress(payload);
// make client sign the generated tx
const { to, value, data, gasLimit, chainId, from } = depositData.txData;
const txHash = await signer.sendTransaction({ to, value, data, gasLimit, chainId, from });
console.log('tx', tx);