Merge branch 'master' into electra_merge

# Conflicts:
#	CHANGELOG.md
This commit is contained in:
Chris Berry
2025-02-06 16:42:26 +00:00
8 changed files with 87 additions and 8 deletions

View File

@@ -1,3 +1,4 @@
// Copyright © 2020 - 2025 Weald Technology Trading
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
@@ -56,6 +57,12 @@ func ParseAccount(ctx context.Context,
account, err = parseAccountFromKeystorePath(ctx, accountStr, supplementary, unlock)
}
}
if err != nil {
if strings.Count(accountStr, " ") > 7 {
// It is also possible that this is a mnemonic with "/" in the additional word, so try that as well.
account, err = parseAccountFromMnemonic(ctx, accountStr, supplementary, unlock)
}
}
if err != nil {
return nil, err
}

View File

@@ -1,4 +1,4 @@
// Copyright © 2020 Weald Technology Trading
// Copyright © 2020 - 2025 Weald Technology Trading
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
@@ -75,6 +75,18 @@ func TestParseAccount(t *testing.T) {
supplementary: []string{"m/12381/3600/0/0"},
expectedPubkey: "0x99b1f1d84d76185466d86c34bde1101316afddae76217aa86cd066979b19858c2c9d9e56eebc1e067ac54277a61790db",
},
{
name: "ShortMnemonic",
accountStr: "aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban art",
supplementary: []string{"m/12381/3600/0/0"},
expectedPubkey: "0x99b1f1d84d76185466d86c34bde1101316afddae76217aa86cd066979b19858c2c9d9e56eebc1e067ac54277a61790db",
},
{
name: "ShortMnemonicWith25th",
accountStr: `aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban art !"£$%^&*()<>,./?;:'@#~]}[{-_=+`,
supplementary: []string{"m/12381/3600/0/0"},
expectedPubkey: "0xa9264986cbde1f05d4c37ed57b03c476f360f0c64cf4a41752c3d352f60caebb6555c5522f0f962962a619336e1539f2",
},
{
name: "MnemonicUnlocked",
accountStr: "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon art",