Skip to content

Commit 9a1b059

Browse files
feat(pulse-sdk-solidity): Create Pulse solidity SDK (#2667)
* feat: extracted public components out to SDK * doc: improve readme * fix: add remapping to abi gen * fix: identifier issues * doc: add signatures for the error types * undo argus lockfile change * fix: merge, format * test: update references to sdk
1 parent 1acf74b commit 9a1b059

28 files changed

+1909
-502
lines changed

pnpm-lock.yaml

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ packages:
2626
- target_chains/ethereum/contracts
2727
- target_chains/ethereum/abi_generator
2828
- target_chains/ethereum/entropy_sdk/solidity
29+
- target_chains/ethereum/pulse_sdk/solidity
2930
- target_chains/ethereum/sdk/js
3031
- target_chains/ethereum/sdk/solidity
3132
- target_chains/ethereum/sdk/stylus/pyth-mock-solidity

target_chains/ethereum/abi_generator/src/index.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ function generateAbi(contracts) {
2525
sources,
2626
settings: {
2727
outputSelection,
28+
remappings: [
29+
// Needed for @pythnetwork/pulse-sdk-solidity since it depends on @pythnetwork/pyth-sdk-solidity
30+
"@pythnetwork/=./node_modules/@pythnetwork/",
31+
],
2832
},
2933
};
3034

@@ -42,9 +46,28 @@ function generateAbi(contracts) {
4246
fs.mkdirSync("abis");
4347
}
4448

49+
// Report compilation failures
50+
if (output.errors) {
51+
// We can still generate ABIs with warnings, only throw for errors
52+
const errors = output.errors.filter((e) => e.severity === "error");
53+
if (errors.length > 0) {
54+
console.error("Compilation errors:");
55+
for (const error of errors) {
56+
console.error(error.formattedMessage || error.message);
57+
}
58+
throw new Error("Compilation failed due to errors");
59+
}
60+
}
61+
4562
for (let contract of contracts) {
4663
const contractFile = `${contract}.sol`;
4764

65+
if (!output.contracts[contractFile]) {
66+
throw new Error(`Unable to produce ABI for ${contractFile}.`);
67+
}
68+
if (!output.contracts[contractFile][contract]) {
69+
throw new Error(`Unable to produce ABI for ${contractFile}:${contract}.`);
70+
}
4871
const abi = output.contracts[contractFile][contract].abi;
4972
fs.writeFileSync(
5073
`abis/${contract}.json`,

target_chains/ethereum/contracts/contracts/pulse/IScheduler.sol

Lines changed: 0 additions & 140 deletions
This file was deleted.

0 commit comments

Comments
 (0)