@evergonlabs/tmi-protocol-api 0.10.0-rc.0 → 0.10.0-rc.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 +359 -1
- package/dist/app.d.ts.map +1 -1
- package/dist/client.d.ts +389 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/common/roles/erc1155-token-roles.d.ts +8 -0
- package/dist/common/roles/erc1155-token-roles.d.ts.map +1 -0
- package/dist/common/roles/erc1155-token-roles.js +13 -0
- package/dist/common/roles/exports.d.ts +1 -0
- package/dist/common/roles/exports.d.ts.map +1 -1
- package/dist/common/roles/exports.js +1 -0
- package/dist/issuance/common/factories.base.d.ts +12 -12
- package/dist/issuance/erc1155/burn.d.ts +34 -0
- package/dist/issuance/erc1155/burn.d.ts.map +1 -0
- package/dist/issuance/erc1155/burn.js +39 -0
- package/dist/issuance/erc1155/default/deploy.d.ts +34 -0
- package/dist/issuance/erc1155/default/deploy.d.ts.map +1 -0
- package/dist/issuance/erc1155/default/deploy.js +53 -0
- package/dist/issuance/erc1155/default/initialize.d.ts +34 -0
- package/dist/issuance/erc1155/default/initialize.d.ts.map +1 -0
- package/dist/issuance/erc1155/default/initialize.js +38 -0
- package/dist/issuance/erc1155/default/parseDeployEvent.d.ts +21 -0
- package/dist/issuance/erc1155/default/parseDeployEvent.d.ts.map +1 -0
- package/dist/issuance/erc1155/default/parseDeployEvent.js +74 -0
- package/dist/issuance/erc1155/gated/deploy.d.ts +36 -0
- package/dist/issuance/erc1155/gated/deploy.d.ts.map +1 -0
- package/dist/issuance/erc1155/gated/deploy.js +61 -0
- package/dist/issuance/erc1155/gated/initialize.d.ts +36 -0
- package/dist/issuance/erc1155/gated/initialize.d.ts.map +1 -0
- package/dist/issuance/erc1155/gated/initialize.js +44 -0
- package/dist/issuance/erc1155/gated/parseDeployEvent.d.ts +21 -0
- package/dist/issuance/erc1155/gated/parseDeployEvent.d.ts.map +1 -0
- package/dist/issuance/erc1155/gated/parseDeployEvent.js +74 -0
- package/dist/issuance/erc1155/grantRole.d.ts +33 -0
- package/dist/issuance/erc1155/grantRole.d.ts.map +1 -0
- package/dist/issuance/erc1155/grantRole.js +41 -0
- package/dist/issuance/erc1155/index.d.ts +361 -0
- package/dist/issuance/erc1155/index.d.ts.map +1 -0
- package/dist/issuance/erc1155/index.js +38 -0
- package/dist/issuance/erc1155/mint.d.ts +34 -0
- package/dist/issuance/erc1155/mint.d.ts.map +1 -0
- package/dist/issuance/erc1155/mint.js +39 -0
- package/dist/issuance/erc1155/recover.d.ts +36 -0
- package/dist/issuance/erc1155/recover.d.ts.map +1 -0
- package/dist/issuance/erc1155/recover.js +40 -0
- package/dist/issuance/erc1155/renounceRole.d.ts +33 -0
- package/dist/issuance/erc1155/renounceRole.d.ts.map +1 -0
- package/dist/issuance/erc1155/renounceRole.js +41 -0
- package/dist/issuance/erc1155/revokeRole.d.ts +33 -0
- package/dist/issuance/erc1155/revokeRole.d.ts.map +1 -0
- package/dist/issuance/erc1155/revokeRole.js +41 -0
- package/dist/issuance/erc1155/setApprovalForAll.d.ts +32 -0
- package/dist/issuance/erc1155/setApprovalForAll.d.ts.map +1 -0
- package/dist/issuance/erc1155/setApprovalForAll.js +39 -0
- package/dist/issuance/erc1155/setBaseURI.d.ts +30 -0
- package/dist/issuance/erc1155/setBaseURI.d.ts.map +1 -0
- package/dist/issuance/erc1155/setBaseURI.js +36 -0
- package/dist/issuance/erc1155/setTokenURI.d.ts +32 -0
- package/dist/issuance/erc1155/setTokenURI.d.ts.map +1 -0
- package/dist/issuance/erc1155/setTokenURI.js +38 -0
- package/dist/issuance/erc721/approve.js +1 -1
- package/dist/issuance/erc721/burn.js +1 -1
- package/dist/issuance/erc721/default/deploy.js +4 -4
- package/dist/issuance/erc721/default/initialize.js +1 -1
- package/dist/issuance/erc721/default/parseDeployEvent.js +1 -1
- package/dist/issuance/erc721/gated/deploy.js +4 -4
- package/dist/issuance/erc721/gated/initialize.js +1 -1
- package/dist/issuance/erc721/gated/parseDeployEvent.js +1 -1
- package/dist/issuance/erc721/grantRole.js +1 -1
- package/dist/issuance/erc721/index.d.ts +0 -1
- package/dist/issuance/erc721/index.d.ts.map +1 -1
- package/dist/issuance/erc721/mint.d.ts +0 -2
- package/dist/issuance/erc721/mint.d.ts.map +1 -1
- package/dist/issuance/erc721/mint.js +4 -6
- package/dist/issuance/erc721/nextTokenId.d.ts +19 -0
- package/dist/issuance/erc721/nextTokenId.d.ts.map +1 -0
- package/dist/issuance/erc721/nextTokenId.js +79 -0
- package/dist/issuance/erc721/recover.js +1 -1
- package/dist/issuance/erc721/renounceRole.js +1 -1
- package/dist/issuance/erc721/revokeRole.js +1 -1
- package/dist/issuance/erc721/setBaseURI.js +1 -1
- package/dist/issuance/erc721/setTokenURI.js +1 -1
- package/dist/issuance/erc721/transferFrom.js +1 -1
- package/dist/issuance/index.d.ts +359 -1
- package/dist/issuance/index.d.ts.map +1 -1
- package/dist/issuance/index.js +2 -0
- package/package.json +9 -9
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revokeRole.d.ts","sourceRoot":"","sources":["../../../src/issuance/erc1155/revokeRole.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAiC,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAE5G,eAAO,MAAM,8BAA8B;;;;iBAOzC,CAAC;AAkBH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;aAc5B,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
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 { convertErc1155TokenRoleToHash, Erc1155TokenRole } from "../../common/roles/erc1155-token-roles.js";
|
|
8
|
+
export const RevokeRoleErc1155RequestSchema = z.object({
|
|
9
|
+
tokenAddress: AddressSchema,
|
|
10
|
+
role: z.nativeEnum(Erc1155TokenRole).openapi({
|
|
11
|
+
description: "The role to revoke",
|
|
12
|
+
example: Erc1155TokenRole.MINTER_ROLE,
|
|
13
|
+
}),
|
|
14
|
+
account: AddressSchema.openapi({ description: "The address to revoke the role from" }),
|
|
15
|
+
});
|
|
16
|
+
const revokeRoleRoute = describeRoute({
|
|
17
|
+
summary: "Revoke Role on ERC1155",
|
|
18
|
+
description: "Returns transaction data for revoking a role on the ERC1155 token contract",
|
|
19
|
+
tags: ["Issuance"],
|
|
20
|
+
responses: {
|
|
21
|
+
200: {
|
|
22
|
+
description: "Returns transaction data for revoking a role",
|
|
23
|
+
content: {
|
|
24
|
+
"application/json": {
|
|
25
|
+
schema: resolver(TransactionSchema),
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
export const RevokeRoleErc1155 = createController({
|
|
32
|
+
build: (factory) => factory.createApp().post("/", revokeRoleRoute, validator("json", RevokeRoleErc1155RequestSchema), async (c) => {
|
|
33
|
+
const { tokenAddress, role, account } = c.req.valid("json");
|
|
34
|
+
return c.json(toTransaction({
|
|
35
|
+
address: tokenAddress,
|
|
36
|
+
abi: abis.erc1155AutoIdPausableRecoverableUpgradeableAbi,
|
|
37
|
+
functionName: "revokeRole",
|
|
38
|
+
args: [convertErc1155TokenRoleToHash(role), account],
|
|
39
|
+
}));
|
|
40
|
+
}),
|
|
41
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const SetApprovalForAllErc1155RequestSchema: z.ZodObject<{
|
|
3
|
+
tokenAddress: z.ZodPipe<z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>, z.ZodTransform<`0x${string}`, `0x${string}`>>;
|
|
4
|
+
operator: z.ZodPipe<z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>, z.ZodTransform<`0x${string}`, `0x${string}`>>;
|
|
5
|
+
approved: z.ZodBoolean;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export declare const SetApprovalForAllErc1155: import("../../common/controller.js").IController<import("hono/hono-base").HonoBase<import("../../common/context.js").AppContext, {
|
|
8
|
+
"/": {
|
|
9
|
+
$post: {
|
|
10
|
+
input: {
|
|
11
|
+
json: {
|
|
12
|
+
tokenAddress: string;
|
|
13
|
+
operator: string;
|
|
14
|
+
approved: boolean;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
output: {
|
|
18
|
+
data: `0x${string}`;
|
|
19
|
+
to: `0x${string}`;
|
|
20
|
+
details: {
|
|
21
|
+
functionName: string;
|
|
22
|
+
address: `0x${string}`;
|
|
23
|
+
abi: any[];
|
|
24
|
+
args: any[];
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
outputFormat: "json";
|
|
28
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
}, "/", "/">>;
|
|
32
|
+
//# sourceMappingURL=setApprovalForAll.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setApprovalForAll.d.ts","sourceRoot":"","sources":["../../../src/issuance/erc1155/setApprovalForAll.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,qCAAqC;;;;iBAIhD,CAAC;AAkBH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;aAgBnC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
export const SetApprovalForAllErc1155RequestSchema = z.object({
|
|
8
|
+
tokenAddress: AddressSchema,
|
|
9
|
+
operator: AddressSchema.openapi({ description: "Address to grant/revoke approval for all tokens" }),
|
|
10
|
+
approved: z.boolean().openapi({ description: "True to approve, false to revoke" }),
|
|
11
|
+
});
|
|
12
|
+
const setApprovalForAllRoute = describeRoute({
|
|
13
|
+
summary: "Set Approval For All ERC1155",
|
|
14
|
+
description: "Returns transaction data for granting or revoking approval for all ERC1155 tokens",
|
|
15
|
+
tags: ["Issuance"],
|
|
16
|
+
responses: {
|
|
17
|
+
200: {
|
|
18
|
+
description: "Returns transaction data for setting approval for all tokens",
|
|
19
|
+
content: {
|
|
20
|
+
"application/json": {
|
|
21
|
+
schema: resolver(TransactionSchema),
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
export const SetApprovalForAllErc1155 = createController({
|
|
28
|
+
build: (factory) => factory
|
|
29
|
+
.createApp()
|
|
30
|
+
.post("/", setApprovalForAllRoute, validator("json", SetApprovalForAllErc1155RequestSchema), async (c) => {
|
|
31
|
+
const { tokenAddress, operator, approved } = c.req.valid("json");
|
|
32
|
+
return c.json(toTransaction({
|
|
33
|
+
address: tokenAddress,
|
|
34
|
+
abi: abis.erc1155AutoIdPausableRecoverableUpgradeableAbi,
|
|
35
|
+
functionName: "setApprovalForAll",
|
|
36
|
+
args: [operator, approved],
|
|
37
|
+
}));
|
|
38
|
+
}),
|
|
39
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const SetBaseURIErc1155RequestSchema: z.ZodObject<{
|
|
3
|
+
tokenAddress: z.ZodPipe<z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>, z.ZodTransform<`0x${string}`, `0x${string}`>>;
|
|
4
|
+
baseURI: z.ZodString;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export declare const SetBaseURIErc1155: import("../../common/controller.js").IController<import("hono/hono-base").HonoBase<import("../../common/context.js").AppContext, {
|
|
7
|
+
"/": {
|
|
8
|
+
$post: {
|
|
9
|
+
input: {
|
|
10
|
+
json: {
|
|
11
|
+
tokenAddress: string;
|
|
12
|
+
baseURI: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
output: {
|
|
16
|
+
data: `0x${string}`;
|
|
17
|
+
to: `0x${string}`;
|
|
18
|
+
details: {
|
|
19
|
+
functionName: string;
|
|
20
|
+
address: `0x${string}`;
|
|
21
|
+
abi: any[];
|
|
22
|
+
args: any[];
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
outputFormat: "json";
|
|
26
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
}, "/", "/">>;
|
|
30
|
+
//# sourceMappingURL=setBaseURI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setBaseURI.d.ts","sourceRoot":"","sources":["../../../src/issuance/erc1155/setBaseURI.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,8BAA8B;;;iBAGzC,CAAC;AAkBH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;aAc5B,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
export const SetBaseURIErc1155RequestSchema = z.object({
|
|
8
|
+
tokenAddress: AddressSchema,
|
|
9
|
+
baseURI: z.string().nonempty().openapi({ description: "New base URI for token metadata" }),
|
|
10
|
+
});
|
|
11
|
+
const setBaseURIRoute = describeRoute({
|
|
12
|
+
summary: "Set Base URI for ERC1155",
|
|
13
|
+
description: "Returns transaction data for setting the base URI for ERC1155 metadata (DEFAULT_ADMIN_ROLE gated)",
|
|
14
|
+
tags: ["Issuance"],
|
|
15
|
+
responses: {
|
|
16
|
+
200: {
|
|
17
|
+
description: "Returns transaction data for setting base URI",
|
|
18
|
+
content: {
|
|
19
|
+
"application/json": {
|
|
20
|
+
schema: resolver(TransactionSchema),
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
export const SetBaseURIErc1155 = createController({
|
|
27
|
+
build: (factory) => factory.createApp().post("/", setBaseURIRoute, validator("json", SetBaseURIErc1155RequestSchema), async (c) => {
|
|
28
|
+
const { tokenAddress, baseURI } = c.req.valid("json");
|
|
29
|
+
return c.json(toTransaction({
|
|
30
|
+
address: tokenAddress,
|
|
31
|
+
abi: abis.erc1155AutoIdPausableRecoverableUpgradeableAbi,
|
|
32
|
+
functionName: "setBaseURI",
|
|
33
|
+
args: [baseURI],
|
|
34
|
+
}));
|
|
35
|
+
}),
|
|
36
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const SetTokenURIErc1155RequestSchema: z.ZodObject<{
|
|
3
|
+
tokenAddress: z.ZodPipe<z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>, z.ZodTransform<`0x${string}`, `0x${string}`>>;
|
|
4
|
+
id: z.ZodPipe<z.core.$ZodBranded<z.ZodString, "Int256", "out">, z.ZodTransform<bigint, string & z.core.$brand<"Int256">>>;
|
|
5
|
+
tokenURI: z.ZodString;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export declare const SetTokenURIErc1155: import("../../common/controller.js").IController<import("hono/hono-base").HonoBase<import("../../common/context.js").AppContext, {
|
|
8
|
+
"/": {
|
|
9
|
+
$post: {
|
|
10
|
+
input: {
|
|
11
|
+
json: {
|
|
12
|
+
tokenAddress: string;
|
|
13
|
+
id: string;
|
|
14
|
+
tokenURI: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
output: {
|
|
18
|
+
data: `0x${string}`;
|
|
19
|
+
to: `0x${string}`;
|
|
20
|
+
details: {
|
|
21
|
+
functionName: string;
|
|
22
|
+
address: `0x${string}`;
|
|
23
|
+
abi: any[];
|
|
24
|
+
args: any[];
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
outputFormat: "json";
|
|
28
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
}, "/", "/">>;
|
|
32
|
+
//# sourceMappingURL=setTokenURI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setTokenURI.d.ts","sourceRoot":"","sources":["../../../src/issuance/erc1155/setTokenURI.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,+BAA+B;;;;iBAI1C,CAAC;AAmBH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;aAc7B,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
export const SetTokenURIErc1155RequestSchema = z.object({
|
|
9
|
+
tokenAddress: AddressSchema,
|
|
10
|
+
id: Int256BigInt(z.bigint().nonnegative()),
|
|
11
|
+
tokenURI: z.string().nonempty().openapi({ description: "URI for the specific token metadata" }),
|
|
12
|
+
});
|
|
13
|
+
const setTokenURIRoute = describeRoute({
|
|
14
|
+
summary: "Set Token URI for ERC1155",
|
|
15
|
+
description: "Returns transaction data for setting the URI for a specific ERC1155 token ID (DEFAULT_ADMIN_ROLE required)",
|
|
16
|
+
tags: ["Issuance"],
|
|
17
|
+
responses: {
|
|
18
|
+
200: {
|
|
19
|
+
description: "Returns transaction data for setting token URI",
|
|
20
|
+
content: {
|
|
21
|
+
"application/json": {
|
|
22
|
+
schema: resolver(TransactionSchema),
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
export const SetTokenURIErc1155 = createController({
|
|
29
|
+
build: (factory) => factory.createApp().post("/", setTokenURIRoute, validator("json", SetTokenURIErc1155RequestSchema), async (c) => {
|
|
30
|
+
const { tokenAddress, id, tokenURI } = c.req.valid("json");
|
|
31
|
+
return c.json(toTransaction({
|
|
32
|
+
address: tokenAddress,
|
|
33
|
+
abi: abis.erc1155AutoIdPausableRecoverableUpgradeableAbi,
|
|
34
|
+
functionName: "setTokenURI",
|
|
35
|
+
args: [BigInt(id), tokenURI],
|
|
36
|
+
}));
|
|
37
|
+
}),
|
|
38
|
+
});
|
|
@@ -30,7 +30,7 @@ export const ApproveErc721 = createController({
|
|
|
30
30
|
const { tokenAddress, to, tokenId } = c.req.valid("json");
|
|
31
31
|
return c.json(toTransaction({
|
|
32
32
|
address: tokenAddress,
|
|
33
|
-
abi: abis.
|
|
33
|
+
abi: abis.erc721AutoIdPausableRecoverableUpgradeableAbi,
|
|
34
34
|
functionName: "approve",
|
|
35
35
|
args: [to, BigInt(tokenId)],
|
|
36
36
|
}));
|
|
@@ -29,7 +29,7 @@ export const BurnErc721 = createController({
|
|
|
29
29
|
const { tokenAddress, tokenId } = c.req.valid("json");
|
|
30
30
|
return c.json(toTransaction({
|
|
31
31
|
address: tokenAddress,
|
|
32
|
-
abi: abis.
|
|
32
|
+
abi: abis.erc721AutoIdPausableRecoverableUpgradeableAbi,
|
|
33
33
|
functionName: "burn",
|
|
34
34
|
args: [BigInt(tokenId)],
|
|
35
35
|
}));
|
|
@@ -19,10 +19,10 @@ const deployErc721Route = describeRoute({
|
|
|
19
19
|
|
|
20
20
|
Returns transaction data for deploying a new ERC721 token via the factory contract.
|
|
21
21
|
|
|
22
|
-
Calls deployAndInitializeProxy on the
|
|
22
|
+
Calls deployAndInitializeProxy on the ERC721AutoIdPausableRecoverableFactory to atomically deploy and initialize a new token proxy.
|
|
23
23
|
|
|
24
24
|
The deployed token supports:
|
|
25
|
-
- mint(to
|
|
25
|
+
- mint(to) - Mint token with auto-generated ID (MINTER_ROLE gated)
|
|
26
26
|
- burn(tokenId) - Burn token (owner, approved, or MINTER_ROLE)
|
|
27
27
|
- setBaseURI(uri) - Set base URI (URI_SETTER_ROLE gated)
|
|
28
28
|
- setTokenURI(tokenId, uri) - Set token-specific URI (URI_SETTER_ROLE gated)
|
|
@@ -44,8 +44,8 @@ export const CreateErc721Token = createController({
|
|
|
44
44
|
const { chainId, tokenName, tokenSymbol, baseURI, defaultTokenAdmin, minter } = c.req.valid("json");
|
|
45
45
|
const factory = getFactories(chainId);
|
|
46
46
|
return c.json(toTransaction({
|
|
47
|
-
address: factory.
|
|
48
|
-
abi: abis.
|
|
47
|
+
address: factory.ERC721AutoIdPausableRecoverableFactory,
|
|
48
|
+
abi: abis.erc721AutoIdPausableRecoverableFactoryAbi,
|
|
49
49
|
functionName: "deployAndInitializeProxy",
|
|
50
50
|
args: [tokenName, tokenSymbol, baseURI, defaultTokenAdmin, minter],
|
|
51
51
|
}));
|
|
@@ -32,7 +32,7 @@ export const InitializeDefaultErc721 = createController({
|
|
|
32
32
|
const { tokenAddress, name, symbol, baseURI, defaultAdmin, minter } = c.req.valid("json");
|
|
33
33
|
return c.json(toTransaction({
|
|
34
34
|
address: tokenAddress,
|
|
35
|
-
abi: abis.
|
|
35
|
+
abi: abis.erc721AutoIdPausableRecoverableUpgradeableAbi,
|
|
36
36
|
functionName: "initialize",
|
|
37
37
|
args: [name, symbol, baseURI, defaultAdmin, minter],
|
|
38
38
|
}));
|
|
@@ -51,7 +51,7 @@ export const ParseDefaultErc721DeployEvent = createController({
|
|
|
51
51
|
hash: params.hash,
|
|
52
52
|
});
|
|
53
53
|
const [event] = parseEventLogs({
|
|
54
|
-
abi: abis.
|
|
54
|
+
abi: abis.erc721AutoIdPausableRecoverableFactoryAbi,
|
|
55
55
|
eventName: "TokenProxyConfigured",
|
|
56
56
|
logs: receipt.logs,
|
|
57
57
|
});
|
|
@@ -23,10 +23,10 @@ const deployGatedErc721Route = describeRoute({
|
|
|
23
23
|
|
|
24
24
|
Returns transaction data for deploying a new gated ERC721 token via the factory contract.
|
|
25
25
|
|
|
26
|
-
Calls deployAndInitializeProxy on the
|
|
26
|
+
Calls deployAndInitializeProxy on the ERC721AutoIdGatedPausableRecoverableFactory to atomically deploy and initialize a new token proxy with whitelist gating.
|
|
27
27
|
|
|
28
28
|
The deployed token supports:
|
|
29
|
-
- mint(to
|
|
29
|
+
- mint(to) - Mint token with auto-generated ID (MINTER_ROLE gated)
|
|
30
30
|
- burn(tokenId) - Burn token (owner, approved, or MINTER_ROLE)
|
|
31
31
|
- setBaseURI(uri) - Set base URI (URI_SETTER_ROLE gated)
|
|
32
32
|
- setTokenURI(tokenId, uri) - Set token-specific URI (URI_SETTER_ROLE gated)
|
|
@@ -51,8 +51,8 @@ export const CreateGatedErc721Token = createController({
|
|
|
51
51
|
const { chainId, tokenName, tokenSymbol, baseURI, defaultTokenAdmin, minter, gatingSigner } = c.req.valid("json");
|
|
52
52
|
const factory = getFactories(chainId);
|
|
53
53
|
return c.json(toTransaction({
|
|
54
|
-
address: factory.
|
|
55
|
-
abi: abis.
|
|
54
|
+
address: factory.ERC721AutoIdGatedPausableRecoverableFactory,
|
|
55
|
+
abi: abis.erc721AutoIdGatedPausableRecoverableFactoryAbi,
|
|
56
56
|
functionName: "deployAndInitializeProxy",
|
|
57
57
|
args: [tokenName, tokenSymbol, baseURI, defaultTokenAdmin, minter, gatingSigner ?? DEFAULT_COMPILOT_SIGNER],
|
|
58
58
|
}));
|
|
@@ -36,7 +36,7 @@ export const InitializeGatedErc721 = createController({
|
|
|
36
36
|
const { tokenAddress, name, symbol, baseURI, defaultAdmin, minter, gatingSigner } = c.req.valid("json");
|
|
37
37
|
return c.json(toTransaction({
|
|
38
38
|
address: tokenAddress,
|
|
39
|
-
abi: abis.
|
|
39
|
+
abi: abis.erc721AutoIdWhitelistGatedPausableRecoverableUpgradeableAbi,
|
|
40
40
|
functionName: "initialize",
|
|
41
41
|
args: [name, symbol, baseURI, defaultAdmin, minter, gatingSigner ?? DEFAULT_COMPILOT_SIGNER],
|
|
42
42
|
}));
|
|
@@ -51,7 +51,7 @@ export const ParseGatedErc721DeployEvent = createController({
|
|
|
51
51
|
hash: params.hash,
|
|
52
52
|
});
|
|
53
53
|
const [event] = parseEventLogs({
|
|
54
|
-
abi: abis.
|
|
54
|
+
abi: abis.erc721AutoIdGatedPausableRecoverableFactoryAbi,
|
|
55
55
|
eventName: "TokenProxyConfigured",
|
|
56
56
|
logs: receipt.logs,
|
|
57
57
|
});
|
|
@@ -33,7 +33,7 @@ export const GrantRoleErc721 = createController({
|
|
|
33
33
|
const { tokenAddress, role, account } = c.req.valid("json");
|
|
34
34
|
return c.json(toTransaction({
|
|
35
35
|
address: tokenAddress,
|
|
36
|
-
abi: abis.
|
|
36
|
+
abi: abis.erc721AutoIdPausableRecoverableUpgradeableAbi,
|
|
37
37
|
functionName: "grantRole",
|
|
38
38
|
args: [convertErc721TokenRoleToHash(role), account],
|
|
39
39
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/issuance/erc721/index.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/issuance/erc721/index.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAuB3B,CAAC"}
|
|
@@ -2,7 +2,6 @@ import { z } from "zod";
|
|
|
2
2
|
export declare const MintErc721RequestSchema: z.ZodObject<{
|
|
3
3
|
tokenAddress: z.ZodPipe<z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>, z.ZodTransform<`0x${string}`, `0x${string}`>>;
|
|
4
4
|
to: z.ZodPipe<z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>, z.ZodTransform<`0x${string}`, `0x${string}`>>;
|
|
5
|
-
tokenId: z.ZodPipe<z.core.$ZodBranded<z.ZodString, "Int256", "out">, z.ZodTransform<bigint, string & z.core.$brand<"Int256">>>;
|
|
6
5
|
}, z.core.$strip>;
|
|
7
6
|
export declare const MintErc721: import("../../common/controller.js").IController<import("hono/hono-base").HonoBase<import("../../common/context.js").AppContext, {
|
|
8
7
|
"/": {
|
|
@@ -11,7 +10,6 @@ export declare const MintErc721: import("../../common/controller.js").IControlle
|
|
|
11
10
|
json: {
|
|
12
11
|
tokenAddress: string;
|
|
13
12
|
to: string;
|
|
14
|
-
tokenId: string;
|
|
15
13
|
};
|
|
16
14
|
};
|
|
17
15
|
output: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mint.d.ts","sourceRoot":"","sources":["../../../src/issuance/erc721/mint.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"mint.d.ts","sourceRoot":"","sources":["../../../src/issuance/erc721/mint.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,uBAAuB;;;iBAGlC,CAAC;AAmBH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;aAcrB,CAAC"}
|
|
@@ -4,15 +4,13 @@ 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 { Int256BigInt } from "../../common/int256.js";
|
|
8
7
|
export const MintErc721RequestSchema = z.object({
|
|
9
8
|
tokenAddress: AddressSchema,
|
|
10
9
|
to: AddressSchema.openapi({ description: "Address to mint the token to" }),
|
|
11
|
-
tokenId: Int256BigInt(z.bigint().nonnegative()),
|
|
12
10
|
});
|
|
13
11
|
const mintRoute = describeRoute({
|
|
14
12
|
summary: "Mint ERC721",
|
|
15
|
-
description: "Returns transaction data for minting an ERC721 token (MINTER_ROLE required)",
|
|
13
|
+
description: "Returns transaction data for minting an ERC721 token with an auto-generated token ID (MINTER_ROLE required)",
|
|
16
14
|
tags: ["Issuance"],
|
|
17
15
|
responses: {
|
|
18
16
|
200: {
|
|
@@ -27,12 +25,12 @@ const mintRoute = describeRoute({
|
|
|
27
25
|
});
|
|
28
26
|
export const MintErc721 = createController({
|
|
29
27
|
build: (factory) => factory.createApp().post("/", mintRoute, validator("json", MintErc721RequestSchema), async (c) => {
|
|
30
|
-
const { tokenAddress, to
|
|
28
|
+
const { tokenAddress, to } = c.req.valid("json");
|
|
31
29
|
return c.json(toTransaction({
|
|
32
30
|
address: tokenAddress,
|
|
33
|
-
abi: abis.
|
|
31
|
+
abi: abis.erc721AutoIdPausableRecoverableUpgradeableAbi,
|
|
34
32
|
functionName: "mint",
|
|
35
|
-
args: [to
|
|
33
|
+
args: [to],
|
|
36
34
|
}));
|
|
37
35
|
}),
|
|
38
36
|
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const NextTokenIdErc721: import("../../common/controller.js").IController<import("hono/hono-base").HonoBase<import("../../common/context.js").AppContext, {
|
|
2
|
+
"/": {
|
|
3
|
+
$get: {
|
|
4
|
+
input: {
|
|
5
|
+
query: {
|
|
6
|
+
chainId: string | string[];
|
|
7
|
+
tokenAddress: string | string[];
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
output: {
|
|
11
|
+
nextTokenId: string;
|
|
12
|
+
totalMinted: number;
|
|
13
|
+
};
|
|
14
|
+
outputFormat: "json";
|
|
15
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
}, "/", "/">>;
|
|
19
|
+
//# sourceMappingURL=nextTokenId.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nextTokenId.d.ts","sourceRoot":"","sources":["../../../src/issuance/erc721/nextTokenId.ts"],"names":[],"mappings":"AAsCA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;aAsD5B,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { describeRoute } from "hono-openapi";
|
|
2
|
+
import { resolver, validator } from "hono-openapi";
|
|
3
|
+
import { zeroAddress } from "viem";
|
|
4
|
+
import { getContractEvents } from "viem/actions";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import { abis } from "@evergonlabs/tmi-factories-sdk";
|
|
7
|
+
import { getPublicClient } from "../../common/blockchain.js";
|
|
8
|
+
import { createController } from "../../common/controller.js";
|
|
9
|
+
import { AddressSchema } from "../../common/index.js";
|
|
10
|
+
import { FactoryChainIdQuery } from "../common/factories.js";
|
|
11
|
+
const QuerySchema = z.object({
|
|
12
|
+
chainId: FactoryChainIdQuery.openapi({
|
|
13
|
+
param: {
|
|
14
|
+
name: "chainId",
|
|
15
|
+
in: "query",
|
|
16
|
+
},
|
|
17
|
+
}),
|
|
18
|
+
tokenAddress: AddressSchema.openapi({
|
|
19
|
+
param: {
|
|
20
|
+
name: "tokenAddress",
|
|
21
|
+
in: "query",
|
|
22
|
+
},
|
|
23
|
+
description: "ERC721 contract address",
|
|
24
|
+
}),
|
|
25
|
+
});
|
|
26
|
+
const ResponseSchema = z.object({
|
|
27
|
+
nextTokenId: z.string().openapi({
|
|
28
|
+
description: "Next available token ID (max minted tokenId + 1, or '0' if none minted)",
|
|
29
|
+
example: "42",
|
|
30
|
+
}),
|
|
31
|
+
totalMinted: z.number().int().nonnegative().openapi({
|
|
32
|
+
description: "Total number of tokens minted (Transfer events from address(0))",
|
|
33
|
+
example: 41,
|
|
34
|
+
}),
|
|
35
|
+
});
|
|
36
|
+
export const NextTokenIdErc721 = createController({
|
|
37
|
+
build: (factory) => factory.createApp().get("/", describeRoute({
|
|
38
|
+
summary: "Get next ERC721 token ID",
|
|
39
|
+
description: "Scans all Transfer events from address(0) (mints) for the given ERC721 contract and returns the next available token ID (highest minted ID + 1). If no tokens have been minted, returns '0'.",
|
|
40
|
+
tags: ["Issuance"],
|
|
41
|
+
responses: {
|
|
42
|
+
200: {
|
|
43
|
+
description: "Returns the next token ID and total minted count",
|
|
44
|
+
content: {
|
|
45
|
+
"application/json": {
|
|
46
|
+
schema: resolver(ResponseSchema),
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
}), validator("query", QuerySchema), async (c) => {
|
|
52
|
+
const params = c.req.valid("query");
|
|
53
|
+
const client = getPublicClient(params.chainId, c.env.config);
|
|
54
|
+
const mintEvents = await getContractEvents(client, {
|
|
55
|
+
address: params.tokenAddress,
|
|
56
|
+
abi: abis.erc721PausableRecoverableUpgradeableAbi,
|
|
57
|
+
eventName: "Transfer",
|
|
58
|
+
args: {
|
|
59
|
+
from: zeroAddress,
|
|
60
|
+
},
|
|
61
|
+
fromBlock: "earliest",
|
|
62
|
+
toBlock: "latest",
|
|
63
|
+
});
|
|
64
|
+
if (mintEvents.length === 0) {
|
|
65
|
+
return c.json({
|
|
66
|
+
nextTokenId: "0",
|
|
67
|
+
totalMinted: 0,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
const maxTokenId = mintEvents.reduce((max, event) => {
|
|
71
|
+
const tokenId = event.args.tokenId;
|
|
72
|
+
return tokenId > max ? tokenId : max;
|
|
73
|
+
}, 0n);
|
|
74
|
+
return c.json({
|
|
75
|
+
nextTokenId: (maxTokenId + 1n).toString(),
|
|
76
|
+
totalMinted: mintEvents.length,
|
|
77
|
+
});
|
|
78
|
+
}),
|
|
79
|
+
});
|
|
@@ -31,7 +31,7 @@ export const RecoverErc721 = createController({
|
|
|
31
31
|
const { tokenAddress, from, to, tokenId } = c.req.valid("json");
|
|
32
32
|
return c.json(toTransaction({
|
|
33
33
|
address: tokenAddress,
|
|
34
|
-
abi: abis.
|
|
34
|
+
abi: abis.erc721AutoIdPausableRecoverableUpgradeableAbi,
|
|
35
35
|
functionName: "recover",
|
|
36
36
|
args: [from, to, BigInt(tokenId)],
|
|
37
37
|
}));
|
|
@@ -33,7 +33,7 @@ export const RenounceRoleErc721 = createController({
|
|
|
33
33
|
const { tokenAddress, role, callerConfirmation } = c.req.valid("json");
|
|
34
34
|
return c.json(toTransaction({
|
|
35
35
|
address: tokenAddress,
|
|
36
|
-
abi: abis.
|
|
36
|
+
abi: abis.erc721AutoIdPausableRecoverableUpgradeableAbi,
|
|
37
37
|
functionName: "renounceRole",
|
|
38
38
|
args: [convertErc721TokenRoleToHash(role), callerConfirmation],
|
|
39
39
|
}));
|
|
@@ -33,7 +33,7 @@ export const RevokeRoleErc721 = createController({
|
|
|
33
33
|
const { tokenAddress, role, account } = c.req.valid("json");
|
|
34
34
|
return c.json(toTransaction({
|
|
35
35
|
address: tokenAddress,
|
|
36
|
-
abi: abis.
|
|
36
|
+
abi: abis.erc721AutoIdPausableRecoverableUpgradeableAbi,
|
|
37
37
|
functionName: "revokeRole",
|
|
38
38
|
args: [convertErc721TokenRoleToHash(role), account],
|
|
39
39
|
}));
|
|
@@ -28,7 +28,7 @@ export const SetBaseURIErc721 = createController({
|
|
|
28
28
|
const { tokenAddress, baseURI } = c.req.valid("json");
|
|
29
29
|
return c.json(toTransaction({
|
|
30
30
|
address: tokenAddress,
|
|
31
|
-
abi: abis.
|
|
31
|
+
abi: abis.erc721AutoIdPausableRecoverableUpgradeableAbi,
|
|
32
32
|
functionName: "setBaseURI",
|
|
33
33
|
args: [baseURI],
|
|
34
34
|
}));
|
|
@@ -30,7 +30,7 @@ export const SetTokenURIErc721 = createController({
|
|
|
30
30
|
const { tokenAddress, tokenId, tokenURI } = c.req.valid("json");
|
|
31
31
|
return c.json(toTransaction({
|
|
32
32
|
address: tokenAddress,
|
|
33
|
-
abi: abis.
|
|
33
|
+
abi: abis.erc721AutoIdPausableRecoverableUpgradeableAbi,
|
|
34
34
|
functionName: "setTokenURI",
|
|
35
35
|
args: [BigInt(tokenId), tokenURI],
|
|
36
36
|
}));
|
|
@@ -31,7 +31,7 @@ export const TransferFromErc721 = createController({
|
|
|
31
31
|
const { tokenAddress, from, to, tokenId } = c.req.valid("json");
|
|
32
32
|
return c.json(toTransaction({
|
|
33
33
|
address: tokenAddress,
|
|
34
|
-
abi: abis.
|
|
34
|
+
abi: abis.erc721AutoIdPausableRecoverableUpgradeableAbi,
|
|
35
35
|
functionName: "transferFrom",
|
|
36
36
|
args: [from, to, BigInt(tokenId)],
|
|
37
37
|
}));
|