Skip to content
This repository has been archived by the owner on Dec 3, 2024. It is now read-only.

fix: add nullable type for transaction #248

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/snap/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 5 additions & 4 deletions packages/snap/src/util/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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<typeof SignaturePayloadJSONSchema>;
Expand Down
Loading