foundry icon indicating copy to clipboard operation
foundry copied to clipboard

feat(cast): add `json` flag in `cast wallet new-mnemonic`

Open leovct opened this issue 4 months ago • 0 comments

Motivation

Closes #9138

Solution

$ castdev wallet new-mnemonic --entropy 0xdf9bf37e6fcdf9bf37e6fcdf9bf37e3c --accounts 3 --json
[
  {
    "mnemonic": "test test test test test test test test test test test junk",
    "accounts": [
      {
        "address": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
        "private_key": "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
      },
      {
        "address": "0x70997970c51812dc3a010c7d01b50e0d17dc79c8",
        "private_key": "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
      },
      {
        "address": "0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc",
        "private_key": "0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a"
      }
    ]
  }
]
$ castdev wallet new-mnemonic --entropy 0xdf9bf37e6fcdf9bf37e6fcdf9bf37e3c --accounts 3 --json | jq '.[0].mnemonic'
"test test test test test test test test test test test junk"
$ castdev wallet new-mnemonic --entropy 0xdf9bf37e6fcdf9bf37e6fcdf9bf37e3c --accounts 3 --json | jq '.[0].accounts[0].address' 
"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"

leovct avatar Oct 18 '24 12:10 leovct