@xyo-network/data
Advanced tools
Comparing version 2.106.0 to 2.107.0
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
90837
173
3
1
+ Addedethers@6.13.1(transitive)
+ Addedws@8.17.1(transitive)
- Removedethers@6.13.0(transitive)
- Removedws@8.5.0(transitive)
Updatedethers@6.13.1