Skip to content

API : Feature

王辰 edited this page Jan 6, 2020 · 2 revisions

<<< Return API Reference

Navigation

Premise

const api = new boxdjs.Api(fetch, <http://xxx>, 'http')
boxdjs.Contract.setProvider('http://xxx', from, privateKey)

Methods

signTxByPrivKey

Sign transaction by private-key.

Parameters

unsigned-transaction: UnsignedTx
private-key-hex: <string>

Returns

signed-transaction

signTxByCrypto

Sign transaction by crypto.json.

Parameters

* SignedTxByCryptoReq {
  unsignedTx: [UnsignedTx](https://github.com/BOXFoundation/box-js/wiki/API-:-Interface#unsignedtx)
  crypto: [Crypto](https://github.com/BOXFoundation/box-js/wiki/API-:-Interface#crypto)
  pwd: <string>
}

makeBoxTxByCryptoUseBoxd

Make BOX transaction by crypto.json [Backend Serialization].

Parameters

* MakeBoxTxByCryptoReq 
{
  tx: {
    from: <string>
    to: <string[]>
    amounts: <number[]>
  }
  crypto: [Crypto](https://github.com/BOXFoundation/box-js/wiki/API-:-Interface#crypto)
  pwd: <string>
}

Returns

hash: <string>

makeBoxTxByCrypto

Make BOX transaction by crypto.json [Local Serialization].

Parameters

* MakeBoxTxByCryptoReq 
{
  tx: {
    from: <string>
    to: <string[]>
    amounts: <number[]>
  }
  crypto: [Crypto](https://github.com/BOXFoundation/box-js/wiki/API-:-Interface#crypto)
  pwd: <string>
}

Returns

hash: <string>

makeSplitTxByCrypto

Make split transaction by crypto.json.

Parameters

* MakeSplitTxByCryptoReq 
{
  tx: {
    from: <string>
    addrs: <string[]>
    weights: <number[]>
  }
  crypto: [Crypto](https://github.com/BOXFoundation/box-js/wiki/API-:-Interface#crypto)
  pwd: <string>
}

Returns

splitAddr: <string>
hash: <string>

issueTokenByCrypto

Issue token by crypto.json.

Parameters

* IssueTokenByCryptoReq 
{
  tx: {
  issuer: <string>;
  owner: <string>;
  tag: {
      decimal: <number>;
      name: <string>;
      supply: <number>;
      symbol: <string>;
    };
  }
  crypto: [Crypto](https://github.com/BOXFoundation/box-js/wiki/API-:-Interface#crypto)
  pwd: <string>
}

Returns

hash: <string>

makeTokenTxByCrypto

Make token transaction by crypto.json.

Parameters

* MakeTokenTxByCryptoReq 
{
  tx: {
    amounts: <number[]>;
    from: <string>;
    to: <string[]>;
    token_hash: <string>;
    token_index: <number>;
  }
  crypto: [Crypto](https://github.com/BOXFoundation/box-js/wiki/API-:-Interface#crypto)
  pwd: <string>
}

Returns

hash: <string>

makeContractTxByPrivKey

Make contract transaction by private_key.

Parameters

* OriginalContractReq 
{
  tx: {
    from: <string>;
    to: <string>;
    amount: <number>;
    gasLimit: <number>;
    nonce: <number>;
    isDeploy: <boolean>;
    data: <string>;
  }
  crypto: [Crypto](https://github.com/BOXFoundation/box-js/wiki/API-:-Interface#crypto)
  pwd: <string>
}

Returns

hash: <string>
contractAddr: <string>

makeContractTxByCrypto

Make contract transaction by crypto.json.

Parameters

* ContractTxByCryptoReq 
{
  tx: {
    from: <string>;
    to: <string>;
    amount: <number>;
    gasLimit: <number>;
    nonce: <number>;
    isDeploy: <boolean>;
    data: <string>;
  }
  crypto: [Crypto](https://github.com/BOXFoundation/box-js/wiki/API-:-Interface#crypto)
  pwd: <string>
}

Returns

hash: <string>
contractAddr: <string>

callContract

Call Contract.

Parameters

* CallContractReq 
{
  from: <string>;
  to: <string>;
  data: <string>;
  height: <number>;
  timeout: <number>;
}

Returns

output: <string>

Clone this wiki locally