bitcoinjs / tiny-secp256k1

A tiny secp256k1 native/JS wrapper
MIT License
86 stars 55 forks source link

feat: declare and export TinySecp256k1Interface #108

Closed ChrisCho-H closed 1 year ago

ChrisCho-H commented 1 year ago

Need to declare TinySecp256k1Interface here to be used in multiple libraries. With this, dev can do like

import * as ecc from 'tiny-secp256k1';
import {BIP32Factory} from 'bip32';
import {ECPairFactory} from 'ecpair';

BIP32Factory(ecc as ecc.TinySecp256k1Interface);
ECPairFactory(ecc as ecc.TinySecp256k1Interface);

Then, dev does not need to import multiple TinySecp256k1Interface from multiple libs to prevent type error(issue being handled here).

junderw commented 1 year ago

We don't want to force people to implement methods that won't be used.

ie. if bip32 only uses methodA, why require devs to pass bip32 methodB as well.

If we base the interface on what is in this library, and use that interface with bip32 and ecpair, then we are requiring people to implement methods that never get used.