diff --git a/pkgs/cli/src/modules/bigbang.ts b/pkgs/cli/src/modules/bigbang.ts index 3bbc967..7537f66 100644 --- a/pkgs/cli/src/modules/bigbang.ts +++ b/pkgs/cli/src/modules/bigbang.ts @@ -2,9 +2,10 @@ // Write with viem // ############################################################### -import { Address } from "viem"; +import { Address, decodeEventLog } from "viem"; import { publicClient, walletClient } from ".."; import { bigbangContractBaseConfig } from "../config"; +import { startLoading } from "../services/loading"; /** * プロジェクト作成 @@ -18,6 +19,8 @@ export const bigbang = async (params: { hatterHatImageURI: string; trustedForwarder: Address; }) => { + const stop = startLoading(); + const { request } = await publicClient.simulateContract({ ...bigbangContractBaseConfig, account: walletClient.account, @@ -33,5 +36,30 @@ export const bigbang = async (params: { }); const transactionHash = await walletClient.writeContract(request); + const receipt = await publicClient.waitForTransactionReceipt({ + hash: transactionHash, + }); + + const log = receipt.logs.find((log) => { + try { + const decodedLog = decodeEventLog({ + abi: bigbangContractBaseConfig.abi, + data: log.data, + topics: log.topics, + }); + return decodedLog.eventName === "Executed"; + } catch (error) {} + })!; + + stop(); + + console.log( + decodeEventLog({ + abi: bigbangContractBaseConfig.abi, + data: log.data, + topics: log.topics, + }) + ); + return transactionHash; }; diff --git a/pkgs/cli/src/modules/fractiontoken.ts b/pkgs/cli/src/modules/fractiontoken.ts index 7b0ff6a..ef5ae5f 100644 --- a/pkgs/cli/src/modules/fractiontoken.ts +++ b/pkgs/cli/src/modules/fractiontoken.ts @@ -56,7 +56,13 @@ export const sendFractionToken = async ( stop(); - console.log(log); + console.log( + decodeEventLog({ + abi: fractionTokenBaseConfig.abi, + data: log!.data, + topics: log!.topics, + }) + ); return transactionHash; };