@mysten/bcs
Advanced tools
Comparing version 0.0.0-experimental-20240926213518 to 0.0.0-experimental-20241126214925
# Change Log | ||
## 0.0.0-experimental-20240926213518 | ||
## 0.0.0-experimental-20241126214925 | ||
### Patch Changes | ||
- 1dd7713: Accept arrays of numbers when serializing bcs.bytes() | ||
## 1.1.0 | ||
### Minor Changes | ||
@@ -6,0 +12,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, Uint8Array>; | ||
bytes<T extends number>(size: T, options?: BcsTypeOptions<Uint8Array, Iterable<number>>): BcsType<Uint8Array, Iterable<number>>; | ||
/** | ||
@@ -62,0 +62,0 @@ * Creates a BcsType that can ser/de string values. Strings will be UTF-8 encoded |
@@ -164,4 +164,5 @@ "use strict"; | ||
write: (value, writer) => { | ||
const array = new Uint8Array(value); | ||
for (let i = 0; i < size; i++) { | ||
writer.write8(value[i] ?? 0); | ||
writer.write8(array[i] ?? 0); | ||
} | ||
@@ -168,0 +169,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, Uint8Array>; | ||
bytes<T extends number>(size: T, options?: BcsTypeOptions<Uint8Array, Iterable<number>>): BcsType<Uint8Array, Iterable<number>>; | ||
/** | ||
@@ -62,0 +62,0 @@ * Creates a BcsType that can ser/de string values. Strings will be UTF-8 encoded |
@@ -149,4 +149,5 @@ import { | ||
write: (value, writer) => { | ||
const array = new Uint8Array(value); | ||
for (let i = 0; i < size; i++) { | ||
writer.write8(value[i] ?? 0); | ||
writer.write8(array[i] ?? 0); | ||
} | ||
@@ -153,0 +154,0 @@ }, |
{ | ||
"name": "@mysten/bcs", | ||
"version": "0.0.0-experimental-20240926213518", | ||
"version": "0.0.0-experimental-20241126214925", | ||
"description": "BCS - Canonical Binary Serialization implementation for JavaScript", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
@@ -158,3 +158,3 @@ // Copyright (c) Mysten Labs, Inc. | ||
bytes<T extends number>(size: T, options?: BcsTypeOptions<Uint8Array, Iterable<number>>) { | ||
return fixedSizeBcsType<Uint8Array>({ | ||
return fixedSizeBcsType<Uint8Array, Iterable<number>>({ | ||
name: `bytes[${size}]`, | ||
@@ -164,4 +164,5 @@ size, | ||
write: (value, writer) => { | ||
const array = new Uint8Array(value); | ||
for (let i = 0; i < size; i++) { | ||
writer.write8(value[i] ?? 0); | ||
writer.write8(array[i] ?? 0); | ||
} | ||
@@ -168,0 +169,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
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
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
355484
4951