You are viewing a single comment's thread from:

RE: 波场(Tron)开发指南

in #starnote3 years ago

波场中得到的uint数据都是16进制(hex,如:[{"_hex":"0x0f4240"}]),如果在js中做加减乘除可以自动转换成10进制,也可以自动调整。
1 trx = 1000000 sun

uint public b = 1 trx;

let  b = await contract.b().call() //查询方法view
console.log(333, 'b', tronWeb.toBigNumber(b).toFixed())
//333 "b" "1000000"

tronWeb.fromSun()
> tronWeb.fromSun("1000000")
'1'
本地创建的得到 object
浏览器创建的得到 string

tronWeb.toSun()
tronWeb.toSun(10)
>"10000000"

Coin Marketplace

STEEM 0.28
TRX 0.12
JST 0.032
BTC 66167.71
ETH 3014.78
USDT 1.00
SBD 3.73