feat: add ABI validation helpers for Ponder (#29)

resolves https://codeberg.org/johba/harb/issues/23

Co-authored-by: openhands <openhands@all-hands.dev>
Reviewed-on: https://codeberg.org/johba/harb/pulls/29
This commit is contained in:
johba 2025-09-30 20:02:43 +02:00
parent 0eaf91be13
commit 76d84341de
17 changed files with 2105 additions and 49 deletions

View file

@ -19,6 +19,7 @@
"@graphql-codegen/typescript-operations": "^4.2.0",
"@graphql-typed-document-node/core": "^3.2.0",
"@types/jest": "^29.5.12",
"@types/node": "^24.6.0",
"jest": "^29.7.0",
"ts-jest": "^29.1.2",
"typescript": "^5.4.3"
@ -2887,13 +2888,13 @@
"license": "MIT"
},
"node_modules/@types/node": {
"version": "20.12.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.2.tgz",
"integrity": "sha512-zQ0NYO87hyN6Xrclcqp7f8ZbXNbRfoGWNcMvHTPQp9UUrwI0mI7XBz+cu7/W6/VClYo2g63B0cjull/srU7LgQ==",
"version": "24.6.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.6.0.tgz",
"integrity": "sha512-F1CBxgqwOMc4GKJ7eY22hWhBVQuMYTtqI8L0FcszYcpYX0fzfDGpez22Xau8Mgm7O9fI+zA/TYIdq3tGWfweBA==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~5.26.4"
"undici-types": "~7.13.0"
}
},
"node_modules/@types/stack-utils": {
@ -7904,9 +7905,9 @@
}
},
"node_modules/undici-types": {
"version": "5.26.5",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
"version": "7.13.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.13.0.tgz",
"integrity": "sha512-Ov2Rr9Sx+fRgagJ5AX0qvItZG/JKKoBRAVITs1zk7IqZGTJUwgUr7qoYBpWwakpWilTZFM98rG/AFRocu10iIQ==",
"dev": true,
"license": "MIT"
},

View file

@ -24,6 +24,7 @@
"@graphql-codegen/typescript-operations": "^4.2.0",
"@graphql-typed-document-node/core": "^3.2.0",
"@types/jest": "^29.5.12",
"@types/node": "^24.6.0",
"jest": "^29.7.0",
"ts-jest": "^29.1.2",
"typescript": "^5.4.3"

25
kraiken-lib/src/abis.ts Normal file
View file

@ -0,0 +1,25 @@
/**
* Contract ABIs extracted from forge build artifacts
*
* These ABIs are the single source of truth, generated from onchain/out/
* To update: run `forge build` in onchain/ directory
*/
const KraikenForgeOutput = require('../../onchain/out/Kraiken.sol/Kraiken.json');
const StakeForgeOutput = require('../../onchain/out/Stake.sol/Stake.json');
/**
* Kraiken ERC20 token contract ABI
*/
export const KraikenAbi = KraikenForgeOutput.abi;
/**
* Stake (Harberger tax staking) contract ABI
*/
export const StakeAbi = StakeForgeOutput.abi;
// Re-export for convenience
export const ABIS = {
Kraiken: KraikenAbi,
Stake: StakeAbi,
} as const;

View file

@ -22,3 +22,5 @@ export {
getSnatchList,
isPositionDelinquent,
} from "./helpers";
export { KraikenAbi, StakeAbi, ABIS } from "./abis";

View file

@ -5,7 +5,9 @@
"declaration": true,
"outDir": "./dist",
"skipLibCheck": true,
"types": []
"resolveJsonModule": true,
"esModuleInterop": true,
"types": ["node"]
},
"include": [
"src/**/*"

View file

@ -1432,12 +1432,12 @@
resolved "https://registry.npmjs.org/@types/json-stable-stringify/-/json-stable-stringify-1.0.36.tgz"
integrity sha512-b7bq23s4fgBB76n34m2b3RBf6M369B0Z9uRR8aHTMd8kZISRkmDEpPD8hhpYvDFzr3bJCPES96cm3Q6qRNDbQw==
"@types/node@*", "@types/node@>=13":
version "20.12.2"
resolved "https://registry.npmjs.org/@types/node/-/node-20.12.2.tgz"
integrity sha512-zQ0NYO87hyN6Xrclcqp7f8ZbXNbRfoGWNcMvHTPQp9UUrwI0mI7XBz+cu7/W6/VClYo2g63B0cjull/srU7LgQ==
"@types/node@*", "@types/node@^24.6.0", "@types/node@>=13":
version "24.6.0"
resolved "https://registry.npmjs.org/@types/node/-/node-24.6.0.tgz"
integrity sha512-F1CBxgqwOMc4GKJ7eY22hWhBVQuMYTtqI8L0FcszYcpYX0fzfDGpez22Xau8Mgm7O9fI+zA/TYIdq3tGWfweBA==
dependencies:
undici-types "~5.26.4"
undici-types "~7.13.0"
"@types/stack-utils@^2.0.0":
version "2.0.3"
@ -2387,6 +2387,11 @@ fs.realpath@^1.0.0:
resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==
fsevents@^2.3.2:
version "2.3.3"
resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz"
integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==
function-bind@^1.1.2:
version "1.1.2"
resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz"
@ -4257,10 +4262,10 @@ unc-path-regex@^0.1.2:
resolved "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz"
integrity sha512-eXL4nmJT7oCpkZsHZUOJo8hcX3GbsiDOa0Qu9F646fi8dT3XuSVopVqAcEiVzSKKH7UoDti23wNX3qGFxcW5Qg==
undici-types@~5.26.4:
version "5.26.5"
resolved "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz"
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==
undici-types@~7.13.0:
version "7.13.0"
resolved "https://registry.npmjs.org/undici-types/-/undici-types-7.13.0.tgz"
integrity sha512-Ov2Rr9Sx+fRgagJ5AX0qvItZG/JKKoBRAVITs1zk7IqZGTJUwgUr7qoYBpWwakpWilTZFM98rG/AFRocu10iIQ==
unixify@^1.0.0:
version "1.0.0"