GithubHelp home page GithubHelp logo

aptos-archive-api's Introduction

Welcome to Aptos Archive API

Install

npm install @olton/aptos-archive-api --save

Api Config

Api configuration file connect.conf placed in src folder.

Init & Using

const arch = new Archive() // when config.json exist or
const arch = new Archive({
    "proto": "http",
    "host": "archive.aptosnet.com",
    "port": 5432,
    "user": "user",
    "password": "password",
    "database": "aptos_archive",
    "options": {
        "allowExitOnIdle": true,
        "max": 3000
    }
})
const collectionCount = await arch.collectionsCount()

Functions

Archive API

  • state() - return archive state (current store version and timestamp)
  • ledger() - return current ledger state
const state = await arch.state()
const ledger = await arch.ledger()

Coins API

  • transferCoinCount()
  • mintCoinCount()
  • incomingPayments(address, {order, limit, start})
  • outgoingPayments(address, {order, limit, start})
  • payments({order, limit, start})
  • mintAddress(address, {order, limit, start})
  • mint({order, limit, start})
const tran_count = await arch.transferCoinCount()
const mint_count = await arch.mintCoinCount()
const incoming = await arch.incomingPayments("0x123...", {limit: 25, start: 0})
const outgoing = await arch.outgoingPayments("0x123...", {limit: 25, start: 0})
const payments = await arch.payments({limit: 25, start: 0})
const mintAddr = await arch.mintAddress("0x123...", {limit: 25, start: 0})
const mint = await arch.mint({order: "version desc", limit: 25, start: 0})

Nft API

  • collectionsCount()
  • collections({order, limit, start})
  • collectionsByName(name, {order, limit, start})
  • collectionsInCollection(collection, {order, limit, start})
  • collectionsByAddress(address, {order, limit, start})
  • tokensCount()
  • tokens({order, limit, start})
  • tokensByName(name, {order, limit, start})
  • tokensByAddress(address, {order, limit, start})
  • collectionsCountForAddress(address)
  • tokensCountForAddress(address)
const collectionsCount = await arch.collectionsCount()
const collections = await arch.collections({order: "version", limit: 25, start: 0})
const collectionsByName = await arch.collectionsByName("Alice's collection", {order: "version", limit: 25, start: 0})
const collectionsByAddress = await arch.collectionsByAddress("0x1234567890...", {order: "version", limit: 25, start: 0})
const tokenCount = await arch.tokensCount()

Transactions API

  • transactions({order, limit, start})
  • userTransactions({order, limit, start})
  • metaTransactions({order, limit, start})
  • stateTransactions({order, limit, start})
  • transactionsFromAddress(address, {order, limit, start})
  • proposalTransactionsFromAddress(address, {order, limit, start})
  • proposalTransaction({order, limit, start})
  • genesis()
  • transactionsCount()
const trans = await transactions({order:"version", limit:25, start:0})
const genesis = await arch.genesis()
const counts = await arch.transactionsCount()
const userTransactions = await arch.userTransactions({order: "version", limit: 25, start: 0})
const metaTransactions = await arch.metaTransactions({order: "version", limit: 25, start: 0})
const stateTransactions = await arch.stateTransactions({order: "version", limit: 25, start: 0})
const transactionsFromAddress = await arch.transactionsFromAddress("0x1234567890...", {order: "version", limit: 25, start: 0})
const proposalTransactionsFromAddress = await arch.proposalTransactionsFromAddress("0x1234567890...", {order: "version", limit: 25, start: 0})
const proposalTransactions = await arch.proposalTransactions({order: "version", limit: 25, start: 0})

Validators API

  • currentRound()
  • roundsPerEpoch(epoch_count)
  • roundsPerEpochByAddress(address, epoch_count)
  • roundsInTime(trunc, limit)
const currentRound = await arch.currentRoun()
const roundsPerEpoch = await arch.roundsPerEpoch(10)
const roundsPerEpochByAddress = await arch.roundsPerEpochByAddress("0x1234567890...", 10)
const roundsInTime = await arch.roundsInTime("minute", 60)

Events API

  • events({order, limit, start})
  • eventsByType(type, {order, limit, start})
  • eventsByKey(key, {order, limit, start})
  • eventsByAddress(address, {order, limit, start})
const events = arch.events({order: "version", limit: 25, start: 0})
const eventsByType = arch.eventsByType("0x1::coin::DepositEvent", {order: "version", limit: 25, start: 0})
const eventsByKey = arch.eventsByKey("0x1000000000...", {order: "version", limit: 25, start: 0})
const eventsByAddress = arch.eventsByAddress("0x1234567890...", {order: "version", limit: 25, start: 0})

aptos-archive-api's People

Contributors

olton avatar

Watchers

 avatar  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.