0.2.0-development • Published 6 months ago

@tevaeralabs/tevaera-web3 v0.2.0-development

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

JavaScript SDK for tevaera-web3

An npm package to intract with smart contracts created by Tevaera Labs on ethereum network. It can be used in browser applications.

Getting started

npm install @tevaeralabs/tevaera-web3

After installing the app, you can then import and use the SDK:

Create instance of the contract using web3 provider

import { CitizenId } from "@tevaeralabs/tevaera-web3";

// get the web3 provider
const provider = new zksync.Web3Provider(window.ethereum);

// create the instance of citizen id contract
const citizenIdContract = new CitizenId({ web3Provider: provider });

Create instance of the contract using wallet private key

import { CitizenId } from "@tevaeralabs/tevaera-web3";
import { types } from "@tevaeralabs/tevaera-web3";

// create the instance of citizen id contract
const citizenIdContract = new CitizenId({
  network: types.Network.Sepolia,
  privateKey: "<wallet_private_key>",
});

Complete example

import { CitizenId, KarmaPoint } from "@tevaeralabs/tevaera-web3";

// get the web3 provider
const provider = new zksync.Web3Provider(window.ethereum);

//// get citizen id by wallet
// create the instance of citizen id contract
const citizenIdContract = new CitizenId({ web3Provider: provider });

// get token id (nft id) by wallet address
const tokenId = citizenIdContract.GetCitizenID("<wallet_address>");

//// get karma point balance by wallet
// create the instance of karma point contract
const karmaPointContract = new KarmaPoint({ web3Provider: provider });

// get karma point balance by wallet address
const kpBalance = karmaPointContract.GetKpBalance("<wallet_address>");
// get karma point price by kp amount
const kpBalance = karmaPointContract.GetKpPrice("<no_of_kp>");
// buy karma point
const kpBalance = karmaPointContract.BuyKarmaPoints("<no_of_kp>");
// withdraw karma point
const kpBalance = karmaPointContract.WithdrawKarmaPoints("<no_of_kp>");

Using the Tevaera Web3 SDK

The Tevaera Web3 SDK currently supports four different namespaces, including:

  • CitizenId: All citizen methods
  • Claim: All claim methods
  • Guardians: All guardian methods
  • KarmaPoint: All karma point methods

Below is the list of methods supported by all classes:

  • CitizenId

    • GetCitizenID
    • MintCitizenID
  • KarmaPoint

    • BuyKarmaPoints
    • GetBoughtKarmaPoints
    • GetKpBalance
    • GetKpBuyCap
    • GetKpBuyingCap
    • GetKpPrice
    • WithdrawKarmaPoints
  • Claim

    • Claim
  • ReformistSphinx

    • GetReformistSphinxByWallet
    • MintReformistSphinx
0.2.0-development

6 months ago

0.1.8-development

7 months ago

0.1.9-development

7 months ago

0.1.7

12 months ago

0.0.89

1 year ago

0.0.85

1 year ago

0.0.84

1 year ago

0.1.0

1 year ago

0.0.8-3.4-dev

1 year ago

0.0.8-3.3-dev

1 year ago

0.0.8-3.2-dev

1 year ago

0.0.8-3.1

1 year ago

0.0.83

1 year ago

0.0.76

2 years ago

0.0.77

2 years ago

0.0.75

2 years ago

0.0.73

2 years ago

0.0.72

2 years ago

0.0.64

2 years ago

0.0.65

2 years ago

0.0.66

2 years ago

0.0.51

2 years ago

0.0.29

2 years ago

0.0.25

2 years ago

0.0.26

2 years ago

0.0.1-testnet

2 years ago