Skip to content

Commit 857090a

Browse files
Add tokenId support to ERC1155 signature generation (#902)
1 parent 4851842 commit 857090a

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/server/routes/contract/extensions/erc1155/read/signature-generate.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ const requestBodySchemaV5 = Type.Intersect([
5555
currency: Type.Optional(Type.String()),
5656
validityStartTimestamp: Type.Integer({ minimum: 0 }),
5757
validityEndTimestamp: Type.Optional(Type.Integer({ minimum: 0 })),
58+
tokenId: Type.Optional(Type.String()),
5859
uid: Type.Optional(Type.String()),
5960
}),
6061
Type.Union([
@@ -145,6 +146,7 @@ export async function erc1155SignatureGenerate(fastify: FastifyInstance) {
145146
currency,
146147
validityStartTimestamp,
147148
validityEndTimestamp,
149+
tokenId,
148150
uid,
149151
} = args;
150152

@@ -183,6 +185,7 @@ export async function erc1155SignatureGenerate(fastify: FastifyInstance) {
183185
royaltyBps,
184186
primarySaleRecipient,
185187
pricePerToken,
188+
tokenId: maybeBigInt(tokenId),
186189
pricePerTokenWei: maybeBigInt(pricePerTokenWei),
187190
currency,
188191
validityStartTimestamp: new Date(validityStartTimestamp * 1000),
@@ -223,6 +226,7 @@ export async function erc1155SignatureGenerate(fastify: FastifyInstance) {
223226
royaltyBps,
224227
royaltyRecipient,
225228
uid,
229+
tokenId,
226230
} = request.body as Static<typeof requestBodySchemaV4>;
227231

228232
const contract = await getContractV4({
@@ -247,6 +251,7 @@ export async function erc1155SignatureGenerate(fastify: FastifyInstance) {
247251
royaltyBps,
248252
royaltyRecipient,
249253
uid,
254+
tokenId,
250255
});
251256

252257
const signedPayload = await contract.erc1155.signature.generate(payload);

src/server/schemas/nft/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,12 @@ export const signature1155InputSchema = Type.Object({
302302
Type.Integer({ minimum: 0 }),
303303
]),
304304
),
305+
tokenId: Type.Optional(
306+
Type.String({
307+
description:
308+
"The token id to mint. If not provided, a new token id will be generated.",
309+
}),
310+
),
305311
});
306312

307313
export const signature1155OutputSchema = Type.Object({

0 commit comments

Comments
 (0)