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
feat: allow signing deposit transactions with private keys #7
Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.
This PR allows clients to use the SDK outside of the browser environment (e.g. bots, scripts and servers). Specifically, this change enables clients to provide a wallet containing a private key they control and use that to sign deposit transactions and related transactions such as approveERC20.
Other minor changes made:
Added code coverage output on each test run.
Added logic to switch between fetch and node-fetch depending on which environment the SDK is running in.
Type of change
Please delete options that are not relevant.
[ ] Bug fix (non-breaking change which fixes an issue)
[X] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
[X] This change requires a documentation update
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
In the new e2e folder, make a copy of the .env.example file and rename it to .env then fill out the variables.
Run yarn test to execute the test in the e2e folder.
To test existing functionality in the browser
Run yarn build
Clone the hyphen-ui repo and checkout to the master-v2 branch.
In the package.json file, point the hyphen sdk dependency to your local copy of my branch i.e. "@biconomy/hyphen-staging": "../hyphen-sdk".
Run yarn && yarn run start:staging.
Go to localhost:300 in your browser and perform a deposit transaction. This will prompt you to sign using your browser extension wallet.
Tests Added/Updated
E2E Tests
[X] Check pre-deposit status
[X] Submit transaction to provide liquidity pools with allowance to spend user's tokens
[X] Perform a deposit transaction using a provided private key
Unit Tests
[ ] ...
Coverage
The --coverage flag has been passed into jest when running the tests. Once the test suite completes, the coverage will be printed to the terminal. A new folder called coverage will also be created (not tracked by git). Go to coverage/lcov-report/index.html and open the page in the browser.
Checklist:
[ ] My code follows the style guidelines of this project
[X] I have performed a self-review of my code
[X] I have commented my code, particularly in hard-to-understand areas
[X] I have made corresponding changes to the documentation
[X] My changes generate no new warnings
[X] I have added tests that prove my fix is effective or that my feature works
[ ] New and existing unit tests pass locally with my changes
[ ] Any dependent changes have been merged and published in downstream modules
Description
This PR allows clients to use the SDK outside of the browser environment (e.g. bots, scripts and servers). Specifically, this change enables clients to provide a wallet containing a private key they control and use that to sign deposit transactions and related transactions such as
approveERC20
.Other minor changes made:
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Test Configuration:
Steps to reproduce
yarn
to install the new dependencies..env.example
file and rename it to.env
then fill out the variables.yarn test
to execute the test in the e2e folder.yarn build
master-v2
branch."@biconomy/hyphen-staging": "../hyphen-sdk"
.yarn && yarn run start:staging
.Tests Added/Updated
Coverage
The
--coverage
flag has been passed into jest when running the tests. Once the test suite completes, the coverage will be printed to the terminal. A new folder called coverage will also be created (not tracked by git). Go to coverage/lcov-report/index.html and open the page in the browser.Checklist: