Skip to content

Add interactive TS script to register tokens #114

@JoE11-y

Description

@JoE11-y

Summary

Create a Node/TypeScript interactive script that lets an admin register tokens via the contract function:

function registerToken(AssetType assetType, address tokenAddress, address priceFeed, uint8 decimals)
enum AssetType { ETH, ERC20 }

Requirements

  • File path: scripts/registertoken.ts

  • Prompts the admin for:

    • Asset Type (ETH or ERC20)
    • Token Address (skip/zero address if ETH)
    • Price Feed Address (Chainlink Sepolia; link in script help)
    • Decimals (e.g., 18 for ETH/ERC20)
  • Validates inputs (addresses, decimals range, etc.)

  • Loads config from env:

    • RPC_URL (Sepolia)
    • PRIVATE_KEY (admin)
    • CONTRACT_ADDRESS (ZeroXBridge or Registry contract exposing registerToken)
  • Displays a full transaction preview and asks for confirmation

  • Sends the tx and prints:

    • hash
    • mined block number
    • gas used
  • Clean exit codes (non-zero on failure)

  • Include minimal ABI for registerToken + AssetType

Reference

Acceptance Criteria

  • Running ts-node scripts/registertoken.ts (or pnpm ts-node …) launches an interactive flow
  • Successful registration logs tx details; failures provide actionable errors
  • Input validation prevents obvious misconfigs (bad address, decimals, etc.)
  • Script is documented with a short header comment and usage notes

Metadata

Metadata

Assignees

Labels

3 Days ETAWithin Three days, send in a PR. Failure to do so will result in a reassignment of your issues.enhancementNew feature or requestgood first issueGood for newcomers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions