Skip to content

Near

js
const provider = window.bitkeep.near
const provider = window.bitkeep.near

requestSignIn

Requests a login contract, giving the required viewing and change methods, returning the access key (response may change in future versions).

js
/**
* 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>
/**
* 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>
js
const contractId = 'guest-book.testnet';
const methodNames = ['addMessage'];
const res = await provider.requestSignIn({ contractId, methodNames });
const contractId = 'guest-book.testnet';
const methodNames = ['addMessage'];
const res = await provider.requestSignIn({ contractId, methodNames });

signOut()

Log out access keys from this account and clear logged in access keys from storage. If a dapp has multiple contractIds, the specific contractId must be passed.

js
/**
* @param {*} contractId contract account id (options)
*/
near.signOut({ contractId }): Promise<Result>;
/**
* @param {*} contractId contract account id (options)
*/
near.signOut({ contractId }): Promise<Result>;

isSignedIn()

Check whether the current account is logged in. If a dapp has multiple contractIds, the specific contractId needs to be passed in.

js
/**
* @param {*} contractId contract account id (options)
*/
near.isSignedIn({ contractId }): boolean;
/**
* @param {*} contractId contract account id (options)
*/
near.isSignedIn({ contractId }): boolean;

getPublicKey()

Get public key

js
/**
* @param {*} contractId contract account id (options)
*/
await near.getPublicKey(): string;
/**
* @param {*} contractId contract account id (options)
*/
await near.getPublicKey(): string;

verifyOwner()

Verify owner

js

await near.verifyOwner(message, accountId, networdkId): boolean;

await near.verifyOwner(message, accountId, networdkId): boolean;

signAndSendTransaction()

Sign and send a transaction

js

near.signAndSendTransaction({ receiverId: string, actions: Action}): Response;

near.signAndSendTransaction({ receiverId: string, actions: Action}): Response;

signAndSendTransactions()

Sign and send multiple transactions rpc请求

js

near.signAndSendTransactions({ receiverId: string, actions: Action}): Response;

near.signAndSendTransactions({ receiverId: string, actions: Action}): Response;