简体   繁体   中英

xrpl-accountlib - UnhandledPromiseRejectionWarning: TypeError: AddressCodec.isValidSeed is not a function

Here, I use both isValidAddress and isValidSeed from utils. isValidSeed throws an error, but isValidAddress does not after being used in a similar fashion.

I get no other errors in the code.

if(process.argv.length < 3) {
  console.log("Usage: node dist/index <r-address>")
  process.exit(1)
}
import { XrplClient } from "xrpl-client"
import { derive, utils, XRPL_Account } from "xrpl-accountlib"

const client = new XrplClient("wss://s.altnet.rippletest.net:51233")

const main =async () => {
  const data = await client.send({
    id: 1,
    command: "account_info",
    account: process.argv[2]

  })
  console.log(data)

//checking isValidAddress usage
  if(!utils.isValidAddress(data.account_data.Account)) {
    console.log("Invalid r-address")
    process.exit(1)
  }
  console.log("Valid r-address")
  

//checking isValidSeed usage
  if(!utils.isValidSeed(process.argv[2])) {
    console.log("Invalid Seed")
    process.exit(1)
  }
}
main()

which version of the xrpl-accountlib library do you use?

There was a fix regarding the isValidSeed method around December 2021:

isValidSeed 修复

Make sure to use the latest version of the xrpl-accountlib.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM