-
Notifications
You must be signed in to change notification settings - Fork 42
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
sign bulk psbts #42
Merged
teebszet
merged 7 commits into
develop
from
mahmoud/eng-2877-batch-sign-psbt-in-sats-connect
Nov 29, 2023
Merged
sign bulk psbts #42
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
fd465c9
init sign bulk psbts
m-aboelenein 4efc968
Export the `signMultipleTransactions` method
dhriaznov 89fe39b
broadcast for all psbts instead of individual ones
m-aboelenein a1a8790
Merge branch 'develop' into mahmoud/eng-2877-batch-sign-psbt-in-sats-…
dhriaznov 32a2e05
Add a limit of 100 psbts for the bulk psbt signing
dhriaznov 8bd0404
remove broadcast flag for signMultiple
m-aboelenein 6858de0
Merge branch 'develop' into mahmoud/eng-2877-batch-sign-psbt-in-sats-…
teebszet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './sendBtcTransaction'; | ||
export * from './signTransaction'; | ||
export * from './signMultipleTransactions'; | ||
export * from './types'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import type { Json } from 'jsontokens'; | ||
import { createUnsecuredToken } from 'jsontokens'; | ||
import { getProviderOrThrow } from '../provider'; | ||
import type { SignMultipleTransactionOptions } from './types'; | ||
|
||
export const signMultipleTransactions = async (options: SignMultipleTransactionOptions) => { | ||
const provider = await getProviderOrThrow(options.getProvider); | ||
|
||
const { psbts } = options.payload; | ||
if (!psbts || !psbts.length) { | ||
throw new Error('psbts array is required'); | ||
} | ||
try { | ||
const request = createUnsecuredToken(options.payload as unknown as Json); | ||
const response = await provider.signMultipleTransactions(request); | ||
options.onFinish?.(response); | ||
} catch (error) { | ||
console.error('[Connect] Error during sign Multiple transactions request', error); | ||
options.onCancel?.(); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just checking on this, do we expect some psbts to have broadcast set to true and some to false or should boroadcast maybe be pulled out of the PsbtPayload type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah this was the point i brought up during the daily before maybe @yknl can chime in on that one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also only passing an address without specifying and index
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should pull it out. Having some transactions broadcasted and some not would be bad UX. Developers can always make another request for transactions that they don't intend to broadcast immediately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@m-aboelenein will you change the interface here so that
broadcast
boolean property is related to all of the psbts sent to sign?