update code and include package.json

This commit is contained in:
Jingles 2024-12-25 16:09:16 +08:00 committed by Lucas
parent c1871768f8
commit 1f1ca4f807
2 changed files with 33 additions and 16 deletions

View File

@ -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();

View File

@ -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"
}
}