diff --git a/examples/hello_world/generate-credentials.ts b/examples/hello_world/generate-credentials.ts index 1836b318..c525b2e2 100644 --- a/examples/hello_world/generate-credentials.ts +++ b/examples/hello_world/generate-credentials.ts @@ -1,16 +1,20 @@ -import { MeshWallet } from '@meshsdk/core'; -import fs from 'node:fs'; - -const secret_key = MeshWallet.brew(true) as string; - -fs.writeFileSync('me.sk', secret_key); - -const wallet = new MeshWallet({ - networkId: 0, - key: { - type: 'root', - bech32: secret_key, - }, -}); - -fs.writeFileSync('me.addr', wallet.getUnusedAddresses()[0]); \ No newline at end of file +import { MeshWallet } from "@meshsdk/core"; +import fs from "node:fs"; + +async function main() { + const secret_key = MeshWallet.brew(true) as string; + + fs.writeFileSync("me.sk", secret_key); + + const wallet = new MeshWallet({ + networkId: 0, + key: { + type: "root", + bech32: secret_key, + }, + }); + + fs.writeFileSync("me.addr", (await wallet.getUnusedAddresses())[0]); +} + +main(); diff --git a/examples/hello_world/package.json b/examples/hello_world/package.json new file mode 100644 index 00000000..c12187a2 --- /dev/null +++ b/examples/hello_world/package.json @@ -0,0 +1,13 @@ +{ + "name": "hello_world", + "version": "0.0.1", + "scripts": { + "generate": "npx tsx generate-credentials.ts", + "lock": "npx tsx lock.ts" + }, + "author": "jinglescode", + "dependencies": { + "@meshsdk/core": "^1.8.4", + "tsx": "^4.19.2" + } +}