-
Notifications
You must be signed in to change notification settings - Fork 274
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
feat(abstract-utxo): add psbt support backup recovery #3755
Conversation
493a951
to
7cb08ff
Compare
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.
were all of the fixtures changed because you changed the mocking? Was there a reason why that was needed?
@@ -62,16 +55,17 @@ export interface FormattedOfflineVaultTxInfo { | |||
* @param txHex | |||
* @returns {{txHex: *, txInfo: {unspents: *}, feeInfo: {}, coin: void}} | |||
*/ | |||
function formatForOfflineVault<TNumber extends number | bigint = number>( |
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.
why would you take away TNumber
here?
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.
As per new change, OfflineVaultTxInfo
uses valueString
to carry large values. value is always number
. So no need to for Generics.
const safeRootWalletKeys = new RootWalletKeys( | ||
rootWalletKeys.triple.map((bip32) => bip32.neutered()) as Triple<BIP32Interface>, | ||
rootWalletKeys.derivationPrefixes | ||
); | ||
const xPubs = safeRootWalletKeys.triple.map( |
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.
nice
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.
maybe we need RootWalletPublicKeys
Primarily what you mentioned (prevTx id change changes txHex) and also few cases returns PSBT hex instread transaction hex, new response fields |
7cb08ff
to
8c385f0
Compare
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.
nits mostly
@@ -1,42 +0,0 @@ | |||
/** |
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.
this could have been a separate commit
export interface OfflineVaultTxInfo<TNumber extends number | bigint = number> { | ||
inputs: WalletUnspent<TNumber>[]; | ||
export interface OfflineVaultTxInfo { | ||
inputs: WalletUnspent<number>[]; |
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.
I suppose OfflineVault always takes number? Probably would have been a good separate commit as well.
* Builds a funds recovery transaction without BitGo | ||
* Builds a funds recovery transaction without BitGo. | ||
* | ||
* Returns transaction hex for unsigned sweep transaction, half signed backup recovery transaction with KRS provider (only keyternal), |
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.
* Returns transaction hex for unsigned sweep transaction, half signed backup recovery transaction with KRS provider (only keyternal), | |
* Returns transaction hex in legacy format for unsigned sweep transaction, half signed backup recovery transaction with KRS provider (only keyternal), |
@@ -276,6 +283,7 @@ export async function backupKeyRecovery<TNumber extends number | bigint = number | |||
|
|||
const isKrsRecovery = getIsKrsRecovery(params); | |||
const isUnsignedSweep = getIsUnsignedSweep(params); | |||
const respondWithTx = isUnsignedSweep || !isKrsRecovery || params.krsProvider === 'keyternal'; |
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.
const respondWithTx = isUnsignedSweep || !isKrsRecovery || params.krsProvider === 'keyternal'; | |
const responseFormat = (isUnsignedSweep || !isKrsRecovery || params.krsProvider === 'keyternal') ? 'legacy' : 'psbt'; |
|
||
// Construct a transaction | ||
txInfo.inputs = unspents; | ||
txInfo.inputs = respondWithTx |
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.
txInfo.inputs = respondWithTx | |
txInfo.inputs = responseFormat === 'legacy' ? |
@@ -203,32 +237,38 @@ function run( | |||
|
|||
if (params.hasUserSignature && params.hasBackupSignature) { | |||
it('has no placeholder signatures', function () { |
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.
it('has no placeholder signatures', function () { | |
it('has no placeholder signatures', function (this: mocha.Context) { |
then you can get rid of the @ts-expect-error
further down
const safeRootWalletKeys = new RootWalletKeys( | ||
rootWalletKeys.triple.map((bip32) => bip32.neutered()) as Triple<BIP32Interface>, | ||
rootWalletKeys.derivationPrefixes | ||
); | ||
const xPubs = safeRootWalletKeys.triple.map( |
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.
maybe we need RootWalletPublicKeys
8c385f0
to
8ec4522
Compare
PSBT is used to build and sign backup recovery and unsigned sweep Ticket: BTC-317
8ec4522
to
b312a86
Compare
No description provided.