Fox.ONE Js-Open-SDK

安装

依赖 axios

npm install foxone-js-opensdk

使用

1、html 引入

// 先引入 axios 
<script src="[your path]/axios.js"></script>
<script src="[node_modules]/foxone-js-opensdk/dist/FoxSDK.js"></script>

<script>
// load assets
FoxSDK.loadAssets.then(assets => {
  // code
}).catch(err => {
  // handle error
})
</script>

2、js 引入

import FoxSDK from 'foxone-js-opensdk'

// load assets
FoxSDK.loadAssets().then(assets => {
  // code
}).catch(err => {
  // handle error
})

Account

Account module

Account.modifyPIN(pin, newPin) ⇒ Promise

setup or modify your pin.

Kind: static method of Account
Fulfil: Object - result of modify pin.
Reject: Error - request Error.

Param Type Description
pin string pin for now. ‘’ when setting pin for the first time.
newPin string pin to set, a string of 6 digits.

Account.verifyPIN(pin) ⇒ Promise

verify pin.

Kind: static method of Account
Fulfil: Object - result of verify pin.
Reject: Error - request error.

Param Type Description
pin string pin for now, a string of 6 digits.

Account.getAccountDetail() ⇒ Promise

get login user account detail.

Kind: static method of Account
Fulfil: User - user account object.
Reject: error - request error.

Wallet.loadAssets() ⇒ Promise

load all assets in the wallet.

Kind: static method of Wallet
Fulfil: Array - all assets details.
Reject: Error - request error.

Wallet.loadAsset(id) ⇒ Promise

load an asset by assetId.

Kind: static method of Wallet
Fulfil: Object - asset detail.
Reject: Error - request error.

Param Type Description
id string the assetId for the asset to load.

Wallet.loadEnabledCoins() ⇒ Promise

load available coins for deposit.