0.6.0 • Published 3 years ago

@stablepay/sdk_l2 v0.6.0

Weekly downloads
46
License
MIT
Repository
github
Last release
3 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

3 years ago

0.0.60

3 years ago

0.0.50

3 years ago

0.0.44

3 years ago

0.0.45

3 years ago

0.0.46

3 years ago

0.0.43

3 years ago

0.0.42

3 years ago

0.0.41

3 years ago

0.0.40

3 years ago

0.0.36

3 years ago

0.0.35

3 years ago

0.0.34

3 years ago

0.0.33

3 years ago

0.0.32

3 years ago

0.0.31

3 years ago

0.0.30

3 years ago

0.0.29

3 years ago

0.0.28

3 years ago

0.0.27

3 years ago

0.0.25

3 years ago

0.0.24-b

3 years ago

0.0.26

3 years ago

0.0.24

3 years ago

0.0.23

3 years ago

0.0.22

3 years ago

0.0.20

4 years ago

0.0.17

4 years ago

0.0.16

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago