XRPLF / xrpl.js

A JavaScript/TypeScript API for interacting with the XRP Ledger in Node.js and the browser
https://xrpl.org/
1.2k stars 511 forks source link

TypeError - Cannot read properties of undefined (reading 'length') #1780

Closed diadal closed 2 years ago

diadal commented 2 years ago

create wallet not working deno

const createwallet = new (xrpl as any).Wallet()
    console.log('createwallet', createwallet)
    return createwallet
Screen Shot 2021-11-03 at 11 32 06 AM
mvadari commented 2 years ago

The Wallet constructor requires publicKey and privateKey parameters: https://js.xrpl.org/classes/Wallet.html#constructor

If you're looking to create a new wallet, then you want Wallet.generate. If you're on testnet/devnet and want a wallet that has already been funded (and the account therefore exists), then you can use fundWallet

intelliot commented 2 years ago

@diadal We're closing this issue due to inactivity, but if the issue persists, let us know!

mrosendin commented 2 years ago

Thanks @mvadari @intelliot, I just ran into this issue today. The documentation needs to be updated at https://xrpl.org/get-started-using-javascript.html, particularly this part:

If you just want to generate keys, you can create a new Wallet instance like this:

const test_wallet = new xrpl.Wallet()
mvadari commented 2 years ago

Yes, there's a PR up for that: https://github.com/XRPLF/xrpl-dev-portal/pull/1256 Thanks for reporting.