From 04f891c4a4a05697175b27901228abffac13fda4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thoralf=20M=C3=BCller?= Date: Thu, 9 Nov 2023 21:50:03 +0100 Subject: [PATCH] Remove example --- .../examples/exchange/1-generate-address.ts | 55 ------------------- 1 file changed, 55 deletions(-) delete mode 100644 bindings/nodejs/examples/exchange/1-generate-address.ts diff --git a/bindings/nodejs/examples/exchange/1-generate-address.ts b/bindings/nodejs/examples/exchange/1-generate-address.ts deleted file mode 100644 index 4896052a7f..0000000000 --- a/bindings/nodejs/examples/exchange/1-generate-address.ts +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2023 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -// This example generates an address for an account. -// Run with command: -// yarn run-example ./exchange/2-generate-address.ts - -import { CoinType, SecretManager } from '@iota/sdk'; - -// This example uses secrets in environment variables for simplicity which should not be done in production. -require('dotenv').config({ path: '.env' }); - -async function run() { - try { - for (const envVar of [ - 'MNEMONIC', - 'STRONGHOLD_SNAPSHOT_PATH', - 'STRONGHOLD_PASSWORD', - ]) - if (!(envVar in process.env)) { - throw new Error( - `.env ${envVar} is undefined, see .env.example`, - ); - } - - const strongholdSecretManager = { - stronghold: { - snapshotPath: process.env.STRONGHOLD_SNAPSHOT_PATH, - password: process.env.STRONGHOLD_PASSWORD, - }, - }; - - const secretManager = new SecretManager(strongholdSecretManager); - - // A mnemonic can be generated with `Utils.generateMnemonic()`. - // Store the mnemonic in the Stronghold snapshot, this needs to be done only the first time. - // The mnemonic can't be retrieved from the Stronghold file, so make a backup in a secure place! - await secretManager.storeMnemonic(process.env.MNEMONIC as string); - - const walletAddress = await secretManager.generateEd25519Addresses({ - coinType: CoinType.IOTA, - accountIndex: 0, - range: { - start: 0, - end: 1, - }, - bech32Hrp: 'tst', - }); - console.log('Address:', walletAddress[0]); - } catch (error) { - console.error(error); - } -} - -run().then(() => process.exit());