Skip to content

Commit fa5c40d

Browse files
authored
Contract Deployment: Deploy options support (#562)
1 parent 1302d92 commit fa5c40d

19 files changed

+216
-93
lines changed

src/server/routes/contract/royalties/read/getDefaultRoyaltyInfo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Static, Type } from "@sinclair/typebox";
22
import { FastifyInstance } from "fastify";
33
import { StatusCodes } from "http-status-codes";
44
import { getContract } from "../../../../../utils/cache/getContract";
5-
import { RoyaltySchema } from "../../../../schemas/contract";
5+
import { royaltySchema } from "../../../../schemas/contract";
66
import {
77
contractParamSchema,
88
standardResponseSchema,
@@ -13,7 +13,7 @@ const requestSchema = contractParamSchema;
1313

1414
// OUTPUT
1515
const responseSchema = Type.Object({
16-
result: RoyaltySchema,
16+
result: royaltySchema,
1717
});
1818

1919
responseSchema.examples = [

src/server/routes/contract/royalties/read/getTokenRoyaltyInfo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Static, Type } from "@sinclair/typebox";
22
import { FastifyInstance } from "fastify";
33
import { StatusCodes } from "http-status-codes";
44
import { getContract } from "../../../../../utils/cache/getContract";
5-
import { RoyaltySchema } from "../../../../schemas/contract";
5+
import { royaltySchema } from "../../../../schemas/contract";
66
import {
77
contractParamSchema,
88
standardResponseSchema,
@@ -15,7 +15,7 @@ const requestSchema = Type.Object({
1515
});
1616
// OUTPUT
1717
const responseSchema = Type.Object({
18-
result: RoyaltySchema,
18+
result: royaltySchema,
1919
});
2020

2121
responseSchema.examples = [

src/server/routes/contract/royalties/write/setDefaultRoyaltyInfo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { FastifyInstance } from "fastify";
33
import { StatusCodes } from "http-status-codes";
44
import { queueTx } from "../../../../../db/transactions/queueTx";
55
import { getContract } from "../../../../../utils/cache/getContract";
6-
import { RoyaltySchema } from "../../../../schemas/contract";
6+
import { royaltySchema } from "../../../../schemas/contract";
77
import {
88
contractParamSchema,
99
requestQuerystringSchema,
@@ -17,7 +17,7 @@ import { getChainIdFromChain } from "../../../../utils/chain";
1717
// INPUTS
1818
const requestSchema = contractParamSchema;
1919
const requestBodySchema = Type.Object({
20-
...RoyaltySchema.properties,
20+
...royaltySchema.properties,
2121
...txOverridesWithValueSchema.properties,
2222
});
2323

src/server/routes/contract/royalties/write/setTokenRoyaltyInfo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { FastifyInstance } from "fastify";
33
import { StatusCodes } from "http-status-codes";
44
import { queueTx } from "../../../../../db/transactions/queueTx";
55
import { getContract } from "../../../../../utils/cache/getContract";
6-
import { RoyaltySchema } from "../../../../schemas/contract";
6+
import { royaltySchema } from "../../../../schemas/contract";
77
import {
88
contractParamSchema,
99
requestQuerystringSchema,
@@ -17,7 +17,7 @@ import { getChainIdFromChain } from "../../../../utils/chain";
1717
// INPUTS
1818
const requestSchema = contractParamSchema;
1919
const requestBodySchema = Type.Object({
20-
...RoyaltySchema.properties,
20+
...royaltySchema.properties,
2121
token_id: Type.String({
2222
description: "The token ID to set the royalty info for.",
2323
}),

src/server/routes/deploy/prebuilt.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { FastifyInstance } from "fastify";
33
import { StatusCodes } from "http-status-codes";
44
import { queueTx } from "../../../db/transactions/queueTx";
55
import { getSdk } from "../../../utils/cache/getSdk";
6+
import { contractDeployBasicSchema } from "../../schemas/contract";
67
import {
78
prebuiltDeployParamSchema,
89
standardResponseSchema,
@@ -18,11 +19,7 @@ const requestBodySchema = Type.Object({
1819
contractMetadata: Type.Any({
1920
description: "Arguments for the deployment.",
2021
}),
21-
version: Type.Optional(
22-
Type.String({
23-
description: "Version of the contract to deploy. Defaults to latest.",
24-
}),
25-
),
22+
...contractDeployBasicSchema.properties,
2623
...txOverridesWithValueSchema.properties,
2724
});
2825

@@ -70,7 +67,14 @@ export async function deployPrebuilt(fastify: FastifyInstance) {
7067
},
7168
handler: async (request, reply) => {
7269
const { chain, contractType } = request.params;
73-
const { contractMetadata, version, txOverrides } = request.body;
70+
const {
71+
contractMetadata,
72+
version,
73+
txOverrides,
74+
saltForProxyDeploy,
75+
forceDirectDeploy,
76+
compilerOptions,
77+
} = request.body;
7478
const chainId = await getChainIdFromChain(chain);
7579
const {
7680
"x-backend-wallet-address": walletAddress,
@@ -83,6 +87,11 @@ export async function deployPrebuilt(fastify: FastifyInstance) {
8387
contractType,
8488
contractMetadata,
8589
version,
90+
{
91+
saltForProxyDeploy,
92+
forceDirectDeploy,
93+
compilerOptions,
94+
},
8695
);
8796
const deployedAddress = await tx.simulate();
8897

src/server/routes/deploy/prebuilts/edition.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { FastifyInstance } from "fastify";
33
import { StatusCodes } from "http-status-codes";
44
import { queueTx } from "../../../../db/transactions/queueTx";
55
import { getSdk } from "../../../../utils/cache/getSdk";
6+
import { contractDeployBasicSchema } from "../../../schemas/contract";
67
import {
78
commonContractSchema,
89
commonPlatformFeeSchema,
@@ -29,11 +30,7 @@ const requestBodySchema = Type.Object({
2930
...commonPrimarySaleSchema.properties,
3031
...commonTrustedForwarderSchema.properties,
3132
}),
32-
version: Type.Optional(
33-
Type.String({
34-
description: "Version of the contract to deploy. Defaults to latest.",
35-
}),
36-
),
33+
...contractDeployBasicSchema.properties,
3734
...txOverridesWithValueSchema.properties,
3835
});
3936

@@ -75,7 +72,14 @@ export async function deployPrebuiltEdition(fastify: FastifyInstance) {
7572
},
7673
handler: async (request, reply) => {
7774
const { chain } = request.params;
78-
const { contractMetadata, version, txOverrides } = request.body;
75+
const {
76+
contractMetadata,
77+
version,
78+
txOverrides,
79+
saltForProxyDeploy,
80+
forceDirectDeploy,
81+
compilerOptions,
82+
} = request.body;
7983
const chainId = await getChainIdFromChain(chain);
8084
const {
8185
"x-backend-wallet-address": walletAddress,
@@ -88,6 +92,11 @@ export async function deployPrebuiltEdition(fastify: FastifyInstance) {
8892
"edition",
8993
contractMetadata,
9094
version,
95+
{
96+
saltForProxyDeploy,
97+
forceDirectDeploy,
98+
compilerOptions,
99+
},
91100
);
92101
const deployedAddress = await tx.simulate();
93102

src/server/routes/deploy/prebuilts/editionDrop.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { FastifyInstance } from "fastify";
33
import { StatusCodes } from "http-status-codes";
44
import { queueTx } from "../../../../db/transactions/queueTx";
55
import { getSdk } from "../../../../utils/cache/getSdk";
6+
import { contractDeployBasicSchema } from "../../../schemas/contract";
67
import {
78
commonContractSchema,
89
commonPlatformFeeSchema,
@@ -31,11 +32,7 @@ const requestBodySchema = Type.Object({
3132
...commonPrimarySaleSchema.properties,
3233
...commonTrustedForwarderSchema.properties,
3334
}),
34-
version: Type.Optional(
35-
Type.String({
36-
description: "Version of the contract to deploy. Defaults to latest.",
37-
}),
38-
),
35+
...contractDeployBasicSchema.properties,
3936
...txOverridesWithValueSchema.properties,
4037
});
4138

@@ -75,7 +72,14 @@ export async function deployPrebuiltEditionDrop(fastify: FastifyInstance) {
7572
},
7673
handler: async (request, reply) => {
7774
const { chain } = request.params;
78-
const { contractMetadata, version, txOverrides } = request.body;
75+
const {
76+
contractMetadata,
77+
version,
78+
txOverrides,
79+
saltForProxyDeploy,
80+
forceDirectDeploy,
81+
compilerOptions,
82+
} = request.body;
7983
const chainId = await getChainIdFromChain(chain);
8084
const {
8185
"x-backend-wallet-address": walletAddress,
@@ -88,6 +92,11 @@ export async function deployPrebuiltEditionDrop(fastify: FastifyInstance) {
8892
"edition-drop",
8993
contractMetadata,
9094
version,
95+
{
96+
saltForProxyDeploy,
97+
forceDirectDeploy,
98+
compilerOptions,
99+
},
91100
);
92101
const deployedAddress = await tx.simulate();
93102

src/server/routes/deploy/prebuilts/marketplaceV3.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { FastifyInstance } from "fastify";
33
import { StatusCodes } from "http-status-codes";
44
import { queueTx } from "../../../../db/transactions/queueTx";
55
import { getSdk } from "../../../../utils/cache/getSdk";
6+
import { contractDeployBasicSchema } from "../../../schemas/contract";
67
import {
78
commonContractSchema,
89
commonPlatformFeeSchema,
@@ -23,11 +24,7 @@ const requestBodySchema = Type.Object({
2324
...commonPlatformFeeSchema.properties,
2425
...commonTrustedForwarderSchema.properties,
2526
}),
26-
version: Type.Optional(
27-
Type.String({
28-
description: "Version of the contract to deploy. Defaults to latest.",
29-
}),
30-
),
27+
...contractDeployBasicSchema.properties,
3128
...txOverridesWithValueSchema.properties,
3229
});
3330

@@ -66,7 +63,14 @@ export async function deployPrebuiltMarketplaceV3(fastify: FastifyInstance) {
6663
},
6764
handler: async (request, reply) => {
6865
const { chain } = request.params;
69-
const { contractMetadata, version, txOverrides } = request.body;
66+
const {
67+
contractMetadata,
68+
version,
69+
txOverrides,
70+
saltForProxyDeploy,
71+
forceDirectDeploy,
72+
compilerOptions,
73+
} = request.body;
7074
const chainId = await getChainIdFromChain(chain);
7175
const {
7276
"x-backend-wallet-address": walletAddress,
@@ -79,6 +83,11 @@ export async function deployPrebuiltMarketplaceV3(fastify: FastifyInstance) {
7983
"marketplace-v3",
8084
contractMetadata,
8185
version,
86+
{
87+
saltForProxyDeploy,
88+
forceDirectDeploy,
89+
compilerOptions,
90+
},
8291
);
8392
const deployedAddress = await tx.simulate();
8493

src/server/routes/deploy/prebuilts/multiwrap.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { FastifyInstance } from "fastify";
33
import { StatusCodes } from "http-status-codes";
44
import { queueTx } from "../../../../db/transactions/queueTx";
55
import { getSdk } from "../../../../utils/cache/getSdk";
6+
import { contractDeployBasicSchema } from "../../../schemas/contract";
67
import {
78
commonContractSchema,
89
commonRoyaltySchema,
@@ -25,11 +26,7 @@ const requestBodySchema = Type.Object({
2526
...commonSymbolSchema.properties,
2627
...commonTrustedForwarderSchema.properties,
2728
}),
28-
version: Type.Optional(
29-
Type.String({
30-
description: "Version of the contract to deploy. Defaults to latest.",
31-
}),
32-
),
29+
...contractDeployBasicSchema.properties,
3330
...txOverridesWithValueSchema.properties,
3431
});
3532

@@ -69,7 +66,14 @@ export async function deployPrebuiltMultiwrap(fastify: FastifyInstance) {
6966
},
7067
handler: async (request, reply) => {
7168
const { chain } = request.params;
72-
const { contractMetadata, version, txOverrides } = request.body;
69+
const {
70+
contractMetadata,
71+
version,
72+
txOverrides,
73+
saltForProxyDeploy,
74+
forceDirectDeploy,
75+
compilerOptions,
76+
} = request.body;
7377
const chainId = await getChainIdFromChain(chain);
7478
const {
7579
"x-backend-wallet-address": walletAddress,
@@ -82,6 +86,11 @@ export async function deployPrebuiltMultiwrap(fastify: FastifyInstance) {
8286
"multiwrap",
8387
contractMetadata,
8488
version,
89+
{
90+
saltForProxyDeploy,
91+
forceDirectDeploy,
92+
compilerOptions,
93+
},
8594
);
8695
const deployedAddress = await tx.simulate();
8796

src/server/routes/deploy/prebuilts/nftCollection.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { FastifyInstance } from "fastify";
33
import { StatusCodes } from "http-status-codes";
44
import { queueTx } from "../../../../db/transactions/queueTx";
55
import { getSdk } from "../../../../utils/cache/getSdk";
6+
import { contractDeployBasicSchema } from "../../../schemas/contract";
67
import {
78
commonContractSchema,
89
commonPlatformFeeSchema,
@@ -29,11 +30,7 @@ const requestBodySchema = Type.Object({
2930
...commonPrimarySaleSchema.properties,
3031
...commonTrustedForwarderSchema.properties,
3132
}),
32-
version: Type.Optional(
33-
Type.String({
34-
description: "Version of the contract to deploy. Defaults to latest.",
35-
}),
36-
),
33+
...contractDeployBasicSchema.properties,
3734
...txOverridesWithValueSchema.properties,
3835
});
3936

@@ -72,7 +69,14 @@ export async function deployPrebuiltNFTCollection(fastify: FastifyInstance) {
7269
},
7370
handler: async (request, reply) => {
7471
const { chain } = request.params;
75-
const { contractMetadata, version, txOverrides } = request.body;
72+
const {
73+
contractMetadata,
74+
version,
75+
txOverrides,
76+
saltForProxyDeploy,
77+
forceDirectDeploy,
78+
compilerOptions,
79+
} = request.body;
7680
const chainId = await getChainIdFromChain(chain);
7781
const {
7882
"x-backend-wallet-address": walletAddress,
@@ -85,6 +89,11 @@ export async function deployPrebuiltNFTCollection(fastify: FastifyInstance) {
8589
"nft-collection",
8690
contractMetadata,
8791
version,
92+
{
93+
saltForProxyDeploy,
94+
forceDirectDeploy,
95+
compilerOptions,
96+
},
8897
);
8998
const deployedAddress = await tx.simulate();
9099

0 commit comments

Comments
 (0)