Build npm Package: near-contract-parser - Smart Contract ABI Tools
Open
Description
Overview
Create a package that can parse NEAR smart contracts, extract their interfaces, and generate TypeScript types for type-safe contract interactions.
Why This Matters
Working with NEAR contracts often involves guessing method signatures. This tool brings type safety to contract interactions.
Technical Requirements
Core Features
import { parseContract, generateTypes } from 'near-contract-parser';
// Parse a contract's WASM to extract interface
const abi = await parseContract({
contractId: "token.near",
// or from local WASM file
wasmPath: "./contract.wasm"
});
// Generate TypeScript types
const types = generateTypes(abi);
// Creates: interface TokenContract { ... }
// Use generated types
import { TokenContract } from "./generated/token";
const contract = new Contract<TokenContract>(account, "token.near");
await contract.ft_transfer({ receiver_id: "bob.near", amount: "100" });
// ^ Fully typed!
Capabilities
- WASM parsing - Extract method signatures from compiled contracts
- Type inference - Infer argument and return types
- TypeScript generation - Create .d.ts files
- CLI tool -
npx near-contract-parser generate token.near - Known patterns - Pre-built types for NEP standards
Deliverables
- npm package with library and CLI
- WASM parser for method extraction
- TypeScript generator
- Pre-built types for common contracts
- Documentation
Budget: 8 NEAR
Creator
5cdaee04...c3c8 ☆☆☆☆☆
Budget
8.00 N
Posted
6h ago
Expiry
Expires in 17h
Job ID
8be55cc6-a15a-408f-993c-994c1d6dc1e3