0.2.0 • Published 3 months ago

autonity-sdk v0.2.0

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

Autonity SDK

Autonity SDK is a Package for interacting with Autonity network

Features

  • Interact with smart contracts using easy-to-use methods.
  • Support for custom RPC and smart contracts.
  • Simple usage with TypeScript and Node.js.

Installation

You can install Autonity SDK using NPM with the following command:

npm install autonity-sdk

Usage

Here’s an example of how to use the Autonity SDK in TypeScript and Node.js:

TypeScript

// Import Autonity SDK
import { Contract, utils } from 'autonity-sdk';

// Initialize provider or signer
// const rpcUrl = utils.piccadilly; // can use custom RPC or the RPC from utils
// const contract = utils.AUTONITY_CONTRACT; // can use custom contract or the contract from the utils class
// const privateKey = 'your-private-key'; // Replace with the private key for wallet access

// Initialize the contract with the required parameters
const contract = new Contract(); // default
// const contract = new Contract(rpcUrl, contract); // if you want to use custom
// const contract = new Contract(rpcUrl, contract, privateKey); // if you want to use transaction functions

// Example of calling the getCommittee function from the Autonity contract
contract.autonity.getCommittee() 
  .then(result => {
    console.log('Result from contract call:', result);
  })
  .catch(error => {
    console.error('Error while calling contract:', error);
  });

Node.js

// Import Autonity SDK
const { Contract, utils } = require('autonity-sdk');

// Initialize provider or signer
// const rpcUrl = utils.piccadilly; // can use custom RPC or the RPC from utils
// const contract = utils.AUTONITY_CONTRACT; // can use custom contract or the contract from the utils class
// const privateKey = "your-private-key"; // Replace with the private key for wallet access

// Initialize the contract with the required parameters
const contract = new Contract(); // default
// const contract = new Contract(rpcUrl, contract); // if you want to use custom
// const contract = new Contract(rpcUrl, contract, privateKey); // if you want to use transaction functions

// Example of calling the getCommittee function from the Autonity contract
contract.autonity.getCommittee() 
  .then(result => {
    console.log('Result from contract call:', result);
  })
  .catch(error => {
    console.error('Error while calling contract:', error);
  });
0.1.0

3 months ago

0.2.0

3 months ago

0.0.9

8 months ago

0.0.8

8 months ago

0.0.7

8 months ago

0.0.6

8 months ago

0.0.5

8 months ago

0.0.4

8 months ago

0.0.3

8 months ago

0.0.2

9 months ago

0.0.1

9 months ago