@txnlab/use-wallet 2.2.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -481,7 +481,7 @@ useEffect(() => {
481
481
 
482
482
  - Documentation - https://developer.algorand.org/docs/rest-apis/kmd
483
483
 
484
- ### Custom Provider
484
+ ### Custom
485
485
 
486
486
  - Documentation - [Custom Provider](#custom-provider)
487
487
 
package/dist/cjs/index.js CHANGED
@@ -2635,13 +2635,23 @@ class KMDWalletClient extends BaseClient {
2635
2635
  return;
2636
2636
  }
2637
2637
  // Not to be signed by our signer, skip it
2638
- else if (!connectedAccounts.includes(this.algosdk.encodeAddress(dtxn.snd))) {
2639
- return;
2638
+ else {
2639
+ const senderAddress = this.algosdk.encodeAddress(dtxn.snd);
2640
+ const rekeyAddress = dtxn.rekey ? this.algosdk.encodeAddress(dtxn.rekey) : null;
2641
+ const isSignerConnected = rekeyAddress
2642
+ ? connectedAccounts.includes(rekeyAddress) && connectedAccounts.includes(senderAddress)
2643
+ : connectedAccounts.includes(senderAddress);
2644
+ if (!isSignerConnected) {
2645
+ return;
2646
+ }
2640
2647
  }
2641
2648
  // overwrite with an empty blob
2642
2649
  signedTxns[idx] = new Uint8Array();
2643
2650
  const txn = this.algosdk.Transaction.from_obj_for_encoding(dtxn);
2644
- signingPromises.push(this.#client.signTransaction(token, pw, txn));
2651
+ const promise = txn.reKeyTo
2652
+ ? this.#client.signTransactionWithSpecificPublicKey(token, pw, txn, txn.reKeyTo.publicKey)
2653
+ : this.#client.signTransaction(token, pw, txn);
2654
+ signingPromises.push(promise);
2645
2655
  });
2646
2656
  const signingResults = await Promise.all(signingPromises);
2647
2657
  // Restore the newly signed txns in the correct order