diff --git a/packages/calimero-sdk/.husky/pre-commit b/packages/calimero-sdk/.husky/pre-commit new file mode 100644 index 000000000..1be495fe7 --- /dev/null +++ b/packages/calimero-sdk/.husky/pre-commit @@ -0,0 +1,5 @@ +pnpm test + +pnpm prettier + +pnpm lint:fix \ No newline at end of file diff --git a/packages/calimero-sdk/package.json b/packages/calimero-sdk/package.json index c7b6a314f..d25359e7c 100644 --- a/packages/calimero-sdk/package.json +++ b/packages/calimero-sdk/package.json @@ -42,6 +42,7 @@ "eslint-plugin-react": "^7.34.1", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.6", + "husky": "^9.0.11", "jest": "^26.0.1", "prettier": "3.3.2", "rimraf": "^3.0.0", @@ -68,7 +69,7 @@ "prefuzz": "pnpm build", "fuzz": "jsfuzz test/fuzz/borsh-roundtrip.js test/fuzz/corpus/", "clean": "pnpm rimraf lib node_modules", - "prepare": "pnpm build", + "prepare": "husky", "bundlewatch": "bundlewatch", "prettier": "exec prettier . --write" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e342f5f99..a9e3d0e4f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -230,6 +230,9 @@ importers: eslint-plugin-react-refresh: specifier: ^0.4.6 version: 0.4.7(eslint@8.57.0) + husky: + specifier: ^9.0.11 + version: 9.0.11 jest: specifier: ^26.0.1 version: 26.6.3(bufferutil@4.0.8)(ts-node@10.9.2(@types/node@18.19.34)(typescript@4.9.5)) @@ -6122,6 +6125,11 @@ packages: resolution: {integrity: sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==} engines: {node: '>=16.17.0'} + husky@9.0.11: + resolution: {integrity: sha512-AB6lFlbwwyIqMdHYhwPe+kjOC3Oc5P3nThEoW/AaO2BX3vJDjWPFxYLxokUZOo6RNX20He3AaT8sESs9NJcmEw==} + engines: {node: '>=18'} + hasBin: true + i18next-browser-languagedetector@7.1.0: resolution: {integrity: sha512-cr2k7u1XJJ4HTOjM9GyOMtbOA47RtUoWRAtt52z43r3AoMs2StYKyjS3URPhzHaf+mn10hY9dZWamga5WPQjhA==} @@ -10268,8 +10276,8 @@ packages: typescript: optional: true - viem@2.13.10: - resolution: {integrity: sha512-fPnbjqlLfWniczYCbnK47MKjyp1/O/b5wMe5ZpflpccD3GUz/f47dLxwLjfSYxXkwS+GERWHWd+2OXb6N/BBQA==} + viem@2.14.0: + resolution: {integrity: sha512-+XnuRNONDRyMNEM+1n6Ak41Py0KBFOmirQ67wPv//ytCmNIJhmy8vqhdFREr3m51GAGgDkllh4JoAdCUUaZJLw==} peerDependencies: typescript: '>=5.0.4' peerDependenciesMeta: @@ -13783,8 +13791,8 @@ snapshots: react-copy-to-clipboard: 5.1.0(react@18.3.1) react-dom: 18.3.1(react@18.3.1) react-jazzicon: 1.0.4(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - viem: 2.13.10(bufferutil@4.0.8)(typescript@5.4.5) - wagmi: 1.4.12(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.6)(@babel/preset-env@7.24.6(@babel/core@7.24.6))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1))(react@18.3.1)(typescript@5.4.5)(viem@2.13.10(bufferutil@4.0.8)(typescript@5.4.5)) + viem: 2.14.0(bufferutil@4.0.8)(typescript@5.4.5) + wagmi: 1.4.12(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.6)(@babel/preset-env@7.24.6(@babel/core@7.24.6))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1))(react@18.3.1)(typescript@5.4.5)(viem@2.14.0(bufferutil@4.0.8)(typescript@5.4.5)) transitivePeerDependencies: - '@azure/app-configuration' - '@azure/cosmos' @@ -13823,8 +13831,8 @@ snapshots: react-copy-to-clipboard: 5.1.0(react@18.3.1) react-dom: 18.3.1(react@18.3.1) react-jazzicon: 1.0.4(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - viem: 2.13.10(bufferutil@4.0.8)(typescript@4.9.5) - wagmi: 1.4.12(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.6)(@babel/preset-env@7.24.6(@babel/core@7.24.6))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1))(react@18.3.1)(typescript@4.9.5)(viem@2.13.10(bufferutil@4.0.8)(typescript@4.9.5)) + viem: 2.14.0(bufferutil@4.0.8)(typescript@4.9.5) + wagmi: 1.4.12(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.6)(@babel/preset-env@7.24.6(@babel/core@7.24.6))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1))(react@18.3.1)(typescript@4.9.5)(viem@2.14.0(bufferutil@4.0.8)(typescript@4.9.5)) transitivePeerDependencies: - '@azure/app-configuration' - '@azure/cosmos' @@ -15540,7 +15548,7 @@ snapshots: transitivePeerDependencies: - supports-color - '@wagmi/connectors@3.1.10(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(typescript@4.9.5)(viem@2.13.10(bufferutil@4.0.8)(typescript@4.9.5))': + '@wagmi/connectors@3.1.10(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(typescript@4.9.5)(viem@2.14.0(bufferutil@4.0.8)(typescript@4.9.5))': dependencies: '@coinbase/wallet-sdk': 3.9.3 '@safe-global/safe-apps-provider': 0.18.2(bufferutil@4.0.8)(typescript@4.9.5) @@ -15551,7 +15559,7 @@ snapshots: '@walletconnect/utils': 2.10.2 abitype: 0.8.7(typescript@4.9.5) eventemitter3: 4.0.7 - viem: 2.13.10(bufferutil@4.0.8)(typescript@4.9.5) + viem: 2.14.0(bufferutil@4.0.8)(typescript@4.9.5) optionalDependencies: typescript: 4.9.5 transitivePeerDependencies: @@ -15577,7 +15585,7 @@ snapshots: - utf-8-validate - zod - '@wagmi/connectors@3.1.10(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(typescript@5.4.5)(viem@2.13.10(bufferutil@4.0.8)(typescript@5.4.5))': + '@wagmi/connectors@3.1.10(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(typescript@5.4.5)(viem@2.14.0(bufferutil@4.0.8)(typescript@5.4.5))': dependencies: '@coinbase/wallet-sdk': 3.9.3 '@safe-global/safe-apps-provider': 0.18.2(bufferutil@4.0.8)(typescript@5.4.5) @@ -15588,7 +15596,7 @@ snapshots: '@walletconnect/utils': 2.10.2 abitype: 0.8.7(typescript@5.4.5) eventemitter3: 4.0.7 - viem: 2.13.10(bufferutil@4.0.8)(typescript@5.4.5) + viem: 2.14.0(bufferutil@4.0.8)(typescript@5.4.5) optionalDependencies: typescript: 5.4.5 transitivePeerDependencies: @@ -15614,12 +15622,12 @@ snapshots: - utf-8-validate - zod - '@wagmi/core@1.4.12(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react@18.3.1)(typescript@4.9.5)(viem@2.13.10(bufferutil@4.0.8)(typescript@4.9.5))': + '@wagmi/core@1.4.12(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react@18.3.1)(typescript@4.9.5)(viem@2.14.0(bufferutil@4.0.8)(typescript@4.9.5))': dependencies: - '@wagmi/connectors': 3.1.10(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(typescript@4.9.5)(viem@2.13.10(bufferutil@4.0.8)(typescript@4.9.5)) + '@wagmi/connectors': 3.1.10(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(typescript@4.9.5)(viem@2.14.0(bufferutil@4.0.8)(typescript@4.9.5)) abitype: 0.8.7(typescript@4.9.5) eventemitter3: 4.0.7 - viem: 2.13.10(bufferutil@4.0.8)(typescript@4.9.5) + viem: 2.14.0(bufferutil@4.0.8)(typescript@4.9.5) zustand: 4.5.2(@types/react@18.3.3)(immer@9.0.21)(react@18.3.1) optionalDependencies: typescript: 4.9.5 @@ -15647,12 +15655,12 @@ snapshots: - utf-8-validate - zod - '@wagmi/core@1.4.12(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react@18.3.1)(typescript@5.4.5)(viem@2.13.10(bufferutil@4.0.8)(typescript@5.4.5))': + '@wagmi/core@1.4.12(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react@18.3.1)(typescript@5.4.5)(viem@2.14.0(bufferutil@4.0.8)(typescript@5.4.5))': dependencies: - '@wagmi/connectors': 3.1.10(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(typescript@5.4.5)(viem@2.13.10(bufferutil@4.0.8)(typescript@5.4.5)) + '@wagmi/connectors': 3.1.10(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(typescript@5.4.5)(viem@2.14.0(bufferutil@4.0.8)(typescript@5.4.5)) abitype: 0.8.7(typescript@5.4.5) eventemitter3: 4.0.7 - viem: 2.13.10(bufferutil@4.0.8)(typescript@5.4.5) + viem: 2.14.0(bufferutil@4.0.8)(typescript@5.4.5) zustand: 4.5.2(@types/react@18.3.3)(immer@9.0.21)(react@18.3.1) optionalDependencies: typescript: 5.4.5 @@ -19664,6 +19672,8 @@ snapshots: human-signals@5.0.0: {} + husky@9.0.11: {} + i18next-browser-languagedetector@7.1.0: dependencies: '@babel/runtime': 7.24.6 @@ -24838,7 +24848,7 @@ snapshots: - utf-8-validate - zod - viem@2.13.10(bufferutil@4.0.8)(typescript@4.9.5): + viem@2.14.0(bufferutil@4.0.8)(typescript@4.9.5): dependencies: '@adraffy/ens-normalize': 1.10.0 '@noble/curves': 1.2.0 @@ -24855,7 +24865,7 @@ snapshots: - utf-8-validate - zod - viem@2.13.10(bufferutil@4.0.8)(typescript@5.4.5): + viem@2.14.0(bufferutil@4.0.8)(typescript@5.4.5): dependencies: '@adraffy/ens-normalize': 1.10.0 '@noble/curves': 1.2.0 @@ -24907,16 +24917,16 @@ snapshots: dependencies: xml-name-validator: 3.0.0 - wagmi@1.4.12(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.6)(@babel/preset-env@7.24.6(@babel/core@7.24.6))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1))(react@18.3.1)(typescript@4.9.5)(viem@2.13.10(bufferutil@4.0.8)(typescript@4.9.5)): + wagmi@1.4.12(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.6)(@babel/preset-env@7.24.6(@babel/core@7.24.6))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1))(react@18.3.1)(typescript@4.9.5)(viem@2.14.0(bufferutil@4.0.8)(typescript@4.9.5)): dependencies: '@tanstack/query-sync-storage-persister': 4.36.1 '@tanstack/react-query': 4.36.1(react-dom@18.3.1(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.6)(@babel/preset-env@7.24.6(@babel/core@7.24.6))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1))(react@18.3.1) '@tanstack/react-query-persist-client': 4.36.1(@tanstack/react-query@4.36.1(react-dom@18.3.1(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.6)(@babel/preset-env@7.24.6(@babel/core@7.24.6))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1))(react@18.3.1)) - '@wagmi/core': 1.4.12(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react@18.3.1)(typescript@4.9.5)(viem@2.13.10(bufferutil@4.0.8)(typescript@4.9.5)) + '@wagmi/core': 1.4.12(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react@18.3.1)(typescript@4.9.5)(viem@2.14.0(bufferutil@4.0.8)(typescript@4.9.5)) abitype: 0.8.7(typescript@4.9.5) react: 18.3.1 use-sync-external-store: 1.2.2(react@18.3.1) - viem: 2.13.10(bufferutil@4.0.8)(typescript@4.9.5) + viem: 2.14.0(bufferutil@4.0.8)(typescript@4.9.5) optionalDependencies: typescript: 4.9.5 transitivePeerDependencies: @@ -24944,16 +24954,16 @@ snapshots: - utf-8-validate - zod - wagmi@1.4.12(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.6)(@babel/preset-env@7.24.6(@babel/core@7.24.6))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1))(react@18.3.1)(typescript@5.4.5)(viem@2.13.10(bufferutil@4.0.8)(typescript@5.4.5)): + wagmi@1.4.12(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.6)(@babel/preset-env@7.24.6(@babel/core@7.24.6))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1))(react@18.3.1)(typescript@5.4.5)(viem@2.14.0(bufferutil@4.0.8)(typescript@5.4.5)): dependencies: '@tanstack/query-sync-storage-persister': 4.36.1 '@tanstack/react-query': 4.36.1(react-dom@18.3.1(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.6)(@babel/preset-env@7.24.6(@babel/core@7.24.6))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1))(react@18.3.1) '@tanstack/react-query-persist-client': 4.36.1(@tanstack/react-query@4.36.1(react-dom@18.3.1(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.6)(@babel/preset-env@7.24.6(@babel/core@7.24.6))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1))(react@18.3.1)) - '@wagmi/core': 1.4.12(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react@18.3.1)(typescript@5.4.5)(viem@2.13.10(bufferutil@4.0.8)(typescript@5.4.5)) + '@wagmi/core': 1.4.12(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react@18.3.1)(typescript@5.4.5)(viem@2.14.0(bufferutil@4.0.8)(typescript@5.4.5)) abitype: 0.8.7(typescript@5.4.5) react: 18.3.1 use-sync-external-store: 1.2.2(react@18.3.1) - viem: 2.13.10(bufferutil@4.0.8)(typescript@5.4.5) + viem: 2.14.0(bufferutil@4.0.8)(typescript@5.4.5) optionalDependencies: typescript: 5.4.5 transitivePeerDependencies: