连接钱包(内部)

BitKeep WebView 默认开放了特有的钱包连接方式。

需要在DApp里引入bitkeep.js文件,会开放一个对象 BitKeepInvoke。

注意,在调用BitKeepInvoke之前,请先调用BitKeepInvoke.onLoadReady(callback)来确保BitKeep对象以加载完成。

获取用户地址

BitKeepInvoke.getAddress(function(err, data){
console.log(data)
//data = {"eth": "0x....", "bnb": "0x....."}
});

调起转账

BitKeepInvoke.pay(主链名, 参数,回调);
//普通转账
BitKeepInvoke.pay("eth", {
"coin": "eth",
"to": "0x.....",
"amount": "0.1",
"gas": "400000"
}, function(err, reply){
});
//Token转账
BitKeepInvoke.pay("eth", {
"coin": "uni",
"contract": "uni的合约地址",
"to": "0x.....",
"amount": "0.1",
"gas": "400000"
}, function(err, reply){
});
//合约执行
BitKeepInvoke.pay("eth", {
"coin": "uni",
"to": "uni的合约地址",
"data": "合约执行方法及参数(abi数据)",
"amount": "0.1",
"gas": "400000"
}, function(err, reply){
});