Skip to content

Commit

Permalink
Merge pull request #4018 from BitGo/WIN-1011-rename-coreum
Browse files Browse the repository at this point in the history
refactor: rename coin from 'core' to 'coreum'
  • Loading branch information
hitansh-madan authored Oct 26, 2023
2 parents 056e4aa + baecc01 commit 673590c
Show file tree
Hide file tree
Showing 47 changed files with 188 additions and 190 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ COPY --from=builder /tmp/bitgo/modules/abstract-cosmos /var/modules/abstract-cos
COPY --from=builder /tmp/bitgo/modules/sdk-coin-bld /var/modules/sdk-coin-bld/
COPY --from=builder /tmp/bitgo/modules/sdk-coin-bsc /var/modules/sdk-coin-bsc/
COPY --from=builder /tmp/bitgo/modules/sdk-coin-celo /var/modules/sdk-coin-celo/
COPY --from=builder /tmp/bitgo/modules/sdk-coin-core /var/modules/sdk-coin-core/
COPY --from=builder /tmp/bitgo/modules/sdk-coin-coreum /var/modules/sdk-coin-coreum/
COPY --from=builder /tmp/bitgo/modules/sdk-coin-cspr /var/modules/sdk-coin-cspr/
COPY --from=builder /tmp/bitgo/modules/sdk-coin-dot /var/modules/sdk-coin-dot/
COPY --from=builder /tmp/bitgo/modules/sdk-coin-etc /var/modules/sdk-coin-etc/
Expand Down Expand Up @@ -129,7 +129,7 @@ cd /var/modules/abstract-cosmos && yarn link && \
cd /var/modules/sdk-coin-bld && yarn link && \
cd /var/modules/sdk-coin-bsc && yarn link && \
cd /var/modules/sdk-coin-celo && yarn link && \
cd /var/modules/sdk-coin-core && yarn link && \
cd /var/modules/sdk-coin-coreum && yarn link && \
cd /var/modules/sdk-coin-cspr && yarn link && \
cd /var/modules/sdk-coin-dot && yarn link && \
cd /var/modules/sdk-coin-etc && yarn link && \
Expand Down Expand Up @@ -197,7 +197,7 @@ RUN cd /var/bitgo-express && \
yarn link @bitgo/sdk-coin-bld && \
yarn link @bitgo/sdk-coin-bsc && \
yarn link @bitgo/sdk-coin-celo && \
yarn link @bitgo/sdk-coin-core && \
yarn link @bitgo/sdk-coin-coreum && \
yarn link @bitgo/sdk-coin-cspr && \
yarn link @bitgo/sdk-coin-dot && \
yarn link @bitgo/sdk-coin-etc && \
Expand Down
2 changes: 1 addition & 1 deletion modules/account-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@bitgo/sdk-coin-bld": "^1.6.0",
"@bitgo/sdk-coin-bsc": "^3.10.0",
"@bitgo/sdk-coin-celo": "^1.5.13",
"@bitgo/sdk-coin-core": "^1.2.0",
"@bitgo/sdk-coin-coreum": "^1.0.0",
"@bitgo/sdk-coin-cspr": "^1.7.0",
"@bitgo/sdk-coin-dot": "^3.15.0",
"@bitgo/sdk-coin-etc": "^1.4.13",
Expand Down
8 changes: 4 additions & 4 deletions modules/account-lib/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ export { Islm };
import * as Zeta from '@bitgo/sdk-coin-zeta';
export { Zeta };

import * as Core from '@bitgo/sdk-coin-core';
export { Core };
import * as Coreum from '@bitgo/sdk-coin-coreum';
export { Coreum };

import * as Sol from '@bitgo/sdk-coin-sol';
export { Sol };
Expand Down Expand Up @@ -183,8 +183,8 @@ const coinBuilderMap = {
tzeta: Zeta.TransactionBuilderFactory,
islm: Islm.TransactionBuilderFactory,
tislm: Islm.TransactionBuilderFactory,
core: Core.TransactionBuilderFactory,
tcore: Core.TransactionBuilderFactory,
core: Coreum.TransactionBuilderFactory,
tcore: Coreum.TransactionBuilderFactory,
arbeth: Arbeth.TransactionBuilder,
tarbeth: Arbeth.TransactionBuilder,
opeth: Opeth.TransactionBuilder,
Expand Down
2 changes: 1 addition & 1 deletion modules/account-lib/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"path": "../sdk-coin-celo"
},
{
"path": "../sdk-coin-core"
"path": "../sdk-coin-coreum"
},
{
"path": "../sdk-coin-cspr"
Expand Down
2 changes: 1 addition & 1 deletion modules/bitgo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"@bitgo/sdk-coin-btc": "^1.7.13",
"@bitgo/sdk-coin-btg": "^1.5.13",
"@bitgo/sdk-coin-celo": "^1.5.13",
"@bitgo/sdk-coin-core": "^1.2.0",
"@bitgo/sdk-coin-coreum": "^1.0.0",
"@bitgo/sdk-coin-cspr": "^1.7.0",
"@bitgo/sdk-coin-dash": "^1.5.13",
"@bitgo/sdk-coin-doge": "^1.12.13",
Expand Down
8 changes: 4 additions & 4 deletions modules/bitgo/src/v2/coinFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
Btg,
Celo,
CeloToken,
Core,
Coreum,
Cspr,
Dash,
Doge,
Expand Down Expand Up @@ -78,7 +78,7 @@ import {
Tbsv,
Tbtc,
Tcelo,
Tcore,
Tcoreum,
Tcspr,
Tdash,
Tdoge,
Expand Down Expand Up @@ -137,7 +137,7 @@ function registerCoinConstructors(globalCoinFactory: CoinFactory): void {
globalCoinFactory.register('btc', Btc.createInstance);
globalCoinFactory.register('btg', Btg.createInstance);
globalCoinFactory.register('celo', Celo.createInstance);
globalCoinFactory.register('core', Core.createInstance);
globalCoinFactory.register('coreum', Coreum.createInstance);
globalCoinFactory.register('cspr', Cspr.createInstance);
globalCoinFactory.register('dash', Dash.createInstance);
globalCoinFactory.register('doge', Doge.createInstance);
Expand Down Expand Up @@ -184,7 +184,7 @@ function registerCoinConstructors(globalCoinFactory: CoinFactory): void {
globalCoinFactory.register('tbsv', Tbsv.createInstance);
globalCoinFactory.register('tbtc', Tbtc.createInstance);
globalCoinFactory.register('tcelo', Tcelo.createInstance);
globalCoinFactory.register('tcore', Tcore.createInstance);
globalCoinFactory.register('tcoreum', Tcoreum.createInstance);
globalCoinFactory.register('tcspr', Tcspr.createInstance);
globalCoinFactory.register('tdash', Tdash.createInstance);
globalCoinFactory.register('tdoge', Tdoge.createInstance);
Expand Down
4 changes: 2 additions & 2 deletions modules/bitgo/src/v2/coins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Bsv, Tbsv } from '@bitgo/sdk-coin-bsv';
import { Btc, Tbtc } from '@bitgo/sdk-coin-btc';
import { Btg } from '@bitgo/sdk-coin-btg';
import { Celo, CeloToken, Tcelo } from '@bitgo/sdk-coin-celo';
import { Core, Tcore } from '@bitgo/sdk-coin-core';
import { Coreum, Tcoreum } from '@bitgo/sdk-coin-coreum';
import { Cspr, Tcspr } from '@bitgo/sdk-coin-cspr';
import { Dash, Tdash } from '@bitgo/sdk-coin-dash';
import { Doge, Tdoge } from '@bitgo/sdk-coin-doge';
Expand Down Expand Up @@ -59,7 +59,7 @@ export { Bsv, Tbsv };
export { Btc, Tbtc };
export { Btg };
export { Celo, CeloToken, Tcelo };
export { Core, Tcore };
export { Coreum, Tcoreum };
export { Cspr, Tcspr };
export { Dash, Tdash };
export { Doge, Tdoge };
Expand Down
2 changes: 1 addition & 1 deletion modules/bitgo/test/v2/unit/keychains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('V2 Keychains', function () {
n.asset !== UnderlyingAsset.DOGE &&
n.asset !== UnderlyingAsset.ETHW &&
n.asset !== UnderlyingAsset.KAVA &&
n.asset !== UnderlyingAsset.CORE &&
n.asset !== UnderlyingAsset.COREUM &&
n.asset !== UnderlyingAsset.BERA &&
n.asset !== UnderlyingAsset.ISLM &&
n.asset !== UnderlyingAsset.ARBETH && // TODO(WIN-692): remove this once coin-specific module for arbeth is added
Expand Down
2 changes: 1 addition & 1 deletion modules/bitgo/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"path": "../sdk-coin-celo"
},
{
"path": "../sdk-coin-core"
"path": "../sdk-coin-coreum"
},
{
"path": "../sdk-coin-cspr"
Expand Down
4 changes: 0 additions & 4 deletions modules/sdk-coin-core/src/index.ts

This file was deleted.

8 changes: 0 additions & 8 deletions modules/sdk-coin-core/src/register.ts

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# BitGo sdk-coin-core
# BitGo sdk-coin-coreum

SDK coins provide a modular approach to a monolithic architecture. This and all BitGoJS SDK coins allow developers to use only the coins needed for a given project.

## Installation

All coins are loaded traditionally through the `bitgo` package. If you are using coins individually, you will be accessing the coin via the `@bitgo/sdk-api` package.

In your project install both `@bitgo/sdk-api` and `@bitgo/sdk-coin-core`.
In your project install both `@bitgo/sdk-api` and `@bitgo/sdk-coin-coreum`.

```shell
npm i @bitgo/sdk-api @bitgo/sdk-coin-core
npm i @bitgo/sdk-api @bitgo/sdk-coin-coreum
```

Next, you will be able to initialize an instance of "bitgo" through `@bitgo/sdk-api` instead of `bitgo`.

```javascript
import { BitGoAPI } from '@bitgo/sdk-api';
import { Core } from '@bitgo/sdk-coin-core';
import { Coreum } from '@bitgo/sdk-coin-coreum';

const sdk = new BitGoAPI();

sdk.register('core', Core.createInstance);
sdk.register('coreum', Coreum.createInstance);
```

## Development
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bitgo/sdk-coin-core",
"version": "1.2.0",
"name": "@bitgo/sdk-coin-coreum",
"version": "1.0.0",
"description": "BitGo SDK coin library for Coreum",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ import { BaseCoin, BitGoBase, Environments } from '@bitgo/sdk-core';
import { BaseCoin as StaticsBaseCoin, BaseUnit, coins } from '@bitgo/statics';
import { KeyPair, TransactionBuilderFactory } from './lib';
import { GAS_AMOUNT, GAS_LIMIT } from './lib/constants';
import { CoreUtils } from './lib/utils';
import { CoreumUtils } from './lib/utils';

export class Core extends CosmosCoin {
protected readonly _utils: CoreUtils;
export class Coreum extends CosmosCoin {
protected readonly _utils: CoreumUtils;
protected readonly _staticsCoin: Readonly<StaticsBaseCoin>;
protected constructor(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>) {
super(bitgo, staticsCoin);
if (!staticsCoin) {
throw new Error('missing required constructor parameter staticsCoin');
}
this._staticsCoin = staticsCoin;
this._utils = new CoreUtils();
this._utils = new CoreumUtils();
}

static createInstance(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>): BaseCoin {
return new Core(bitgo, staticsCoin);
return new Coreum(bitgo, staticsCoin);
}

/** @inheritDoc **/
Expand All @@ -38,12 +38,12 @@ export class Core extends CosmosCoin {

/** @inheritDoc **/
protected getPublicNodeUrl(): string {
return Environments[this.bitgo.getEnv()].coreNodeUrl;
return Environments[this.bitgo.getEnv()].coreumNodeUrl;
}

/** @inheritDoc **/
getDenomination(): string {
return BaseUnit.CORE;
return BaseUnit.COREUM;
}

/** @inheritDoc **/
Expand Down
4 changes: 4 additions & 0 deletions modules/sdk-coin-coreum/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './coreum';
export * from './lib';
export * from './register';
export * from './tcoreum';
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from '@bitgo/abstract-cosmos';
import { BaseTransactionBuilderFactory, InvalidTransactionError, TransactionType } from '@bitgo/sdk-core';
import { BaseCoin as CoinConfig } from '@bitgo/statics';
import { CoreUtils } from './utils';
import { CoreumUtils } from './utils';

export class TransactionBuilderFactory extends BaseTransactionBuilderFactory {
constructor(_coinConfig: Readonly<CoinConfig>) {
Expand All @@ -17,7 +17,7 @@ export class TransactionBuilderFactory extends BaseTransactionBuilderFactory {

/** @inheritdoc */
from(raw: string): CosmosTransactionBuilder {
const tx = new CosmosTransaction(this._coinConfig, new CoreUtils(this._coinConfig.network.type));
const tx = new CosmosTransaction(this._coinConfig, new CoreumUtils(this._coinConfig.network.type));
tx.enrichTransactionDetailsFromRawTransaction(raw);
try {
switch (tx.type) {
Expand All @@ -41,31 +41,31 @@ export class TransactionBuilderFactory extends BaseTransactionBuilderFactory {
getTransferBuilder(tx?: CosmosTransaction): CosmosTransferBuilder {
return this.initializeBuilder(
tx,
new CosmosTransferBuilder(this._coinConfig, new CoreUtils(this._coinConfig.network.type))
new CosmosTransferBuilder(this._coinConfig, new CoreumUtils(this._coinConfig.network.type))
);
}

/** @inheritdoc */
getStakingActivateBuilder(tx?: CosmosTransaction): StakingActivateBuilder {
return this.initializeBuilder(
tx,
new StakingActivateBuilder(this._coinConfig, new CoreUtils(this._coinConfig.network.type))
new StakingActivateBuilder(this._coinConfig, new CoreumUtils(this._coinConfig.network.type))
);
}

/** @inheritdoc */
getStakingDeactivateBuilder(tx?: CosmosTransaction): StakingDeactivateBuilder {
return this.initializeBuilder(
tx,
new StakingDeactivateBuilder(this._coinConfig, new CoreUtils(this._coinConfig.network.type))
new StakingDeactivateBuilder(this._coinConfig, new CoreumUtils(this._coinConfig.network.type))
);
}

/** @inheritdoc */
getStakingWithdrawRewardsBuilder(tx?: CosmosTransaction): StakingWithdrawRewardsBuilder {
return this.initializeBuilder(
tx,
new StakingWithdrawRewardsBuilder(this._coinConfig, new CoreUtils(this._coinConfig.network.type))
new StakingWithdrawRewardsBuilder(this._coinConfig, new CoreumUtils(this._coinConfig.network.type))
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { CosmosUtils } from '@bitgo/abstract-cosmos';
import * as constants from './constants';
import { NetworkType } from '@bitgo/statics';

export class CoreUtils extends CosmosUtils {
export class CoreumUtils extends CosmosUtils {
private networkType: NetworkType;
constructor(networkType: NetworkType = NetworkType.MAINNET) {
super();
Expand Down Expand Up @@ -46,6 +46,6 @@ export class CoreUtils extends CosmosUtils {
}
}

const coreUtils = new CoreUtils();
const coreumUtils = new CoreumUtils();

export default coreUtils;
export default coreumUtils;
8 changes: 8 additions & 0 deletions modules/sdk-coin-coreum/src/register.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { BitGoBase } from '@bitgo/sdk-core';
import { Coreum } from './coreum';
import { Tcoreum } from './tcoreum';

export const register = (sdk: BitGoBase): void => {
sdk.register('coreum', Coreum.createInstance);
sdk.register('tcoreum', Tcoreum.createInstance);
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
*/
import { AddressFormat, BaseCoin, BitGoBase } from '@bitgo/sdk-core';
import { BaseUnit, NetworkType, BaseCoin as StaticsBaseCoin } from '@bitgo/statics';
import { Core } from './core';
import { Coreum } from './coreum';
import { KeyPair } from './lib';
import { CoreUtils } from './lib/utils';
import { CoreumUtils } from './lib/utils';

export class Tcore extends Core {
protected readonly _utils: CoreUtils;
export class Tcoreum extends Coreum {
protected readonly _utils: CoreumUtils;
protected readonly _staticsCoin: Readonly<StaticsBaseCoin>;
protected constructor(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>) {
super(bitgo, staticsCoin);
Expand All @@ -20,16 +20,16 @@ export class Tcore extends Core {
}

this._staticsCoin = staticsCoin;
this._utils = new CoreUtils(NetworkType.TESTNET);
this._utils = new CoreumUtils(NetworkType.TESTNET);
}

static createInstance(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>): BaseCoin {
return new Tcore(bitgo, staticsCoin);
return new Tcoreum(bitgo, staticsCoin);
}

/** @inheritDoc **/
getDenomination(): string {
return BaseUnit.TESTCORE;
return BaseUnit.TCOREUM;
}

/** @inheritDoc **/
Expand Down
Loading

0 comments on commit 673590c

Please sign in to comment.