bcnmy / hyphen-sdk

Repository containing Hyphen SDK code that helps you integrate Hyphen cross-chain asset transfer protocol in your Dapp. Hyphen SDK provides you simple to use methods that connects directly with Hyphen liquidity pools on supported chains and hyphen nodes to fetch information related to cross chain transfer transactions.
MIT License
5 stars 2 forks source link

depositAndswap gasToken method added #29

Closed divyaN73 closed 1 year ago

divyaN73 commented 1 year ago

Description

Method added in SDK to call "depositAndswap" method on Liquidity Pool contract.

Type of change

How Has This Been Tested?

Test Configuration:

Using New Sample Function

Signature: async DepositManager.depositAndSwap(request: DepositAndSwapRequest) => Promise<TransactionResponse>

Sample Request:

  const request: DepositAndSwapRequest = {
      sender: "",
      receiver: "";
      tokenAddress: "";
      depositContractAddress: <LiquidityPool contract address>;
      amount: "";
      fromChainId: "";
      toChainId: "";
      useBiconomy: <boolean>;
      dAppName: "Test";
      tag?: null;
      swapRequest: [{
        tokenAddress: "0x4200000000000000000000000000000000000006", 
        percentage: 200000000,  // 2%
        amount: 0, 
        operations: 0,
        path: "0x0000000000000000000000000000000000000000"
    }];
  };

  const response = await depositManager.depositAndSwap(request);

Sample Response: same response as in "Deposit" method call

Automated Tests Added/Updated

Coverage

Checklist: