-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add protocol sdk and minting features
- Loading branch information
Showing
30 changed files
with
3,991 additions
and
289 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 |
---|---|---|
|
@@ -23,3 +23,7 @@ jobs: | |
- name: Build js package | ||
run: | | ||
npx turbo run build | ||
- name: Test js package | ||
run: | | ||
npx turbo run test:js |
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 was deleted.
Oops, something went wrong.
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
File renamed without changes.
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
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,84 @@ | ||
import { spawn } from "node:child_process"; | ||
import { join } from "path"; | ||
import { test } from "vitest"; | ||
import { | ||
PublicClient, | ||
TestClient, | ||
WalletClient, | ||
createPublicClient, | ||
createTestClient, | ||
createWalletClient, | ||
http, | ||
} from "viem"; | ||
import { foundry } from "viem/chains"; | ||
|
||
export interface AnvilViemClientsTest { | ||
viemClients: { | ||
walletClient: WalletClient; | ||
publicClient: PublicClient; | ||
testClient: TestClient; | ||
}; | ||
} | ||
|
||
async function waitForAnvilInit(anvil: any) { | ||
return new Promise((resolve) => { | ||
anvil.stdout.once("data", () => { | ||
resolve(true); | ||
}); | ||
}); | ||
} | ||
|
||
export const anvilTest = test.extend<AnvilViemClientsTest>({ | ||
viemClients: async ({task}, use) => { | ||
console.log('setting up clients for ', task.name); | ||
const port = Math.floor(Math.random() * 2000) + 4000; | ||
const anvil = spawn( | ||
"anvil", | ||
[ | ||
"--port", | ||
`${port}`, | ||
"--fork-url", | ||
"https://rpc.zora.co/", | ||
"--fork-block-number", | ||
"6133407", | ||
"--chain-id", | ||
"31337", | ||
], | ||
{ | ||
cwd: join(__dirname, ".."), | ||
killSignal: "SIGINT", | ||
}, | ||
); | ||
const anvilHost = `http://0.0.0.0:${port}`; | ||
await waitForAnvilInit(anvil); | ||
|
||
const chain = { | ||
...foundry, | ||
}; | ||
|
||
const walletClient = createWalletClient({ | ||
chain, | ||
transport: http(anvilHost), | ||
}); | ||
|
||
const testClient = createTestClient({ | ||
chain, | ||
mode: "anvil", | ||
transport: http(anvilHost), | ||
}); | ||
|
||
const publicClient = createPublicClient({ | ||
chain, | ||
transport: http(anvilHost), | ||
}); | ||
|
||
await use({ | ||
publicClient, | ||
walletClient, | ||
testClient, | ||
}); | ||
|
||
// clean up function, called once after all tests run | ||
anvil.kill("SIGINT"); | ||
}, | ||
}); |
Oops, something went wrong.