near-api-js
Advanced tools
Comparing version 0.36.2 to 0.36.3
@@ -81,6 +81,6 @@ 'use strict'; | ||
const { accessKey } = accessKeyInfo; | ||
const status = await this.connection.provider.status(); | ||
const block = await this.connection.provider.block({ finality: 'final' }); | ||
const blockHash = block.header.hash; | ||
const nonce = ++accessKey.nonce; | ||
// TODO: get latest_block_hash from block query using `final` finality | ||
return await transaction_1.signTransaction(receiverId, nonce, actions, borsh_1.baseDecode(status.sync_info.latest_block_hash), this.connection.signer, this.accountId, this.connection.networkId); | ||
return await transaction_1.signTransaction(receiverId, nonce, actions, borsh_1.baseDecode(blockHash), this.connection.signer, this.accountId, this.connection.networkId); | ||
} | ||
@@ -87,0 +87,0 @@ /** |
@@ -172,7 +172,7 @@ "use strict"; | ||
} | ||
const block = await this.connection.provider.block({ finality: 'final' }); | ||
const blockHash = borsh_1.baseDecode(block.header.hash); | ||
const publicKey = utils_1.PublicKey.from(accessKey.public_key); | ||
// TODO: Cache & listen for nonce updates for given access key | ||
const nonce = accessKey.access_key.nonce + 1; | ||
const status = await this.connection.provider.status(); | ||
const blockHash = borsh_1.baseDecode(status.sync_info.latest_block_hash); | ||
const transaction = transaction_1.createTransaction(this.accountId, publicKey, receiverId, nonce, actions, blockHash); | ||
@@ -179,0 +179,0 @@ await this.walletConnection.requestSignTransactions([transaction], window.location.href); |
{ | ||
"name": "near-api-js", | ||
"description": "JavaScript library to interact with NEAR Protocol via RPC API", | ||
"version": "0.36.2", | ||
"version": "0.36.3", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
@@ -135,8 +135,8 @@ 'use strict'; | ||
const status = await this.connection.provider.status(); | ||
const block = await this.connection.provider.block({ finality: 'final' }); | ||
const blockHash = block.header.hash; | ||
const nonce = ++accessKey.nonce; | ||
// TODO: get latest_block_hash from block query using `final` finality | ||
return await signTransaction( | ||
receiverId, nonce, actions, baseDecode(status.sync_info.latest_block_hash), this.connection.signer, this.accountId, this.connection.networkId | ||
receiverId, nonce, actions, baseDecode(blockHash), this.connection.signer, this.accountId, this.connection.networkId | ||
); | ||
@@ -143,0 +143,0 @@ } |
@@ -202,7 +202,8 @@ import { Account } from './account'; | ||
const block = await this.connection.provider.block({ finality: 'final' }); | ||
const blockHash = baseDecode(block.header.hash); | ||
const publicKey = PublicKey.from(accessKey.public_key); | ||
// TODO: Cache & listen for nonce updates for given access key | ||
const nonce = accessKey.access_key.nonce + 1; | ||
const status = await this.connection.provider.status(); | ||
const blockHash = baseDecode(status.sync_info.latest_block_hash); | ||
const transaction = createTransaction(this.accountId, publicKey, receiverId, nonce, actions, blockHash); | ||
@@ -209,0 +210,0 @@ await this.walletConnection.requestSignTransactions([transaction], window.location.href); |
@@ -162,6 +162,6 @@ const url = require('url'); | ||
}, | ||
status() { | ||
block() { | ||
return { | ||
sync_info: { | ||
latest_block_hash: BLOCK_HASH | ||
header: { | ||
hash: BLOCK_HASH | ||
} | ||
@@ -168,0 +168,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3304129