Skip to content

Commit

Permalink
feat(svm): codama client
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Maldonado <[email protected]>
  • Loading branch information
md0x committed Jan 14, 2025
1 parent 6ab6f78 commit ceecd63
Show file tree
Hide file tree
Showing 4 changed files with 707 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ yarn-error.log
yarn-debug.log*
gasReporterOutput.json
logs

# generated clients
clients/js/src/generated/
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"build:cjs": "tsc --project tsconfig.build.json --module commonjs --outDir ./dist/cjs --removeComments --verbatimModuleSyntax false && echo > ./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
"build:esm": "tsc --project tsconfig.build.json --module es2015 --outDir ./dist/esm && echo > ./dist/esm/package.json '{\"type\":\"module\",\"sideEffects\":false}'",
"build:types": "tsc --project tsconfig.build.json --module esnext --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap",
"generate-clients": "yarn ts-node ./scripts/generate-clients.ts",
"test": "hardhat test",
"test:watch": "hardhat watch test",
"test:run:arweave": "npx -y arlocal",
Expand Down Expand Up @@ -99,17 +100,22 @@
},
"dependencies": {
"@across-protocol/across-token": "^1.0.0",
"@across-protocol/constants": "^3.1.28",
"@across-protocol/constants": "^3.1.27",
"@across-protocol/contracts": "^3.0.24",
"@codama/nodes-from-anchor": "^1.1.0",
"@codama/renderers-js": "^1.1.1",
"@coral-xyz/borsh": "^0.30.1",
"@eth-optimism/sdk": "^3.3.1",
"@ethersproject/bignumber": "^5.7.0",
"@pinata/sdk": "^2.1.0",
"@solana/web3.js": "2",
"@types/mocha": "^10.0.1",
"@uma/sdk": "^0.34.10",
"arweave": "^1.14.4",
"async": "^3.2.5",
"axios": "^0.27.2",
"big-number": "^2.0.0",
"codama": "^1.2.0",
"decimal.js": "^10.3.1",
"ethers": "^5.7.2",
"lodash": "^4.17.21",
Expand Down Expand Up @@ -159,4 +165,4 @@
"[email protected]": "4.0.4",
"[email protected]": "5.0.1"
}
}
}
12 changes: 12 additions & 0 deletions scripts/generate-clients.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { createFromRoot } from 'codama';
import { rootNodeFromAnchor, AnchorIdl } from '@codama/nodes-from-anchor';
import { renderVisitor as renderJavaScriptVisitor } from "@codama/renderers-js";
import { SvmSpokeIdl } from "@across-protocol/contracts"
import path from 'path';

const codama = createFromRoot(rootNodeFromAnchor(SvmSpokeIdl as AnchorIdl));

const jsClient = path.join(__dirname, "..", "clients", "js");
codama.accept(
renderJavaScriptVisitor(path.join(jsClient, "src", "generated"))
);
Loading

0 comments on commit ceecd63

Please sign in to comment.