Skip to content

Commit 2545b25

Browse files
committed
fix(mbe): added etherscan api token as recovery params
TICKET: WP-5168
1 parent b254361 commit 2545b25

File tree

4 files changed

+35
-5
lines changed

4 files changed

+35
-5
lines changed

masterBitgoExpress.json

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,9 +462,6 @@
462462
"ledgerSequenceDelta": {
463463
"type": "number"
464464
},
465-
"gasPrice": {
466-
"type": "number"
467-
},
468465
"noSplitChange": {
469466
"type": "boolean"
470467
},
@@ -762,6 +759,36 @@
762759
"coinSpecificParams": {
763760
"type": "object",
764761
"properties": {
762+
"ecdsaCosmosLikeRecoverySpecificParams": {
763+
"type": "object",
764+
"properties": {
765+
"rootAddress": {
766+
"type": "string"
767+
}
768+
},
769+
"required": [
770+
"rootAddress"
771+
]
772+
},
773+
"ecdsaEthLikeRecoverySpecificParams": {
774+
"type": "object",
775+
"properties": {
776+
"apiKey": {
777+
"type": "string"
778+
},
779+
"bitgoDestinationAddress": {
780+
"type": "string"
781+
},
782+
"walletContractAddress": {
783+
"type": "string"
784+
}
785+
},
786+
"required": [
787+
"apiKey",
788+
"bitgoDestinationAddress",
789+
"walletContractAddress"
790+
]
791+
},
765792
"evmRecoveryOptions": {
766793
"type": "object",
767794
"properties": {

src/__tests__/api/master/recoveryWalletMpcV2.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ describe('MBE mpcv2 recovery', () => {
5858
it('should recover a HETH (an eth-like) wallet by calling the enclaved express service', async () => {
5959
const etherscanTxlistNock = nock('https://api.etherscan.io')
6060
.get(
61-
`/v2/api?chainid=17000&module=account&action=txlist&address=0x43442e403d64d29c4f64065d0c1a0e8edc03d6c8`,
61+
`/v2/api?chainid=17000&module=account&action=txlist&address=0x43442e403d64d29c4f64065d0c1a0e8edc03d6c8&apikey=etherscan-api-key`,
6262
)
6363
.matchHeader('any', () => true)
6464
.reply(200, {
@@ -71,7 +71,7 @@ describe('MBE mpcv2 recovery', () => {
7171

7272
const etherscanBalanceNock = nock('https://api.etherscan.io')
7373
.get(
74-
`/v2/api?chainid=17000&module=account&action=balance&address=0x43442e403d64d29c4f64065d0c1a0e8edc03d6c8`,
74+
`/v2/api?chainid=17000&module=account&action=balance&address=0x43442e403d64d29c4f64065d0c1a0e8edc03d6c8&apikey=etherscan-api-key`,
7575
)
7676
.matchHeader('any', () => true)
7777
.reply(200, {
@@ -105,6 +105,7 @@ describe('MBE mpcv2 recovery', () => {
105105
ecdsaEthLikeRecoverySpecificParams: {
106106
walletContractAddress: '0x43442e403d64d29c4f64065d0c1a0e8edc03d6c8',
107107
bitgoDestinationAddress: '0x43442e403d64d29c4f64065d0c1a0e8edc03d6c8', //placeholder
108+
apiKey: `etherscan-api-key`,
108109
},
109110
},
110111
});

src/api/master/handlers/recoveryWallet.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ export async function handleRecoveryWalletOnPrem(
271271
gasLimit,
272272
bitgoDestinationAddress: coinSpecificParams?.ecdsaEthLikeRecoverySpecificParams
273273
?.bitgoDestinationAddress as string,
274+
apiKey: coinSpecificParams?.ecdsaEthLikeRecoverySpecificParams?.apiKey
274275
};
275276
} else if (isCosmosLikeCoin(sdkCoin)) {
276277
params.cosmosLikeParams = {

src/api/master/routers/masterApiSpec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export const RecoveryParamTypes = {
7979
ecdsaEthLikeRecoverySpecificParams: t.type({
8080
walletContractAddress: t.string,
8181
bitgoDestinationAddress: t.string,
82+
apiKey: t.string,
8283
}),
8384

8485
// ECDSA Cosmos-like recovery specific parameters

0 commit comments

Comments
 (0)