Skip to content

Commit

Permalink
update code and include package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
jinglescode committed Dec 25, 2024
1 parent 3355b47 commit 86f5984
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 16 deletions.
36 changes: 20 additions & 16 deletions examples/hello_world/generate-credentials.ts
Original file line number Diff line number Diff line change
@@ -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]);
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();
13 changes: 13 additions & 0 deletions examples/hello_world/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}

0 comments on commit 86f5984

Please sign in to comment.