How to use the ripple-address-codec.classicAddressToXAddress function in ripple-address-codec

To help you get started, we’ve selected a few ripple-address-codec examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ripple / ripple-lib / src / offline / generate-address.ts View on Github external
function generateAddressAPI(options: GenerateAddressOptions): GeneratedAddress {
  validate.generateAddress({options})
  try {
    const secret = keypairs.generateSeed(options)
    const keypair = keypairs.deriveKeypair(secret)
    const classicAddress = keypairs.deriveAddress(keypair.publicKey)
    const returnValue: any = {
      xAddress: classicAddressToXAddress(
        classicAddress,
        false,
        options && options.test
      ),
      secret
    }
    if (options.includeClassicAddress) {
      returnValue.classicAddress = classicAddress
      returnValue.address = classicAddress
    }
    return returnValue
  } catch (error) {
    throw new errors.UnexpectedError(error.message)
  }
}
github ripple / ripple-lib / src / offline / derive.ts View on Github external
function deriveXAddress(options: {
  publicKey: string
  tag: number | false
  test: boolean
}): string {
  const classicAddress = deriveAddress(options.publicKey)
  return classicAddressToXAddress(classicAddress, options.tag, options.test)
}
github ripple / ripple-lib / src / ledger / parse / account-delete.ts View on Github external
function parseAccountDelete(tx: any): FormattedAccountDelete {
  assert.ok(tx.TransactionType === 'AccountDelete')

  return removeUndefined({
    destination: tx.Destination,
    destinationTag: tx.DestinationTag,
    destinationXAddress: classicAddressToXAddress(
      tx.Destination,
      tx.DestinationTag === undefined ? false : tx.DestinationTag,
      false
    )
  })
}