Please note: The NEAR RPC standard is still under review and specifications may change. Implementation details and method signatures are subject to updates.
near_getAccounts
Retrieve all accounts visible to the session.publicKey references the underlying FullAccess key linked to each account.
Parameters
noneReturns
1.Array - Array of accounts:
1.1. Object
1.1.1. accountId : String - The account name to which the publicKey corresponds as plain text
1.1.2. publicKey : String - The public counterpart of the key used to sign, expressed as a string with format <key-type>:<base58-key-bytes>
Example
near_signIn
For dApps that often sign gas-only transactions,FunctionCall access keys can be created for one or more accounts to greatly improve the UX. While this could be achieved with signTransactions, it suggests a direct intention that a user wishes to sign in to a dApp’s smart contract.
Parameters
Object- Sign In parameters: 1.1.permission:Object- Function call key permission parameters 1.1.1.receiverId:String- smart contract for which the function call access key will be created 1.1.2.methodNames:Array<String>- list of methods that can be called on the smart contract 1.2.accounts:Array- list of accounts for which a FunctionCall access key will be added: 1.2.1.Object- Account 1.2.1.1.accountId:String- The account name to which the publicKey corresponds as plain text 1.2.1.2.publicKey:String- The public counterpart of the key used to sign, expressed as a string with format<key-type>:<base58-key-bytes>
Returns
voidExample
near_signOut
Delete one or moreFunctionCall access keys created with signIn. While this could be achieved with signTransactions, it suggests a direct intention that a user wishes to sign out from a dApp’s smart contract.
Parameters
1.Array - Array of accounts:
1.1. Object
1.1.1. accountId : String - The account name to which the publicKey corresponds as plain text
1.1.2. publicKey : String - The public counterpart of the key used to sign, expressed as a string with format <key-type>:<base58-key-bytes>
Returns
voidExample
near_signTransaction
Sign a transaction. It makes use of near-api-js to enable interoperability with dApps that will already use it for constructing transactions and communicating with RPC endpoints. Transaction passed tosignTransaction must be encoded.
Parameters
Object- Signing parameters: 1.1.transaction:Uint8Array- Encoded Transaction via transactions.Transaction.encode()
Returns
The result ofsignTransaction and is encoded SignedTransaction model.
Uint8Array- Encoded SignedTransaction via transactions.SignedTransaction.encode()
Example
near_signTransactions
Sign a list of transactions. It makes use of near-api-js to enable interoperability with dApps that will already use it for constructing transactions and communicating with RPC endpoints. Transactions passed tosignTransactions must be encoded.
Parameters
Array<Object>- Signing parameters: 1.1.transactions:Array<Uint8Array>- Array of Encoded Transaction via transactions.Transaction.encode()
Returns
The result ofsignTransactions and are encoded SignedTransaction models.
Array<Uint8Array>- Array of Encoded SignedTransaction via transactions.SignedTransaction.encode()