Conversation
pranavjain97
left a comment
There was a problem hiding this comment.
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.
I see this code repeating for the 3rd time between consolidation, consolidating unspents and now this. Please re-use code between these 3 APIs
| }; | ||
|
|
||
| // Accelerate transaction | ||
| const result = await wallet.accelerateTransaction(accelerationParams); |
There was a problem hiding this comment.
this is the only difference i'm seeing
| * 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.
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.
I will fix this in the later PR.
pranavjain97
left a comment
There was a problem hiding this comment.
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