0.1.6-development • Published 29 days ago

@tevaeralabs/tevaera-web3 v0.1.6-development

Weekly downloads
-
License
MIT
Repository
github
Last release
29 days 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.0.89

1 month ago

0.1.3-development

2 months ago

0.0.85

2 months ago

0.0.84

2 months ago

0.1.1-development

2 months ago

0.1.2-development

2 months ago

0.1.0

2 months ago

0.0.8-3.4-dev

2 months ago

0.0.8-3.3-dev

2 months ago

0.0.8-3.2-dev

3 months ago

0.0.8-3.1

3 months ago

0.0.87-development

3 months ago

0.0.88-development

3 months ago

0.0.85-development

3 months ago

0.0.86-development

3 months ago

0.0.84-development

3 months ago

0.0.83

4 months ago

0.0.83-development

4 months ago

0.0.82-development

4 months ago

0.0.81-development

4 months ago

0.0.80-development

4 months ago

0.0.79-development

4 months ago

0.0.78-development

4 months ago

0.0.76

5 months ago

0.0.77

5 months ago

0.0.75

5 months ago

0.0.75-development

6 months ago

0.0.40-development

9 months ago

0.0.73-development

7 months ago

0.0.72-development

7 months ago

0.0.62-development

8 months ago

0.0.41-development

9 months ago

0.0.52-development

8 months ago

0.0.63-development

8 months ago

0.0.74-development

6 months ago

0.0.53-development

8 months ago

0.0.42-development

9 months ago

0.0.50-development

9 months ago

0.0.61-development

8 months ago

0.0.71-development

7 months ago

0.0.70-development

7 months ago

0.0.60-development

8 months ago

0.0.73

7 months ago

0.0.48-development

9 months ago

0.0.49-development

9 months ago

0.0.72

7 months ago

0.0.44-development

9 months ago

0.0.45-development

9 months ago

0.0.43-development

9 months ago

0.0.46-development

9 months ago

0.0.47-development

9 months ago

0.0.69-development

7 months ago

0.0.67-development

7 months ago

0.0.68-development

7 months ago

0.0.64

8 months ago

0.0.65

7 months ago

0.0.66

7 months ago

0.0.59-development

8 months ago

0.0.51

9 months ago

0.0.37-development

10 months ago

0.0.38-development

9 months ago

0.0.55-development

8 months ago

0.0.54-development

8 months ago

0.0.57-development

8 months ago

0.0.39-development

9 months ago

0.0.58-development

8 months ago

0.0.56-development

8 months ago

0.0.36-development

10 months ago

0.0.35-development

11 months ago

0.0.30-development

11 months ago

0.0.31-development

11 months ago

0.0.33-development

11 months ago

0.0.34-development

11 months ago

0.0.32-development

11 months ago

0.0.27-development

12 months ago

0.0.28-development

12 months ago

0.0.29

12 months ago

0.0.25

1 year ago

0.0.26

1 year ago

0.0.1-testnet

1 year ago