let preTransferStatus = await hyphen.depositManager.preDepositStatus({
tokenAddress: "", // Token address on fromChain which needs to be transferred
amount: "", // Amount of tokens to be transferred in smallest unit eg wei
fromChainId: "" // Chain id from where tokens needs to be transferred
toChainId: "", // Chain id where tokens are supposed to be sent
userAddress: "" // User wallet address who want's to do the transfer
if (preTransferStatus.code === RESPONSE_CODES.OK) {
// β
ALL CHECKS PASSED. Proceed to do deposit transaction
} else if(preTransferStatus.code === RESPONSE_CODES.ALLOWANCE_NOT_GIVEN) {
// β Not enough apporval from user address on LiquidityPoolManager contract on fromChain
let infiniteApproval = false;
let approveTx = await hyphen.tokens.approveERC20(tokenAddress,
preTransferStatus.depositContract, amount.toString(),
infiniteApproval, useBiconomy,
wallet); // !!!NOTE: the previously created wallet is added here
// β±Wait for the transaction to confirm, pass a number of blocks to wait as param
// NOTE: Whenever there is a transaction done via SDK, all responses
// will be ethers.js compatible with an async wait() function that
// can be called with 'await' to wait for transaction confirmation.
// πNow proceed to do the deposit transaction
} else if (preTransferStatus.code === RESPONSE_CODES.UNSUPPORTED_NETWORK) {
// β Target chain id is not supported yet
} else if (preTransferStatus.code === RESPONSE_CODES.NO_LIQUIDITY) {
// β No liquidity available on target chain for given tokenn
} else if (preTransferStatus.code === RESPONSE_CODES.UNSUPPORTED_TOKEN) {
// β Requested token is not supported on fromChain yet
// β Any other unexpected error