mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-23 15:20:55 +01:00
Merge pull request #2203 from BlueWallet/ops-payjoin-bump
OPS: updated payjoin dep
This commit is contained in:
commit
d127ef86ae
4 changed files with 20 additions and 3 deletions
5
package-lock.json
generated
5
package-lock.json
generated
|
@ -17998,8 +17998,9 @@
|
|||
}
|
||||
},
|
||||
"payjoin-client": {
|
||||
"version": "git+https://github.com/bitcoinjs/payjoin-client.git#31d2118a4c0d00192d975f3a6da2a96238f8f7a5",
|
||||
"from": "git+https://github.com/bitcoinjs/payjoin-client.git#31d2118a4c0d00192d975f3a6da2a96238f8f7a5",
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/payjoin-client/-/payjoin-client-1.0.0.tgz",
|
||||
"integrity": "sha512-3LLfpP9xaSkEeBZnNkjTDAANy5y7iIv+q5E36WTUnjz0tw1Jet8CfRzMnknunSlepXl9FV7sbrp4/s3P8zewnA==",
|
||||
"requires": {
|
||||
"bitcoinjs-lib": "^5.2.0"
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
"lottie-react-native": "3.5.0",
|
||||
"metro-react-native-babel-preset": "0.63.0",
|
||||
"path-browserify": "1.0.1",
|
||||
"payjoin-client": "git+https://github.com/bitcoinjs/payjoin-client.git#31d2118a4c0d00192d975f3a6da2a96238f8f7a5",
|
||||
"payjoin-client": "1.0.0",
|
||||
"pbkdf2": "3.1.1",
|
||||
"prettier": "2.1.2",
|
||||
"process": "0.11.10",
|
||||
|
|
|
@ -46,6 +46,18 @@ export default class Confirm extends Component {
|
|||
this.isBiometricUseCapableAndEnabled = await Biometric.isBiometricUseCapableAndEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* we need to look into `recipients`, find destination address and return its outputScript
|
||||
* (needed for payjoin)
|
||||
*
|
||||
* @return {string}
|
||||
*/
|
||||
getPaymentScript() {
|
||||
for (const recipient of this.state.recipients) {
|
||||
return bitcoin.address.toOutputScript(recipient.address);
|
||||
}
|
||||
}
|
||||
|
||||
send() {
|
||||
this.setState({ isLoading: true }, async () => {
|
||||
try {
|
||||
|
@ -54,7 +66,9 @@ export default class Confirm extends Component {
|
|||
await this.broadcast(this.state.tx);
|
||||
} else {
|
||||
const wallet = new PayjoinTransaction(this.state.psbt, txHex => this.broadcast(txHex), this.state.fromWallet);
|
||||
const paymentScript = this.getPaymentScript();
|
||||
const payjoinClient = new PayjoinClient({
|
||||
paymentScript,
|
||||
wallet,
|
||||
payjoinUrl: this.state.payjoinUrl,
|
||||
});
|
||||
|
|
|
@ -57,6 +57,7 @@ describe('PayjoinTransaction', () => {
|
|||
};
|
||||
|
||||
const payjoinClient = new PayjoinClient({
|
||||
paymentScript: bitcoin.address.toOutputScript('bc1qyvdzueznsh0rsyfqzdtj9ce7nlx4rlg2v93lcl'),
|
||||
wallet,
|
||||
payjoinRequester: payjoinRequesterMock,
|
||||
});
|
||||
|
@ -110,6 +111,7 @@ describe('PayjoinTransaction', () => {
|
|||
};
|
||||
|
||||
const payjoinClient = new PayjoinClient({
|
||||
paymentScript: bitcoin.address.toOutputScript('bc1qy0ydthpa35m37pvwl5tu76j0srcmcwtmaur3aw'),
|
||||
wallet,
|
||||
payjoinRequester: payjoinRequesterMock,
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue