Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/masterBitgoExpress/routers/accelerateRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,12 @@ const AccelerateResponse: HttpResponse = {
};

/**
* Accelerate transaction (advanced)
* Advanced Wallets - Accelerate Transaction
*
* Send a new transaction to accelerate the targeted unconfirmed transaction either by using Child-Pays-For-Parent (CPFP) or Replace-By-Fee (RBF).
*
* Retrieves the private key from KMS using the provided public key, then signs and broadcasts the transaction.
*
* Use this endpoint only with advanced wallets. For other wallet types, use [Accelerate Transaction](https://developers.bitgo.com/reference/expresswalletacceleratetx).
*
* @tag Advanced Wallets
Expand Down
51 changes: 2 additions & 49 deletions src/masterBitgoExpress/routers/awmExpressHealth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { MasterExpressConfig } from '../../shared/types';
import logger from '../../shared/logger';
import { responseHandler } from '../../shared/middleware';
import { AdvancedWalletManagerClient } from '../clients/advancedWalletManagerClient';
import { PingResponseType, VersionResponseType } from '../../types/health';
import { PingResponseType } from '../../types/health';
import { customDecodeErrorFormatter } from '../../shared/errorFormatters';

// Response type for /ping/advancedWalletManager endpoint
Expand All @@ -21,16 +21,8 @@ const PingAwmResponse: HttpResponse = {
}),
};

const VersionAwmResponse: HttpResponse = {
200: VersionResponseType,
500: t.type({
error: t.string,
details: t.string,
}),
};

/**
* Ping (MBE-to-AWM)
* Advanced Wallets - Ping Advanced Wallet Manager
*
* Test your connection between the Advanced Wallet Manager (AWM) and the Master Bitgo Express (MBE) servers.
*
Expand All @@ -45,29 +37,10 @@ const PingAwmRoute = httpRoute({
description: 'Ping the advanced wallet manager server',
});

/**
* Check Version (MBE-to-AWM)
*
* Use the Master Bitgo Express (MBE) server to check your version of the Advanced Wallet Manager (AWM) server. Calling this endpoint instructs the MBE server to call [Check AWM Version](https://developers.bitgo.com/reference/v1healthversionawm).
*
* @tag Advanced Wallets
* @operationId advancedwallet.mbe.awm.version
*/
const VersionAwmRoute = httpRoute({
method: 'GET',
path: '/version/advancedWalletManager',
request: httpRequest({}),
response: VersionAwmResponse,
description: 'Get the version of the advanced wallet manager server',
});

export const AdvancedWalletManagerHealthSpec = apiSpec({
'advancedwallet.mbe.awm.ping': {
post: PingAwmRoute,
},
'advancedwallet.mbe.awm.version': {
get: VersionAwmRoute,
},
});

// Create router with handlers
Expand Down Expand Up @@ -107,25 +80,5 @@ export function createAdvancedWalletManagerHealthRouter(
}),
]);

router.get('advancedwallet.mbe.awm.version', [
responseHandler(async () => {
try {
// Use the client's getVersion method instead of direct HTTP request
const versionResponse = await awmClient.getVersion();

return Response.ok({
version: versionResponse.version,
name: versionResponse.name,
});
} catch (error) {
logger.error('Failed to get version from advanced wallet manager:', { error });
return Response.internalError({
error: 'Failed to get version from advanced wallet manager',
details: error instanceof Error ? error.message : String(error),
});
}
}),
]);

return router;
}
4 changes: 3 additions & 1 deletion src/masterBitgoExpress/routers/consolidateRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ export const ConsolidateResponse: HttpResponse = {
};

/**
* Consolidate account (advanced)
* Advanced Wallets - Consolidate Account
*
* Build, sign, and send a consolidation transaction, all in one call. For account-based assets, consolidating the balances in the receive addresses to the base address maximizes the spendable balance of a wallet.
*
* Retrieves the private key from KMS using the provided public key or common keychain, then signs and broadcasts the transaction.
*
* Use this endpoint only with advanced wallets. For other wallet types, use [Consolidate account (simple)](https://developers.bitgo.com/reference/expresswalletconsolidateaccount).
*
* @tag Advanced Wallets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ export const ConsolidateUnspentsResponse: HttpResponse = {
};

/**
* Consolidate unspents (advanced)
* Advanced Wallets - Consolidate Unspents
*
* Builds, signs, and sends a transaction to consolidate unspents all in 1 call. Consolidating unspents is only for UTXO-based assets.
*
* Retrieves the private key from KMS using the provided public key, then signs and broadcasts the transaction.
*
* Use this endpoint only with advanced wallets. For other wallet types, use [Consolidate unspents (simple)](https://developers.bitgo.com/reference/expresswalletconsolidateunspents).
*
* @tag Advanced Wallets
Expand Down
8 changes: 4 additions & 4 deletions src/masterBitgoExpress/routers/generateWalletRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,12 @@ const GenerateWalletRequest = {
};

/**
* Generate wallet (advanced)
* Advanced Wallets - Generate Wallet
*
* Create a new advanced wallet. Calling this endpoint does the following:
* 1. Creates the user keychain in the advanced wallet manager and encrypts it with the respective key management service (KMS).
* 2. Creates the backup keychain in the advanced wallet manager and encrypts it with the respective KMS.
* 3. Uploads the public user and backup keys to BitGo.
* 1. Generates user keychain in isolated AWM, then sends to KMS (encrypts private key, stores public key mapping).
* 2. Generates backup keychain in isolated AWM, then sends to KMS (encrypts private key, stores public key mapping).
* 3. Uploads the user and backup public keys to BitGo.
* 4. Creates the BitGo key on the BitGo service.
* 5. Creates the wallet on BitGo with the 3 keys.
*
Expand Down
4 changes: 2 additions & 2 deletions src/masterBitgoExpress/routers/healthCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const VersionResponse: HttpResponse = {
};

/**
* Ping (MBE)
* Advanced Wallets - Ping
*
* Test your connection to the Master Bitgo Express (MBE) server.
*
Expand All @@ -32,7 +32,7 @@ const PingRoute = httpRoute({
});

/**
* Check Version (MBE)
* Advanced Wallets - Check Version
*
* Check your version of the Master Bitgo Express (MBE) server.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,15 @@ const RecoveryConsolidationsWalletResponse: HttpResponse = {
};

/**
* Consolidate and recover assets (advanced)
* Advanced Wallets - Consolidate and Recover Assets
*
* Recover assets from an advanced wallet with a balance in multiple receive addresses. Build, sign, and send a consolidation and recovery, all in one call. Sign using your user and backup keys. Works for both multisignature and MPC recoveries.
*
* To recover assets from an advanced wallet with a balance only in the base address, use [Recover assets (advanced)](https://developers.bitgo.com/reference/advancedwalletrecovery).
* Retrieves the private keys from KMS using the provided public keys or common keychain, then signs and returns the broadcastable transaction hex.
*
* Note: This endpoint only works when AWM and MBE are running in recovery mode.
*
* To recover assets from an advanced wallet with a balance only in the base address, use [Advanced Wallets - Recover Assets](https://developers.bitgo.com/reference/advancedwalletrecovery).
*
* Use this endpoint only with advanced wallets. For other wallet types, use the [Wallet Recovery Wizard](https://developers.bitgo.com/docs/wallets-recover#/).
*
Expand Down
8 changes: 6 additions & 2 deletions src/masterBitgoExpress/routers/recoveryRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,15 @@ const RecoveryWalletRequest = {
};

/**
* Recover assets (advanced)
* Advanced Wallets - Recover Assets
*
* Recover assets from an advanced wallet with a balance only in the base address. Works for both multisignature and MPC recoveries.
*
* To recover assets from an advanced wallet with balances in multiple receive addresses, use [Consolidate and recover assets (advanced)](https://developers.bitgo.com/reference/advancedwalletconsolidaterecovery).
* Retrieves the private keys from KMS using the provided public keys or common keychain, then signs and returns the broadcastable transaction hex.
*
* Note: This endpoint only works when AWM and MBE are running in recovery mode.
*
* To recover assets from an advanced wallet with balances in multiple receive addresses, use [Advanced Wallets - Consolidate and Recover Assets](https://developers.bitgo.com/reference/advancedwalletconsolidaterecovery).
*
* Use this endpoint only with advanced wallets. For other wallet types, use the [Wallet Recovery Wizard](https://developers.bitgo.com/docs/wallets-recover#/).
*
Expand Down
6 changes: 4 additions & 2 deletions src/masterBitgoExpress/routers/sendManyRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,13 @@ export const SendManyResponse: HttpResponse = {
};

/**
* Send to many (advanced)
* Advanced Wallets - Send to Many
*
* Send coins or tokens to one or more recipients. You can use this endpoint to schedule outgoing transactions in bulk, lowering your aggregate amount of blockchain fees.
*
* Works with both multisignature and MPC wallets. Also supports external-signer mode.
* Retrieves the private key from KMS using the provided public key, then signs and broadcasts the transaction.
*
* Works with both multisignature and MPC wallets.
*
* Works with most BitGo-supported assets, but currently unavailable for: ALGO, ARBETH, AVAXC, CELO, CELO:CUSD, CSPR, DOT, EOS, HTETH:BGERCH, NEAR, OPETH, STX, TON, TRX, TRX:USDC, XLM, XRP, XTZ
*
Expand Down
4 changes: 3 additions & 1 deletion src/masterBitgoExpress/routers/signAndSendMpcRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ export const SignMpcResponse: HttpResponse = {
};

/**
* Sign and send MPC transaction (advanced)
* Advanced Wallets - Sign and Send MPC Transaction
*
* Sign and send a MPC transaction.
*
* Retrieves the private key from KMS using the provided common keychain, then signs and broadcasts the transaction.
*
* Use this endpoint only with advanced wallets. For other wallet types, use [Sign MPC transaction](https://developers.bitgo.com/reference/expresswalletsigntxtss).
*
* @tag Advanced Wallets
Expand Down