Skip to content

LILO js api old

zhaojun-sh edited this page Dec 20, 2018 · 1 revision

LILO web3 API

1.生成dcrm地址 dcrmLiLoReqAddress(dcrmReqAddr)

lilo.dcrmLiLoReqAddress("0x3a1b3b81ed061581558a81f11d63e03129347437","0x041307617C209E15A4BB0B7946F8D89A7A0164CF44342AAE751D319367E7AF8FC7D08B9C42DF2B613AA00D31F43C3EEA8CC113545407DB4C0B0DE97A1D4D4D74BC","ETH")

参数说明

lilo.dcrmLiLoReqAddress(
"0x3a1b3b81ed061581558a81f11d63e03129347437", //FUSION账户地址
"0x041307617C209E15A4BB0B7946F8D89A7A0164CF44342AAE751D319367E7AF8FC7D08B9C42DF2B613AA00D31F43C3EEA8CC113545407DB4C0B0DE97A1D4D4D74BC", //FUSION账户对应公钥 (去掉此参数)
"ETH" //币种
)

// 修改:一个币种只生成一个DCRM地址,重复请求直接return重复操作出错信息

结果: 0xa1bd6abd05d6b99419d42be7a2257aca4f7df63e18d4d1df37a99dc8aa99edd2 //交易hash

2. 获取DCRM地址 getLiLoDcrmAddr(dcrmGetAddr)

lilo.getLiLoDcrmAddr("0x3a1b3b81ed061581558a81f11d63e03129347437","0xa1bd6abd05d6b99419d42be7a2257aca4f7df63e18d4d1df37a99dc8aa99edd2")

参数说明

lilo.getLiLoDcrmAddr(
"0x3a1b3b81ed061581558a81f11d63e03129347437", // FUSION地址
“ETH” // 币种
)

结果: 0x3E3c4B0c469D58Fad2E77Fb590B2286982004F3e //DCRM地址

3.请求lockin dcrmLockIn (dcrmLockin)

先完成充值:eth测试网从帐号0x0520e8e5E08169c4dbc1580Dc9bF56638532773A 往0x3E3c4B0c469D58Fad2E77Fb590B2286982004F3e充值0.123456789 eth,交易hash为0x4ee0a307e798c2105867da9656801355dcc70352919c81d1edb63f5849b8bd95

lilo.dcrmLockIn("0x3a1b3b81ed061581558a81f11d63e03129347437","0x3E3c4B0c469D58Fad2E77Fb590B2286982004F3e","123456789000000000","ETH",["0x4ee0a307e798c2105867da9656801355dcc70352919c81d1edb63f5849b8bd95"])

参数说明

lilo.dcrmLockIn(
"0x3a1b3b81ed061581558a81f11d63e03129347437", // FUSION账户地址(可以去掉)
"0x3E3c4B0c469D58Fad2E77Fb590B2286982004F3e", // 要lockin的DCRM地址 (可以去掉,根据币种获取)
"123456789000000000", // 充值金额
"ETH", //币种
["0x4ee0a307e798c2105867da9656801355dcc70352919c81d1edb63f5849b8bd95"] // 充值交易hash
)

结果: 0x25708638c11ff6ef35d6885eecefe2e6adc4fbc3646374f825b6c7b4cb5889ef // 交易hash

4.查询余额 getDcrmAccountBalance(dcrmGetBalance)

帐号0x3a1b3b81ed061581558a81f11d63e03129347437下的币种为ETH的地址为0x3E3c4B0c469D58Fad2E77Fb590B2286982004F3e

lilo.getDcrmAccountBalance("0x3a1b3b81ed061581558a81f11d63e03129347437","0x3E3c4B0c469D58Fad2E77Fb590B2286982004F3e","ETH")

参数说明

lilo.getDcrmAccountBalance(
"0x3a1b3b81ed061581558a81f11d63e03129347437", //fusion 账户地址
”0x3E3c4B0c469D58Fad2E77Fb590B2286982004F3e", // DCRM地址(可以去除)
"ETH" // 币种
)

结果:

123456789000000000 余额

5.链内转帐:dcrmTransaction(dcrmSendTransaction)

再新建一个dcrm地址 lilo.dcrmLiLoReqAddress("0x3a1b3b81ed061581558a81f11d63e03129347437","0x041307617C209E15A4BB0B7946F8D89A7A0164CF44342AAE751D319367E7AF8FC7D08B9C42DF2B613AA00D31F43C3EEA8CC113545407DB4C0B0DE97A1D4D4D74BC","ETH") lilo.getLiLoDcrmAddr("0x3a1b3b81ed061581558a81f11d63e03129347437","0xc8cbb9a6cae0e711677a5bcd75d56528b17297343dacc9d1e9d30c30d1cda5cb") 得到新dcrm地址:0x96acE283D60384906DFa9bA70B39f206E8b964c4

接着调用 lilo.dcrmTransaction("0x3a1b3b81ed061581558a81f11d63e03129347437","0x3E3c4B0c469D58Fad2E77Fb590B2286982004F3e","0x3a1b3b81ed061581558a81f11d63e03129347437","0x96acE283D60384906DFa9bA70B39f206E8b964c4","1000000000","ETH")

参数说明

lilo.dcrmTransaction(
"0x3a1b3b81ed061581558a81f11d63e03129347437", // from的fusion地址(去除)
"0x3E3c4B0c469D58Fad2E77Fb590B2286982004F3e", // from的DCRM地址(去除)
"0x3a1b3b81ed061581558a81f11d63e03129347437", // to 的fusion地址
"0x96acE283D60384906DFa9bA70B39f206E8b964c4", // to的dcrm地址(去除)
"1000000000", // 转账金额
"ETH" //转账币种
)

6.请求lockout dcrmLockOut(dcrmLockout)

第一第二参数按默认值就可以。第三个参数是提现到哪里的地址,第四个参数是要提现的fusion帐号,第五个参数是提现的金额,第六个参数是币种,第七个参数是从哪个dcrm addr提现出去。

lilo.dcrmLockOut("0x569882AC04C3A8831758B26B1ED343BBF7424C86CC5F8385D11C3573A811753868EA55290CCDE1B544D699CEED4DCB1BDE911DAF49B7F9D4B9480A19463D5B1F","0xae59a8d5d0091873de2a0b1702fb67f0cd352e1583884e962d2bb537e597d333","0xd92c6581cb000367c10a1997070ccd870287f2da","0x3a1b3b81ed061581558a81f11d63e03129347437","1000000000","ETH","0x3E3c4B0c469D58Fad2E77Fb590B2286982004F3e")

参数说明

lilo.dcrmLockOut(
"0x569882AC04C3A8831758B26B1ED343BBF7424C86CC5F8385D11C3573A811753868EA55290CCDE1B544D699CEED4DCB1BDE911DAF49B7F9D4B9480A19463D5B1F", // 用户的sig签名 (可以去掉)
"0xae59a8d5d0091873de2a0b1702fb67f0cd352e1583884e962d2bb537e597d333", // 待签名的txhash(可以去掉)
"0xd92c6581cb000367c10a1997070ccd870287f2da",  // lockout to提现地址 
"0x3a1b3b81ed061581558a81f11d63e03129347437",   // fusion账户 (可以去掉)
“1000000000", // 提现金额
"ETH", //币种
"0x3E3c4B0c469D58Fad2E77Fb590B2286982004F3e" //  dcrm地址 (可以去掉)
)

结果:

0x02fc4a7bed53f56d07fd0d67fdcb5d59ef96ee7fd886b4bfe2ef85aa88d2ed49 //交易hash