Skip to content

Commit 29f0b5a

Browse files
author
Shikhar Bakhda
committed
feat(abstract-eth): validate istss for evms
BG-58908
1 parent 45b4251 commit 29f0b5a

5 files changed

Lines changed: 24 additions & 0 deletions

File tree

modules/abstract-eth/src/abstractEthLikeCoin.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ export abstract class AbstractEthLikeCoin extends BaseCoin {
105105
return Math.pow(10, this._staticsCoin.decimalPlaces);
106106
}
107107

108+
/** @inheritDoc */
109+
isEVM(): boolean {
110+
return true;
111+
}
112+
108113
valuelessTransferAllowed(): boolean {
109114
return true;
110115
}

modules/sdk-coin-eth/src/eth.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,11 @@ export class Eth extends BaseCoin {
400400
return true;
401401
}
402402

403+
/** @inheritDoc */
404+
isEVM(): boolean {
405+
return true;
406+
}
407+
403408
getMPCAlgorithm(): MPCAlgorithm {
404409
return 'ecdsa';
405410
}

modules/sdk-core/src/bitgo/baseCoin/baseCoin.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,14 @@ export abstract class BaseCoin implements IBaseCoin {
167167
return false;
168168
}
169169

170+
/**
171+
* Flag indicating if this blockchain runs on EVM architecture.
172+
* @returns {boolean} True if the blockchain runs on EVM architecture.
173+
*/
174+
isEVM(): boolean {
175+
return false;
176+
}
177+
170178
/**
171179
* Flag indicating if this coin supports BLS-DKG wallets.
172180
* @returns {boolean} True if BLS-DKG Wallets can be created for this coin

modules/sdk-core/src/bitgo/baseCoin/iBaseCoin.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ export interface IBaseCoin {
361361
allowsAccountConsolidations(): boolean;
362362
getTokenEnablementConfig(): TokenEnablementConfig;
363363
supportsTss(): boolean;
364+
isEVM(): boolean;
364365
supportsBlsDkg(): boolean;
365366
getBaseFactor(): number | string;
366367
baseUnitsToBigUnits(baseUnits: string | number): string;

modules/sdk-core/src/bitgo/wallet/wallets.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,11 @@ export class Wallets implements IWallets {
205205
walletParams.enterprise = params.enterprise;
206206
}
207207

208+
// EVM TSS wallets must use wallet version 3
209+
if ((isTss && this.baseCoin.isEVM()) !== (params.walletVersion === 3)) {
210+
throw new Error('EVM TSS wallets are only supported for wallet version 3');
211+
}
212+
208213
if (isTss) {
209214
if (isCold) {
210215
throw new Error('TSS cold wallets are not supported at this time');

0 commit comments

Comments
 (0)