Skip to content

Commit

Permalink
Merge pull request #3978 from BitGo/WIN-497-add-ethliketsscoin-class
Browse files Browse the repository at this point in the history
add abstract-eth classes
  • Loading branch information
gianchandania authored Oct 13, 2023
2 parents 5350cb6 + eb99545 commit 29cc413
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 37 deletions.
17 changes: 17 additions & 0 deletions modules/abstract-eth/src/abstractEthLikeMPCCoin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* @prettier
*/
import { MPCAlgorithm } from '@bitgo/sdk-core';
import { AbstractEthLikeCoin } from './abstractEthLikeCoin';

export abstract class AbstractEthLikeMPCCoin extends AbstractEthLikeCoin {
/** @inheritDoc */
supportsTss(): boolean {
return true;
}

/** @inheritDoc */
getMPCAlgorithm(): MPCAlgorithm {
return 'ecdsa';
}
}
17 changes: 17 additions & 0 deletions modules/abstract-eth/src/ethLikeMPCToken.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* @prettier
*/
import { MPCAlgorithm } from '@bitgo/sdk-core';
import { EthLikeToken } from './ethLikeToken';

export abstract class EthLikeMPCToken extends EthLikeToken {
/** @inheritDoc */
supportsTss(): boolean {
return true;
}

/** @inheritDoc */
getMPCAlgorithm(): MPCAlgorithm {
return 'ecdsa';
}
}
2 changes: 2 additions & 0 deletions modules/abstract-eth/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export * from './abstractEthLikeCoin';
export * from './ethLikeToken';
export * from './abstractEthLikeMPCCoin';
export * from './ethLikeMPCToken';
16 changes: 3 additions & 13 deletions modules/sdk-coin-arbeth/src/arbeth.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { BaseCoin, BitGoBase, MPCAlgorithm } from '@bitgo/sdk-core';
import { BaseCoin, BitGoBase } from '@bitgo/sdk-core';
import { BaseCoin as StaticsBaseCoin, coins } from '@bitgo/statics';
import { AbstractEthLikeCoin } from '@bitgo/abstract-eth';
import { AbstractEthLikeMPCCoin } from '@bitgo/abstract-eth';
import { TransactionBuilder as EthTransactionBuilder } from '@bitgo/sdk-coin-eth';
import { TransactionBuilder } from './lib';

export class Arbeth extends AbstractEthLikeCoin {
export class Arbeth extends AbstractEthLikeMPCCoin {
protected constructor(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>) {
super(bitgo, staticsCoin);
}
Expand All @@ -16,14 +16,4 @@ export class Arbeth extends AbstractEthLikeCoin {
protected getTransactionBuilder(): EthTransactionBuilder {
return new TransactionBuilder(coins.get(this.getBaseChain()));
}

/** @inheritDoc */
supportsTss(): boolean {
return true;
}

/** @inheritDoc */
getMPCAlgorithm(): MPCAlgorithm {
return 'ecdsa';
}
}
16 changes: 3 additions & 13 deletions modules/sdk-coin-bsc/src/bsc.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { BaseCoin, BitGoBase, MPCAlgorithm } from '@bitgo/sdk-core';
import { BaseCoin, BitGoBase } from '@bitgo/sdk-core';
import { BaseCoin as StaticsBaseCoin, coins } from '@bitgo/statics';
import { AbstractEthLikeCoin } from '@bitgo/abstract-eth';
import { AbstractEthLikeMPCCoin } from '@bitgo/abstract-eth';
import { TransactionBuilder as EthTransactionBuilder } from '@bitgo/sdk-coin-eth';
import { TransactionBuilder } from './lib';

export class Bsc extends AbstractEthLikeCoin {
export class Bsc extends AbstractEthLikeMPCCoin {
protected constructor(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>) {
super(bitgo, staticsCoin);
}
Expand All @@ -17,16 +17,6 @@ export class Bsc extends AbstractEthLikeCoin {
return new TransactionBuilder(coins.get(this.getBaseChain()));
}

/** @inheritDoc */
supportsTss(): boolean {
return true;
}

/** @inheritDoc */
getMPCAlgorithm(): MPCAlgorithm {
return 'ecdsa';
}

/** @inheritDoc */
allowsAccountConsolidations(): boolean {
return true;
Expand Down
14 changes: 3 additions & 11 deletions modules/sdk-coin-bsc/src/bscToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
*/

import { EthLikeTokenConfig } from '@bitgo/statics';
import { BitGoBase, CoinConstructor, MPCAlgorithm, NamedCoinConstructor } from '@bitgo/sdk-core';
import { CoinNames, EthLikeToken } from '@bitgo/abstract-eth';
import { BitGoBase, CoinConstructor, NamedCoinConstructor } from '@bitgo/sdk-core';
import { CoinNames, EthLikeMPCToken } from '@bitgo/abstract-eth';

export { EthLikeTokenConfig };

export class BscToken extends EthLikeToken {
export class BscToken extends EthLikeMPCToken {
public readonly tokenConfig: EthLikeTokenConfig;
static coinNames: CoinNames = {
Mainnet: 'bsc',
Expand All @@ -28,12 +28,4 @@ export class BscToken extends EthLikeToken {
getFullName(): string {
return 'Bsc Token';
}

supportsTss(): boolean {
return true;
}

getMPCAlgorithm(): MPCAlgorithm {
return 'ecdsa';
}
}

0 comments on commit 29cc413

Please sign in to comment.