Skip to content

Commit

Permalink
new UniSwap Action
Browse files Browse the repository at this point in the history
  • Loading branch information
awisniew207 committed Dec 19, 2024
1 parent 3fe2e4f commit 7c911f1
Show file tree
Hide file tree
Showing 4 changed files with 309 additions and 324 deletions.
2 changes: 1 addition & 1 deletion packages/lit-agent-tool-uniswap/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,4 @@ export { generateIndexFiles };
// Only run build if this is the main module
if (import.meta.url === `file://${process.argv[1]}`) {
build();
}
}
23 changes: 18 additions & 5 deletions packages/lit-agent-tool-uniswap/scripts/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,24 @@ async function main() {
// Ensure dist directory exists
await fs.mkdir(join(rootDir, "dist"), { recursive: true });

// First generate the files
console.log("Generating files...");
await generateIndexFiles();

// Give the filesystem a moment to sync
console.log("Waiting for filesystem to sync...");
await new Promise((resolve) => setTimeout(resolve, 2000));

// Read the action string
const actionString = await fs.readFile(
join(rootDir, "dist", "lit-action.js"),
"utf-8"
);
const litActionPath = join(rootDir, "dist", "litAction.js");
console.log('Reading from:', litActionPath);
const actionString = await fs.readFile(litActionPath, "utf-8");

// Verify the content looks correct
if (!actionString.startsWith("(async () =>")) {
console.error("Generated code appears malformed:", actionString.substring(0, 100));
throw new Error("Generated code is not in the expected format");
}

const startTime = Date.now();
const pinataResponse = await uploadToPinata(PINATA_JWT, actionString);
Expand All @@ -121,4 +134,4 @@ async function main() {
}
}

main();
main();
Loading

0 comments on commit 7c911f1

Please sign in to comment.