Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

73
Views
Alchemy API trying to call `getTokenBalances` at a particular block height

First I set the variable tokenArray:

const tokenArray = [
    '<token contract address 1>',
    '<token contract address 2>',
    '<token contract address 3>',
    etc...
]

I have this function:

async getTokens() {
        const ownerAddr = this.account;
        const balances = await this.web3.alchemy.getTokenBalances(ownerAddr, tokenArray, process.env.BLOCK_NUMBER)
        return balances

And I run it like this:

getTokens().then(function (result) {
    console.log(result);

The function will then return all of my current token balances but not my token balances as of the specified block height, followed by this error.

/Users/<myusername>/Desktop/Dev/token-balance-through-time/node_modules/@alch/alchemy-web3/dist/cjs/util/promises.js:28
        callback(null, result);
        ^

TypeError: callback is not a function
    at /Users/<myusername>/Desktop/Dev/token-balance-through-time/node_modules/@alch/alchemy-web3/dist/cjs/util/promises.js:28:9
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
<myusername>@<mycomputername> token-balance-through-time % 

How do I call getTokenBalances at a particular block height? BTW getTokenBalances is from @alch/alchemy-web3 and imported at the top of the file like this. const { createAlchemyWeb3 } = require('@alch/alchemy-web3');

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!