Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: hot wallet cli #74

Merged
merged 21 commits into from
Jul 15, 2024
Merged

feat: hot wallet cli #74

merged 21 commits into from
Jul 15, 2024

Conversation

kaladinlight
Copy link
Contributor

@kaladinlight kaladinlight commented Jun 20, 2024

Closes #69

Create and Fund:
hotWalletCliCreateAndFund

Recover from keystore file:
hotWalletCliRecoverKeystore

Recover from custom keystore file:
hotWalletCliCustomKeystoreFile

Recover from manual mnemonic:
hotWalletCliManualMnemonic

Fail to recover:
hotWalletCliFail

Testing steps:

Add break to signTransactions and/or broadcastTransactions loops to simulate a non complete sign or broadcast step and validate script picks up properly. Known issue is the balance check in wallet.fund() that is only valid on initial fund, but will fail when trying to pick up after 1 or more txs have been broadcast. Also known issue is we broadcast too fast currently resulting in invalid nonce errors

NO NEED TO TEST MULTISIG DOCS (unrelated to script, will be validated manually outside of these PRs)

  1. Seed mock distribution epoch (july example - replace reward address to an address you own if you want to send to yourself) index.ts
  await ipfs.addEpoch({
    number: 0,
    startTimestamp: 1714521600000,
    endTimestamp: 1717199999999,
    startBlock: 206540038,
    endBlock: 217103096,
    totalRevenue: '3',
    totalRewardUnits: '3',
    distributionRate: 0.25,
    burnRate: 0.25,
    distributionsByStakingAddress: {
      '0x6bF198c2B5c8E48Af4e876bc2173175b89b1DA0C': {
        amount: '1',
        rewardUnits: '1',
        txId: '',
        rewardAddress: 'thor10prpfj07j6a7rvtd5tfqhdzp8xsypzatfrc2v5',
      },
      '0x6bF198c2B5c8E48Af4e876bc2173175b89b1DA0D': {
        amount: '2',
        rewardUnits: '2',
        txId: '',
        rewardAddress: 'thor10prpfj07j6a7rvtd5tfqhdzp8xsypzatfrc2v5',
      },
    },
  })
  1. Use the generated unsignedTx_epoch-N.json file to manually fund the hot wallet from a wallet that you control (doesn't have to be multisig). Be sure to use the correct amount to send for funding and you can add the same memo if desired, but has no affect on the script itself

@kaladinlight kaladinlight force-pushed the hot-wallet-cli-part-1 branch 2 times, most recently from f1ec2ab to 031f972 Compare June 20, 2024 21:44
@gomesalexandre gomesalexandre self-requested a review June 28, 2024 08:13
Copy link
Contributor

@gomesalexandre gomesalexandre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First pass, untested but conceptually looks sane to me!

scripts/hotWalletCli/index.ts Outdated Show resolved Hide resolved
scripts/hotWalletCli/wallet.ts Outdated Show resolved Hide resolved
@kaladinlight kaladinlight changed the title feat: hot wallet cli part 1 feat: hot wallet cli Jul 8, 2024
Copy link
Contributor

@0xean 0xean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of comments, nothing really blocking, just questions.

scripts/hotWalletCli/wallet.ts Show resolved Hide resolved
scripts/hotWalletCli/wallet.ts Show resolved Hide resolved
scripts/hotWalletCli/wallet.ts Show resolved Hide resolved
scripts/hotWalletCli/wallet.ts Show resolved Hide resolved
scripts/hotWalletCli/wallet.ts Show resolved Hide resolved
@kaladinlight kaladinlight merged commit bf6db8d into main Jul 15, 2024
2 checks passed
@kaladinlight kaladinlight deleted the hot-wallet-cli-part-1 branch July 15, 2024 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants