npm install @olton/aptos-archive-api --save
Api configuration file connect.conf
placed in src folder.
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()
- state() - return archive state (current store version and timestamp)
- ledger() - return current ledger state
const state = await arch.state()
const ledger = await arch.ledger()
- 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})
- 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({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})
- 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({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})