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

@metaplex-foundation/umi-serializer-data-view

Package Overview
Dependencies
Maintainers
10
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metaplex-foundation/umi-serializer-data-view - npm Package Compare versions

Comparing version 0.7.3 to 0.7.4

6

package.json
{
"name": "@metaplex-foundation/umi-serializer-data-view",
"version": "0.7.3",
"version": "0.7.4",
"description": "A serializer implementation relying on the native DataView API",

@@ -23,3 +23,3 @@ "license": "MIT",

"peerDependencies": {
"@metaplex-foundation/umi": "^0.7.2"
"@metaplex-foundation/umi": "^0.7.4"
},

@@ -29,3 +29,3 @@ "devDependencies": {

"ava": "^5.1.0",
"@metaplex-foundation/umi": "^0.7.2"
"@metaplex-foundation/umi": "^0.7.4"
},

@@ -32,0 +32,0 @@ "publishConfig": {

@@ -391,2 +391,3 @@ import {

): Serializer<T> => {
const prefix = options.size ?? u8();
const enumKeys = Object.keys(constructor);

@@ -420,11 +421,13 @@ const enumValues = Object.values(constructor);

return {
description: options.description ?? `enum(${valueDescriptions})`,
fixedSize: 1,
maxSize: 1,
description:
options.description ??
`enum(${valueDescriptions}; ${prefix.description})`,
fixedSize: prefix.fixedSize,
maxSize: prefix.maxSize,
serialize: (value: T) => {
assertValidVariant(value as string | number);
if (typeof value === 'number') return u8().serialize(value);
if (typeof value === 'number') return prefix.serialize(value);
const valueIndex = enumValues.indexOf(value);
if (valueIndex >= 0) return u8().serialize(valueIndex);
return u8().serialize(enumKeys.indexOf(value as string));
if (valueIndex >= 0) return prefix.serialize(valueIndex);
return prefix.serialize(enumKeys.indexOf(value as string));
},

@@ -435,6 +438,10 @@ deserialize: (bytes: Uint8Array, offset = 0) => {

}
const [value, newOffset] = u8().deserialize(bytes, offset);
const [value, newOffset] = prefix.deserialize(bytes, offset);
const valueAsNumber = Number(value);
offset = newOffset;
assertValidVariant(value);
return [(isNumericEnum ? value : enumValues[value]) as T, offset];
assertValidVariant(valueAsNumber);
return [
(isNumericEnum ? valueAsNumber : enumValues[valueAsNumber]) as T,
offset,
];
},

@@ -448,3 +455,3 @@ };

): Serializer<T, U> => {
const prefix = options.prefix ?? u8();
const prefix = options.size ?? u8();
const fieldDescriptions = variants

@@ -451,0 +458,0 @@ .map(

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