@evergonlabs/tmi-protocol-api 0.7.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.d.ts +60 -6
- package/dist/app.d.ts.map +1 -1
- package/dist/client.d.ts +60 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/common/blockchain.d.ts +68 -67
- package/dist/common/blockchain.d.ts.map +1 -1
- package/dist/common/blockchain.js +5 -9
- package/dist/common/config.d.ts +4 -1
- package/dist/common/config.d.ts.map +1 -1
- package/dist/common/config.js +0 -9
- package/dist/common/context.d.ts +2 -2
- package/dist/common/context.d.ts.map +1 -1
- package/dist/common/models/chainId.d.ts +3 -0
- package/dist/common/models/chainId.d.ts.map +1 -1
- package/dist/common/models/chainId.js +10 -16
- package/dist/common/models/platform.d.ts +1 -1
- package/dist/common/models/transaction.js +1 -1
- package/dist/factory.d.ts +2 -2
- package/dist/factory.d.ts.map +1 -1
- package/dist/fractions/markets/getDeployEvent.js +1 -1
- package/dist/fractions/sales/common/fractionsSale.d.ts +1 -1
- package/dist/fractions/sales/getVaultAddress.js +1 -1
- package/dist/fractions/sales/getWithdrawEvent.js +1 -1
- package/dist/fractions/sales/parseFractionsCreatedEvent.js +1 -1
- package/dist/fractions/sales/vesting/parseClaimVestedTokensEvent.js +1 -1
- package/dist/fractions/sig/getNonce.route.js +1 -1
- package/dist/general/balanceClient.d.ts +2 -1
- package/dist/general/balanceClient.d.ts.map +1 -1
- package/dist/general/balanceClient.js +2 -2
- package/dist/general/common.d.ts +2 -1
- package/dist/general/common.d.ts.map +1 -1
- package/dist/general/common.js +2 -2
- package/dist/general/estimateGas.js +1 -1
- package/dist/general/getBalance.js +1 -1
- package/dist/general/getBalancesBatch.js +1 -1
- package/dist/general/searchBalances.js +1 -1
- package/dist/issuance/common/factories.d.ts +1 -0
- package/dist/issuance/common/factories.d.ts.map +1 -1
- package/dist/issuance/common/factories.js +2 -0
- package/dist/issuance/erc20/deploy.d.ts +0 -2
- package/dist/issuance/erc20/deploy.d.ts.map +1 -1
- package/dist/issuance/erc20/deploy.js +17 -21
- package/dist/issuance/erc20/deployGated.d.ts +40 -0
- package/dist/issuance/erc20/deployGated.d.ts.map +1 -0
- package/dist/issuance/erc20/deployGated.js +58 -0
- package/dist/issuance/erc20/index.d.ts +29 -2
- package/dist/issuance/erc20/index.d.ts.map +1 -1
- package/dist/issuance/erc20/index.js +2 -0
- package/dist/issuance/erc20/parseErc20DeployEvent.d.ts +1 -1
- package/dist/issuance/erc20/parseErc20DeployEvent.d.ts.map +1 -1
- package/dist/issuance/erc20/parseErc20DeployEvent.js +4 -4
- package/dist/issuance/erc721/deploy.d.ts +0 -2
- package/dist/issuance/erc721/deploy.d.ts.map +1 -1
- package/dist/issuance/erc721/deploy.js +4 -8
- package/dist/issuance/erc721/deployGated.d.ts +40 -0
- package/dist/issuance/erc721/deployGated.d.ts.map +1 -0
- package/dist/issuance/erc721/deployGated.js +58 -0
- package/dist/issuance/erc721/index.d.ts +29 -2
- package/dist/issuance/erc721/index.d.ts.map +1 -1
- package/dist/issuance/erc721/index.js +2 -0
- package/dist/issuance/erc721/parseErc721DeployEvent.d.ts +1 -1
- package/dist/issuance/erc721/parseErc721DeployEvent.d.ts.map +1 -1
- package/dist/issuance/erc721/parseErc721DeployEvent.js +4 -4
- package/dist/issuance/index.d.ts +58 -4
- package/dist/issuance/index.d.ts.map +1 -1
- package/dist/stakingTemplates/templates/common/getCreatePoolEvent.js +1 -1
- package/dist/stakingTemplates/templates/common/getPlatformDeployEvent.js +1 -1
- package/dist/stakingTemplates/templates/common/getStakeEvent.js +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { describeRoute } from "hono-openapi";
|
|
2
|
+
import { resolver, validator } from "hono-openapi";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { abis } from "@evergonlabs/tmi-factories-sdk";
|
|
5
|
+
import { createController } from "../../common/controller.js";
|
|
6
|
+
import { AddressSchema, toTransaction, TransactionSchema } from "../../common/index.js";
|
|
7
|
+
import { Int256BigInt } from "../../common/int256.js";
|
|
8
|
+
import { DEFAULT_COMPILOT_SIGNER } from "../../common/models/compilot.js";
|
|
9
|
+
import { FactoryChainId, getFactories } from "../common/factories.js";
|
|
10
|
+
export const DeployGatedErc20RequestSchema = z.object({
|
|
11
|
+
chainId: FactoryChainId.Schema,
|
|
12
|
+
tokenName: z.string().nonempty().openapi({ description: "Name of the ERC20 token" }),
|
|
13
|
+
tokenSymbol: z.string().nonempty().openapi({ description: "Symbol of the ERC20 token" }),
|
|
14
|
+
supplyCap: Int256BigInt(z.bigint().nonnegative()),
|
|
15
|
+
defaultTokenAdmin: AddressSchema.openapi({ description: "Address to receive DEFAULT_ADMIN_ROLE" }),
|
|
16
|
+
minter: AddressSchema.openapi({ description: "Address to receive MINTER_ROLE" }),
|
|
17
|
+
gatingSigner: AddressSchema.optional().openapi({
|
|
18
|
+
description: "Address of the gating signer for whitelist verification. Defaults to the ComPilot signer.",
|
|
19
|
+
}),
|
|
20
|
+
});
|
|
21
|
+
const deployGatedErc20Route = describeRoute({
|
|
22
|
+
summary: "Deploy Gated ERC20 via Factory",
|
|
23
|
+
description: `Returns transaction data for deploying a new whitelist-gated ERC20 token via the factory contract.
|
|
24
|
+
|
|
25
|
+
Calls deployAndInitializeProxy on the ERC20GatedPausableRecoverableFactory to atomically deploy and initialize a new token proxy.`,
|
|
26
|
+
tags: ["Issuance"],
|
|
27
|
+
responses: {
|
|
28
|
+
200: {
|
|
29
|
+
description: "Returns transaction data for deploying a gated ERC20 token via factory",
|
|
30
|
+
content: {
|
|
31
|
+
"application/json": {
|
|
32
|
+
schema: resolver(TransactionSchema),
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
export const CreateGatedErc20Token = createController({
|
|
39
|
+
build: (factory) => factory
|
|
40
|
+
.createApp()
|
|
41
|
+
.post("/", deployGatedErc20Route, validator("json", DeployGatedErc20RequestSchema), async (c) => {
|
|
42
|
+
const { chainId, tokenName, tokenSymbol, supplyCap, defaultTokenAdmin, minter, gatingSigner } = c.req.valid("json");
|
|
43
|
+
const factory = getFactories(chainId);
|
|
44
|
+
return c.json(toTransaction({
|
|
45
|
+
address: factory.ERC20GatedPausableRecoverableFactory,
|
|
46
|
+
abi: abis.erc20GatedPausableRecoverableFactoryAbi,
|
|
47
|
+
functionName: "deployAndInitializeProxy",
|
|
48
|
+
args: [
|
|
49
|
+
tokenName,
|
|
50
|
+
tokenSymbol,
|
|
51
|
+
BigInt(supplyCap),
|
|
52
|
+
defaultTokenAdmin,
|
|
53
|
+
minter,
|
|
54
|
+
gatingSigner ?? DEFAULT_COMPILOT_SIGNER,
|
|
55
|
+
],
|
|
56
|
+
}));
|
|
57
|
+
}),
|
|
58
|
+
});
|
|
@@ -9,7 +9,6 @@ export declare const Erc20Controller: import("../../common/controller.js").ICont
|
|
|
9
9
|
supplyCap: string;
|
|
10
10
|
defaultTokenAdmin: string;
|
|
11
11
|
minter: string;
|
|
12
|
-
gatingSigner?: string | undefined;
|
|
13
12
|
};
|
|
14
13
|
};
|
|
15
14
|
output: {
|
|
@@ -27,6 +26,34 @@ export declare const Erc20Controller: import("../../common/controller.js").ICont
|
|
|
27
26
|
};
|
|
28
27
|
};
|
|
29
28
|
}, "/deploy"> | import("hono/types").MergeSchemaPath<{
|
|
29
|
+
"/": {
|
|
30
|
+
$post: {
|
|
31
|
+
input: {
|
|
32
|
+
json: {
|
|
33
|
+
chainId: 11155111 | 72080;
|
|
34
|
+
tokenName: string;
|
|
35
|
+
tokenSymbol: string;
|
|
36
|
+
supplyCap: string;
|
|
37
|
+
defaultTokenAdmin: string;
|
|
38
|
+
minter: string;
|
|
39
|
+
gatingSigner?: string | undefined;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
output: {
|
|
43
|
+
data: `0x${string}`;
|
|
44
|
+
to: `0x${string}`;
|
|
45
|
+
details: {
|
|
46
|
+
functionName: string;
|
|
47
|
+
address: `0x${string}`;
|
|
48
|
+
abi: any[];
|
|
49
|
+
args: any[];
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
outputFormat: "json";
|
|
53
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
}, "/deployGated"> | import("hono/types").MergeSchemaPath<{
|
|
30
57
|
"/": {
|
|
31
58
|
$get: {
|
|
32
59
|
input: {
|
|
@@ -44,7 +71,7 @@ export declare const Erc20Controller: import("../../common/controller.js").ICont
|
|
|
44
71
|
symbol: string;
|
|
45
72
|
};
|
|
46
73
|
outputFormat: "json";
|
|
47
|
-
status:
|
|
74
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
48
75
|
};
|
|
49
76
|
};
|
|
50
77
|
}, "/getDeployEvent"> | import("hono/types").MergeSchemaPath<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/issuance/erc20/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/issuance/erc20/index.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAiB1B,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { createController } from "../../common/controller.js";
|
|
|
2
2
|
import { ApproveErc20Token } from "./approve.js";
|
|
3
3
|
import { BurnErc20Token } from "./burn.js";
|
|
4
4
|
import { CreateErc20Token } from "./deploy.js";
|
|
5
|
+
import { CreateGatedErc20Token } from "./deployGated.js";
|
|
5
6
|
import { GrantRoleErc20 } from "./grantRole.js";
|
|
6
7
|
import { InitializeErc20 } from "./initialize.js";
|
|
7
8
|
import { MintErc20Token } from "./mint.js";
|
|
@@ -15,6 +16,7 @@ export const Erc20Controller = createController({
|
|
|
15
16
|
build: (factory) => factory
|
|
16
17
|
.createApp()
|
|
17
18
|
.route("/deploy", CreateErc20Token.build(factory))
|
|
19
|
+
.route("/deployGated", CreateGatedErc20Token.build(factory))
|
|
18
20
|
.route("/getDeployEvent", ParseErc20DeployEvent.build(factory))
|
|
19
21
|
.route("/approve", ApproveErc20Token.build(factory))
|
|
20
22
|
.route("/burn", BurnErc20Token.build(factory))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseErc20DeployEvent.d.ts","sourceRoot":"","sources":["../../../src/issuance/erc20/parseErc20DeployEvent.ts"],"names":[],"mappings":"AA4BA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"parseErc20DeployEvent.d.ts","sourceRoot":"","sources":["../../../src/issuance/erc20/parseErc20DeployEvent.ts"],"names":[],"mappings":"AA4BA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;QAoDhC,CAAC"}
|
|
@@ -9,9 +9,9 @@ import { getPublicClient } from "../../common/blockchain.js";
|
|
|
9
9
|
import { createController } from "../../common/controller.js";
|
|
10
10
|
import { HttpError } from "../../common/http-error.js";
|
|
11
11
|
import { AddressSchema, HashSchema } from "../../common/index.js";
|
|
12
|
-
import {
|
|
12
|
+
import { FactoryChainIdQuery } from "../common/factories.js";
|
|
13
13
|
const QuerySchema = z.object({
|
|
14
|
-
chainId:
|
|
14
|
+
chainId: FactoryChainIdQuery.openapi({
|
|
15
15
|
param: {
|
|
16
16
|
name: "chainId",
|
|
17
17
|
in: "query",
|
|
@@ -48,7 +48,7 @@ export const ParseErc20DeployEvent = createController({
|
|
|
48
48
|
},
|
|
49
49
|
}), validator("query", QuerySchema), async (c) => {
|
|
50
50
|
const params = c.req.valid("query");
|
|
51
|
-
const receipt = await waitForTransactionReceipt(getPublicClient(params.chainId), {
|
|
51
|
+
const receipt = await waitForTransactionReceipt(getPublicClient(params.chainId, c.env.config), {
|
|
52
52
|
hash: params.hash,
|
|
53
53
|
});
|
|
54
54
|
const [event] = parseEventLogs({
|
|
@@ -66,7 +66,7 @@ export const ParseErc20DeployEvent = createController({
|
|
|
66
66
|
supplyCap: event.args.supplyCap.toString(),
|
|
67
67
|
name: event.args.name,
|
|
68
68
|
symbol: event.args.symbol,
|
|
69
|
-
}
|
|
69
|
+
});
|
|
70
70
|
}),
|
|
71
71
|
});
|
|
72
72
|
class UnableParseErc20DeployEvent extends HttpError {
|
|
@@ -6,7 +6,6 @@ export declare const DeployErc721RequestSchema: z.ZodObject<{
|
|
|
6
6
|
baseURI: z.ZodString;
|
|
7
7
|
defaultTokenAdmin: z.ZodPipe<z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>, z.ZodTransform<`0x${string}`, `0x${string}`>>;
|
|
8
8
|
minter: z.ZodPipe<z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>, z.ZodTransform<`0x${string}`, `0x${string}`>>;
|
|
9
|
-
gatingSigner: z.ZodOptional<z.ZodPipe<z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>, z.ZodTransform<`0x${string}`, `0x${string}`>>>;
|
|
10
9
|
}, z.core.$strip>;
|
|
11
10
|
export declare const CreateErc721Token: import("../../common/controller.js").IController<import("hono/hono-base").HonoBase<import("../../common/context.js").AppContext, {
|
|
12
11
|
"/": {
|
|
@@ -19,7 +18,6 @@ export declare const CreateErc721Token: import("../../common/controller.js").ICo
|
|
|
19
18
|
baseURI: string;
|
|
20
19
|
defaultTokenAdmin: string;
|
|
21
20
|
minter: string;
|
|
22
|
-
gatingSigner?: string | undefined;
|
|
23
21
|
};
|
|
24
22
|
};
|
|
25
23
|
output: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/issuance/erc721/deploy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/issuance/erc721/deploy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,yBAAyB;;;;;;;iBAOpC,CAAC;AA2BH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;QAc5B,CAAC"}
|
|
@@ -4,7 +4,6 @@ import { z } from "zod";
|
|
|
4
4
|
import { abis } from "@evergonlabs/tmi-factories-sdk";
|
|
5
5
|
import { createController } from "../../common/controller.js";
|
|
6
6
|
import { AddressSchema, toTransaction, TransactionSchema } from "../../common/index.js";
|
|
7
|
-
import { DEFAULT_COMPILOT_SIGNER } from "../../common/models/compilot.js";
|
|
8
7
|
import { FactoryChainId, getFactories } from "../common/factories.js";
|
|
9
8
|
export const DeployErc721RequestSchema = z.object({
|
|
10
9
|
chainId: FactoryChainId.Schema,
|
|
@@ -13,9 +12,6 @@ export const DeployErc721RequestSchema = z.object({
|
|
|
13
12
|
baseURI: z.string().openapi({ description: "Base URI for token metadata" }),
|
|
14
13
|
defaultTokenAdmin: AddressSchema.openapi({ description: "Address to receive DEFAULT_ADMIN_ROLE" }),
|
|
15
14
|
minter: AddressSchema.openapi({ description: "Address to receive MINTER_ROLE" }),
|
|
16
|
-
gatingSigner: AddressSchema.optional().openapi({
|
|
17
|
-
description: "Address of the gating signer for whitelist verification. Defaults to the ComPilot signer.",
|
|
18
|
-
}),
|
|
19
15
|
});
|
|
20
16
|
const deployErc721Route = describeRoute({
|
|
21
17
|
summary: "Deploy ERC721 via Factory",
|
|
@@ -43,13 +39,13 @@ The deployed token supports:
|
|
|
43
39
|
});
|
|
44
40
|
export const CreateErc721Token = createController({
|
|
45
41
|
build: (factory) => factory.createApp().post("/", deployErc721Route, validator("json", DeployErc721RequestSchema), async (c) => {
|
|
46
|
-
const { chainId, tokenName, tokenSymbol, baseURI, defaultTokenAdmin, minter
|
|
42
|
+
const { chainId, tokenName, tokenSymbol, baseURI, defaultTokenAdmin, minter } = c.req.valid("json");
|
|
47
43
|
const factory = getFactories(chainId);
|
|
48
44
|
return c.json(toTransaction({
|
|
49
|
-
address: factory.
|
|
50
|
-
abi: abis.
|
|
45
|
+
address: factory.ERC721PausableRecoverableFactory,
|
|
46
|
+
abi: abis.erc721PausableRecoverableFactoryAbi,
|
|
51
47
|
functionName: "deployAndInitializeProxy",
|
|
52
|
-
args: [tokenName, tokenSymbol, baseURI, defaultTokenAdmin, minter
|
|
48
|
+
args: [tokenName, tokenSymbol, baseURI, defaultTokenAdmin, minter],
|
|
53
49
|
}));
|
|
54
50
|
}),
|
|
55
51
|
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const DeployGatedErc721RequestSchema: z.ZodObject<{
|
|
3
|
+
chainId: z.ZodUnion<[z.ZodLiteral<11155111 | 72080>, z.ZodLiteral<11155111 | 72080>, ...z.ZodLiteral<11155111 | 72080>[]]>;
|
|
4
|
+
tokenName: z.ZodString;
|
|
5
|
+
tokenSymbol: z.ZodString;
|
|
6
|
+
baseURI: z.ZodString;
|
|
7
|
+
defaultTokenAdmin: z.ZodPipe<z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>, z.ZodTransform<`0x${string}`, `0x${string}`>>;
|
|
8
|
+
minter: z.ZodPipe<z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>, z.ZodTransform<`0x${string}`, `0x${string}`>>;
|
|
9
|
+
gatingSigner: z.ZodOptional<z.ZodPipe<z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>, z.ZodTransform<`0x${string}`, `0x${string}`>>>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export declare const CreateGatedErc721Token: import("../../common/controller.js").IController<import("hono/hono-base").HonoBase<import("../../common/context.js").AppContext, {
|
|
12
|
+
"/": {
|
|
13
|
+
$post: {
|
|
14
|
+
input: {
|
|
15
|
+
json: {
|
|
16
|
+
chainId: 11155111 | 72080;
|
|
17
|
+
tokenName: string;
|
|
18
|
+
tokenSymbol: string;
|
|
19
|
+
baseURI: string;
|
|
20
|
+
defaultTokenAdmin: string;
|
|
21
|
+
minter: string;
|
|
22
|
+
gatingSigner?: string | undefined;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
output: {
|
|
26
|
+
data: `0x${string}`;
|
|
27
|
+
to: `0x${string}`;
|
|
28
|
+
details: {
|
|
29
|
+
functionName: string;
|
|
30
|
+
address: `0x${string}`;
|
|
31
|
+
abi: any[];
|
|
32
|
+
args: any[];
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
outputFormat: "json";
|
|
36
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
}, "/">>;
|
|
40
|
+
//# sourceMappingURL=deployGated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployGated.d.ts","sourceRoot":"","sources":["../../../src/issuance/erc721/deployGated.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,8BAA8B;;;;;;;;iBAUzC,CAAC;AA4BH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAiBjC,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { describeRoute } from "hono-openapi";
|
|
2
|
+
import { resolver, validator } from "hono-openapi";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { abis } from "@evergonlabs/tmi-factories-sdk";
|
|
5
|
+
import { createController } from "../../common/controller.js";
|
|
6
|
+
import { AddressSchema, toTransaction, TransactionSchema } from "../../common/index.js";
|
|
7
|
+
import { DEFAULT_COMPILOT_SIGNER } from "../../common/models/compilot.js";
|
|
8
|
+
import { FactoryChainId, getFactories } from "../common/factories.js";
|
|
9
|
+
export const DeployGatedErc721RequestSchema = z.object({
|
|
10
|
+
chainId: FactoryChainId.Schema,
|
|
11
|
+
tokenName: z.string().nonempty().openapi({ description: "Name of the NFT collection" }),
|
|
12
|
+
tokenSymbol: z.string().nonempty().openapi({ description: "Symbol of the NFT collection" }),
|
|
13
|
+
baseURI: z.string().openapi({ description: "Base URI for token metadata" }),
|
|
14
|
+
defaultTokenAdmin: AddressSchema.openapi({ description: "Address to receive DEFAULT_ADMIN_ROLE" }),
|
|
15
|
+
minter: AddressSchema.openapi({ description: "Address to receive MINTER_ROLE" }),
|
|
16
|
+
gatingSigner: AddressSchema.optional().openapi({
|
|
17
|
+
description: "Address of the gating signer for whitelist verification. Defaults to the ComPilot signer.",
|
|
18
|
+
}),
|
|
19
|
+
});
|
|
20
|
+
const deployGatedErc721Route = describeRoute({
|
|
21
|
+
summary: "Deploy Gated ERC721 via Factory",
|
|
22
|
+
description: `Returns transaction data for deploying a new gated ERC721 token via the factory contract.
|
|
23
|
+
|
|
24
|
+
Calls deployAndInitializeProxy on the ERC721GatedPausableRecoverableFactory to atomically deploy and initialize a new token proxy with whitelist gating.
|
|
25
|
+
|
|
26
|
+
The deployed token supports:
|
|
27
|
+
- mint(to, tokenId) - Mint token (MINTER_ROLE gated)
|
|
28
|
+
- burn(tokenId) - Burn token (owner, approved, or MINTER_ROLE)
|
|
29
|
+
- setBaseURI(uri) - Set base URI (URI_SETTER_ROLE gated)
|
|
30
|
+
- setTokenURI(tokenId, uri) - Set token-specific URI (URI_SETTER_ROLE gated)
|
|
31
|
+
- setContractURI(uri) - Set contract metadata URI (URI_SETTER_ROLE gated)
|
|
32
|
+
- Whitelist gating via gatingSigner for transfer verification`,
|
|
33
|
+
tags: ["Issuance"],
|
|
34
|
+
responses: {
|
|
35
|
+
200: {
|
|
36
|
+
description: "Returns transaction data for deploying a gated ERC721 token via factory",
|
|
37
|
+
content: {
|
|
38
|
+
"application/json": {
|
|
39
|
+
schema: resolver(TransactionSchema),
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
export const CreateGatedErc721Token = createController({
|
|
46
|
+
build: (factory) => factory
|
|
47
|
+
.createApp()
|
|
48
|
+
.post("/", deployGatedErc721Route, validator("json", DeployGatedErc721RequestSchema), async (c) => {
|
|
49
|
+
const { chainId, tokenName, tokenSymbol, baseURI, defaultTokenAdmin, minter, gatingSigner } = c.req.valid("json");
|
|
50
|
+
const factory = getFactories(chainId);
|
|
51
|
+
return c.json(toTransaction({
|
|
52
|
+
address: factory.ERC721GatedPausableRecoverableFactory,
|
|
53
|
+
abi: abis.erc721GatedPausableRecoverableFactoryAbi,
|
|
54
|
+
functionName: "deployAndInitializeProxy",
|
|
55
|
+
args: [tokenName, tokenSymbol, baseURI, defaultTokenAdmin, minter, gatingSigner ?? DEFAULT_COMPILOT_SIGNER],
|
|
56
|
+
}));
|
|
57
|
+
}),
|
|
58
|
+
});
|
|
@@ -9,7 +9,6 @@ export declare const Erc721Controller: import("../../common/controller.js").ICon
|
|
|
9
9
|
baseURI: string;
|
|
10
10
|
defaultTokenAdmin: string;
|
|
11
11
|
minter: string;
|
|
12
|
-
gatingSigner?: string | undefined;
|
|
13
12
|
};
|
|
14
13
|
};
|
|
15
14
|
output: {
|
|
@@ -27,6 +26,34 @@ export declare const Erc721Controller: import("../../common/controller.js").ICon
|
|
|
27
26
|
};
|
|
28
27
|
};
|
|
29
28
|
}, "/deploy"> | import("hono/types").MergeSchemaPath<{
|
|
29
|
+
"/": {
|
|
30
|
+
$post: {
|
|
31
|
+
input: {
|
|
32
|
+
json: {
|
|
33
|
+
chainId: 11155111 | 72080;
|
|
34
|
+
tokenName: string;
|
|
35
|
+
tokenSymbol: string;
|
|
36
|
+
baseURI: string;
|
|
37
|
+
defaultTokenAdmin: string;
|
|
38
|
+
minter: string;
|
|
39
|
+
gatingSigner?: string | undefined;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
output: {
|
|
43
|
+
data: `0x${string}`;
|
|
44
|
+
to: `0x${string}`;
|
|
45
|
+
details: {
|
|
46
|
+
functionName: string;
|
|
47
|
+
address: `0x${string}`;
|
|
48
|
+
abi: any[];
|
|
49
|
+
args: any[];
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
outputFormat: "json";
|
|
53
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
}, "/deployGated"> | import("hono/types").MergeSchemaPath<{
|
|
30
57
|
"/": {
|
|
31
58
|
$get: {
|
|
32
59
|
input: {
|
|
@@ -44,7 +71,7 @@ export declare const Erc721Controller: import("../../common/controller.js").ICon
|
|
|
44
71
|
baseURI: string;
|
|
45
72
|
};
|
|
46
73
|
outputFormat: "json";
|
|
47
|
-
status:
|
|
74
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
48
75
|
};
|
|
49
76
|
};
|
|
50
77
|
}, "/getDeployEvent"> | import("hono/types").MergeSchemaPath<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/issuance/erc721/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/issuance/erc721/index.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAkB3B,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { createController } from "../../common/controller.js";
|
|
|
2
2
|
import { ApproveErc721 } from "./approve.js";
|
|
3
3
|
import { BurnErc721 } from "./burn.js";
|
|
4
4
|
import { CreateErc721Token } from "./deploy.js";
|
|
5
|
+
import { CreateGatedErc721Token } from "./deployGated.js";
|
|
5
6
|
import { GrantRoleErc721 } from "./grantRole.js";
|
|
6
7
|
import { InitializeErc721 } from "./initialize.js";
|
|
7
8
|
import { MintErc721 } from "./mint.js";
|
|
@@ -16,6 +17,7 @@ export const Erc721Controller = createController({
|
|
|
16
17
|
build: (factory) => factory
|
|
17
18
|
.createApp()
|
|
18
19
|
.route("/deploy", CreateErc721Token.build(factory))
|
|
20
|
+
.route("/deployGated", CreateGatedErc721Token.build(factory))
|
|
19
21
|
.route("/getDeployEvent", ParseErc721DeployEvent.build(factory))
|
|
20
22
|
.route("/approve", ApproveErc721.build(factory))
|
|
21
23
|
.route("/burn", BurnErc721.build(factory))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseErc721DeployEvent.d.ts","sourceRoot":"","sources":["../../../src/issuance/erc721/parseErc721DeployEvent.ts"],"names":[],"mappings":"AA2BA,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"parseErc721DeployEvent.d.ts","sourceRoot":"","sources":["../../../src/issuance/erc721/parseErc721DeployEvent.ts"],"names":[],"mappings":"AA2BA,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;QAoDjC,CAAC"}
|
|
@@ -8,9 +8,9 @@ import { getPublicClient } from "../../common/blockchain.js";
|
|
|
8
8
|
import { createController } from "../../common/controller.js";
|
|
9
9
|
import { HttpError } from "../../common/http-error.js";
|
|
10
10
|
import { AddressSchema, HashSchema } from "../../common/index.js";
|
|
11
|
-
import {
|
|
11
|
+
import { FactoryChainIdQuery } from "../common/factories.js";
|
|
12
12
|
const QuerySchema = z.object({
|
|
13
|
-
chainId:
|
|
13
|
+
chainId: FactoryChainIdQuery.openapi({
|
|
14
14
|
param: {
|
|
15
15
|
name: "chainId",
|
|
16
16
|
in: "query",
|
|
@@ -47,7 +47,7 @@ export const ParseErc721DeployEvent = createController({
|
|
|
47
47
|
},
|
|
48
48
|
}), validator("query", QuerySchema), async (c) => {
|
|
49
49
|
const params = c.req.valid("query");
|
|
50
|
-
const receipt = await waitForTransactionReceipt(getPublicClient(params.chainId), {
|
|
50
|
+
const receipt = await waitForTransactionReceipt(getPublicClient(params.chainId, c.env.config), {
|
|
51
51
|
hash: params.hash,
|
|
52
52
|
});
|
|
53
53
|
const [event] = parseEventLogs({
|
|
@@ -65,7 +65,7 @@ export const ParseErc721DeployEvent = createController({
|
|
|
65
65
|
name: event.args.name,
|
|
66
66
|
symbol: event.args.symbol,
|
|
67
67
|
baseURI: event.args.baseURI,
|
|
68
|
-
}
|
|
68
|
+
});
|
|
69
69
|
}),
|
|
70
70
|
});
|
|
71
71
|
class UnableParseErc721DeployEvent extends HttpError {
|
package/dist/issuance/index.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ export declare const IssuanceApi: import("../common/controller.js").IApi<import(
|
|
|
9
9
|
supplyCap: string;
|
|
10
10
|
defaultTokenAdmin: string;
|
|
11
11
|
minter: string;
|
|
12
|
-
gatingSigner?: string | undefined;
|
|
13
12
|
};
|
|
14
13
|
};
|
|
15
14
|
output: {
|
|
@@ -27,6 +26,34 @@ export declare const IssuanceApi: import("../common/controller.js").IApi<import(
|
|
|
27
26
|
};
|
|
28
27
|
};
|
|
29
28
|
}, "/deploy"> | import("hono/types").MergeSchemaPath<{
|
|
29
|
+
"/": {
|
|
30
|
+
$post: {
|
|
31
|
+
input: {
|
|
32
|
+
json: {
|
|
33
|
+
chainId: 11155111 | 72080;
|
|
34
|
+
tokenName: string;
|
|
35
|
+
tokenSymbol: string;
|
|
36
|
+
supplyCap: string;
|
|
37
|
+
defaultTokenAdmin: string;
|
|
38
|
+
minter: string;
|
|
39
|
+
gatingSigner?: string | undefined;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
output: {
|
|
43
|
+
data: `0x${string}`;
|
|
44
|
+
to: `0x${string}`;
|
|
45
|
+
details: {
|
|
46
|
+
functionName: string;
|
|
47
|
+
address: `0x${string}`;
|
|
48
|
+
abi: any[];
|
|
49
|
+
args: any[];
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
outputFormat: "json";
|
|
53
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
}, "/deployGated"> | import("hono/types").MergeSchemaPath<{
|
|
30
57
|
"/": {
|
|
31
58
|
$get: {
|
|
32
59
|
input: {
|
|
@@ -44,7 +71,7 @@ export declare const IssuanceApi: import("../common/controller.js").IApi<import(
|
|
|
44
71
|
symbol: string;
|
|
45
72
|
};
|
|
46
73
|
outputFormat: "json";
|
|
47
|
-
status:
|
|
74
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
48
75
|
};
|
|
49
76
|
};
|
|
50
77
|
}, "/getDeployEvent"> | import("hono/types").MergeSchemaPath<{
|
|
@@ -304,7 +331,6 @@ export declare const IssuanceApi: import("../common/controller.js").IApi<import(
|
|
|
304
331
|
baseURI: string;
|
|
305
332
|
defaultTokenAdmin: string;
|
|
306
333
|
minter: string;
|
|
307
|
-
gatingSigner?: string | undefined;
|
|
308
334
|
};
|
|
309
335
|
};
|
|
310
336
|
output: {
|
|
@@ -322,6 +348,34 @@ export declare const IssuanceApi: import("../common/controller.js").IApi<import(
|
|
|
322
348
|
};
|
|
323
349
|
};
|
|
324
350
|
}, "/deploy"> | import("hono/types").MergeSchemaPath<{
|
|
351
|
+
"/": {
|
|
352
|
+
$post: {
|
|
353
|
+
input: {
|
|
354
|
+
json: {
|
|
355
|
+
chainId: 11155111 | 72080;
|
|
356
|
+
tokenName: string;
|
|
357
|
+
tokenSymbol: string;
|
|
358
|
+
baseURI: string;
|
|
359
|
+
defaultTokenAdmin: string;
|
|
360
|
+
minter: string;
|
|
361
|
+
gatingSigner?: string | undefined;
|
|
362
|
+
};
|
|
363
|
+
};
|
|
364
|
+
output: {
|
|
365
|
+
data: `0x${string}`;
|
|
366
|
+
to: `0x${string}`;
|
|
367
|
+
details: {
|
|
368
|
+
functionName: string;
|
|
369
|
+
address: `0x${string}`;
|
|
370
|
+
abi: any[];
|
|
371
|
+
args: any[];
|
|
372
|
+
};
|
|
373
|
+
};
|
|
374
|
+
outputFormat: "json";
|
|
375
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
376
|
+
};
|
|
377
|
+
};
|
|
378
|
+
}, "/deployGated"> | import("hono/types").MergeSchemaPath<{
|
|
325
379
|
"/": {
|
|
326
380
|
$get: {
|
|
327
381
|
input: {
|
|
@@ -339,7 +393,7 @@ export declare const IssuanceApi: import("../common/controller.js").IApi<import(
|
|
|
339
393
|
baseURI: string;
|
|
340
394
|
};
|
|
341
395
|
outputFormat: "json";
|
|
342
|
-
status:
|
|
396
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
343
397
|
};
|
|
344
398
|
};
|
|
345
399
|
}, "/getDeployEvent"> | import("hono/types").MergeSchemaPath<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/issuance/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/issuance/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gDAStB,CAAC"}
|
|
@@ -30,7 +30,7 @@ export function createGetCreatePoolEventController(template) {
|
|
|
30
30
|
},
|
|
31
31
|
}), validator("query", SentTransactionParamsSchema), async (c) => {
|
|
32
32
|
const params = c.req.valid("query");
|
|
33
|
-
const receipt = await waitForTransactionReceipt(getPublicClient(params.chainId), {
|
|
33
|
+
const receipt = await waitForTransactionReceipt(getPublicClient(params.chainId, c.env.config), {
|
|
34
34
|
hash: params.hash,
|
|
35
35
|
});
|
|
36
36
|
const result = parseAssetManagersDeployEvent(template.template, receipt.logs);
|
|
@@ -28,7 +28,7 @@ export function createGetPlatformDeployEventController(template) {
|
|
|
28
28
|
},
|
|
29
29
|
}), validator("query", SentTransactionParamsSchema), async (c) => {
|
|
30
30
|
const params = c.req.valid("query");
|
|
31
|
-
const receipt = await waitForTransactionReceipt(getPublicClient(params.chainId), {
|
|
31
|
+
const receipt = await waitForTransactionReceipt(getPublicClient(params.chainId, c.env.config), {
|
|
32
32
|
hash: params.hash,
|
|
33
33
|
});
|
|
34
34
|
const result = parseDeployDiamondEvent(receipt.logs);
|
|
@@ -34,7 +34,7 @@ export function createGetStakeEventController(template) {
|
|
|
34
34
|
},
|
|
35
35
|
}), validator("query", SentTransactionParamsSchema), async (c) => {
|
|
36
36
|
const params = c.req.valid("query");
|
|
37
|
-
const receipt = await waitForTransactionReceipt(getPublicClient(params.chainId), {
|
|
37
|
+
const receipt = await waitForTransactionReceipt(getPublicClient(params.chainId, c.env.config), {
|
|
38
38
|
hash: params.hash,
|
|
39
39
|
});
|
|
40
40
|
const result = parseStakeEvent(template.template, receipt.logs);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evergonlabs/tmi-protocol-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
"viem": "^2.23.2",
|
|
40
40
|
"zod": "^4.3.6",
|
|
41
41
|
"zod-openapi": "^5.4.6",
|
|
42
|
-
"@evergonlabs/tmi-protocol-contracts": "0.
|
|
43
|
-
"@evergonlabs/tmi-protocol-
|
|
44
|
-
"@evergonlabs/tmi-protocol-indexer": "0.
|
|
45
|
-
"@evergonlabs/tmi-protocol-
|
|
46
|
-
"@evergonlabs/tmi-protocol-
|
|
47
|
-
"@evergonlabs/tmi-protocol-
|
|
48
|
-
"@evergonlabs/tmi-protocol-
|
|
42
|
+
"@evergonlabs/tmi-protocol-contracts": "0.8.1",
|
|
43
|
+
"@evergonlabs/tmi-protocol-types": "0.8.1",
|
|
44
|
+
"@evergonlabs/tmi-protocol-indexer": "0.8.1",
|
|
45
|
+
"@evergonlabs/tmi-protocol-utils": "0.8.1",
|
|
46
|
+
"@evergonlabs/tmi-protocol-fractions-sdk": "0.8.1",
|
|
47
|
+
"@evergonlabs/tmi-protocol-shared": "0.8.1",
|
|
48
|
+
"@evergonlabs/tmi-protocol-staking-sdk": "0.8.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@evergonlabs/tmi-eslint-config": "0.3.0",
|