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

Commit d232283

Browse files
authored
fix: add nullable type for transaction (#248)
1 parent 6fa2dbd commit d232283

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

packages/snap/snap.manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "git+https://github.com/chainsafe/metamask-snap-polkadot.git"
88
},
99
"source": {
10-
"shasum": "Ub34hILBwiaKcauY0Oz3pstQ5uZidpRJlnx+mE6hXRI=",
10+
"shasum": "XZTf0C/b6ZNF2fpguQYHO282nTPg9irWFoamJ4aUSn4=",
1111
"location": {
1212
"npm": {
1313
"filePath": "dist/bundle.js",

packages/snap/src/util/validation.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { BlockId } from '@chainsafe/metamask-polkadot-types';
22
import type { SignerPayloadRaw } from '@polkadot/types/types';
33
import type { Describe, Infer } from 'superstruct';
44
import {
5+
nullable,
56
array,
67
boolean,
78
define,
@@ -22,21 +23,21 @@ const HexStringStruct = define<`0x${string}`>('HexString', (value) => {
2223
// SignerPayloadJSON from '@polkadot/types/types';
2324
const SignaturePayloadJSONSchema = object({
2425
address: string(),
25-
assetId: optional(union([number(), object()])),
26+
assetId: nullable(optional(union([number(), object()]))),
2627
blockHash: HexStringStruct,
2728
blockNumber: HexStringStruct,
2829
era: HexStringStruct,
2930
genesisHash: HexStringStruct,
30-
metadataHash: optional(HexStringStruct),
31+
metadataHash: nullable(optional(HexStringStruct)),
3132
method: string(),
32-
mode: optional(number()),
33+
mode: nullable(optional(number())),
3334
nonce: HexStringStruct,
3435
specVersion: HexStringStruct,
3536
tip: HexStringStruct,
3637
transactionVersion: HexStringStruct,
3738
signedExtensions: array(string()),
3839
version: number(),
39-
withSignedTransaction: optional(boolean())
40+
withSignedTransaction: nullable(optional(boolean()))
4041
});
4142

4243
type SignaturePayloadJSONType = Infer<typeof SignaturePayloadJSONSchema>;

0 commit comments

Comments
 (0)