-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* init sign bulk psbts * Export the `signMultipleTransactions` method * broadcast for all psbts instead of individual ones * Add a limit of 100 psbts for the bulk psbt signing * remove broadcast flag for signMultiple --------- Co-authored-by: Denys Hriaznov <[email protected]> Co-authored-by: Den <[email protected]> Co-authored-by: Tim Man <[email protected]>
- Loading branch information
1 parent
da590f9
commit 488fdeb
Showing
6 changed files
with
56 additions
and
4 deletions.
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,26 @@ | ||
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'); | ||
} | ||
|
||
if (psbts.length > 100) { | ||
throw new Error('psbts array must contain less than 100 psbts'); | ||
} | ||
|
||
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