Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@layerzerolabs/devtools

Package Overview
Dependencies
Maintainers
27
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@layerzerolabs/devtools - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

43

dist/index.d.ts

@@ -254,2 +254,43 @@ import { EndpointId } from '@layerzerolabs/lz-definitions';

type Hash = string | number | boolean | bigint;
/**
* Data structure similar to the default ES6 Map
* with one crucial difference - it requires a hash function
* which allows it to store values not by reference, but by value
*
* The implementation is quite naive as it uses three additional maps
* to be able to easily implement the ES6 Map interface. This comes at a small
* storage price which, in our environment, is perfectly negligible.
*
* The interface matches the interface of Map with one syntactic sugar added:
* the getOrElse method that prevents us from having to do null checks on get.
*/
declare abstract class AbstractMap<K, V> implements Map<K, V> {
#private;
protected abstract hash(key: K): Hash;
constructor(entries?: Iterable<[K, V]>);
clear(): void;
delete(key: K): boolean;
forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: unknown): void;
get(key: K): V | undefined;
getOrElse(key: K, orElse: () => V): V;
has(key: K): boolean;
set(key: K, value: V): this;
get size(): number;
entries(): IterableIterator<[K, V]>;
keys(): IterableIterator<K>;
values(): IterableIterator<V>;
[Symbol.iterator](): IterableIterator<[K, V]>;
[Symbol.toStringTag]: string;
}
declare class OmniPointMap<V, K extends OmniPoint = OmniPoint> extends AbstractMap<K, V> {
[Symbol.toStringTag]: string;
protected hash(point: K): string;
}
declare class OmniVectorMap<V, K extends OmniVector = OmniVector> extends AbstractMap<K, V> {
[Symbol.toStringTag]: string;
protected hash(vector: K): string;
}
declare const formatEid: (eid: EndpointId) => string;

@@ -378,2 +419,2 @@ declare const formatOmniPoint: ({ eid, address }: OmniPoint) => string;

export { type Address, AddressSchema, type Bytes32, EmptyOmniEdgeSchema, EmptyOmniNodeSchema, type EndpointBasedFactory, EndpointIdSchema, type Factory, type IOmniSDK, type OmniEdge, type OmniError, type OmniGraph, OmniGraphBuilder, type OmniNode, type OmniPoint, OmniPointSchema, type OmniSigner, type OmniSignerFactory, type OmniTransaction, type OmniTransactionReceipt, type OmniTransactionResponse, type OmniTransactionWithError, type OmniTransactionWithReceipt, type OmniTransactionWithResponse, type OmniVector, OmniVectorSchema, type SignAndSendResult, UIntSchema, type WithEid, type WithOptionals, arePointsEqual, areSameEndpoint, areVectorsEqual, createOmniEdgeSchema, createOmniGraphSchema, createOmniNodeSchema, createSignAndSend, first, firstFactory, flattenTransactions, formatEid, formatOmniPoint, formatOmniTransaction, formatOmniVector, isDeepEqual, isOmniGraphEmpty, isOmniPoint, isVectorPossible, parallel, sequence, serializePoint, serializeVector, vectorFromNodes };
export { type Address, AddressSchema, type Bytes32, EmptyOmniEdgeSchema, EmptyOmniNodeSchema, type EndpointBasedFactory, EndpointIdSchema, type Factory, type IOmniSDK, type OmniEdge, type OmniError, type OmniGraph, OmniGraphBuilder, type OmniNode, type OmniPoint, OmniPointMap, OmniPointSchema, type OmniSigner, type OmniSignerFactory, type OmniTransaction, type OmniTransactionReceipt, type OmniTransactionResponse, type OmniTransactionWithError, type OmniTransactionWithReceipt, type OmniTransactionWithResponse, type OmniVector, OmniVectorMap, OmniVectorSchema, type SignAndSendResult, UIntSchema, type WithEid, type WithOptionals, arePointsEqual, areSameEndpoint, areVectorsEqual, createOmniEdgeSchema, createOmniGraphSchema, createOmniNodeSchema, createSignAndSend, first, firstFactory, flattenTransactions, formatEid, formatOmniPoint, formatOmniTransaction, formatOmniVector, isDeepEqual, isOmniGraphEmpty, isOmniPoint, isVectorPossible, parallel, sequence, serializePoint, serializeVector, vectorFromNodes };

@@ -12,2 +12,8 @@ 'use strict';

var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
var __accessCheck = (obj, member, msg) => {

@@ -66,4 +72,4 @@ if (!member.has(obj))

var formatEid = (eid) => {
var _a;
return (_a = lzDefinitions.EndpointId[eid]) != null ? _a : `Unknown EndpointId (${eid})`;
var _a4;
return (_a4 = lzDefinitions.EndpointId[eid]) != null ? _a4 : `Unknown EndpointId (${eid})`;
};

@@ -73,2 +79,86 @@ var formatOmniPoint = ({ eid, address }) => `[${address} @ ${formatEid(eid)}]`;

// src/common/map.ts
var _keys, _values, _entries, _a;
var AbstractMap = class {
constructor(entries = []) {
__privateAdd(this, _keys, /* @__PURE__ */ new Map());
__privateAdd(this, _values, /* @__PURE__ */ new Map());
__privateAdd(this, _entries, /* @__PURE__ */ new Map());
__publicField(this, _a, "HashMap");
for (const [key, value] of entries) {
this.set(key, value);
}
}
clear() {
__privateGet(this, _keys).clear();
__privateGet(this, _values).clear();
__privateGet(this, _entries).clear();
}
delete(key) {
const serialized = this.hash(key);
return __privateGet(this, _keys).delete(serialized), __privateGet(this, _values).delete(serialized), __privateGet(this, _entries).delete(serialized);
}
forEach(callbackfn, thisArg) {
for (const [_, [key, value]] of __privateGet(this, _entries)) {
callbackfn.apply(thisArg, [value, key, this]);
}
}
get(key) {
return __privateGet(this, _values).get(this.hash(key));
}
getOrElse(key, orElse) {
return this.has(key) ? this.get(key) : orElse();
}
has(key) {
return __privateGet(this, _keys).has(this.hash(key));
}
set(key, value) {
const serialized = this.hash(key);
return __privateGet(this, _keys).set(serialized, key), __privateGet(this, _values).set(serialized, value), __privateGet(this, _entries).set(serialized, [key, value]), this;
}
get size() {
return __privateGet(this, _entries).size;
}
entries() {
return __privateGet(this, _entries).values();
}
keys() {
return __privateGet(this, _keys).values();
}
values() {
return __privateGet(this, _values).values();
}
[Symbol.iterator]() {
return this.entries();
}
};
_a = Symbol.toStringTag;
_keys = new WeakMap();
_values = new WeakMap();
_entries = new WeakMap();
// src/omnigraph/map.ts
var _a2;
var OmniPointMap = class extends AbstractMap {
constructor() {
super(...arguments);
__publicField(this, _a2, "OmniPointMap");
}
hash(point) {
return serializePoint(point);
}
};
_a2 = Symbol.toStringTag;
var _a3;
var OmniVectorMap = class extends AbstractMap {
constructor() {
super(...arguments);
__publicField(this, _a3, "OmniVectorMap");
}
hash(vector) {
return serializeVector(vector);
}
};
_a3 = Symbol.toStringTag;
// src/omnigraph/builder.ts

@@ -79,4 +169,4 @@ var _nodes, _edges, _assertCanAddEdge, assertCanAddEdge_fn;

__privateAdd(this, _assertCanAddEdge);
__privateAdd(this, _nodes, /* @__PURE__ */ new Map());
__privateAdd(this, _edges, /* @__PURE__ */ new Map());
__privateAdd(this, _nodes, new OmniPointMap());
__privateAdd(this, _edges, new OmniVectorMap());
}

@@ -102,3 +192,3 @@ /**

addNodes(...nodes) {
return nodes.forEach((node) => __privateGet(this, _nodes).set(serializePoint(node.point), node)), this;
return nodes.forEach((node) => __privateGet(this, _nodes).set(node.point, node)), this;
}

@@ -108,3 +198,3 @@ addEdges(...edges) {

__privateMethod(this, _assertCanAddEdge, assertCanAddEdge_fn).call(this, edge);
__privateGet(this, _edges).set(serializeVector(edge.vector), edge);
__privateGet(this, _edges).set(edge.vector, edge);
}), this;

@@ -116,7 +206,7 @@ }

[...this.getEdgesFrom(point)].forEach((edge) => this.removeEdgeAt(edge.vector)), // Only then we remove the node itself
__privateGet(this, _nodes).delete(serializePoint(point)), this
__privateGet(this, _nodes).delete(point), this
);
}
removeEdgeAt(vector) {
return __privateGet(this, _edges).delete(serializeVector(vector)), this;
return __privateGet(this, _edges).delete(vector), this;
}

@@ -133,6 +223,6 @@ // .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-

getNodeAt(point) {
return __privateGet(this, _nodes).get(serializePoint(point));
return __privateGet(this, _nodes).get(point);
}
getEdgeAt(vector) {
return __privateGet(this, _edges).get(serializeVector(vector));
return __privateGet(this, _edges).get(vector);
}

@@ -257,3 +347,5 @@ getEdgesFrom(point) {

exports.OmniGraphBuilder = OmniGraphBuilder;
exports.OmniPointMap = OmniPointMap;
exports.OmniPointSchema = OmniPointSchema;
exports.OmniVectorMap = OmniVectorMap;
exports.OmniVectorSchema = OmniVectorSchema;

@@ -260,0 +352,0 @@ exports.UIntSchema = UIntSchema;

6

package.json
{
"name": "@layerzerolabs/devtools",
"version": "0.0.2",
"version": "0.0.3",
"description": "Core utilities for working with LayerZero on-chain infrastructure",

@@ -26,3 +26,3 @@ "repository": {

"@layerzerolabs/io-devtools": "~0.0.2",
"@layerzerolabs/lz-definitions": "~2.0.7",
"@layerzerolabs/lz-definitions": "~2.0.11",
"@layerzerolabs/test-devtools": "~0.0.2",

@@ -42,3 +42,3 @@ "@types/jest": "^29.5.11",

"@layerzerolabs/io-devtools": "~0.0.2",
"@layerzerolabs/lz-definitions": "~2.0.7",
"@layerzerolabs/lz-definitions": "~2.0.11",
"zod": "^3.22.4"

@@ -45,0 +45,0 @@ },

@@ -7,3 +7,3 @@ <p align="center">

<h1 align="center">@layerzerolabs/utils</h1>
<h1 align="center">@layerzerolabs/devtools</h1>

@@ -13,7 +13,7 @@ <!-- The badges section -->

<!-- Shields.io NPM published package version -->
<a href="https://www.npmjs.com/package/@layerzerolabs/utils"><img alt="NPM Version" src="https://img.shields.io/npm/v/@layerzerolabs/utils"/></a>
<a href="https://www.npmjs.com/package/@layerzerolabs/devtools"><img alt="NPM Version" src="https://img.shields.io/npm/v/@layerzerolabs/devtools"/></a>
<!-- Shields.io NPM downloads -->
<a href="https://www.npmjs.com/package/@layerzerolabs/utils"><img alt="Downloads" src="https://img.shields.io/npm/dm/@layerzerolabs/utils"/></a>
<a href="https://www.npmjs.com/package/@layerzerolabs/devtools"><img alt="Downloads" src="https://img.shields.io/npm/dm/@layerzerolabs/devtools"/></a>
<!-- Shields.io license badge -->
<a href="https://www.npmjs.com/package/@layerzerolabs/utils"><img alt="NPM License" src="https://img.shields.io/npm/l/@layerzerolabs/utils"/></a>
<a href="https://www.npmjs.com/package/@layerzerolabs/devtools"><img alt="NPM License" src="https://img.shields.io/npm/l/@layerzerolabs/devtools"/></a>
</p>

@@ -24,7 +24,7 @@

```bash
yarn add @layerzerolabs/utils
yarn add @layerzerolabs/devtools
pnpm add @layerzerolabs/utils
pnpm add @layerzerolabs/devtools
npm install @layerzerolabs/utils
npm install @layerzerolabs/devtools
```

@@ -42,3 +42,3 @@

import { EndpointId } from "@layerzerolabs/lz-definitions";
import { OmniPoint } from "@layerzerolabs/utils";
import { OmniPoint } from "@layerzerolabs/devtools";

@@ -57,3 +57,3 @@ const omniPoint: OmniPoint = {

import { EndpointId } from "@layerzerolabs/lz-definitions";
import { OmniVector } from "@layerzerolabs/utils";
import { OmniVector } from "@layerzerolabs/devtools";

@@ -60,0 +60,0 @@ const from: OmniPoint = {

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