Near
When running a DApp in the Bitget Wallet App or in the Chrome browser with the Chrome Extension installed, you can access the global object window.bitkeep.near
for subsequent API calls.
const provider = window.bitkeep.near
Injected object properties and methods
Method | Parameters | Return Type | Description |
---|---|---|---|
getAccountId |
() |
string |
Get the account ID |
getPublicKey |
() |
string |
Get the public key |
requestSignIn |
(params) |
Promise |
Request user sign-in |
isSignedIn |
() |
boolean |
Check if the user is signed in |
signOut |
() |
Promise |
Sign out the current user |
signAndSendTransaction |
(param) |
Promise |
Sign and send a transaction |
verifyOwner |
(message, accountId) |
Promise |
Verify account ownership |
requestSignTransactions |
({ transactions }) |
Promise |
Request multiple transaction signatures |
Provider
When running a DApp in the Bitget Wallet App or in the Chrome browser with the Chrome Extension installed, you can access the global object window.bitkeep.near
for subsequent API calls.
const provider = window.bitkeep.near
getAccountId
Returns the account ID (username) of the currently signed-in user.
Usage
window.bitkeep.getAccountId()
Try It
getPublicKey
Retrieves the public key associated with the user’s account.
Usage
window.bitkeep.getPublicKey()
Try It
requestSignIn
Triggers the NEAR Wallet login flow, requesting the user to sign in.
Usage
/** * request signin the contract, with the view and change methods provided, return the access key * @param {*} contractId contract account id * @param {*} methodNames the method names on the contract that should be allowed to be called. Pass null for no method names and '' or [] for any method names. * @param {*} createNew if need create new access key, set createNew = true. Default is false * @returns { accessKey } signed in access key */ provider.requestSignIn({ contractId, methodNames, createNew = false }): Promise<Result>
Try It
isSignedIn
Checks whether the user is currently signed in to the NEAR wallet.
Usage
window.bitkeep.isSignedIn()
Try It
SignOut
disconnect current near wallet
Usage
window.bitkeep.signOut()
Try It
VerifyOwner
Verifies that the current user is the real owner of a NEAR account by signing a message or making a secure call.
Usage
window.bitkeep.verifyOwner()