zkt-sdk
zkToken | JS SDK
Installation and Running
As a package for typescript project
import { ZkEth } from "zkt-sdk";
const zkEth = new ZkEth("<ETHERJS_BROWSER_PROVIDER>");
const auth = zkEth.authentication("<SXT_ENDPOINT>", "<SECRETS_PROXY_ENDPOINT>");
console.log(zkEth);
Example in React Project
import { ZkEth } from "zkt-sdk";
import { ethers } from 'ethers';
const provider = new ethers.BrowserProvider(window.ethereum, { name: 'polygon', chainId: 137 });
const zkEth = new ZkEth(provider, 137);
await zkEth.depositNative(33, '0x3077Bf667dBD81d3c718684Da4DE4Dc8448220E1', 0)
As a bundled js file for the web
- Install all dependencies
yarn
- Build the bundled js file
yarn run build-web
The build files should be available in ./dist/web
folder
- Test
yarn run test-web
A new index.html
with sample usage code should be available in the ./dist
folder. In your browser open http://localhost:9000 and check the console logs. It watches any changes to the html file
Usage
<!DOCTYPE html>
<head>
<script src="./bundle.js"></script>
<script>
const zkEth = new ZkEth("<ETHERJS_BROWSER_PROVIDER>");
const auth = zkEth.authentication("<SXT_ENDPOINT>", "<SECRETS_PROXY_ENDPOINT>");
console.log(auth)
</script>
</head>
</html>
As a package file for the nodejs
- Install all dependencies
yarn
- Generate a node js package
yarn run build-node
Node js version of the files will be generated to dist/node