# Webview 方法(只移动端)
Bitget Wallet 提供了一些公共方法让 Dapp 与钱包互动。你可以到 Bitget DApp 搜索栏,并尝试一下。
# isBitKeep
// check the UserAgent include "BitKeep"
var isBitKeep = navigator.userAgent.indexOf('BitKeep') > 0;
// check the var
var isBitKeep = window.isBitKeep;
1
2
3
4
2
3
4
# 获取钱包身份
BitKeepInvoke.getIdentity(callback);
1
# 获取地址
BitKeepInvoke.getAddress(callback);
1
# 选择主币
BitKeepInvoke.selectCoin(callback);
1
# Toast
BitKeepInvoke.toast("Hello World");
1
# Alert
BitKeepInvoke.alert("Hello", callback);
1
# Confirm
BitKeepInvoke.confirm("Hello?", callback);
1
# 关闭页面
BitKeepInvoke.close();
1
# 显示/隐藏 Loading
BitKeepInvoke.showLoading();
BitKeepInvoke.hideLoading();
1
2
2
# 打开 URL
//In APP
BitKeepInvoke.openUrl("https://www.google.com");
//Our Of APP
BitKeepInvoke.openUrl2("https://www.google.com");
1
2
3
4
2
3
4
# 在右上角显示文本按钮
BitKeepInvoke.setTextAction("Text", function(){
//Click Callback
});
1
2
3
2
3
# 在右上角显示图片按钮
BitKeepInvoke.setIconAction("http://xxx.png", function(){
//Click Callback
});
1
2
3
2
3
# 分享文本
BitKeepInvoke.shareText("message", callback);
1
# 分享图片
BitKeepInvoke.shareImage("http://xxx.png", callback);
1
# 分享截图
BitKeepInvoke.shareScreenshot(callback)
1
# 分享 URL
BitKeepInvoke.shareUrl("title", "description", "url", "icon", callback);
1
# Transfer
BitKeepInvoke.pay(ChainCoin, Params,Callback);
//Chain Coin Transfer
BitKeepInvoke.pay("eth", {
"coin": "eth",
"to": "0x.....",
"amount": "0.1",
"gas": "400000"
}, function(err, reply){
});
//Token Transfer
BitKeepInvoke.pay("eth", {
"coin": "uni",
"contract": "token contract",
"to": "0x.....",
"amount": "0.1",
"gas": "400000"
}, function(err, reply){
});
//Call Contract
BitKeepInvoke.pay("eth", {
"coin": "uni",
"to": "token contract",
"data": "abi data",
"amount": "0.1",
"gas": "400000"
}, function(err, reply){
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33