From 24c37a7e3a19cfc07a6e679379a1d390bb2f47a5 Mon Sep 17 00:00:00 2001 From: Anton Lykhoyda Date: Tue, 27 Aug 2024 17:03:47 +0200 Subject: [PATCH] fix add nullable type --- packages/snap/snap.manifest.json | 2 +- packages/snap/src/util/validation.ts | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/snap/snap.manifest.json b/packages/snap/snap.manifest.json index 01ba2bb4..485871b6 100644 --- a/packages/snap/snap.manifest.json +++ b/packages/snap/snap.manifest.json @@ -7,7 +7,7 @@ "url": "git+https://github.com/chainsafe/metamask-snap-polkadot.git" }, "source": { - "shasum": "Ub34hILBwiaKcauY0Oz3pstQ5uZidpRJlnx+mE6hXRI=", + "shasum": "XZTf0C/b6ZNF2fpguQYHO282nTPg9irWFoamJ4aUSn4=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/snap/src/util/validation.ts b/packages/snap/src/util/validation.ts index f114e742..3261f5e6 100644 --- a/packages/snap/src/util/validation.ts +++ b/packages/snap/src/util/validation.ts @@ -2,6 +2,7 @@ import type { BlockId } from '@chainsafe/metamask-polkadot-types'; import type { SignerPayloadRaw } from '@polkadot/types/types'; import type { Describe, Infer } from 'superstruct'; import { + nullable, array, boolean, define, @@ -22,21 +23,21 @@ const HexStringStruct = define<`0x${string}`>('HexString', (value) => { // SignerPayloadJSON from '@polkadot/types/types'; const SignaturePayloadJSONSchema = object({ address: string(), - assetId: optional(union([number(), object()])), + assetId: nullable(optional(union([number(), object()]))), blockHash: HexStringStruct, blockNumber: HexStringStruct, era: HexStringStruct, genesisHash: HexStringStruct, - metadataHash: optional(HexStringStruct), + metadataHash: nullable(optional(HexStringStruct)), method: string(), - mode: optional(number()), + mode: nullable(optional(number())), nonce: HexStringStruct, specVersion: HexStringStruct, tip: HexStringStruct, transactionVersion: HexStringStruct, signedExtensions: array(string()), version: number(), - withSignedTransaction: optional(boolean()) + withSignedTransaction: nullable(optional(boolean())) }); type SignaturePayloadJSONType = Infer;