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

Hi help me create code please #1586

Open
jaylinlucero opened this issue May 8, 2024 · 2 comments
Open

Hi help me create code please #1586

jaylinlucero opened this issue May 8, 2024 · 2 comments

Comments

@jaylinlucero
Copy link

jaylinlucero commented May 8, 2024

Good afternoon, can you help me, I use the @cosmjs/proto-signing library to generate Agoric coins, after generating phrases from seed (possible buyer peanut auto assist powder draft hidden lunch that first evoke ) I get the address address - agoric1jh4jnpedwmfn3wvut4adnt6xqy2pj2km0xuz63

and when I add a seed phrase to Keplr I get the address - agoric15fr4ptrgfv5k200k94epahk3q226g2dkujdhp9

Having checked everything, I realized that the address generation is based on the derivative m/44'/118'/ and you need m/44'/564'/

added to the code

const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, {prefix: "agoric", hdPath: ("m/44'/564'"),});
but the address is still generated at 118
help me solve this issue or give an example of a script with correct generation please

@jaylinlucero
Copy link
Author

if I add it like this

const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, {hdPaths: [stringToPath("m/44'/564")], prefix: "agoric"});

then it writes an error

ReferenceError: stringToPath is not defined

Node version v20.11.0

@0xpatrickdev
Copy link

The following should work:

const hdPath = (coinType = 118, account = 0) =>
  stringToPath(`m/44'/${coinType}'/${account}'/0/0`);
  
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, {
    prefix: Agoric.Bech32MainPrefix,
    hdPaths: [hdPath(564, 0)],
  });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants