-
Notifications
You must be signed in to change notification settings - Fork 0
feat(mbe): accelerate utxo #55
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
Conversation
pranavjain97
left a comment
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 you able to test accelerations as well?
| const enclavedExpressClient = req.enclavedExpressClient; | ||
| const reqId = new RequestTracer(); | ||
| const bitgo = req.bitgo; | ||
| const baseCoin = bitgo.coin(req.params.coin); | ||
| const params = req.decoded; | ||
| const walletId = req.params.walletId; | ||
| const wallet = await baseCoin.wallets().get({ id: walletId, reqId }); | ||
|
|
||
| // Log the runtime class name of the wallet object | ||
| logger.info('Wallet runtime class name: %s', wallet?.constructor.name); | ||
| logger.info('Wallet prototype chain: %s', Object.getPrototypeOf(wallet)?.constructor.name); | ||
|
|
||
| if (!wallet) { | ||
| throw new Error(`Wallet ${walletId} not found`); | ||
| } | ||
|
|
||
| // Get the signing keychain based on source | ||
| const keyIdIndex = params.source === 'user' ? KeyIndices.USER : KeyIndices.BACKUP; | ||
| const signingKeychain = await baseCoin.keychains().get({ | ||
| id: wallet.keyIds()[keyIdIndex], | ||
| }); | ||
|
|
||
| if (!signingKeychain || !signingKeychain.pub) { | ||
| throw new Error(`Signing keychain for ${params.source} not found`); | ||
| } | ||
|
|
||
| if (params.pubkey && params.pubkey !== signingKeychain.pub) { | ||
| throw new Error(`Pub provided does not match the keychain on wallet for ${params.source}`); | ||
| } |
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 see this code repeating for the 3rd time between consolidation, consolidating unspents and now this. Please re-use code between these 3 APIs
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.
fixed
| }; | ||
|
|
||
| // Accelerate transaction | ||
| const result = await wallet.accelerateTransaction(accelerationParams); |
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 is the only difference i'm seeing
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.
fixed
| * Fetch wallet and signing keychain, with validation for source and pubkey. | ||
| * Throws with a clear error if not found or mismatched. | ||
| */ | ||
| export async function getWalletAndSigningKeychain({ |
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.
Lets move this under api/master since it is only used within MBE. Also rename to handlerUtils since this isnt coin specific
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 will fix this in the later PR.
pranavjain97
left a comment
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.
You can do that change in a follow-up.
yes, I have tested for multisig and it works well. |
Tasks: WP-4793
[MBE, EBE] Create UTXO Acceleration Routes