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

@xyo-network/data

Package Overview
Dependencies
Maintainers
0
Versions
347
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xyo-network/data - npm Package Compare versions

Comparing version 2.106.0 to 2.107.0

2

dist/browser/Data.d.ts

@@ -15,3 +15,3 @@ import { Hex } from '@xylabs/hex';

get bytes(): ArrayBuffer;
get hex(): Lowercase<string>;
get hex(): Hex;
get keccak256(): Uint8Array;

@@ -18,0 +18,0 @@ static from(data: ArrayBuffer | undefined): Data | undefined;

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

// src/AbstractData.ts
var AbstractData = class _AbstractData {
get length() {
return this.bytes.byteLength;
}
static is(value) {
return value instanceof _AbstractData;
}
};
// src/Data.ts
import { base16, base58 } from "@scure/base";
import { toArrayBuffer, toUint8Array } from "@xylabs/arraybuffer";
import { assertEx } from "@xylabs/assert";
import { keccak256 } from "ethers";
var Data = class _Data extends AbstractData {
_bytes;
_length;
constructor(length, bytes, base) {
super();
this._bytes = toUint8Array(bytes, length, base);
this._length = length;
}
get base58() {
this.checkLength();
return base58.encode(new Uint8Array(this.bytes));
}
get bytes() {
return assertEx(this._bytes, () => "Data uninitialized");
}
get hex() {
this.checkLength();
return base16.encode(new Uint8Array(this.bytes)).toLowerCase();
}
get keccak256() {
this.checkLength();
return toArrayBuffer(keccak256(new Uint8Array(this.bytes)));
}
static from(data) {
return data ? new _Data(data.byteLength, data) : void 0;
}
checkLength() {
assertEx(this.bytes.byteLength === this._length, () => `Length Mismatch: ${this.bytes.byteLength} !== ${this._length}`);
}
};
export {
AbstractData,
Data
};
var e=class r{get length(){return this.bytes.byteLength}static is(t){return t instanceof r}};import{base16 as h,base58 as c}from"@scure/base";import{toArrayBuffer as o,toUint8Array as b}from"@xylabs/arraybuffer";import{assertEx as s}from"@xylabs/assert";import{keccak256 as y}from"ethers";var n=class r extends e{_bytes;_length;constructor(t,a,i){super(),this._bytes=b(a,t,i),this._length=t}get base58(){return this.checkLength(),c.encode(new Uint8Array(this.bytes))}get bytes(){return s(this._bytes,()=>"Data uninitialized")}get hex(){return this.checkLength(),h.encode(new Uint8Array(this.bytes)).toLowerCase()}get keccak256(){return this.checkLength(),o(y(new Uint8Array(this.bytes)))}static from(t){return t?new r(t.byteLength,t):void 0}checkLength(){s(this.bytes.byteLength===this._length,()=>`Length Mismatch: ${this.bytes.byteLength} !== ${this._length}`)}};export{e as AbstractData,n as Data};
//# sourceMappingURL=index.js.map

@@ -15,3 +15,3 @@ import { Hex } from '@xylabs/hex';

get bytes(): ArrayBuffer;
get hex(): Lowercase<string>;
get hex(): Hex;
get keccak256(): Uint8Array;

@@ -18,0 +18,0 @@ static from(data: ArrayBuffer | undefined): Data | undefined;

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

// src/AbstractData.ts
var AbstractData = class _AbstractData {
get length() {
return this.bytes.byteLength;
}
static is(value) {
return value instanceof _AbstractData;
}
};
// src/Data.ts
import { base16, base58 } from "@scure/base";
import { toArrayBuffer, toUint8Array } from "@xylabs/arraybuffer";
import { assertEx } from "@xylabs/assert";
import { keccak256 } from "ethers";
var Data = class _Data extends AbstractData {
_bytes;
_length;
constructor(length, bytes, base) {
super();
this._bytes = toUint8Array(bytes, length, base);
this._length = length;
}
get base58() {
this.checkLength();
return base58.encode(new Uint8Array(this.bytes));
}
get bytes() {
return assertEx(this._bytes, () => "Data uninitialized");
}
get hex() {
this.checkLength();
return base16.encode(new Uint8Array(this.bytes)).toLowerCase();
}
get keccak256() {
this.checkLength();
return toArrayBuffer(keccak256(new Uint8Array(this.bytes)));
}
static from(data) {
return data ? new _Data(data.byteLength, data) : void 0;
}
checkLength() {
assertEx(this.bytes.byteLength === this._length, () => `Length Mismatch: ${this.bytes.byteLength} !== ${this._length}`);
}
};
export {
AbstractData,
Data
};
var e=class r{get length(){return this.bytes.byteLength}static is(t){return t instanceof r}};import{base16 as h,base58 as c}from"@scure/base";import{toArrayBuffer as o,toUint8Array as b}from"@xylabs/arraybuffer";import{assertEx as s}from"@xylabs/assert";import{keccak256 as y}from"ethers";var n=class r extends e{_bytes;_length;constructor(t,a,i){super(),this._bytes=b(a,t,i),this._length=t}get base58(){return this.checkLength(),c.encode(new Uint8Array(this.bytes))}get bytes(){return s(this._bytes,()=>"Data uninitialized")}get hex(){return this.checkLength(),h.encode(new Uint8Array(this.bytes)).toLowerCase()}get keccak256(){return this.checkLength(),o(y(new Uint8Array(this.bytes)))}static from(t){return t?new r(t.byteLength,t):void 0}checkLength(){s(this.bytes.byteLength===this._length,()=>`Length Mismatch: ${this.bytes.byteLength} !== ${this._length}`)}};export{e as AbstractData,n as Data};
//# sourceMappingURL=index.js.map

@@ -15,3 +15,3 @@ import { Hex } from '@xylabs/hex';

get bytes(): ArrayBuffer;
get hex(): Lowercase<string>;
get hex(): Hex;
get keccak256(): Uint8Array;

@@ -18,0 +18,0 @@ static from(data: ArrayBuffer | undefined): Data | undefined;

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

// src/AbstractData.ts
var AbstractData = class _AbstractData {
get length() {
return this.bytes.byteLength;
}
static is(value) {
return value instanceof _AbstractData;
}
};
// src/Data.ts
import { base16, base58 } from "@scure/base";
import { toArrayBuffer, toUint8Array } from "@xylabs/arraybuffer";
import { assertEx } from "@xylabs/assert";
import { keccak256 } from "ethers";
var Data = class _Data extends AbstractData {
_bytes;
_length;
constructor(length, bytes, base) {
super();
this._bytes = toUint8Array(bytes, length, base);
this._length = length;
}
get base58() {
this.checkLength();
return base58.encode(new Uint8Array(this.bytes));
}
get bytes() {
return assertEx(this._bytes, () => "Data uninitialized");
}
get hex() {
this.checkLength();
return base16.encode(new Uint8Array(this.bytes)).toLowerCase();
}
get keccak256() {
this.checkLength();
return toArrayBuffer(keccak256(new Uint8Array(this.bytes)));
}
static from(data) {
return data ? new _Data(data.byteLength, data) : void 0;
}
checkLength() {
assertEx(this.bytes.byteLength === this._length, () => `Length Mismatch: ${this.bytes.byteLength} !== ${this._length}`);
}
};
export {
AbstractData,
Data
};
var e=class r{get length(){return this.bytes.byteLength}static is(t){return t instanceof r}};import{base16 as h,base58 as c}from"@scure/base";import{toArrayBuffer as o,toUint8Array as b}from"@xylabs/arraybuffer";import{assertEx as s}from"@xylabs/assert";import{keccak256 as y}from"ethers";var n=class r extends e{_bytes;_length;constructor(t,a,i){super(),this._bytes=b(a,t,i),this._length=t}get base58(){return this.checkLength(),c.encode(new Uint8Array(this.bytes))}get bytes(){return s(this._bytes,()=>"Data uninitialized")}get hex(){return this.checkLength(),h.encode(new Uint8Array(this.bytes)).toLowerCase()}get keccak256(){return this.checkLength(),o(y(new Uint8Array(this.bytes)))}static from(t){return t?new r(t.byteLength,t):void 0}checkLength(){s(this.bytes.byteLength===this._length,()=>`Length Mismatch: ${this.bytes.byteLength} !== ${this._length}`)}};export{e as AbstractData,n as Data};
//# sourceMappingURL=index.js.map

@@ -18,8 +18,8 @@ {

"@xylabs/hex": "^3.5.1",
"ethers": "6.13.0"
"ethers": "6.13.1"
},
"devDependencies": {
"@xylabs/ts-scripts-yarn3": "^3.11.2",
"@xylabs/tsconfig": "^3.11.2",
"typescript": "^5.4.5"
"@xylabs/ts-scripts-yarn3": "^3.11.8",
"@xylabs/tsconfig": "^3.11.8",
"typescript": "^5.5.2"
},

@@ -64,4 +64,4 @@ "exports": {

"sideEffects": false,
"version": "2.106.0",
"version": "2.107.0",
"type": "module"
}

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

/* eslint-disable import/no-deprecated */
import { base16, base58 } from '@scure/base'

@@ -3,0 +2,0 @@ import { toArrayBuffer, toUint8Array } from '@xylabs/arraybuffer'

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

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

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