DepositManager
The DepositManager subclass provides methods for initiating and checking the status of cross-chain transfers through Hyphen.
Usage: hyphen.depositManager
Methods
Methods
preDepositCheck(checkStatusRequest)
preDepositCheck(checkStatusRequest)
Performs the required status checks before doing a cross-chain transaction. Recommended to call before performing any cross-chain transaction.
Arguments
checkStatusRequest: {
tokenAddress: string,
amount: string,
fromChainId: number,
toChainId: number,
userAddress: string
}
Returns a Promise which resolves to an object with the following keys:
1. code
: a number of type hyphen.RESPONSE_CODES
, as given below
144
OK
145
ALREADY_EXISTS
146
UNSUPPORTED_TOKEN
148
NO_LIQUIDITY
149
UNSUPPORTED_NETWORK
150
ALLOWANCE_NOT_GIVEN
200
SUCCESS
400
BAD_REQUEST
500
ERROR_RESPONSE
2. message
: a string representing the status
deposit(request, wallet?)
deposit(request, wallet?)
Initiates a cross-chain transfer.
Arguments
request: {
sender: string,
receiver: string,
tokenAddress: string,
depositContractAddress: string,
amount: string,
fromChainId: string,
toChainId: string,
useBiconomy: boolean,
dAppName: string
}
wallet?: ethers.Wallet
Returns
Promise<TransactionResponse | undefined>
: TransactionResponse of the deposit transaction on fromChain.
checkDepositStatus(depositRequest)
checkDepositStatus(depositRequest)
Checks and returns the status of a given deposit transaction
Arguments
depositRequest: {
depositHash: string, // Transaction Hash of deposit transaction
fromChainId: number, // ChainId of chain on which deposit was done
}
Returns: a Promise resolving to an object with the following parameters:
{
amount?: Amount to be transferred
code: 200 if Executors have started processing the tranasaction, else 404
depositHash?: string
exitHash?: string
fromChainId: number
message: string
statusCode?: 1 if processing, 2 if processed and 3 if failed
toChainId?: number
tokenAddress?: string
}
getTransferFee(request)
getTransferFee(request)
Returns the transfer fee for a given token and amount.
Arguments
Type - GetTransferFeeRequest
{
fromChainId: number;
toChainId: number;
tokenAddress: string;
amount: BigNumberish;
}
Returns: a Promise resolving to a GetTransferFeeResponse
object with the following parameters:
{
code: number
message: string
responseCode?: number
gasFee: string, // Gas fee in USDC on destination chain e.g. "0.966"
transferFee: string, // LP Fee in UDSC on destination chain e.g. "0.10009509"
transferFeePercentage: string, // Percentage LP fee eg. "0.10009509"
reward: string, // Reward in USDC if available on source chain e.g. "0"
netTransferFee: string, // Final Net Transfer Fee (transferFee + gasFee - reward) e.g. "1.06609509"
amountToGet: string // Approximate amount to get on destination chain (Amount deposited - netTransferFee) e.g. "98.93390491"
}
Last updated
Was this helpful?