diff --git a/.github/workflows/test-contract.yml b/.github/workflows/test-contract.yml index f781bc2..ae5be52 100644 --- a/.github/workflows/test-contract.yml +++ b/.github/workflows/test-contract.yml @@ -29,6 +29,10 @@ jobs: run: yarn install working-directory: ./pkgs/contract + - name: Lint Check + run: yarn lint + working-directory: ./pkgs/contract + - name: Run Hardhat tests run: | npx hardhat test > ./test-results.txt diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 18b5c36..0000000 --- a/.prettierignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/typechain-types -**/artifacts -**/cache -**/coverage* -**/.next -**/dist \ No newline at end of file diff --git a/.prettierrc.json b/.prettierrc.json deleted file mode 100644 index f5361ac..0000000 --- a/.prettierrc.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "overrides": [ - { - "files": "**/*.sol", - "options": { - "printWidth": 80, - "tabWidth": 4, - "useTabs": true, - "singleQuote": false, - "bracketSpacing": true, - "explicitTypes": "preserve" - } - }, - { - "files": "**/*.ts", - "options": { - "printWidth": 80, - "tabWidth": 2, - "useTabs": true, - "singleQuote": false, - "bracketSpacing": true, - "explicitTypes": "preserve" - } - }, - { - "files": "**/*.tsx", - "options": { - "printWidth": 80, - "tabWidth": 2, - "useTabs": true, - "singleQuote": false, - "bracketSpacing": true, - "explicitTypes": "preserve" - } - } - ] -} diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 5168625..9c6e831 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,6 +1,6 @@ { "recommendations": [ - "esbenp.prettier-vscode", + "biomejs.biome", "NomicFoundation.hardhat-solidity", "tintinweb.solidity-visual-auditor", "jebbs.plantuml", diff --git a/.vscode/settings.json b/.vscode/settings.json index ae06cf7..a17f7c0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,12 +1,15 @@ { "editor.formatOnSave": true, - "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.defaultFormatter": "biomejs.biome", "[typescript]": { + "editor.defaultFormatter": "biomejs.biome", "editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit" } }, "[plantuml]": { "editor.defaultFormatter": "jebbs.plantuml" - } + }, + "files.insertFinalNewline": true, + "files.trimTrailingWhitespace": true } diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..072fdbc --- /dev/null +++ b/biome.json @@ -0,0 +1,47 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", + "vcs": { + "enabled": false, + "clientKind": "git", + "useIgnoreFile": false + }, + "files": { + "ignoreUnknown": false, + "ignore": [ + "**/node_modules", + "**/build", + "**/dist", + "**/coverage", + "**/temp", + "**/tmp", + "**/out", + "**/target", + "**/public", + "**/docs", + "**/contract/artifacts", + "**/contract/cache", + "**/contract/test", + "**/subgraph/generated", + "**/subgraph/build", + "**/frontend/gql" + ] + }, + "formatter": { + "enabled": true, + "indentStyle": "space" + }, + "organizeImports": { + "enabled": true + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true + } + }, + "javascript": { + "formatter": { + "quoteStyle": "double" + } + } +} diff --git a/lefthook.yaml b/lefthook.yaml new file mode 100644 index 0000000..c71a29d --- /dev/null +++ b/lefthook.yaml @@ -0,0 +1,5 @@ +pre-commit: + commands: + check: + glob: "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}" + run: npx biome check --apply --no-errors-on-unmatched --files-ignore-unknown=true . && git update-index --again diff --git a/package.json b/package.json index 1da112f..92b1c7f 100644 --- a/package.json +++ b/package.json @@ -9,14 +9,19 @@ "engines": { "node": ">=20" }, - "workspaces": [ - "pkgs/*" - ], + "workspaces": ["pkgs/*"], "scripts": { + "biome:format": "npx biome format --write .", + "biome:check": "npx biome check --apply .", "frontend": "yarn workspace frontend", "contract": "yarn workspace contract", "cli": "yarn workspace cli", - "document": "yarn workspace document" + "document": "yarn workspace document", + "subgraph": "yarn workspace subgraph" + }, + "devDependencies": { + "@biomejs/biome": "^1.9.4", + "lefthook": "^1.10.1" }, "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" } diff --git a/pkgs/cli/scripts/hat.ts b/pkgs/cli/scripts/hat.ts index 91c089c..3b5b91f 100644 --- a/pkgs/cli/scripts/hat.ts +++ b/pkgs/cli/scripts/hat.ts @@ -5,7 +5,7 @@ import { hatsSubgraphClient } from "../src/modules/hatsProtocol"; * HatsProtocolの機能を試すためのスクリプト */ const main = async () => { - /* + /* // hatの情報を取得する。 const hat = await hatsSubgraphClient.getHat({ chainId: optimism.id, @@ -34,29 +34,29 @@ const main = async () => { console.log(hat); */ - // ツリー情報を全て取得する。 - const tree = await hatsSubgraphClient.getTree({ - chainId: optimism.id, - treeId: 163, - props: { - hats: { - props: { - prettyId: true, - status: true, - createdAt: true, - details: true, - maxSupply: true, - eligibility: true, - imageUri: true, - toggle: true, - levelAtLocalTree: true, - currentSupply: true, - }, - }, - }, - }); + // ツリー情報を全て取得する。 + const tree = await hatsSubgraphClient.getTree({ + chainId: optimism.id, + treeId: 163, + props: { + hats: { + props: { + prettyId: true, + status: true, + createdAt: true, + details: true, + maxSupply: true, + eligibility: true, + imageUri: true, + toggle: true, + levelAtLocalTree: true, + currentSupply: true, + }, + }, + }, + }); - console.log(tree); + console.log(tree); }; main().catch(console.error); diff --git a/pkgs/cli/src/abi/bigbang.ts b/pkgs/cli/src/abi/bigbang.ts index 8db4a89..96fde08 100644 --- a/pkgs/cli/src/abi/bigbang.ts +++ b/pkgs/cli/src/abi/bigbang.ts @@ -1,228 +1,228 @@ export const BIGBANG_ABI = [ - { - inputs: [ - { - internalType: "address", - name: "_trustedForwarder", - type: "address", - }, - { - internalType: "address", - name: "_hatsAddress", - type: "address", - }, - { - internalType: "address", - name: "_hatsModuleFactory", - type: "address", - }, - { - internalType: "address", - name: "_hatsTimeFrameModule_IMPL", - type: "address", - }, - { - internalType: "address", - name: "_splitsCreatorFactory", - type: "address", - }, - { - internalType: "address", - name: "_splitFactoryV2", - type: "address", - }, - { - internalType: "address", - name: "_fractionToken", - type: "address", - }, - ], - stateMutability: "nonpayable", - type: "constructor", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "owner", - type: "address", - }, - { - indexed: true, - internalType: "uint256", - name: "topHatId", - type: "uint256", - }, - { - indexed: false, - internalType: "address", - name: "hatsTimeFrameModule", - type: "address", - }, - { - indexed: false, - internalType: "address", - name: "splitCreator", - type: "address", - }, - ], - name: "Executed", - type: "event", - }, - { - inputs: [], - name: "Hats", - outputs: [ - { - internalType: "contract IHats", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "HatsModuleFactory", - outputs: [ - { - internalType: "contract IHatsModuleFactory", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "HatsTimeFrameModule_IMPL", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "SplitsCreatorFactory", - outputs: [ - { - internalType: "contract ISplitsCreatorFactory", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "_owner", - type: "address", - }, - { - internalType: "string", - name: "_topHatDetails", - type: "string", - }, - { - internalType: "string", - name: "_topHatImageURI", - type: "string", - }, - { - internalType: "string", - name: "_hatterHatDetails", - type: "string", - }, - { - internalType: "string", - name: "_hatterHatImageURI", - type: "string", - }, - { - internalType: "address", - name: "_trustedForwarder", - type: "address", - }, - ], - name: "bigbang", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "fractionToken", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "forwarder", - type: "address", - }, - ], - name: "isTrustedForwarder", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "splitFactoryV2", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "trustedForwarder", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, + { + inputs: [ + { + internalType: "address", + name: "_trustedForwarder", + type: "address", + }, + { + internalType: "address", + name: "_hatsAddress", + type: "address", + }, + { + internalType: "address", + name: "_hatsModuleFactory", + type: "address", + }, + { + internalType: "address", + name: "_hatsTimeFrameModule_IMPL", + type: "address", + }, + { + internalType: "address", + name: "_splitsCreatorFactory", + type: "address", + }, + { + internalType: "address", + name: "_splitFactoryV2", + type: "address", + }, + { + internalType: "address", + name: "_fractionToken", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address", + }, + { + indexed: true, + internalType: "uint256", + name: "topHatId", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "hatsTimeFrameModule", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "splitCreator", + type: "address", + }, + ], + name: "Executed", + type: "event", + }, + { + inputs: [], + name: "Hats", + outputs: [ + { + internalType: "contract IHats", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "HatsModuleFactory", + outputs: [ + { + internalType: "contract IHatsModuleFactory", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "HatsTimeFrameModule_IMPL", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "SplitsCreatorFactory", + outputs: [ + { + internalType: "contract ISplitsCreatorFactory", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_owner", + type: "address", + }, + { + internalType: "string", + name: "_topHatDetails", + type: "string", + }, + { + internalType: "string", + name: "_topHatImageURI", + type: "string", + }, + { + internalType: "string", + name: "_hatterHatDetails", + type: "string", + }, + { + internalType: "string", + name: "_hatterHatImageURI", + type: "string", + }, + { + internalType: "address", + name: "_trustedForwarder", + type: "address", + }, + ], + name: "bigbang", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "fractionToken", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "forwarder", + type: "address", + }, + ], + name: "isTrustedForwarder", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "splitFactoryV2", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "trustedForwarder", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, ] as const; diff --git a/pkgs/cli/src/abi/fractiontoken.ts b/pkgs/cli/src/abi/fractiontoken.ts index a88416f..c404c86 100644 --- a/pkgs/cli/src/abi/fractiontoken.ts +++ b/pkgs/cli/src/abi/fractiontoken.ts @@ -1,634 +1,634 @@ export const FRACTION_TOKEN_ABI = [ - { - inputs: [ - { - internalType: "string", - name: "_uri", - type: "string", - }, - { - internalType: "uint256", - name: "_tokenSupply", - type: "uint256", - }, - { - internalType: "address", - name: "_hatsAddress", - type: "address", - }, - { - internalType: "address", - name: "_trustedForwarderAddress", - type: "address", - }, - ], - stateMutability: "nonpayable", - type: "constructor", - }, - { - inputs: [ - { - internalType: "address", - name: "sender", - type: "address", - }, - { - internalType: "uint256", - name: "balance", - type: "uint256", - }, - { - internalType: "uint256", - name: "needed", - type: "uint256", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "ERC1155InsufficientBalance", - type: "error", - }, - { - inputs: [ - { - internalType: "address", - name: "approver", - type: "address", - }, - ], - name: "ERC1155InvalidApprover", - type: "error", - }, - { - inputs: [ - { - internalType: "uint256", - name: "idsLength", - type: "uint256", - }, - { - internalType: "uint256", - name: "valuesLength", - type: "uint256", - }, - ], - name: "ERC1155InvalidArrayLength", - type: "error", - }, - { - inputs: [ - { - internalType: "address", - name: "operator", - type: "address", - }, - ], - name: "ERC1155InvalidOperator", - type: "error", - }, - { - inputs: [ - { - internalType: "address", - name: "receiver", - type: "address", - }, - ], - name: "ERC1155InvalidReceiver", - type: "error", - }, - { - inputs: [ - { - internalType: "address", - name: "sender", - type: "address", - }, - ], - name: "ERC1155InvalidSender", - type: "error", - }, - { - inputs: [ - { - internalType: "address", - name: "operator", - type: "address", - }, - { - internalType: "address", - name: "owner", - type: "address", - }, - ], - name: "ERC1155MissingApprovalForAll", - type: "error", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "account", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "operator", - type: "address", - }, - { - indexed: false, - internalType: "bool", - name: "approved", - type: "bool", - }, - ], - name: "ApprovalForAll", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "operator", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "from", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "to", - type: "address", - }, - { - indexed: false, - internalType: "uint256[]", - name: "ids", - type: "uint256[]", - }, - { - indexed: false, - internalType: "uint256[]", - name: "values", - type: "uint256[]", - }, - ], - name: "TransferBatch", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "operator", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "from", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "to", - type: "address", - }, - { - indexed: false, - internalType: "uint256", - name: "id", - type: "uint256", - }, - { - indexed: false, - internalType: "uint256", - name: "value", - type: "uint256", - }, - ], - name: "TransferSingle", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "string", - name: "value", - type: "string", - }, - { - indexed: true, - internalType: "uint256", - name: "id", - type: "uint256", - }, - ], - name: "URI", - type: "event", - }, - { - inputs: [], - name: "TOKEN_SUPPLY", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "account", - type: "address", - }, - { - internalType: "uint256", - name: "id", - type: "uint256", - }, - ], - name: "balanceOf", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "account", - type: "address", - }, - { - internalType: "address", - name: "wearer", - type: "address", - }, - { - internalType: "uint256", - name: "hatId", - type: "uint256", - }, - ], - name: "balanceOf", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address[]", - name: "accounts", - type: "address[]", - }, - { - internalType: "address[]", - name: "wearers", - type: "address[]", - }, - { - internalType: "uint256[]", - name: "hatIds", - type: "uint256[]", - }, - ], - name: "balanceOfBatch", - outputs: [ - { - internalType: "uint256[]", - name: "", - type: "uint256[]", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address[]", - name: "accounts", - type: "address[]", - }, - { - internalType: "uint256[]", - name: "ids", - type: "uint256[]", - }, - ], - name: "balanceOfBatch", - outputs: [ - { - internalType: "uint256[]", - name: "", - type: "uint256[]", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "from", - type: "address", - }, - { - internalType: "address", - name: "wearer", - type: "address", - }, - { - internalType: "uint256", - name: "hatId", - type: "uint256", - }, - { - internalType: "uint256", - name: "value", - type: "uint256", - }, - ], - name: "burn", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "hatId", - type: "uint256", - }, - { - internalType: "address", - name: "account", - type: "address", - }, - ], - name: "getTokenId", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "getTokenRecipients", - outputs: [ - { - internalType: "address[]", - name: "", - type: "address[]", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "account", - type: "address", - }, - { - internalType: "address", - name: "operator", - type: "address", - }, - ], - name: "isApprovedForAll", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "forwarder", - type: "address", - }, - ], - name: "isTrustedForwarder", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "hatId", - type: "uint256", - }, - { - internalType: "address", - name: "account", - type: "address", - }, - ], - name: "mint", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "from", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256[]", - name: "tokenIds", - type: "uint256[]", - }, - { - internalType: "uint256[]", - name: "amounts", - type: "uint256[]", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", - }, - ], - name: "safeBatchTransferFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "from", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - { - internalType: "uint256", - name: "amount", - type: "uint256", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", - }, - ], - name: "safeTransferFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "operator", - type: "address", - }, - { - internalType: "bool", - name: "approved", - type: "bool", - }, - ], - name: "setApprovalForAll", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes4", - name: "interfaceId", - type: "bytes4", - }, - ], - name: "supportsInterface", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "trustedForwarder", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "uri", - outputs: [ - { - internalType: "string", - name: "", - type: "string", - }, - ], - stateMutability: "view", - type: "function", - }, + { + inputs: [ + { + internalType: "string", + name: "_uri", + type: "string", + }, + { + internalType: "uint256", + name: "_tokenSupply", + type: "uint256", + }, + { + internalType: "address", + name: "_hatsAddress", + type: "address", + }, + { + internalType: "address", + name: "_trustedForwarderAddress", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address", + }, + { + internalType: "uint256", + name: "balance", + type: "uint256", + }, + { + internalType: "uint256", + name: "needed", + type: "uint256", + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "ERC1155InsufficientBalance", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "approver", + type: "address", + }, + ], + name: "ERC1155InvalidApprover", + type: "error", + }, + { + inputs: [ + { + internalType: "uint256", + name: "idsLength", + type: "uint256", + }, + { + internalType: "uint256", + name: "valuesLength", + type: "uint256", + }, + ], + name: "ERC1155InvalidArrayLength", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address", + }, + ], + name: "ERC1155InvalidOperator", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "receiver", + type: "address", + }, + ], + name: "ERC1155InvalidReceiver", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address", + }, + ], + name: "ERC1155InvalidSender", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address", + }, + { + internalType: "address", + name: "owner", + type: "address", + }, + ], + name: "ERC1155MissingApprovalForAll", + type: "error", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "operator", + type: "address", + }, + { + indexed: false, + internalType: "bool", + name: "approved", + type: "bool", + }, + ], + name: "ApprovalForAll", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "operator", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + { + indexed: false, + internalType: "uint256[]", + name: "ids", + type: "uint256[]", + }, + { + indexed: false, + internalType: "uint256[]", + name: "values", + type: "uint256[]", + }, + ], + name: "TransferBatch", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "operator", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "id", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256", + }, + ], + name: "TransferSingle", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "string", + name: "value", + type: "string", + }, + { + indexed: true, + internalType: "uint256", + name: "id", + type: "uint256", + }, + ], + name: "URI", + type: "event", + }, + { + inputs: [], + name: "TOKEN_SUPPLY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address", + }, + { + internalType: "uint256", + name: "id", + type: "uint256", + }, + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address", + }, + { + internalType: "address", + name: "wearer", + type: "address", + }, + { + internalType: "uint256", + name: "hatId", + type: "uint256", + }, + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address[]", + name: "accounts", + type: "address[]", + }, + { + internalType: "address[]", + name: "wearers", + type: "address[]", + }, + { + internalType: "uint256[]", + name: "hatIds", + type: "uint256[]", + }, + ], + name: "balanceOfBatch", + outputs: [ + { + internalType: "uint256[]", + name: "", + type: "uint256[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address[]", + name: "accounts", + type: "address[]", + }, + { + internalType: "uint256[]", + name: "ids", + type: "uint256[]", + }, + ], + name: "balanceOfBatch", + outputs: [ + { + internalType: "uint256[]", + name: "", + type: "uint256[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address", + }, + { + internalType: "address", + name: "wearer", + type: "address", + }, + { + internalType: "uint256", + name: "hatId", + type: "uint256", + }, + { + internalType: "uint256", + name: "value", + type: "uint256", + }, + ], + name: "burn", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "hatId", + type: "uint256", + }, + { + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "getTokenId", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "pure", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "getTokenRecipients", + outputs: [ + { + internalType: "address[]", + name: "", + type: "address[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address", + }, + { + internalType: "address", + name: "operator", + type: "address", + }, + ], + name: "isApprovedForAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "forwarder", + type: "address", + }, + ], + name: "isTrustedForwarder", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "hatId", + type: "uint256", + }, + { + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "mint", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address", + }, + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256[]", + name: "tokenIds", + type: "uint256[]", + }, + { + internalType: "uint256[]", + name: "amounts", + type: "uint256[]", + }, + { + internalType: "bytes", + name: "data", + type: "bytes", + }, + ], + name: "safeBatchTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address", + }, + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + { + internalType: "bytes", + name: "data", + type: "bytes", + }, + ], + name: "safeTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address", + }, + { + internalType: "bool", + name: "approved", + type: "bool", + }, + ], + name: "setApprovalForAll", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceId", + type: "bytes4", + }, + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "trustedForwarder", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "uri", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "view", + type: "function", + }, ] as const; diff --git a/pkgs/cli/src/abi/hats.ts b/pkgs/cli/src/abi/hats.ts index f7faf1a..37fd1d7 100644 --- a/pkgs/cli/src/abi/hats.ts +++ b/pkgs/cli/src/abi/hats.ts @@ -1,924 +1,924 @@ export const HATS_ABI = [ - { - inputs: [ - { internalType: "string", name: "_name", type: "string" }, - { internalType: "string", name: "_baseImageURI", type: "string" }, - ], - stateMutability: "nonpayable", - type: "constructor", - }, - { - inputs: [{ internalType: "uint256", name: "hatId", type: "uint256" }], - name: "AllHatsWorn", - type: "error", - }, - { - inputs: [ - { internalType: "address", name: "wearer", type: "address" }, - { internalType: "uint256", name: "hatId", type: "uint256" }, - ], - name: "AlreadyWearingHat", - type: "error", - }, - { inputs: [], name: "BatchArrayLengthMismatch", type: "error" }, - { inputs: [], name: "CircularLinkage", type: "error" }, - { inputs: [], name: "CrossTreeLinkage", type: "error" }, - { - inputs: [{ internalType: "uint256", name: "hatId", type: "uint256" }], - name: "HatDoesNotExist", - type: "error", - }, - { inputs: [], name: "HatNotActive", type: "error" }, - { inputs: [], name: "Immutable", type: "error" }, - { inputs: [], name: "InvalidHatId", type: "error" }, - { inputs: [], name: "InvalidUnlink", type: "error" }, - { inputs: [], name: "LinkageNotRequested", type: "error" }, - { inputs: [], name: "MaxLevelsReached", type: "error" }, - { inputs: [], name: "MaxLevelsReached", type: "error" }, - { inputs: [], name: "NewMaxSupplyTooLow", type: "error" }, - { - inputs: [ - { internalType: "address", name: "user", type: "address" }, - { internalType: "uint256", name: "hatId", type: "uint256" }, - ], - name: "NotAdmin", - type: "error", - }, - { inputs: [], name: "NotAdminOrWearer", type: "error" }, - { inputs: [], name: "NotEligible", type: "error" }, - { inputs: [], name: "NotHatWearer", type: "error" }, - { inputs: [], name: "NotHatsEligibility", type: "error" }, - { inputs: [], name: "NotHatsToggle", type: "error" }, - { inputs: [], name: "StringTooLong", type: "error" }, - { inputs: [], name: "ZeroAddress", type: "error" }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "owner", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "operator", - type: "address", - }, - { indexed: false, internalType: "bool", name: "approved", type: "bool" }, - ], - name: "ApprovalForAll", - type: "event", - }, - { - anonymous: false, - inputs: [ - { indexed: false, internalType: "uint256", name: "id", type: "uint256" }, - { - indexed: false, - internalType: "string", - name: "details", - type: "string", - }, - { - indexed: false, - internalType: "uint32", - name: "maxSupply", - type: "uint32", - }, - { - indexed: false, - internalType: "address", - name: "eligibility", - type: "address", - }, - { - indexed: false, - internalType: "address", - name: "toggle", - type: "address", - }, - { indexed: false, internalType: "bool", name: "mutable_", type: "bool" }, - { - indexed: false, - internalType: "string", - name: "imageURI", - type: "string", - }, - ], - name: "HatCreated", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "uint256", - name: "hatId", - type: "uint256", - }, - { - indexed: false, - internalType: "string", - name: "newDetails", - type: "string", - }, - ], - name: "HatDetailsChanged", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "uint256", - name: "hatId", - type: "uint256", - }, - { - indexed: false, - internalType: "address", - name: "newEligibility", - type: "address", - }, - ], - name: "HatEligibilityChanged", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "uint256", - name: "hatId", - type: "uint256", - }, - { - indexed: false, - internalType: "string", - name: "newImageURI", - type: "string", - }, - ], - name: "HatImageURIChanged", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "uint256", - name: "hatId", - type: "uint256", - }, - { - indexed: false, - internalType: "uint32", - name: "newMaxSupply", - type: "uint32", - }, - ], - name: "HatMaxSupplyChanged", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "uint256", - name: "hatId", - type: "uint256", - }, - ], - name: "HatMutabilityChanged", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "uint256", - name: "hatId", - type: "uint256", - }, - { indexed: false, internalType: "bool", name: "newStatus", type: "bool" }, - ], - name: "HatStatusChanged", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "uint256", - name: "hatId", - type: "uint256", - }, - { - indexed: false, - internalType: "address", - name: "newToggle", - type: "address", - }, - ], - name: "HatToggleChanged", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "uint32", - name: "domain", - type: "uint32", - }, - { - indexed: false, - internalType: "uint256", - name: "newAdmin", - type: "uint256", - }, - ], - name: "TopHatLinkRequested", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "uint32", - name: "domain", - type: "uint32", - }, - { - indexed: false, - internalType: "uint256", - name: "newAdmin", - type: "uint256", - }, - ], - name: "TopHatLinked", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "operator", - type: "address", - }, - { indexed: true, internalType: "address", name: "from", type: "address" }, - { indexed: true, internalType: "address", name: "to", type: "address" }, - { - indexed: false, - internalType: "uint256[]", - name: "ids", - type: "uint256[]", - }, - { - indexed: false, - internalType: "uint256[]", - name: "amounts", - type: "uint256[]", - }, - ], - name: "TransferBatch", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "operator", - type: "address", - }, - { indexed: true, internalType: "address", name: "from", type: "address" }, - { indexed: true, internalType: "address", name: "to", type: "address" }, - { indexed: false, internalType: "uint256", name: "id", type: "uint256" }, - { - indexed: false, - internalType: "uint256", - name: "amount", - type: "uint256", - }, - ], - name: "TransferSingle", - type: "event", - }, - { - anonymous: false, - inputs: [ - { indexed: false, internalType: "string", name: "value", type: "string" }, - { indexed: true, internalType: "uint256", name: "id", type: "uint256" }, - ], - name: "URI", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "uint256", - name: "hatId", - type: "uint256", - }, - { - indexed: false, - internalType: "address", - name: "wearer", - type: "address", - }, - { - indexed: false, - internalType: "bool", - name: "wearerStanding", - type: "bool", - }, - ], - name: "WearerStandingChanged", - type: "event", - }, - { - inputs: [ - { internalType: "uint32", name: "_topHatDomain", type: "uint32" }, - { internalType: "uint256", name: "_newAdminHat", type: "uint256" }, - { internalType: "address", name: "_eligibility", type: "address" }, - { internalType: "address", name: "_toggle", type: "address" }, - { internalType: "string", name: "_details", type: "string" }, - { internalType: "string", name: "_imageURI", type: "string" }, - ], - name: "approveLinkTopHatToTree", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "uint256", name: "", type: "uint256" }, - { internalType: "address", name: "", type: "address" }, - ], - name: "badStandings", - outputs: [{ internalType: "bool", name: "", type: "bool" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "_wearer", type: "address" }, - { internalType: "uint256", name: "_hatId", type: "uint256" }, - ], - name: "balanceOf", - outputs: [{ internalType: "uint256", name: "balance", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "address[]", name: "_wearers", type: "address[]" }, - { internalType: "uint256[]", name: "_hatIds", type: "uint256[]" }, - ], - name: "balanceOfBatch", - outputs: [ - { internalType: "uint256[]", name: "balances", type: "uint256[]" }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "baseImageURI", - outputs: [{ internalType: "string", name: "", type: "string" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "uint256[]", name: "_admins", type: "uint256[]" }, - { internalType: "string[]", name: "_details", type: "string[]" }, - { internalType: "uint32[]", name: "_maxSupplies", type: "uint32[]" }, - { - internalType: "address[]", - name: "_eligibilityModules", - type: "address[]", - }, - { internalType: "address[]", name: "_toggleModules", type: "address[]" }, - { internalType: "bool[]", name: "_mutables", type: "bool[]" }, - { internalType: "string[]", name: "_imageURIs", type: "string[]" }, - ], - name: "batchCreateHats", - outputs: [{ internalType: "bool", name: "success", type: "bool" }], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "uint256[]", name: "_hatIds", type: "uint256[]" }, - { internalType: "address[]", name: "_wearers", type: "address[]" }, - ], - name: "batchMintHats", - outputs: [{ internalType: "bool", name: "success", type: "bool" }], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "uint256", name: "_admin", type: "uint256" }, - { internalType: "uint16", name: "_newHat", type: "uint16" }, - ], - name: "buildHatId", - outputs: [{ internalType: "uint256", name: "id", type: "uint256" }], - stateMutability: "pure", - type: "function", - }, - { - inputs: [ - { internalType: "uint256", name: "_hatId", type: "uint256" }, - { internalType: "string", name: "_newDetails", type: "string" }, - ], - name: "changeHatDetails", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "uint256", name: "_hatId", type: "uint256" }, - { internalType: "address", name: "_newEligibility", type: "address" }, - ], - name: "changeHatEligibility", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "uint256", name: "_hatId", type: "uint256" }, - { internalType: "string", name: "_newImageURI", type: "string" }, - ], - name: "changeHatImageURI", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "uint256", name: "_hatId", type: "uint256" }, - { internalType: "uint32", name: "_newMaxSupply", type: "uint32" }, - ], - name: "changeHatMaxSupply", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "uint256", name: "_hatId", type: "uint256" }, - { internalType: "address", name: "_newToggle", type: "address" }, - ], - name: "changeHatToggle", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], - name: "checkHatStatus", - outputs: [{ internalType: "bool", name: "toggled", type: "bool" }], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "uint256", name: "_hatId", type: "uint256" }, - { internalType: "address", name: "_wearer", type: "address" }, - ], - name: "checkHatWearerStatus", - outputs: [{ internalType: "bool", name: "updated", type: "bool" }], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "uint256", name: "_admin", type: "uint256" }, - { internalType: "string", name: "_details", type: "string" }, - { internalType: "uint32", name: "_maxSupply", type: "uint32" }, - { internalType: "address", name: "_eligibility", type: "address" }, - { internalType: "address", name: "_toggle", type: "address" }, - { internalType: "bool", name: "_mutable", type: "bool" }, - { internalType: "string", name: "_imageURI", type: "string" }, - ], - name: "createHat", - outputs: [{ internalType: "uint256", name: "newHatId", type: "uint256" }], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "uint256", name: "_hatId", type: "uint256" }, - { internalType: "uint32", name: "_level", type: "uint32" }, - ], - name: "getAdminAtLevel", - outputs: [{ internalType: "uint256", name: "admin", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "uint256", name: "_hatId", type: "uint256" }, - { internalType: "uint32", name: "_level", type: "uint32" }, - ], - name: "getAdminAtLocalLevel", - outputs: [{ internalType: "uint256", name: "admin", type: "uint256" }], - stateMutability: "pure", - type: "function", - }, - { - inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], - name: "getHatEligibilityModule", - outputs: [ - { internalType: "address", name: "eligibility", type: "address" }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], - name: "getHatLevel", - outputs: [{ internalType: "uint32", name: "level", type: "uint32" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], - name: "getHatMaxSupply", - outputs: [{ internalType: "uint32", name: "maxSupply", type: "uint32" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], - name: "getHatToggleModule", - outputs: [{ internalType: "address", name: "toggle", type: "address" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], - name: "getImageURIForHat", - outputs: [{ internalType: "string", name: "_uri", type: "string" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], - name: "getLocalHatLevel", - outputs: [{ internalType: "uint32", name: "level", type: "uint32" }], - stateMutability: "pure", - type: "function", - }, - { - inputs: [{ internalType: "uint256", name: "_admin", type: "uint256" }], - name: "getNextId", - outputs: [{ internalType: "uint256", name: "nextId", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "uint32", name: "_topHatDomain", type: "uint32" }], - name: "getTippyTopHatDomain", - outputs: [{ internalType: "uint32", name: "domain", type: "uint32" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], - name: "getTopHatDomain", - outputs: [{ internalType: "uint32", name: "domain", type: "uint32" }], - stateMutability: "pure", - type: "function", - }, - { - inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], - name: "hatSupply", - outputs: [{ internalType: "uint32", name: "supply", type: "uint32" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], - name: "isActive", - outputs: [{ internalType: "bool", name: "active", type: "bool" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "_user", type: "address" }, - { internalType: "uint256", name: "_hatId", type: "uint256" }, - ], - name: "isAdminOfHat", - outputs: [{ internalType: "bool", name: "isAdmin", type: "bool" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "", type: "address" }, - { internalType: "address", name: "", type: "address" }, - ], - name: "isApprovedForAll", - outputs: [{ internalType: "bool", name: "", type: "bool" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "_wearer", type: "address" }, - { internalType: "uint256", name: "_hatId", type: "uint256" }, - ], - name: "isEligible", - outputs: [{ internalType: "bool", name: "eligible", type: "bool" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "_wearer", type: "address" }, - { internalType: "uint256", name: "_hatId", type: "uint256" }, - ], - name: "isInGoodStanding", - outputs: [{ internalType: "bool", name: "standing", type: "bool" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], - name: "isLocalTopHat", - outputs: [{ internalType: "bool", name: "_isLocalTopHat", type: "bool" }], - stateMutability: "pure", - type: "function", - }, - { - inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], - name: "isTopHat", - outputs: [{ internalType: "bool", name: "_isTopHat", type: "bool" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], - name: "isValidHatId", - outputs: [{ internalType: "bool", name: "validHatId", type: "bool" }], - stateMutability: "pure", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "_user", type: "address" }, - { internalType: "uint256", name: "_hatId", type: "uint256" }, - ], - name: "isWearerOfHat", - outputs: [{ internalType: "bool", name: "isWearer", type: "bool" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "lastTopHatId", - outputs: [{ internalType: "uint32", name: "", type: "uint32" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "uint32", name: "", type: "uint32" }], - name: "linkedTreeAdmins", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "uint32", name: "", type: "uint32" }], - name: "linkedTreeRequests", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], - name: "makeHatImmutable", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "uint256", name: "_hatId", type: "uint256" }, - { internalType: "address", name: "_wearer", type: "address" }, - ], - name: "mintHat", - outputs: [{ internalType: "bool", name: "success", type: "bool" }], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "_target", type: "address" }, - { internalType: "string", name: "_details", type: "string" }, - { internalType: "string", name: "_imageURI", type: "string" }, - ], - name: "mintTopHat", - outputs: [{ internalType: "uint256", name: "topHatId", type: "uint256" }], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [{ internalType: "bytes[]", name: "data", type: "bytes[]" }], - name: "multicall", - outputs: [{ internalType: "bytes[]", name: "", type: "bytes[]" }], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "name", - outputs: [{ internalType: "string", name: "", type: "string" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "uint32", name: "_topHatDomain", type: "uint32" }, - { internalType: "uint256", name: "_linkedAdmin", type: "uint256" }, - ], - name: "noCircularLinkage", - outputs: [{ internalType: "bool", name: "notCircular", type: "bool" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "uint32", name: "_topHatDomain", type: "uint32" }, - { internalType: "uint256", name: "_newAdminHat", type: "uint256" }, - { internalType: "address", name: "_eligibility", type: "address" }, - { internalType: "address", name: "_toggle", type: "address" }, - { internalType: "string", name: "_details", type: "string" }, - { internalType: "string", name: "_imageURI", type: "string" }, - ], - name: "relinkTopHatWithinTree", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], - name: "renounceHat", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "uint32", name: "_topHatDomain", type: "uint32" }, - { internalType: "uint256", name: "_requestedAdminHat", type: "uint256" }, - ], - name: "requestLinkTopHatToTree", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "", type: "address" }, - { internalType: "address", name: "", type: "address" }, - { internalType: "uint256[]", name: "", type: "uint256[]" }, - { internalType: "uint256[]", name: "", type: "uint256[]" }, - { internalType: "bytes", name: "", type: "bytes" }, - ], - name: "safeBatchTransferFrom", - outputs: [], - stateMutability: "pure", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "", type: "address" }, - { internalType: "address", name: "", type: "address" }, - { internalType: "uint256", name: "", type: "uint256" }, - { internalType: "uint256", name: "", type: "uint256" }, - { internalType: "bytes", name: "", type: "bytes" }, - ], - name: "safeTransferFrom", - outputs: [], - stateMutability: "pure", - type: "function", - }, - { - inputs: [ - { internalType: "uint32", name: "_topHatDomain", type: "uint32" }, - { internalType: "uint256", name: "_newAdminHat", type: "uint256" }, - ], - name: "sameTippyTopHatDomain", - outputs: [{ internalType: "bool", name: "sameDomain", type: "bool" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "", type: "address" }, - { internalType: "bool", name: "", type: "bool" }, - ], - name: "setApprovalForAll", - outputs: [], - stateMutability: "pure", - type: "function", - }, - { - inputs: [ - { internalType: "uint256", name: "_hatId", type: "uint256" }, - { internalType: "bool", name: "_newStatus", type: "bool" }, - ], - name: "setHatStatus", - outputs: [{ internalType: "bool", name: "toggled", type: "bool" }], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "uint256", name: "_hatId", type: "uint256" }, - { internalType: "address", name: "_wearer", type: "address" }, - { internalType: "bool", name: "_eligible", type: "bool" }, - { internalType: "bool", name: "_standing", type: "bool" }, - ], - name: "setHatWearerStatus", - outputs: [{ internalType: "bool", name: "updated", type: "bool" }], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [{ internalType: "bytes4", name: "interfaceId", type: "bytes4" }], - name: "supportsInterface", - outputs: [{ internalType: "bool", name: "", type: "bool" }], - stateMutability: "pure", - type: "function", - }, - { - inputs: [ - { internalType: "uint256", name: "_hatId", type: "uint256" }, - { internalType: "address", name: "_from", type: "address" }, - { internalType: "address", name: "_to", type: "address" }, - ], - name: "transferHat", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "uint32", name: "_topHatDomain", type: "uint32" }, - { internalType: "address", name: "_wearer", type: "address" }, - ], - name: "unlinkTopHatFromTree", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [{ internalType: "uint256", name: "id", type: "uint256" }], - name: "uri", - outputs: [{ internalType: "string", name: "_uri", type: "string" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], - name: "viewHat", - outputs: [ - { internalType: "string", name: "details", type: "string" }, - { internalType: "uint32", name: "maxSupply", type: "uint32" }, - { internalType: "uint32", name: "supply", type: "uint32" }, - { internalType: "address", name: "eligibility", type: "address" }, - { internalType: "address", name: "toggle", type: "address" }, - { internalType: "string", name: "imageURI", type: "string" }, - { internalType: "uint16", name: "lastHatId", type: "uint16" }, - { internalType: "bool", name: "mutable_", type: "bool" }, - { internalType: "bool", name: "active", type: "bool" }, - ], - stateMutability: "view", - type: "function", - }, + { + inputs: [ + { internalType: "string", name: "_name", type: "string" }, + { internalType: "string", name: "_baseImageURI", type: "string" }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [{ internalType: "uint256", name: "hatId", type: "uint256" }], + name: "AllHatsWorn", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "wearer", type: "address" }, + { internalType: "uint256", name: "hatId", type: "uint256" }, + ], + name: "AlreadyWearingHat", + type: "error", + }, + { inputs: [], name: "BatchArrayLengthMismatch", type: "error" }, + { inputs: [], name: "CircularLinkage", type: "error" }, + { inputs: [], name: "CrossTreeLinkage", type: "error" }, + { + inputs: [{ internalType: "uint256", name: "hatId", type: "uint256" }], + name: "HatDoesNotExist", + type: "error", + }, + { inputs: [], name: "HatNotActive", type: "error" }, + { inputs: [], name: "Immutable", type: "error" }, + { inputs: [], name: "InvalidHatId", type: "error" }, + { inputs: [], name: "InvalidUnlink", type: "error" }, + { inputs: [], name: "LinkageNotRequested", type: "error" }, + { inputs: [], name: "MaxLevelsReached", type: "error" }, + { inputs: [], name: "MaxLevelsReached", type: "error" }, + { inputs: [], name: "NewMaxSupplyTooLow", type: "error" }, + { + inputs: [ + { internalType: "address", name: "user", type: "address" }, + { internalType: "uint256", name: "hatId", type: "uint256" }, + ], + name: "NotAdmin", + type: "error", + }, + { inputs: [], name: "NotAdminOrWearer", type: "error" }, + { inputs: [], name: "NotEligible", type: "error" }, + { inputs: [], name: "NotHatWearer", type: "error" }, + { inputs: [], name: "NotHatsEligibility", type: "error" }, + { inputs: [], name: "NotHatsToggle", type: "error" }, + { inputs: [], name: "StringTooLong", type: "error" }, + { inputs: [], name: "ZeroAddress", type: "error" }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "operator", + type: "address", + }, + { indexed: false, internalType: "bool", name: "approved", type: "bool" }, + ], + name: "ApprovalForAll", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "uint256", name: "id", type: "uint256" }, + { + indexed: false, + internalType: "string", + name: "details", + type: "string", + }, + { + indexed: false, + internalType: "uint32", + name: "maxSupply", + type: "uint32", + }, + { + indexed: false, + internalType: "address", + name: "eligibility", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "toggle", + type: "address", + }, + { indexed: false, internalType: "bool", name: "mutable_", type: "bool" }, + { + indexed: false, + internalType: "string", + name: "imageURI", + type: "string", + }, + ], + name: "HatCreated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "hatId", + type: "uint256", + }, + { + indexed: false, + internalType: "string", + name: "newDetails", + type: "string", + }, + ], + name: "HatDetailsChanged", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "hatId", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "newEligibility", + type: "address", + }, + ], + name: "HatEligibilityChanged", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "hatId", + type: "uint256", + }, + { + indexed: false, + internalType: "string", + name: "newImageURI", + type: "string", + }, + ], + name: "HatImageURIChanged", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "hatId", + type: "uint256", + }, + { + indexed: false, + internalType: "uint32", + name: "newMaxSupply", + type: "uint32", + }, + ], + name: "HatMaxSupplyChanged", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "hatId", + type: "uint256", + }, + ], + name: "HatMutabilityChanged", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "hatId", + type: "uint256", + }, + { indexed: false, internalType: "bool", name: "newStatus", type: "bool" }, + ], + name: "HatStatusChanged", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "hatId", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "newToggle", + type: "address", + }, + ], + name: "HatToggleChanged", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint32", + name: "domain", + type: "uint32", + }, + { + indexed: false, + internalType: "uint256", + name: "newAdmin", + type: "uint256", + }, + ], + name: "TopHatLinkRequested", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint32", + name: "domain", + type: "uint32", + }, + { + indexed: false, + internalType: "uint256", + name: "newAdmin", + type: "uint256", + }, + ], + name: "TopHatLinked", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "operator", + type: "address", + }, + { indexed: true, internalType: "address", name: "from", type: "address" }, + { indexed: true, internalType: "address", name: "to", type: "address" }, + { + indexed: false, + internalType: "uint256[]", + name: "ids", + type: "uint256[]", + }, + { + indexed: false, + internalType: "uint256[]", + name: "amounts", + type: "uint256[]", + }, + ], + name: "TransferBatch", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "operator", + type: "address", + }, + { indexed: true, internalType: "address", name: "from", type: "address" }, + { indexed: true, internalType: "address", name: "to", type: "address" }, + { indexed: false, internalType: "uint256", name: "id", type: "uint256" }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "TransferSingle", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "string", name: "value", type: "string" }, + { indexed: true, internalType: "uint256", name: "id", type: "uint256" }, + ], + name: "URI", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "hatId", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "wearer", + type: "address", + }, + { + indexed: false, + internalType: "bool", + name: "wearerStanding", + type: "bool", + }, + ], + name: "WearerStandingChanged", + type: "event", + }, + { + inputs: [ + { internalType: "uint32", name: "_topHatDomain", type: "uint32" }, + { internalType: "uint256", name: "_newAdminHat", type: "uint256" }, + { internalType: "address", name: "_eligibility", type: "address" }, + { internalType: "address", name: "_toggle", type: "address" }, + { internalType: "string", name: "_details", type: "string" }, + { internalType: "string", name: "_imageURI", type: "string" }, + ], + name: "approveLinkTopHatToTree", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "address", name: "", type: "address" }, + ], + name: "badStandings", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_wearer", type: "address" }, + { internalType: "uint256", name: "_hatId", type: "uint256" }, + ], + name: "balanceOf", + outputs: [{ internalType: "uint256", name: "balance", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address[]", name: "_wearers", type: "address[]" }, + { internalType: "uint256[]", name: "_hatIds", type: "uint256[]" }, + ], + name: "balanceOfBatch", + outputs: [ + { internalType: "uint256[]", name: "balances", type: "uint256[]" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "baseImageURI", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "uint256[]", name: "_admins", type: "uint256[]" }, + { internalType: "string[]", name: "_details", type: "string[]" }, + { internalType: "uint32[]", name: "_maxSupplies", type: "uint32[]" }, + { + internalType: "address[]", + name: "_eligibilityModules", + type: "address[]", + }, + { internalType: "address[]", name: "_toggleModules", type: "address[]" }, + { internalType: "bool[]", name: "_mutables", type: "bool[]" }, + { internalType: "string[]", name: "_imageURIs", type: "string[]" }, + ], + name: "batchCreateHats", + outputs: [{ internalType: "bool", name: "success", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256[]", name: "_hatIds", type: "uint256[]" }, + { internalType: "address[]", name: "_wearers", type: "address[]" }, + ], + name: "batchMintHats", + outputs: [{ internalType: "bool", name: "success", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_admin", type: "uint256" }, + { internalType: "uint16", name: "_newHat", type: "uint16" }, + ], + name: "buildHatId", + outputs: [{ internalType: "uint256", name: "id", type: "uint256" }], + stateMutability: "pure", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_hatId", type: "uint256" }, + { internalType: "string", name: "_newDetails", type: "string" }, + ], + name: "changeHatDetails", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_hatId", type: "uint256" }, + { internalType: "address", name: "_newEligibility", type: "address" }, + ], + name: "changeHatEligibility", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_hatId", type: "uint256" }, + { internalType: "string", name: "_newImageURI", type: "string" }, + ], + name: "changeHatImageURI", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_hatId", type: "uint256" }, + { internalType: "uint32", name: "_newMaxSupply", type: "uint32" }, + ], + name: "changeHatMaxSupply", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_hatId", type: "uint256" }, + { internalType: "address", name: "_newToggle", type: "address" }, + ], + name: "changeHatToggle", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], + name: "checkHatStatus", + outputs: [{ internalType: "bool", name: "toggled", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_hatId", type: "uint256" }, + { internalType: "address", name: "_wearer", type: "address" }, + ], + name: "checkHatWearerStatus", + outputs: [{ internalType: "bool", name: "updated", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_admin", type: "uint256" }, + { internalType: "string", name: "_details", type: "string" }, + { internalType: "uint32", name: "_maxSupply", type: "uint32" }, + { internalType: "address", name: "_eligibility", type: "address" }, + { internalType: "address", name: "_toggle", type: "address" }, + { internalType: "bool", name: "_mutable", type: "bool" }, + { internalType: "string", name: "_imageURI", type: "string" }, + ], + name: "createHat", + outputs: [{ internalType: "uint256", name: "newHatId", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_hatId", type: "uint256" }, + { internalType: "uint32", name: "_level", type: "uint32" }, + ], + name: "getAdminAtLevel", + outputs: [{ internalType: "uint256", name: "admin", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_hatId", type: "uint256" }, + { internalType: "uint32", name: "_level", type: "uint32" }, + ], + name: "getAdminAtLocalLevel", + outputs: [{ internalType: "uint256", name: "admin", type: "uint256" }], + stateMutability: "pure", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], + name: "getHatEligibilityModule", + outputs: [ + { internalType: "address", name: "eligibility", type: "address" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], + name: "getHatLevel", + outputs: [{ internalType: "uint32", name: "level", type: "uint32" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], + name: "getHatMaxSupply", + outputs: [{ internalType: "uint32", name: "maxSupply", type: "uint32" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], + name: "getHatToggleModule", + outputs: [{ internalType: "address", name: "toggle", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], + name: "getImageURIForHat", + outputs: [{ internalType: "string", name: "_uri", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], + name: "getLocalHatLevel", + outputs: [{ internalType: "uint32", name: "level", type: "uint32" }], + stateMutability: "pure", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_admin", type: "uint256" }], + name: "getNextId", + outputs: [{ internalType: "uint256", name: "nextId", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint32", name: "_topHatDomain", type: "uint32" }], + name: "getTippyTopHatDomain", + outputs: [{ internalType: "uint32", name: "domain", type: "uint32" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], + name: "getTopHatDomain", + outputs: [{ internalType: "uint32", name: "domain", type: "uint32" }], + stateMutability: "pure", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], + name: "hatSupply", + outputs: [{ internalType: "uint32", name: "supply", type: "uint32" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], + name: "isActive", + outputs: [{ internalType: "bool", name: "active", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_user", type: "address" }, + { internalType: "uint256", name: "_hatId", type: "uint256" }, + ], + name: "isAdminOfHat", + outputs: [{ internalType: "bool", name: "isAdmin", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "", type: "address" }, + { internalType: "address", name: "", type: "address" }, + ], + name: "isApprovedForAll", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_wearer", type: "address" }, + { internalType: "uint256", name: "_hatId", type: "uint256" }, + ], + name: "isEligible", + outputs: [{ internalType: "bool", name: "eligible", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_wearer", type: "address" }, + { internalType: "uint256", name: "_hatId", type: "uint256" }, + ], + name: "isInGoodStanding", + outputs: [{ internalType: "bool", name: "standing", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], + name: "isLocalTopHat", + outputs: [{ internalType: "bool", name: "_isLocalTopHat", type: "bool" }], + stateMutability: "pure", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], + name: "isTopHat", + outputs: [{ internalType: "bool", name: "_isTopHat", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], + name: "isValidHatId", + outputs: [{ internalType: "bool", name: "validHatId", type: "bool" }], + stateMutability: "pure", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_user", type: "address" }, + { internalType: "uint256", name: "_hatId", type: "uint256" }, + ], + name: "isWearerOfHat", + outputs: [{ internalType: "bool", name: "isWearer", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "lastTopHatId", + outputs: [{ internalType: "uint32", name: "", type: "uint32" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint32", name: "", type: "uint32" }], + name: "linkedTreeAdmins", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint32", name: "", type: "uint32" }], + name: "linkedTreeRequests", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], + name: "makeHatImmutable", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_hatId", type: "uint256" }, + { internalType: "address", name: "_wearer", type: "address" }, + ], + name: "mintHat", + outputs: [{ internalType: "bool", name: "success", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_target", type: "address" }, + { internalType: "string", name: "_details", type: "string" }, + { internalType: "string", name: "_imageURI", type: "string" }, + ], + name: "mintTopHat", + outputs: [{ internalType: "uint256", name: "topHatId", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bytes[]", name: "data", type: "bytes[]" }], + name: "multicall", + outputs: [{ internalType: "bytes[]", name: "", type: "bytes[]" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "name", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "uint32", name: "_topHatDomain", type: "uint32" }, + { internalType: "uint256", name: "_linkedAdmin", type: "uint256" }, + ], + name: "noCircularLinkage", + outputs: [{ internalType: "bool", name: "notCircular", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "uint32", name: "_topHatDomain", type: "uint32" }, + { internalType: "uint256", name: "_newAdminHat", type: "uint256" }, + { internalType: "address", name: "_eligibility", type: "address" }, + { internalType: "address", name: "_toggle", type: "address" }, + { internalType: "string", name: "_details", type: "string" }, + { internalType: "string", name: "_imageURI", type: "string" }, + ], + name: "relinkTopHatWithinTree", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], + name: "renounceHat", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint32", name: "_topHatDomain", type: "uint32" }, + { internalType: "uint256", name: "_requestedAdminHat", type: "uint256" }, + ], + name: "requestLinkTopHatToTree", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "", type: "address" }, + { internalType: "address", name: "", type: "address" }, + { internalType: "uint256[]", name: "", type: "uint256[]" }, + { internalType: "uint256[]", name: "", type: "uint256[]" }, + { internalType: "bytes", name: "", type: "bytes" }, + ], + name: "safeBatchTransferFrom", + outputs: [], + stateMutability: "pure", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "", type: "address" }, + { internalType: "address", name: "", type: "address" }, + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "bytes", name: "", type: "bytes" }, + ], + name: "safeTransferFrom", + outputs: [], + stateMutability: "pure", + type: "function", + }, + { + inputs: [ + { internalType: "uint32", name: "_topHatDomain", type: "uint32" }, + { internalType: "uint256", name: "_newAdminHat", type: "uint256" }, + ], + name: "sameTippyTopHatDomain", + outputs: [{ internalType: "bool", name: "sameDomain", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "", type: "address" }, + { internalType: "bool", name: "", type: "bool" }, + ], + name: "setApprovalForAll", + outputs: [], + stateMutability: "pure", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_hatId", type: "uint256" }, + { internalType: "bool", name: "_newStatus", type: "bool" }, + ], + name: "setHatStatus", + outputs: [{ internalType: "bool", name: "toggled", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_hatId", type: "uint256" }, + { internalType: "address", name: "_wearer", type: "address" }, + { internalType: "bool", name: "_eligible", type: "bool" }, + { internalType: "bool", name: "_standing", type: "bool" }, + ], + name: "setHatWearerStatus", + outputs: [{ internalType: "bool", name: "updated", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bytes4", name: "interfaceId", type: "bytes4" }], + name: "supportsInterface", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "pure", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_hatId", type: "uint256" }, + { internalType: "address", name: "_from", type: "address" }, + { internalType: "address", name: "_to", type: "address" }, + ], + name: "transferHat", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint32", name: "_topHatDomain", type: "uint32" }, + { internalType: "address", name: "_wearer", type: "address" }, + ], + name: "unlinkTopHatFromTree", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "id", type: "uint256" }], + name: "uri", + outputs: [{ internalType: "string", name: "_uri", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_hatId", type: "uint256" }], + name: "viewHat", + outputs: [ + { internalType: "string", name: "details", type: "string" }, + { internalType: "uint32", name: "maxSupply", type: "uint32" }, + { internalType: "uint32", name: "supply", type: "uint32" }, + { internalType: "address", name: "eligibility", type: "address" }, + { internalType: "address", name: "toggle", type: "address" }, + { internalType: "string", name: "imageURI", type: "string" }, + { internalType: "uint16", name: "lastHatId", type: "uint16" }, + { internalType: "bool", name: "mutable_", type: "bool" }, + { internalType: "bool", name: "active", type: "bool" }, + ], + stateMutability: "view", + type: "function", + }, ] as const; diff --git a/pkgs/cli/src/abi/hatsTimeFrameModule.ts b/pkgs/cli/src/abi/hatsTimeFrameModule.ts index 4a842b2..ef99157 100644 --- a/pkgs/cli/src/abi/hatsTimeFrameModule.ts +++ b/pkgs/cli/src/abi/hatsTimeFrameModule.ts @@ -1,217 +1,217 @@ export const HATS_TIME_FRAME_MODULE_ABI = [ - { - inputs: [ - { - internalType: "address", - name: "_trustedForwarder", - type: "address", - }, - { - internalType: "string", - name: "_version", - type: "string", - }, - ], - stateMutability: "nonpayable", - type: "constructor", - }, - { - inputs: [], - name: "InvalidInitialization", - type: "error", - }, - { - inputs: [], - name: "NotInitializing", - type: "error", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "uint64", - name: "version", - type: "uint64", - }, - ], - name: "Initialized", - type: "event", - }, - { - inputs: [], - name: "HATS", - outputs: [ - { - internalType: "contract IHats", - name: "", - type: "address", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [], - name: "IMPLEMENTATION", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "wearer", - type: "address", - }, - { - internalType: "uint256", - name: "hatId", - type: "uint256", - }, - ], - name: "getWearingElapsedTime", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "wearer", - type: "address", - }, - { - internalType: "uint256", - name: "hatId", - type: "uint256", - }, - ], - name: "getWoreTime", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "hatId", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "forwarder", - type: "address", - }, - ], - name: "isTrustedForwarder", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "hatId", - type: "uint256", - }, - { - internalType: "address", - name: "wearer", - type: "address", - }, - ], - name: "mintHat", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes", - name: "_initData", - type: "bytes", - }, - ], - name: "setUp", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "trustedForwarder", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "version", - outputs: [ - { - internalType: "string", - name: "", - type: "string", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "version_", - outputs: [ - { - internalType: "string", - name: "", - type: "string", - }, - ], - stateMutability: "view", - type: "function", - }, + { + inputs: [ + { + internalType: "address", + name: "_trustedForwarder", + type: "address", + }, + { + internalType: "string", + name: "_version", + type: "string", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [], + name: "InvalidInitialization", + type: "error", + }, + { + inputs: [], + name: "NotInitializing", + type: "error", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint64", + name: "version", + type: "uint64", + }, + ], + name: "Initialized", + type: "event", + }, + { + inputs: [], + name: "HATS", + outputs: [ + { + internalType: "contract IHats", + name: "", + type: "address", + }, + ], + stateMutability: "pure", + type: "function", + }, + { + inputs: [], + name: "IMPLEMENTATION", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "pure", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "wearer", + type: "address", + }, + { + internalType: "uint256", + name: "hatId", + type: "uint256", + }, + ], + name: "getWearingElapsedTime", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "wearer", + type: "address", + }, + { + internalType: "uint256", + name: "hatId", + type: "uint256", + }, + ], + name: "getWoreTime", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "hatId", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "pure", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "forwarder", + type: "address", + }, + ], + name: "isTrustedForwarder", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "hatId", + type: "uint256", + }, + { + internalType: "address", + name: "wearer", + type: "address", + }, + ], + name: "mintHat", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes", + name: "_initData", + type: "bytes", + }, + ], + name: "setUp", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "trustedForwarder", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "version", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "version_", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "view", + type: "function", + }, ] as const; diff --git a/pkgs/cli/src/abi/splits.ts b/pkgs/cli/src/abi/splits.ts index 30233a0..94fc5f0 100644 --- a/pkgs/cli/src/abi/splits.ts +++ b/pkgs/cli/src/abi/splits.ts @@ -1,108 +1,108 @@ export const SPLITS_ABI = [ - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "address", - name: "split", - type: "address", - }, - ], - name: "SplitsCreated", - type: "event", - }, - { - inputs: [], - name: "FRACTION_TOKEN", - outputs: [ - { - internalType: "contract IFractionToken", - name: "", - type: "address", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [], - name: "HATS_TIME_FRAME_MODULE", - outputs: [ - { - internalType: "contract IHatsTimeFrameModule", - name: "", - type: "address", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [], - name: "SPLIT_FACTORY_V2", - outputs: [ - { - internalType: "contract ISplitFactoryV2", - name: "", - type: "address", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [], - name: "TRUSTED_FORWARDER", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [ - { - components: [ - { - internalType: "uint256", - name: "hatId", - type: "uint256", - }, - { - internalType: "uint256", - name: "multiplierBottom", - type: "uint256", - }, - { - internalType: "uint256", - name: "multiplierTop", - type: "uint256", - }, - { - internalType: "address[]", - name: "wearers", - type: "address[]", - }, - ], - internalType: "struct ISplitsCreator.SplitsInfo[]", - name: "_splitsInfo", - type: "tuple[]", - }, - ], - name: "create", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "nonpayable", - type: "function", - }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "split", + type: "address", + }, + ], + name: "SplitsCreated", + type: "event", + }, + { + inputs: [], + name: "FRACTION_TOKEN", + outputs: [ + { + internalType: "contract IFractionToken", + name: "", + type: "address", + }, + ], + stateMutability: "pure", + type: "function", + }, + { + inputs: [], + name: "HATS_TIME_FRAME_MODULE", + outputs: [ + { + internalType: "contract IHatsTimeFrameModule", + name: "", + type: "address", + }, + ], + stateMutability: "pure", + type: "function", + }, + { + inputs: [], + name: "SPLIT_FACTORY_V2", + outputs: [ + { + internalType: "contract ISplitFactoryV2", + name: "", + type: "address", + }, + ], + stateMutability: "pure", + type: "function", + }, + { + inputs: [], + name: "TRUSTED_FORWARDER", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "pure", + type: "function", + }, + { + inputs: [ + { + components: [ + { + internalType: "uint256", + name: "hatId", + type: "uint256", + }, + { + internalType: "uint256", + name: "multiplierBottom", + type: "uint256", + }, + { + internalType: "uint256", + name: "multiplierTop", + type: "uint256", + }, + { + internalType: "address[]", + name: "wearers", + type: "address[]", + }, + ], + internalType: "struct ISplitsCreator.SplitsInfo[]", + name: "_splitsInfo", + type: "tuple[]", + }, + ], + name: "create", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, ] as const; diff --git a/pkgs/cli/src/commands/bigbang.ts b/pkgs/cli/src/commands/bigbang.ts index 4787f3b..d8c9c40 100644 --- a/pkgs/cli/src/commands/bigbang.ts +++ b/pkgs/cli/src/commands/bigbang.ts @@ -1,35 +1,35 @@ import { Command } from "commander"; -import { bigbang } from "../modules/bigbang"; import { zeroAddress } from "viem"; +import { bigbang } from "../modules/bigbang"; export const bigbangCommands = new Command(); bigbangCommands - .name("bigbang") - .description("This is a CLI bigbang for toban project") - .version("1.0.0"); + .name("bigbang") + .description("This is a CLI bigbang for toban project") + .version("1.0.0"); bigbangCommands - .command("create") - .description("Create project") - .requiredOption("-o, --owner ", "Owner") - .requiredOption("-td, --topHatDetails ", "Top hat details") - .requiredOption("-ti, --topHatImageURI ", "Top hat image URI") - .option("-hd, --hatterHatDetails ", "Hatter hat details") - .option( - "-hi, --hatterHatImageURI ", - "Hatter hat image URI" - ) - .option("-f, --trustedForwarder ", "Trusted forwarder") - .action(async (options) => { - const hash = await bigbang({ - owner: options.owner, - topHatDetails: options.topHatDetails, - topHatImageURI: options.topHatImageURI, - hatterHatDetails: options.hatterHatDetails || "", - hatterHatImageURI: options.hatterHatImageURI || "", - trustedForwarder: options.trustedForwarder || zeroAddress, - }); + .command("create") + .description("Create project") + .requiredOption("-o, --owner ", "Owner") + .requiredOption("-td, --topHatDetails ", "Top hat details") + .requiredOption("-ti, --topHatImageURI ", "Top hat image URI") + .option("-hd, --hatterHatDetails ", "Hatter hat details") + .option( + "-hi, --hatterHatImageURI ", + "Hatter hat image URI", + ) + .option("-f, --trustedForwarder ", "Trusted forwarder") + .action(async (options) => { + const hash = await bigbang({ + owner: options.owner, + topHatDetails: options.topHatDetails, + topHatImageURI: options.topHatImageURI, + hatterHatDetails: options.hatterHatDetails || "", + hatterHatImageURI: options.hatterHatImageURI || "", + trustedForwarder: options.trustedForwarder || zeroAddress, + }); - console.log(`Transaction hash: ${hash}`); - }); + console.log(`Transaction hash: ${hash}`); + }); diff --git a/pkgs/cli/src/commands/fractionToken.ts b/pkgs/cli/src/commands/fractionToken.ts index f947cd5..fe28e8c 100644 --- a/pkgs/cli/src/commands/fractionToken.ts +++ b/pkgs/cli/src/commands/fractionToken.ts @@ -4,36 +4,36 @@ import { mintFractionToken, sendFractionToken } from "../modules/fractiontoken"; export const fractionTokenCommands = new Command(); fractionTokenCommands - .name("fractionToken") - .description("This is a CLI fractionToken for toban project") - .version("1.0.0"); + .name("fractionToken") + .description("This is a CLI fractionToken for toban project") + .version("1.0.0"); fractionTokenCommands - .command("mint") - .description("Mint fraction token") - .requiredOption("-hid, --hatId ", "Hat ID") - .requiredOption("-a, --account ", "Account") - .action(async (options) => { - const transactionHash = await mintFractionToken( - BigInt(options.hatId), - options.account - ); + .command("mint") + .description("Mint fraction token") + .requiredOption("-hid, --hatId ", "Hat ID") + .requiredOption("-a, --account ", "Account") + .action(async (options) => { + const transactionHash = await mintFractionToken( + BigInt(options.hatId), + options.account, + ); - console.log(`Transaction hash: ${transactionHash}`); - }); + console.log(`Transaction hash: ${transactionHash}`); + }); fractionTokenCommands - .command("send") - .description("Send fraction token") - .requiredOption("-t, --to ", "To") - .requiredOption("-hid, --hatId ", "Hat ID") - .requiredOption("-a, --amount ", "Amount") - .action(async (options) => { - const transactionHash = await sendFractionToken( - options.to, - BigInt(options.hatId), - BigInt(options.amount) - ); + .command("send") + .description("Send fraction token") + .requiredOption("-t, --to ", "To") + .requiredOption("-hid, --hatId ", "Hat ID") + .requiredOption("-a, --amount ", "Amount") + .action(async (options) => { + const transactionHash = await sendFractionToken( + options.to, + BigInt(options.hatId), + BigInt(options.amount), + ); - console.log(`Transaction hash: ${transactionHash}`); - }); + console.log(`Transaction hash: ${transactionHash}`); + }); diff --git a/pkgs/cli/src/commands/hats.ts b/pkgs/cli/src/commands/hats.ts index 2acf486..3ac18af 100644 --- a/pkgs/cli/src/commands/hats.ts +++ b/pkgs/cli/src/commands/hats.ts @@ -1,14 +1,14 @@ import { Command } from "commander"; +import type { Address } from "viem"; +import { rootProgram } from ".."; import { - getTreeInfo, - getWearerInfo, - getWearersInfo, - createHat, - mintHat, + createHat, + getTreeInfo, + getWearerInfo, + getWearersInfo, + mintHat, } from "../modules/hatsProtocol"; import { getAccount } from "../services/wallet"; -import { rootProgram } from ".."; -import { Address } from "viem"; export const hatsCommands = new Command(); @@ -17,9 +17,9 @@ export const hatsCommands = new Command(); // ############################################################### hatsCommands - .name("hats") - .description("This is a CLI hats for toban project") - .version("1.0.0"); + .name("hats") + .description("This is a CLI hats for toban project") + .version("1.0.0"); // ############################################################### // command setUp @@ -29,95 +29,95 @@ hatsCommands * ツリーIDに紐づく全てのHatsを表示するコマンド */ hatsCommands - .command("list") - .description("Show all of the Hats that are associated with the tree ID") - .option("-id, --treeId ", "Tree ID") - .action(async (options) => { - const { chain } = rootProgram.opts(); - // ツリー情報を全て取得する。 - const tree = await getTreeInfo(Number(options.treeId), chain); + .command("list") + .description("Show all of the Hats that are associated with the tree ID") + .option("-id, --treeId ", "Tree ID") + .action(async (options) => { + const { chain } = rootProgram.opts(); + // ツリー情報を全て取得する。 + const tree = await getTreeInfo(Number(options.treeId), chain); - console.log(tree); - }); + console.log(tree); + }); /** * HatIdに紐づく着用者の情報を表示するコマンド */ hatsCommands - .command("wears") - .description("Show all of the wears that are associated with the hat ID") - .option("-id, --hatId ", "Hat ID") - .action(async (options) => { - const { chain } = rootProgram.opts(); - // ツリー情報を全て取得する。 - const wearers = await getWearersInfo(options.hatId, chain); + .command("wears") + .description("Show all of the wears that are associated with the hat ID") + .option("-id, --hatId ", "Hat ID") + .action(async (options) => { + const { chain } = rootProgram.opts(); + // ツリー情報を全て取得する。 + const wearers = await getWearersInfo(options.hatId, chain); - console.log(wearers); - }); + console.log(wearers); + }); /** * ウォレットアドレスに紐づくhatの情報を取得するコマンド */ hatsCommands - .command("wear") - .description("Show all of the hat info that are associated with the hat ID") - .option("-addr, --address
", "Wallet Address") - .action(async (options) => { - // 特定のウォレットアドレスに紐づく情報を全て取得する。 - const address = - options.address || getAccount(rootProgram.opts().profile).address; - const wearer = await getWearerInfo(address, rootProgram.opts().chain); + .command("wear") + .description("Show all of the hat info that are associated with the hat ID") + .option("-addr, --address
", "Wallet Address") + .action(async (options) => { + // 特定のウォレットアドレスに紐づく情報を全て取得する。 + const address = + options.address || getAccount(rootProgram.opts().profile).address; + const wearer = await getWearerInfo(address, rootProgram.opts().chain); - console.log(wearer); - }); + console.log(wearer); + }); /** * ロールを作成 */ hatsCommands - .command("createHat") - .description("Create Hat") - .requiredOption("-phid, --parentHatId ", "Parent Hat ID") - .option("-img, --imageURI ", "Image URI") - .option("-det , --details
", "Details") - .option("-max, --maxSupply ", "Max Supply") - .option("-el, --eligibility ", "Eligibility Address") - .option("-tgl, --toggle ", "Toggle") - .option("-mut, --mutable ", "Mutable") - .action( - async ({ - parentHatId, - details, - maxSupply, - eligibility, - toggle, - mutable, - imageURI, - }) => { - const transactionHash = await createHat({ - parentHatId: BigInt(parentHatId), - details, - maxSupply, - eligibility: eligibility as Address, - toggle: toggle as Address, - mutable: mutable == "true", - imageURI, - }); + .command("createHat") + .description("Create Hat") + .requiredOption("-phid, --parentHatId ", "Parent Hat ID") + .option("-img, --imageURI ", "Image URI") + .option("-det , --details
", "Details") + .option("-max, --maxSupply ", "Max Supply") + .option("-el, --eligibility ", "Eligibility Address") + .option("-tgl, --toggle ", "Toggle") + .option("-mut, --mutable ", "Mutable") + .action( + async ({ + parentHatId, + details, + maxSupply, + eligibility, + toggle, + mutable, + imageURI, + }) => { + const transactionHash = await createHat({ + parentHatId: BigInt(parentHatId), + details, + maxSupply, + eligibility: eligibility as Address, + toggle: toggle as Address, + mutable: mutable === "true", + imageURI, + }); - console.log("Transaction hash: ", transactionHash); - } - ); + console.log("Transaction hash: ", transactionHash); + }, + ); /** * ロールを付与 */ hatsCommands - .command("mintHat") - .description("Mint Hat") - .requiredOption("-hid, --hatId ", "Hat ID") - .requiredOption("--wearer ", "Wearer address") - .action(async ({ hatId, wearer }) => { - const transactionHash = await mintHat({ hatId, wearer }); + .command("mintHat") + .description("Mint Hat") + .requiredOption("-hid, --hatId ", "Hat ID") + .requiredOption("--wearer ", "Wearer address") + .action(async ({ hatId, wearer }) => { + const transactionHash = await mintHat({ hatId, wearer }); - console.log("Transaction hash: ", transactionHash); - }); + console.log("Transaction hash: ", transactionHash); + }); diff --git a/pkgs/cli/src/commands/pinata.ts b/pkgs/cli/src/commands/pinata.ts index dccb967..54b5bde 100644 --- a/pkgs/cli/src/commands/pinata.ts +++ b/pkgs/cli/src/commands/pinata.ts @@ -1,9 +1,9 @@ +import fs from "node:fs"; +import path from "node:path"; import { Command } from "commander"; -import { getJwt, setJwt } from "../services/pinata"; import { PinataSDK } from "pinata-web3"; -import path from "path"; -import fs from "fs"; import { startLoading } from "../services/loading"; +import { getJwt, setJwt } from "../services/pinata"; export const pinataCommands = new Command(); @@ -12,129 +12,129 @@ export const pinataCommands = new Command(); // ############################################################### pinataCommands - .name("pinata") - .description("This is a CLI for pinata") - .version("1.0.0"); + .name("pinata") + .description("This is a CLI for pinata") + .version("1.0.0"); /** * PinataのJWTを設定するコマンド */ pinataCommands - .command("setJwt") - .description("Set a jwt of Pinata") - .requiredOption("--jwt ") - .action(({ jwt }) => { - setJwt(jwt); - }); + .command("setJwt") + .description("Set a jwt of Pinata") + .requiredOption("--jwt ") + .action(({ jwt }) => { + setJwt(jwt); + }); /** * Hatのメタデータをipfs上にアップロードするコマンド */ interface Responsibility { - label: string; - description?: string; - link?: string; + label: string; + description?: string; + link?: string; } interface Eligibility { - manual: boolean; - criteria: string[]; + manual: boolean; + criteria: string[]; } interface Toggle { - manual: boolean; - criteria: string[]; + manual: boolean; + criteria: string[]; } pinataCommands - .command("uploadMetadata") - .description("Upload the hat metadata on ipfs.") - .requiredOption("-n, --name ", "Hat Name") - .requiredOption("-d, --description ", "Hat Details") - .option( - "-r, --responsibilities