-
Notifications
You must be signed in to change notification settings - Fork 0
rest api_CN
leolianger edited this page Jul 3, 2019
·
18 revisions
接口数据类型 | 请求方法 | 类型 | 描述 | 需要验签 |
---|---|---|---|---|
交易品种信息 | GET /symbols | GET | 交易对的计价货币和报价精度 | N |
交易品种信息 | GET /currencies | GET | 交易币种列表 | N |
市场行情 | GET /tickers | GET | 全部symbol或单个symbol的24小时的价格变化 | N |
市场行情 | GET /depth | GET | 单个symbol的市场深度行情 | N |
市场行情 | GET /klines | GET | 单个symbol的K线 | N |
市场行情 | GET /trades | GET | 单个symbol的成交记录 | N |
账户信息 | GET /balance/ | GET | 查询用户的账户状态 | Y |
用户订单信息 | GET /orders/open/ | GET | 获取用户单个或者所有symbol的open订单 | N |
用户订单信息 | GET /orders/closed/ | GET | 获取用户单个或者所有symbol的closed订单 | N |
用户订单信息 | GET /orders/{id} | GET | 根据orderid查询订单详情 | N |
用户订单信息 | GET /orders/trades | GET | 获取用户的历史成交详情 | N |
充提币及转币信息 | GET /depositaddress | GET | 获取充值地址 N | |
充提币及转币信息 | GET /withdrawals | GET | 查询提币信息 | N |
充提币及转币信息 | GET /deposits | GET | 查询充币信息 | N |
充提币及转币信息 | GET /transfers | GET | 查询转账记录 | N |
交易 | POST /transaction | POST | 创建订单 | Y |
交易 | POST /transaction | POST | 取消订单 | Y |
提币和转账 | POST /transaction | POST | 申请提币 | Y |
提币和转账 | POST /transaction | POST | 申请转账 | Y |
请求参数: (无)
响应数据:
symbol list
请求响应例子:
[
{
"symbol": "68719476706", // market symbol, unique,在其它接口中,如果需要使用symbol标明market,请使用这个symbol
"name": "ETH/BTC", // market symbol name, non-unique
"base": "2", // base coin currency
"quote": "32", // quote coin currency
"baseName": "ETH", // base coin code
"quoteName": "BTC", // quote coin code
"active": true,
"maker": "0.0008", // maker fee
"taker": "0.0008", // taker fee
"precision": { // number of decimal digits "after the dot"
"amount": 8, // 交易时,amount的精度,代表小数点后的最大位数
"price": 10 // 交易时,price的精度,代表小数点后的最大位数
},
"limits": {
"amount": {
"min": "0.00000001", // 交易时,amount的最小值
"max": "-1" // 当值为-1时,代表没有上限
},
"price": {
"min": "0.0000000001", // 交易时,price的最小值
"max": "-1" // 当值为-1时,代表没有上限
}
}
}
]
请求参数:
(无)
响应数据:
currency list
[
{
"code": "32", // currency id, unique,在其它接口中,如果需要使用currency信息,请使用这个id
"name": "BTC", // currency name, non-unique
"type": "crypto",
"fullname": "Bitcoin",
"active": true,
"basePrecision": 18, // 在ByteTrade链上,1个BTC将表示为1000000000000000000的整数
"transferPrecision": 10, // 在ByteTrade链上,转账最小值为0.0000000001
"externalPrecision": 8, // 在BTC的链上,最小单位为0.00000001
"chainType":"bitcoin",
"chainContractAddress": "",
"limits": {
"deposit": {
"min": "0.001", // pixiu 系统支持的最小充值数量,需要再确认下接口
"max": "-1" // 当值为-1时,代表没有上限
},
"withdraw": {
"min": "0.01", // pixiu 系统支持的最小充值数量,需要再确认下接口
"max": "-1" // 当值为-1时,代表没有上限
}
}
}
]
请求参数:
参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
---|---|---|---|---|---|
symbol | false | string | 交易对symbol | 68719476706, 4294967297, ... |
响应数据:
ticker list
请求响应例子:
[
{
"symbol": "68719476706", // unique id, unique
"name": "ETH/BTC", // string symbol of the market, non-unique
"base": "2", // base coin id
"quote": "32", // quote coin id
"timestamp": 1559124034283, // int (64-bit Unix Timestamp in milliseconds since Epoch 1 Jan 1970)
"datetime": "2019-05-29T10:00:34.283Z", // ISO8601 datetime string with milliseconds
"high": "0.031526", // highest price
"low": "0.030771", // lowest price
"open": "0.031009", // opening price
"close": "0.031035", // price of last trade (closing price for current period)
"last": "0.031035", // same as `close`, duplicated for convenience
"change": "2.6e-05", // absolute change, `last - open`
"percentage": "0.084", // relative change, `(change/open) * 100`
"baseVolume": "209771.771", // volume of base currency traded for last 24 hours
"quoteVolume": "6519.97393184" // volume of quote currency traded for last 24 hours
}
]
请求参数:
参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
---|---|---|---|---|---|
symbol | true | string | 交易对symbol | 68719476706, 4294967297, ... | |
limit | false | int | asks或bids个数 | [1,100] | |
type | false | string | 深度的价格聚合度,step0时无聚合,step1\2\3\4\5分别代表聚合度为报价精度*10\100\1000\10000\100000 | step0 | step0,step1,step2,step3,step4,step5 |
响应数据:
depth dict
请求响应例子:
{
"bids": [
[
"0.031138", // price
"0.05" // amount
],
[
"0.031137",
"1.94"
],
[
"0.031136",
"0.236"
]
],
"asks": [
[
"0.031147",
"14.237"
],
[
"0.031149",
"0.033"
],
[
"0.03115",
"0.417"
],
[
"0.031151",
"0.755"
],
"timestamp": 1559549045008,
"datetime": "2019-06-03T08:04:05.008Z"
}
请求参数:
参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
---|---|---|---|---|---|
symbol | true | string | 交易对symbol | 68719476706, 4294967297, ... | |
timeframe | true | string | K线类型 | 1m, 5m,15m,30m,1h,4h,1d,5d,1w,1M | |
since | false | int | K线开始时间(utc毫秒),如果不设置这个值,则默认获取从当前时刻向前的limit个kline | ||
limit | false | int | K线数据个数 | 100 | [1,500] |
响应数据:
kline list
请求响应例子:
[
[
1559574540000, // UTC timestamp in milliseconds, integer
"0.030753", // (O)pen price, String
"0.030778", // (H)ighest price
"0.030752", // (L)owest price
"0.030778", // (C)losing price
"30.716" // (V)olume (in terms of the base currency)
],
[
1559574600000,
"0.030778",
"0.030789",
"0.030775",
"0.030775",
"86.1294"
]
]
请求参数:
参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
---|---|---|---|---|---|
symbol | true | string | 交易对symbol | 68719476706, 4294967297, ... | |
since | false | int | 获取trade开始时间(utc毫秒),如果不设置这个值,则默认获取从当前时刻向前的limit个trade | ||
limit | false | int | trades数据个数 | 100 | [1,500] |
响应数据:
trade list
请求响应例子:
[
{
"id": "6863a873ed87443bfc8bd759451d5c9ec4a2dafc", // string trade id
"timestamp": 1559633809458, // Unix timestamp in milliseconds
"datetime": "2019-06-04T07:36:49.458Z", // ISO8601 datetime with milliseconds
"symbol": "68719476706", // symbol
"name": "ETH/BTC", // symbol name
"side": "buy", // direction of the trade, "buy" or "sell"
"price": "0.031118", // price in quote currency
"amount": "0.2379", // amount of base currency
"cost": "0.0074029722" // amount of quote currency
}
]
请求参数:
参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
---|---|---|---|---|---|
userid | true | string | 用户id | Aquila, ... |
响应数据:
balance list
请求响应例子:
[
{
"code": "32", // string coin id
"name": "BTC", // string coin name
"free": "0.23", // money available for trading
"used": "0.03", // money on hold, locked, frozen or pending
"total": "0.26" // total balance (free + used)
}
]
请求参数:
参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
---|---|---|---|---|---|
userid | true | string | 用户id | Aquila, , ... | |
symbol | false | string | 交易对symbol | 68719476706, 4294967297, ... | |
since | false | int | 获取openorder的开始时间(utc毫秒),如果不设置这个值,则默认获取从当前时刻向前的limit个openorder | ||
limit | false | int | openorder数据个数 | 100 | [1,100] |
响应数据:
open order list
[
{
"id": "12345-67890:09876/54321", // string
"txid": "42d225b12d97441e709c741e1f99b377ec3a3822" // tx_id in bytetrade
"datetime": "2017-08-17 12:42:48.000", // ISO8601 datetime of "timestamp" with milliseconds
"timestamp": 1502962946216, // order placing/opening Unix timestamp in milliseconds
"lastTradeTimestamp": 1502962956216, // Unix timestamp of the most recent trade on this order
"status": "open", // "open"
"symbol": "68719476706", // symbol Id
"name": "ETH/BTC", // symbol name
"type": "limit", // "market", "limit"
"side": "buy", // "buy", "sell"
"price": "0.029", // float price in quote currency
"average": "0",
"amount": "0.000294", // ordered amount of base currency
"filled": "0", // filled amount of base currency
"remaining": "0.000294", // remaining amount to fill
"cost": "0", // "filled" * "price" (filling price used where available)
"fee": { // fee info, if available
"code": "32", // which currency the fee is (usually quote)
"name": "BTC",
"cost": "0", // the fee amount in that currency
"rate": "0", // the fee rate (if available)
}
]
请求参数:
参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
---|---|---|---|---|---|
userid | true | string | 用户id | Aquila, , ... | |
symbol | false | string | 交易对symbol | 68719476706, 4294967297, ... | |
since | false | int | 获取closedorder的开始时间(utc毫秒),如果不设置这个值,则默认获取从当前时刻向前的limit个closedorder | ||
limit | false | int | closedorder数据个数 | 100 | [1,100] |
响应数据:
closed order list
请求响应例子:
[
{
"id": "a7922889b77005bae42b48cd15db3849a1e89d4b", // string
"txid": "42d225b12d97441e709c741e1f99b377ec3a3822", // tx_id in bytetrade
"datetime": "2017-08-17 12:42:48.000", // ISO8601 datetime of "timestamp" with milliseconds
"timestamp": 1502962946216, // order placing/opening Unix timestamp in milliseconds
"lastTradeTimestamp": 1502962956216, // Unix timestamp of the most recent trade on this order
"status": "closed", // "closed"
"symbol": "68719476706", // symbol Id
"name": "ETH/BTC", // symbol name
"type": "limit", // "market", "limit"
"side": "buy", // "buy", "sell"
"price": "0.03413801", // float price in quote currency
"average": "0.03413801", // money/filled
"amount": "0.001", // ordered amount of base currency
"filled": "0.001", // filled amount of base currency
"remaining": "0", // remaining amount to fill
"cost": "0.000034138432", // "filled" * "price" (filling price used where available)
"fee": { // fee info, if available
"code": "32", // which currency the fee is (usually quote)
"name": "BTC",
"cost": "0", // the fee amount in that currency
"rate": "0", // the fee rate (if available)
}
}
]
请求参数:
参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
---|---|---|---|---|---|
orderid | true | string | 订单id | a7922889b77005bae42b48cd15db3849a1e89d4b, , ... |
响应数据:
order info dict
请求响应例子:
{
"id": "a7922889b77005bae42b48cd15db3849a1e89d4b", // string
"txid": "909108605661dfd3e6d85ae2a9faceb524dce733", // tx_id in bytetrade
"datetime": "2017-08-17 12:42:48.000", // ISO8601 datetime of "timestamp" with milliseconds
"timestamp": 1502962946216, // order placing/opening Unix timestamp in milliseconds
"lastTradeTimestamp": 1502962956216, // Unix timestamp of the most recent trade on this order
"status": "closed", // "open", "closed", 如果一个订单没有成交,而就被取消掉,通过此接口不会查询到
"symbol": "68719476706", // symbol Id
"name": "ETH/BTC", // symbol name
"type": "limit", // "market", "limit"
"side": "buy", // "buy", "sell"
"price": "0.03413801", // float price in quote currency
"amount": "0.001", // ordered amount of base currency
"filled": "0.001", // filled amount of base currency
"remaining": "0", // remaining amount to fill
"cost": "0.000034138432", // "filled" * "price" (filling price used where available)
"fee": { // fee info, if available
"code": "32", // which currency the fee is (usually quote)
"name": "BTC",
"cost": "0", // the fee amount in that currency
"rate": "0", // the fee rate (if available)
}
}
请求参数:
参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
---|---|---|---|---|---|
userid | true | string | 用户id | Aquila, , ... | |
symbol | false | string | 交易对symbol | 68719476706, 4294967297, ... | |
orderid | false | string | 订单id | a7922889b77005bae42b48cd15db3849a1e89d4b, , ... | |
since | false | int | 获取用户trade的开始时间(utc毫秒),如果不设置这个值,则默认获取从当前时刻向前的limit个trade | ||
limit | false | int | 用户trade个数 | 100 | [1,100] |
响应数据:
matchresults info list
[
{
"id": "3b185509047d385381fa1ec4d975ebb0d41c97c3", // string trade id
"txid": "909108605661dfd3e6d85ae2a9faceb524dce733", // tx_id in bytetrade
"timestamp": 1502962946216, // Unix timestamp in milliseconds
"datetime": "2017-08-17 12:42:48.000", // ISO8601 datetime with milliseconds
"symbol": "4294967297", // symbol
"name": "ETH/BTC", // symbol name
"order": "d891f26f8cbc08e27434eb9ab9fb937ee1e7e438", // string order id or undefined/None/null
"type": "limit", // order type, "market", "limit" or undefined/None/null
"side": "sell", // direction of the trade, "buy" or "sell"
"takerOrMaker": "taker", // string, "taker" or "maker"
"price": "0.00007412", // float price in quote currency
"amount": "27.29041663", // amount of base currency
"cost": "0.0020227656806156", // total cost (including fees), `price * amount`
"fee": { // provided by exchange or calculated by ccxt
"cost": "0.0000016182125445", // float
"code": "32", // usually base currency for buys, quote currency for sells
"name": "BTC",
"rate": 0.002, // the fee rate (if available)
}
}
]
请求参数:
参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
---|---|---|---|---|---|
userid | true | string | 用户id | Aquila, , ... | |
code | false | string | currency的code | 2, 3, ... |
响应数据:
deposit address
[
{
"code": "2", // currency code
"name": "ETH",
"chainType":"ethereum", // 充值链类型,当前支持ethereum/naka/cmt/bitcoin
"address": "0x10c03cde1395e8e1e7626b890384c9897f7f597b", // address in terms of requested currency
"tag": "" // tag / memo / paymentId for particular currencies (XRP, XMR, ...)
}
]
请求参数:
参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
---|---|---|---|---|---|
userid | true | string | 用户id | Aquila, , ... | |
code | false | string | currency的code | 2, 3, ... | |
since | false | int | 获取用户withdraw的开始时间(utc毫秒),如果不设置这个值,则默认获取从当前时刻向前的limit个withdraw | ||
limit | false | int | withdraw数据个数 | 100 | [1,100] |
响应数据:
withdrawal list
[
{
"id": "e523e01b778e377c9bbc3a883305409c3774efb1",
"txid": "0xc42f1611d795cb5a9bda63af4a9fd28c7958a18d908bf1750ccfea9ace88d48f", // 对应外部链上的转账信息,当前从listWithdraws没有找到这个,但是从区块浏览器中可以看到,需要确认下如何获取
"timestamp": 1553134089103,
"datetime": "2019-03-21T02:08:09.103Z",
"address": "0x32d74896f05204d1b6ae7b0a3cebd7fc0cd8f9c7",
"tag": "",
"type": "withdrawal",
"amount": 10,
"code": "3",
"name": "KCASH",
"status": "succeed",
"updated": 1553134584448,
"fee": {
"code": "3",
"name": "KCASH",
"cost": "0",
"rate": "0"
}
}
]
请求参数:
参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
---|---|---|---|---|---|
userid | true | string | 用户id | Aquila, , ... | |
code | false | string | currency的id | 2, 3, ... | |
since | false | int | 获取用户deposit的开始时间(utc毫秒),如果不设置这个值,则默认获取从当前时刻向前的limit个deposit | 0 | |
limit | false | int | deposit数据个数 | 100 | [1,100] |
响应数据:
deposit list
[
{
"id": "7b52aeb2d8f624d16ef0473defdd8d39db057c02",
"txid": "0xdfa9724b0f269a2b2eecd952c6b369320febce047938772fff6f129322bf632c", // 对应外部链上的转账信息,当前从listWithdraws没有找到这个,但是从区块浏览器中可以看到,需要确认下如何获取
"timestamp": 1553134089103,
"datetime": "2019-03-21T02:08:09.103Z",
"address": "0x10c03cde1395e8e1e7626b890384c9897f7f597b",
"tag": "",
"type": "deposit",
"amount": "0.01030928",
"code": "2",
"name":"ETH",
"status": "succeed",
"updated": 1553134584448,
"fee": {
"code": "2",
"name": "ETH",
"cost": "0",
"rate": "0"
}
}
]
请求参数:
参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
---|---|---|---|---|---|
userid | true | string | 用户id | Aquila, , ... | |
code | false | string | currency的id | 2, 3, ... | |
since | false | int | 获取用户transfer的开始时间(utc毫秒),如果不设置这个值,则默认获取从当前时刻向前的limit个transfer | 0 | |
limit | false | int | transfer数据个数 | 100 | [1,100] |
transfer list
请求响应例子:
[
{
"id": "8dd700fde3e0f947e4b52d72950a9fb3261c59d1",
"timestamp": 1553134089103,
"datetime": "2019-03-21T02:08:09.103Z",
"tag": "",
"type": "transfer",
"amount": "-5",
"to":"fly2020",
"from":"gogogo",
"code": "34",
"name": "MT",
"status": "succeed",
"updated": 1553134584448
}
]
请求参数:
参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
---|---|---|---|---|---|
trObj | true | string | 签名及序列化后的创建订单的transaction |
trObjj生成步骤:
// 构造订单对象
var ob = {
fee : 90000, // 手续费
creator: "user123", // 操作人id
side : 2, // 1:卖,2:买
order_type : 1, // 1:limitOrder,2:marketOrder
market_name : 68719476706, // 市场
amount : 98765432100000000, // 数量(注意:该数值计算参考下面的转换说明)
price : 123456780000000000, // 价格,市场价传"0"即可(注意:该数值计算参考下面的转换说明)
now : Math.ceil(Date.now() / 1000),
expiration: Math.ceil(Date.now() / 1000) + 10, // 过期时间
use_btt_as_fee: true, // 是否使用btt作为手续费
freeze_btt_fee: 270000 // 当use_btt_as_fee为true时,冻结的手续费数额
};
// 转换说明:
// 上链数据只有整数,因此需要将满足小数点后位数精度要求的amount和price,分别按照currencies接口中basePrecision的要求转为整数,精度要求和转换方式如下:
// (1) 精度要求:期望买入的amount以及买入时的price,小数点后位数,不能超过symbols接口返回的precision的amount和price中的精度;
// (2) 在精度满足要求后,将amount和price变为整形数据:需要用amount和price分别乘以各自币种的10的basePrecision幂;
// 假如当前市场是ETH/BTC,用户想以限价0.12345678901的价格购买0.0987654321个,从symbols接口中可知,对ETH/BTC交易对,amount的精度要求是10,price的精度要求是8;从currencies接口中可知,ETH和BTC的basePrecision都是18,则计算如下:
// 用户输入的价格0.12345678901,小数点收的有效位数为11,超过了8,应进行截断修改为0.12345678; 用户想要购买的数量为0.0987654321个,小数点后有效位数是10,刚好不超过amount的精度要求;
// 在进行上述处理后,将price 0.12345678*BTC的10的basePrecisio幂,得到上链price为123456780000000000,将amount 0.0987654321 *ETH的10的basePrecision幂,得到上链amount为98765432100000000。
// 若以限价单进行买卖时,price都是对应交易对中的quote currency,amount都是对应交易中的base currency(以ETH/BTC为例,base currency是指ETH,quote currency是指BTC)
// 若以市价单进行买卖,进行买操作时,amount对应的quote currency,进行卖操作时,amount对应的base currency。
// 验证签名
var tr = new bytetrade_js.TransactionBuilder();
tr.validate_type = 0;
tr.dapp = ""; // dapp name
tr.add_type_operation( "order_create", ob );
tr.timestamp = Math.ceil(Date.now() / 1000);
tr.add_signer(privateKey);
tr.finalize().then(() => {
if (!tr.signed) { tr.sign(); }
var tr_object = tr.toObject();
trObject = JSON.stringify(tr_object);
//然后将trObject参数POST到服务器transaction的endpoint即可。
请求参数:
参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
---|---|---|---|---|---|
trObj | true | string | 签名及序列化后的取消订单的transaction |
trObj生成步骤:
// 构造订单对象
var ob = {
fee : 90000, // 手续费
creator: "user123", // 操作人id
order_id : "a7922889b77005bae42b48cd15db3849a1e89d4b", // 订单id
market_name : 68719476706 // 订单市场
};
var tr = new bytetrade_js.TransactionBuilder();
tr.validate_type = 0;
tr.dapp = ""; // dapp name
tr.add_type_operation( "order_cancel", ob );
tr.timestamp = Math.ceil(Date.now() / 1000);
tr.add_signer(privateKey);
tr.finalize().then(() => {
if (!tr.signed) { tr.sign(); }
var tr_object = tr.toObject();
trObject = JSON.stringify(tr_object);
//然后将trObject参数POST到服务器transaction的endpoint即可。
请求参数:
参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
---|---|---|---|---|---|
trObj | true | string | 签名及序列化后的创建订单的transaction |
trObj生成步骤:
// 构建提币对象
let tr = new Trbuilder()
tr.add_type_operation("withdraw", ob)
tr.dapp = "dapp";// dapp地址
tr.propose({
fee: 3000000000,
proposaler: "address",
expiration_time: Math.ceil(Date.now() / 1000),
proposed_ops: []
});
tr.timestamp = Math.ceil(Date.now() / 1000);
tr.validate_type = 0;
tr.add_signer(privkey);
// 本地验证签名
tr.finalize().then(() => {
if (!tr.signed) { tr.sign(); }
var tr_object = tr.toObject();
trObject = JSON.stringify(tr_object);
//然后将trObject参数POST到服务器transaction的endpoint即可。
请求参数:
参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
---|---|---|---|---|---|
trObj | true | string | 签名及序列化后的创建订单的transaction |
trObj生成步骤:
var ob={
fee : 900000, // 手续费
from:"test001", // 转出人id
to:"test099", // 接收人id
asset_type:1, // 资产id
amount:12345678910000000 // 转出金额(注意:该数值计算参考下面的转换说明)
}
// 转换说明:
// 上链数据只有整数,因此需要将满足小数点后位数精度要求的amount,按照currencies接口中basePrecision的要求转为整数,精度要求和转换方式如下:
// (1) 精度要求:转账的amount小数点后位数,不能超过currencies接口中对应币的transferPrecision;
// (2) 在精度满足要求后,将amount变为整形数据:需要用amount乘以currencies接口返回的币种的10的basePrecision幂;
// 假如进行KCASH的转账,想转0.01234567891个KCASH,从currencies接口中,知道KCASH的basePrecision为18,transferPrecision为10,即转账的小数点后有效位数不能超过10,
// 而0.01234567891的有效位数为11,因此需要对其进行截断,得到0.0123456789,然后乘以10的basePrecision幂,得到上链amount为123456780000000000。
var tr = new bytetrade_js.TransactionBuilder();
tr.add_type_operation( "transfer", ob );
tr.timestamp = Math.ceil(Date.now() / 1000);
tr.validate_type = 0;
tr.dapp = "Sagittarius";
// 获取当前用户私钥对象
tr.add_signer(privkey);
// 本地验证签名
tr.finalize().then(() => {
if (!tr.signed) { tr.sign(); }
var tr_object = tr.toObject();
trObject = JSON.stringify(tr_object);
//然后将trObject参数POST到服务器transaction的endpoint即可。