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
2
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 0.0.1-1 to 0.0.1-2

dist/borshify-proof.d.ts.map

4

dist/borshify-proof.d.ts

@@ -1,1 +0,3 @@

export function borshifyOutcomeProof(proof: any): Buffer;
/// <reference types="node" />
export declare function borshifyOutcomeProof(proof: any): Buffer;
//# sourceMappingURL=borshify-proof.d.ts.map

@@ -8,7 +8,9 @@ "use strict";

const web3_utils_1 = __importDefault(require("web3-utils"));
const bs58 = require('bs58');
const bs58_1 = __importDefault(require("bs58"));
// Encode outcome proof according to its borsh schema.
// import { LightClientProof } from 'near-api-js/lib/providers/provider'
// export function borshifyOutcomeProof (proof: LightClientProof): Buffer {
// TODO fix LightClientProof interface
function borshifyOutcomeProof(proof) {
const statusToBuffer = (status) => {
console.log(status);
if ('SuccessValue' in status) {

@@ -25,3 +27,3 @@ const data = Buffer.from(status.SuccessValue, 'base64');

Buffer.from([3]),
bs58.decode(status.SuccessReceiptId)
bs58_1.default.decode(status.SuccessReceiptId)
]);

@@ -36,7 +38,7 @@ }

Buffer.concat(proof.outcome_proof.proof.map((p) => Buffer.concat([
bs58.decode(p.hash),
bs58_1.default.decode(p.hash),
Buffer.from([p.direction === 'Right' ? 1 : 0])
]))),
bs58.decode(proof.outcome_proof.block_hash),
bs58.decode(proof.outcome_proof.id),
bs58_1.default.decode(proof.outcome_proof.block_hash),
bs58_1.default.decode(proof.outcome_proof.id),
Buffer.concat([

@@ -49,3 +51,3 @@ web3_utils_1.default

.toBuffer('le', 4),
Buffer.concat(proof.outcome_proof.outcome.receipt_ids.map((r) => bs58.decode(r))),
Buffer.concat(proof.outcome_proof.outcome.receipt_ids.map((r) => bs58_1.default.decode(r))),
web3_utils_1.default.toBN(proof.outcome_proof.outcome.gas_burnt).toBuffer('le', 8),

@@ -61,11 +63,11 @@ web3_utils_1.default

web3_utils_1.default.toBN(0).toBuffer('le', 4),
bs58.decode(proof.block_header_lite.prev_block_hash),
bs58.decode(proof.block_header_lite.inner_rest_hash),
bs58_1.default.decode(proof.block_header_lite.prev_block_hash),
bs58_1.default.decode(proof.block_header_lite.inner_rest_hash),
web3_utils_1.default
.toBN(proof.block_header_lite.inner_lite.height)
.toBuffer('le', 8),
bs58.decode(proof.block_header_lite.inner_lite.epoch_id),
bs58.decode(proof.block_header_lite.inner_lite.next_epoch_id),
bs58.decode(proof.block_header_lite.inner_lite.prev_state_root),
bs58.decode(proof.block_header_lite.inner_lite.outcome_root),
bs58_1.default.decode(proof.block_header_lite.inner_lite.epoch_id),
bs58_1.default.decode(proof.block_header_lite.inner_lite.next_epoch_id),
bs58_1.default.decode(proof.block_header_lite.inner_lite.prev_state_root),
bs58_1.default.decode(proof.block_header_lite.inner_lite.outcome_root),
// for backward compatible in tests with old dumps

@@ -76,7 +78,7 @@ web3_utils_1.default

.toBuffer('le', 8),
bs58.decode(proof.block_header_lite.inner_lite.next_bp_hash),
bs58.decode(proof.block_header_lite.inner_lite.block_merkle_root),
bs58_1.default.decode(proof.block_header_lite.inner_lite.next_bp_hash),
bs58_1.default.decode(proof.block_header_lite.inner_lite.block_merkle_root),
web3_utils_1.default.toBN(proof.block_proof.length).toBuffer('le', 4),
Buffer.concat(proof.block_proof.map((bp) => Buffer.concat([
bs58.decode(bp.hash),
bs58_1.default.decode(bp.hash),
Buffer.from([bp.direction === 'Right' ? 1 : 0])

@@ -83,0 +85,0 @@ ])))

@@ -1,1 +0,2 @@

export function lastBlockNumber(): Promise<any>;
export declare function ethOnNearSyncHeight(): Promise<number>;
//# sourceMappingURL=ethOnNearClient.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.lastBlockNumber = void 0;
exports.ethOnNearSyncHeight = void 0;
const near_api_js_1 = require("near-api-js");

@@ -11,2 +11,3 @@ const serialize_1 = require("near-api-js/lib/utils/serialize");

});
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
class EthOnNearClientBorsh {

@@ -28,3 +29,3 @@ constructor(args) {

}
async function lastBlockNumber() {
async function ethOnNearSyncHeight() {
// near-api-js requires instantiating an "account" object, even though view

@@ -37,3 +38,3 @@ // functions require no signature and therefore no associated account, so the

}
exports.lastBlockNumber = lastBlockNumber;
exports.ethOnNearSyncHeight = ethOnNearSyncHeight;
//# sourceMappingURL=ethOnNearClient.js.map

@@ -1,3 +0,5 @@

export * as urlParams from "./url-params";
export { borshifyOutcomeProof } from "./borshify-proof";
export { lastBlockNumber } from "./ethOnNearClient";
export * as urlParams from './url-params';
export { borshifyOutcomeProof } from './borshify-proof';
export { ethOnNearSyncHeight } from './ethOnNearClient';
export { nearOnEthSyncHeight } from './nearOnEthClient';
//# sourceMappingURL=index.d.ts.map

@@ -22,3 +22,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.lastBlockNumber = exports.borshifyOutcomeProof = exports.urlParams = void 0;
exports.nearOnEthSyncHeight = exports.ethOnNearSyncHeight = exports.borshifyOutcomeProof = exports.urlParams = void 0;
exports.urlParams = __importStar(require("./url-params"));

@@ -28,3 +28,5 @@ var borshify_proof_1 = require("./borshify-proof");

var ethOnNearClient_1 = require("./ethOnNearClient");
Object.defineProperty(exports, "lastBlockNumber", { enumerable: true, get: function () { return ethOnNearClient_1.lastBlockNumber; } });
Object.defineProperty(exports, "ethOnNearSyncHeight", { enumerable: true, get: function () { return ethOnNearClient_1.ethOnNearSyncHeight; } });
var nearOnEthClient_1 = require("./nearOnEthClient");
Object.defineProperty(exports, "nearOnEthSyncHeight", { enumerable: true, get: function () { return nearOnEthClient_1.nearOnEthSyncHeight; } });
//# sourceMappingURL=index.js.map

@@ -1,3 +0,8 @@

export function get(...paramNames: any[]): any;
export function set(newParams: any): void;
export function clear(...paramNames: any[]): void;
export declare function get(...paramNames: string[]): string | null | {
[x: string]: string;
};
export declare function set(newParams: {
[x: string]: string;
}): void;
export declare function clear(...paramNames: any[]): void;
//# sourceMappingURL=url-params.d.ts.map

@@ -24,2 +24,3 @@ "use strict";

}
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
window.history.replaceState({}, '', `${location.pathname}?${params}`);

@@ -36,2 +37,3 @@ }

if (params.toString()) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
window.history.replaceState({}, '', `${location.pathname}?${params}`);

@@ -38,0 +40,0 @@ }

{
"name": "@near-eth/utils",
"version": "0.0.1-1",
"version": "0.0.1-2",
"license": "(MIT AND Apache-2.0)",

@@ -17,2 +17,3 @@ "main": "dist/index.js",

"@types/bn.js": "^5.1.0",
"@types/bs58": "^4.0.1",
"@types/node": "^14.14.28",

@@ -25,2 +26,3 @@ "@yarnpkg/pnpify": "^2.4.0",

"near-api-js": "^0.39.0",
"web3": "^1.3.4",
"web3-utils": "^1.3.4"

@@ -33,4 +35,4 @@ },

"type": "git",
"url": "https://github.com/near/rainbow-bridge-client/tree/main/packages/nep141-erc20"
"url": "https://github.com/aurora-is-near/rainbow-bridge-client/tree/main/packages/utils"
}
}

@@ -1,2 +0,27 @@

# TODO
Common utils for connector packages
`@near-eth/utils`
=================
Common utils for connector packages
Installation
------------
```shell
yarn add @near-eth/utils
```
```json
"dependencies": {
"@near-eth/utils": "^1.0.0",
}
```
Usage
-----
```js
import {
urlParams,
ethOnNearSyncHeight,
nearOnEthSyncHeight,
borshifyOutcomeProof
} from '@near-eth/utils'
```

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