Skip to content

Commit 62df6d0

Browse files
committed
create by id
1 parent c79881d commit 62df6d0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/thirdweb/src/tokens/create-token.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import { bytesToHex, randomBytes } from "@noble/hashes/utils";
22
import type { Hex } from "viem";
33
import { parseEventLogs } from "../event/actions/parse-logs.js";
44
import { createdEvent } from "../extensions/tokens/__generated__/ERC20Entrypoint/events/Created.js";
5-
import { create } from "../extensions/tokens/__generated__/ERC20Entrypoint/write/create.js";
5+
import { createById } from "../extensions/tokens/__generated__/ERC20Entrypoint/write/createById.js";
66
import { sendAndConfirmTransaction } from "../transaction/actions/send-and-confirm-transaction.js";
7+
import { padHex, toHex } from "../utils/encoding/hex.js";
78
import { DEFAULT_DEVELOPER_ADDRESS } from "./constants.js";
89
import { getDeployedEntrypointERC20 } from "./get-entrypoint-erc20.js";
910
import {
@@ -28,13 +29,16 @@ export async function createToken(options: CreateTokenOptions) {
2829
const entrypoint = await getDeployedEntrypointERC20(options);
2930

3031
let hookData: Hex = "0x";
32+
let contractId = padHex(toHex("ERC20Asset"), { size: 32 });
3133
if (launchConfig?.kind === "pool") {
3234
hookData = encodePoolConfig(launchConfig.config);
35+
contractId = padHex(toHex("ERC20Asset_Pool"), { size: 32 });
3336
}
3437

35-
const transaction = create({
38+
const transaction = createById({
3639
contract: entrypoint,
37-
createParams: {
40+
contractId,
41+
params: {
3842
data: encodedInitData,
3943
hookData,
4044
developer: options.developerAddress || DEFAULT_DEVELOPER_ADDRESS,

0 commit comments

Comments
 (0)