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

@mysten/bcs

Package Overview
Dependencies
Maintainers
7
Versions
537
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mysten/bcs - npm Package Compare versions

Comparing version 0.0.0-experimental-20241209193009 to 0.0.0-experimental-20250127194049

14

CHANGELOG.md
# Change Log
## 0.0.0-experimental-20241209193009
## 0.0.0-experimental-20250127194049
### Minor Changes
- 10e2724: Allow BcsType.transform to omit input or output transform
## 1.2.1
### Patch Changes
- 7abd243: Update repo links
## 1.2.0
### Minor Changes
- ad24b95: Verify hex string is valid hex in `fromHex`

@@ -8,0 +20,0 @@

4

dist/cjs/b58.d.ts
export declare const toBase58: (buffer: Uint8Array) => string;
export declare const fromBase58: (str: string) => Uint8Array;
export declare const fromBase58: (str: string) => Uint8Array<ArrayBufferLike>;
/** @deprecated use toBase58 instead */
export declare const toB58: (buffer: Uint8Array) => string;
/** @deprecated use fromBase58 instead */
export declare const fromB58: (str: string) => Uint8Array;
export declare const fromB58: (str: string) => Uint8Array<ArrayBufferLike>;

@@ -30,5 +30,5 @@ import { BcsReader } from './reader.js';

fromBase64(b64: string): T;
transform<T2, Input2>({ name, input, output, validate, }: {
input: (val: Input2) => Input;
output: (value: T) => T2;
transform<T2 = T, Input2 = Input>({ name, input, output, validate, }: {
input?: (val: Input2) => Input;
output?: (value: T) => T2;
} & BcsTypeOptions<T2, Input2>): BcsType<T2, Input2>;

@@ -39,4 +39,5 @@ }

#private;
[x: number]: boolean;
constructor(type: BcsType<T, Input>, schema: Uint8Array);
toBytes(): Uint8Array;
toBytes(): Uint8Array<ArrayBufferLike>;
toHex(): string;

@@ -43,0 +44,0 @@ toBase64(): string;

@@ -94,9 +94,9 @@ "use strict";

name: name ?? this.name,
read: (reader) => output(this.read(reader)),
write: (value, writer) => __privateGet(this, _write).call(this, input(value), writer),
serializedSize: (value) => this.serializedSize(input(value)),
serialize: (value, options) => __privateGet(this, _serialize).call(this, input(value), options),
read: (reader) => output ? output(this.read(reader)) : this.read(reader),
write: (value, writer) => __privateGet(this, _write).call(this, input ? input(value) : value, writer),
serializedSize: (value) => this.serializedSize(input ? input(value) : value),
serialize: (value, options) => __privateGet(this, _serialize).call(this, input ? input(value) : value, options),
validate: (value) => {
validate?.(value);
this.validate(input(value));
this.validate(input ? input(value) : value);
}

@@ -103,0 +103,0 @@ });

@@ -59,3 +59,3 @@ import type { BcsTypeOptions } from './bcs-type.js';

*/
bytes<T extends number>(size: T, options?: BcsTypeOptions<Uint8Array, Iterable<number>>): BcsType<Uint8Array, Iterable<number>>;
bytes<T extends number>(size: T, options?: BcsTypeOptions<Uint8Array, Iterable<number>>): BcsType<Uint8Array<ArrayBufferLike>, Iterable<number>>;
/**

@@ -62,0 +62,0 @@ * Creates a BcsType that can ser/de string values. Strings will be UTF-8 encoded

@@ -19,4 +19,4 @@ "use strict";

var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var src_exports = {};
__export(src_exports, {
var index_exports = {};
__export(index_exports, {
BcsReader: () => import_reader.BcsReader,

@@ -44,3 +44,3 @@ BcsType: () => import_bcs_type.BcsType,

});
module.exports = __toCommonJS(src_exports);
module.exports = __toCommonJS(index_exports);
var import_b58 = require("./b58.js");

@@ -47,0 +47,0 @@ var import_b64 = require("./b64.js");

export declare const toBase58: (buffer: Uint8Array) => string;
export declare const fromBase58: (str: string) => Uint8Array;
export declare const fromBase58: (str: string) => Uint8Array<ArrayBufferLike>;
/** @deprecated use toBase58 instead */
export declare const toB58: (buffer: Uint8Array) => string;
/** @deprecated use fromBase58 instead */
export declare const fromB58: (str: string) => Uint8Array;
export declare const fromB58: (str: string) => Uint8Array<ArrayBufferLike>;

@@ -30,5 +30,5 @@ import { BcsReader } from './reader.js';

fromBase64(b64: string): T;
transform<T2, Input2>({ name, input, output, validate, }: {
input: (val: Input2) => Input;
output: (value: T) => T2;
transform<T2 = T, Input2 = Input>({ name, input, output, validate, }: {
input?: (val: Input2) => Input;
output?: (value: T) => T2;
} & BcsTypeOptions<T2, Input2>): BcsType<T2, Input2>;

@@ -39,4 +39,5 @@ }

#private;
[x: number]: boolean;
constructor(type: BcsType<T, Input>, schema: Uint8Array);
toBytes(): Uint8Array;
toBytes(): Uint8Array<ArrayBufferLike>;
toHex(): string;

@@ -43,0 +44,0 @@ toBase64(): string;

@@ -63,9 +63,9 @@ var __typeError = (msg) => {

name: name ?? this.name,
read: (reader) => output(this.read(reader)),
write: (value, writer) => __privateGet(this, _write).call(this, input(value), writer),
serializedSize: (value) => this.serializedSize(input(value)),
serialize: (value, options) => __privateGet(this, _serialize).call(this, input(value), options),
read: (reader) => output ? output(this.read(reader)) : this.read(reader),
write: (value, writer) => __privateGet(this, _write).call(this, input ? input(value) : value, writer),
serializedSize: (value) => this.serializedSize(input ? input(value) : value),
serialize: (value, options) => __privateGet(this, _serialize).call(this, input ? input(value) : value, options),
validate: (value) => {
validate?.(value);
this.validate(input(value));
this.validate(input ? input(value) : value);
}

@@ -72,0 +72,0 @@ });

@@ -59,3 +59,3 @@ import type { BcsTypeOptions } from './bcs-type.js';

*/
bytes<T extends number>(size: T, options?: BcsTypeOptions<Uint8Array, Iterable<number>>): BcsType<Uint8Array, Iterable<number>>;
bytes<T extends number>(size: T, options?: BcsTypeOptions<Uint8Array, Iterable<number>>): BcsType<Uint8Array<ArrayBufferLike>, Iterable<number>>;
/**

@@ -62,0 +62,0 @@ * Creates a BcsType that can ser/de string values. Strings will be UTF-8 encoded

{
"name": "@mysten/bcs",
"version": "0.0.0-experimental-20241209193009",
"version": "0.0.0-experimental-20250127194049",
"description": "BCS - Canonical Binary Serialization implementation for JavaScript",

@@ -25,3 +25,3 @@ "license": "Apache-2.0",

"type": "git",
"url": "git+https://github.com/mystenlabs/sui.git"
"url": "git+https://github.com/MystenLabs/ts-sdks.git"
},

@@ -37,3 +37,3 @@ "keywords": [

"bugs": {
"url": "https://github.com/mystenlabs/sui/issues"
"url": "https://github.com/MystenLabs/ts-sdks/issues"
},

@@ -50,8 +50,8 @@ "size-limit": [

],
"homepage": "https://github.com/mystenlabs/sui#readme",
"homepage": "https://github.com/MystenLabs/ts-sdks#readme",
"devDependencies": {
"@size-limit/preset-small-lib": "^11.1.4",
"size-limit": "^11.1.4",
"typescript": "^5.5.3",
"vitest": "^2.0.1",
"typescript": "^5.7.2",
"vitest": "^2.1.8",
"@mysten/build-scripts": "0.0.0"

@@ -58,0 +58,0 @@ },

@@ -82,3 +82,3 @@ // Copyright (c) Mysten Labs, Inc.

transform<T2, Input2>({
transform<T2 = T, Input2 = Input>({
name,

@@ -89,14 +89,15 @@ input,

}: {
input: (val: Input2) => Input;
output: (value: T) => T2;
input?: (val: Input2) => Input;
output?: (value: T) => T2;
} & BcsTypeOptions<T2, Input2>) {
return new BcsType<T2, Input2>({
name: name ?? this.name,
read: (reader) => output(this.read(reader)),
write: (value, writer) => this.#write(input(value), writer),
serializedSize: (value) => this.serializedSize(input(value)),
serialize: (value, options) => this.#serialize(input(value), options),
read: (reader) => (output ? output(this.read(reader)) : (this.read(reader) as never)),
write: (value, writer) => this.#write(input ? input(value) : (value as never), writer),
serializedSize: (value) => this.serializedSize(input ? input(value) : (value as never)),
serialize: (value, options) =>
this.#serialize(input ? input(value) : (value as never), options),
validate: (value) => {
validate?.(value);
this.validate(input(value));
this.validate(input ? input(value) : (value as never));
},

@@ -103,0 +104,0 @@ });

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