Skip to content

Commit

Permalink
final startup docs and yarn scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
kaladinlight committed Jun 20, 2024
1 parent f23f2c6 commit 031f972
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 5 deletions.
18 changes: 18 additions & 0 deletions scripts/hotWalletCli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Prerequisites

- NodeJS (v18+): https://nodejs.org/en/download/package-manager
- Yarn: https://classic.yarnpkg.com/lang/en/docs/install/#debian-stable

## Setup

- Install dependencies:
```bash
yarn
```

## Running

- Run script:
```bash
yarn start
```
4 changes: 2 additions & 2 deletions scripts/hotWalletCli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ const run = async () => {
const { mnemonic, keystoreFile: keystore } = await create()

info(`Encrypted keystore file created (${keystore})`)
info('Please back up your mnemonic in another secure way in case keystore file recovery fails!')
info('Please back up your mnemonic in another secure way in case keystore file recovery fails!!!')
info(`Mnemonic: ${mnemonic}`)
warn('DO NOT INTERACT WITH THIS WALLET FOR ANY REASON OUTSIDE OF THIS SCRIPT!')
warn('DO NOT INTERACT WITH THIS WALLET FOR ANY REASON OUTSIDE OF THIS SCRIPT!!!')

const confirmed = await prompts.confirm({
message: 'Have you securely backed up your mnemonic? ',
Expand Down
3 changes: 2 additions & 1 deletion scripts/hotWalletCli/mnemonic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ export const create = async (): Promise<{
const mnemonic = generateMnemonic()
const encryptedMnemonic = encryptMnemonic(mnemonic, password)

// save file as related to epoch
// TODO: save file as related to epoch
const keystoreFile = path.join(RFOX_DIR, 'keystore.txt')

fs.writeFileSync(keystoreFile, encryptedMnemonic, 'utf8')

return { mnemonic, keystoreFile }
Expand Down
4 changes: 4 additions & 0 deletions scripts/hotWalletCli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
"node": ">=18"
},
"license": "MIT",
"scripts": {
"clean": "rm -rf node_modules",
"start": "tsx index.ts"
},
"dependencies": {
"@inquirer/core": "^8.2.2",
"@inquirer/prompts": "^5.0.5",
Expand Down
4 changes: 2 additions & 2 deletions scripts/hotWalletCli/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ export class Wallet {
messages: [
{
'@type': '/types.MsgSend',
//from_address: SHAPESHIFT_MULTISIG_ADDRESS,
from_address: 'thor10prpfj07j6a7rvtd5tfqhdzp8xsypzatfrc2v5',
from_address: SHAPESHIFT_MULTISIG_ADDRESS,
to_address: address,
amount: [
{
Expand Down Expand Up @@ -114,6 +113,7 @@ export const fund = async (wallet: Wallet, amount: string) => {
const unsignedTx = await wallet.buildFundingTransaction(amount)
const unsignedTxFile = path.join(RFOX_DIR, 'unsigned_tx.json')

// TODO: save file as related to epoch
fs.writeFileSync(unsignedTxFile, JSON.stringify(unsignedTx, null, 2), 'utf8')

info(`Unsigned funding transaction created (${unsignedTxFile})`)
Expand Down

0 comments on commit 031f972

Please sign in to comment.