From 8cd8e08c3dfa8abfb12daffe8382d0b9f7902869 Mon Sep 17 00:00:00 2001 From: Joe Huang Date: Fri, 30 Jan 2026 13:32:42 -0600 Subject: [PATCH 1/3] add ts script --- scripts/ton_wallet_generator/README.md | 19 +++++++++++++++ .../ton_wallet_generator/generate-wallet.ts | 23 +++++++++++++++++++ scripts/ton_wallet_generator/package.json | 18 +++++++++++++++ scripts/ton_wallet_generator/tsconfig.json | 14 +++++++++++ 4 files changed, 74 insertions(+) create mode 100644 scripts/ton_wallet_generator/README.md create mode 100644 scripts/ton_wallet_generator/generate-wallet.ts create mode 100644 scripts/ton_wallet_generator/package.json create mode 100644 scripts/ton_wallet_generator/tsconfig.json diff --git a/scripts/ton_wallet_generator/README.md b/scripts/ton_wallet_generator/README.md new file mode 100644 index 000000000..4a03639ea --- /dev/null +++ b/scripts/ton_wallet_generator/README.md @@ -0,0 +1,19 @@ +# Generate TON wallet + +This is a typescript that generates a TON wallets and prints the mnemonic, secret and address to the console. +## Usage + +```bash +npm install + +npm run generate +``` +## Examples + +```bash +Mnemonic: unfair capable drastic increase bonus pledge ridge blue cube over fine daring frozen shrimp seat universe outside pen injury dumb enact artwork ship insane +Wallet Secret Key: 56cc895313f7abba1f2c6cd36d42e8737ced6138cba80f4381008a055ba9c30b135e61a6c3397e01ddf96af08d7a8f18eff8efcfc7a9ba5f7f05ce69f04a34ad +Public Key: 135e61a6c3397e01ddf96af08d7a8f18eff8efcfc7a9ba5f7f05ce69f04a34ad +Wallet v4 Address: EQDpKqfyCfFAmAtv7ihG2awG9psdAz1t-eFvi7gUJ13Z1GBY +Wallet v5 Address: EQByKwFuc1AFjCAWdGay-kLzoOmqsg0qaX44wU3FENX6PT2n +``` diff --git a/scripts/ton_wallet_generator/generate-wallet.ts b/scripts/ton_wallet_generator/generate-wallet.ts new file mode 100644 index 000000000..8a5ccf809 --- /dev/null +++ b/scripts/ton_wallet_generator/generate-wallet.ts @@ -0,0 +1,23 @@ +// generate-wallet.ts +import { mnemonicNew, mnemonicToWalletKey } from "@ton/crypto"; +import { WalletContractV4, WalletContractV5R1, TonClient, Address } from "@ton/ton"; +import { getHttpEndpoint } from "@orbs-network/ton-access"; + +async function main() { + const mnemonic = await mnemonicNew(); + console.log("Mnemonic:", mnemonic.join(" ")); + + const key = await mnemonicToWalletKey(mnemonic); + const walletv4 = WalletContractV4.create({ workchain: 0, publicKey: key.publicKey }); + const walletv5 = WalletContractV5R1.create({ workchain: 0, publicKey: key.publicKey }); + + console.log("Wallet Secret Key:", key.secretKey.toString("hex")); // Are we storing the hex in secrets manager? + console.log("Public Key:", key.publicKey.toString("hex")); // Ask security to share this + console.log("Wallet v4 Address:", walletv4.address.toString({ bounceable: true })); + console.log("Wallet v5 Address:", walletv5.address.toString({ bounceable: true })); +} + +main().catch((error) => { + console.error("Error:", error); + process.exit(1); +}); diff --git a/scripts/ton_wallet_generator/package.json b/scripts/ton_wallet_generator/package.json new file mode 100644 index 000000000..dfffc4aaf --- /dev/null +++ b/scripts/ton_wallet_generator/package.json @@ -0,0 +1,18 @@ +{ + "name": "ton-wallet-generator", + "version": "1.0.0", + "description": "Generate TON wallet addresses", + "main": "generate-wallet.ts", + "scripts": { + "generate": "npx ts-node generate-wallet.ts" + }, + "dependencies": { + "@ton/crypto": "^3.3.0", + "@ton/ton": "^15.0.0", + "@orbs-network/ton-access": "^2.3.3" + }, + "devDependencies": { + "ts-node": "^10.9.2", + "typescript": "^5.3.3" + } +} diff --git a/scripts/ton_wallet_generator/tsconfig.json b/scripts/ton_wallet_generator/tsconfig.json new file mode 100644 index 000000000..4244e76bf --- /dev/null +++ b/scripts/ton_wallet_generator/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "ES2020", + "module": "commonjs", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "outDir": "./dist", + "resolveJsonModule": true + }, + "include": ["*.ts"], + "exclude": ["node_modules"] +} From 38b3835052cddfc7d1600536678f8f5dc3cb5187 Mon Sep 17 00:00:00 2001 From: Joe Huang Date: Tue, 3 Feb 2026 13:01:03 -0600 Subject: [PATCH 2/3] rm unused --- scripts/ton_wallet_generator/generate-wallet.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/ton_wallet_generator/generate-wallet.ts b/scripts/ton_wallet_generator/generate-wallet.ts index 8a5ccf809..13afc5368 100644 --- a/scripts/ton_wallet_generator/generate-wallet.ts +++ b/scripts/ton_wallet_generator/generate-wallet.ts @@ -1,7 +1,6 @@ // generate-wallet.ts import { mnemonicNew, mnemonicToWalletKey } from "@ton/crypto"; -import { WalletContractV4, WalletContractV5R1, TonClient, Address } from "@ton/ton"; -import { getHttpEndpoint } from "@orbs-network/ton-access"; +import { WalletContractV4, WalletContractV5R1} from "@ton/ton"; async function main() { const mnemonic = await mnemonicNew(); From 94d691c68d5ccada6b9e52027a94ff884056f7fb Mon Sep 17 00:00:00 2001 From: Joe Huang Date: Thu, 12 Feb 2026 14:44:14 -0600 Subject: [PATCH 3/3] update --- scripts/ton_wallet_generator/package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/ton_wallet_generator/package.json b/scripts/ton_wallet_generator/package.json index dfffc4aaf..a21374201 100644 --- a/scripts/ton_wallet_generator/package.json +++ b/scripts/ton_wallet_generator/package.json @@ -8,8 +8,7 @@ }, "dependencies": { "@ton/crypto": "^3.3.0", - "@ton/ton": "^15.0.0", - "@orbs-network/ton-access": "^2.3.3" + "@ton/ton": "^15.0.0" }, "devDependencies": { "ts-node": "^10.9.2",