File tree Expand file tree Collapse file tree 6 files changed +19
-21
lines changed Expand file tree Collapse file tree 6 files changed +19
-21
lines changed Original file line number Diff line number Diff line change 1
- import { PublicKeySchema , TransactionPayload } from "@mina-js/utils" ;
1
+ import { PublicKeySchema , TransactionBodySchema } from "@mina-js/utils" ;
2
2
import { z } from "zod" ;
3
3
import { SendZkappInput } from "./zkapp" ;
4
4
@@ -12,7 +12,7 @@ export const SignatureSchema = z.union([
12
12
z . object ( { field : z . string ( ) , scalar : z . string ( ) } ) ,
13
13
] ) ;
14
14
export const SendTransactionBodySchema = z . object ( {
15
- input : TransactionPayload ,
15
+ input : TransactionBodySchema ,
16
16
signature : SignatureSchema ,
17
17
} ) ;
18
18
export const SendZkAppBodySchema = z . object ( {
Original file line number Diff line number Diff line change 1
- import { FieldSchema , TransactionBody } from "@mina-js/utils" ;
1
+ import { FieldSchema , TransactionBodySchema } from "@mina-js/utils" ;
2
2
import { z } from "zod" ;
3
3
4
4
export const SignFieldsParamsSchema = z
@@ -21,6 +21,6 @@ export const CreateNullifierParamsSchema = z
21
21
22
22
export const SignTransactionParamsSchema = z
23
23
. object ( {
24
- transaction : TransactionBody ,
24
+ transaction : TransactionBodySchema ,
25
25
} )
26
26
. strict ( ) ;
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import type {
7
7
SignTransaction ,
8
8
} from "@mina-js/accounts" ;
9
9
import { createClient } from "@mina-js/klesia-sdk" ;
10
- import type { PartiallyFormedTransactionProperties } from "@mina-js/utils" ;
10
+ import type { PartialTransaction } from "@mina-js/utils" ;
11
11
import { match } from "ts-pattern" ;
12
12
import { createStore } from "./store" ;
13
13
@@ -117,9 +117,7 @@ export const createWalletClient = ({
117
117
if ( account . type !== "local" ) throw new Error ( "Account type not supported" ) ;
118
118
return account . createNullifier ( params ) ;
119
119
} ;
120
- const prepareTransactionRequest = async (
121
- transaction : PartiallyFormedTransactionProperties ,
122
- ) => {
120
+ const prepareTransactionRequest = async ( transaction : PartialTransaction ) => {
123
121
let fee = transaction . fee ;
124
122
let nonce = transaction . nonce ;
125
123
if ( ! nonce ) {
Original file line number Diff line number Diff line change 7
7
SignedFieldsSchema ,
8
8
SignedMessageSchema ,
9
9
SignedTransactionSchema ,
10
- TransactionPayload ,
10
+ TransactionPayloadSchema ,
11
11
TransactionReceiptSchema ,
12
12
} from "@mina-js/utils" ;
13
13
import { z } from "zod" ;
@@ -57,7 +57,7 @@ export const SignFieldsRequestParamsSchema = RequestWithContext.extend({
57
57
} ) . strict ( ) ;
58
58
export const SignTransactionRequestParamsSchema = RequestWithContext . extend ( {
59
59
method : z . literal ( "mina_signTransaction" ) ,
60
- params : z . array ( z . union ( [ TransactionPayload , ZkAppCommandPayload ] ) ) ,
60
+ params : z . array ( z . union ( [ TransactionPayloadSchema , ZkAppCommandPayload ] ) ) ,
61
61
} ) . strict ( ) ;
62
62
export const SendTransactionRequestParamsSchema = RequestWithContext . extend ( {
63
63
method : z . literal ( "mina_sendTransaction" ) ,
Original file line number Diff line number Diff line change @@ -2,13 +2,14 @@ import type { z } from "zod";
2
2
import type {
3
3
LiteralSchema ,
4
4
NullifierSchema ,
5
- PartiallyFormedTransactionPayload ,
5
+ PartialTransactionSchema ,
6
6
PrivateKeySchema ,
7
7
PublicKeySchema ,
8
8
SignedFieldsSchema ,
9
9
SignedMessageSchema ,
10
10
SignedTransactionSchema ,
11
- TransactionPayload ,
11
+ TransactionBodySchema ,
12
+ TransactionPayloadSchema ,
12
13
TransactionReceiptSchema ,
13
14
ZkAppCommandPayload ,
14
15
} from "./validation" ;
@@ -20,10 +21,9 @@ export type Literal = z.infer<typeof LiteralSchema>;
20
21
export type Json = Literal | { [ key : string ] : Json } | Json [ ] ;
21
22
export type PublicKey = z . infer < typeof PublicKeySchema > ;
22
23
export type PrivateKey = z . infer < typeof PrivateKeySchema > ;
23
- export type TransactionProperties = z . infer < typeof TransactionPayload > ;
24
- export type PartiallyFormedTransactionProperties = z . infer <
25
- typeof PartiallyFormedTransactionPayload
26
- > ;
24
+ export type TransactionBody = z . infer < typeof TransactionBodySchema > ;
25
+ export type TransactionPayload = z . infer < typeof TransactionPayloadSchema > ;
26
+ export type PartialTransaction = z . infer < typeof PartialTransactionSchema > ;
27
27
export type ZkAppCommandProperties = z . infer < typeof ZkAppCommandPayload > ;
28
28
29
29
/**
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ export const FeePayerSchema = z
37
37
} )
38
38
. strict ( ) ;
39
39
40
- export const TransactionBody = z
40
+ export const TransactionBodySchema = z
41
41
. object ( {
42
42
from : PublicKeySchema ,
43
43
to : PublicKeySchema ,
@@ -49,13 +49,13 @@ export const TransactionBody = z
49
49
} )
50
50
. strict ( ) ;
51
51
52
- export const TransactionPayload = z
52
+ export const TransactionPayloadSchema = z
53
53
. object ( {
54
- transaction : TransactionBody ,
54
+ transaction : TransactionBodySchema ,
55
55
} )
56
56
. strict ( ) ;
57
57
58
- export const PartiallyFormedTransactionPayload = TransactionPayload . extend ( {
58
+ export const PartialTransactionSchema = TransactionPayloadSchema . extend ( {
59
59
fee : z . coerce . string ( ) . optional ( ) ,
60
60
nonce : z . coerce . string ( ) . optional ( ) ,
61
61
} ) ;
@@ -112,7 +112,7 @@ export const SignedTransactionSchema = z
112
112
. object ( {
113
113
signature : SignatureSchema ,
114
114
publicKey : PublicKeySchema ,
115
- data : TransactionBody ,
115
+ data : TransactionBodySchema ,
116
116
} )
117
117
. strict ( ) ;
118
118
You can’t perform that action at this time.
0 commit comments