# vdsjs

> The VDS JavaScript library for Smart Contract development.

Latest version **1.0.3** (published 2020-05-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install vdsjs
pnpm add vdsjs
yarn add vdsjs
bun add vdsjs
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2020-05-23 |
| First published | 2020-05-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 316.6 KB |
| Known vulnerabilities | 0 (+24 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | vzone |

## Links

- npm: https://www.npmjs.com/package/vdsjs
- npm.io page: https://npm.io/package/vdsjs

## Dependencies (5)

- [btoa](https://npm.io/package/btoa.md) ^1.1.2
- [axios](https://npm.io/package/axios.md) ^0.18.1
- [url-parse](https://npm.io/package/url-parse.md) ^1.4.7
- [eventemitter3](https://npm.io/package/eventemitter3.md) ^2.0.3
- [qtumjs-ethjs-abi](https://npm.io/package/qtumjs-ethjs-abi.md) ^1.0.3

## Recent versions

- 1.0.3 (latest) — 2020-05-23
- 1.0.2 — 2020-05-23
- 1.0.1 — 2020-05-09
- 1.0.0 — 2020-05-09

## README

The VDS JavaScript library for Smart Contract development.

# Install

```
npm install vdsjs
```

This is a sample code snippet that transfer ERC20 tokens:

```js
import { VdsRPC } from "vdsjs"

const repoData = require("./solar.json")
const vds = new Vds("http://vds:test@localhost:3889", repoData)

const myToken = vds.contract(
  "zeppelin-solidity/contracts/token/CappedToken.sol",
)

async function transfer(fromAddr, toAddr, amount) {
  const tx = await myToken.send("transfer", [toAddr, amount], {
    senderAddress: fromAddr,
  })

  console.log("transfer tx:", tx.txid)
  console.log(tx)

  await tx.confirm(3)
  console.log("transfer confirmed")
}
```
This is a sample code snippet that sample contract:
```js
const {Contract, VdsRPC} = require("vdsjs")
const rpc = new VdsRPC("/")
const contractInfo = require("./MilFold.json");
const milFold = new Contract(rpc, contractInfo);

//单参数
function getHistoryRoundInfo(args) {

  let callResult = milFold.call("getHistoryRoundInfo", args);//返回16进制数据
  callResult.then(data => {
    console.log(JSON.stringify(data));
    console.log(JSON.stringify(data.outputs));
  });

  let funcArgs = [];
  funcArgs.push(args)

  let callParseData = milFold.callFunc("getHistoryRoundInfo", funcArgs);//返回10进制数据
  callParseData.then(data => {
    console.log(JSON.stringify(data));
  });
}
//多参数
function getPlayerRoundNums(...args) {

  let callArgs = [];
  callArgs.push(args[0][0])
  callArgs.push(args[1][0])

  let callResult = milFold.call("getPlayerRoundNums", callArgs);
  callResult.then(data => {
    console.log(JSON.stringify(data));
    console.log(JSON.stringify(data.outputs));
  });

  let funcArgs = [];
  funcArgs.push(args[0])
  funcArgs.push(args[1])

  let callParseData = milFold.callFunc("getPlayerRoundNums", funcArgs);
  callParseData.then(data => {
    console.log(JSON.stringify(data));
  });
}

let chaindemo = {
  getHistoryRoundInfo: function (args) {
    getHistoryRoundInfo(args);
  },
  getPlayerRoundNums: function (...args) {
    getPlayerRoundNums(...args);
  }
};

export default chaindemo;

```

---
_Source: https://npm.io/package/vdsjs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
