From 12b80526d5594a9ec9b6d0a74ad9b81300bc74e0 Mon Sep 17 00:00:00 2001 From: Sayan kar Date: Tue, 21 Oct 2025 14:50:22 +0530 Subject: [PATCH 1/8] chore: adding rollup build, bundle esm only deps together with build --- client/.gitignore | 3 +- client/package-lock.json | 728 +++++++++++++++++++++++++++++++++------ client/package.json | 97 ++++-- client/rollup.config.js | 193 +++++++++++ 4 files changed, 900 insertions(+), 121 deletions(-) create mode 100644 client/rollup.config.js diff --git a/client/.gitignore b/client/.gitignore index 5014ec80..cf64cb4e 100644 --- a/client/.gitignore +++ b/client/.gitignore @@ -12,4 +12,5 @@ dist/_types /.tshy-* /__tests__ .DS_Store -/docs/typedoc \ No newline at end of file +/docs/typedoc +.rollup.cache \ No newline at end of file diff --git a/client/package-lock.json b/client/package-lock.json index 7bf32997..8c714696 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -15,6 +15,10 @@ "viem": "^2.33.3" }, "devDependencies": { + "@rollup/plugin-commonjs": "^28.0.8", + "@rollup/plugin-node-resolve": "^16.0.3", + "@rollup/plugin-terser": "^0.4.4", + "@rollup/plugin-typescript": "^12.1.4", "@types/node": "^22.15.17", "assert": "^2.1.0", "browserify-zlib": "^0.2.0", @@ -23,6 +27,7 @@ "crypto-browserify": "^3.12.0", "domain-browser": "^4.19.0", "events": "^3.3.0", + "glob": "^11.0.3", "https-browserify": "^1.0.0", "msw": "^2.10.4", "os-browserify": "^0.3.0", @@ -30,11 +35,13 @@ "process": "^0.11.10", "punycode": "^2.3.1", "querystring-es3": "^0.2.1", + "rollup": "^4.52.5", "stream-browserify": "^3.0.0", "stream-http": "^3.2.0", "string_decoder": "^1.3.0", "timers-browserify": "^2.0.12", "ts-loader": "^9.5.1", + "tslib": "^2.8.1", "tty-browserify": "^0.0.1", "typedoc": "^0.28.9", "typedoc-github-theme": "^0.3.0", @@ -641,6 +648,132 @@ } } }, + "node_modules/@isaacs/balanced-match": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz", + "integrity": "sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@isaacs/brace-expansion": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.0.tgz", + "integrity": "sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@isaacs/balanced-match": "^4.0.1" + }, + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-regex": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", + "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", + "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.12", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.12.tgz", @@ -782,10 +915,149 @@ "dev": true, "license": "MIT" }, + "node_modules/@rollup/plugin-commonjs": { + "version": "28.0.8", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-28.0.8.tgz", + "integrity": "sha512-o1Ug9PxYsF61R7/NXO/GgMZZproLd/WH2XA53Tp9ppf6bU1lMlTtC/gUM6zM3mesi2E0rypk+PNtVrELREyWEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rollup/pluginutils": "^5.0.1", + "commondir": "^1.0.1", + "estree-walker": "^2.0.2", + "fdir": "^6.2.0", + "is-reference": "1.2.1", + "magic-string": "^0.30.3", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=16.0.0 || 14 >= 14.17" + }, + "peerDependencies": { + "rollup": "^2.68.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-commonjs/node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@rollup/plugin-node-resolve": { + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-16.0.3.tgz", + "integrity": "sha512-lUYM3UBGuM93CnMPG1YocWu7X802BrNF3jW2zny5gQyLQgRFJhV1Sq0Zi74+dh/6NBx1DxFC4b4GXg9wUCG5Qg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rollup/pluginutils": "^5.0.1", + "@types/resolve": "1.20.2", + "deepmerge": "^4.2.2", + "is-module": "^1.0.0", + "resolve": "^1.22.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^2.78.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-terser": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/@rollup/plugin-terser/-/plugin-terser-0.4.4.tgz", + "integrity": "sha512-XHeJC5Bgvs8LfukDwWZp7yeqin6ns8RTl2B9avbejt6tZqsqvVoWI7ZTQrcNsfKEDWBTnTxM8nMDkO2IFFbd0A==", + "dev": true, + "license": "MIT", + "dependencies": { + "serialize-javascript": "^6.0.1", + "smob": "^1.0.0", + "terser": "^5.17.4" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-typescript": { + "version": "12.1.4", + "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-12.1.4.tgz", + "integrity": "sha512-s5Hx+EtN60LMlDBvl5f04bEiFZmAepk27Q+mr85L/00zPDn1jtzlTV6FWn81MaIwqfWzKxmOJrBWHU6vtQyedQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rollup/pluginutils": "^5.1.0", + "resolve": "^1.22.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^2.14.0||^3.0.0||^4.0.0", + "tslib": "*", + "typescript": ">=3.7.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + }, + "tslib": { + "optional": true + } + } + }, + "node_modules/@rollup/pluginutils": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.3.0.tgz", + "integrity": "sha512-5EdhGZtnu3V88ces7s53hhfK5KSASnJZv8Lulpc04cWO3REESroJXg73DFsOmgbU2BhwV0E20bu2IDZb3VKW4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "estree-walker": "^2.0.2", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/pluginutils/node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true, + "license": "MIT" + }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.40.2.tgz", - "integrity": "sha512-JkdNEq+DFxZfUwxvB58tHMHBHVgX23ew41g1OQinthJ+ryhdRk67O31S7sYw8u2lTjHUPFxwar07BBt1KHp/hg==", + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.52.5.tgz", + "integrity": "sha512-8c1vW4ocv3UOMp9K+gToY5zL2XiiVw3k7f1ksf4yO1FlDFQ1C2u72iACFnSOceJFsWskc2WZNqeRhFRPzv+wtQ==", "cpu": [ "arm" ], @@ -797,9 +1069,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.40.2.tgz", - "integrity": "sha512-13unNoZ8NzUmnndhPTkWPWbX3vtHodYmy+I9kuLxN+F+l+x3LdVF7UCu8TWVMt1POHLh6oDHhnOA04n8oJZhBw==", + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.52.5.tgz", + "integrity": "sha512-mQGfsIEFcu21mvqkEKKu2dYmtuSZOBMmAl5CFlPGLY94Vlcm+zWApK7F/eocsNzp8tKmbeBP8yXyAbx0XHsFNA==", "cpu": [ "arm64" ], @@ -811,9 +1083,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.40.2.tgz", - "integrity": "sha512-Gzf1Hn2Aoe8VZzevHostPX23U7N5+4D36WJNHK88NZHCJr7aVMG4fadqkIf72eqVPGjGc0HJHNuUaUcxiR+N/w==", + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.52.5.tgz", + "integrity": "sha512-takF3CR71mCAGA+v794QUZ0b6ZSrgJkArC+gUiG6LB6TQty9T0Mqh3m2ImRBOxS2IeYBo4lKWIieSvnEk2OQWA==", "cpu": [ "arm64" ], @@ -825,9 +1097,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.40.2.tgz", - "integrity": "sha512-47N4hxa01a4x6XnJoskMKTS8XZ0CZMd8YTbINbi+w03A2w4j1RTlnGHOz/P0+Bg1LaVL6ufZyNprSg+fW5nYQQ==", + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.52.5.tgz", + "integrity": "sha512-W901Pla8Ya95WpxDn//VF9K9u2JbocwV/v75TE0YIHNTbhqUTv9w4VuQ9MaWlNOkkEfFwkdNhXgcLqPSmHy0fA==", "cpu": [ "x64" ], @@ -839,9 +1111,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.40.2.tgz", - "integrity": "sha512-8t6aL4MD+rXSHHZUR1z19+9OFJ2rl1wGKvckN47XFRVO+QL/dUSpKA2SLRo4vMg7ELA8pzGpC+W9OEd1Z/ZqoQ==", + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.52.5.tgz", + "integrity": "sha512-QofO7i7JycsYOWxe0GFqhLmF6l1TqBswJMvICnRUjqCx8b47MTo46W8AoeQwiokAx3zVryVnxtBMcGcnX12LvA==", "cpu": [ "arm64" ], @@ -853,9 +1125,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.40.2.tgz", - "integrity": "sha512-C+AyHBzfpsOEYRFjztcYUFsH4S7UsE9cDtHCtma5BK8+ydOZYgMmWg1d/4KBytQspJCld8ZIujFMAdKG1xyr4Q==", + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.52.5.tgz", + "integrity": "sha512-jr21b/99ew8ujZubPo9skbrItHEIE50WdV86cdSoRkKtmWa+DDr6fu2c/xyRT0F/WazZpam6kk7IHBerSL7LDQ==", "cpu": [ "x64" ], @@ -867,9 +1139,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.40.2.tgz", - "integrity": "sha512-de6TFZYIvJwRNjmW3+gaXiZ2DaWL5D5yGmSYzkdzjBDS3W+B9JQ48oZEsmMvemqjtAFzE16DIBLqd6IQQRuG9Q==", + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.52.5.tgz", + "integrity": "sha512-PsNAbcyv9CcecAUagQefwX8fQn9LQ4nZkpDboBOttmyffnInRy8R8dSg6hxxl2Re5QhHBf6FYIDhIj5v982ATQ==", "cpu": [ "arm" ], @@ -881,9 +1153,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.40.2.tgz", - "integrity": "sha512-urjaEZubdIkacKc930hUDOfQPysezKla/O9qV+O89enqsqUmQm8Xj8O/vh0gHg4LYfv7Y7UsE3QjzLQzDYN1qg==", + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.52.5.tgz", + "integrity": "sha512-Fw4tysRutyQc/wwkmcyoqFtJhh0u31K+Q6jYjeicsGJJ7bbEq8LwPWV/w0cnzOqR2m694/Af6hpFayLJZkG2VQ==", "cpu": [ "arm" ], @@ -895,9 +1167,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.40.2.tgz", - "integrity": "sha512-KlE8IC0HFOC33taNt1zR8qNlBYHj31qGT1UqWqtvR/+NuCVhfufAq9fxO8BMFC22Wu0rxOwGVWxtCMvZVLmhQg==", + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.52.5.tgz", + "integrity": "sha512-a+3wVnAYdQClOTlyapKmyI6BLPAFYs0JM8HRpgYZQO02rMR09ZcV9LbQB+NL6sljzG38869YqThrRnfPMCDtZg==", "cpu": [ "arm64" ], @@ -909,9 +1181,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.40.2.tgz", - "integrity": "sha512-j8CgxvfM0kbnhu4XgjnCWJQyyBOeBI1Zq91Z850aUddUmPeQvuAy6OiMdPS46gNFgy8gN1xkYyLgwLYZG3rBOg==", + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.52.5.tgz", + "integrity": "sha512-AvttBOMwO9Pcuuf7m9PkC1PUIKsfaAJ4AYhy944qeTJgQOqJYJ9oVl2nYgY7Rk0mkbsuOpCAYSs6wLYB2Xiw0Q==", "cpu": [ "arm64" ], @@ -922,10 +1194,10 @@ "linux" ] }, - "node_modules/@rollup/rollup-linux-loongarch64-gnu": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.40.2.tgz", - "integrity": "sha512-Ybc/1qUampKuRF4tQXc7G7QY9YRyeVSykfK36Y5Qc5dmrIxwFhrOzqaVTNoZygqZ1ZieSWTibfFhQ5qK8jpWxw==", + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.52.5.tgz", + "integrity": "sha512-DkDk8pmXQV2wVrF6oq5tONK6UHLz/XcEVow4JTTerdeV1uqPeHxwcg7aFsfnSm9L+OO8WJsWotKM2JJPMWrQtA==", "cpu": [ "loong64" ], @@ -936,10 +1208,10 @@ "linux" ] }, - "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.40.2.tgz", - "integrity": "sha512-3FCIrnrt03CCsZqSYAOW/k9n625pjpuMzVfeI+ZBUSDT3MVIFDSPfSUgIl9FqUftxcUXInvFah79hE1c9abD+Q==", + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.52.5.tgz", + "integrity": "sha512-W/b9ZN/U9+hPQVvlGwjzi+Wy4xdoH2I8EjaCkMvzpI7wJUs8sWJ03Rq96jRnHkSrcHTpQe8h5Tg3ZzUPGauvAw==", "cpu": [ "ppc64" ], @@ -951,9 +1223,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.40.2.tgz", - "integrity": "sha512-QNU7BFHEvHMp2ESSY3SozIkBPaPBDTsfVNGx3Xhv+TdvWXFGOSH2NJvhD1zKAT6AyuuErJgbdvaJhYVhVqrWTg==", + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.52.5.tgz", + "integrity": "sha512-sjQLr9BW7R/ZiXnQiWPkErNfLMkkWIoCz7YMn27HldKsADEKa5WYdobaa1hmN6slu9oWQbB6/jFpJ+P2IkVrmw==", "cpu": [ "riscv64" ], @@ -965,9 +1237,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.40.2.tgz", - "integrity": "sha512-5W6vNYkhgfh7URiXTO1E9a0cy4fSgfE4+Hl5agb/U1sa0kjOLMLC1wObxwKxecE17j0URxuTrYZZME4/VH57Hg==", + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.52.5.tgz", + "integrity": "sha512-hq3jU/kGyjXWTvAh2awn8oHroCbrPm8JqM7RUpKjalIRWWXE01CQOf/tUNWNHjmbMHg/hmNCwc/Pz3k1T/j/Lg==", "cpu": [ "riscv64" ], @@ -979,9 +1251,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.40.2.tgz", - "integrity": "sha512-B7LKIz+0+p348JoAL4X/YxGx9zOx3sR+o6Hj15Y3aaApNfAshK8+mWZEf759DXfRLeL2vg5LYJBB7DdcleYCoQ==", + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.52.5.tgz", + "integrity": "sha512-gn8kHOrku8D4NGHMK1Y7NA7INQTRdVOntt1OCYypZPRt6skGbddska44K8iocdpxHTMMNui5oH4elPH4QOLrFQ==", "cpu": [ "s390x" ], @@ -993,9 +1265,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.40.2.tgz", - "integrity": "sha512-lG7Xa+BmBNwpjmVUbmyKxdQJ3Q6whHjMjzQplOs5Z+Gj7mxPtWakGHqzMqNER68G67kmCX9qX57aRsW5V0VOng==", + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.52.5.tgz", + "integrity": "sha512-hXGLYpdhiNElzN770+H2nlx+jRog8TyynpTVzdlc6bndktjKWyZyiCsuDAlpd+j+W+WNqfcyAWz9HxxIGfZm1Q==", "cpu": [ "x64" ], @@ -1007,9 +1279,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.40.2.tgz", - "integrity": "sha512-tD46wKHd+KJvsmije4bUskNuvWKFcTOIM9tZ/RrmIvcXnbi0YK/cKS9FzFtAm7Oxi2EhV5N2OpfFB348vSQRXA==", + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.52.5.tgz", + "integrity": "sha512-arCGIcuNKjBoKAXD+y7XomR9gY6Mw7HnFBv5Rw7wQRvwYLR7gBAgV7Mb2QTyjXfTveBNFAtPt46/36vV9STLNg==", "cpu": [ "x64" ], @@ -1020,10 +1292,24 @@ "linux" ] }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.52.5.tgz", + "integrity": "sha512-QoFqB6+/9Rly/RiPjaomPLmR/13cgkIGfA40LHly9zcH1S0bN2HVFYk3a1eAyHQyjs3ZJYlXvIGtcCs5tko9Cw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.40.2.tgz", - "integrity": "sha512-Bjv/HG8RRWLNkXwQQemdsWw4Mg+IJ29LK+bJPW2SCzPKOUaMmPEppQlu/Fqk1d7+DX3V7JbFdbkh/NMmurT6Pg==", + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.52.5.tgz", + "integrity": "sha512-w0cDWVR6MlTstla1cIfOGyl8+qb93FlAVutcor14Gf5Md5ap5ySfQ7R9S/NjNaMLSFdUnKGEasmVnu3lCMqB7w==", "cpu": [ "arm64" ], @@ -1035,9 +1321,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.40.2.tgz", - "integrity": "sha512-dt1llVSGEsGKvzeIO76HToiYPNPYPkmjhMHhP00T9S4rDern8P2ZWvWAQUEJ+R1UdMWJ/42i/QqJ2WV765GZcA==", + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.52.5.tgz", + "integrity": "sha512-Aufdpzp7DpOTULJCuvzqcItSGDH73pF3ko/f+ckJhxQyHtp67rHw3HMNxoIdDMUITJESNE6a8uh4Lo4SLouOUg==", "cpu": [ "ia32" ], @@ -1048,10 +1334,24 @@ "win32" ] }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.52.5.tgz", + "integrity": "sha512-UGBUGPFp1vkj6p8wCRraqNhqwX/4kNQPS57BCFc8wYh0g94iVIW33wJtQAx3G7vrjjNtRaxiMUylM0ktp/TRSQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.40.2.tgz", - "integrity": "sha512-bwspbWB04XJpeElvsp+DCylKfF4trJDa2Y9Go8O6A7YLX2LIKGcNK/CYImJN6ZP4DcuOHB4Utl3iCbnR62DudA==", + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.52.5.tgz", + "integrity": "sha512-TAcgQh2sSkykPRWLrdyy2AiceMckNf5loITqXxFI5VuQjS5tSuw3WlwdN8qv8vzjLAUTvYaH/mVjSFpbkFbpTg==", "cpu": [ "x64" ], @@ -1234,9 +1534,9 @@ } }, "node_modules/@types/estree": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz", - "integrity": "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", "dev": true, "license": "MIT" }, @@ -1263,10 +1563,18 @@ "integrity": "sha512-v1DKRfUdyW+jJhZNEI1PYy29S2YRxMV5AOO/x/SjKmW0acCIOqmbj6Haf9eHAhsPmrhlHSxEhv/1WszcLWV4cg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "undici-types": "~6.21.0" } }, + "node_modules/@types/resolve": { + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.20.2.tgz", + "integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/statuses": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/statuses/-/statuses-2.0.6.tgz", @@ -1650,6 +1958,7 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -1676,6 +1985,7 @@ "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -2010,6 +2320,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "caniuse-lite": "^1.0.30001726", "electron-to-chromium": "^1.5.173", @@ -2307,6 +2618,13 @@ "dev": true, "license": "MIT" }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", + "dev": true, + "license": "MIT" + }, "node_modules/constants-browserify": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", @@ -2448,6 +2766,16 @@ "node": ">=6" } }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/define-data-property": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", @@ -2540,6 +2868,13 @@ "node": ">= 0.4" } }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true, + "license": "MIT" + }, "node_modules/electron-to-chromium": { "version": "1.5.192", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.192.tgz", @@ -2900,6 +3235,23 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/foreground-child": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", + "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", + "dev": true, + "license": "ISC", + "dependencies": { + "cross-spawn": "^7.0.6", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", @@ -2971,6 +3323,30 @@ "node": ">= 0.4" } }, + "node_modules/glob": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.3.tgz", + "integrity": "sha512-2Nim7dha1KVkaiF4q6Dj+ngPPMdfvLJEOpZk/jKiUAkqKebpGAWQXAq9z1xu9HKu5lWfqw/FASuccEjyznjPaA==", + "dev": true, + "license": "ISC", + "dependencies": { + "foreground-child": "^3.3.1", + "jackspeak": "^4.1.1", + "minimatch": "^10.0.3", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^2.0.0" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/glob-to-regexp": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", @@ -2978,6 +3354,22 @@ "dev": true, "license": "BSD-2-Clause" }, + "node_modules/glob/node_modules/minimatch": { + "version": "10.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.3.tgz", + "integrity": "sha512-IPZ167aShDZZUMdRk66cyQAW3qr0WzbHkPdMYa8bzZhlHhO3jALbKdxcaak7W9FfT2rZNpQuUu4Od7ILEpXSaw==", + "dev": true, + "license": "ISC", + "dependencies": { + "@isaacs/brace-expansion": "^5.0.0" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/gopd": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", @@ -3248,6 +3640,13 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==", + "dev": true, + "license": "MIT" + }, "node_modules/is-nan": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz", @@ -3295,6 +3694,16 @@ "node": ">=0.10.0" } }, + "node_modules/is-reference": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", + "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "*" + } + }, "node_modules/is-regex": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", @@ -3367,6 +3776,22 @@ "ws": "*" } }, + "node_modules/jackspeak": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.1.1.tgz", + "integrity": "sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/jest-worker": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", @@ -3462,6 +3887,16 @@ "dev": true, "license": "MIT" }, + "node_modules/lru-cache": { + "version": "11.2.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.2.tgz", + "integrity": "sha512-F9ODfyqML2coTIsQpSkRHnLSZMtkU8Q+mSfcaIyKwy58u+8k5nvAYeiNhsyMARvzNcXJ9QfWVrcPsC9e9rAxtg==", + "dev": true, + "license": "ISC", + "engines": { + "node": "20 || >=22" + } + }, "node_modules/lunr": { "version": "2.3.9", "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", @@ -3658,6 +4093,16 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -3672,6 +4117,7 @@ "dev": true, "hasInstallScript": true, "license": "MIT", + "peer": true, "dependencies": { "@bundled-es-modules/cookie": "^2.0.1", "@bundled-es-modules/statuses": "^1.0.1", @@ -3924,6 +4370,13 @@ "node": ">=6" } }, + "node_modules/package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", + "dev": true, + "license": "BlueOak-1.0.0" + }, "node_modules/pako": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", @@ -3983,6 +4436,23 @@ "dev": true, "license": "MIT" }, + "node_modules/path-scurry": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz", + "integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^11.0.0", + "minipass": "^7.1.2" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/path-to-regexp": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", @@ -4384,13 +4854,14 @@ } }, "node_modules/rollup": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.40.2.tgz", - "integrity": "sha512-tfUOg6DTP4rhQ3VjOO6B4wyrJnGOX85requAXvqYTHsOgb2TFJdZ3aWpT8W2kPoypSGP7dZUyzxJ9ee4buM5Fg==", + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.52.5.tgz", + "integrity": "sha512-3GuObel8h7Kqdjt0gxkEzaifHTqLVW56Y/bjN7PSQtkKr0w3V/QYSdt6QWYtd7A1xUtYQigtdUfgj1RvWVtorw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { - "@types/estree": "1.0.7" + "@types/estree": "1.0.8" }, "bin": { "rollup": "dist/bin/rollup" @@ -4400,26 +4871,28 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.40.2", - "@rollup/rollup-android-arm64": "4.40.2", - "@rollup/rollup-darwin-arm64": "4.40.2", - "@rollup/rollup-darwin-x64": "4.40.2", - "@rollup/rollup-freebsd-arm64": "4.40.2", - "@rollup/rollup-freebsd-x64": "4.40.2", - "@rollup/rollup-linux-arm-gnueabihf": "4.40.2", - "@rollup/rollup-linux-arm-musleabihf": "4.40.2", - "@rollup/rollup-linux-arm64-gnu": "4.40.2", - "@rollup/rollup-linux-arm64-musl": "4.40.2", - "@rollup/rollup-linux-loongarch64-gnu": "4.40.2", - "@rollup/rollup-linux-powerpc64le-gnu": "4.40.2", - "@rollup/rollup-linux-riscv64-gnu": "4.40.2", - "@rollup/rollup-linux-riscv64-musl": "4.40.2", - "@rollup/rollup-linux-s390x-gnu": "4.40.2", - "@rollup/rollup-linux-x64-gnu": "4.40.2", - "@rollup/rollup-linux-x64-musl": "4.40.2", - "@rollup/rollup-win32-arm64-msvc": "4.40.2", - "@rollup/rollup-win32-ia32-msvc": "4.40.2", - "@rollup/rollup-win32-x64-msvc": "4.40.2", + "@rollup/rollup-android-arm-eabi": "4.52.5", + "@rollup/rollup-android-arm64": "4.52.5", + "@rollup/rollup-darwin-arm64": "4.52.5", + "@rollup/rollup-darwin-x64": "4.52.5", + "@rollup/rollup-freebsd-arm64": "4.52.5", + "@rollup/rollup-freebsd-x64": "4.52.5", + "@rollup/rollup-linux-arm-gnueabihf": "4.52.5", + "@rollup/rollup-linux-arm-musleabihf": "4.52.5", + "@rollup/rollup-linux-arm64-gnu": "4.52.5", + "@rollup/rollup-linux-arm64-musl": "4.52.5", + "@rollup/rollup-linux-loong64-gnu": "4.52.5", + "@rollup/rollup-linux-ppc64-gnu": "4.52.5", + "@rollup/rollup-linux-riscv64-gnu": "4.52.5", + "@rollup/rollup-linux-riscv64-musl": "4.52.5", + "@rollup/rollup-linux-s390x-gnu": "4.52.5", + "@rollup/rollup-linux-x64-gnu": "4.52.5", + "@rollup/rollup-linux-x64-musl": "4.52.5", + "@rollup/rollup-openharmony-arm64": "4.52.5", + "@rollup/rollup-win32-arm64-msvc": "4.52.5", + "@rollup/rollup-win32-ia32-msvc": "4.52.5", + "@rollup/rollup-win32-x64-gnu": "4.52.5", + "@rollup/rollup-win32-x64-msvc": "4.52.5", "fsevents": "~2.3.2" } }, @@ -4681,6 +5154,13 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/smob": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/smob/-/smob-1.5.0.tgz", + "integrity": "sha512-g6T+p7QO8npa+/hNx9ohv1E5pVCmWrVCUzUXJyLdMmftX6ER0oiWY/w9knEonLpnOp6b6FenKnMfR8gqwWdwig==", + "dev": true, + "license": "MIT" + }, "node_modules/source-map": { "version": "0.7.6", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.6.tgz", @@ -4832,6 +5312,22 @@ "node": ">=8" } }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -4845,6 +5341,20 @@ "node": ">=8" } }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -5081,6 +5591,14 @@ "webpack": "^5.0.0" } }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true, + "license": "0BSD", + "peer": true + }, "node_modules/tty-browserify": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", @@ -5122,6 +5640,7 @@ "integrity": "sha512-aw45vwtwOl3QkUAmWCnLV9QW1xY+FSX2zzlit4MAfE99wX+Jij4ycnpbAWgBXsRrxmfs9LaYktg/eX5Bpthd3g==", "dev": true, "license": "Apache-2.0", + "peer": true, "dependencies": { "@gerrit0/mini-shiki": "^3.9.0", "lunr": "^2.3.9", @@ -5159,6 +5678,7 @@ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "devOptional": true, "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -5337,6 +5857,7 @@ "integrity": "sha512-0msEVHJEScQbhkbVTb/4iHZdJ6SXp/AvxL2sjwYQFfBqleHtnCqv1J3sa9zbWz/6kW1m9Tfzn92vW+kZ1WV6QA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.4.4", @@ -5527,6 +6048,7 @@ "integrity": "sha512-B4t+nJqytPeuZlHuIKTbalhljIFXeNRqrUGAQgTGlfOl2lXXKXw+yZu6bicycP+PUlM44CxBjCFD6aciKFT3LQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@types/eslint-scope": "^3.7.7", "@types/estree": "^1.0.8", @@ -5576,6 +6098,7 @@ "integrity": "sha512-pIDJHIEI9LR0yxHXQ+Qh95k2EvXpWzZ5l+d+jIo+RdSm9MiHfzazIxwwni/p7+x4eJZuvG1AJwgC4TNQ7NRgsg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@discoveryjs/json-ext": "^0.5.0", "@webpack-cli/configtest": "^2.1.1", @@ -5651,13 +6174,6 @@ "node": ">=10.13.0" } }, - "node_modules/webpack/node_modules/@types/estree": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", - "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", - "dev": true, - "license": "MIT" - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -5734,11 +6250,31 @@ "node": ">=8" } }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/ws": { "version": "8.18.3", "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz", "integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==", "license": "MIT", + "peer": true, "engines": { "node": ">=10.0.0" }, diff --git a/client/package.json b/client/package.json index 5f1fcd44..6573336b 100644 --- a/client/package.json +++ b/client/package.json @@ -4,8 +4,8 @@ "update-version": "node scripts/update-version.js", "clean": "rm -rf dist src/_cjs src/_esm src/_types .tsbuildinfo", "build:all": "npm run clean && npm run build:cjs && npm run build:esm && npm run build:types && npm run build:webpack", - "build:cjs": "tsc --project ./tsconfig.cjs.json --noEmitOnError false && printf '{\"type\":\"commonjs\"}' > ./dist/_cjs/package.json", - "build:esm": "tsc --project ./tsconfig.esm.json --noEmitOnError false && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./dist/_esm/package.json", + "build:cjs": "BUILD_FORMAT=cjs rollup --config rollup.config.js && printf '{\"type\":\"commonjs\"}' > ./dist/_cjs/package.json", + "build:esm": "BUILD_FORMAT=esm rollup --config rollup.config.js && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./dist/_esm/package.json", "build:types": "npx tsc --project ./tsconfig.esm.json --declarationDir ./dist/_types --emitDeclarationOnly --declaration --declarationMap", "build:webpack": "npx webpack --config webpack.config.cjs", "generate-docs": "typedoc", @@ -51,6 +51,10 @@ "viem": "^2.33.3" }, "devDependencies": { + "@rollup/plugin-commonjs": "^28.0.8", + "@rollup/plugin-node-resolve": "^16.0.3", + "@rollup/plugin-terser": "^0.4.4", + "@rollup/plugin-typescript": "^12.1.4", "@types/node": "^22.15.17", "assert": "^2.1.0", "browserify-zlib": "^0.2.0", @@ -59,6 +63,7 @@ "crypto-browserify": "^3.12.0", "domain-browser": "^4.19.0", "events": "^3.3.0", + "glob": "^11.0.3", "https-browserify": "^1.0.0", "msw": "^2.10.4", "os-browserify": "^0.3.0", @@ -66,11 +71,13 @@ "process": "^0.11.10", "punycode": "^2.3.1", "querystring-es3": "^0.2.1", + "rollup": "^4.52.5", "stream-browserify": "^3.0.0", "stream-http": "^3.2.0", "string_decoder": "^1.3.0", "timers-browserify": "^2.0.12", "ts-loader": "^9.5.1", + "tslib": "^2.8.1", "tty-browserify": "^0.0.1", "typedoc": "^0.28.9", "typedoc-github-theme": "^0.3.0", @@ -204,27 +211,69 @@ }, "typesVersions": { "*": { - "utils": ["./dist/_types/utils/index.d.ts"], - "accounts": ["./dist/_types/accounts/index.d.ts"], - "chains": ["./dist/_types/chains/index.d.ts"], - "methods": ["./dist/_types/methods/index.d.ts"], - "methods/wallet": ["./dist/_types/methods/wallet/index.d.ts"], - "methods/wallet/cChain": ["./dist/_types/methods/wallet/cChain/index.d.ts"], - "methods/wallet/pChain": ["./dist/_types/methods/wallet/pChain/index.d.ts"], - "methods/wallet/xChain": ["./dist/_types/methods/wallet/xChain/index.d.ts"], - "methods/public": ["./dist/_types/methods/public/index.d.ts"], - "methods/pChain": ["./dist/_types/methods/pChain/index.d.ts"], - "methods/admin": ["./dist/_types/methods/admin/index.d.ts"], - "methods/cChain": ["./dist/_types/methods/cChain/index.d.ts"], - "methods/xChain": ["./dist/_types/methods/xChain/index.d.ts"], - "methods/health": ["./dist/_types/methods/health/index.d.ts"], - "methods/index": ["./dist/_types/methods/index/index.d.ts"], - "methods/info": ["./dist/_types/methods/info/index.d.ts"], - "node": ["./dist/_types/node/index.d.ts"], - "nonce": ["./dist/_types/nonce/index.d.ts"], - "serializable": ["./dist/_types/serializable/index.d.ts"], - "siwe": ["./dist/_types/siwe/index.d.ts"], - "window": ["./dist/_types/window/index.d.ts"] + "utils": [ + "./dist/_types/utils/index.d.ts" + ], + "accounts": [ + "./dist/_types/accounts/index.d.ts" + ], + "chains": [ + "./dist/_types/chains/index.d.ts" + ], + "methods": [ + "./dist/_types/methods/index.d.ts" + ], + "methods/wallet": [ + "./dist/_types/methods/wallet/index.d.ts" + ], + "methods/wallet/cChain": [ + "./dist/_types/methods/wallet/cChain/index.d.ts" + ], + "methods/wallet/pChain": [ + "./dist/_types/methods/wallet/pChain/index.d.ts" + ], + "methods/wallet/xChain": [ + "./dist/_types/methods/wallet/xChain/index.d.ts" + ], + "methods/public": [ + "./dist/_types/methods/public/index.d.ts" + ], + "methods/pChain": [ + "./dist/_types/methods/pChain/index.d.ts" + ], + "methods/admin": [ + "./dist/_types/methods/admin/index.d.ts" + ], + "methods/cChain": [ + "./dist/_types/methods/cChain/index.d.ts" + ], + "methods/xChain": [ + "./dist/_types/methods/xChain/index.d.ts" + ], + "methods/health": [ + "./dist/_types/methods/health/index.d.ts" + ], + "methods/index": [ + "./dist/_types/methods/index/index.d.ts" + ], + "methods/info": [ + "./dist/_types/methods/info/index.d.ts" + ], + "node": [ + "./dist/_types/node/index.d.ts" + ], + "nonce": [ + "./dist/_types/nonce/index.d.ts" + ], + "serializable": [ + "./dist/_types/serializable/index.d.ts" + ], + "siwe": [ + "./dist/_types/siwe/index.d.ts" + ], + "window": [ + "./dist/_types/window/index.d.ts" + ] } } -} \ No newline at end of file +} diff --git a/client/rollup.config.js b/client/rollup.config.js new file mode 100644 index 00000000..d6adffa4 --- /dev/null +++ b/client/rollup.config.js @@ -0,0 +1,193 @@ +import commonjs from '@rollup/plugin-commonjs'; +import { nodeResolve } from '@rollup/plugin-node-resolve'; +import terser from '@rollup/plugin-terser'; +import typescript from '@rollup/plugin-typescript'; +import fs from 'fs'; + +// Get all entry points +const getEntryPoints = () => { + const entries = { + 'index': 'src/index.ts' + }; + + // Add sub-path entries based on package.json exports + const subPaths = [ + 'accounts', 'chains', 'methods', 'methods/wallet', 'methods/wallet/cChain', + 'methods/wallet/pChain', 'methods/wallet/xChain', 'methods/public', 'methods/pChain', + 'methods/admin', 'methods/cChain', 'methods/xChain', 'methods/health', + 'methods/index', 'methods/info', 'node', 'nonce', 'serializable', 'siwe', 'utils', 'window' + ]; + + for (const subPath of subPaths) { + const srcPath = `src/${subPath}/index.ts`; + try { + // Check if the file exists + fs.accessSync(srcPath); + entries[subPath] = srcPath; + } catch (e) { + // File doesn't exist, skip + } + } + + return entries; +}; + +const baseConfig = { + external: [ + // Keep these as external dependencies + '@avalabs/avalanchejs', + // '@noble/hashes', // Bundle this ES module dependency + // '@noble/secp256k1', // Bundle this ES module dependency + 'util', + 'viem', + // Node.js built-ins + 'crypto', + 'fs', + 'path', + 'url', + 'stream', + 'buffer', + 'events', + 'util', + 'assert', + 'os', + 'child_process', + 'worker_threads' + ], + plugins: [ + nodeResolve({ + preferBuiltins: true, + exportConditions: ['node'] + }), + commonjs() + ] +}; + +export default (commandLineArgs) => { + const buildFormat = process.env.BUILD_FORMAT || commandLineArgs.environment?.BUILD_FORMAT; + const entryPoints = getEntryPoints(); + + if (buildFormat === 'cjs') { + return Object.entries(entryPoints).map(([name, input]) => ({ + ...baseConfig, + input, + output: { + file: name === 'index' ? `dist/_cjs/index.js` : `dist/_cjs/${name}/index.js`, + format: 'cjs', + sourcemap: false, + exports: 'auto', + inlineDynamicImports: true + }, + plugins: [ + ...baseConfig.plugins, + typescript({ + tsconfig: './tsconfig.cjs.json', + declaration: false, + declarationMap: false, + sourceMap: false, + exclude: ['**/*.test.ts', '**/*.spec.ts'], + module: 'esnext', + target: 'es2020' + }), + terser({ + compress: { + drop_console: true, + drop_debugger: true + } + }) + ] + })); + } + + if (buildFormat === 'esm') { + return Object.entries(entryPoints).map(([name, input]) => ({ + ...baseConfig, + input, + output: { + file: name === 'index' ? `dist/_esm/index.js` : `dist/_esm/${name}/index.js`, + format: 'esm', + sourcemap: false, + inlineDynamicImports: true + }, + plugins: [ + ...baseConfig.plugins, + typescript({ + tsconfig: './tsconfig.esm.json', + declaration: false, + declarationMap: false, + sourceMap: false, + exclude: ['**/*.test.ts', '**/*.spec.ts'], + module: 'esnext', + target: 'es2020' + }), + terser({ + compress: { + drop_console: true, + drop_debugger: true + } + }) + ] + })); + } + + // Default: build both formats + return [ + ...Object.entries(entryPoints).map(([name, input]) => ({ + ...baseConfig, + input, + output: { + file: `dist/_cjs/${name}/index.js`, + format: 'cjs', + sourcemap: false, + exports: 'auto', + inlineDynamicImports: true + }, + plugins: [ + ...baseConfig.plugins, + typescript({ + tsconfig: './tsconfig.cjs.json', + declaration: false, + declarationMap: false, + sourceMap: false, + exclude: ['**/*.test.ts', '**/*.spec.ts'], + module: 'esnext', + target: 'es2020' + }), + terser({ + compress: { + drop_console: true, + drop_debugger: true + } + }) + ] + })), + ...Object.entries(entryPoints).map(([name, input]) => ({ + ...baseConfig, + input, + output: { + file: `dist/_esm/${name}/index.js`, + format: 'esm', + sourcemap: false, + inlineDynamicImports: true + }, + plugins: [ + ...baseConfig.plugins, + typescript({ + tsconfig: './tsconfig.esm.json', + declaration: false, + declarationMap: false, + sourceMap: false, + exclude: ['**/*.test.ts', '**/*.spec.ts'], + module: 'esnext', + target: 'es2020' + }), + terser({ + compress: { + drop_console: true, + drop_debugger: true + } + }) + ] + })) + ]; +}; From b14b4ed589c04b59f3890693c8d0308a724c5483 Mon Sep 17 00:00:00 2001 From: Sayan kar Date: Fri, 31 Oct 2025 20:59:47 +0530 Subject: [PATCH 2/8] chore: add methods introduced in granite upgrade --- .vscode/settings.json | 2 + client/examples/package-lock.json | 826 +++++++++++++++++- client/examples/package.json | 1 + .../package-lock.json | 423 ++++++++- .../package.json | 1 + client/src/clients/createAvalancheClient.ts | 83 +- .../src/clients/createProposervmApiClient.ts | 115 +++ .../src/clients/decorators/avalanche.test.ts | 155 +++- client/src/clients/decorators/avalanche.ts | 82 +- client/src/clients/decorators/pChain.test.ts | 1 + client/src/clients/decorators/pChain.ts | 35 + .../src/clients/decorators/proposervmApi.ts | 65 ++ .../clients/types/createAvalancheClient.ts | 86 +- client/src/clients/types/types.ts | 3 + client/src/clients/utils.ts | 6 + client/src/index.ts | 11 + .../src/methods/pChain/getAllValidatorsAt.ts | 55 ++ client/src/methods/pChain/index.ts | 7 + client/src/methods/pChain/pChainRpcSchema.ts | 2 + .../pChain/types/getAllValidatorsAt.ts | 36 + .../src/methods/proposervm/getCurrentEpoch.ts | 45 + .../methods/proposervm/getProposedHeight.ts | 45 + client/src/methods/proposervm/index.ts | 11 + .../methods/proposervm/proposervmRpcSchema.ts | 15 + .../proposervm/types/getCurrentEpoch.ts | 21 + .../proposervm/types/getProposedHeight.ts | 17 + 26 files changed, 2010 insertions(+), 139 deletions(-) create mode 100644 client/src/clients/createProposervmApiClient.ts create mode 100644 client/src/clients/decorators/proposervmApi.ts create mode 100644 client/src/methods/pChain/getAllValidatorsAt.ts create mode 100644 client/src/methods/pChain/types/getAllValidatorsAt.ts create mode 100644 client/src/methods/proposervm/getCurrentEpoch.ts create mode 100644 client/src/methods/proposervm/getProposedHeight.ts create mode 100644 client/src/methods/proposervm/index.ts create mode 100644 client/src/methods/proposervm/proposervmRpcSchema.ts create mode 100644 client/src/methods/proposervm/types/getCurrentEpoch.ts create mode 100644 client/src/methods/proposervm/types/getProposedHeight.ts diff --git a/.vscode/settings.json b/.vscode/settings.json index 442133f2..231e0071 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -25,6 +25,7 @@ "Permissioned", "Permissionless", "POSTHOG", + "proposervm", "Sayan", "scure", "Sepk", @@ -37,6 +38,7 @@ "UTXOID", "UTXOs", "viem", + "VMAPI", "xChain" ] } diff --git a/client/examples/package-lock.json b/client/examples/package-lock.json index dc953293..b634419e 100644 --- a/client/examples/package-lock.json +++ b/client/examples/package-lock.json @@ -9,6 +9,7 @@ "version": "1.0.0", "license": "BSD-3-Clause", "dependencies": { + "@avalanche-sdk/client": "^0.0.4-alpha.16", "dotenv": "^16.3.1" }, "devDependencies": { @@ -17,6 +18,44 @@ "typescript": "^5.0.0" } }, + "node_modules/@adraffy/ens-normalize": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.11.1.tgz", + "integrity": "sha512-nhCBV3quEgesuf7c7KYfperqSS14T8bYuvJ8PcLJp6znkZpFc0AuW4qBtr8eKVyPPe/8RSr7sglCWPU5eaxwKQ==", + "license": "MIT" + }, + "node_modules/@avalabs/avalanchejs": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@avalabs/avalanchejs/-/avalanchejs-5.0.0.tgz", + "integrity": "sha512-0hJK/Hdf8v+q05c8+5K6arFmzq7o1W4I05/Dmr+Es1XRi8canvTu1Y0RruYd6ea2rrvX3UhKrPs3BzLhCTHDrw==", + "dependencies": { + "@noble/curves": "1.3.0", + "@noble/hashes": "1.3.3", + "@noble/secp256k1": "2.0.0", + "@scure/base": "1.1.5", + "micro-eth-signer": "0.7.2" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@avalanche-sdk/client": { + "version": "0.0.4-alpha.16", + "resolved": "https://registry.npmjs.org/@avalanche-sdk/client/-/client-0.0.4-alpha.16.tgz", + "integrity": "sha512-rpOwBURNaV62rZSyacuQfPhTsuHWhnNNcoqTWEBXrGqIkUXoIdG4YqGrjKVVvNk/c7uRC1NX7FbmpOv7fgibJw==", + "license": "BSD-3-Clause", + "dependencies": { + "@avalabs/avalanchejs": "^5.0.0", + "@noble/hashes": "1.3.3", + "@noble/secp256k1": "2.0.0", + "util": "^0.12.5", + "viem": "^2.33.3" + }, + "engines": { + "node": ">=20", + "npm": ">=10" + } + }, "node_modules/@esbuild/aix-ppc64": { "version": "0.25.9", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.9.tgz", @@ -459,6 +498,159 @@ "node": ">=18" } }, + "node_modules/@ethereumjs/rlp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/rlp/-/rlp-5.0.0.tgz", + "integrity": "sha512-WuS1l7GJmB0n0HsXLozCoEFc9IwYgf3l0gCkKVYgR67puVF1O4OpEaN0hWmm1c+iHUHFCKt1hJrvy5toLg+6ag==", + "license": "MPL-2.0", + "bin": { + "rlp": "bin/rlp" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@noble/ciphers": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-1.3.0.tgz", + "integrity": "sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/curves": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.3.0.tgz", + "integrity": "sha512-t01iSXPuN+Eqzb4eBX0S5oubSqXbK/xXa1Ne18Hj8f9pStxztHCE2gfboSp/dZRLSqfuLpRK2nDXDK+W9puocA==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.3.3" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/hashes": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", + "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==", + "license": "MIT", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/secp256k1": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-2.0.0.tgz", + "integrity": "sha512-rUGBd95e2a45rlmFTqQJYEFA4/gdIARFfuTuTqLglz0PZ6AKyzyXsEZZq7UZn8hZsvaBgpCzKKBJizT2cJERXw==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "license": "MIT" + }, + "node_modules/@scure/base": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.5.tgz", + "integrity": "sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ==", + "license": "MIT", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.7.0.tgz", + "integrity": "sha512-E4FFX/N3f4B80AKWp5dP6ow+flD1LQZo/w8UnLGYZO674jS6YnYeepycOOksv+vLPSpgN35wgKgy+ybfTb2SMw==", + "license": "MIT", + "dependencies": { + "@noble/curves": "~1.9.0", + "@noble/hashes": "~1.8.0", + "@scure/base": "~1.2.5" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32/node_modules/@noble/curves": { + "version": "1.9.7", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.7.tgz", + "integrity": "sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.8.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32/node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32/node_modules/@scure/base": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.2.6.tgz", + "integrity": "sha512-g/nm5FgUa//MCj1gV09zTJTaM6KBAHqLN907YVQqf7zC49+DcO4B1so4ZX07Ef10Twr6nuqYEH9GEggFXA4Fmg==", + "license": "MIT", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip39": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.6.0.tgz", + "integrity": "sha512-+lF0BbLiJNwVlev4eKelw1WWLaiKXw7sSl8T6FvBlWkdX+94aGJ4o8XjUdlyhTCjd8c+B3KT3JfS8P0bLRNU6A==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "~1.8.0", + "@scure/base": "~1.2.5" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip39/node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip39/node_modules/@scure/base": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.2.6.tgz", + "integrity": "sha512-g/nm5FgUa//MCj1gV09zTJTaM6KBAHqLN907YVQqf7zC49+DcO4B1so4ZX07Ef10Twr6nuqYEH9GEggFXA4Fmg==", + "license": "MIT", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@types/node": { "version": "20.19.10", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.10.tgz", @@ -469,6 +661,106 @@ "undici-types": "~6.21.0" } }, + "node_modules/abitype": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.1.0.tgz", + "integrity": "sha512-6Vh4HcRxNMLA0puzPjM5GBgT4aAcFGKZzSgAXvuZ27shJP6NEpielTuqbBmZILR5/xd0PizkBGy5hReKz9jl5A==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/wevm" + }, + "peerDependencies": { + "typescript": ">=5.0.4", + "zod": "^3.22.0 || ^4.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + }, + "zod": { + "optional": true + } + } + }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "license": "MIT", + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/call-bind": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", + "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.0", + "es-define-property": "^1.0.0", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/dotenv": { "version": "16.6.1", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz", @@ -481,6 +773,50 @@ "url": "https://dotenvx.com" } }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/esbuild": { "version": "0.25.9", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.9.tgz", @@ -523,6 +859,27 @@ "@esbuild/win32-x64": "0.25.9" } }, + "node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "license": "MIT" + }, + "node_modules/for-each": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", + "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", + "license": "MIT", + "dependencies": { + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", @@ -538,6 +895,61 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/generator-function": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/generator-function/-/generator-function-2.0.1.tgz", + "integrity": "sha512-SFdFmIJi+ybC0vjlHN0ZGVGHc3lgE0DxPAT0djjVg+kjOnSqclqmj0KQ7ykTOLP6YxoqOvuAODGdcHJn+43q3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/get-tsconfig": { "version": "4.10.1", "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.10.1.tgz", @@ -551,6 +963,270 @@ "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" } }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/is-arguments": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.2.0.tgz", + "integrity": "sha512-7bVbi0huj/wrIAOzb8U1aszg9kdi3KN/CyU19CTI7tAoZYEZoL9yCDXpbXN+uPsuWnP02cyug1gleqq+TU+YCA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-generator-function": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.1.2.tgz", + "integrity": "sha512-upqt1SkGkODW9tsGNG5mtXTXtECizwtS2kA161M+gJPc1xdb/Ax629af6YrTwcOeQHbewrPNlE5Dx7kzvXTizA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.4", + "generator-function": "^2.0.0", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-regex": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", + "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", + "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", + "license": "MIT", + "dependencies": { + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/isows": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/isows/-/isows-1.0.7.tgz", + "integrity": "sha512-I1fSfDCZL5P0v33sVqeTDSpcstAg/N+wF5HS033mogOVIp4B+oHC7oOCsA3axAbBSGTJ8QubbNmnIRN/h8U7hg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "license": "MIT", + "peerDependencies": { + "ws": "*" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/micro-eth-signer": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/micro-eth-signer/-/micro-eth-signer-0.7.2.tgz", + "integrity": "sha512-uFH23nqPNdg2KZ9ZdvLG4GO3bTAOWRhwGTsecY4Et2IdQOJ26x6inu8lJ9oyslnYL/0o1vnETCGhMimMvO0SqQ==", + "license": "MIT", + "dependencies": { + "@ethereumjs/rlp": "5.0.0", + "@noble/curves": "~1.3.0", + "@noble/hashes": "~1.3.3", + "@scure/base": "~1.1.5", + "micro-packed": "~0.5.1" + } + }, + "node_modules/micro-packed": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/micro-packed/-/micro-packed-0.5.3.tgz", + "integrity": "sha512-zWRoH+qUb/ZMp9gVZhexvRGCENDM5HEQF4sflqpdilUHWK2/zKR7/MT8GBctnTwbhNJwy1iuk5q6+TYP7/twYA==", + "license": "MIT", + "dependencies": { + "@scure/base": "~1.1.5" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/ox": { + "version": "0.9.6", + "resolved": "https://registry.npmjs.org/ox/-/ox-0.9.6.tgz", + "integrity": "sha512-8SuCbHPvv2eZLYXrNmC0EC12rdzXQLdhnOMlHDW2wiCPLxBrOOJwX5L5E61by+UjTPOryqQiRSnjIKCI+GykKg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "license": "MIT", + "dependencies": { + "@adraffy/ens-normalize": "^1.11.0", + "@noble/ciphers": "^1.3.0", + "@noble/curves": "1.9.1", + "@noble/hashes": "^1.8.0", + "@scure/bip32": "^1.7.0", + "@scure/bip39": "^1.6.0", + "abitype": "^1.0.9", + "eventemitter3": "5.0.1" + }, + "peerDependencies": { + "typescript": ">=5.4.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/ox/node_modules/@noble/curves": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.1.tgz", + "integrity": "sha512-k11yZxZg+t+gWvBbIswW0yoJlu8cHOC7dhunwOzoWH/mXGBiYyR4YY6hAEK/3EUs4UpB8la1RfdRpeGsFHkWsA==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.8.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/ox/node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/possible-typed-array-names": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", + "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/resolve-pkg-maps": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", @@ -561,6 +1237,40 @@ "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" } }, + "node_modules/safe-regex-test": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.1.0.tgz", + "integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-regex": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/tsx": { "version": "4.20.4", "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.20.4.tgz", @@ -585,8 +1295,9 @@ "version": "5.9.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.2.tgz", "integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==", - "dev": true, + "devOptional": true, "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -601,6 +1312,119 @@ "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", "dev": true, "license": "MIT" + }, + "node_modules/util": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", + "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + } + }, + "node_modules/viem": { + "version": "2.38.3", + "resolved": "https://registry.npmjs.org/viem/-/viem-2.38.3.tgz", + "integrity": "sha512-By2TutLv07iNHHtWqHHzjGipevYsfGqT7KQbGEmqLco1qTJxKnvBbSviqiu6/v/9REV6Q/FpmIxf2Z7/l5AbcQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "license": "MIT", + "dependencies": { + "@noble/curves": "1.9.1", + "@noble/hashes": "1.8.0", + "@scure/bip32": "1.7.0", + "@scure/bip39": "1.6.0", + "abitype": "1.1.0", + "isows": "1.0.7", + "ox": "0.9.6", + "ws": "8.18.3" + }, + "peerDependencies": { + "typescript": ">=5.0.4" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/viem/node_modules/@noble/curves": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.1.tgz", + "integrity": "sha512-k11yZxZg+t+gWvBbIswW0yoJlu8cHOC7dhunwOzoWH/mXGBiYyR4YY6hAEK/3EUs4UpB8la1RfdRpeGsFHkWsA==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.8.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/viem/node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.19", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.19.tgz", + "integrity": "sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw==", + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "for-each": "^0.3.5", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/ws": { + "version": "8.18.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz", + "integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } } } } diff --git a/client/examples/package.json b/client/examples/package.json index 62185001..3be3df70 100644 --- a/client/examples/package.json +++ b/client/examples/package.json @@ -9,6 +9,7 @@ "license": "BSD-3-Clause", "description": "", "dependencies": { + "@avalanche-sdk/client": "^0.0.4-alpha.16", "dotenv": "^16.3.1" }, "devDependencies": { diff --git a/client/examples/react-show-balance-and-cross-chain-transfers/package-lock.json b/client/examples/react-show-balance-and-cross-chain-transfers/package-lock.json index 4b83ca6f..f171aa82 100644 --- a/client/examples/react-show-balance-and-cross-chain-transfers/package-lock.json +++ b/client/examples/react-show-balance-and-cross-chain-transfers/package-lock.json @@ -8,6 +8,7 @@ "name": "react-show-balance-and-cross-chain-transfers", "version": "0.1.0", "dependencies": { + "@avalanche-sdk/client": "^0.0.4-alpha.16", "@emotion/react": "^11.13.3", "@emotion/styled": "^11.13.0", "@mui/icons-material": "^6.5.0", @@ -25,6 +26,12 @@ "vite": "^7.1.5" } }, + "node_modules/@adraffy/ens-normalize": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.11.1.tgz", + "integrity": "sha512-nhCBV3quEgesuf7c7KYfperqSS14T8bYuvJ8PcLJp6znkZpFc0AuW4qBtr8eKVyPPe/8RSr7sglCWPU5eaxwKQ==", + "license": "MIT" + }, "node_modules/@ampproject/remapping": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", @@ -39,6 +46,38 @@ "node": ">=6.0.0" } }, + "node_modules/@avalabs/avalanchejs": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@avalabs/avalanchejs/-/avalanchejs-5.0.0.tgz", + "integrity": "sha512-0hJK/Hdf8v+q05c8+5K6arFmzq7o1W4I05/Dmr+Es1XRi8canvTu1Y0RruYd6ea2rrvX3UhKrPs3BzLhCTHDrw==", + "dependencies": { + "@noble/curves": "1.3.0", + "@noble/hashes": "1.3.3", + "@noble/secp256k1": "2.0.0", + "@scure/base": "1.1.5", + "micro-eth-signer": "0.7.2" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@avalanche-sdk/client": { + "version": "0.0.4-alpha.16", + "resolved": "https://registry.npmjs.org/@avalanche-sdk/client/-/client-0.0.4-alpha.16.tgz", + "integrity": "sha512-rpOwBURNaV62rZSyacuQfPhTsuHWhnNNcoqTWEBXrGqIkUXoIdG4YqGrjKVVvNk/c7uRC1NX7FbmpOv7fgibJw==", + "license": "BSD-3-Clause", + "dependencies": { + "@avalabs/avalanchejs": "^5.0.0", + "@noble/hashes": "1.3.3", + "@noble/secp256k1": "2.0.0", + "util": "^0.12.5", + "viem": "^2.33.3" + }, + "engines": { + "node": ">=20", + "npm": ">=10" + } + }, "node_modules/@babel/code-frame": { "version": "7.27.1", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", @@ -69,6 +108,7 @@ "integrity": "sha512-UlLAnTPrFdNGoFtbSXwcGFQBtQZJCNjaN6hQNP3UPvuNXT1i82N26KL3dZeIpNalWywr9IuQuncaAfUaS1g6sQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.27.1", @@ -385,6 +425,7 @@ "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.14.0.tgz", "integrity": "sha512-O000MLDBDdk/EohJPFUqvnp4qnHeYkVP5B0xEG0D/L7cOKP9kefu2DXn8dj74cQfsEzUqh+sr1RzFqiL1o+PpA==", "license": "MIT", + "peer": true, "dependencies": { "@babel/runtime": "^7.18.3", "@emotion/babel-plugin": "^11.13.5", @@ -428,6 +469,7 @@ "resolved": "https://registry.npmjs.org/@emotion/styled/-/styled-11.14.1.tgz", "integrity": "sha512-qEEJt42DuToa3gurlH4Qqc1kVpNq8wO8cJtDzU46TjlzWjDlsVyevtYCRijVq3SrHsROS+gVQ8Fnea108GnKzw==", "license": "MIT", + "peer": true, "dependencies": { "@babel/runtime": "^7.18.3", "@emotion/babel-plugin": "^11.13.5", @@ -915,6 +957,18 @@ "node": ">=18" } }, + "node_modules/@ethereumjs/rlp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/rlp/-/rlp-5.0.0.tgz", + "integrity": "sha512-WuS1l7GJmB0n0HsXLozCoEFc9IwYgf3l0gCkKVYgR67puVF1O4OpEaN0hWmm1c+iHUHFCKt1hJrvy5toLg+6ag==", + "license": "MPL-2.0", + "bin": { + "rlp": "bin/rlp" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.12", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.12.tgz", @@ -990,6 +1044,7 @@ "resolved": "https://registry.npmjs.org/@mui/material/-/material-6.5.0.tgz", "integrity": "sha512-yjvtXoFcrPLGtgKRxFaH6OQPtcLPhkloC0BML6rBG5UeldR0nPULR/2E2BfXdo5JNV7j7lOzrrLX2Qf/iSidow==", "license": "MIT", + "peer": true, "dependencies": { "@babel/runtime": "^7.26.0", "@mui/core-downloads-tracker": "^6.5.0", @@ -1179,6 +1234,54 @@ } } }, + "node_modules/@noble/ciphers": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-1.3.0.tgz", + "integrity": "sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/curves": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.3.0.tgz", + "integrity": "sha512-t01iSXPuN+Eqzb4eBX0S5oubSqXbK/xXa1Ne18Hj8f9pStxztHCE2gfboSp/dZRLSqfuLpRK2nDXDK+W9puocA==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.3.3" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/hashes": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", + "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==", + "license": "MIT", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/secp256k1": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-2.0.0.tgz", + "integrity": "sha512-rUGBd95e2a45rlmFTqQJYEFA4/gdIARFfuTuTqLglz0PZ6AKyzyXsEZZq7UZn8hZsvaBgpCzKKBJizT2cJERXw==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "license": "MIT" + }, "node_modules/@popperjs/core": { "version": "2.11.8", "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz", @@ -1476,6 +1579,99 @@ "win32" ] }, + "node_modules/@scure/base": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.5.tgz", + "integrity": "sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ==", + "license": "MIT", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.7.0.tgz", + "integrity": "sha512-E4FFX/N3f4B80AKWp5dP6ow+flD1LQZo/w8UnLGYZO674jS6YnYeepycOOksv+vLPSpgN35wgKgy+ybfTb2SMw==", + "license": "MIT", + "dependencies": { + "@noble/curves": "~1.9.0", + "@noble/hashes": "~1.8.0", + "@scure/base": "~1.2.5" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32/node_modules/@noble/curves": { + "version": "1.9.7", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.7.tgz", + "integrity": "sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.8.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32/node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32/node_modules/@scure/base": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.2.6.tgz", + "integrity": "sha512-g/nm5FgUa//MCj1gV09zTJTaM6KBAHqLN907YVQqf7zC49+DcO4B1so4ZX07Ef10Twr6nuqYEH9GEggFXA4Fmg==", + "license": "MIT", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip39": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.6.0.tgz", + "integrity": "sha512-+lF0BbLiJNwVlev4eKelw1WWLaiKXw7sSl8T6FvBlWkdX+94aGJ4o8XjUdlyhTCjd8c+B3KT3JfS8P0bLRNU6A==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "~1.8.0", + "@scure/base": "~1.2.5" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip39/node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip39/node_modules/@scure/base": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.2.6.tgz", + "integrity": "sha512-g/nm5FgUa//MCj1gV09zTJTaM6KBAHqLN907YVQqf7zC49+DcO4B1so4ZX07Ef10Twr6nuqYEH9GEggFXA4Fmg==", + "license": "MIT", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@types/babel__core": { "version": "7.20.5", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", @@ -1545,6 +1741,7 @@ "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.23.tgz", "integrity": "sha512-/LDXMQh55EzZQ0uVAZmKKhfENivEvWz6E+EYzh+/MCjMhNsotd+ZHhBGIjFDTi6+fz0OhQQQLbTgdQIxxCsC0w==", "license": "MIT", + "peer": true, "dependencies": { "@types/prop-types": "*", "csstype": "^3.0.2" @@ -1590,6 +1787,27 @@ "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" } }, + "node_modules/abitype": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.1.0.tgz", + "integrity": "sha512-6Vh4HcRxNMLA0puzPjM5GBgT4aAcFGKZzSgAXvuZ27shJP6NEpielTuqbBmZILR5/xd0PizkBGy5hReKz9jl5A==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/wevm" + }, + "peerDependencies": { + "typescript": ">=5.0.4", + "zod": "^3.22.0 || ^4.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + }, + "zod": { + "optional": true + } + } + }, "node_modules/available-typed-arrays": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", @@ -1640,6 +1858,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "caniuse-lite": "^1.0.30001733", "electron-to-chromium": "^1.5.199", @@ -1944,6 +2163,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "license": "MIT" + }, "node_modules/fdir": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", @@ -2254,6 +2479,21 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/isows": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/isows/-/isows-1.0.7.tgz", + "integrity": "sha512-I1fSfDCZL5P0v33sVqeTDSpcstAg/N+wF5HS033mogOVIp4B+oHC7oOCsA3axAbBSGTJ8QubbNmnIRN/h8U7hg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "license": "MIT", + "peerDependencies": { + "ws": "*" + } + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -2328,6 +2568,31 @@ "node": ">= 0.4" } }, + "node_modules/micro-eth-signer": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/micro-eth-signer/-/micro-eth-signer-0.7.2.tgz", + "integrity": "sha512-uFH23nqPNdg2KZ9ZdvLG4GO3bTAOWRhwGTsecY4Et2IdQOJ26x6inu8lJ9oyslnYL/0o1vnETCGhMimMvO0SqQ==", + "license": "MIT", + "dependencies": { + "@ethereumjs/rlp": "5.0.0", + "@noble/curves": "~1.3.0", + "@noble/hashes": "~1.3.3", + "@scure/base": "~1.1.5", + "micro-packed": "~0.5.1" + } + }, + "node_modules/micro-packed": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/micro-packed/-/micro-packed-0.5.3.tgz", + "integrity": "sha512-zWRoH+qUb/ZMp9gVZhexvRGCENDM5HEQF4sflqpdilUHWK2/zKR7/MT8GBctnTwbhNJwy1iuk5q6+TYP7/twYA==", + "license": "MIT", + "dependencies": { + "@scure/base": "~1.1.5" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -2369,6 +2634,63 @@ "node": ">=0.10.0" } }, + "node_modules/ox": { + "version": "0.9.6", + "resolved": "https://registry.npmjs.org/ox/-/ox-0.9.6.tgz", + "integrity": "sha512-8SuCbHPvv2eZLYXrNmC0EC12rdzXQLdhnOMlHDW2wiCPLxBrOOJwX5L5E61by+UjTPOryqQiRSnjIKCI+GykKg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "license": "MIT", + "dependencies": { + "@adraffy/ens-normalize": "^1.11.0", + "@noble/ciphers": "^1.3.0", + "@noble/curves": "1.9.1", + "@noble/hashes": "^1.8.0", + "@scure/bip32": "^1.7.0", + "@scure/bip39": "^1.6.0", + "abitype": "^1.0.9", + "eventemitter3": "5.0.1" + }, + "peerDependencies": { + "typescript": ">=5.4.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/ox/node_modules/@noble/curves": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.1.tgz", + "integrity": "sha512-k11yZxZg+t+gWvBbIswW0yoJlu8cHOC7dhunwOzoWH/mXGBiYyR4YY6hAEK/3EUs4UpB8la1RfdRpeGsFHkWsA==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.8.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/ox/node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -2426,6 +2748,7 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -2502,6 +2825,7 @@ "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", "license": "MIT", + "peer": true, "dependencies": { "loose-envify": "^1.1.0" }, @@ -2514,6 +2838,7 @@ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", "license": "MIT", + "peer": true, "dependencies": { "loose-envify": "^1.1.0", "scheduler": "^0.23.2" @@ -2734,8 +3059,9 @@ "version": "5.9.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.2.tgz", "integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==", - "dev": true, + "devOptional": true, "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -2788,12 +3114,70 @@ "which-typed-array": "^1.1.2" } }, + "node_modules/viem": { + "version": "2.38.3", + "resolved": "https://registry.npmjs.org/viem/-/viem-2.38.3.tgz", + "integrity": "sha512-By2TutLv07iNHHtWqHHzjGipevYsfGqT7KQbGEmqLco1qTJxKnvBbSviqiu6/v/9REV6Q/FpmIxf2Z7/l5AbcQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "license": "MIT", + "dependencies": { + "@noble/curves": "1.9.1", + "@noble/hashes": "1.8.0", + "@scure/bip32": "1.7.0", + "@scure/bip39": "1.6.0", + "abitype": "1.1.0", + "isows": "1.0.7", + "ox": "0.9.6", + "ws": "8.18.3" + }, + "peerDependencies": { + "typescript": ">=5.0.4" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/viem/node_modules/@noble/curves": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.1.tgz", + "integrity": "sha512-k11yZxZg+t+gWvBbIswW0yoJlu8cHOC7dhunwOzoWH/mXGBiYyR4YY6hAEK/3EUs4UpB8la1RfdRpeGsFHkWsA==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.8.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/viem/node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/vite": { "version": "7.1.5", "resolved": "https://registry.npmjs.org/vite/-/vite-7.1.5.tgz", "integrity": "sha512-4cKBO9wR75r0BeIWWWId9XK9Lj6La5X846Zw9dFfzMRw38IlTk2iCcUt6hsyiDRcPidc55ZParFYDXi0nXOeLQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.5.0", @@ -2884,27 +3268,34 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/ws": { + "version": "8.18.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz", + "integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/yallist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", "dev": true, "license": "ISC" - }, - "node_modules/yaml": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.1.tgz", - "integrity": "sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw==", - "dev": true, - "license": "ISC", - "optional": true, - "peer": true, - "bin": { - "yaml": "bin.mjs" - }, - "engines": { - "node": ">= 14.6" - } } } } diff --git a/client/examples/react-show-balance-and-cross-chain-transfers/package.json b/client/examples/react-show-balance-and-cross-chain-transfers/package.json index b5c58a23..1c1bde86 100644 --- a/client/examples/react-show-balance-and-cross-chain-transfers/package.json +++ b/client/examples/react-show-balance-and-cross-chain-transfers/package.json @@ -9,6 +9,7 @@ "preview": "vite preview --port 5173" }, "dependencies": { + "@avalanche-sdk/client": "^0.0.4-alpha.16", "@emotion/react": "^11.13.3", "@emotion/styled": "^11.13.0", "@mui/icons-material": "^6.5.0", diff --git a/client/src/clients/createAvalancheClient.ts b/client/src/clients/createAvalancheClient.ts index 187fc020..ac70a2f7 100644 --- a/client/src/clients/createAvalancheClient.ts +++ b/client/src/clients/createAvalancheClient.ts @@ -15,6 +15,7 @@ import { createHealthApiClient } from "./createHealthApiClient.js"; import { createIndexApiClient } from "./createIndexApiClient.js"; import { createInfoApiClient } from "./createInfoApiClient.js"; import { createPChainClient } from "./createPChainClient.js"; +import { createProposerVMApiClient } from "./createProposervmApiClient.js"; import { createXChainClient } from "./createXChainClient.js"; import { adminAPIActions } from "./decorators/adminApi.js"; import { avalanchePublicActions } from "./decorators/avalanchePublic.js"; @@ -23,6 +24,7 @@ import { healthAPIActions } from "./decorators/healthApi.js"; import { indexAPIActions } from "./decorators/indexApi.js"; import { infoAPIActions } from "./decorators/infoApi.js"; import { pChainActions } from "./decorators/pChain.js"; +import { proposerVMAPIActions } from "./decorators/proposervmApi.js"; import { xChainActions } from "./decorators/xChain.js"; import { AvalancheClient, @@ -40,6 +42,7 @@ import { createAvalancheTransportClient } from "./utils.js"; * - Admin API * - Info API * - Health API + * - ProposerVM API * - Index API * * @param parameters - {@link AvalancheClientConfig} @@ -66,6 +69,7 @@ import { createAvalancheTransportClient } from "./utils.js"; * const adminClient = client.admin * const infoClient = client.info * const healthClient = client.health + * const proposervmClient = client.proposervm * const indexPChainBlockClient = client.indexPChainBlock * * // Get the latest block number @@ -165,34 +169,61 @@ export function createAvalancheClient< ...parameters, key: "health", name: "Health Client", - }).extend(healthAPIActions) as any, + }).extend(healthAPIActions), - indexPChainBlock: createIndexApiClient({ - ...parameters, - key: "indexPChainBlock", - name: "Index P-Chain Block Client", - clientType: "indexPChainBlock", - }).extend(indexAPIActions) as any, + proposervm: { + cChain: createProposerVMApiClient({ + ...parameters, + key: "proposervm", + name: "ProposerVM Client", + clientType: "proposervmCChain", + }).extend(proposerVMAPIActions) as any, - indexCChainBlock: createIndexApiClient({ - ...parameters, - key: "indexCChainBlock", - name: "Index C-Chain Block Client", - clientType: "indexCChainBlock", - }).extend(indexAPIActions) as any, + pChain: createProposerVMApiClient({ + ...parameters, + key: "proposervm", + name: "ProposerVM Client", + clientType: "proposervmPChain", + }).extend(proposerVMAPIActions) as any, - indexXChainBlock: createIndexApiClient({ - ...parameters, - key: "indexXChainBlock", - name: "Index X-Chain Block Client", - clientType: "indexXChainBlock", - }).extend(indexAPIActions) as any, + xChain: createProposerVMApiClient({ + ...parameters, + key: "proposervm", + name: "ProposerVM Client", + clientType: "proposervmXChain", + }).extend(proposerVMAPIActions) as any, + } as any, - indexXChainTx: createIndexApiClient({ - ...parameters, - key: "indexXChainTx", - name: "Index X-Chain Tx Client", - clientType: "indexXChainTx", - }).extend(indexAPIActions) as any, - }; + indexBlock: { + pChain: createIndexApiClient({ + ...parameters, + key: "indexPChainBlock", + name: "Index P-Chain Block Client", + clientType: "indexPChainBlock", + }).extend(indexAPIActions) as any, + + cChain: createIndexApiClient({ + ...parameters, + key: "indexCChainBlock", + name: "Index C-Chain Block Client", + clientType: "indexCChainBlock", + }).extend(indexAPIActions) as any, + + xChain: createIndexApiClient({ + ...parameters, + key: "indexXChainBlock", + name: "Index X-Chain Block Client", + clientType: "indexXChainBlock", + }).extend(indexAPIActions) as any, + } as any, + + indexTx: { + xChain: createIndexApiClient({ + ...parameters, + key: "indexXChainTx", + name: "Index X-Chain Tx Client", + clientType: "indexXChainTx", + }).extend(indexAPIActions) as any, + } as any, + } as any; } diff --git a/client/src/clients/createProposervmApiClient.ts b/client/src/clients/createProposervmApiClient.ts new file mode 100644 index 00000000..836e0cf0 --- /dev/null +++ b/client/src/clients/createProposervmApiClient.ts @@ -0,0 +1,115 @@ +import { + Account, + Address, + Chain, + ParseAccount, + Prettify, + RpcSchema, + Transport, +} from "viem"; +import { ProposerVMRpcSchema } from "../methods/proposervm/proposervmRpcSchema.js"; +import { + AvalancheCoreClient, + createAvalancheCoreClient, + CreateAvalancheCoreClientErrorType, +} from "./createAvalancheCoreClient.js"; +import { + proposerVMAPIActions, + ProposerVMAPIActions, +} from "./decorators/proposervmApi.js"; +import { AvalancheClientConfig } from "./types/createAvalancheClient.js"; + +export type ProposerVMApiClientConfig< + transport extends Transport, + chain extends Chain | undefined = Chain | undefined, + accountOrAddress extends Account | Address | undefined = undefined, + rpcSchema extends RpcSchema | undefined = undefined, + raw extends boolean = false +> = Prettify< + AvalancheClientConfig & { + clientType: "proposervmCChain" | "proposervmPChain" | "proposervmXChain"; + } +>; + +export type ProposerVMApiClient< + transport extends Transport = Transport, + chain extends Chain | undefined = Chain | undefined, + accountOrAddress extends Account | undefined = undefined, + rpcSchema extends RpcSchema | undefined = undefined +> = Prettify< + AvalancheCoreClient< + transport, + chain, + accountOrAddress, + rpcSchema extends RpcSchema + ? [...ProposerVMRpcSchema, ...rpcSchema] + : ProposerVMRpcSchema, + ProposerVMAPIActions + > +>; + +export type CreateProposerVMApiClientErrorType = + CreateAvalancheCoreClientErrorType; + +/** + * Creates a ProposerVM API Client with a given transport configured for a Chain. + * + * The ProposerVM API Client is an interface to interact with the ProposerVM API through Avalanche-specific JSON-RPC API methods. + * + * @param parameters - {@link ProposerVMApiClientConfig} + * @returns A ProposerVM API Client. {@link ProposerVMApiClient} + * + * @example + * ```ts + * import { createProposerVMApiClient} from '@avalanche-sdk/client' + * import { avalanche } from '@avalanche-sdk/client/chains' + * + * const client = createProposerVMApiClient({ + * chain: avalanche, + * transport: { + * type: "http", + * }, + * }) + * + * // Get proposer VM height + * const height = await client.getProposedHeight() + * + * // Get current epoch + * const epoch = await client.getCurrentEpoch() + * ``` + */ +export function createProposerVMApiClient< + transport extends Transport, + chain extends Chain | undefined = undefined, + accountOrAddress extends Account | Address | undefined = undefined, + rpcSchema extends RpcSchema | undefined = undefined, + raw extends boolean = false +>( + parameters: ProposerVMApiClientConfig< + transport, + chain, + accountOrAddress, + rpcSchema, + raw + > +): ProposerVMApiClient< + transport, + chain, + ParseAccount, + rpcSchema +> { + const { + key = "proposervm", + name = "ProposerVM API Client", + clientType, + } = parameters; + + const client = createAvalancheCoreClient({ + ...parameters, + key, + name, + clientType, + }); + + return client.extend(proposerVMAPIActions) as any; +} diff --git a/client/src/clients/decorators/avalanche.test.ts b/client/src/clients/decorators/avalanche.test.ts index c61013b7..abfc5ef8 100644 --- a/client/src/clients/decorators/avalanche.test.ts +++ b/client/src/clients/decorators/avalanche.test.ts @@ -275,22 +275,40 @@ const mockClient = { chain: avalanche, transport: mockTransport, }), - indexPChainBlock: createAvalancheBaseClient({ - chain: avalanche, - transport: mockTransport, - }), - indexCChainBlock: createAvalancheBaseClient({ - chain: avalanche, - transport: mockTransport, - }), - indexXChainBlock: createAvalancheBaseClient({ - chain: avalanche, - transport: mockTransport, - }), - indexXChainTx: createAvalancheBaseClient({ - chain: avalanche, - transport: mockTransport, - }), + proposervm: { + cChain: createAvalancheBaseClient({ + chain: avalanche, + transport: mockTransport, + }), + pChain: createAvalancheBaseClient({ + chain: avalanche, + transport: mockTransport, + }), + xChain: createAvalancheBaseClient({ + chain: avalanche, + transport: mockTransport, + }), + } as any, + indexBlock: { + pChain: createAvalancheBaseClient({ + chain: avalanche, + transport: mockTransport, + }), + cChain: createAvalancheBaseClient({ + chain: avalanche, + transport: mockTransport, + }), + xChain: createAvalancheBaseClient({ + chain: avalanche, + transport: mockTransport, + }), + }, + indexTx: { + xChain: createAvalancheBaseClient({ + chain: avalanche, + transport: mockTransport, + }), + }, } as any; const avalancheClient = avalancheActions(mockClient); @@ -360,37 +378,41 @@ test("default", async () => { "liveness": [Function], "readiness": [Function], }, - "indexCChainBlock": { - "getContainerByID": [Function], - "getContainerByIndex": [Function], - "getContainerRange": [Function], - "getIndex": [Function], - "getLastAccepted": [Function], - "isAccepted": [Function], - }, - "indexPChainBlock": { - "getContainerByID": [Function], - "getContainerByIndex": [Function], - "getContainerRange": [Function], - "getIndex": [Function], - "getLastAccepted": [Function], - "isAccepted": [Function], + "indexBlock": { + "cChain": { + "getContainerByID": [Function], + "getContainerByIndex": [Function], + "getContainerRange": [Function], + "getIndex": [Function], + "getLastAccepted": [Function], + "isAccepted": [Function], + }, + "pChain": { + "getContainerByID": [Function], + "getContainerByIndex": [Function], + "getContainerRange": [Function], + "getIndex": [Function], + "getLastAccepted": [Function], + "isAccepted": [Function], + }, + "xChain": { + "getContainerByID": [Function], + "getContainerByIndex": [Function], + "getContainerRange": [Function], + "getIndex": [Function], + "getLastAccepted": [Function], + "isAccepted": [Function], + }, }, - "indexXChainBlock": { - "getContainerByID": [Function], - "getContainerByIndex": [Function], - "getContainerRange": [Function], - "getIndex": [Function], - "getLastAccepted": [Function], - "isAccepted": [Function], - }, - "indexXChainTx": { - "getContainerByID": [Function], - "getContainerByIndex": [Function], - "getContainerRange": [Function], - "getIndex": [Function], - "getLastAccepted": [Function], - "isAccepted": [Function], + "indexTx": { + "xChain": { + "getContainerByID": [Function], + "getContainerByIndex": [Function], + "getContainerRange": [Function], + "getIndex": [Function], + "getLastAccepted": [Function], + "isAccepted": [Function], + }, }, "info": { "acps": [Function], @@ -410,6 +432,7 @@ test("default", async () => { "maxPriorityFeePerGas": [Function], "multicall": [Function], "pChain": { + "getAllValidatorsAt": [Function], "getBalance": [Function], "getBlock": [Function], "getBlockByHeight": [Function], @@ -440,6 +463,20 @@ test("default", async () => { "validates": [Function], }, "prepareTransactionRequest": [Function], + "proposervm": { + "cChain": { + "getCurrentEpoch": [Function], + "getProposedHeight": [Function], + }, + "pChain": { + "getCurrentEpoch": [Function], + "getProposedHeight": [Function], + }, + "xChain": { + "getCurrentEpoch": [Function], + "getProposedHeight": [Function], + }, + }, "readContract": [Function], "sendRawTransaction": [Function], "sendRawTransactionSync": [Function], @@ -648,7 +685,7 @@ describe("smoke test", () => { describe("Index API methods", () => { test("getContainerByID", async () => { - const res = await avalancheClient.indexPChainBlock!.getContainerByID({ + const res = await avalancheClient.indexBlock!.pChain!.getContainerByID({ id: "6fXf5hncR8LXvwtM8iezFQBpK5cubV6y1dWgpJCcNyzGB1EzY", encoding: "hex", }); @@ -656,7 +693,7 @@ describe("smoke test", () => { }); test("isAccepted", async () => { - const res = await avalancheClient.indexPChainBlock!.isAccepted({ + const res = await avalancheClient.indexBlock!.pChain!.isAccepted({ id: "6fXf5hncR8LXvwtM8iezFQBpK5cubV6y1dWgpJCcNyzGB1EzY", encoding: "hex", }); @@ -664,6 +701,28 @@ describe("smoke test", () => { }); }); + describe("ProposerVM API methods", () => { + test("getCurrentEpoch C-Chain", async () => { + const res = await avalancheClient.proposervm!.cChain!.getCurrentEpoch(); + expect(res).toBeDefined(); + }); + + test("getProposedHeight C-Chain", async () => { + const res = await avalancheClient.proposervm!.cChain!.getProposedHeight(); + expect(res).toBeDefined(); + }); + + test("getCurrentEpoch P-Chain", async () => { + const res = await avalancheClient.proposervm!.pChain!.getCurrentEpoch(); + expect(res).toBeDefined(); + }); + + test("getProposedHeight X-Chain", async () => { + const res = await avalancheClient.proposervm!.xChain!.getProposedHeight(); + expect(res).toBeDefined(); + }); + }); + describe("Avalanche Public methods", () => { test("baseFee", async () => { const res = await avalancheClient.baseFee(); diff --git a/client/src/clients/decorators/avalanche.ts b/client/src/clients/decorators/avalanche.ts index 1f0c0fa7..5d1abd98 100644 --- a/client/src/clients/decorators/avalanche.ts +++ b/client/src/clients/decorators/avalanche.ts @@ -10,8 +10,8 @@ import { healthAPIActions, HealthAPIActions } from "./healthApi.js"; import { IndexAPIActions, indexAPIActions } from "./indexApi.js"; import { InfoAPIActions, infoAPIActions } from "./infoApi.js"; import { pChainActions, PChainActions } from "./pChain.js"; +import { ProposerVMAPIActions, proposerVMAPIActions } from "./proposervmApi.js"; import { XChainActions, xChainActions } from "./xChain.js"; - export type AvalancheActions = PublicActions & AvalanchePublicActions & { pChain?: PChainActions; @@ -21,10 +21,19 @@ export type AvalancheActions = PublicActions & admin?: AdminAPIActions; info?: InfoAPIActions; health?: HealthAPIActions; - indexPChainBlock?: IndexAPIActions; - indexCChainBlock?: IndexAPIActions; - indexXChainBlock?: IndexAPIActions; - indexXChainTx?: IndexAPIActions; + indexBlock?: { + pChain?: IndexAPIActions; + cChain?: IndexAPIActions; + xChain?: IndexAPIActions; + }; + indexTx?: { + xChain?: IndexAPIActions; + }; + proposervm?: { + cChain?: ProposerVMAPIActions; + pChain?: ProposerVMAPIActions; + xChain?: ProposerVMAPIActions; + }; }; export function avalancheActions< @@ -38,10 +47,17 @@ export function avalancheActions< admin: adminClient, info: infoClient, health: healthClient, - indexPChainBlock: indexPChainBlockClient, - indexCChainBlock: indexCChainBlockClient, - indexXChainBlock: indexXChainBlockClient, - indexXChainTx: indexXChainTxClient, + indexBlock: { + pChain: indexPChainBlockClient, + cChain: indexCChainBlockClient, + xChain: indexXChainBlockClient, + }, + indexTx: { xChain: indexXChainTxClient }, + proposervm: { + cChain: proposervmCChainClient, + pChain: proposervmPChainClient, + xChain: proposervmXChainClient, + }, ...publicClient } = client as any; @@ -54,17 +70,45 @@ export function avalancheActions< ...(infoClient ? { info: infoAPIActions(infoClient) } : {}), ...(healthClient ? { health: healthAPIActions(healthClient) } : {}), ...(adminClient ? { admin: adminAPIActions(adminClient) } : {}), - ...(indexPChainBlockClient - ? { indexPChainBlock: indexAPIActions(indexPChainBlockClient) } - : {}), - ...(indexCChainBlockClient - ? { indexCChainBlock: indexAPIActions(indexCChainBlockClient) } - : {}), - ...(indexXChainBlockClient - ? { indexXChainBlock: indexAPIActions(indexXChainBlockClient) } + ...(indexPChainBlockClient || + indexCChainBlockClient || + indexXChainBlockClient || + indexXChainTxClient + ? { + indexBlock: { + ...(indexPChainBlockClient + ? { pChain: indexAPIActions(indexPChainBlockClient) } + : {}), + ...(indexCChainBlockClient + ? { cChain: indexAPIActions(indexCChainBlockClient) } + : {}), + ...(indexXChainBlockClient + ? { xChain: indexAPIActions(indexXChainBlockClient) } + : {}), + }, + indexTx: { + ...(indexXChainTxClient + ? { xChain: indexAPIActions(indexXChainTxClient) } + : {}), + }, + } : {}), - ...(indexXChainTxClient - ? { indexXChainTx: indexAPIActions(indexXChainTxClient) } + ...(proposervmCChainClient || + proposervmPChainClient || + proposervmXChainClient + ? { + proposervm: { + ...(proposervmCChainClient + ? { cChain: proposerVMAPIActions(proposervmCChainClient) } + : {}), + ...(proposervmPChainClient + ? { pChain: proposerVMAPIActions(proposervmPChainClient) } + : {}), + ...(proposervmXChainClient + ? { xChain: proposerVMAPIActions(proposervmXChainClient) } + : {}), + }, + } : {}), }; } diff --git a/client/src/clients/decorators/pChain.test.ts b/client/src/clients/decorators/pChain.test.ts index e8e4dfe3..2930bc0a 100644 --- a/client/src/clients/decorators/pChain.test.ts +++ b/client/src/clients/decorators/pChain.test.ts @@ -95,6 +95,7 @@ const pChainClient = pChainActions(client); test("default", async () => { expect(pChainClient).toMatchInlineSnapshot(`{ + "getAllValidatorsAt": [Function], "getBalance": [Function], "getBlock": [Function], "getBlockByHeight": [Function], diff --git a/client/src/clients/decorators/pChain.ts b/client/src/clients/decorators/pChain.ts index b0323614..ab94b977 100644 --- a/client/src/clients/decorators/pChain.ts +++ b/client/src/clients/decorators/pChain.ts @@ -1,4 +1,5 @@ import { Chain, Transport } from "viem"; +import { getAllValidatorsAt } from "../../methods/pChain/getAllValidatorsAt.js"; import { getBalance } from "../../methods/pChain/getBalance.js"; import { getBlock } from "../../methods/pChain/getBlock.js"; import { getBlockByHeight } from "../../methods/pChain/getBlockByHeight.js"; @@ -25,6 +26,10 @@ import { getUTXOs } from "../../methods/pChain/getUTXOs.js"; import { getValidatorsAt } from "../../methods/pChain/getValidatorsAt.js"; import { issueTx } from "../../methods/pChain/issueTx.js"; import { sampleValidators } from "../../methods/pChain/sampleValidators.js"; +import { + GetAllValidatorsAtParameters, + GetAllValidatorsAtReturnType, +} from "../../methods/pChain/types/getAllValidatorsAt.js"; import { GetBalanceParameters, GetBalanceReturnType, @@ -777,6 +782,35 @@ export type PChainActions = { args: GetValidatorsAtParameters ) => Promise; + /** + * Get all validators at a specific height across all Subnets and the Primary Network. + * + * - Docs: https://build.avax.network/docs/api-reference/p-chain/api#platformgetallvalidatorsat + * + * @param args - {@link GetAllValidatorsAtParameters} The height + * @returns All validators at that height across all Subnets. {@link GetAllValidatorsAtReturnType} + * + * @example + * ```ts + * import { createAvalancheClient} from '@avalanche-sdk/client' + * import { avalanche } from '@avalanche-sdk/client/chains' + * + * const client = createAvalancheClient({ + * chain: avalanche, + * transport: { + * type: "http", + * }, + * }) + * + * const validators = await client.pChain.getAllValidatorsAt({ + * height: 1000001 + * }) + * ``` + */ + getAllValidatorsAt: ( + args: GetAllValidatorsAtParameters + ) => Promise; + /** * Issue a transaction to the Platform Chain. * @@ -917,6 +951,7 @@ export function pChainActions< getTx: (args) => getTx(client, args), getTxStatus: (args) => getTxStatus(client, args), getUTXOs: (args) => getUTXOs(client, args), + getAllValidatorsAt: (args) => getAllValidatorsAt(client, args), getValidatorsAt: (args) => getValidatorsAt(client, args), issueTx: (args) => issueTx(client, args), sampleValidators: (args) => sampleValidators(client, args), diff --git a/client/src/clients/decorators/proposervmApi.ts b/client/src/clients/decorators/proposervmApi.ts new file mode 100644 index 00000000..130454fa --- /dev/null +++ b/client/src/clients/decorators/proposervmApi.ts @@ -0,0 +1,65 @@ +import { Chain, Transport } from "viem"; +import { getCurrentEpoch } from "../../methods/proposervm/getCurrentEpoch.js"; +import { getProposedHeight } from "../../methods/proposervm/getProposedHeight.js"; +import { GetCurrentEpochReturnType } from "../../methods/proposervm/types/getCurrentEpoch.js"; +import { GetProposedHeightReturnType } from "../../methods/proposervm/types/getProposedHeight.js"; +import { AvalancheCoreClient } from "../createAvalancheCoreClient.js"; + +export type ProposerVMAPIActions = { + /** + * Returns this node's current proposer VM height. + * + * - Docs: https://build.avax.network/docs/api-reference/proposervm-api#proposervmgetproposedheight + * + * @returns This node's current proposer VM height. {@link GetProposedHeightReturnType} + * + * @example + * ```ts + * import { createAvalancheClient} from '@avalanche-sdk/client' + * import { avalanche } from '@avalanche-sdk/client/chains' + * + * const client = createAvalancheClient({ + * chain: avalanche, + * transport: { + * type: "http", + * }, + * }) + * + * const height = await client.proposervm.getProposedHeight() + * ``` + */ + getProposedHeight: () => Promise; + + /** + * Returns the current epoch information. + * + * - Docs: https://build.avax.network/docs/api-reference/proposervm-api#proposervmgetcurrentepoch + * + * @returns The current epoch information. {@link GetCurrentEpochReturnType} + * + * @example + * ```ts + * import { createAvalancheClient} from '@avalanche-sdk/client' + * import { avalanche } from '@avalanche-sdk/client/chains' + * + * const client = createAvalancheClient({ + * chain: avalanche, + * transport: { + * type: "http", + * }, + * }) + * + * const epoch = await client.proposervm.getCurrentEpoch() + * ``` + */ + getCurrentEpoch: () => Promise; +}; + +export function proposerVMAPIActions< + chain extends Chain | undefined = Chain | undefined +>(client: AvalancheCoreClient): ProposerVMAPIActions { + return { + getProposedHeight: () => getProposedHeight(client), + getCurrentEpoch: () => getCurrentEpoch(client), + }; +} diff --git a/client/src/clients/types/createAvalancheClient.ts b/client/src/clients/types/createAvalancheClient.ts index 5aac5038..8731f725 100644 --- a/client/src/clients/types/createAvalancheClient.ts +++ b/client/src/clients/types/createAvalancheClient.ts @@ -15,6 +15,7 @@ import { HealthRpcSchema } from "../../methods/health/healthRpcSchema.js"; import { IndexRpcSchema } from "../../methods/index/indexRpcSchema.js"; import { InfoRpcSchema } from "../../methods/info/infoRpcSchema.js"; import { PChainRpcSchema } from "../../methods/pChain/pChainRpcSchema.js"; +import { ProposerVMRpcSchema } from "../../methods/proposervm/proposervmRpcSchema.js"; import { AvalanchePublicRpcSchema } from "../../methods/public/avalanchePublicRpcSchema.js"; import { XChainRpcSchema } from "../../methods/xChain/xChainRpcSchema.js"; import { @@ -29,6 +30,7 @@ import { HealthAPIActions } from "../decorators/healthApi.js"; import { IndexAPIActions } from "../decorators/indexApi.js"; import { InfoAPIActions } from "../decorators/infoApi.js"; import { PChainActions } from "../decorators/pChain.js"; +import { ProposerVMAPIActions } from "../decorators/proposervmApi.js"; import { XChainActions } from "../decorators/xChain.js"; export type AvalancheClientConfig< @@ -112,37 +114,63 @@ export type AvalancheClient< HealthAPIActions >; - indexPChainBlock: AvalancheCoreClient< - transport, - chain, - accountOrAddress, - IndexRpcSchema, - IndexAPIActions - >; + proposervm: { + cChain: AvalancheCoreClient< + transport, + chain, + accountOrAddress, + ProposerVMRpcSchema, + ProposerVMAPIActions + >; + pChain: AvalancheCoreClient< + transport, + chain, + accountOrAddress, + ProposerVMRpcSchema, + ProposerVMAPIActions + >; + xChain: AvalancheCoreClient< + transport, + chain, + accountOrAddress, + ProposerVMRpcSchema, + ProposerVMAPIActions + >; + }; - indexCChainBlock: AvalancheCoreClient< - transport, - chain, - accountOrAddress, - IndexRpcSchema, - IndexAPIActions - >; + indexBlock: { + pChain: AvalancheCoreClient< + transport, + chain, + accountOrAddress, + IndexRpcSchema, + IndexAPIActions + >; + cChain: AvalancheCoreClient< + transport, + chain, + accountOrAddress, + IndexRpcSchema, + IndexAPIActions + >; + xChain: AvalancheCoreClient< + transport, + chain, + accountOrAddress, + IndexRpcSchema, + IndexAPIActions + >; + }; - indexXChainBlock: AvalancheCoreClient< - transport, - chain, - accountOrAddress, - IndexRpcSchema, - IndexAPIActions - >; - - indexXChainTx: AvalancheCoreClient< - transport, - chain, - accountOrAddress, - IndexRpcSchema, - IndexAPIActions - >; + indexTx: { + xChain: AvalancheCoreClient< + transport, + chain, + accountOrAddress, + IndexRpcSchema, + IndexAPIActions + >; + }; } : {}) >; diff --git a/client/src/clients/types/types.ts b/client/src/clients/types/types.ts index 13721bc6..4ea390b0 100644 --- a/client/src/clients/types/types.ts +++ b/client/src/clients/types/types.ts @@ -51,4 +51,7 @@ export type ClientType = | "indexXChainBlock" | "indexXChainTx" | "health" + | "proposervmCChain" + | "proposervmPChain" + | "proposervmXChain" | "wallet"; diff --git a/client/src/clients/utils.ts b/client/src/clients/utils.ts index a8e44134..c9897f5a 100644 --- a/client/src/clients/utils.ts +++ b/client/src/clients/utils.ts @@ -118,6 +118,12 @@ function getClientURL( return `${origin}/ext/index/X/block`; case "indexXChainTx": return `${origin}/ext/index/X/tx`; + case "proposervmCChain": + return `${origin}/ext/bc/C/proposervm`; + case "proposervmPChain": + return `${origin}/ext/bc/P/proposervm`; + case "proposervmXChain": + return `${origin}/ext/bc/X/proposervm`; default: throw new Error(`Invalid client type` + clientType); } diff --git a/client/src/index.ts b/client/src/index.ts index 9ebca055..63764a04 100644 --- a/client/src/index.ts +++ b/client/src/index.ts @@ -1450,6 +1450,12 @@ export { type PChainClient, type PChainClientConfig, } from "./clients/createPChainClient.js"; +export { + createProposerVMApiClient, + type CreateProposerVMApiClientErrorType, + type ProposerVMApiClient, + type ProposerVMApiClientConfig, +} from "./clients/createProposervmApiClient.js"; export { createXChainClient, type CreateXChainClientErrorType, @@ -1493,6 +1499,10 @@ export { pChainActions, type PChainActions, } from "./clients/decorators/pChain.js"; +export { + proposerVMAPIActions, + type ProposerVMAPIActions, +} from "./clients/decorators/proposervmApi.js"; export { xChainActions, type XChainActions, @@ -1510,6 +1520,7 @@ export { type HealthRpcSchema } from "./methods/health/healthRpcSchema.js"; export { type IndexRpcSchema } from "./methods/index/indexRpcSchema.js"; export { type InfoRpcSchema } from "./methods/info/infoRpcSchema.js"; export { type PChainRpcSchema } from "./methods/pChain/pChainRpcSchema.js"; +export { type ProposerVMRpcSchema } from "./methods/proposervm/proposervmRpcSchema.js"; export { type AvalanchePublicRpcSchema } from "./methods/public/avalanchePublicRpcSchema.js"; export { type AvalancheWalletRpcSchema } from "./methods/wallet/avalancheWalletRPCSchema.js"; export { type XChainRpcSchema } from "./methods/xChain/xChainRpcSchema.js"; diff --git a/client/src/methods/pChain/getAllValidatorsAt.ts b/client/src/methods/pChain/getAllValidatorsAt.ts new file mode 100644 index 00000000..0fb6a40d --- /dev/null +++ b/client/src/methods/pChain/getAllValidatorsAt.ts @@ -0,0 +1,55 @@ +import { Chain, Transport } from "viem"; +import { + AvalancheCoreClient, + AvalancheCoreClient as Client, +} from "../../clients/createAvalancheCoreClient.js"; +import { PChainRpcSchema } from "./pChainRpcSchema.js"; +import { + GetAllValidatorsAtParameters, + GetAllValidatorsAtReturnType, +} from "./types/getAllValidatorsAt.js"; + +/** + * Get all validators at a specific height across all Subnets and the Primary Network. + * + * - Docs: https://build.avax.network/docs/api-reference/p-chain/api#platformgetallvalidatorsat + * + * @param client - The client to use. {@link AvalancheCoreClient} + * @param params - The height {@link GetAllValidatorsAtParameters} + * @returns All validators at that height across all Subnets. {@link GetAllValidatorsAtReturnType} + * + * @example + * ```ts + * import { createAvalancheCoreClient } from '@avalanche-sdk/client' + * import { avalanche } from '@avalanche-sdk/client/chains' + * import { getAllValidatorsAt } from '@avalanche-sdk/client/methods/pChain' + * + * const client = createAvalancheCoreClient({ + * chain: avalanche, + * transport: { + * type: "http", + * url: "", + * }, + * }) + * + * const validators = await getAllValidatorsAt(client, { + * height: 1000001 + * }) + * ``` + */ +export async function getAllValidatorsAt( + client: Client, + params: GetAllValidatorsAtParameters +): Promise { + return client.request< + PChainRpcSchema, + { + method: "platform.getAllValidatorsAt"; + params: GetAllValidatorsAtParameters; + }, + GetAllValidatorsAtReturnType + >({ + method: "platform.getAllValidatorsAt", + params, + }); +} diff --git a/client/src/methods/pChain/index.ts b/client/src/methods/pChain/index.ts index 26eb5f3a..6cf06f49 100644 --- a/client/src/methods/pChain/index.ts +++ b/client/src/methods/pChain/index.ts @@ -159,6 +159,13 @@ export { type GetUTXOsReturnType, } from "./types/getUTXOs.js"; +export { getAllValidatorsAt } from "./getAllValidatorsAt.js"; +export { + type GetAllValidatorsAtErrorType, + type GetAllValidatorsAtParameters, + type GetAllValidatorsAtReturnType, +} from "./types/getAllValidatorsAt.js"; + export { getValidatorsAt } from "./getValidatorsAt.js"; export { type GetValidatorsAtErrorType, diff --git a/client/src/methods/pChain/pChainRpcSchema.ts b/client/src/methods/pChain/pChainRpcSchema.ts index f463eb75..e3c6e482 100644 --- a/client/src/methods/pChain/pChainRpcSchema.ts +++ b/client/src/methods/pChain/pChainRpcSchema.ts @@ -1,4 +1,5 @@ import { RpcSchemaOverride } from "viem"; +import { GetAllValidatorsAtMethod } from "./types/getAllValidatorsAt.js"; import { GetBalanceMethod } from "./types/getBalance.js"; import { GetBlockMethod } from "./types/getBlock.js"; import { GetBlockByHeightMethod } from "./types/getBlockByHeight.js"; @@ -52,6 +53,7 @@ export type PChainMethods = [ GetTxMethod, GetTxStatusMethod, GetUTXOsMethod, + GetAllValidatorsAtMethod, GetValidatorsAtMethod, IssueTxMethod, SampleValidatorsMethod, diff --git a/client/src/methods/pChain/types/getAllValidatorsAt.ts b/client/src/methods/pChain/types/getAllValidatorsAt.ts new file mode 100644 index 00000000..9a057b7f --- /dev/null +++ b/client/src/methods/pChain/types/getAllValidatorsAt.ts @@ -0,0 +1,36 @@ +import { RequestErrorType } from "viem/utils"; + +/** + * Parameters for the `platform.getAllValidatorsAt` method. + * Get all validators at a given height across all Subnets and the Primary Network. + * @property height - The P-Chain height to get validators at, or "proposed" to return the validator set at the node's ProposerVM height + */ +export type GetAllValidatorsAtParameters = { + height: number | "proposed"; +}; + +/** + * Return type for the `platform.getAllValidatorsAt` method. + * @property validatorSets - A map of Subnet IDs to their validator information + */ +export type GetAllValidatorsAtReturnType = { + validatorSets: Record< + string, + { + validators: Array<{ + publicKey: string; + weight: string; + nodeIDs: string[]; + }>; + totalWeight: string; + } + >; +}; + +export type GetAllValidatorsAtErrorType = RequestErrorType; + +export type GetAllValidatorsAtMethod = { + Method: "platform.getAllValidatorsAt"; + Parameters: GetAllValidatorsAtParameters; + ReturnType: GetAllValidatorsAtReturnType; +}; diff --git a/client/src/methods/proposervm/getCurrentEpoch.ts b/client/src/methods/proposervm/getCurrentEpoch.ts new file mode 100644 index 00000000..0ff917aa --- /dev/null +++ b/client/src/methods/proposervm/getCurrentEpoch.ts @@ -0,0 +1,45 @@ +import { Chain, Transport } from "viem"; +import { + AvalancheCoreClient, + AvalancheCoreClient as Client, +} from "../../clients/createAvalancheCoreClient.js"; +import { ProposerVMRpcSchema } from "../../methods/proposervm/proposervmRpcSchema.js"; +import { GetCurrentEpochReturnType } from "./types/getCurrentEpoch.js"; + +/** + * Returns the current epoch information. + * + * - Docs: https://build.avax.network/docs/api-reference/proposervm-api#proposervmgetcurrentepoch + * + * @param client - The client to use. {@link AvalancheCoreClient} + * @returns The current epoch information. {@link GetCurrentEpochReturnType} + * + * @example + * ```ts + * import { createAvalancheCoreClient } from '@avalanche-sdk/client' + * import { avalanche } from '@avalanche-sdk/client/chains' + * import { getCurrentEpoch } from '@avalanche-sdk/client/methods/proposervm' + * + * const client = createAvalancheCoreClient({ + * chain: avalanche, + * transport: { + * type: "http", + * url: "", + * }, + * }) + * + * const epoch = await getCurrentEpoch(client) + * ``` + */ +export async function getCurrentEpoch( + client: Client +): Promise { + return client.request< + ProposerVMRpcSchema, + { method: "proposervm.getCurrentEpoch"; params: {} }, + GetCurrentEpochReturnType + >({ + method: "proposervm.getCurrentEpoch", + params: {}, + }); +} diff --git a/client/src/methods/proposervm/getProposedHeight.ts b/client/src/methods/proposervm/getProposedHeight.ts new file mode 100644 index 00000000..76c7fbf3 --- /dev/null +++ b/client/src/methods/proposervm/getProposedHeight.ts @@ -0,0 +1,45 @@ +import { Chain, Transport } from "viem"; +import { + AvalancheCoreClient, + AvalancheCoreClient as Client, +} from "../../clients/createAvalancheCoreClient.js"; +import { ProposerVMRpcSchema } from "../../methods/proposervm/proposervmRpcSchema.js"; +import { GetProposedHeightReturnType } from "./types/getProposedHeight.js"; + +/** + * Returns this node's current proposer VM height. + * + * - Docs: https://build.avax.network/docs/api-reference/proposervm-api#proposervmgetproposedheight + * + * @param client - The client to use. {@link AvalancheCoreClient} + * @returns This node's current proposer VM height. {@link GetProposedHeightReturnType} + * + * @example + * ```ts + * import { createAvalancheCoreClient } from '@avalanche-sdk/client' + * import { avalanche } from '@avalanche-sdk/client/chains' + * import { getProposedHeight } from '@avalanche-sdk/client/methods/proposervm' + * + * const client = createAvalancheCoreClient({ + * chain: avalanche, + * transport: { + * type: "http", + * url: "", + * }, + * }) + * + * const height = await getProposedHeight(client) + * ``` + */ +export async function getProposedHeight( + client: Client +): Promise { + return client.request< + ProposerVMRpcSchema, + { method: "proposervm.getProposedHeight"; params: {} }, + GetProposedHeightReturnType + >({ + method: "proposervm.getProposedHeight", + params: {}, + }); +} diff --git a/client/src/methods/proposervm/index.ts b/client/src/methods/proposervm/index.ts new file mode 100644 index 00000000..e4a92586 --- /dev/null +++ b/client/src/methods/proposervm/index.ts @@ -0,0 +1,11 @@ +export { getProposedHeight } from "./getProposedHeight.js"; +export type { + GetProposedHeightErrorType, + GetProposedHeightReturnType, +} from "./types/getProposedHeight.js"; + +export { getCurrentEpoch } from "./getCurrentEpoch.js"; +export type { + GetCurrentEpochErrorType, + GetCurrentEpochReturnType, +} from "./types/getCurrentEpoch.js"; diff --git a/client/src/methods/proposervm/proposervmRpcSchema.ts b/client/src/methods/proposervm/proposervmRpcSchema.ts new file mode 100644 index 00000000..9a0ebe5a --- /dev/null +++ b/client/src/methods/proposervm/proposervmRpcSchema.ts @@ -0,0 +1,15 @@ +import { RpcSchemaOverride } from "viem"; +import { GetCurrentEpochMethod } from "./types/getCurrentEpoch.js"; +import { GetProposedHeightMethod } from "./types/getProposedHeight.js"; + +export type ProposerVMMethods = [ + GetProposedHeightMethod, + GetCurrentEpochMethod +]; + +/** + * The RPC schema for the ProposerVM methods. + * + * @see {@link ProposerVMMethods} + */ +export type ProposerVMRpcSchema = RpcSchemaOverride & ProposerVMMethods; diff --git a/client/src/methods/proposervm/types/getCurrentEpoch.ts b/client/src/methods/proposervm/types/getCurrentEpoch.ts new file mode 100644 index 00000000..a9cf180c --- /dev/null +++ b/client/src/methods/proposervm/types/getCurrentEpoch.ts @@ -0,0 +1,21 @@ +import { RequestErrorType } from "viem/utils"; + +/** + * Return type for the proposervm.getCurrentEpoch method. + * @property number - The current epoch number + * @property startTime - The epoch start time (Unix timestamp) + * @property pChainHeight - The P-Chain height at the start of this epoch + */ +export type GetCurrentEpochReturnType = { + number: string; + startTime: string; + pChainHeight: string; +}; + +export type GetCurrentEpochErrorType = RequestErrorType; + +export type GetCurrentEpochMethod = { + Method: "proposervm.getCurrentEpoch"; + Parameters: {}; + ReturnType: GetCurrentEpochReturnType; +}; diff --git a/client/src/methods/proposervm/types/getProposedHeight.ts b/client/src/methods/proposervm/types/getProposedHeight.ts new file mode 100644 index 00000000..d70fe39a --- /dev/null +++ b/client/src/methods/proposervm/types/getProposedHeight.ts @@ -0,0 +1,17 @@ +import { RequestErrorType } from "viem/utils"; + +/** + * Return type for the proposervm.getProposedHeight method. + * @property height - This node's current proposer VM height + */ +export type GetProposedHeightReturnType = { + height: string; +}; + +export type GetProposedHeightErrorType = RequestErrorType; + +export type GetProposedHeightMethod = { + Method: "proposervm.getProposedHeight"; + Parameters: {}; + ReturnType: GetProposedHeightReturnType; +}; From 5d1246d19f3f5788d0229c6bd5c4ca1b5c7240d4 Mon Sep 17 00:00:00 2001 From: Sayan kar Date: Mon, 3 Nov 2025 17:02:48 +0530 Subject: [PATCH 3/8] chore: add avalanche specific block types --- client/package-lock.json | 3 +- client/src/index.ts | 4 +- client/src/types/block.ts | 117 +++++++++++++++++++++++++++++++++++ client/src/types/global.d.ts | 19 ++++++ client/tsconfig.json | 3 +- 5 files changed, 143 insertions(+), 3 deletions(-) create mode 100644 client/src/types/block.ts create mode 100644 client/src/types/global.d.ts diff --git a/client/package-lock.json b/client/package-lock.json index 35fc67f7..0e476918 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -5596,7 +5596,8 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "dev": true, - "license": "0BSD" + "license": "0BSD", + "peer": true }, "node_modules/tty-browserify": { "version": "0.0.1", diff --git a/client/src/index.ts b/client/src/index.ts index 63764a04..d1a4fa98 100644 --- a/client/src/index.ts +++ b/client/src/index.ts @@ -899,7 +899,7 @@ export type { AuthorizationRequest, BlobSidecar, BlobSidecars, - Block, + // Block is exported separately below from our augmented type (includes Avalanche-specific fields) BlockIdentifier, BlockNumber, BlockTag, @@ -1524,3 +1524,5 @@ export { type ProposerVMRpcSchema } from "./methods/proposervm/proposervmRpcSche export { type AvalanchePublicRpcSchema } from "./methods/public/avalanchePublicRpcSchema.js"; export { type AvalancheWalletRpcSchema } from "./methods/wallet/avalancheWalletRPCSchema.js"; export { type XChainRpcSchema } from "./methods/xChain/xChainRpcSchema.js"; +// Augment viem's Block type with Avalanche-specific fields +export type { Block } from "./types/block.js"; diff --git a/client/src/types/block.ts b/client/src/types/block.ts new file mode 100644 index 00000000..9dc19d0f --- /dev/null +++ b/client/src/types/block.ts @@ -0,0 +1,117 @@ +/** + * Extended Block type that includes Avalanche-specific fields in addition to all viem Block fields. + * + * This type extends viem's Block type with Avalanche-specific fields that are present in + * Avalanche network blocks. All existing viem Block fields are preserved, and the following + * Avalanche-specific fields are added as optional properties: + * + * **Timing Fields:** + * - `timestampMilliseconds?: Hex` - Block timestamp in milliseconds (Avalanche-specific) + * - `minDelayExcess?: Hex` - Minimum delay excess in the Avalanche network + * + * **Gas / Data Fields:** + * - `blockGasCost?: bigint` - The block gas cost in the Avalanche network + * - `extDataGasUsed?: bigint` - The external data gas used in the Avalanche network + * - `extDataHash?: Hex` - The hash of external data in the Avalanche network + * + * **Metadata Fields:** + * - `blockExtraData?: Hex` - Extra block data in the Avalanche network + * + * @example + * ```ts + * import { Block } from '@avalanche-sdk/client/types' + * import { getBlock } from 'viem' + * + * const block: Block = await getBlock(client, { blockNumber: 123n }) + * // block now includes all viem Block fields plus: + * // block.blockGasCost, block.extDataGasUsed, block.extDataHash, + * // block.blockExtraData, block.timestampMilliseconds, block.minDelayExcess + * ``` + */ +import type { + Address, + BlockTag, + Hash, + Hex, + Transaction, + Withdrawal, +} from "viem"; +// Import viem's Block type directly from its internal module path to avoid circular reference +// This bypasses the module augmentation in global.d.ts that would cause a circular dependency + +export type Block< + quantity = bigint, + includeTransactions extends boolean = boolean, + blockTag extends BlockTag = BlockTag, + transaction = Transaction< + bigint, + number, + blockTag extends "pending" ? true : false + > +> = { + /** Base fee per gas */ + baseFeePerGas: quantity | null; + /** Total used blob gas by all transactions in this block */ + blobGasUsed: quantity; + /** Difficulty for this block */ + difficulty: quantity; + /** Excess blob gas */ + excessBlobGas: quantity; + /** "Extra data" field of this block */ + extraData: Hex; + /** Maximum gas allowed in this block */ + gasLimit: quantity; + /** Total used gas by all transactions in this block */ + gasUsed: quantity; + /** Block hash or `null` if pending */ + hash: blockTag extends "pending" ? null : Hash; + /** Logs bloom filter or `null` if pending */ + logsBloom: blockTag extends "pending" ? null : Hex; + /** Address that received this block’s mining rewards, COINBASE address */ + miner: Address; + /** Unique identifier for the block. */ + mixHash: Hash; + /** Proof-of-work hash or `null` if pending */ + nonce: blockTag extends "pending" ? null : Hex; + /** Block number or `null` if pending */ + number: blockTag extends "pending" ? null : quantity; + /** Root of the parent beacon chain block */ + parentBeaconBlockRoot?: Hex | undefined; + /** Parent block hash */ + parentHash: Hash; + /** Root of the this block’s receipts trie */ + receiptsRoot: Hex; + sealFields: Hex[]; + /** SHA3 of the uncles data in this block */ + sha3Uncles: Hash; + /** Size of this block in bytes */ + size: quantity; + /** Root of this block’s final state trie */ + stateRoot: Hash; + /** Unix timestamp of when this block was collated */ + timestamp: quantity; + /** Total difficulty of the chain until this block */ + totalDifficulty: quantity | null; + /** List of transaction objects or hashes */ + transactions: includeTransactions extends true ? transaction[] : Hash[]; + /** Root of this block’s transaction trie */ + transactionsRoot: Hash; + /** List of uncle hashes */ + uncles: Hash[]; + /** List of withdrawal objects */ + withdrawals?: Withdrawal[] | undefined; + /** Root of the this block’s withdrawals trie */ + withdrawalsRoot?: Hex | undefined; + /** Block gas cost in the Avalanche network. */ + blockGasCost?: bigint; + /** External data gas used in the Avalanche network. */ + extDataGasUsed?: bigint; + /** Hash of external data in the Avalanche network. */ + extDataHash?: Hex; + /** Extra block data in the Avalanche network. */ + blockExtraData?: Hex; + /** Block timestamp in milliseconds (Avalanche-specific). */ + timestampMilliseconds?: Hex; + /** Minimum delay excess in the Avalanche network. */ + minDelayExcess?: Hex; +}; diff --git a/client/src/types/global.d.ts b/client/src/types/global.d.ts new file mode 100644 index 00000000..3dd7376b --- /dev/null +++ b/client/src/types/global.d.ts @@ -0,0 +1,19 @@ +// Type augmentation for viem's Block module to use Avalanche-specific Block type +import "viem"; +import type { BlockTag, Transaction } from "viem"; +import type { Block as AvalancheBlock } from "./block.js"; + +declare module "viem" { + export type Block< + quantity = bigint, + includeTransactions extends boolean = boolean, + blockTag extends BlockTag = BlockTag, + transaction = Transaction< + bigint, + number, + blockTag extends "pending" ? true : false + > + > = AvalancheBlock; +} + +export {}; diff --git a/client/tsconfig.json b/client/tsconfig.json index 77d7ccd5..91332ee6 100644 --- a/client/tsconfig.json +++ b/client/tsconfig.json @@ -36,7 +36,8 @@ "forceConsistentCasingInFileNames": true, "rootDir": "src", "baseUrl": ".", - "moduleDetection": "force" + "moduleDetection": "force", + "types": ["./src/types/global.d.ts"] }, "include": ["src/**/*"], "exclude": ["node_modules/", "dist", "**/*.test.ts", "node_modules/viem/**/*"] From e9feb27daa7716983f455fec80c85d1dc707b304 Mon Sep 17 00:00:00 2001 From: Sayan kar Date: Mon, 3 Nov 2025 17:09:52 +0530 Subject: [PATCH 4/8] chore: modify codeowners file to include data-platform team --- .github/CODEOWNERS | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index fbffbcfc..62fddbb4 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1,6 @@ -* @SayanKar \ No newline at end of file +# CODEOWNERS file for Avalanche SDK TypeScript +# This file defines code owners who will be automatically requested for review +# when changes are made to the corresponding paths. +# +# Default owners for the entire repository +* @SayanKar @rajranjan0608 @ava-labs/data-platform \ No newline at end of file From 6926408901ed83ed864764381bb555b97a898111 Mon Sep 17 00:00:00 2001 From: Sayan kar Date: Mon, 3 Nov 2025 17:45:45 +0530 Subject: [PATCH 5/8] chore: modify naming to be consistent and add docs to readme --- client/README.md | 31 +++++++++++++- client/package.json | 8 ++++ client/src/clients/createAvalancheClient.ts | 33 ++++++++------- .../src/clients/createProposervmApiClient.ts | 40 +++++++++---------- .../src/clients/decorators/avalanche.test.ts | 2 +- client/src/clients/decorators/avalanche.ts | 14 +++---- .../src/clients/decorators/proposervmApi.ts | 6 +-- .../clients/types/createAvalancheClient.ts | 16 ++++---- client/src/index.ts | 14 +++---- .../pChain/types/getAllValidatorsAt.ts | 2 +- .../src/methods/proposervm/getCurrentEpoch.ts | 4 +- .../methods/proposervm/getProposedHeight.ts | 4 +- .../methods/proposervm/proposervmRpcSchema.ts | 8 ++-- 13 files changed, 111 insertions(+), 71 deletions(-) diff --git a/client/README.md b/client/README.md index ef1d21a5..1265899d 100644 --- a/client/README.md +++ b/client/README.md @@ -37,7 +37,8 @@ const cChainClient = client.cChain const adminClient = client.admin const infoClient = client.info const healthClient = client.health -const indexPChainBlockClient = client.indexPChainBlock +const indexPChainBlockClient = client.indexBlock.pChain +const proposervmCChainClient = client.proposervm // Example: Get the latest block number const blockNumber = await pChainClient.getBlockNumber() @@ -176,6 +177,7 @@ const exportTx = await cChainWallet.prepareExportTxn({ - Index C-Chain Block - Index X-Chain Block - Index X-Chain Transaction +- **proposervm Client**: Proposer VM Information ### Wallet Clients @@ -208,6 +210,7 @@ const client = createAvalancheClient({ The SDK supports multiple transport types for connecting to Avalanche nodes. Each transport type has specific configuration options: #### HTTP Transport (Recommended) + ```typescript const client = createAvalancheClient({ chain: avalanche, @@ -230,12 +233,14 @@ const client = createAvalancheClient({ ``` **HTTP Transport Features:** + - **Automatic URL Resolution**: If no URL is provided, uses the chain's default RPC endpoint - **Custom Headers**: Support for custom HTTP headers via `fetchOptions.headers` - **API Key Support**: Automatically adds `x-glacier-api-key` header when `apiKey` is provided - **Rate Limit Support**: Automatically adds `rlToken` header when `rlToken` is provided #### WebSocket Transport + ```typescript const client = createAvalancheClient({ chain: avalanche, @@ -252,11 +257,13 @@ const client = createAvalancheClient({ ``` **WebSocket Transport Features:** + - **Real-time Updates**: Supports WebSocket connections for live data - **Automatic Reconnection**: Built-in retry logic with configurable retry count and delay - **Event-driven**: Ideal for subscribing to blockchain events and real-time updates #### Custom Transport + ```typescript const client = createAvalancheClient({ chain: avalanche, @@ -271,11 +278,13 @@ const client = createAvalancheClient({ ``` **Custom Transport Features:** + - **Provider Integration**: Integrate with custom RPC providers or middleware - **Flexible Configuration**: Full control over transport behavior - **Wallet Support**: Special handling for wallet clients #### Fallback Transport + ```typescript const client = createAvalancheClient({ chain: avalanche, @@ -295,11 +304,13 @@ const client = createAvalancheClient({ ``` **Fallback Transport Features:** + - **High Availability**: Automatic failover between multiple RPC endpoints ### Advanced Configuration Examples #### Custom HTTP Headers and Timeouts + ```typescript const client = createAvalancheClient({ chain: avalanche, @@ -317,6 +328,7 @@ const client = createAvalancheClient({ ``` #### Multiple Fallback Endpoints + ```typescript const client = createAvalancheClient({ chain: avalanche, @@ -336,6 +348,7 @@ const client = createAvalancheClient({ ``` #### WebSocket with Custom Configuration + ```typescript const client = createAvalancheClient({ chain: avalanche, @@ -436,6 +449,9 @@ import { /* Health methods */ } from '@avalanche-sdk/client/methods/health' // Index methods import { /* Index methods */ } from '@avalanche-sdk/client/methods/index' + +// proposervm methods +import { /* proposervm methods */ } from '@avalanche-sdk/client/methods/proposervm' ``` ### Utilities @@ -507,6 +523,7 @@ import { /* Window utilities */ } from '@avalanche-sdk/client/window' - [`sampleValidators`](./src/methods/pChain/sampleValidators.ts) - Samples validators from the specified Subnet. [Docs](https://build.avax.network/docs/api-reference/p-chain/api#platformsamplevalidators) - [`validatedBy`](./src/methods/pChain/validatedBy.ts) - Gets the Subnet that validates a given blockchain. [Docs](https://build.avax.network/docs/api-reference/p-chain/api#platformvalidatedby) - [`validates`](./src/methods/pChain/validates.ts) - Gets the IDs of the blockchains a Subnet validates. [Docs](https://build.avax.network/docs/api-reference/p-chain/api#platformvalidates) +- [`getAllValidatorsAt`](./src/methods/pChain/getAllValidatorsAt.ts) - Get the validators and their weights of all L1s and the Primary Network at a given P-Chain height. [Docs](https://build.avax.network/docs/api-reference/p-chain/api#platformgetallvalidatorsat) ### X-Chain Methods @@ -619,6 +636,10 @@ import { /* Window utilities */ } from '@avalanche-sdk/client/window' - [`getLastAccepted`](./src/methods/index/getLastAccepted.ts) - Get the last accepted container. [Docs](https://build.avax.network/docs/api-reference/index-api#indexgetlastaccepted) - [`isAccepted`](./src/methods/index/isAccepted.ts) - Returns true if the container is in this index. [Docs](https://build.avax.network/docs/api-reference/index-api#indexisaccepted) +### proposervm Methods +- [`getCurrentEpoch`](./src/methods/proposervm/getCurrentEpoch.ts) - Returns the current epoch information. [Docs](https://build.avax.network/docs/api-reference/proposervm-api#proposervmgetcurrentepoch) +- [`getProposedHeight`](./src/methods/proposervm/getProposedHeight.ts) - Returns this node's current proposer VM height. [Docs](https://build.avax.network/docs/api-reference/proposervm-api#proposervmgetproposedheight) + ## Examples > **Note:** Make sure to create your own `.env` file by copying the `.env.example` file and updating the values. You'll also need to modify the `config.ts` file to point to your `.env` file path. By default, the examples use the values from `.env.example`, and the test addresses mentioned in the examples as comments (like `0x76Dd3d7b2f635c2547B861e55aE8A374E587742D` and `X-fuji19fc97zn3mzmwr827j4d3n45refkksgms4y2yzz`) are derived from the private key values in that file. @@ -626,12 +647,15 @@ import { /* Window utilities */ } from '@avalanche-sdk/client/window' Check out the [examples](./examples) folder for comprehensive usage examples: ### Basic Examples + - [`sendAvax.ts`](./examples/sendAvax.ts) - Basic example of sending AVAX using the SDK ### Primary Network Transaction Examples + The [`prepare-primary-network-txns`](./examples/prepare-primary-network-txns) folder contains examples for preparing various types of transactions: #### Cross-Chain Transfer Examples + - [`transfer-avax-from-x-chain-to-p-chain.ts`](./examples/prepare-primary-network-txns/transfer-avax-from-x-chain-to-p-chain.ts) - Transfer AVAX from X-Chain to P-Chain - [`transfer-avax-from-p-chain-to-x-chain.ts`](./examples/prepare-primary-network-txns/transfer-avax-from-p-chain-to-x-chain.ts) - Transfer AVAX from P-Chain to X-Chain - [`transfer-avax-from-x-chain-to-c-chain.ts`](./examples/prepare-primary-network-txns/transfer-avax-from-x-chain-to-c-chain.ts) - Transfer AVAX from X-Chain to C-Chain @@ -640,10 +664,12 @@ The [`prepare-primary-network-txns`](./examples/prepare-primary-network-txns) fo - [`transfer-avax-from-c-chain-to-p-chain.ts`](./examples/prepare-primary-network-txns/transfer-avax-from-c-chain-to-p-chain.ts) - Transfer AVAX from C-Chain to P-Chain #### X-Chain Transaction Examples + - [`exportTx.ts`](./examples/prepare-primary-network-txns/x-chain/exportTx.ts) - Prepare X-Chain export transaction - [`importTx.ts`](./examples/prepare-primary-network-txns/x-chain/importTx.ts) - Prepare X-Chain import transaction #### P-Chain Transaction Examples + - [`addSubnetValidatorTx.ts`](./examples/prepare-primary-network-txns/p-chain/addSubnetValidatorTx.ts) - Add subnet validator transaction - [`baseTx.ts`](./examples/prepare-primary-network-txns/p-chain/baseTx.ts) - Base transaction example - [`convertSubnetToL1Tx.ts`](./examples/prepare-primary-network-txns/p-chain/convertSubnetToL1Tx.ts) - Convert subnet to L1 transaction @@ -654,6 +680,7 @@ The [`prepare-primary-network-txns`](./examples/prepare-primary-network-txns) fo - [`removeSubnetValidatorTx.ts`](./examples/prepare-primary-network-txns/p-chain/removeSubnetValidatorTx.ts) - Remove subnet validator transaction #### C-Chain Transaction Examples + - [`exportTx.ts`](./examples/prepare-primary-network-txns/c-chain/exportTx.ts) - Prepare C-Chain export transaction - [`importTx.ts`](./examples/prepare-primary-network-txns/c-chain/importTx.ts) - Prepare C-Chain import transaction @@ -679,4 +706,4 @@ If you encounter any issues or have questions, please: - [GitHub Repository](https://github.com/ava-labs/avalanche-sdk-typescript) - [Documentation](https://github.com/ava-labs/avalanche-sdk-typescript/tree/main/client#readme) -- [Issue Tracker](https://github.com/ava-labs/avalanche-sdk-typescript/issues) \ No newline at end of file +- [Issue Tracker](https://github.com/ava-labs/avalanche-sdk-typescript/issues) diff --git a/client/package.json b/client/package.json index 6573336b..391016fc 100644 --- a/client/package.json +++ b/client/package.json @@ -165,6 +165,11 @@ "import": "./dist/_esm/methods/index/index.js", "require": "./dist/_cjs/methods/index/index.js" }, + "./methods/proposervm": { + "types": "./dist/_types/methods/proposervm/index.d.ts", + "import": "./dist/_esm/methods/proposervm/index.js", + "require": "./dist/_cjs/methods/proposervm/index.js" + }, "./methods/info": { "types": "./dist/_types/methods/info/index.d.ts", "import": "./dist/_esm/methods/info/index.js", @@ -256,6 +261,9 @@ "methods/index": [ "./dist/_types/methods/index/index.d.ts" ], + "methods/proposervm": [ + "./dist/_types/methods/proposervm/index.d.ts" + ], "methods/info": [ "./dist/_types/methods/info/index.d.ts" ], diff --git a/client/src/clients/createAvalancheClient.ts b/client/src/clients/createAvalancheClient.ts index ac70a2f7..d80f21ee 100644 --- a/client/src/clients/createAvalancheClient.ts +++ b/client/src/clients/createAvalancheClient.ts @@ -15,7 +15,7 @@ import { createHealthApiClient } from "./createHealthApiClient.js"; import { createIndexApiClient } from "./createIndexApiClient.js"; import { createInfoApiClient } from "./createInfoApiClient.js"; import { createPChainClient } from "./createPChainClient.js"; -import { createProposerVMApiClient } from "./createProposervmApiClient.js"; +import { createProposervmApiClient } from "./createProposervmApiClient.js"; import { createXChainClient } from "./createXChainClient.js"; import { adminAPIActions } from "./decorators/adminApi.js"; import { avalanchePublicActions } from "./decorators/avalanchePublic.js"; @@ -24,7 +24,7 @@ import { healthAPIActions } from "./decorators/healthApi.js"; import { indexAPIActions } from "./decorators/indexApi.js"; import { infoAPIActions } from "./decorators/infoApi.js"; import { pChainActions } from "./decorators/pChain.js"; -import { proposerVMAPIActions } from "./decorators/proposervmApi.js"; +import { proposervmAPIActions } from "./decorators/proposervmApi.js"; import { xChainActions } from "./decorators/xChain.js"; import { AvalancheClient, @@ -42,7 +42,7 @@ import { createAvalancheTransportClient } from "./utils.js"; * - Admin API * - Info API * - Health API - * - ProposerVM API + * - proposervm API * - Index API * * @param parameters - {@link AvalancheClientConfig} @@ -69,8 +69,13 @@ import { createAvalancheTransportClient } from "./utils.js"; * const adminClient = client.admin * const infoClient = client.info * const healthClient = client.health - * const proposervmClient = client.proposervm - * const indexPChainBlockClient = client.indexPChainBlock + * const proposervmCChainClient = client.proposervm.cChain + * const proposervmPChainClient = client.proposervm.pChain + * const proposervmXChainClient = client.proposervm.xChain + * const indexPChainBlockClient = client.indexBlock.pChain + * const indexCChainBlockClient = client.indexBlock.cChain + * const indexXChainBlockClient = client.indexBlock.xChain + * const indexXChainTxClient = client.indexTx.xChain * * // Get the latest block number * const blockNumber = await client.pChain.getBlockNumber() @@ -172,26 +177,26 @@ export function createAvalancheClient< }).extend(healthAPIActions), proposervm: { - cChain: createProposerVMApiClient({ + cChain: createProposervmApiClient({ ...parameters, key: "proposervm", - name: "ProposerVM Client", + name: "proposervm Client", clientType: "proposervmCChain", - }).extend(proposerVMAPIActions) as any, + }).extend(proposervmAPIActions) as any, - pChain: createProposerVMApiClient({ + pChain: createProposervmApiClient({ ...parameters, key: "proposervm", - name: "ProposerVM Client", + name: "proposervm Client", clientType: "proposervmPChain", - }).extend(proposerVMAPIActions) as any, + }).extend(proposervmAPIActions) as any, - xChain: createProposerVMApiClient({ + xChain: createProposervmApiClient({ ...parameters, key: "proposervm", - name: "ProposerVM Client", + name: "proposervm Client", clientType: "proposervmXChain", - }).extend(proposerVMAPIActions) as any, + }).extend(proposervmAPIActions) as any, } as any, indexBlock: { diff --git a/client/src/clients/createProposervmApiClient.ts b/client/src/clients/createProposervmApiClient.ts index 836e0cf0..c0987d28 100644 --- a/client/src/clients/createProposervmApiClient.ts +++ b/client/src/clients/createProposervmApiClient.ts @@ -7,19 +7,19 @@ import { RpcSchema, Transport, } from "viem"; -import { ProposerVMRpcSchema } from "../methods/proposervm/proposervmRpcSchema.js"; +import { ProposervmRpcSchema } from "../methods/proposervm/proposervmRpcSchema.js"; import { AvalancheCoreClient, createAvalancheCoreClient, CreateAvalancheCoreClientErrorType, } from "./createAvalancheCoreClient.js"; import { - proposerVMAPIActions, - ProposerVMAPIActions, + proposervmAPIActions, + ProposervmAPIActions, } from "./decorators/proposervmApi.js"; import { AvalancheClientConfig } from "./types/createAvalancheClient.js"; -export type ProposerVMApiClientConfig< +export type ProposervmApiClientConfig< transport extends Transport, chain extends Chain | undefined = Chain | undefined, accountOrAddress extends Account | Address | undefined = undefined, @@ -31,7 +31,7 @@ export type ProposerVMApiClientConfig< } >; -export type ProposerVMApiClient< +export type ProposervmApiClient< transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, accountOrAddress extends Account | undefined = undefined, @@ -42,29 +42,29 @@ export type ProposerVMApiClient< chain, accountOrAddress, rpcSchema extends RpcSchema - ? [...ProposerVMRpcSchema, ...rpcSchema] - : ProposerVMRpcSchema, - ProposerVMAPIActions + ? [...ProposervmRpcSchema, ...rpcSchema] + : ProposervmRpcSchema, + ProposervmAPIActions > >; -export type CreateProposerVMApiClientErrorType = +export type CreateProposervmApiClientErrorType = CreateAvalancheCoreClientErrorType; /** - * Creates a ProposerVM API Client with a given transport configured for a Chain. + * Creates a proposervm API Client with a given transport configured for a Chain. * - * The ProposerVM API Client is an interface to interact with the ProposerVM API through Avalanche-specific JSON-RPC API methods. + * The proposervm API Client is an interface to interact with the proposervm API through Avalanche-specific JSON-RPC API methods. * - * @param parameters - {@link ProposerVMApiClientConfig} - * @returns A ProposerVM API Client. {@link ProposerVMApiClient} + * @param parameters - {@link ProposervmApiClientConfig} + * @returns A proposervm API Client. {@link ProposervmApiClient} * * @example * ```ts - * import { createProposerVMApiClient} from '@avalanche-sdk/client' + * import { createProposervmApiClient} from '@avalanche-sdk/client' * import { avalanche } from '@avalanche-sdk/client/chains' * - * const client = createProposerVMApiClient({ + * const client = createProposervmApiClient({ * chain: avalanche, * transport: { * type: "http", @@ -78,21 +78,21 @@ export type CreateProposerVMApiClientErrorType = * const epoch = await client.getCurrentEpoch() * ``` */ -export function createProposerVMApiClient< +export function createProposervmApiClient< transport extends Transport, chain extends Chain | undefined = undefined, accountOrAddress extends Account | Address | undefined = undefined, rpcSchema extends RpcSchema | undefined = undefined, raw extends boolean = false >( - parameters: ProposerVMApiClientConfig< + parameters: ProposervmApiClientConfig< transport, chain, accountOrAddress, rpcSchema, raw > -): ProposerVMApiClient< +): ProposervmApiClient< transport, chain, ParseAccount, @@ -100,7 +100,7 @@ export function createProposerVMApiClient< > { const { key = "proposervm", - name = "ProposerVM API Client", + name = "proposervm API Client", clientType, } = parameters; @@ -111,5 +111,5 @@ export function createProposerVMApiClient< clientType, }); - return client.extend(proposerVMAPIActions) as any; + return client.extend(proposervmAPIActions) as any; } diff --git a/client/src/clients/decorators/avalanche.test.ts b/client/src/clients/decorators/avalanche.test.ts index abfc5ef8..cfd0da8d 100644 --- a/client/src/clients/decorators/avalanche.test.ts +++ b/client/src/clients/decorators/avalanche.test.ts @@ -701,7 +701,7 @@ describe("smoke test", () => { }); }); - describe("ProposerVM API methods", () => { + describe("proposervm API methods", () => { test("getCurrentEpoch C-Chain", async () => { const res = await avalancheClient.proposervm!.cChain!.getCurrentEpoch(); expect(res).toBeDefined(); diff --git a/client/src/clients/decorators/avalanche.ts b/client/src/clients/decorators/avalanche.ts index 5d1abd98..0656ac4e 100644 --- a/client/src/clients/decorators/avalanche.ts +++ b/client/src/clients/decorators/avalanche.ts @@ -10,7 +10,7 @@ import { healthAPIActions, HealthAPIActions } from "./healthApi.js"; import { IndexAPIActions, indexAPIActions } from "./indexApi.js"; import { InfoAPIActions, infoAPIActions } from "./infoApi.js"; import { pChainActions, PChainActions } from "./pChain.js"; -import { ProposerVMAPIActions, proposerVMAPIActions } from "./proposervmApi.js"; +import { proposervmAPIActions, ProposervmAPIActions } from "./proposervmApi.js"; import { XChainActions, xChainActions } from "./xChain.js"; export type AvalancheActions = PublicActions & AvalanchePublicActions & { @@ -30,9 +30,9 @@ export type AvalancheActions = PublicActions & xChain?: IndexAPIActions; }; proposervm?: { - cChain?: ProposerVMAPIActions; - pChain?: ProposerVMAPIActions; - xChain?: ProposerVMAPIActions; + cChain?: ProposervmAPIActions; + pChain?: ProposervmAPIActions; + xChain?: ProposervmAPIActions; }; }; @@ -99,13 +99,13 @@ export function avalancheActions< ? { proposervm: { ...(proposervmCChainClient - ? { cChain: proposerVMAPIActions(proposervmCChainClient) } + ? { cChain: proposervmAPIActions(proposervmCChainClient) } : {}), ...(proposervmPChainClient - ? { pChain: proposerVMAPIActions(proposervmPChainClient) } + ? { pChain: proposervmAPIActions(proposervmPChainClient) } : {}), ...(proposervmXChainClient - ? { xChain: proposerVMAPIActions(proposervmXChainClient) } + ? { xChain: proposervmAPIActions(proposervmXChainClient) } : {}), }, } diff --git a/client/src/clients/decorators/proposervmApi.ts b/client/src/clients/decorators/proposervmApi.ts index 130454fa..5b6b868d 100644 --- a/client/src/clients/decorators/proposervmApi.ts +++ b/client/src/clients/decorators/proposervmApi.ts @@ -5,7 +5,7 @@ import { GetCurrentEpochReturnType } from "../../methods/proposervm/types/getCur import { GetProposedHeightReturnType } from "../../methods/proposervm/types/getProposedHeight.js"; import { AvalancheCoreClient } from "../createAvalancheCoreClient.js"; -export type ProposerVMAPIActions = { +export type ProposervmAPIActions = { /** * Returns this node's current proposer VM height. * @@ -55,9 +55,9 @@ export type ProposerVMAPIActions = { getCurrentEpoch: () => Promise; }; -export function proposerVMAPIActions< +export function proposervmAPIActions< chain extends Chain | undefined = Chain | undefined ->(client: AvalancheCoreClient): ProposerVMAPIActions { +>(client: AvalancheCoreClient): ProposervmAPIActions { return { getProposedHeight: () => getProposedHeight(client), getCurrentEpoch: () => getCurrentEpoch(client), diff --git a/client/src/clients/types/createAvalancheClient.ts b/client/src/clients/types/createAvalancheClient.ts index 8731f725..52f447c3 100644 --- a/client/src/clients/types/createAvalancheClient.ts +++ b/client/src/clients/types/createAvalancheClient.ts @@ -15,7 +15,7 @@ import { HealthRpcSchema } from "../../methods/health/healthRpcSchema.js"; import { IndexRpcSchema } from "../../methods/index/indexRpcSchema.js"; import { InfoRpcSchema } from "../../methods/info/infoRpcSchema.js"; import { PChainRpcSchema } from "../../methods/pChain/pChainRpcSchema.js"; -import { ProposerVMRpcSchema } from "../../methods/proposervm/proposervmRpcSchema.js"; +import { ProposervmRpcSchema } from "../../methods/proposervm/proposervmRpcSchema.js"; import { AvalanchePublicRpcSchema } from "../../methods/public/avalanchePublicRpcSchema.js"; import { XChainRpcSchema } from "../../methods/xChain/xChainRpcSchema.js"; import { @@ -30,7 +30,7 @@ import { HealthAPIActions } from "../decorators/healthApi.js"; import { IndexAPIActions } from "../decorators/indexApi.js"; import { InfoAPIActions } from "../decorators/infoApi.js"; import { PChainActions } from "../decorators/pChain.js"; -import { ProposerVMAPIActions } from "../decorators/proposervmApi.js"; +import { ProposervmAPIActions } from "../decorators/proposervmApi.js"; import { XChainActions } from "../decorators/xChain.js"; export type AvalancheClientConfig< @@ -119,22 +119,22 @@ export type AvalancheClient< transport, chain, accountOrAddress, - ProposerVMRpcSchema, - ProposerVMAPIActions + ProposervmRpcSchema, + ProposervmAPIActions >; pChain: AvalancheCoreClient< transport, chain, accountOrAddress, - ProposerVMRpcSchema, - ProposerVMAPIActions + ProposervmRpcSchema, + ProposervmAPIActions >; xChain: AvalancheCoreClient< transport, chain, accountOrAddress, - ProposerVMRpcSchema, - ProposerVMAPIActions + ProposervmRpcSchema, + ProposervmAPIActions >; }; diff --git a/client/src/index.ts b/client/src/index.ts index d1a4fa98..fbafd764 100644 --- a/client/src/index.ts +++ b/client/src/index.ts @@ -1451,10 +1451,10 @@ export { type PChainClientConfig, } from "./clients/createPChainClient.js"; export { - createProposerVMApiClient, - type CreateProposerVMApiClientErrorType, - type ProposerVMApiClient, - type ProposerVMApiClientConfig, + createProposervmApiClient, + type CreateProposervmApiClientErrorType, + type ProposervmApiClient, + type ProposervmApiClientConfig, } from "./clients/createProposervmApiClient.js"; export { createXChainClient, @@ -1500,8 +1500,8 @@ export { type PChainActions, } from "./clients/decorators/pChain.js"; export { - proposerVMAPIActions, - type ProposerVMAPIActions, + proposervmAPIActions, + type ProposervmAPIActions, } from "./clients/decorators/proposervmApi.js"; export { xChainActions, @@ -1520,7 +1520,7 @@ export { type HealthRpcSchema } from "./methods/health/healthRpcSchema.js"; export { type IndexRpcSchema } from "./methods/index/indexRpcSchema.js"; export { type InfoRpcSchema } from "./methods/info/infoRpcSchema.js"; export { type PChainRpcSchema } from "./methods/pChain/pChainRpcSchema.js"; -export { type ProposerVMRpcSchema } from "./methods/proposervm/proposervmRpcSchema.js"; +export { type ProposervmRpcSchema } from "./methods/proposervm/proposervmRpcSchema.js"; export { type AvalanchePublicRpcSchema } from "./methods/public/avalanchePublicRpcSchema.js"; export { type AvalancheWalletRpcSchema } from "./methods/wallet/avalancheWalletRPCSchema.js"; export { type XChainRpcSchema } from "./methods/xChain/xChainRpcSchema.js"; diff --git a/client/src/methods/pChain/types/getAllValidatorsAt.ts b/client/src/methods/pChain/types/getAllValidatorsAt.ts index 9a057b7f..ecb0dc8a 100644 --- a/client/src/methods/pChain/types/getAllValidatorsAt.ts +++ b/client/src/methods/pChain/types/getAllValidatorsAt.ts @@ -3,7 +3,7 @@ import { RequestErrorType } from "viem/utils"; /** * Parameters for the `platform.getAllValidatorsAt` method. * Get all validators at a given height across all Subnets and the Primary Network. - * @property height - The P-Chain height to get validators at, or "proposed" to return the validator set at the node's ProposerVM height + * @property height - The P-Chain height to get validators at, or "proposed" to return the validator set at the node's proposervm height */ export type GetAllValidatorsAtParameters = { height: number | "proposed"; diff --git a/client/src/methods/proposervm/getCurrentEpoch.ts b/client/src/methods/proposervm/getCurrentEpoch.ts index 0ff917aa..89c1a8fb 100644 --- a/client/src/methods/proposervm/getCurrentEpoch.ts +++ b/client/src/methods/proposervm/getCurrentEpoch.ts @@ -3,7 +3,7 @@ import { AvalancheCoreClient, AvalancheCoreClient as Client, } from "../../clients/createAvalancheCoreClient.js"; -import { ProposerVMRpcSchema } from "../../methods/proposervm/proposervmRpcSchema.js"; +import { ProposervmRpcSchema } from "../../methods/proposervm/proposervmRpcSchema.js"; import { GetCurrentEpochReturnType } from "./types/getCurrentEpoch.js"; /** @@ -35,7 +35,7 @@ export async function getCurrentEpoch( client: Client ): Promise { return client.request< - ProposerVMRpcSchema, + ProposervmRpcSchema, { method: "proposervm.getCurrentEpoch"; params: {} }, GetCurrentEpochReturnType >({ diff --git a/client/src/methods/proposervm/getProposedHeight.ts b/client/src/methods/proposervm/getProposedHeight.ts index 76c7fbf3..309984cd 100644 --- a/client/src/methods/proposervm/getProposedHeight.ts +++ b/client/src/methods/proposervm/getProposedHeight.ts @@ -3,7 +3,7 @@ import { AvalancheCoreClient, AvalancheCoreClient as Client, } from "../../clients/createAvalancheCoreClient.js"; -import { ProposerVMRpcSchema } from "../../methods/proposervm/proposervmRpcSchema.js"; +import { ProposervmRpcSchema } from "../../methods/proposervm/proposervmRpcSchema.js"; import { GetProposedHeightReturnType } from "./types/getProposedHeight.js"; /** @@ -35,7 +35,7 @@ export async function getProposedHeight( client: Client ): Promise { return client.request< - ProposerVMRpcSchema, + ProposervmRpcSchema, { method: "proposervm.getProposedHeight"; params: {} }, GetProposedHeightReturnType >({ diff --git a/client/src/methods/proposervm/proposervmRpcSchema.ts b/client/src/methods/proposervm/proposervmRpcSchema.ts index 9a0ebe5a..522cd21c 100644 --- a/client/src/methods/proposervm/proposervmRpcSchema.ts +++ b/client/src/methods/proposervm/proposervmRpcSchema.ts @@ -2,14 +2,14 @@ import { RpcSchemaOverride } from "viem"; import { GetCurrentEpochMethod } from "./types/getCurrentEpoch.js"; import { GetProposedHeightMethod } from "./types/getProposedHeight.js"; -export type ProposerVMMethods = [ +export type ProposervmMethods = [ GetProposedHeightMethod, GetCurrentEpochMethod ]; /** - * The RPC schema for the ProposerVM methods. + * The RPC schema for the proposervm methods. * - * @see {@link ProposerVMMethods} + * @see {@link ProposervmMethods} */ -export type ProposerVMRpcSchema = RpcSchemaOverride & ProposerVMMethods; +export type ProposervmRpcSchema = RpcSchemaOverride & ProposervmMethods; From 162d67062e4a3264f5ee38ce54bda8c9f5de4612 Mon Sep 17 00:00:00 2001 From: Sayan kar Date: Mon, 3 Nov 2025 18:13:21 +0530 Subject: [PATCH 6/8] chore: add build path for proposervm to rollup config --- client/rollup.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/rollup.config.js b/client/rollup.config.js index d6adffa4..59f51c61 100644 --- a/client/rollup.config.js +++ b/client/rollup.config.js @@ -14,7 +14,7 @@ const getEntryPoints = () => { const subPaths = [ 'accounts', 'chains', 'methods', 'methods/wallet', 'methods/wallet/cChain', 'methods/wallet/pChain', 'methods/wallet/xChain', 'methods/public', 'methods/pChain', - 'methods/admin', 'methods/cChain', 'methods/xChain', 'methods/health', + 'methods/admin', 'methods/cChain', 'methods/xChain', 'methods/health', 'methods/proposervm', 'methods/index', 'methods/info', 'node', 'nonce', 'serializable', 'siwe', 'utils', 'window' ]; From f4134d72413f79dc59d379fa415bff7f9c6b00b7 Mon Sep 17 00:00:00 2001 From: Sayan kar Date: Mon, 3 Nov 2025 21:17:38 +0530 Subject: [PATCH 7/8] chore: fix dev docs for the new methods --- client/src/clients/createIndexApiClient.ts | 5 +++-- .../src/clients/createProposervmApiClient.ts | 19 ++++++++++++++----- client/src/clients/decorators/indexApi.ts | 12 ++++++------ .../clients/decorators/proposervmApi.test.ts | 18 ++++++++++++++++++ .../src/clients/decorators/proposervmApi.ts | 16 ++++++++++------ .../src/methods/pChain/getAllValidatorsAt.ts | 3 +++ 6 files changed, 54 insertions(+), 19 deletions(-) create mode 100644 client/src/clients/decorators/proposervmApi.test.ts diff --git a/client/src/clients/createIndexApiClient.ts b/client/src/clients/createIndexApiClient.ts index 915b8786..8406d97e 100644 --- a/client/src/clients/createIndexApiClient.ts +++ b/client/src/clients/createIndexApiClient.ts @@ -69,10 +69,11 @@ export type CreateIndexApiClientErrorType = CreateAvalancheCoreClientErrorType; * transport: { * type: "http", * }, + * clientType: "indexPChainBlock", * }) * - * // Get index P-Chain block - * const block = await client.indexPChainBlock.getContainerByID({ + * // Get container by ID for P-Chain block + * const block = await client.getContainerByID({ * id: '0x1', * encoding: 'hex' * }) diff --git a/client/src/clients/createProposervmApiClient.ts b/client/src/clients/createProposervmApiClient.ts index c0987d28..df216ed2 100644 --- a/client/src/clients/createProposervmApiClient.ts +++ b/client/src/clients/createProposervmApiClient.ts @@ -64,18 +64,27 @@ export type CreateProposervmApiClientErrorType = * import { createProposervmApiClient} from '@avalanche-sdk/client' * import { avalanche } from '@avalanche-sdk/client/chains' * - * const client = createProposervmApiClient({ + * const cChainClient = createProposervmApiClient({ * chain: avalanche, * transport: { * type: "http", * }, + * clientType: "proposervmCChain", * }) * - * // Get proposer VM height - * const height = await client.getProposedHeight() + * // Get proposer VM height for C-Chain + * const cChainHeight = await cChainClient.getProposedHeight() * - * // Get current epoch - * const epoch = await client.getCurrentEpoch() + * const pChainClient = createProposervmApiClient({ + * chain: avalanche, + * transport: { + * type: "http", + * }, + * clientType: "proposervmPChain", + * }) + * + * // Get proposer VM height for P-Chain + * const pChainHeight = await pChainClient.getProposedHeight() * ``` */ export function createProposervmApiClient< diff --git a/client/src/clients/decorators/indexApi.ts b/client/src/clients/decorators/indexApi.ts index 7bcb0fdd..c59f2120 100644 --- a/client/src/clients/decorators/indexApi.ts +++ b/client/src/clients/decorators/indexApi.ts @@ -52,7 +52,7 @@ export type IndexAPIActions = { * }, * }) * - * const container = await client.indexPChainBlock.getContainerByID({ + * const container = await client.indexBlock.pChain.getContainerByID({ * id: "6fXf5hncR8LXvwtM8iezFQBpK5cubV6y1dWgpJCcNyzGB1EzY", * encoding: "hex" * }) @@ -82,7 +82,7 @@ export type IndexAPIActions = { * }, * }) * - * const container = await client.indexPChainBlock.getContainerByIndex({ + * const container = await client.indexBlock.pChain.getContainerByIndex({ * index: 1, * encoding: "hex" * }) @@ -112,7 +112,7 @@ export type IndexAPIActions = { * }, * }) * - * const containers = await client.indexPChainBlock.getContainerRange({ + * const containers = await client.indexBlock.pChain.getContainerRange({ * startIndex: 0, * endIndex: 10, * encoding: "hex" @@ -143,7 +143,7 @@ export type IndexAPIActions = { * }, * }) * - * const index = await client.indexPChainBlock.getIndex({ + * const index = await client.indexBlock.pChain.getIndex({ * id: "6fXf5hncR8LXvwtM8iezFQBpK5cubV6y1dWgpJCcNyzGB1EzY", * encoding: "hex" * }) @@ -171,7 +171,7 @@ export type IndexAPIActions = { * }, * }) * - * const lastAccepted = await client.indexPChainBlock.getLastAccepted({ + * const lastAccepted = await client.indexBlock.pChain.getLastAccepted({ * encoding: "hex" * }) * ``` @@ -200,7 +200,7 @@ export type IndexAPIActions = { * }, * }) * - * const isAccepted = await client.indexPChainBlock.isAccepted({ + * const isAccepted = await client.indexBlock.pChain.isAccepted({ * id: "6fXf5hncR8LXvwtM8iezFQBpK5cubV6y1dWgpJCcNyzGB1EzY", * encoding: "hex" * }) diff --git a/client/src/clients/decorators/proposervmApi.test.ts b/client/src/clients/decorators/proposervmApi.test.ts new file mode 100644 index 00000000..d5dc3764 --- /dev/null +++ b/client/src/clients/decorators/proposervmApi.test.ts @@ -0,0 +1,18 @@ +import { expect, test } from "vitest"; +import { avalanche } from "../../chains/index.js"; +import { createAvalancheCoreClient } from "../createAvalancheCoreClient.js"; +import { proposervmAPIActions } from "./proposervmApi.js"; + +const client = createAvalancheCoreClient({ + chain: avalanche, + transport: { type: "http" }, +} as any); + +const proposervmApiClient = proposervmAPIActions(client); + +test("default", async () => { + expect(proposervmApiClient).toMatchInlineSnapshot(`{ + "getCurrentEpoch": [Function], + "getProposedHeight": [Function], +}`); +}); diff --git a/client/src/clients/decorators/proposervmApi.ts b/client/src/clients/decorators/proposervmApi.ts index 5b6b868d..33b2b242 100644 --- a/client/src/clients/decorators/proposervmApi.ts +++ b/client/src/clients/decorators/proposervmApi.ts @@ -7,11 +7,11 @@ import { AvalancheCoreClient } from "../createAvalancheCoreClient.js"; export type ProposervmAPIActions = { /** - * Returns this node's current proposer VM height. + * Returns this node's current proposer VM height for the requested chain (C-Chain, P-Chain, X-Chain). * * - Docs: https://build.avax.network/docs/api-reference/proposervm-api#proposervmgetproposedheight * - * @returns This node's current proposer VM height. {@link GetProposedHeightReturnType} + * @returns This node's current proposer VM height for the requested chain. {@link GetProposedHeightReturnType} * * @example * ```ts @@ -25,17 +25,19 @@ export type ProposervmAPIActions = { * }, * }) * - * const height = await client.proposervm.getProposedHeight() + * const cChainHeight = await client.proposervm.cChain.getProposedHeight() + * const pChainHeight = await client.proposervm.pChain.getProposedHeight() + * const xChainHeight = await client.proposervm.xChain.getProposedHeight() * ``` */ getProposedHeight: () => Promise; /** - * Returns the current epoch information. + * Returns the current epoch information for the requested chain (C-Chain, P-Chain, X-Chain). * * - Docs: https://build.avax.network/docs/api-reference/proposervm-api#proposervmgetcurrentepoch * - * @returns The current epoch information. {@link GetCurrentEpochReturnType} + * @returns The current epoch information for the requested chain. {@link GetCurrentEpochReturnType} * * @example * ```ts @@ -49,7 +51,9 @@ export type ProposervmAPIActions = { * }, * }) * - * const epoch = await client.proposervm.getCurrentEpoch() + * const cChainEpoch = await client.proposervm.cChain.getCurrentEpoch() + * const pChainEpoch = await client.proposervm.pChain.getCurrentEpoch() + * const xChainEpoch = await client.proposervm.xChain.getCurrentEpoch() * ``` */ getCurrentEpoch: () => Promise; diff --git a/client/src/methods/pChain/getAllValidatorsAt.ts b/client/src/methods/pChain/getAllValidatorsAt.ts index 0fb6a40d..6cb5f2e5 100644 --- a/client/src/methods/pChain/getAllValidatorsAt.ts +++ b/client/src/methods/pChain/getAllValidatorsAt.ts @@ -12,6 +12,9 @@ import { /** * Get all validators at a specific height across all Subnets and the Primary Network. * + * Note: The public API (api.avax.network) only support height within 1000 blocks + * from the P-Chain tip. + * * - Docs: https://build.avax.network/docs/api-reference/p-chain/api#platformgetallvalidatorsat * * @param client - The client to use. {@link AvalancheCoreClient} From 816554a014b732bdb952ef23e4f8d647d85fecf2 Mon Sep 17 00:00:00 2001 From: Sayan kar Date: Mon, 3 Nov 2025 21:22:56 +0530 Subject: [PATCH 8/8] chore: modify dev docs in pChain getAllValidatorsAt decorator to add note --- client/src/clients/decorators/pChain.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/src/clients/decorators/pChain.ts b/client/src/clients/decorators/pChain.ts index ab94b977..93e6a217 100644 --- a/client/src/clients/decorators/pChain.ts +++ b/client/src/clients/decorators/pChain.ts @@ -785,6 +785,9 @@ export type PChainActions = { /** * Get all validators at a specific height across all Subnets and the Primary Network. * + * Note: The public API (api.avax.network) only support height within 1000 blocks + * from the P-Chain tip. + * * - Docs: https://build.avax.network/docs/api-reference/p-chain/api#platformgetallvalidatorsat * * @param args - {@link GetAllValidatorsAtParameters} The height