Skip to content

Commit d3a9b6f

Browse files
authored
Added Headers Details to sign End-points (#395)
1 parent 1c47eee commit d3a9b6f

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

src/server/routes/contract/extensions/erc1155/read/signatureGenerate.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
erc721ContractParamSchema,
1212
standardResponseSchema,
1313
} from "../../../../../schemas/sharedApiSchemas";
14+
import { walletAuthSchema } from "../../../../../schemas/wallet";
1415
import { getChainIdFromChain } from "../../../../../utils/chain";
1516
import { checkAndReturnNFTSignaturePayload } from "../../../../../utils/validator";
1617

@@ -47,6 +48,7 @@ export async function erc1155SignatureGenerate(fastify: FastifyInstance) {
4748
operationId: "signatureGenerate",
4849
params: requestSchema,
4950
body: requestBodySchema,
51+
headers: walletAuthSchema,
5052
response: {
5153
...standardResponseSchema,
5254
[StatusCodes.OK]: responseSchema,
@@ -67,10 +69,16 @@ export async function erc1155SignatureGenerate(fastify: FastifyInstance) {
6769
royaltyRecipient,
6870
uid,
6971
} = request.body;
72+
const walletAddress = request.headers[
73+
"x-backend-wallet-address"
74+
] as string;
75+
const accountAddress = request.headers["x-account-address"] as string;
7076
const chainId = await getChainIdFromChain(chain);
7177
const contract = await getContract({
7278
chainId,
7379
contractAddress,
80+
walletAddress,
81+
accountAddress,
7482
});
7583

7684
const payload = checkAndReturnNFTSignaturePayload<

src/server/routes/contract/extensions/erc20/read/signatureGenerate.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
erc721ContractParamSchema,
1212
standardResponseSchema,
1313
} from "../../../../../schemas/sharedApiSchemas";
14+
import { walletAuthSchema } from "../../../../../schemas/wallet";
1415
import { getChainIdFromChain } from "../../../../../utils/chain";
1516
import { checkAndReturnERC20SignaturePayload } from "../../../../../utils/validator";
1617

@@ -47,6 +48,7 @@ export async function erc20SignatureGenerate(fastify: FastifyInstance) {
4748
operationId: "signatureGenerate",
4849
params: requestSchema,
4950
body: requestBodySchema,
51+
headers: walletAuthSchema,
5052
response: {
5153
...standardResponseSchema,
5254
[StatusCodes.OK]: responseSchema,
@@ -67,11 +69,13 @@ export async function erc20SignatureGenerate(fastify: FastifyInstance) {
6769
const walletAddress = request.headers[
6870
"x-backend-wallet-address"
6971
] as string;
72+
const accountAddress = request.headers["x-account-address"] as string;
7073
const chainId = await getChainIdFromChain(chain);
7174
const contract = await getContract({
7275
chainId,
7376
contractAddress,
7477
walletAddress,
78+
accountAddress,
7579
});
7680

7781
const payload = checkAndReturnERC20SignaturePayload<

src/server/routes/contract/extensions/erc721/read/signatureGenerate.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,13 @@ export async function erc721SignatureGenerate(fastify: FastifyInstance) {
9696
const walletAddress = request.headers[
9797
"x-backend-wallet-address"
9898
] as string;
99+
const accountAddress = request.headers["x-account-address"] as string;
99100
const chainId = await getChainIdFromChain(chain);
100101
const contract = await getContract({
101102
chainId,
102103
contractAddress,
103104
walletAddress,
105+
accountAddress,
104106
});
105107

106108
const payload = checkAndReturnNFTSignaturePayload<

0 commit comments

Comments
 (0)