Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions modules/abstract-cosmos/src/cosmosToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ export class CosmosToken extends CosmosCoin {
}

getFullName(): string {
// Eg - returns "Atom Token", "Osmo Token"
return `${this.tokenConfig.coin.charAt(0).toUpperCase()}${this.tokenConfig.coin.slice(1)} Token`;
const displayCoin = this.getFamily();
return `${displayCoin.charAt(0).toUpperCase() + displayCoin.slice(1)} Token`;
}

getBaseFactor(): number {
Expand Down
49 changes: 49 additions & 0 deletions modules/abstract-cosmos/test/unit/cosmosToken.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import 'should';

import { TestBitGo, TestBitGoAPI } from '@bitgo/sdk-test';
import { BitGoAPI } from '@bitgo/sdk-api';
import { CosmosToken } from '../../src';

describe('Cosmos Tokens', function () {
let bitgo: TestBitGoAPI;
let mainnetCosmosToken;
let testnetCosmosToken;
const testnetTokenName = 'thash:ylds';
const mainnetTokenName = 'hash:ylds';

before(function () {
bitgo = TestBitGo.decorate(BitGoAPI, { env: 'test' });
CosmosToken.createTokenConstructors().forEach(({ name, coinConstructor }) => {
bitgo.safeRegister(name, coinConstructor);
});
bitgo.initializeTestVars();
mainnetCosmosToken = bitgo.coin(mainnetTokenName);
testnetCosmosToken = bitgo.coin(testnetTokenName);
});

it('should return constants for Hash YLDS testnet token', function () {
testnetCosmosToken.getChain().should.equal(testnetTokenName);
testnetCosmosToken.getBaseChain().should.equal('thash');
testnetCosmosToken.getFullName().should.equal('Hash Token');
testnetCosmosToken.getBaseFactor().should.equal(1e6);
testnetCosmosToken.type.should.equal(testnetTokenName);
testnetCosmosToken.name.should.equal('Testnet YLDS Token');
testnetCosmosToken.coin.should.equal('thash');
testnetCosmosToken.network.should.equal('Testnet');
testnetCosmosToken.denom.should.equal('uylds.fcc');
testnetCosmosToken.decimalPlaces.should.equal(6);
});

it('should return constants for Hash YLDS mainnet token', function () {
mainnetCosmosToken.getChain().should.equal(mainnetTokenName);
mainnetCosmosToken.getBaseChain().should.equal('hash');
mainnetCosmosToken.getFullName().should.equal('Hash Token');
mainnetCosmosToken.getBaseFactor().should.equal(1e6);
mainnetCosmosToken.type.should.equal(mainnetTokenName);
mainnetCosmosToken.name.should.equal('YLDS Token');
mainnetCosmosToken.coin.should.equal('hash');
mainnetCosmosToken.network.should.equal('Mainnet');
mainnetCosmosToken.denom.should.equal('uylds.fcc');
mainnetCosmosToken.decimalPlaces.should.equal(6);
});
});
6 changes: 6 additions & 0 deletions modules/statics/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2879,6 +2879,12 @@ export enum UnderlyingAsset {
// VET testnet tokens
'tvet:vtho' = 'tvet:vtho',

// COSMOS tokens
'hash:ylds' = 'hash:ylds',

// COSMOS testnet tokens
'thash:ylds' = 'thash:ylds',

// fiats
AED = 'aed',
EUR = 'eur',
Expand Down
2 changes: 2 additions & 0 deletions modules/statics/src/coinFeatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,8 @@ export const COSMOS_SIDECHAIN_FEATURES_WITH_STAKING = [
CoinFeature.STAKING,
CoinFeature.BULK_STAKING_TRANSACTION,
];
export const COSMOS_TOKEN_FEATURES = [...COSMOS_SIDECHAIN_FEATURES];
export const COSMOS_TOKEN_FEATURES_WITH_STAKING = [...COSMOS_SIDECHAIN_FEATURES_WITH_STAKING];
export const ATOM_FEATURES = [...COSMOS_SIDECHAIN_FEATURES_WITH_STAKING, CoinFeature.CUSTODY_BITGO_FRANKFURT];
export const INJECTIVE_FEATURES = [
...COSMOS_SIDECHAIN_FEATURES_WITH_STAKING,
Expand Down
4 changes: 4 additions & 0 deletions modules/statics/src/coins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
stellarToken,
suiToken,
vetToken,
cosmosToken,
talgoToken,
taptNFTCollection,
taptToken,
Expand Down Expand Up @@ -70,6 +71,7 @@ import { ofcCoins } from './coins/ofcCoins';
import { sip10Tokens } from './coins/sip10Tokens';
import { nep141Tokens } from './coins/nep141Tokens';
import { vetTokens } from './coins/vetTokens';
import { cosmosTokens } from './coins/cosmosTokens';
import {
ADA_FEATURES_WITH_FRANKFURT,
ALGO_FEATURES,
Expand Down Expand Up @@ -139,6 +141,7 @@ export const coins = CoinMap.fromCoins([
...sip10Tokens,
...nep141Tokens,
...vetTokens,
...cosmosTokens,
avaxp(
'5436386e-9e4d-4d82-92df-59d9720d1738',
'avaxp',
Expand Down Expand Up @@ -4039,6 +4042,7 @@ export function createToken(token: AmsTokenConfig): Readonly<BaseCoin> | undefin
bera: beraErc20,
bsc: bscToken,
celo: celoToken,
cosmos: cosmosToken,
eth: erc20,
eos: eosToken,
hbar: hederaToken,
Expand Down
29 changes: 29 additions & 0 deletions modules/statics/src/coins/cosmosTokens.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { cosmosToken } from '../account';
import { UnderlyingAsset, BaseUnit } from '../base';
import { COSMOS_TOKEN_FEATURES_WITH_STAKING } from '../coinFeatures';
import { Networks } from '../networks';

export const cosmosTokens = [
cosmosToken(
'4c215052-be4b-4d10-9c05-63eac29cd953',
'hash:ylds',
'YLDS Token',
'uylds.fcc',
6,
Networks.main.hash,
BaseUnit.HASH,
UnderlyingAsset['hash:ylds'],
COSMOS_TOKEN_FEATURES_WITH_STAKING
),
cosmosToken(
'252dd264-a189-48e3-96e0-27802fc11b8d',
'thash:ylds',
'Testnet YLDS Token',
'uylds.fcc',
6,
Networks.test.hash,
BaseUnit.HASH,
UnderlyingAsset['thash:ylds'],
COSMOS_TOKEN_FEATURES_WITH_STAKING
),
];
Loading