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

Typescript error when using the method `generateAddress()` #974

Closed oktapodia closed 5 years ago

oktapodia commented 5 years ago

Hello,

I have a little typing error when trying to use the method generateAddress from RippleAPI in typescript.

The auto-generated typing file in ripple-lib/dist/npm/offline/generate-address.d.ts contains: declare function generateAddressAPI(options?: Object): Object;

And it should contains the following typing: https://github.com/ripple/ripple-lib/blob/develop/src/offline/generate-address.ts#L5

Then when i'm trying to get the address or secret from this response, I'm getting these errors:

Do you know how to make it compliant?

Regards

oktapodia commented 5 years ago

Actually, I found that it has been fixed by https://github.com/ripple/ripple-lib/pull/968, do you have an ETA for the new version?

intelliot commented 5 years ago

@oktapodia Good catch. Here's a temporary workaround:

const address = api.generateAddress() as {address: string, secret: string}
const keypair = api.deriveKeypair(address.secret)

The new version will be released within a day or so.