near-contract-parser
v1.0.0
Published
Parse NEAR smart contract WASM code.
Downloads
1,352
Maintainers
Readme
NEAR Contract Parser
Collection of utilities for parsing base64-encoded WASM smart contracts on NEAR Protocol, extracting exported members, and detecting likely candidates for standard contract interface implementation.
Usage
Installation
$ npm install --save near-contract-parser
Example
const { Near, keyStores } = require('near-api-js');
const { parseContract } = require('near-contract-parser');
const near = new Near({
networkId: 'mainnet',
keyStore: new keyStores.InMemoryKeyStore(),
nodeUrl: 'https://rpc.mainnet.near.org',
walletUrl: 'https://wallet.mainnet.near.org',
helperUrl: 'https://helper.mainnet.near.org',
explorerUrl: 'https://explorer.mainnet.near.org',
});
(async () => {
const account_id = 'CONTRACT_ACCOUNT_ID.near';
const { code_base64 } = await near.connection.provider.query({
account_id,
finality: 'final',
request_type: 'view_code',
});
console.log(parseContract(code_base64));
})();
Authors
- Jacob Lindahl [email protected] @sudo_build