junderw
6 years ago
No known key found for this signature in database
GPG Key ID: B256185D3A971908
3 changed files with
17 additions and
22 deletions
-
src/psbt.js
-
ts_src/psbt.ts
-
tsconfig.json
|
|
@ -87,7 +87,7 @@ class Psbt extends bip174_1.Psbt { |
|
|
|
}; |
|
|
|
return this.addPartialSigToInput(inputIndex, partialSig); |
|
|
|
} |
|
|
|
async signInputAsync(inputIndex, keyPair) { |
|
|
|
signInputAsync(inputIndex, keyPair) { |
|
|
|
if (!keyPair || !keyPair.publicKey) |
|
|
|
throw new Error('Need Signer to sign input'); |
|
|
|
const { hash, sighashType } = getHashAndSighashType( |
|
|
@ -96,14 +96,13 @@ class Psbt extends bip174_1.Psbt { |
|
|
|
keyPair.publicKey, |
|
|
|
this.globalMap.unsignedTx, |
|
|
|
); |
|
|
|
const partialSig = { |
|
|
|
pubkey: keyPair.publicKey, |
|
|
|
signature: bscript.signature.encode( |
|
|
|
await keyPair.sign(hash), |
|
|
|
sighashType, |
|
|
|
), |
|
|
|
}; |
|
|
|
this.addPartialSigToInput(inputIndex, partialSig); |
|
|
|
return keyPair.sign(hash).then(signature => { |
|
|
|
const partialSig = { |
|
|
|
pubkey: keyPair.publicKey, |
|
|
|
signature: bscript.signature.encode(signature, sighashType), |
|
|
|
}; |
|
|
|
this.addPartialSigToInput(inputIndex, partialSig); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
exports.Psbt = Psbt; |
|
|
|
|
|
@ -102,10 +102,7 @@ export class Psbt extends PsbtBase { |
|
|
|
return this.addPartialSigToInput(inputIndex, partialSig); |
|
|
|
} |
|
|
|
|
|
|
|
async signInputAsync( |
|
|
|
inputIndex: number, |
|
|
|
keyPair: SignerAsync, |
|
|
|
): Promise<void> { |
|
|
|
signInputAsync(inputIndex: number, keyPair: SignerAsync): Promise<void> { |
|
|
|
if (!keyPair || !keyPair.publicKey) |
|
|
|
throw new Error('Need Signer to sign input'); |
|
|
|
const { hash, sighashType } = getHashAndSighashType( |
|
|
@ -115,15 +112,14 @@ export class Psbt extends PsbtBase { |
|
|
|
this.globalMap.unsignedTx!, |
|
|
|
); |
|
|
|
|
|
|
|
const partialSig = { |
|
|
|
pubkey: keyPair.publicKey, |
|
|
|
signature: bscript.signature.encode( |
|
|
|
await keyPair.sign(hash), |
|
|
|
sighashType, |
|
|
|
), |
|
|
|
}; |
|
|
|
return keyPair.sign(hash).then(signature => { |
|
|
|
const partialSig = { |
|
|
|
pubkey: keyPair.publicKey, |
|
|
|
signature: bscript.signature.encode(signature, sighashType), |
|
|
|
}; |
|
|
|
|
|
|
|
this.addPartialSigToInput(inputIndex, partialSig); |
|
|
|
this.addPartialSigToInput(inputIndex, partialSig); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -1,6 +1,6 @@ |
|
|
|
{ |
|
|
|
"compilerOptions": { |
|
|
|
"target": "ES2017", |
|
|
|
"target": "ES2015", |
|
|
|
"module": "commonjs", |
|
|
|
"outDir": "./src", |
|
|
|
"declaration": true, |
|
|
|