New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@near-eth/utils

Package Overview
Dependencies
Maintainers
3
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@near-eth/utils - npm Package Compare versions

Comparing version 2.4.0 to 2.4.1

20

dist/findFinalizationTx.d.ts
import { ethers } from 'ethers';
export declare class SearchError extends Error {
}
export declare function findFinalizationTxOnNear({ proof, connectorAccount, eventRelayerAccount, finalizationMethod, callIndexer }: {
proof: string;
connectorAccount: string;
eventRelayerAccount: string;
finalizationMethod: string;
callIndexer: (query: string) => Promise<Array<{
originated_from_transaction_hash: string;
included_in_block_timestamp: string;
}>>;
export interface ExplorerIndexerResult {
originated_from_transaction_hash: string;
included_in_block_timestamp: string;
}
export declare function findFinalizationTxOnNear({ proof, connectorAccount, eventRelayerAccount, finalizationMethod, ethTxHash, callIndexer }: {
proof?: string;
connectorAccount?: string;
eventRelayerAccount?: string;
finalizationMethod?: string;
ethTxHash?: string;
callIndexer: (query: string) => Promise<ExplorerIndexerResult[] | string>;
}): Promise<{

@@ -14,0 +16,0 @@ transactions: string[];

@@ -12,17 +12,26 @@ "use strict";

exports.SearchError = SearchError;
async function findFinalizationTxOnNear({ proof, connectorAccount, eventRelayerAccount, finalizationMethod, callIndexer }) {
const query = `SELECT public.receipts.originated_from_transaction_hash, public.receipts.included_in_block_timestamp
FROM public.receipts
JOIN public.action_receipt_actions
ON public.action_receipt_actions.receipt_id = public.receipts.receipt_id
WHERE (receipt_predecessor_account_id = '${eventRelayerAccount}'
AND receipt_receiver_account_id = '${connectorAccount}'
AND args ->> 'method_name' = '${finalizationMethod}'
AND args ->> 'args_base64' = '${proof}'
)`;
// NOTE: Generally only 1 result is returned, but allow multiple in case finalization attempts are made.
const results = await callIndexer(query);
const transactions = results.map(tx => tx.originated_from_transaction_hash);
const timestamps = results.map(tx => Number(tx.included_in_block_timestamp));
return { transactions, timestamps };
async function findFinalizationTxOnNear({ proof, connectorAccount, eventRelayerAccount, finalizationMethod, ethTxHash, callIndexer }) {
if (ethTxHash) {
const nearTxHash = await callIndexer(ethTxHash);
return { transactions: [nearTxHash], timestamps: [] };
}
else if (proof && connectorAccount && eventRelayerAccount && finalizationMethod) {
const query = `SELECT public.receipts.originated_from_transaction_hash, public.receipts.included_in_block_timestamp
FROM public.receipts
JOIN public.action_receipt_actions
ON public.action_receipt_actions.receipt_id = public.receipts.receipt_id
WHERE (receipt_predecessor_account_id = '${eventRelayerAccount}'
AND receipt_receiver_account_id = '${connectorAccount}'
AND args ->> 'method_name' = '${finalizationMethod}'
AND args ->> 'args_base64' = '${proof}'
)`;
// NOTE: Generally only 1 result is returned, but allow multiple in case finalization attempts are made.
const results = await callIndexer(query);
const transactions = results.map(tx => tx.originated_from_transaction_hash);
const timestamps = results.map(tx => Number(tx.included_in_block_timestamp));
return { transactions, timestamps };
}
else {
throw new Error('Expected ethTxHash or sql query params');
}
}

@@ -29,0 +38,0 @@ exports.findFinalizationTxOnNear = findFinalizationTxOnNear;

@@ -5,3 +5,3 @@ export * as urlParams from './url-params';

export * as aurora from './aurora';
export { findFinalizationTxOnEthereum, findFinalizationTxOnNear } from './findFinalizationTx';
export { findFinalizationTxOnEthereum, findFinalizationTxOnNear, ExplorerIndexerResult } from './findFinalizationTx';
export { borshifyOutcomeProof } from './borshify-proof';

@@ -8,0 +8,0 @@ export { ethOnNearSyncHeight } from './ethOnNearClient';

{
"name": "@near-eth/utils",
"version": "2.4.0",
"version": "2.4.1",
"license": "(MIT AND Apache-2.0)",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc