New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

myvetools

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

myvetools

Tools for interacting with VeChainThor

  • 1.4.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

MyVeTools

Tools for operating VeChain Thor.

Installation

npm i myvetools

Management of Solidity Compiler

To download a particular Solidity compiler version

node_modules/.bin/solcver -d <VERSION>

To use a downloaded compiler version

node_modules/.bin/solcver -u <VERSION>

Usage

CMD Tools

To create a template TS file for testing smart contracts

node_modules/.bin/mvt -c <FileName>

Package builtin

This package defines the deployed addresses and ABIs of the built-in smart contracts.

To get ABI of function energy from contract Prototype:

const abi = getBuiltinABI('prototype', 'energy', 'function')

You can import soloAccounts to get the 10 default accounts in the solo mode of the thor client >=1.5.0.

Package utils

To get ABI:

const abi = JSON.parse(
	compileContract(solFilePath, contractName, 'abi')
)

To get bytecode:

const bytecode = compileContract(solFilePath, contractName, 'bytecode')

To get a function ABI:

const abiFunc = getABI(abiContract, funcName, 'function')

Check test/utils.test.ts for more examples.

Package connexUtils

This package defines functions that interact directly with a Thor network. It includes functions:

  • deployContract - to deploy a smart contract
  • contractCallWithTx - to call a contract function that changes the contract storage
  • contractCall - to call a contract function that does not change the contract storage
  • getReceipt - to get the receipt of a transaction
  • decodeEvent - to decode a logged event

See test/connexUitls.test.ts for examples.

Package contract

This package is designed to make it easier to operate a contract.

To create a Contract instance:

const c = new Contract({abi: contractABI})

To deploy the contract:

// Set bytecode
c.bytecode(bin)

// Assume that the constructor is of no inputs and doesn't need transfer any value. Method deploy generates the clause for deploying the contract.
const clause = c.deploy(0)

// Construct and send the transaction. Here `connex` is an instance that implements the Connex interface.
const output = await connex.vendor.sign('tx', [clause]).request()

To send a transaction to call function set(uint256):

// Set deployed contract address
c.at(deployedContractAddress)

// Method send generates the clause that calls the function
const clause = c.send('set', 0, newValue)

// Construct and send the transaction.
const output = await connex.vendor.sign('tx', [clause]).request()

To call function get:

c.connex(connex)

const output = await c.call('get')

See test/contract.test.ts for more examples.

Test

To test package connexUtils, you will have to run the Thor client in the solo mode.

FAQs

Package last updated on 26 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc