@@ -27,75 +27,78 @@ export const AddChainRequestParams = z
27
27
. strict ( ) ;
28
28
29
29
// Params
30
- export const AccountsRequestParamsSchema = z
31
- . object ( {
30
+ export const RequestWithContext = z . object ( {
31
+ context : z . record ( z . any ( ) ) . default ( { } ) . optional ( )
32
+ } ) . strict ( )
33
+ export const AccountsRequestParamsSchema = RequestWithContext
34
+ . extend ( {
32
35
method : z . literal ( "mina_accounts" ) ,
33
36
} )
34
37
. strict ( ) ;
35
- export const RequestAccountsRequestParamsSchema = z
36
- . object ( {
38
+ export const RequestAccountsRequestParamsSchema = RequestWithContext
39
+ . extend ( {
37
40
method : z . literal ( "mina_requestAccounts" ) ,
38
41
} )
39
42
. strict ( ) ;
40
- export const ChainIdRequestParamsSchema = z
41
- . object ( { method : z . literal ( "mina_chainId" ) } )
43
+ export const ChainIdRequestParamsSchema = RequestWithContext
44
+ . extend ( { method : z . literal ( "mina_chainId" ) } )
42
45
. strict ( ) ;
43
- export const ChainInformationRequestParamsSchema = z
44
- . object ( { method : z . literal ( "mina_chainInformation" ) } )
46
+ export const ChainInformationRequestParamsSchema = RequestWithContext
47
+ . extend ( { method : z . literal ( "mina_chainInformation" ) } )
45
48
. strict ( ) ;
46
- export const GetBalanceRequestParamsSchema = z
47
- . object ( { method : z . literal ( "mina_getBalance" ) } )
49
+ export const GetBalanceRequestParamsSchema = RequestWithContext
50
+ . extend ( { method : z . literal ( "mina_getBalance" ) } )
48
51
. strict ( ) ;
49
- export const SignRequestParamsSchema = z
50
- . object ( {
52
+ export const SignRequestParamsSchema = RequestWithContext
53
+ . extend ( {
51
54
method : z . literal ( "mina_sign" ) ,
52
55
params : z . array ( z . string ( ) ) ,
53
56
} )
54
57
. strict ( ) ;
55
- export const SignFieldsRequestParamsSchema = z
56
- . object ( {
58
+ export const SignFieldsRequestParamsSchema = RequestWithContext
59
+ . extend ( {
57
60
method : z . literal ( "mina_signFields" ) ,
58
61
params : z . array ( z . array ( FieldSchema ) ) ,
59
62
} )
60
63
. strict ( ) ;
61
- export const SignTransactionRequestParamsSchema = z
62
- . object ( {
64
+ export const SignTransactionRequestParamsSchema = RequestWithContext
65
+ . extend ( {
63
66
method : z . literal ( "mina_signTransaction" ) ,
64
67
params : z . array ( z . union ( [ TransactionPayload , ZkAppCommandPayload ] ) ) ,
65
68
} )
66
69
. strict ( ) ;
67
- export const SendTransactionRequestParamsSchema = z
68
- . object ( {
70
+ export const SendTransactionRequestParamsSchema = RequestWithContext
71
+ . extend ( {
69
72
method : z . literal ( "mina_sendTransaction" ) ,
70
73
params : z . array ( SignedTransactionSchema ) ,
71
74
} )
72
75
. strict ( ) ;
73
- export const CreateNullifierRequestParamsSchema = z
74
- . object ( {
76
+ export const CreateNullifierRequestParamsSchema = RequestWithContext
77
+ . extend ( {
75
78
method : z . literal ( "mina_createNullifier" ) ,
76
79
params : z . array ( z . array ( FieldSchema ) ) ,
77
80
} )
78
81
. strict ( ) ;
79
- export const SwitchChainRequestParamsSchema = z
80
- . object ( {
82
+ export const SwitchChainRequestParamsSchema = RequestWithContext
83
+ . extend ( {
81
84
method : z . literal ( "mina_switchChain" ) ,
82
85
params : z . array ( z . string ( ) ) ,
83
86
} )
84
87
. strict ( ) ;
85
- export const AddChainRequestParamsSchema = z
86
- . object ( {
88
+ export const AddChainRequestParamsSchema = RequestWithContext
89
+ . extend ( {
87
90
method : z . literal ( "mina_addChain" ) ,
88
91
params : z . array ( AddChainRequestParams ) ,
89
92
} )
90
93
. strict ( ) ;
91
- export const SetStateRequestParamsSchema = z
92
- . object ( {
94
+ export const SetStateRequestParamsSchema = RequestWithContext
95
+ . extend ( {
93
96
method : z . literal ( "mina_setState" ) ,
94
97
params : z . array ( JsonSchema ) ,
95
98
} )
96
99
. strict ( ) ;
97
- export const GetStateRequestParamsSchema = z
98
- . object ( {
100
+ export const GetStateRequestParamsSchema = RequestWithContext
101
+ . extend ( {
99
102
method : z . literal ( "mina_getState" ) ,
100
103
params : z . array ( z . string ( ) ) ,
101
104
} )
0 commit comments