-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Pablo Maldonado <[email protected]>
- Loading branch information
Showing
7 changed files
with
688 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,5 @@ target | |
test-ledger | ||
idls | ||
src/svm/assets | ||
src/svm/clients/* | ||
!src/svm/clients/index.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { createFromRoot } from "codama"; | ||
import { rootNodeFromAnchor, AnchorIdl } from "@codama/nodes-from-anchor"; | ||
import { renderVisitor as renderJavaScriptVisitor } from "@codama/renderers-js"; | ||
import { SvmSpokeIdl, MulticallHandlerIdl } from "../../../src/svm/assets"; | ||
import path from "path"; | ||
|
||
let codama = createFromRoot(rootNodeFromAnchor(SvmSpokeIdl as AnchorIdl)); | ||
export const clientsPath = path.join(__dirname, "..", "..", "..", "src", "svm", "clients"); | ||
|
||
codama.accept(renderJavaScriptVisitor(path.join(clientsPath, "SvmSpoke"))); | ||
|
||
codama = createFromRoot(rootNodeFromAnchor(MulticallHandlerIdl as AnchorIdl)); | ||
codama.accept(renderJavaScriptVisitor(path.join(clientsPath, "MulticallHandler"))); | ||
|
||
// codama = createFromRoot(rootNodeFromAnchor(MessageTransmitterIdl as AnchorIdl)); | ||
// codama.accept( | ||
// renderJavaScriptVisitor(path.join(clientsPath, "MessageTransmitter")) | ||
// ); | ||
|
||
// codama = createFromRoot(rootNodeFromAnchor(TokenMessengerMinterIdl as AnchorIdl)); | ||
// codama.accept( | ||
// renderJavaScriptVisitor(path.join(clientsPath, "TokenMessengerMinter")) | ||
// ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { clientsPath } from "./generate-svm-clients"; | ||
|
||
const fs = require("fs"); | ||
const path = require("path"); | ||
|
||
function replaceInFiles(dir: string): void { | ||
const files = fs.readdirSync(dir); | ||
files.forEach((file: string) => { | ||
const filePath = path.join(dir, file); | ||
const stat = fs.statSync(filePath); | ||
|
||
if (stat.isDirectory()) { | ||
replaceInFiles(filePath); | ||
} else if (file.endsWith(".ts")) { | ||
const fileContent = fs.readFileSync(filePath, "utf8"); | ||
const updatedContent = fileContent.replace("@solana/web3.js", "@solana/web3-v2.js"); | ||
fs.writeFileSync(filePath, updatedContent); | ||
} | ||
}); | ||
} | ||
|
||
replaceInFiles(clientsPath); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from "./MulticallHandler"; | ||
export * from "./SvmSpoke"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.