Skip to content

Bitkeep JS Wallet-related APIs

bitkeep.js is a Wallet Bridge API provided by Bitget Wallet. After installing the BGW wallet, you can use this API to interact with the wallet.

SDK Source Code

Identify Bitget Wallet

js
// Check if the UserAgent includes "BitKeep"
var isBitKeep = navigator.userAgent.indexOf('BitKeep') > 0;
// Check the variable
var isBitKeep = window.isBitKeep;
// Check if the UserAgent includes "BitKeep"
var isBitKeep = navigator.userAgent.indexOf('BitKeep') > 0;
// Check the variable
var isBitKeep = window.isBitKeep;

Get Wallet Identity

Parameters:

  • callback - function: (error, data) => {}
js
const callback = (err, data) => {
    if (err){
        // Error handling
    }
    // Todo ..
}
BitKeepInvoke.getIdentity(callback);
const callback = (err, data) => {
    if (err){
        // Error handling
    }
    // Todo ..
}
BitKeepInvoke.getIdentity(callback);

Get Wallet Address

Parameters:

  • callback - function: (error, data) => {}
js
const callback = (err, data) => {
    if (err){
        // Error handling
    }
    // Todo ..
}
BitKeepInvoke.getAddress(callback);
const callback = (err, data) => {
    if (err){
        // Error handling
    }
    // Todo ..
}
BitKeepInvoke.getAddress(callback);

Select Main Coin

Parameters:

  • callback - function: (error, data) => {}
js
const callback = (err, data) => {
    if (err){
        // Error handling
    }
    // Todo ..
}
BitKeepInvoke.selectCoin(callback);
const callback = (err, data) => {
    if (err){
        // Error handling
    }
    // Todo ..
}
BitKeepInvoke.selectCoin(callback);

Transaction

javascript
BitKeepInvoke.pay(ChainCoin, ParamsCallback);

//Chain Coin Transfer
BitKeepInvoke.pay("eth", {
    "coin": "eth",
    "to": "0x.....",
    "amount": "0.1",
    "gas": "400000"
}, function(err, reply){
    if (err){
        //err catch
    }
    //...
});

//Token Transfer
BitKeepInvoke.pay("eth", {
    "coin": "uni",
    "contract": "token contract",
    "to": "0x.....",
    "amount": "0.1",
    "gas": "400000"
}, function(err, reply){
    if (err){
        //err catch
    }
    //...
});

//Call Contract
BitKeepInvoke.pay("eth", {
    "coin": "uni",
    "to": "token contract",
    "data": "abi data",
    "amount": "0.1",
    "gas": "400000"
}, function(err, reply){
    if (err){
        //err catch
    }
    //...
});
BitKeepInvoke.pay(ChainCoin, ParamsCallback);

//Chain Coin Transfer
BitKeepInvoke.pay("eth", {
    "coin": "eth",
    "to": "0x.....",
    "amount": "0.1",
    "gas": "400000"
}, function(err, reply){
    if (err){
        //err catch
    }
    //...
});

//Token Transfer
BitKeepInvoke.pay("eth", {
    "coin": "uni",
    "contract": "token contract",
    "to": "0x.....",
    "amount": "0.1",
    "gas": "400000"
}, function(err, reply){
    if (err){
        //err catch
    }
    //...
});

//Call Contract
BitKeepInvoke.pay("eth", {
    "coin": "uni",
    "to": "token contract",
    "data": "abi data",
    "amount": "0.1",
    "gas": "400000"
}, function(err, reply){
    if (err){
        //err catch
    }
    //...
});