diff --git a/.changeset/clear-taxis-go.md b/.changeset/clear-taxis-go.md new file mode 100644 index 0000000..3cbc689 --- /dev/null +++ b/.changeset/clear-taxis-go.md @@ -0,0 +1,5 @@ +--- +"@macalinao/zod-solana": patch +--- + +Add BPS schema diff --git a/.changeset/fluffy-dingos-count.md b/.changeset/fluffy-dingos-count.md new file mode 100644 index 0000000..5ca2065 --- /dev/null +++ b/.changeset/fluffy-dingos-count.md @@ -0,0 +1,7 @@ +--- +"@macalinao/token-utils": patch +"@macalinao/zod-solana": patch +"@macalinao/quarry": patch +--- + +Eslint 9.38 force diff --git a/bun.lock b/bun.lock index a0a2399..19246d4 100644 --- a/bun.lock +++ b/bun.lock @@ -166,6 +166,7 @@ "@macalinao/tsconfig": "catalog:", "@solana/kit": "catalog:", "@types/bun": "catalog:", + "eslint": "catalog:", "typescript": "catalog:", }, "peerDependencies": { @@ -224,6 +225,7 @@ "@macalinao/tsconfig": "catalog:", "@solana/kit": "catalog:", "@types/bun": "catalog:", + "eslint": "catalog:", "typescript": "catalog:", }, "peerDependencies": { @@ -293,7 +295,7 @@ "@types/bun": "^1.3.0", "@types/react": "^19.2.2", "@types/react-dom": "^19.2.2", - "eslint": "^9.38.0", + "eslint": "=9.38.0", "gill": "^0.12", "react": "^19.2.0", "react-dom": "^19.2.0", @@ -2987,10 +2989,24 @@ "@keystonehq/sol-keyring/bs58": ["bs58@5.0.0", "", { "dependencies": { "base-x": "^4.0.0" } }, "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ=="], + "@macalinao/dataloader-es/eslint": ["eslint@9.38.0", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", "@eslint/config-array": "^0.21.1", "@eslint/config-helpers": "^0.4.1", "@eslint/core": "^0.16.0", "@eslint/eslintrc": "^3.3.1", "@eslint/js": "9.38.0", "@eslint/plugin-kit": "^0.4.0", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^8.4.0", "eslint-visitor-keys": "^4.2.1", "espree": "^10.4.0", "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-t5aPOpmtJcZcz5UJyY2GbvpDlsK5E8JqRqoKtfiKE3cNh437KIqfJr3A3AKf5k64NPx6d0G3dno6XDY05PqPtw=="], + "@macalinao/eslint-config/@eslint/js": ["@eslint/js@9.38.0", "", {}, "sha512-UZ1VpFvXf9J06YG9xQBdnzU+kthors6KjhMAl6f4gH4usHyh31rUf2DLGInT8RFYIReYXNSydgPY0V2LuWgl7A=="], "@macalinao/eslint-config-react/eslint-plugin-react-hooks": ["eslint-plugin-react-hooks@7.0.1", "", { "dependencies": { "@babel/core": "^7.24.4", "@babel/parser": "^7.24.4", "hermes-parser": "^0.25.1", "zod": "^3.25.0 || ^4.0.0", "zod-validation-error": "^3.5.0 || ^4.0.0" }, "peerDependencies": { "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0" } }, "sha512-O0d0m04evaNzEPoSW+59Mezf8Qt0InfgGIBJnpC0h3NH/WjUAR7BIKUfysC6todmtiZ/A0oUVS8Gce0WhBrHsA=="], + "@macalinao/gill-extra/eslint": ["eslint@9.38.0", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", "@eslint/config-array": "^0.21.1", "@eslint/config-helpers": "^0.4.1", "@eslint/core": "^0.16.0", "@eslint/eslintrc": "^3.3.1", "@eslint/js": "9.38.0", "@eslint/plugin-kit": "^0.4.0", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^8.4.0", "eslint-visitor-keys": "^4.2.1", "espree": "^10.4.0", "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-t5aPOpmtJcZcz5UJyY2GbvpDlsK5E8JqRqoKtfiKE3cNh437KIqfJr3A3AKf5k64NPx6d0G3dno6XDY05PqPtw=="], + + "@macalinao/quarry/eslint": ["eslint@9.38.0", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", "@eslint/config-array": "^0.21.1", "@eslint/config-helpers": "^0.4.1", "@eslint/core": "^0.16.0", "@eslint/eslintrc": "^3.3.1", "@eslint/js": "9.38.0", "@eslint/plugin-kit": "^0.4.0", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^8.4.0", "eslint-visitor-keys": "^4.2.1", "espree": "^10.4.0", "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-t5aPOpmtJcZcz5UJyY2GbvpDlsK5E8JqRqoKtfiKE3cNh437KIqfJr3A3AKf5k64NPx6d0G3dno6XDY05PqPtw=="], + + "@macalinao/solana-batch-accounts-loader/eslint": ["eslint@9.38.0", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", "@eslint/config-array": "^0.21.1", "@eslint/config-helpers": "^0.4.1", "@eslint/core": "^0.16.0", "@eslint/eslintrc": "^3.3.1", "@eslint/js": "9.38.0", "@eslint/plugin-kit": "^0.4.0", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^8.4.0", "eslint-visitor-keys": "^4.2.1", "espree": "^10.4.0", "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-t5aPOpmtJcZcz5UJyY2GbvpDlsK5E8JqRqoKtfiKE3cNh437KIqfJr3A3AKf5k64NPx6d0G3dno6XDY05PqPtw=="], + + "@macalinao/token-utils/eslint": ["eslint@9.38.0", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", "@eslint/config-array": "^0.21.1", "@eslint/config-helpers": "^0.4.1", "@eslint/core": "^0.16.0", "@eslint/eslintrc": "^3.3.1", "@eslint/js": "9.38.0", "@eslint/plugin-kit": "^0.4.0", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^8.4.0", "eslint-visitor-keys": "^4.2.1", "espree": "^10.4.0", "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-t5aPOpmtJcZcz5UJyY2GbvpDlsK5E8JqRqoKtfiKE3cNh437KIqfJr3A3AKf5k64NPx6d0G3dno6XDY05PqPtw=="], + + "@macalinao/wallet-adapter-compat/eslint": ["eslint@9.38.0", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", "@eslint/config-array": "^0.21.1", "@eslint/config-helpers": "^0.4.1", "@eslint/core": "^0.16.0", "@eslint/eslintrc": "^3.3.1", "@eslint/js": "9.38.0", "@eslint/plugin-kit": "^0.4.0", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^8.4.0", "eslint-visitor-keys": "^4.2.1", "espree": "^10.4.0", "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-t5aPOpmtJcZcz5UJyY2GbvpDlsK5E8JqRqoKtfiKE3cNh437KIqfJr3A3AKf5k64NPx6d0G3dno6XDY05PqPtw=="], + + "@macalinao/zod-solana/eslint": ["eslint@9.38.0", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", "@eslint/config-array": "^0.21.1", "@eslint/config-helpers": "^0.4.1", "@eslint/core": "^0.16.0", "@eslint/eslintrc": "^3.3.1", "@eslint/js": "9.38.0", "@eslint/plugin-kit": "^0.4.0", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^8.4.0", "eslint-visitor-keys": "^4.2.1", "espree": "^10.4.0", "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-t5aPOpmtJcZcz5UJyY2GbvpDlsK5E8JqRqoKtfiKE3cNh437KIqfJr3A3AKf5k64NPx6d0G3dno6XDY05PqPtw=="], + "@manypkg/find-root/@types/node": ["@types/node@12.20.55", "", {}, "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ=="], "@manypkg/find-root/find-up": ["find-up@4.1.0", "", { "dependencies": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" } }, "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw=="], @@ -3213,6 +3229,8 @@ "ethereum-cryptography/@scure/bip39": ["@scure/bip39@1.3.0", "", { "dependencies": { "@noble/hashes": "~1.4.0", "@scure/base": "~1.1.6" } }, "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ=="], + "example-dapp/eslint": ["eslint@9.38.0", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", "@eslint/config-array": "^0.21.1", "@eslint/config-helpers": "^0.4.1", "@eslint/core": "^0.16.0", "@eslint/eslintrc": "^3.3.1", "@eslint/js": "9.38.0", "@eslint/plugin-kit": "^0.4.0", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^8.4.0", "eslint-visitor-keys": "^4.2.1", "espree": "^10.4.0", "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-t5aPOpmtJcZcz5UJyY2GbvpDlsK5E8JqRqoKtfiKE3cNh437KIqfJr3A3AKf5k64NPx6d0G3dno6XDY05PqPtw=="], + "fast-glob/glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="], "finalhandler/debug": ["debug@2.6.9", "", { "dependencies": { "ms": "2.0.0" } }, "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA=="], @@ -3383,6 +3401,34 @@ "@keystonehq/sol-keyring/bs58/base-x": ["base-x@4.0.1", "", {}, "sha512-uAZ8x6r6S3aUM9rbHGVOIsR15U/ZSc82b3ymnCPsT45Gk1DDvhDPdIgB5MrhirZWt+5K0EEPQH985kNqZgNPFw=="], + "@macalinao/dataloader-es/eslint/@eslint/core": ["@eslint/core@0.16.0", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-nmC8/totwobIiFcGkDza3GIKfAw1+hLiYVrh3I1nIomQ8PEr5cxg34jnkmGawul/ep52wGRAcyeDCNtWKSOj4Q=="], + + "@macalinao/dataloader-es/eslint/@eslint/js": ["@eslint/js@9.38.0", "", {}, "sha512-UZ1VpFvXf9J06YG9xQBdnzU+kthors6KjhMAl6f4gH4usHyh31rUf2DLGInT8RFYIReYXNSydgPY0V2LuWgl7A=="], + + "@macalinao/gill-extra/eslint/@eslint/core": ["@eslint/core@0.16.0", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-nmC8/totwobIiFcGkDza3GIKfAw1+hLiYVrh3I1nIomQ8PEr5cxg34jnkmGawul/ep52wGRAcyeDCNtWKSOj4Q=="], + + "@macalinao/gill-extra/eslint/@eslint/js": ["@eslint/js@9.38.0", "", {}, "sha512-UZ1VpFvXf9J06YG9xQBdnzU+kthors6KjhMAl6f4gH4usHyh31rUf2DLGInT8RFYIReYXNSydgPY0V2LuWgl7A=="], + + "@macalinao/quarry/eslint/@eslint/core": ["@eslint/core@0.16.0", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-nmC8/totwobIiFcGkDza3GIKfAw1+hLiYVrh3I1nIomQ8PEr5cxg34jnkmGawul/ep52wGRAcyeDCNtWKSOj4Q=="], + + "@macalinao/quarry/eslint/@eslint/js": ["@eslint/js@9.38.0", "", {}, "sha512-UZ1VpFvXf9J06YG9xQBdnzU+kthors6KjhMAl6f4gH4usHyh31rUf2DLGInT8RFYIReYXNSydgPY0V2LuWgl7A=="], + + "@macalinao/solana-batch-accounts-loader/eslint/@eslint/core": ["@eslint/core@0.16.0", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-nmC8/totwobIiFcGkDza3GIKfAw1+hLiYVrh3I1nIomQ8PEr5cxg34jnkmGawul/ep52wGRAcyeDCNtWKSOj4Q=="], + + "@macalinao/solana-batch-accounts-loader/eslint/@eslint/js": ["@eslint/js@9.38.0", "", {}, "sha512-UZ1VpFvXf9J06YG9xQBdnzU+kthors6KjhMAl6f4gH4usHyh31rUf2DLGInT8RFYIReYXNSydgPY0V2LuWgl7A=="], + + "@macalinao/token-utils/eslint/@eslint/core": ["@eslint/core@0.16.0", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-nmC8/totwobIiFcGkDza3GIKfAw1+hLiYVrh3I1nIomQ8PEr5cxg34jnkmGawul/ep52wGRAcyeDCNtWKSOj4Q=="], + + "@macalinao/token-utils/eslint/@eslint/js": ["@eslint/js@9.38.0", "", {}, "sha512-UZ1VpFvXf9J06YG9xQBdnzU+kthors6KjhMAl6f4gH4usHyh31rUf2DLGInT8RFYIReYXNSydgPY0V2LuWgl7A=="], + + "@macalinao/wallet-adapter-compat/eslint/@eslint/core": ["@eslint/core@0.16.0", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-nmC8/totwobIiFcGkDza3GIKfAw1+hLiYVrh3I1nIomQ8PEr5cxg34jnkmGawul/ep52wGRAcyeDCNtWKSOj4Q=="], + + "@macalinao/wallet-adapter-compat/eslint/@eslint/js": ["@eslint/js@9.38.0", "", {}, "sha512-UZ1VpFvXf9J06YG9xQBdnzU+kthors6KjhMAl6f4gH4usHyh31rUf2DLGInT8RFYIReYXNSydgPY0V2LuWgl7A=="], + + "@macalinao/zod-solana/eslint/@eslint/core": ["@eslint/core@0.16.0", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-nmC8/totwobIiFcGkDza3GIKfAw1+hLiYVrh3I1nIomQ8PEr5cxg34jnkmGawul/ep52wGRAcyeDCNtWKSOj4Q=="], + + "@macalinao/zod-solana/eslint/@eslint/js": ["@eslint/js@9.38.0", "", {}, "sha512-UZ1VpFvXf9J06YG9xQBdnzU+kthors6KjhMAl6f4gH4usHyh31rUf2DLGInT8RFYIReYXNSydgPY0V2LuWgl7A=="], + "@manypkg/find-root/find-up/locate-path": ["locate-path@5.0.0", "", { "dependencies": { "p-locate": "^4.1.0" } }, "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g=="], "@react-native/codegen/hermes-parser/hermes-estree": ["hermes-estree@0.32.0", "", {}, "sha512-KWn3BqnlDOl97Xe1Yviur6NbgIZ+IP+UVSpshlZWkq+EtoHg6/cwiDj/osP9PCEgFE15KBm1O55JRwbMEm5ejQ=="], @@ -3639,6 +3685,10 @@ "ethereum-cryptography/@scure/bip39/@scure/base": ["@scure/base@1.1.9", "", {}, "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg=="], + "example-dapp/eslint/@eslint/core": ["@eslint/core@0.16.0", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-nmC8/totwobIiFcGkDza3GIKfAw1+hLiYVrh3I1nIomQ8PEr5cxg34jnkmGawul/ep52wGRAcyeDCNtWKSOj4Q=="], + + "example-dapp/eslint/@eslint/js": ["@eslint/js@9.38.0", "", {}, "sha512-UZ1VpFvXf9J06YG9xQBdnzU+kthors6KjhMAl6f4gH4usHyh31rUf2DLGInT8RFYIReYXNSydgPY0V2LuWgl7A=="], + "finalhandler/debug/ms": ["ms@2.0.0", "", {}, "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="], "gill/@solana-program/token-2022/@solana/sysvars": ["@solana/sysvars@2.3.0", "", { "dependencies": { "@solana/accounts": "2.3.0", "@solana/codecs": "2.3.0", "@solana/errors": "2.3.0", "@solana/rpc-types": "2.3.0" }, "peerDependencies": { "typescript": ">=5.3.3" } }, "sha512-LvjADZrpZ+CnhlHqfI5cmsRzX9Rpyb1Ox2dMHnbsRNzeKAMhu9w4ZBIaeTdO322zsTr509G1B+k2ABD3whvUBA=="], diff --git a/package.json b/package.json index 64e0282..a02e701 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "apps/*" ], "catalog": { - "eslint": "^9.38.0", + "eslint": "=9.38.0", "typescript": "^5.9.3", "@macalinao/eslint-config": "^7.0.1", "@macalinao/eslint-config-react": "^6.0.2", diff --git a/packages/quarry/package.json b/packages/quarry/package.json index 9b7f116..4b56931 100644 --- a/packages/quarry/package.json +++ b/packages/quarry/package.json @@ -69,7 +69,8 @@ "@macalinao/tsconfig": "catalog:", "@solana/kit": "catalog:", "@types/bun": "catalog:", - "typescript": "catalog:" + "typescript": "catalog:", + "eslint": "catalog:" }, "peerDependencies": { "@solana/kit": "catalog:" diff --git a/packages/token-utils/package.json b/packages/token-utils/package.json index ad68ad6..966e0ca 100644 --- a/packages/token-utils/package.json +++ b/packages/token-utils/package.json @@ -51,7 +51,8 @@ "@macalinao/tsconfig": "catalog:", "@solana/kit": "catalog:", "@types/bun": "catalog:", - "typescript": "catalog:" + "typescript": "catalog:", + "eslint": "catalog:" }, "peerDependencies": { "@solana/kit": "catalog:" diff --git a/packages/zod-solana/src/bps-schema.test.ts b/packages/zod-solana/src/bps-schema.test.ts new file mode 100644 index 0000000..267be80 --- /dev/null +++ b/packages/zod-solana/src/bps-schema.test.ts @@ -0,0 +1,247 @@ +import { describe, expect, it } from "bun:test"; +import { bpsSchema } from "./bps-schema.js"; + +describe("bpsSchema", () => { + describe("valid values", () => { + it("should accept 0 (0%)", () => { + const result = bpsSchema.safeParse(0); + expect(result.success).toBe(true); + if (result.success) { + expect(result.data).toBe(0); + } + }); + + it("should accept 1 (0.01%)", () => { + const result = bpsSchema.safeParse(1); + expect(result.success).toBe(true); + if (result.success) { + expect(result.data).toBe(1); + } + }); + + it("should accept 50 (0.5%)", () => { + const result = bpsSchema.safeParse(50); + expect(result.success).toBe(true); + if (result.success) { + expect(result.data).toBe(50); + } + }); + + it("should accept 100 (1%)", () => { + const result = bpsSchema.safeParse(100); + expect(result.success).toBe(true); + if (result.success) { + expect(result.data).toBe(100); + } + }); + + it("should accept 500 (5%)", () => { + const result = bpsSchema.safeParse(500); + expect(result.success).toBe(true); + if (result.success) { + expect(result.data).toBe(500); + } + }); + + it("should accept 1000 (10%)", () => { + const result = bpsSchema.safeParse(1000); + expect(result.success).toBe(true); + if (result.success) { + expect(result.data).toBe(1000); + } + }); + + it("should accept 5000 (50%)", () => { + const result = bpsSchema.safeParse(5000); + expect(result.success).toBe(true); + if (result.success) { + expect(result.data).toBe(5000); + } + }); + + it("should accept 10000 (100%)", () => { + const result = bpsSchema.safeParse(10000); + expect(result.success).toBe(true); + if (result.success) { + expect(result.data).toBe(10000); + } + }); + + it("should accept various valid values", () => { + const validValues = [10, 25, 75, 150, 300, 750, 2500, 7500, 9999]; + for (const value of validValues) { + const result = bpsSchema.safeParse(value); + expect(result.success).toBe(true); + if (result.success) { + expect(result.data).toBe(value); + } + } + }); + }); + + describe("invalid values", () => { + it("should reject -1", () => { + const result = bpsSchema.safeParse(-1); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0]?.message).toContain(">=0"); + } + }); + + it("should reject -100", () => { + const result = bpsSchema.safeParse(-100); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0]?.message).toContain(">=0"); + } + }); + + it("should reject 10001 (max + 1)", () => { + const result = bpsSchema.safeParse(10001); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0]?.message).toContain("<=10000"); + } + }); + + it("should reject 50000", () => { + const result = bpsSchema.safeParse(50000); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0]?.message).toContain("<=10000"); + } + }); + + it("should reject 0.5 (non-integer)", () => { + const result = bpsSchema.safeParse(0.5); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0]?.message).toContain("expected int"); + } + }); + + it("should reject 100.5 (non-integer)", () => { + const result = bpsSchema.safeParse(100.5); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0]?.message).toContain("expected int"); + } + }); + + it("should reject 9999.99 (non-integer)", () => { + const result = bpsSchema.safeParse(9999.99); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0]?.message).toContain("expected int"); + } + }); + + it("should reject NaN", () => { + const result = bpsSchema.safeParse(Number.NaN); + expect(result.success).toBe(false); + }); + + it("should reject Infinity", () => { + const result = bpsSchema.safeParse(Number.POSITIVE_INFINITY); + expect(result.success).toBe(false); + }); + + it("should reject -Infinity", () => { + const result = bpsSchema.safeParse(Number.NEGATIVE_INFINITY); + expect(result.success).toBe(false); + }); + + it("should reject string values", () => { + const result = bpsSchema.safeParse("500"); + expect(result.success).toBe(false); + }); + + it("should reject null", () => { + const result = bpsSchema.safeParse(null); + expect(result.success).toBe(false); + }); + + it("should reject undefined", () => { + const result = bpsSchema.safeParse(undefined); + expect(result.success).toBe(false); + }); + + it("should reject objects", () => { + const result = bpsSchema.safeParse({ value: 500 }); + expect(result.success).toBe(false); + }); + + it("should reject arrays", () => { + const result = bpsSchema.safeParse([500]); + expect(result.success).toBe(false); + }); + + it("should reject boolean values", () => { + const result = bpsSchema.safeParse(true); + expect(result.success).toBe(false); + }); + }); + + describe("edge cases", () => { + it("should handle type coercion correctly", () => { + const result = bpsSchema.safeParse(10000.0); + expect(result.success).toBe(true); + if (result.success) { + expect(result.data).toBe(10000); + } + }); + + it("should reject very small negative decimals", () => { + const result = bpsSchema.safeParse(-0.1); + expect(result.success).toBe(false); + }); + + it("should reject very large numbers", () => { + const result = bpsSchema.safeParse(Number.MAX_SAFE_INTEGER); + expect(result.success).toBe(false); + }); + + it("should handle scientific notation within range", () => { + const result = bpsSchema.safeParse(1e4); // 10000 + expect(result.success).toBe(true); + if (result.success) { + expect(result.data).toBe(10000); + } + }); + + it("should reject scientific notation out of range", () => { + const result = bpsSchema.safeParse(1e5); // 100000 + expect(result.success).toBe(false); + }); + }); + + describe("basis points specific tests", () => { + it("should accept common percentage values in basis points", () => { + const commonPercentages = [ + { bps: 1, percentage: "0.01%" }, + { bps: 25, percentage: "0.25%" }, + { bps: 50, percentage: "0.5%" }, + { bps: 100, percentage: "1%" }, + { bps: 250, percentage: "2.5%" }, + { bps: 500, percentage: "5%" }, + { bps: 1000, percentage: "10%" }, + { bps: 2500, percentage: "25%" }, + { bps: 5000, percentage: "50%" }, + { bps: 7500, percentage: "75%" }, + { bps: 10000, percentage: "100%" }, + ]; + + for (const { bps } of commonPercentages) { + const result = bpsSchema.safeParse(bps); + expect(result.success).toBe(true); + if (result.success) { + expect(result.data).toBe(bps); + } + } + }); + + it("should have correct description", () => { + expect(bpsSchema.description).toBe("Basis points (0-10000)"); + }); + }); +}); diff --git a/packages/zod-solana/src/bps-schema.ts b/packages/zod-solana/src/bps-schema.ts new file mode 100644 index 0000000..646930a --- /dev/null +++ b/packages/zod-solana/src/bps-schema.ts @@ -0,0 +1,11 @@ +import * as z from "zod"; + +/** + * Zod schema for basis points (0-10000) + */ +export const bpsSchema: z.ZodNumber = z + .number() + .int() + .min(0) + .max(10000) + .describe("Basis points (0-10000)"); diff --git a/packages/zod-solana/src/index.ts b/packages/zod-solana/src/index.ts index d406034..e0af9d0 100644 --- a/packages/zod-solana/src/index.ts +++ b/packages/zod-solana/src/index.ts @@ -1,4 +1,5 @@ export { addressSchema } from "./address-schema.js"; +export { bpsSchema } from "./bps-schema.js"; export { U8_MAX, U16_MAX, U32_MAX, U64_MAX } from "./constants.js"; export { type TokenMetadata,