1.3.0 • Published 3 years ago
safecustody_sdk v1.3.0
赛福托管钱包API Node-SDK
安装SDK
npm i safecustody_sdk
例子
创建sdkApi
SDK = require("safecustody_sdk")
var config = {
"userid": "26",//对应商户后台的商户id
"appid": "",//对应商户后台的APPID
"secretKey": "",//对应商户后台的SECRETKEY
"apiKey":"",//对应商户后台的APIKEY
"host": "",//TODO 请向微信群的官方人员获取
}
sdk = new SDK()
sdk.setConfig(config)
单个币种查询
// 传入查询的币名
sdk.QueryCoinConf("btc").then(function (data) {
console.log(data.data)
})
查询全部币种信息
sdk.QueryCoins().then(function (data) {
console.log(data.data)
})
查询余额
sdk.QueryBalance([{"chain": "eth", "coin": "usdt"}]).then(function (data) {
console.log(data.data)
})
获取充值地址
// string coin 币名
// string chain 链名
// string subuserid 你的用户id
sdk.GetDepositAddr([{"chain": "trx", "coin": "trx", "subuserid": "1"}]).then(function (data) {
console.log(data.data)
})
获取充值记录
// 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)
})
内部地址查询
// string coin 币名
// string chain 链名
// string addr 要查询的内部地址
sdk.QueryIsInternalAddr(coin = "trx", chain = "trx", addr = "").then(function (data) {
console.log(data.data)
})
提交提币工单
// 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)
})
提币预校验
// 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)
})
查询工单状态
// string coin 币名
// string chain 链名
// string withdrawid 提币订单ID
sdk.QueryWithdrawStatus(coin = "trx", chain = "trx", withdrawid = "").then(function (data) {
console.log(data.data)
})
查询历史提币记录
// 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)
})
取消提币接口
// 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)
})
查询加点高度
// string coin 币名
// string chain 链名
sdk.BlockHeight(chain = "trx", coin = "trx").then(function (data) {
console.log(data.data)
})