Get rid of a use of a constant that I don't need.

Need to delete a use of it from one other place and I can delete it altogether.

Some comments as well on related stuff.
This commit is contained in:
Daniel Krol 2022-05-23 17:59:22 -04:00
parent f841c897dc
commit 8ad085c24c
3 changed files with 12 additions and 2 deletions

View file

@ -260,6 +260,8 @@ export class ApproveComponent implements OnInit {
// TODO
throw "replace all of this transaction parsing and checking with bitcoinjs-lib."
return ""
// TODO Don't use this.globalVars.network here, use the network specified
// in the relevant account.ledger (assuming we even really need network)
// const prefix = CryptoService.PUBLIC_KEY_PREFIXES[this.globalVars.network as Network].deso;
// return bs58check.encode(Buffer.from([...prefix, ...keyBytes]));
}

View file

@ -88,6 +88,8 @@ export class SignUpComponent implements OnInit, OnDestroy {
// specific things that I figure we won't want to forget. This is just
// a guide for the future when we tackle signup.
// TODO Don't use this.globalVars.network here, use the network specified
// in the relevant account.ledger (assuming we even really need network)
const network = this.globalVars.network;
const mnemonic = this.mnemonicCheck;
const extraText = this.extraTextCheck;

View file

@ -1,5 +1,6 @@
import { Injectable } from '@angular/core';
import KeyEncoder from 'key-encoder';
import {GlobalVarsService} from './global-vars.service';
import * as jsonwebtoken from 'jsonwebtoken';
import * as bip32 from 'bip32';
@ -8,6 +9,7 @@ import * as bs58check from 'bs58check'
import * as lbry from 'bitcoinjs-lib' // TODO - package recommends browserify, which I did not do here. This works, but maybe there's good reason to browserify?
import * as ecpair from 'ecpair'; // TODO - required acorn-class-fields for this version of Angular's webpack to accept it. see extend-acorn.js.
// TODO deleteme once I remove the last use of this
const NETWORK = lbry.networks.mainnet
@Injectable({
@ -15,7 +17,9 @@ const NETWORK = lbry.networks.mainnet
})
export class SigningService {
constructor() { }
constructor(
private globalVars: GlobalVarsService,
) { }
// this should be audited and go into a library. hobbled this together from
// code in bitcoinjs-lib.
@ -52,7 +56,9 @@ export class SigningService {
*/
signPSBT(psbtHex: string, nonWitnessUtxoHexes: string[], signingKey: Buffer): string {
const keyPair = ecpair.ECPair.fromPrivateKey(signingKey, { network: NETWORK })
// TODO Don't use this.globalVars.network here, use the network specified
// in the relevant account.ledger (assuming we even really need network)
const keyPair = ecpair.ECPair.fromPrivateKey(signingKey, { network: this.globalVars.network })
const nonWitnessUtxos = nonWitnessUtxoHexes.map(h => Buffer.from(h, 'hex'))
const psbt = lbry.Psbt.fromHex(psbtHex)