Stick with ES2015 for now
This commit is contained in:
parent
77dde89acc
commit
1c8fc69780
3 changed files with 17 additions and 22 deletions
17
src/psbt.js
17
src/psbt.js
|
@ -87,7 +87,7 @@ class Psbt extends bip174_1.Psbt {
|
||||||
};
|
};
|
||||||
return this.addPartialSigToInput(inputIndex, partialSig);
|
return this.addPartialSigToInput(inputIndex, partialSig);
|
||||||
}
|
}
|
||||||
async signInputAsync(inputIndex, keyPair) {
|
signInputAsync(inputIndex, keyPair) {
|
||||||
if (!keyPair || !keyPair.publicKey)
|
if (!keyPair || !keyPair.publicKey)
|
||||||
throw new Error('Need Signer to sign input');
|
throw new Error('Need Signer to sign input');
|
||||||
const { hash, sighashType } = getHashAndSighashType(
|
const { hash, sighashType } = getHashAndSighashType(
|
||||||
|
@ -96,14 +96,13 @@ class Psbt extends bip174_1.Psbt {
|
||||||
keyPair.publicKey,
|
keyPair.publicKey,
|
||||||
this.globalMap.unsignedTx,
|
this.globalMap.unsignedTx,
|
||||||
);
|
);
|
||||||
const partialSig = {
|
return keyPair.sign(hash).then(signature => {
|
||||||
pubkey: keyPair.publicKey,
|
const partialSig = {
|
||||||
signature: bscript.signature.encode(
|
pubkey: keyPair.publicKey,
|
||||||
await keyPair.sign(hash),
|
signature: bscript.signature.encode(signature, sighashType),
|
||||||
sighashType,
|
};
|
||||||
),
|
this.addPartialSigToInput(inputIndex, partialSig);
|
||||||
};
|
});
|
||||||
this.addPartialSigToInput(inputIndex, partialSig);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.Psbt = Psbt;
|
exports.Psbt = Psbt;
|
||||||
|
|
|
@ -102,10 +102,7 @@ export class Psbt extends PsbtBase {
|
||||||
return this.addPartialSigToInput(inputIndex, partialSig);
|
return this.addPartialSigToInput(inputIndex, partialSig);
|
||||||
}
|
}
|
||||||
|
|
||||||
async signInputAsync(
|
signInputAsync(inputIndex: number, keyPair: SignerAsync): Promise<void> {
|
||||||
inputIndex: number,
|
|
||||||
keyPair: SignerAsync,
|
|
||||||
): Promise<void> {
|
|
||||||
if (!keyPair || !keyPair.publicKey)
|
if (!keyPair || !keyPair.publicKey)
|
||||||
throw new Error('Need Signer to sign input');
|
throw new Error('Need Signer to sign input');
|
||||||
const { hash, sighashType } = getHashAndSighashType(
|
const { hash, sighashType } = getHashAndSighashType(
|
||||||
|
@ -115,15 +112,14 @@ export class Psbt extends PsbtBase {
|
||||||
this.globalMap.unsignedTx!,
|
this.globalMap.unsignedTx!,
|
||||||
);
|
);
|
||||||
|
|
||||||
const partialSig = {
|
return keyPair.sign(hash).then(signature => {
|
||||||
pubkey: keyPair.publicKey,
|
const partialSig = {
|
||||||
signature: bscript.signature.encode(
|
pubkey: keyPair.publicKey,
|
||||||
await keyPair.sign(hash),
|
signature: bscript.signature.encode(signature, sighashType),
|
||||||
sighashType,
|
};
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
this.addPartialSigToInput(inputIndex, partialSig);
|
this.addPartialSigToInput(inputIndex, partialSig);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES2017",
|
"target": "ES2015",
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"outDir": "./src",
|
"outDir": "./src",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
|
|
Loading…
Reference in a new issue