0.6.0 • Published 4 years ago

@stablepay/sdk_l2 v0.6.0

Weekly downloads
46
License
MIT
Repository
github
Last release
4 years ago

StablePay SDK for Layer 2 Solutions

StablePay is a decentralized cryptocurrency payment platform powered by smart-contracts in the ethereum network that allows anyone to receive easily and securely an asset-backed stablecoin through their site, mitigating the risk of high volatility in the cryptocurrency market.

This library and its docs are still in development.

Installing

Using npm:

npm install @stablepay/sdk_l2

Using yarn:

yarn add @stablepay/sdk_l2

Usage

import { Layer2Manager, Layer2Type } from '@stablepay/sdk_l2'

// Obtain ZkSync Layer 2 Provider instance bound to 'ropsten' network.
const l2Provider = await Layer2Manager.getProviderByLayer2Type(
  Layer2Type.ZK_SYNC, 'ropsten');

// Obtain the Layer 2 wallet from the provider.
// First, obtain an L2 wallet builder.
const l2WalletBuilder = l2Provider.getLayer2WalletBuilder();

// Then, instantiate the wallet with the builder.
// You may instantiate the wallet either from mnemonics or by
// provider-specific options object. For ZkSync provider, "ethersSigner"
// options is valid (signer from ethers.js signer object). Consult each
// provider's specific options.
const l2Wallet = await l2WalletBuilder.fromOptions({
  ethersSigner: myInstantiatedEthersSignerJSObject
});


async printMyTokenBalance(tokenSymbol: string) {
  // For Ethereum, use 'ETH' as token symbol. Or, invoke getBalance() instead
  // of getTokenBalance() function.
  const myBalance = await l2Wallet.getTokenBalance(tokenSymbol);

  // Print to console.
  console.log(`My ${tokenSymbol} balance is ${myBalance}`);
}

General API design diagram

sdk-l2 design

Running unit tests

To run unit tests, within the project's root directory, just run

$ yarn test

Acknowledgments

Grant(s) by:

0.6.0

4 years ago

0.0.60

4 years ago

0.0.50

4 years ago

0.0.44

4 years ago

0.0.45

4 years ago

0.0.46

4 years ago

0.0.43

4 years ago

0.0.42

4 years ago

0.0.41

4 years ago

0.0.40

4 years ago

0.0.36

4 years ago

0.0.35

4 years ago

0.0.34

4 years ago

0.0.33

4 years ago

0.0.32

4 years ago

0.0.31

4 years ago

0.0.30

4 years ago

0.0.29

4 years ago

0.0.28

4 years ago

0.0.27

4 years ago

0.0.25

4 years ago

0.0.24-b

4 years ago

0.0.26

4 years ago

0.0.24

4 years ago

0.0.23

4 years ago

0.0.22

4 years ago

0.0.20

5 years ago

0.0.17

5 years ago

0.0.16

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago