Skip to content

A quickstart project demonstrating how to query and verify the name() of an ERC-20 token on Ethereum Sepolia using Wormhole Queries and Guardian signatures.

Notifications You must be signed in to change notification settings

martin0995/wh-queries

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Wormhole Query Demo

This is a minimal example showing how to use Wormhole Queries to fetch and verify the name() of an ERC-20 token on Ethereum Sepolia using a Guardian-signed eth_call.

What It Does

  • Connects to Ethereum Sepolia via public RPC
  • Queries the name() function on a target ERC-20 contract
  • Sends the query to the Wormhole Query Proxy
  • Receives a verifiable Guardian-signed response (Query VAA)
  • Decodes the token name from the response

Requirements

  • Node.js 18+
  • An API key for the Wormhole Query Proxy

Getting Started

  1. Clone the repo or copy the script into your project

  2. Install dependencies

    npm install
  3. Create a .env file with your API key:

    API_KEY=your_query_api_key_here
  4. Run the script:

    npm run query

You should see output like:

npm run query

> wormhole-query-demo@1.0.0 query
> tsx src/query.ts


πŸ”Ž Fetching latest block from Sepolia...
βœ… Latest block: 8186366 (0x7ce9fe)

πŸš€ Issuing Wormhole query...

πŸ“¦ Query Proxy response received

πŸ” Parsed chain response:
{
  blockNumber: '8186366',
  blockHash: '0x1008dfc2130b5196040f85ced943403839c586296025a20325e7179fb70ab68c',
  result: '0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000045553444300000000000000000000000000000000000000000000000000000000'
}

βœ… Token Name: USDC

Structure

wormhole-query-demo/
β”œβ”€β”€ src/
β”‚   └── query.ts         # Main script
β”œβ”€β”€ .env                 # Your API key
β”œβ”€β”€ package.json
β”œβ”€β”€ tsconfig.json

About

A quickstart project demonstrating how to query and verify the name() of an ERC-20 token on Ethereum Sepolia using Wormhole Queries and Guardian signatures.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published