# safecustody_sdk

> safecustody wallet api node sdk

Latest version **1.3.0** (published 2021-01-18) · ISC license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.0 |
| Published | 2021-01-18 |
| First published | 2020-11-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 49 |
| Unpacked size | 25.7 KB |
| Known vulnerabilities | 0 (+27 in 5 direct dependencies) |
| Install scripts | no |
| Author | wangxudong |
| Maintainers | chainlife-doc |
| Keywords | wallet, safecustody, chain |

## Links

- npm: https://www.npmjs.com/package/safecustody_sdk
- Repository: https://github.com/chainlife-doc/safecustody_sdk_node
- Homepage: https://github.com/chainlife-doc/safecustody_sdk_node#readme
- Issues: https://github.com/chainlife-doc/safecustody_sdk_node/issues
- npm.io page: https://npm.io/package/safecustody_sdk

## Dependencies (49)

- [qs](https://npm.io/package/qs.md) ^6.5.2
- [ajv](https://npm.io/package/ajv.md) ^6.12.6
- [psl](https://npm.io/package/psl.md) ^1.8.0
- [asn1](https://npm.io/package/asn1.md) ^0.2.4
- [aws4](https://npm.io/package/aws4.md) ^1.11.0
- [jsbn](https://npm.io/package/jsbn.md) ^0.1.1
- [uuid](https://npm.io/package/uuid.md) ^3.4.0
- [axios](https://npm.io/package/axios.md) ^0.21.0
- [sshpk](https://npm.io/package/sshpk.md) ^1.16.1
- [extend](https://npm.io/package/extend.md) ^3.0.2
- [jsprim](https://npm.io/package/jsprim.md) ^1.4.1
- [uri-js](https://npm.io/package/uri-js.md) ^4.4.0
- [verror](https://npm.io/package/verror.md) ^1.10.0
- [getpass](https://npm.io/package/getpass.md) ^0.1.7
- [mime-db](https://npm.io/package/mime-db.md) ^1.44.0
- [request](https://npm.io/package/request.md) ^2.88.2
- [asynckit](https://npm.io/package/asynckit.md) ^0.4.0
- [caseless](https://npm.io/package/caseless.md) ^0.12.0
- [dashdash](https://npm.io/package/dashdash.md) ^1.14.1
- [ecc-jsbn](https://npm.io/package/ecc-jsbn.md) ^0.1.2
- [isstream](https://npm.io/package/isstream.md) ^0.1.2
- [punycode](https://npm.io/package/punycode.md) ^2.1.1
- [aws-sign2](https://npm.io/package/aws-sign2.md) ^0.7.0
- [form-data](https://npm.io/package/form-data.md) ^2.3.3
- [tweetnacl](https://npm.io/package/tweetnacl.md) ^0.14.5
- [extsprintf](https://npm.io/package/extsprintf.md) ^1.3.0
- [har-schema](https://npm.io/package/har-schema.md) ^2.0.0
- [mime-types](https://npm.io/package/mime-types.md) ^2.1.27
- [oauth-sign](https://npm.io/package/oauth-sign.md) ^0.9.0
- [assert-plus](https://npm.io/package/assert-plus.md) ^1.0.0
- [json-schema](https://npm.io/package/json-schema.md) ^0.2.3
- [safe-buffer](https://npm.io/package/safe-buffer.md) ^5.2.1
- [bcrypt-pbkdf](https://npm.io/package/bcrypt-pbkdf.md) ^1.0.2
- [core-util-is](https://npm.io/package/core-util-is.md) ^1.0.2
- [safer-buffer](https://npm.io/package/safer-buffer.md) ^2.1.2
- [tough-cookie](https://npm.io/package/tough-cookie.md) ^2.5.0
- [tunnel-agent](https://npm.io/package/tunnel-agent.md) ^0.6.0
- [forever-agent](https://npm.io/package/forever-agent.md) ^0.6.1
- [har-validator](https://npm.io/package/har-validator.md) ^5.1.5
- [is-typedarray](https://npm.io/package/is-typedarray.md) ^1.0.0
- [delayed-stream](https://npm.io/package/delayed-stream.md) ^1.0.0
- [http-signature](https://npm.io/package/http-signature.md) ^1.2.0
- [combined-stream](https://npm.io/package/combined-stream.md) ^1.0.8
- [fast-deep-equal](https://npm.io/package/fast-deep-equal.md) ^3.1.3
- [performance-now](https://npm.io/package/performance-now.md) ^2.1.0
- [follow-redirects](https://npm.io/package/follow-redirects.md) ^1.13.0
- [json-stringify-safe](https://npm.io/package/json-stringify-safe.md) ^5.0.1
- [json-schema-traverse](https://npm.io/package/json-schema-traverse.md) ^0.4.1
- [fast-json-stable-stringify](https://npm.io/package/fast-json-stable-stringify.md) ^2.1.0

## Recent versions

- 1.3.0 (latest) — 2021-01-18
- 1.2.0 — 2021-01-05
- 1.1.0 — 2020-12-29
- 1.0.1 — 2020-11-20
- 1.0.0 — 2020-11-19

## README

# 赛福托管钱包API Node-SDK  

### 安装SDK
``` npm i safecustody_sdk ```
    
# 例子

#### 创建sdkApi
 ```js
SDK = require("safecustody_sdk")
var config = {
    "userid": "26",//对应商户后台的商户id
    "appid": "",//对应商户后台的APPID
    "secretKey": "",//对应商户后台的SECRETKEY
    "apiKey":"",//对应商户后台的APIKEY
    "host": "",//TODO 请向微信群的官方人员获取
}

sdk = new SDK()
sdk.setConfig(config)
``` 

#### [单个币种查询](https://github.com/chainlife-doc/wallet-api/blob/master/%E5%8D%95%E5%B8%81%E7%A7%8D%E4%BF%A1%E6%81%AF%E6%9F%A5%E8%AF%A2.md)
```js
 // 传入查询的币名
sdk.QueryCoinConf("btc").then(function (data) {
    console.log(data.data)
})
```

#### [查询全部币种信息](https://github.com/chainlife-doc/wallet-api/blob/master/%E6%9F%A5%E8%AF%A2%E5%B8%81%E7%A7%8D%E4%BF%A1%E6%81%AF.md)
```js
sdk.QueryCoins().then(function (data) {
    console.log(data.data)
})
```

#### [查询余额](https://github.com/chainlife-doc/wallet-api/blob/master/%E6%9F%A5%E8%AF%A2%E4%BD%99%E9%A2%9D.md)
```js
sdk.QueryBalance([{"chain": "eth", "coin": "usdt"}]).then(function (data) {
    console.log(data.data)
})
```

#### [获取充值地址](https://github.com/chainlife-doc/wallet-api/blob/master/deposit/%E8%8E%B7%E5%8F%96%E5%85%85%E5%80%BC%E5%9C%B0%E5%9D%80.md)
```js
// string coin 币名           
// string chain 链名          
// string subuserid 你的用户id
sdk.GetDepositAddr([{"chain": "trx", "coin": "trx", "subuserid": "1"}]).then(function (data) {
    console.log(data.data)
})
```

#### [获取充值记录](https://github.com/chainlife-doc/wallet-api/blob/master/deposit/%E8%8E%B7%E5%8F%96%E5%85%85%E5%80%BC%E8%AE%B0%E5%BD%95.md)
```js
// string coin 币名 (空字符串默认不做筛选)                                        
// string chain 主链 (空字符串默认不做筛选)                                        
// string subuserid 你的用户id                               
// int fromid 从哪个充值序号开始，值大于等于1,查询结果包含fromId对应的充值记录       
// int limit 最多查询多少条记录，包含fromid这条记录                      
sdk.GetDepositHistory(subuserId = "1", chain = "trx", coin = "trx", fromId = 0, limit = 100).then(function (data) {
    console.log(data.data)
})
```

#### [内部地址查询](https://github.com/chainlife-doc/wallet-api/blob/master/internal-addr/%E5%86%85%E9%83%A8%E5%9C%B0%E5%9D%80%E6%9F%A5%E8%AF%A2.md)
```js
// string coin 币名      
// string chain 链名     
// string addr 要查询的内部地址
sdk.QueryIsInternalAddr(coin = "trx", chain = "trx", addr = "").then(function (data) {
    console.log(data.data)
})
```

#### [提交提币工单](https://github.com/chainlife-doc/wallet-api/blob/master/withdraw/%E6%8F%90%E4%BA%A4%E6%8F%90%E5%B8%81%E5%B7%A5%E5%8D%95.md)
```js
// coin 币名                        
// chain 链名                       
// subuserid 你的用户id             
// addr 提币地址                      
// amount 提币数量                    
// memo 该字段主要提供给链上支持备注的币种，内容会更新到链上     
// usertags 用户标签, 自定义内容，一般作为订单备注使用,辅助说明
// user_orderid 用户自定义订单ID，该字段主要是填写用户系统的订单流水号，字段具有唯一性（可选字段)
sdk.SubmitWithdraw(subuserid = "1", chain = "trx", coin = "trx", addr = "", amount = "1", memo = "中国", usertags = "深圳",user_orderid="1").then(function (data) {
    console.log(data.data)
})
```

#### [提币预校验](https://github.com/chainlife-doc/wallet-api/blob/master/withdraw/%E6%8F%90%E5%B8%81%E9%A2%84%E6%A0%A1%E9%AA%8C%E6%8E%A5%E5%8F%A3.md)
```js
// string coin 币名                         
// string chain 链名                        
// string subuserid 你的用户id              
// string addr 提币地址                       
// string amount 提币数量                     
// string memo 该字段主要提供给链上支持备注的币种，内容会更新到链上           
// string usertags 用户标签, 自定义内容，一般作为订单备注使用,辅助说明 
// user_orderid  用户自定义订单ID，该字段主要是填写用户系统的订单流水号，字段具有唯一性（可选字段)
sdk.ValidateWithdraw(subuserid = "1", chain = "trx", coin = "trx", addr = "", amount = "1", memo = "中国", usertags = "深圳",user_orderid="1").then(function (data) {
    console.log(data.data)
})
```

#### [查询工单状态](https://github.com/chainlife-doc/wallet-api/blob/master/withdraw/%E6%9F%A5%E8%AF%A2%E6%8F%90%E5%B8%81%E5%B7%A5%E5%8D%95%E7%8A%B6%E6%80%81.md)
```js
// string coin 币名          
// string chain 链名         
// string withdrawid 提币订单ID
sdk.QueryWithdrawStatus(coin = "trx", chain = "trx", withdrawid = "").then(function (data) {
    console.log(data.data)
})
```

#### [查询历史提币记录](https://github.com/chainlife-doc/wallet-api/blob/master/withdraw/%E6%9F%A5%E8%AF%A2%E6%8F%90%E5%B8%81%E8%AE%B0%E5%BD%95.md)
```js
// string coin 币名                                           
// string chain 链名                                          
// string subuserid 你的用户id                                 
// int fromid 从哪个充值序号开始，值大于等于1,查询结果包含fromId对应的充值记录          
// int limit 最多查询多少条记录，包含fromid这条记录                         
sdk.QueryWithdrawHistory(subuserId = "1", chain = "trx", coin = "trx", fromId = 0, limit = 100).then(function (data) {
    console.log(data.data)
})
```

#### [取消提币接口](https://github.com/chainlife-doc/wallet-api/blob/master/withdraw/%E5%8F%96%E6%B6%88%E6%8F%90%E5%B8%81%E6%8E%A5%E5%8F%A3.md)
```js
// string coin 币名                                           
// string chain 链名                                          
// string subuserid 你的用户id  
// string withdrawid 提币订单ID
sdk.WithdrawCancel(subuserId = "1", chain = "trx", coin = "trx", withdrawid = "").then(function (data) {
    console.log(data.data)
})
```
#### [查询加点高度](https://github.com/chainlife-doc/wallet-api/blob/master/%E6%9F%A5%E8%AF%A2%E5%B8%81%E7%A7%8D%E8%8A%82%E7%82%B9%E9%AB%98%E5%BA%A6.md)
```js
// string coin 币名                                           
// string chain 链名   
sdk.BlockHeight(chain = "trx", coin = "trx").then(function (data) {
    console.log(data.data)
})
```

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