Giter Site home page Giter Site logo

ulujs's Introduction

ulujs

ulujs is a JavaScript library for interacting with smart contracts on the AVM blockchains. It provides a convenient interface for interacting with the smart contract tokens, nfts, and dexes.

Features

  • Interaction with smart contract tokens (arc200, arc72)
  • Comprehensive methods for performing swaps and liquidity provision (swap200)

Installation

Install ulujs in your project with:

npm install ulujs

Implementations

  • arc200 - ARC200 Smart Contract Token
  • arc72 - ARC72 Smart Contract NFT
  • hsv2 - HumbleSwap Protocol (v2)
  • swap200 - ARC200 Bases Liqudity Pool (AMM)
  • nt200 - ARC200 Wrapped Network Token (wVOI)

Usage

Import and initialize the ulujs library in your project:

import algosdk from "algosdk";
import { arc200 as Contract } from "hsv2js";

// Initialize Algod client
const algodClient = new algosdk.Algodv2(algodToken, algodServer, algodPort);
const indexerClient = new algosdk.Indexer(
  indexerToken,
  indexerServer,
  indexerPort
);

// Initialize ARC200 Contract instance
const tokenId = 123456; // Replace with your token ID
const contract = new Contract.netTok(tokenId, algodClient, indexerClient);

Event queries

The query argument may be used to retrieve matching events:

const { minRound, maxRound, address, round, txid } = query || {};

minRound and maxRound may be used to specify a range of rounds to query events from. address may be used to filter events by address. round and txid may be used to retrieve events from a specific round or transaction ID.

The following events are available for extended ARC200 token functionalities:

getEvents

Retrieve all events of the ARC200 token.

await contract.getEvents();
//{
//   arc200_Transfer: {
//     name: "arc200_Transfer",
//     signature: "...",
//     selector: "...",
//     events: [
//       [
//         "WR4C7PMYKZ45ZWFWHTQRWHL424VDYXKYH4X2BX4J6KZ7BD3IQD4Q",
//         1519106,
//         1699029707,
//         "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ",
//         "VIAGCPULN6FUTHUNPQZDRQIHBT7IUVT264B3XDXLZNX7OZCJP6MEF7JFQU",
//         10000000000000000n,
//       ],
//       ...
//     ]
//   },
//   arc200_Approval: {
//     name: "arc200_Approval",
//     signature: "...",
//     selector: "...",
//     events: [
//       [
//         "WR4C7PMYKZ45ZWFWHTQRWHL424VDYXKYH4X2BX4J6KZ7BD3IQD4Q",
//         1519106,
//         1699029707,
//         "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ",
//         "VIAGCPULN6FUTHUNPQZDRQIHBT7IUVT264B3XDXLZNX7OZCJP6MEF7JFQU",
//         10000000000000000n,
//       ],
//       ...
//     ]
//   }
//}

standard methods

The following methods are available for standard ARC200 token functionalities:

API Reference

Each method provided by ulujs offers specific functionalities:

  • getEvents(): Retrieves all events of the smart contract.

Contributing

Contributions to ulujs are welcome. Please adhere to the existing code style and ensure all tests pass.

License

ulujs is MIT licensed.

ulujs's People

Contributors

temptemp3 avatar rgranata1 avatar xarmian avatar cswenor avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.