-
Notifications
You must be signed in to change notification settings - Fork 300
feat(sdk-core): add automatic signature cleanup for Express TSS signing #7256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3566,6 +3566,36 @@ export class Wallet implements IWallet { | |
| return ret; | ||
| } | ||
|
|
||
| /** | ||
| * Ensures signature shares are in a clean state before signing a transaction. | ||
| * Automatically deletes signature shares for Full TxRequests before signing to prevent | ||
| * issues with stale or partial signatures. | ||
| * Use this for Express API and other integrations that need automatic cleanup of signatures. | ||
| * | ||
| * @param params - signing options | ||
| * @returns signed transaction | ||
| */ | ||
| public async ensureCleanSigSharesAndSignTransaction( | ||
| params: WalletSignTransactionOptions = {} | ||
| ): Promise<SignedTransaction | TxRequest> { | ||
| const txRequestId = params.txRequestId || params.txPrebuild?.txRequestId; | ||
|
|
||
| if (txRequestId && this.tssUtils && this.multisigType() === 'tss') { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we also separate the cleaning part in different method. It think it will make the method ensureCleanSigSharesAndSignTransaction more readable. |
||
| const txRequest = await this.tssUtils.getTxRequest(txRequestId); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it make sense to move this whole logic to backend via a |
||
|
|
||
| // Always clean signature shares for Full TxRequests before signing | ||
| const isFull = | ||
| txRequest.apiVersion === 'full' && | ||
| ((txRequest.transactions ?? []).length > 0 || (txRequest.messages ?? []).length > 0); | ||
|
|
||
| if (isFull) { | ||
| await this.tssUtils.deleteSignatureShares(txRequestId); | ||
| } | ||
| } | ||
|
|
||
| return this.signTransaction(params); | ||
| } | ||
|
|
||
| /** | ||
| * Signs a transaction from a TSS ECDSA wallet using external signer. | ||
| * | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.