@@ -11,10 +11,13 @@ import { thirdwebClient } from "../../../../../../utils/sdk";
11
11
import { thirdwebSdkVersionSchema } from "../../../../../schemas/httpHeaders/thirdwebSdkVersion" ;
12
12
import {
13
13
ercNFTResponseType ,
14
- nftInputSchema ,
15
14
signature721InputSchema ,
16
15
signature721OutputSchema ,
17
16
} from "../../../../../schemas/nft" ;
17
+ import {
18
+ signature721InputSchemaV5 ,
19
+ signature721OutputSchemaV5 ,
20
+ } from "../../../../../schemas/nft/v5" ;
18
21
import {
19
22
erc721ContractParamSchema ,
20
23
standardResponseSchema ,
@@ -31,34 +34,9 @@ const responseSchemaV4 = Type.Object({
31
34
} ) ;
32
35
33
36
// v5 sdk
34
- const requestBodySchemaV5 = Type . Intersect ( [
35
- Type . Object ( {
36
- to : Type . String ( ) ,
37
- metadata : Type . Union ( [ nftInputSchema , Type . String ( ) ] ) ,
38
- royaltyRecipient : Type . Optional ( Type . String ( ) ) ,
39
- royaltyBps : Type . Optional ( Type . Number ( ) ) ,
40
- primarySaleRecipient : Type . Optional ( Type . String ( ) ) ,
41
- price : Type . Optional ( Type . String ( ) ) ,
42
- priceInWei : Type . Optional ( Type . String ( ) ) ,
43
- currency : Type . Optional ( Type . String ( ) ) ,
44
- validityStartTimestamp : Type . Integer ( ) ,
45
- validityEndTimestamp : Type . Optional ( Type . Integer ( ) ) ,
46
- uid : Type . Optional ( Type . String ( ) ) ,
47
- } ) ,
48
- ] ) ;
37
+ const requestBodySchemaV5 = signature721InputSchemaV5 ;
49
38
const responseSchemaV5 = Type . Object ( {
50
- payload : Type . Object ( {
51
- to : Type . String ( ) ,
52
- royaltyRecipient : Type . String ( ) ,
53
- royaltyBps : Type . String ( ) ,
54
- primarySaleRecipient : Type . String ( ) ,
55
- uri : Type . String ( ) ,
56
- price : Type . String ( ) ,
57
- currency : Type . String ( ) ,
58
- validityStartTimestamp : Type . Integer ( ) ,
59
- validityEndTimestamp : Type . Integer ( ) ,
60
- uid : Type . String ( ) ,
61
- } ) ,
39
+ payload : signature721OutputSchemaV5 ,
62
40
signature : Type . String ( ) ,
63
41
} ) ;
64
42
@@ -172,7 +150,9 @@ export async function erc721SignatureGenerate(fastify: FastifyInstance) {
172
150
price,
173
151
priceInWei : maybeBigInt ( priceInWei ) ,
174
152
currency : currency as Address | undefined ,
175
- validityStartTimestamp : new Date ( validityStartTimestamp * 1000 ) ,
153
+ validityStartTimestamp : validityStartTimestamp
154
+ ? new Date ( validityStartTimestamp * 1000 )
155
+ : undefined ,
176
156
validityEndTimestamp : validityEndTimestamp
177
157
? new Date ( validityEndTimestamp * 1000 )
178
158
: undefined ,
0 commit comments