diff --git a/Dockerfile b/Dockerfile index 6f025f8742..589149be3f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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/ @@ -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 && \ @@ -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 && \ diff --git a/modules/account-lib/package.json b/modules/account-lib/package.json index 59b705fb07..ab829072fc 100644 --- a/modules/account-lib/package.json +++ b/modules/account-lib/package.json @@ -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", diff --git a/modules/account-lib/src/index.ts b/modules/account-lib/src/index.ts index 606e26c4c3..0388bc8151 100644 --- a/modules/account-lib/src/index.ts +++ b/modules/account-lib/src/index.ts @@ -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 }; @@ -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, diff --git a/modules/account-lib/tsconfig.json b/modules/account-lib/tsconfig.json index f7c383d24f..a23cbc08ff 100644 --- a/modules/account-lib/tsconfig.json +++ b/modules/account-lib/tsconfig.json @@ -35,7 +35,7 @@ "path": "../sdk-coin-celo" }, { - "path": "../sdk-coin-core" + "path": "../sdk-coin-coreum" }, { "path": "../sdk-coin-cspr" diff --git a/modules/bitgo/package.json b/modules/bitgo/package.json index 2e6798388c..e435bd4b0e 100644 --- a/modules/bitgo/package.json +++ b/modules/bitgo/package.json @@ -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", diff --git a/modules/bitgo/src/v2/coinFactory.ts b/modules/bitgo/src/v2/coinFactory.ts index ec854d57ad..f05bc84ca7 100644 --- a/modules/bitgo/src/v2/coinFactory.ts +++ b/modules/bitgo/src/v2/coinFactory.ts @@ -29,7 +29,7 @@ import { Btg, Celo, CeloToken, - Core, + Coreum, Cspr, Dash, Doge, @@ -78,7 +78,7 @@ import { Tbsv, Tbtc, Tcelo, - Tcore, + Tcoreum, Tcspr, Tdash, Tdoge, @@ -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); @@ -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); diff --git a/modules/bitgo/src/v2/coins/index.ts b/modules/bitgo/src/v2/coins/index.ts index d6717194c6..23158ceff1 100644 --- a/modules/bitgo/src/v2/coins/index.ts +++ b/modules/bitgo/src/v2/coins/index.ts @@ -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'; @@ -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 }; diff --git a/modules/bitgo/test/v2/unit/keychains.ts b/modules/bitgo/test/v2/unit/keychains.ts index b65b6b786f..30309973c0 100644 --- a/modules/bitgo/test/v2/unit/keychains.ts +++ b/modules/bitgo/test/v2/unit/keychains.ts @@ -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 diff --git a/modules/bitgo/tsconfig.json b/modules/bitgo/tsconfig.json index 802abf4461..555e45e16a 100644 --- a/modules/bitgo/tsconfig.json +++ b/modules/bitgo/tsconfig.json @@ -81,7 +81,7 @@ "path": "../sdk-coin-celo" }, { - "path": "../sdk-coin-core" + "path": "../sdk-coin-coreum" }, { "path": "../sdk-coin-cspr" diff --git a/modules/sdk-coin-core/src/index.ts b/modules/sdk-coin-core/src/index.ts deleted file mode 100644 index 13a6a05129..0000000000 --- a/modules/sdk-coin-core/src/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './core'; -export * from './lib'; -export * from './register'; -export * from './tcore'; diff --git a/modules/sdk-coin-core/src/register.ts b/modules/sdk-coin-core/src/register.ts deleted file mode 100644 index 9d1a9f5c92..0000000000 --- a/modules/sdk-coin-core/src/register.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { BitGoBase } from '@bitgo/sdk-core'; -import { Core } from './core'; -import { Tcore } from './tcore'; - -export const register = (sdk: BitGoBase): void => { - sdk.register('core', Core.createInstance); - sdk.register('tcore', Tcore.createInstance); -}; diff --git a/modules/sdk-coin-core/.eslintignore b/modules/sdk-coin-coreum/.eslintignore similarity index 100% rename from modules/sdk-coin-core/.eslintignore rename to modules/sdk-coin-coreum/.eslintignore diff --git a/modules/sdk-coin-core/.gitignore b/modules/sdk-coin-coreum/.gitignore similarity index 100% rename from modules/sdk-coin-core/.gitignore rename to modules/sdk-coin-coreum/.gitignore diff --git a/modules/sdk-coin-core/.mocharc.yml b/modules/sdk-coin-coreum/.mocharc.yml similarity index 100% rename from modules/sdk-coin-core/.mocharc.yml rename to modules/sdk-coin-coreum/.mocharc.yml diff --git a/modules/sdk-coin-core/.npmignore b/modules/sdk-coin-coreum/.npmignore similarity index 100% rename from modules/sdk-coin-core/.npmignore rename to modules/sdk-coin-coreum/.npmignore diff --git a/modules/sdk-coin-core/.prettierignore b/modules/sdk-coin-coreum/.prettierignore similarity index 100% rename from modules/sdk-coin-core/.prettierignore rename to modules/sdk-coin-coreum/.prettierignore diff --git a/modules/sdk-coin-core/.prettierrc.yml b/modules/sdk-coin-coreum/.prettierrc.yml similarity index 100% rename from modules/sdk-coin-core/.prettierrc.yml rename to modules/sdk-coin-coreum/.prettierrc.yml diff --git a/modules/sdk-coin-core/CHANGELOG.md b/modules/sdk-coin-coreum/CHANGELOG.md similarity index 100% rename from modules/sdk-coin-core/CHANGELOG.md rename to modules/sdk-coin-coreum/CHANGELOG.md diff --git a/modules/sdk-coin-core/README.md b/modules/sdk-coin-coreum/README.md similarity index 77% rename from modules/sdk-coin-core/README.md rename to modules/sdk-coin-coreum/README.md index 4775fab82a..c0c8caa3e7 100644 --- a/modules/sdk-coin-core/README.md +++ b/modules/sdk-coin-coreum/README.md @@ -1,4 +1,4 @@ -# 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. @@ -6,25 +6,25 @@ SDK coins provide a modular approach to a monolithic architecture. This and all 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 -Most of the coin implementations are derived from `@bitgo/sdk-core`, `@bitgo/statics`, and coin specific packages. These implementations are used to interact with the BitGo API and BitGo platform services. +Most of the coin implementations are derived from `@bitgo/sdk-coreum`, `@bitgo/statics`, and coin specific packages. These implementations are used to interact with the BitGo API and BitGo platform services. You will notice that the basic version of common class extensions have been provided to you and must be resolved before the package build will succeed. Upon initiation of a given SDK coin, you will need to verify that your coin has been included in the root `tsconfig.packages.json` and that the linting, formatting, and testing succeeds when run both within the coin and from the root of BitGoJS. diff --git a/modules/sdk-coin-core/package.json b/modules/sdk-coin-coreum/package.json similarity index 95% rename from modules/sdk-coin-core/package.json rename to modules/sdk-coin-coreum/package.json index 13f78ad912..7a804eb1b6 100644 --- a/modules/sdk-coin-core/package.json +++ b/modules/sdk-coin-coreum/package.json @@ -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", diff --git a/modules/sdk-coin-core/src/core.ts b/modules/sdk-coin-coreum/src/coreum.ts similarity index 85% rename from modules/sdk-coin-core/src/core.ts rename to modules/sdk-coin-coreum/src/coreum.ts index 1726bb80ad..3092c3cf96 100644 --- a/modules/sdk-coin-core/src/core.ts +++ b/modules/sdk-coin-coreum/src/coreum.ts @@ -3,10 +3,10 @@ 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; protected constructor(bitgo: BitGoBase, staticsCoin?: Readonly) { super(bitgo, staticsCoin); @@ -14,11 +14,11 @@ export class Core extends CosmosCoin { 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): BaseCoin { - return new Core(bitgo, staticsCoin); + return new Coreum(bitgo, staticsCoin); } /** @inheritDoc **/ @@ -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 **/ diff --git a/modules/sdk-coin-coreum/src/index.ts b/modules/sdk-coin-coreum/src/index.ts new file mode 100644 index 0000000000..de1fc867f2 --- /dev/null +++ b/modules/sdk-coin-coreum/src/index.ts @@ -0,0 +1,4 @@ +export * from './coreum'; +export * from './lib'; +export * from './register'; +export * from './tcoreum'; diff --git a/modules/sdk-coin-core/src/lib/constants.ts b/modules/sdk-coin-coreum/src/lib/constants.ts similarity index 100% rename from modules/sdk-coin-core/src/lib/constants.ts rename to modules/sdk-coin-coreum/src/lib/constants.ts diff --git a/modules/sdk-coin-core/src/lib/index.ts b/modules/sdk-coin-coreum/src/lib/index.ts similarity index 100% rename from modules/sdk-coin-core/src/lib/index.ts rename to modules/sdk-coin-coreum/src/lib/index.ts diff --git a/modules/sdk-coin-core/src/lib/keyPair.ts b/modules/sdk-coin-coreum/src/lib/keyPair.ts similarity index 100% rename from modules/sdk-coin-core/src/lib/keyPair.ts rename to modules/sdk-coin-coreum/src/lib/keyPair.ts diff --git a/modules/sdk-coin-core/src/lib/transactionBuilderFactory.ts b/modules/sdk-coin-coreum/src/lib/transactionBuilderFactory.ts similarity index 85% rename from modules/sdk-coin-core/src/lib/transactionBuilderFactory.ts rename to modules/sdk-coin-coreum/src/lib/transactionBuilderFactory.ts index e089668b1f..1b5f8c7b73 100644 --- a/modules/sdk-coin-core/src/lib/transactionBuilderFactory.ts +++ b/modules/sdk-coin-coreum/src/lib/transactionBuilderFactory.ts @@ -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) { @@ -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) { @@ -41,7 +41,7 @@ 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)) ); } @@ -49,7 +49,7 @@ export class TransactionBuilderFactory extends BaseTransactionBuilderFactory { 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)) ); } @@ -57,7 +57,7 @@ export class TransactionBuilderFactory extends BaseTransactionBuilderFactory { 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)) ); } @@ -65,7 +65,7 @@ export class TransactionBuilderFactory extends BaseTransactionBuilderFactory { 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)) ); } diff --git a/modules/sdk-coin-core/src/lib/utils.ts b/modules/sdk-coin-coreum/src/lib/utils.ts similarity index 93% rename from modules/sdk-coin-core/src/lib/utils.ts rename to modules/sdk-coin-coreum/src/lib/utils.ts index 749452bee8..446dbe161d 100644 --- a/modules/sdk-coin-core/src/lib/utils.ts +++ b/modules/sdk-coin-coreum/src/lib/utils.ts @@ -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(); @@ -46,6 +46,6 @@ export class CoreUtils extends CosmosUtils { } } -const coreUtils = new CoreUtils(); +const coreumUtils = new CoreumUtils(); -export default coreUtils; +export default coreumUtils; diff --git a/modules/sdk-coin-coreum/src/register.ts b/modules/sdk-coin-coreum/src/register.ts new file mode 100644 index 0000000000..05a0085263 --- /dev/null +++ b/modules/sdk-coin-coreum/src/register.ts @@ -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); +}; diff --git a/modules/sdk-coin-core/src/tcore.ts b/modules/sdk-coin-coreum/src/tcoreum.ts similarity index 75% rename from modules/sdk-coin-core/src/tcore.ts rename to modules/sdk-coin-coreum/src/tcoreum.ts index d98b2902c9..f0e8bcdc8f 100644 --- a/modules/sdk-coin-core/src/tcore.ts +++ b/modules/sdk-coin-coreum/src/tcoreum.ts @@ -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; protected constructor(bitgo: BitGoBase, staticsCoin?: Readonly) { super(bitgo, staticsCoin); @@ -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): BaseCoin { - return new Tcore(bitgo, staticsCoin); + return new Tcoreum(bitgo, staticsCoin); } /** @inheritDoc **/ getDenomination(): string { - return BaseUnit.TESTCORE; + return BaseUnit.TCOREUM; } /** @inheritDoc **/ diff --git a/modules/sdk-coin-core/test/resources/core.ts b/modules/sdk-coin-coreum/test/resources/coreum.ts similarity index 100% rename from modules/sdk-coin-core/test/resources/core.ts rename to modules/sdk-coin-coreum/test/resources/coreum.ts diff --git a/modules/sdk-coin-core/test/resources/testcore.ts b/modules/sdk-coin-coreum/test/resources/tcoreum.ts similarity index 100% rename from modules/sdk-coin-core/test/resources/testcore.ts rename to modules/sdk-coin-coreum/test/resources/tcoreum.ts diff --git a/modules/sdk-coin-core/test/unit/core.ts b/modules/sdk-coin-coreum/test/unit/coreum.ts similarity index 79% rename from modules/sdk-coin-core/test/unit/core.ts rename to modules/sdk-coin-coreum/test/unit/coreum.ts index 0ef975084c..48bd008fca 100644 --- a/modules/sdk-coin-core/test/unit/core.ts +++ b/modules/sdk-coin-coreum/test/unit/coreum.ts @@ -2,8 +2,8 @@ import { BitGoAPI } from '@bitgo/sdk-api'; import { TestBitGo, TestBitGoAPI } from '@bitgo/sdk-test'; import BigNumber from 'bignumber.js'; import sinon from 'sinon'; -import { Tcore, Core } from '../../src'; -import { CoreUtils } from '../../src/lib/utils'; +import { Tcoreum, Coreum } from '../../src'; +import { CoreumUtils } from '../../src/lib/utils'; import { TEST_DELEGATE_TX, TEST_SEND_TX, @@ -11,76 +11,76 @@ import { TEST_UNDELEGATE_TX, TEST_WITHDRAW_REWARDS_TX, testnetAddress, -} from '../resources/testcore'; -import { mainnetAddress } from '../resources/core'; +} from '../resources/tcoreum'; +import { mainnetAddress } from '../resources/coreum'; import should = require('should'); import { NetworkType } from '@bitgo/statics'; -describe('Core', function () { +describe('Coreum', function () { let bitgo: TestBitGoAPI; - let core; - let tcore; - let mainnetUtils: CoreUtils; - let testnetUtils: CoreUtils; + let coreum; + let tcoreum; + let mainnetUtils: CoreumUtils; + let testnetUtils: CoreumUtils; before(function () { bitgo = TestBitGo.decorate(BitGoAPI, { env: 'mock' }); - bitgo.safeRegister('core', Core.createInstance); - bitgo.safeRegister('tcore', Tcore.createInstance); + bitgo.safeRegister('coreum', Coreum.createInstance); + bitgo.safeRegister('tcoreum', Tcoreum.createInstance); bitgo.initializeTestVars(); - core = bitgo.coin('core'); - tcore = bitgo.coin('tcore'); - mainnetUtils = new CoreUtils(NetworkType.MAINNET); - testnetUtils = new CoreUtils(NetworkType.TESTNET); + coreum = bitgo.coin('coreum'); + tcoreum = bitgo.coin('tcoreum'); + mainnetUtils = new CoreumUtils(NetworkType.MAINNET); + testnetUtils = new CoreumUtils(NetworkType.TESTNET); }); it('should return the right info', function () { - core.getChain().should.equal('core'); - core.getFamily().should.equal('core'); - core.getFullName().should.equal('Coreum'); - core.getBaseFactor().should.equal(1e6); - - tcore.getChain().should.equal('tcore'); - tcore.getFamily().should.equal('core'); - tcore.getFullName().should.equal('Testnet Coreum'); - tcore.getBaseFactor().should.equal(1e6); + coreum.getChain().should.equal('coreum'); + coreum.getFamily().should.equal('coreum'); + coreum.getFullName().should.equal('Coreum'); + coreum.getBaseFactor().should.equal(1e6); + + tcoreum.getChain().should.equal('tcoreum'); + tcoreum.getFamily().should.equal('coreum'); + tcoreum.getFullName().should.equal('Testnet Coreum'); + tcoreum.getBaseFactor().should.equal(1e6); }); describe('Address Validation', () => { it('should get address details without memoId', function () { - const mainnetAddressDetails = core.getAddressDetails(mainnetAddress.noMemoIdAddress); + const mainnetAddressDetails = coreum.getAddressDetails(mainnetAddress.noMemoIdAddress); mainnetAddressDetails.address.should.equal(mainnetAddress.noMemoIdAddress); should.not.exist(mainnetAddressDetails.memoId); - const testnetAddressDetails = tcore.getAddressDetails(testnetAddress.noMemoIdAddress); + const testnetAddressDetails = tcoreum.getAddressDetails(testnetAddress.noMemoIdAddress); testnetAddressDetails.address.should.equal(testnetAddress.noMemoIdAddress); should.not.exist(testnetAddressDetails.memoId); }); it('should get address details with memoId', function () { - const mainnetAddressDetails = core.getAddressDetails(mainnetAddress.validMemoIdAddress); + const mainnetAddressDetails = coreum.getAddressDetails(mainnetAddress.validMemoIdAddress); mainnetAddressDetails.address.should.equal(mainnetAddress.validMemoIdAddress.split('?')[0]); mainnetAddressDetails.memoId.should.equal('2'); - const testnetAddressDetails = core.getAddressDetails(testnetAddress.validMemoIdAddress); + const testnetAddressDetails = coreum.getAddressDetails(testnetAddress.validMemoIdAddress); testnetAddressDetails.address.should.equal(testnetAddress.validMemoIdAddress.split('?')[0]); testnetAddressDetails.memoId.should.equal('2'); }); it('should throw on invalid memo id address', () => { (() => { - core.getAddressDetails(mainnetAddress.invalidMemoIdAddress); + coreum.getAddressDetails(mainnetAddress.invalidMemoIdAddress); }).should.throw(); (() => { - tcore.getAddressDetails(testnetAddress.invalidMemoIdAddress); + tcoreum.getAddressDetails(testnetAddress.invalidMemoIdAddress); }).should.throw(); }); it('should throw on multiple memo id address', () => { (() => { - core.getAddressDetails(mainnetAddress.multipleMemoIdAddress); + coreum.getAddressDetails(mainnetAddress.multipleMemoIdAddress); }).should.throw(); (() => { - tcore.getAddressDetails(testnetAddress.multipleMemoIdAddress); + tcoreum.getAddressDetails(testnetAddress.multipleMemoIdAddress); }).should.throw(); }); @@ -100,8 +100,8 @@ describe('Core', function () { }, }; - const isValidMainnetReceiveAddress = await core.isWalletAddress(mainnetReceiveAddress); - const isValidTestnetReceiveAddress = await tcore.isWalletAddress(testnetReceiveAddress); + const isValidMainnetReceiveAddress = await coreum.isWalletAddress(mainnetReceiveAddress); + const isValidTestnetReceiveAddress = await tcoreum.isWalletAddress(testnetReceiveAddress); isValidMainnetReceiveAddress.should.equal(true); isValidTestnetReceiveAddress.should.equal(true); @@ -159,7 +159,7 @@ describe('Core', function () { ], }; const verification = {}; - const isTransactionVerified = await tcore.verifyTransaction({ txParams, txPrebuild, verification }); + const isTransactionVerified = await tcoreum.verifyTransaction({ txParams, txPrebuild, verification }); isTransactionVerified.should.equal(true); }); @@ -177,7 +177,7 @@ describe('Core', function () { ], }; const verification = {}; - const isTransactionVerified = await tcore.verifyTransaction({ txParams, txPrebuild, verification }); + const isTransactionVerified = await tcoreum.verifyTransaction({ txParams, txPrebuild, verification }); isTransactionVerified.should.equal(true); }); @@ -195,7 +195,7 @@ describe('Core', function () { ], }; const verification = {}; - const isTransactionVerified = await tcore.verifyTransaction({ txParams, txPrebuild, verification }); + const isTransactionVerified = await tcoreum.verifyTransaction({ txParams, txPrebuild, verification }); isTransactionVerified.should.equal(true); }); @@ -213,14 +213,14 @@ describe('Core', function () { ], }; const verification = {}; - const isTransactionVerified = await tcore.verifyTransaction({ txParams, txPrebuild, verification }); + const isTransactionVerified = await tcoreum.verifyTransaction({ txParams, txPrebuild, verification }); isTransactionVerified.should.equal(true); }); it('should fail to verify transaction with invalid param', async function () { const txPrebuild = {}; const txParams = { recipients: undefined }; - await tcore + await tcoreum .verifyTransaction({ txParams, txPrebuild, @@ -231,7 +231,7 @@ describe('Core', function () { describe('Explain Transaction: ', () => { it('should explain a transfer transaction', async function () { - const explainedTransaction = await tcore.explainTransaction({ + const explainedTransaction = await tcoreum.explainTransaction({ txHex: TEST_SEND_TX.signedTxBase64, }); explainedTransaction.should.deepEqual({ @@ -252,7 +252,7 @@ describe('Core', function () { }); it('should explain a delegate transaction', async function () { - const explainedTransaction = await tcore.explainTransaction({ + const explainedTransaction = await tcoreum.explainTransaction({ txHex: TEST_DELEGATE_TX.signedTxBase64, }); explainedTransaction.should.deepEqual({ @@ -273,7 +273,7 @@ describe('Core', function () { }); it('should explain a undelegate transaction', async function () { - const explainedTransaction = await tcore.explainTransaction({ + const explainedTransaction = await tcoreum.explainTransaction({ txHex: TEST_UNDELEGATE_TX.signedTxBase64, }); explainedTransaction.should.deepEqual({ @@ -294,7 +294,7 @@ describe('Core', function () { }); it('should explain a withdraw transaction', async function () { - const explainedTransaction = await tcore.explainTransaction({ + const explainedTransaction = await tcoreum.explainTransaction({ txHex: TEST_WITHDRAW_REWARDS_TX.signedTxBase64, }); explainedTransaction.should.deepEqual({ @@ -315,7 +315,7 @@ describe('Core', function () { }); it('should explain a transfer transaction with memo', async function () { - const explainedTransaction = await tcore.explainTransaction({ + const explainedTransaction = await tcoreum.explainTransaction({ txHex: TEST_TX_WITH_MEMO.signedTxBase64, }); explainedTransaction.should.deepEqual({ @@ -338,7 +338,7 @@ describe('Core', function () { it('should fail to explain transaction with missing params', async function () { try { - await tcore.explainTransaction({}); + await tcoreum.explainTransaction({}); } catch (error) { should.equal(error.message, 'missing required txHex parameter'); } @@ -346,7 +346,7 @@ describe('Core', function () { it('should fail to explain transaction with invalid params', async function () { try { - await tcore.explainTransaction({ txHex: 'randomString' }); + await tcoreum.explainTransaction({ txHex: 'randomString' }); } catch (error) { should.equal(error.message.startsWith('Invalid transaction:'), true); } @@ -365,7 +365,7 @@ describe('Core', function () { amount: TEST_SEND_TX.sendAmount, }; - const parsedTransaction = await tcore.parseTransaction({ txHex: TEST_SEND_TX.signedTxBase64 }); + const parsedTransaction = await tcoreum.parseTransaction({ txHex: TEST_SEND_TX.signedTxBase64 }); parsedTransaction.should.deepEqual({ inputs: [transferInputsResponse], @@ -374,9 +374,9 @@ describe('Core', function () { }); it('should fail to parse a transfer transaction when explainTransaction response is undefined', async function () { - const stub = sinon.stub(Core.prototype, 'explainTransaction'); + const stub = sinon.stub(Coreum.prototype, 'explainTransaction'); stub.resolves(undefined); - await tcore + await tcoreum .parseTransaction({ txHex: TEST_SEND_TX.signedTxBase64 }) .should.be.rejectedWith('Invalid transaction'); stub.restore(); diff --git a/modules/sdk-coin-core/test/unit/keyPair.ts b/modules/sdk-coin-coreum/test/unit/keyPair.ts similarity index 96% rename from modules/sdk-coin-core/test/unit/keyPair.ts rename to modules/sdk-coin-coreum/test/unit/keyPair.ts index 613aa0fd5b..df780c948d 100644 --- a/modules/sdk-coin-core/test/unit/keyPair.ts +++ b/modules/sdk-coin-coreum/test/unit/keyPair.ts @@ -1,10 +1,10 @@ +import { AddressFormat } from '@bitgo/sdk-core'; import assert from 'assert'; import should from 'should'; import { KeyPair } from '../../src'; -import { TEST_ACCOUNT } from '../resources/core'; -import { AddressFormat } from '@bitgo/sdk-core'; +import { TEST_ACCOUNT } from '../resources/coreum'; -describe('Core Key Pair', () => { +describe('Coreum Key Pair', () => { describe('should create a valid KeyPair', () => { it('from an empty value', () => { const keyPairObj = new KeyPair(); @@ -46,7 +46,7 @@ describe('Core Key Pair', () => { it('from an uncompressed public key', () => { // Input is uncompressed, but we output the compressed key to keep - // parity with core network expectations. + // parity with coreum network expectations. const publicKey = TEST_ACCOUNT.uncompressedPublicKey; const keyPairObj = new KeyPair({ pub: publicKey }); const keys = keyPairObj.getKeys(); diff --git a/modules/sdk-coin-core/test/unit/transaction.ts b/modules/sdk-coin-coreum/test/unit/transaction.ts similarity index 94% rename from modules/sdk-coin-core/test/unit/transaction.ts rename to modules/sdk-coin-coreum/test/unit/transaction.ts index ead1447caf..6b74474383 100644 --- a/modules/sdk-coin-core/test/unit/transaction.ts +++ b/modules/sdk-coin-coreum/test/unit/transaction.ts @@ -9,13 +9,13 @@ import { SendMessage, WithdrawDelegatorRewardsMessage, } from '@bitgo/abstract-cosmos'; -import { CoreUtils } from '../../src/lib/utils'; -import * as testData from '../resources/testcore'; +import { CoreumUtils } from '../../src/lib/utils'; +import * as testData from '../resources/tcoreum'; -describe('Core Transaction', () => { +describe('Coreum Transaction', () => { let tx: CosmosTransaction; - const config = coins.get('tcore'); - const utils = new CoreUtils(config.network.type); + const config = coins.get('tcoreum'); + const utils = new CoreumUtils(config.network.type); beforeEach(() => { tx = new CosmosTransaction(config, utils); @@ -49,14 +49,14 @@ describe('Core Transaction', () => { { address: testData.TEST_SEND_TX.sender, value: testData.TEST_SEND_TX.sendMessage.value.amount[0].amount, - coin: 'tcore', + coin: 'tcoreum', }, ]); should.deepEqual(tx.outputs, [ { address: testData.TEST_SEND_TX.sendMessage.value.toAddress, value: testData.TEST_SEND_TX.sendMessage.value.amount[0].amount, - coin: 'tcore', + coin: 'tcoreum', }, ]); }); @@ -82,14 +82,14 @@ describe('Core Transaction', () => { { address: testData.TEST_SEND_TX.sender, value: testData.TEST_SEND_TX.sendMessage.value.amount[0].amount, - coin: 'tcore', + coin: 'tcoreum', }, ]); should.deepEqual(tx.outputs, [ { address: testData.TEST_SEND_TX.sendMessage.value.toAddress, value: testData.TEST_SEND_TX.sendMessage.value.amount[0].amount, - coin: 'tcore', + coin: 'tcoreum', }, ]); }); @@ -115,14 +115,14 @@ describe('Core Transaction', () => { { address: testData.TEST_DELEGATE_TX.delegator, value: testData.TEST_DELEGATE_TX.sendMessage.value.amount.amount, - coin: 'tcore', + coin: 'tcoreum', }, ]); should.deepEqual(tx.outputs, [ { address: testData.TEST_DELEGATE_TX.validator, value: testData.TEST_DELEGATE_TX.sendMessage.value.amount.amount, - coin: 'tcore', + coin: 'tcoreum', }, ]); }); @@ -148,14 +148,14 @@ describe('Core Transaction', () => { { address: testData.TEST_UNDELEGATE_TX.delegator, value: testData.TEST_UNDELEGATE_TX.sendMessage.value.amount.amount, - coin: 'tcore', + coin: 'tcoreum', }, ]); should.deepEqual(tx.outputs, [ { address: testData.TEST_UNDELEGATE_TX.validator, value: testData.TEST_UNDELEGATE_TX.sendMessage.value.amount.amount, - coin: 'tcore', + coin: 'tcoreum', }, ]); }); @@ -181,14 +181,14 @@ describe('Core Transaction', () => { { address: testData.TEST_WITHDRAW_REWARDS_TX.delegator, value: 'UNAVAILABLE', - coin: 'tcore', + coin: 'tcoreum', }, ]); should.deepEqual(tx.outputs, [ { address: testData.TEST_WITHDRAW_REWARDS_TX.validator, value: 'UNAVAILABLE', - coin: 'tcore', + coin: 'tcoreum', }, ]); }); diff --git a/modules/sdk-coin-core/test/unit/transactionBuilder/StakingActivateBuilder.ts b/modules/sdk-coin-coreum/test/unit/transactionBuilder/StakingActivateBuilder.ts similarity index 93% rename from modules/sdk-coin-core/test/unit/transactionBuilder/StakingActivateBuilder.ts rename to modules/sdk-coin-coreum/test/unit/transactionBuilder/StakingActivateBuilder.ts index 1099851063..7d749b1d41 100644 --- a/modules/sdk-coin-core/test/unit/transactionBuilder/StakingActivateBuilder.ts +++ b/modules/sdk-coin-coreum/test/unit/transactionBuilder/StakingActivateBuilder.ts @@ -4,20 +4,20 @@ import should from 'should'; import { BitGoAPI } from '@bitgo/sdk-api'; import { TestBitGo, TestBitGoAPI } from '@bitgo/sdk-test'; -import { Core, Tcore } from '../../../src'; -import * as testData from '../../resources/testcore'; +import { Coreum, Tcoreum } from '../../../src'; +import * as testData from '../../resources/tcoreum'; -describe('Core Delegate txn Builder', () => { +describe('Coreum Delegate txn Builder', () => { let bitgo: TestBitGoAPI; let basecoin; let factory; let testTx; before(function () { bitgo = TestBitGo.decorate(BitGoAPI, { env: 'mock' }); - bitgo.safeRegister('core', Core.createInstance); - bitgo.safeRegister('tcore', Tcore.createInstance); + bitgo.safeRegister('coreum', Coreum.createInstance); + bitgo.safeRegister('tcoreum', Tcoreum.createInstance); bitgo.initializeTestVars(); - basecoin = bitgo.coin('tcore'); + basecoin = bitgo.coin('tcoreum'); factory = basecoin.getBuilder(); testTx = testData.TEST_DELEGATE_TX; }); diff --git a/modules/sdk-coin-core/test/unit/transactionBuilder/StakingDeactivateBuilder.ts b/modules/sdk-coin-coreum/test/unit/transactionBuilder/StakingDeactivateBuilder.ts similarity index 93% rename from modules/sdk-coin-core/test/unit/transactionBuilder/StakingDeactivateBuilder.ts rename to modules/sdk-coin-coreum/test/unit/transactionBuilder/StakingDeactivateBuilder.ts index 169c9d8e7b..f7590e68a0 100644 --- a/modules/sdk-coin-core/test/unit/transactionBuilder/StakingDeactivateBuilder.ts +++ b/modules/sdk-coin-coreum/test/unit/transactionBuilder/StakingDeactivateBuilder.ts @@ -4,20 +4,20 @@ import should from 'should'; import { BitGoAPI } from '@bitgo/sdk-api'; import { TestBitGo, TestBitGoAPI } from '@bitgo/sdk-test'; -import { Core, Tcore } from '../../../src'; -import * as testData from '../../resources/testcore'; +import { Coreum, Tcoreum } from '../../../src'; +import * as testData from '../../resources/tcoreum'; -describe('Core Undelegate txn Builder', () => { +describe('Coreum Undelegate txn Builder', () => { let bitgo: TestBitGoAPI; let basecoin; let factory; let testTx; before(function () { bitgo = TestBitGo.decorate(BitGoAPI, { env: 'mock' }); - bitgo.safeRegister('core', Core.createInstance); - bitgo.safeRegister('tcore', Tcore.createInstance); + bitgo.safeRegister('coreum', Coreum.createInstance); + bitgo.safeRegister('tcoreum', Tcoreum.createInstance); bitgo.initializeTestVars(); - basecoin = bitgo.coin('tcore'); + basecoin = bitgo.coin('tcoreum'); factory = basecoin.getBuilder(); testTx = testData.TEST_UNDELEGATE_TX; }); diff --git a/modules/sdk-coin-core/test/unit/transactionBuilder/StakingWithdrawRewardsBuilder.ts b/modules/sdk-coin-coreum/test/unit/transactionBuilder/StakingWithdrawRewardsBuilder.ts similarity index 93% rename from modules/sdk-coin-core/test/unit/transactionBuilder/StakingWithdrawRewardsBuilder.ts rename to modules/sdk-coin-coreum/test/unit/transactionBuilder/StakingWithdrawRewardsBuilder.ts index 839d0c1b55..0e7e5dd5c8 100644 --- a/modules/sdk-coin-core/test/unit/transactionBuilder/StakingWithdrawRewardsBuilder.ts +++ b/modules/sdk-coin-coreum/test/unit/transactionBuilder/StakingWithdrawRewardsBuilder.ts @@ -4,20 +4,20 @@ import should from 'should'; import { BitGoAPI } from '@bitgo/sdk-api'; import { TestBitGo, TestBitGoAPI } from '@bitgo/sdk-test'; -import { Core, Tcore } from '../../../src'; -import * as testData from '../../resources/testcore'; +import { Coreum, Tcoreum } from '../../../src'; +import * as testData from '../../resources/tcoreum'; -describe('Core WithdrawRewards txn Builder', () => { +describe('Coreum WithdrawRewards txn Builder', () => { let bitgo: TestBitGoAPI; let basecoin; let factory; let testTx; before(function () { bitgo = TestBitGo.decorate(BitGoAPI, { env: 'mock' }); - bitgo.safeRegister('core', Core.createInstance); - bitgo.safeRegister('tcore', Tcore.createInstance); + bitgo.safeRegister('coreum', Coreum.createInstance); + bitgo.safeRegister('tcoreum', Tcoreum.createInstance); bitgo.initializeTestVars(); - basecoin = bitgo.coin('tcore'); + basecoin = bitgo.coin('tcoreum'); factory = basecoin.getBuilder(); testTx = testData.TEST_WITHDRAW_REWARDS_TX; }); diff --git a/modules/sdk-coin-core/test/unit/transactionBuilder/transactionBuilder.ts b/modules/sdk-coin-coreum/test/unit/transactionBuilder/transactionBuilder.ts similarity index 88% rename from modules/sdk-coin-core/test/unit/transactionBuilder/transactionBuilder.ts rename to modules/sdk-coin-coreum/test/unit/transactionBuilder/transactionBuilder.ts index d8b7a93837..f6a443775f 100644 --- a/modules/sdk-coin-core/test/unit/transactionBuilder/transactionBuilder.ts +++ b/modules/sdk-coin-coreum/test/unit/transactionBuilder/transactionBuilder.ts @@ -3,19 +3,19 @@ import should from 'should'; import { BitGoAPI } from '@bitgo/sdk-api'; import { TestBitGo, TestBitGoAPI } from '@bitgo/sdk-test'; -import { Core, Tcore } from '../../../src'; -import * as testData from '../../resources/testcore'; +import { Coreum, Tcoreum } from '../../../src'; +import * as testData from '../../resources/tcoreum'; -describe('Core Transaction Builder', async () => { +describe('Coreum Transaction Builder', async () => { let bitgo: TestBitGoAPI; let basecoin; let factory; before(function () { bitgo = TestBitGo.decorate(BitGoAPI, { env: 'mock' }); - bitgo.safeRegister('core', Core.createInstance); - bitgo.safeRegister('tcore', Tcore.createInstance); + bitgo.safeRegister('coreum', Coreum.createInstance); + bitgo.safeRegister('tcoreum', Tcoreum.createInstance); bitgo.initializeTestVars(); - basecoin = bitgo.coin('tcore'); + basecoin = bitgo.coin('tcoreum'); factory = basecoin.getBuilder(); }); diff --git a/modules/sdk-coin-core/test/unit/transactionBuilder/transferBuilder.ts b/modules/sdk-coin-coreum/test/unit/transactionBuilder/transferBuilder.ts similarity index 95% rename from modules/sdk-coin-core/test/unit/transactionBuilder/transferBuilder.ts rename to modules/sdk-coin-coreum/test/unit/transactionBuilder/transferBuilder.ts index e954120cab..d3d8f67301 100644 --- a/modules/sdk-coin-core/test/unit/transactionBuilder/transferBuilder.ts +++ b/modules/sdk-coin-coreum/test/unit/transactionBuilder/transferBuilder.ts @@ -3,10 +3,10 @@ import { TransactionType } from '@bitgo/sdk-core'; import { TestBitGo, TestBitGoAPI } from '@bitgo/sdk-test'; import { fromBase64, toHex } from '@cosmjs/encoding'; import should from 'should'; -import { Core, Tcore } from '../../../src'; -import * as testData from '../../resources/testcore'; +import { Coreum, Tcoreum } from '../../../src'; +import * as testData from '../../resources/tcoreum'; -describe('Core Transfer Builder', () => { +describe('Coreum Transfer Builder', () => { let bitgo: TestBitGoAPI; let basecoin; let factory; @@ -14,10 +14,10 @@ describe('Core Transfer Builder', () => { let testTxWithMemo; before(function () { bitgo = TestBitGo.decorate(BitGoAPI, { env: 'mock' }); - bitgo.safeRegister('core', Core.createInstance); - bitgo.safeRegister('tcore', Tcore.createInstance); + bitgo.safeRegister('coreum', Coreum.createInstance); + bitgo.safeRegister('tcoreum', Tcoreum.createInstance); bitgo.initializeTestVars(); - basecoin = bitgo.coin('tcore'); + basecoin = bitgo.coin('tcoreum'); factory = basecoin.getBuilder(); testTx = testData.TEST_SEND_TX; testTxWithMemo = testData.TEST_TX_WITH_MEMO; diff --git a/modules/sdk-coin-core/test/unit/utils.ts b/modules/sdk-coin-coreum/test/unit/utils.ts similarity index 90% rename from modules/sdk-coin-core/test/unit/utils.ts rename to modules/sdk-coin-coreum/test/unit/utils.ts index 8d00503556..c8716daec5 100644 --- a/modules/sdk-coin-core/test/unit/utils.ts +++ b/modules/sdk-coin-coreum/test/unit/utils.ts @@ -1,13 +1,12 @@ -import should from 'should'; - -import { CoreUtils } from '../../src/lib/utils'; -import { blockHash, txIds, mainnetCoinAmounts } from '../resources/core'; -import { testnetCoinAmounts } from '../resources/testcore'; import { NetworkType } from '@bitgo/statics'; +import should from 'should'; +import { CoreumUtils } from '../../src/lib/utils'; +import { blockHash, mainnetCoinAmounts, txIds } from '../resources/coreum'; +import { testnetCoinAmounts } from '../resources/tcoreum'; describe('utils', () => { - const mainnetUtils = new CoreUtils(NetworkType.MAINNET); - const testnetUtils = new CoreUtils(NetworkType.TESTNET); + const mainnetUtils = new CoreumUtils(NetworkType.MAINNET); + const testnetUtils = new CoreumUtils(NetworkType.TESTNET); it('should validate block hash correctly', () => { should.equal(mainnetUtils.isValidBlockId(blockHash.hash1), true); diff --git a/modules/sdk-coin-core/tsconfig.json b/modules/sdk-coin-coreum/tsconfig.json similarity index 100% rename from modules/sdk-coin-core/tsconfig.json rename to modules/sdk-coin-coreum/tsconfig.json diff --git a/modules/sdk-core/src/bitgo/environments.ts b/modules/sdk-core/src/bitgo/environments.ts index d68fb9f069..8b67df7fcb 100644 --- a/modules/sdk-core/src/bitgo/environments.ts +++ b/modules/sdk-core/src/bitgo/environments.ts @@ -32,7 +32,7 @@ interface EnvironmentTemplate { bldNodeUrl: string; beraNodeUrl: string; zetaNodeUrl: string; - coreNodeUrl: string; + coreumNodeUrl: string; islmNodeUrl: string; dotNodeUrls: string[]; tronNodes: { @@ -115,7 +115,7 @@ const mainnetBase: EnvironmentTemplate = { bldNodeUrl: 'https://agoric-api.polkachu.com', beraNodeUrl: '', // TODO(WIN-693): update url when mainnet goes live zetaNodeUrl: 'https://zetachain-athens.blockpi.network/lcd/v1/public', // TODO(WIN-142): update to mainnet url when it's live - coreNodeUrl: 'https://full-node.mainnet-1.coreum.dev:26657', + coreumNodeUrl: 'https://full-node.mainnet-1.coreum.dev:26657', islmNodeUrl: 'https://rest.cosmos.haqq.network', dotNodeUrls: ['wss://rpc.polkadot.io'], tronNodes: { @@ -155,7 +155,7 @@ const testnetBase: EnvironmentTemplate = { bldNodeUrl: 'https://devnet.api.agoric.net', beraNodeUrl: '', // TODO(WIN-693): update url when testnet goes live zetaNodeUrl: 'https://rpc.ankr.com/http/zetachain_athens_testnet', - coreNodeUrl: 'https://full-node.testnet-1.coreum.dev:26657', + coreumNodeUrl: 'https://full-node.testnet-1.coreum.dev:26657', islmNodeUrl: 'https://rest.cosmos.testedge2.haqq.network ', dotNodeUrls: ['wss://westend-rpc.polkadot.io'], tronNodes: { diff --git a/modules/statics/src/base.ts b/modules/statics/src/base.ts index 33889189dc..702ced7d2d 100644 --- a/modules/statics/src/base.ts +++ b/modules/statics/src/base.ts @@ -35,7 +35,7 @@ export enum CoinFamily { BTC = 'btc', BTG = 'btg', CELO = 'celo', - CORE = 'core', + COREUM = 'coreum', CSPR = 'cspr', DASH = 'dash', DOGE = 'doge', @@ -271,7 +271,7 @@ export enum UnderlyingAsset { DASH = 'dash', DOT = 'dot', CELO = 'celo', // Celo main coin - CORE = 'core', + COREUM = 'coreum', CSPR = 'cspr', ETH = 'eth', ETH2 = 'eth2', @@ -299,7 +299,6 @@ export enum UnderlyingAsset { SOL = 'sol', SUI = 'sui', STX = 'stx', - TESTCORE = 'testcore', // Coreum testnet uses different name for native coin TIA = 'tia', // Celestia TON = 'ton', TRX = 'trx', @@ -1433,8 +1432,8 @@ export enum BaseUnit { INJECTIVE = 'inj', ZETA = 'azeta', KAVA = 'ukava', - CORE = 'ucore', - TESTCORE = 'utestcore', // Coreum testnet uses different name for native coin + COREUM = 'ucore', + TCOREUM = 'utestcore', // Coreum testnet uses different name for native coin BERA = 'abera', ISLM = 'aISLM', } diff --git a/modules/statics/src/coins.ts b/modules/statics/src/coins.ts index 9679f422c2..0ac4e61035 100644 --- a/modules/statics/src/coins.ts +++ b/modules/statics/src/coins.ts @@ -998,22 +998,22 @@ export const coins = CoinMap.fromCoins([ ), account( '7df858d5-9da3-4071-ab06-399962ea87b7', - 'core', + 'coreum', 'Coreum', - Networks.main.core, + Networks.main.coreum, 6, - UnderlyingAsset.CORE, - BaseUnit.CORE, + UnderlyingAsset.COREUM, + BaseUnit.COREUM, COSMOS_SIDECHAIN_FEATURES ), account( 'df2f040b-89f3-4bb3-8da7-2445c7fdefca', - 'tcore', + 'tcoreum', 'Testnet Coreum', - Networks.test.core, + Networks.test.coreum, 6, - UnderlyingAsset.TESTCORE, - BaseUnit.TESTCORE, + UnderlyingAsset.COREUM, + BaseUnit.TCOREUM, COSMOS_SIDECHAIN_FEATURES ), account( diff --git a/modules/statics/src/networks.ts b/modules/statics/src/networks.ts index 7500de2122..d953bd64bf 100644 --- a/modules/statics/src/networks.ts +++ b/modules/statics/src/networks.ts @@ -710,15 +710,15 @@ class TonTestnet extends Testnet implements AccountNetwork { explorerUrl = 'https://https://testnet.tonscan.org/'; } -class Core extends Mainnet implements AccountNetwork { +class Coreum extends Mainnet implements AccountNetwork { name = 'Coreum'; - family = CoinFamily.CORE; + family = CoinFamily.COREUM; explorerUrl = 'https://explorer.coreum.com/coreum/transactions/'; } -class CoreTestnet extends Testnet implements AccountNetwork { +class CoreumTestnet extends Testnet implements AccountNetwork { name = 'CoreumTestnet'; - family = CoinFamily.CORE; + family = CoinFamily.COREUM; explorerUrl = 'https://explorer.testnet-1.coreum.dev/coreum/transactions/'; } @@ -915,7 +915,7 @@ export const Networks = { bsc: Object.freeze(new BinanceSmartChain()), casper: Object.freeze(new Casper()), celo: Object.freeze(new Celo()), - core: Object.freeze(new Core()), + coreum: Object.freeze(new Coreum()), dash: Object.freeze(new Dash()), dogecoin: Object.freeze(new Dogecoin()), dot: Object.freeze(new Polkadot()), @@ -997,7 +997,7 @@ export const Networks = { near: Object.freeze(new NearTestnet()), stx: Object.freeze(new StxTestnet()), susd: Object.freeze(new SUSDTestnet()), - core: Object.freeze(new CoreTestnet()), + coreum: Object.freeze(new CoreumTestnet()), tia: Object.freeze(new TiaTestnet()), ton: Object.freeze(new TonTestnet()), trx: Object.freeze(new TrxTestnet()), diff --git a/modules/statics/test/unit/fixtures/expectedColdFeatures.ts b/modules/statics/test/unit/fixtures/expectedColdFeatures.ts index d8d5ea806b..2889f6e6b5 100644 --- a/modules/statics/test/unit/fixtures/expectedColdFeatures.ts +++ b/modules/statics/test/unit/fixtures/expectedColdFeatures.ts @@ -54,7 +54,7 @@ export const expectedColdFeatures = { 'bera', 'bld', 'bsc', - 'core', + 'coreum', 'dot', 'hash', 'islm', @@ -73,7 +73,7 @@ export const expectedColdFeatures = { 'tbera', 'tbld', 'tbsc', - 'tcore', + 'tcoreum', 'tdot', 'thash', 'tia', diff --git a/tsconfig.packages.json b/tsconfig.packages.json index 453a20dcee..f649795c26 100644 --- a/tsconfig.packages.json +++ b/tsconfig.packages.json @@ -74,7 +74,7 @@ "path": "./modules/sdk-coin-celo" }, { - "path": "./modules/sdk-coin-core" + "path": "./modules/sdk-coin-coreum" }, { "path": "./modules/sdk-coin-cspr"