0.1.12 • Published 2 years ago

@olton/aptos-archive-api v0.1.12

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

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})
0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago