1.0.1 • Published 4 years ago

wanchain-sc-sdk v1.0.1

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
4 years ago

wanchain-sc-sdk

SDK for deploying smart contracts on Wanchain.

Installation

Use NPM or Yarn to install the package:

npm install --save wanchain-sc-sdk

Configuration

Before deploying smart contracts, some config items are required.

Choose to deploy on "mainnet" or "testnet", default is mainnet.

Wanchain node for web3 to connect and send transactions, http and wss connections are supported, default is iWan.

Private key of deployer. No default.

Contracts source code directory, it should be absolute path, can include subfolders. No default.

Directory to output deployment information, it should be absolute path, default is homedir of user.

Default is 180 Gwin.

Default is 8 million.

APIs

Config SDK.

Compile a contract, can be skipped if contract name is consistent with it's source file name and not need to link any library.

Link libraries to a contract, can be skipped if not need to link any library.

Deploy a contract.

Send a transaction to contract.

Get a instance of contract which is deployed before.

Usage

Step 1: Create a deployment script file, deploy.js for example.

Step 2: Import wanchain-sc-sdk package.

const deployer = require('wanchain-sc-sdk');

Step 3: Config the deployer.

const cfg = {
  privateKey: 'your-private-key',
  contractDir: 'contracts-directory',
  ......
}
deployer.config(cfg);

Step 4: Compose deployment scripts.

example

Step 5: Start to deploy.

node deploy.js
1.0.1

4 years ago

1.0.0

4 years ago