cmdruid / tapscript

A humble library for working with Tapscript and Bitcoin Transactions.
https://www.npmjs.com/package/@cmdcode/tapscript
Creative Commons Zero v1.0 Universal
188 stars 49 forks source link

ReferenceError: SecretKey is not defined #16

Closed PomegranateApps closed 10 months ago

PomegranateApps commented 1 year ago

How do you import the SecretKey constructor?

It's used in the examples.

cmdruid commented 1 year ago

SecretKey is part of an older version of the crypto-utils library. You can install the proper version via the command:

npm install @cmdcode/crypto-utils@2.0.2

then import via:

import { SecretKey } from '@cmdcode/crypto-utils'
PomegranateApps commented 1 year ago

Ok thank you! I'm still getting "TypeError: SecretKey is not a constructor" even with 2.0.2.

PomegranateApps commented 1 year ago

Do you also have an updated code example with the latest version of your crypto npm?

hathbanger commented 1 year ago

Would love to see some updated code as well!

Ok thank you! I'm still getting "TypeError: SecretKey is not a constructor" even with 2.0.2.

runnin into this as well..

and then the previous util.getPublicKey() function doesn't exist in crypto-utils either.

cmdruid commented 1 year ago

In the latest version of @cmdcode/crypto-utils:

import * as ecc from '@cmdcode/crypto-utils'

const seckey = ecc.keys.gen_seckey()

Everything is typed so you should be able to explore the API for ecc and ecc.keys using vscode or any code editor that supports completions with typescript.

I am still working on updating the documentation for @cmdcode/crypto-utils and @cmdcode/tapscript in my free time. I apologize for the delay! Let me know if you have any further questions on this.