@near-eth/utils
Advanced tools
Comparing version 1.1.0 to 2.0.0-0
@@ -1,2 +0,3 @@ | ||
export declare function ethOnNearSyncHeight(): Promise<number>; | ||
import { Account } from 'near-api-js'; | ||
export declare function ethOnNearSyncHeight(nearClientAccount: string, nearAccount: Account): Promise<number>; | ||
//# sourceMappingURL=ethOnNearClient.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ethOnNearSyncHeight = void 0; | ||
const near_api_js_1 = require("near-api-js"); | ||
const serialize_1 = require("near-api-js/lib/utils/serialize"); | ||
const near = new near_api_js_1.Near({ | ||
keyStore: new near_api_js_1.keyStores.InMemoryKeyStore(), | ||
networkId: process.env.nearNetworkId, | ||
nodeUrl: process.env.nearNodeUrl | ||
}); | ||
// eslint-disable-next-line @typescript-eslint/no-extraneous-class | ||
@@ -28,8 +22,7 @@ class EthOnNearClientBorsh { | ||
} | ||
async function ethOnNearSyncHeight() { | ||
async function ethOnNearSyncHeight(nearClientAccount, nearAccount) { | ||
// near-api-js requires instantiating an "account" object, even though view | ||
// functions require no signature and therefore no associated account, so the | ||
// account name passed in doesn't matter. | ||
const account = await near.account(process.env.nearClientAccount); | ||
const deserialized = await account.viewFunction(process.env.nearClientAccount, 'last_block_number', {}, { parse: deserializeEthOnNearClient }); | ||
const deserialized = await nearAccount.viewFunction(nearClientAccount, 'last_block_number', {}, { parse: deserializeEthOnNearClient }); | ||
return deserialized.last_block_number.toNumber(); | ||
@@ -36,0 +29,0 @@ } |
@@ -1,8 +0,5 @@ | ||
import { ConnectedWalletAccount } from 'near-api-js'; | ||
import { Account } from 'near-api-js'; | ||
import { ethers } from 'ethers'; | ||
export declare function findEthProof(eventName: string, txHash: string, address: string, abi: any, provider: ethers.providers.JsonRpcProvider): Promise<Uint8Array>; | ||
export declare function findNearProof(nearReceiptId: string, nearReceiverId: string, nearBlockHeight: number, nearAccount: ConnectedWalletAccount, provider: ethers.providers.JsonRpcProvider, options?: { | ||
ethClientAddress: string; | ||
ethNearOnEthClientAbi: any; | ||
}): Promise<any>; | ||
export declare function findNearProof(nearReceiptId: string, nearReceiverId: string, nearBlockHeight: number, nearAccount: Account, provider: ethers.providers.Provider, ethClientAddress: string, ethClientAbi: string): Promise<any>; | ||
//# sourceMappingURL=findProof.d.ts.map |
@@ -122,5 +122,4 @@ "use strict"; | ||
} | ||
async function findNearProof(nearReceiptId, nearReceiverId, nearBlockHeight, nearAccount, provider, options) { | ||
options = options !== null && options !== void 0 ? options : { ethClientAddress: process.env.ethClientAddress, ethNearOnEthClientAbi: process.env.ethNearOnEthClientAbiText }; | ||
const nearOnEthClient = new ethers_1.ethers.Contract(options.ethClientAddress, options.ethNearOnEthClientAbi, provider); | ||
async function findNearProof(nearReceiptId, nearReceiverId, nearBlockHeight, nearAccount, provider, ethClientAddress, ethClientAbi) { | ||
const nearOnEthClient = new ethers_1.ethers.Contract(ethClientAddress, ethClientAbi, provider); | ||
const clientBlockHashB58 = bs58_1.default.encode(ethereumjs_util_1.toBuffer(await nearOnEthClient.blockHashes(nearBlockHeight))); | ||
@@ -127,0 +126,0 @@ const proof = await nearAccount.connection.provider.lightClientProof({ |
export * as urlParams from './url-params'; | ||
export * as erc20 from './erc20'; | ||
export { borshifyOutcomeProof } from './borshify-proof'; | ||
@@ -3,0 +4,0 @@ export { ethOnNearSyncHeight } from './ethOnNearClient'; |
@@ -22,4 +22,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.findNearProof = exports.findEthProof = exports.nearOnEthSyncHeight = exports.ethOnNearSyncHeight = exports.borshifyOutcomeProof = exports.urlParams = void 0; | ||
exports.findNearProof = exports.findEthProof = exports.nearOnEthSyncHeight = exports.ethOnNearSyncHeight = exports.borshifyOutcomeProof = exports.erc20 = exports.urlParams = void 0; | ||
exports.urlParams = __importStar(require("./url-params")); | ||
exports.erc20 = __importStar(require("./erc20")); | ||
var borshify_proof_1 = require("./borshify-proof"); | ||
@@ -26,0 +27,0 @@ Object.defineProperty(exports, "borshifyOutcomeProof", { enumerable: true, get: function () { return borshify_proof_1.borshifyOutcomeProof; } }); |
import { ethers } from 'ethers'; | ||
export declare function nearOnEthSyncHeight(provider: ethers.providers.Provider): Promise<number>; | ||
export declare function nearOnEthSyncHeight(provider: ethers.providers.Provider, ethClientAddress: string, ethClientAbi: string): Promise<number>; | ||
//# sourceMappingURL=nearOnEthClient.d.ts.map |
@@ -5,4 +5,4 @@ "use strict"; | ||
const ethers_1 = require("ethers"); | ||
async function nearOnEthSyncHeight(provider) { | ||
const nearOnEthClient = new ethers_1.ethers.Contract(process.env.ethClientAddress, process.env.ethNearOnEthClientAbiText, provider); | ||
async function nearOnEthSyncHeight(provider, ethClientAddress, ethClientAbi) { | ||
const nearOnEthClient = new ethers_1.ethers.Contract(ethClientAddress, ethClientAbi, provider); | ||
const { currentHeight } = await nearOnEthClient.bridgeState(); | ||
@@ -9,0 +9,0 @@ return Number(currentHeight); |
@@ -24,4 +24,3 @@ "use strict"; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions | ||
window.history.replaceState({}, '', `${location.pathname}?${params}`); | ||
window.history.replaceState({}, '', `${location.pathname}?${params.toString()}`); | ||
} | ||
@@ -37,4 +36,3 @@ exports.set = set; | ||
if (params.toString()) { | ||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions | ||
window.history.replaceState({}, '', `${location.pathname}?${params}`); | ||
window.history.replaceState({}, '', `${location.pathname}?${params.toString()}`); | ||
} | ||
@@ -41,0 +39,0 @@ else { |
{ | ||
"name": "@near-eth/utils", | ||
"version": "1.1.0", | ||
"version": "2.0.0-0", | ||
"license": "(MIT AND Apache-2.0)", | ||
@@ -28,3 +28,3 @@ "main": "dist/index.js", | ||
"lite-merkle-patricia-tree": "1.0.0", | ||
"near-api-js": "https://github.com/near/near-api-js#fef7f683fca86980f3509987226fbc7f63b455cb", | ||
"near-api-js": "https://github.com/aurora-is-near/near-api-js#b31f9975b29c69e65c6db2feca2183fac400109e", | ||
"web3-utils": "^1.3.4" | ||
@@ -31,0 +31,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
HTTP dependency
Supply chain riskContains a dependency which resolves to a remote HTTP URL which could be used to inject untrusted code and reduce overall package reliability.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
HTTP dependency
Supply chain riskContains a dependency which resolves to a remote HTTP URL which could be used to inject untrusted code and reduce overall package reliability.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 5 instances in 1 package
37497
31
404
0
2