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

Commit

Permalink
fix: add nullable type for transaction (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lykhoyda authored Aug 27, 2024
1 parent 6fa2dbd commit d232283
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
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

0 comments on commit d232283

Please sign in to comment.