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
33 changes: 33 additions & 0 deletions modules/sdk-coin-ton/test/unit/jettonToken.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import 'should';

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

describe('Jetton Tokens', function () {
let bitgo: TestBitGoAPI;
let testnetJettonToken;
const testnetTokenName = 'tton:ukwny-us';

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

it('should return constants for Testnet Ton token', function () {
testnetJettonToken.getChain().should.equal(testnetTokenName);
testnetJettonToken.getBaseChain().should.equal('tton');
testnetJettonToken.getFullName().should.equal('Ton Token');
testnetJettonToken.getBaseFactor().should.equal(1e9);
testnetJettonToken.type.should.equal(testnetTokenName);
testnetJettonToken.name.should.equal('Test Unknown TokenY-US');
testnetJettonToken.coin.should.equal('tton');
testnetJettonToken.network.should.equal('Testnet');
testnetJettonToken.contractAddress.should.equal('kQD8EQMavE1w6gvgMXUhN8hi7pSk4bKYM-W2dgkNqV54Y16Y');
testnetJettonToken.decimalPlaces.should.equal(9);
});
});
2 changes: 2 additions & 0 deletions modules/statics/src/allCoinsAndTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import { sip10Tokens } from './coins/sip10Tokens';
import { nep141Tokens } from './coins/nep141Tokens';
import { vetTokens } from './coins/vetTokens';
import { cosmosTokens } from './coins/cosmosTokens';
import { jettonTokens } from './coins/jettonTokens';
import { flrp } from './flrp';
import {
ADA_FEATURES_WITH_FRANKFURT,
Expand Down Expand Up @@ -146,6 +147,7 @@ export const allCoinsAndTokens = [
...botTokens,
...botOfcTokens,
...adaTokens,
...jettonTokens,
avaxp(
'5436386e-9e4d-4d82-92df-59d9720d1738',
'avaxp',
Expand Down
3 changes: 3 additions & 0 deletions modules/statics/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3116,6 +3116,9 @@ export enum UnderlyingAsset {
// COSMOS testnet tokens
'thash:ylds' = 'thash:ylds',

// TON testnet tokens
'tton:ukwny-us' = 'tton:ukwny-us',

'eth:0x0' = 'eth:0x0',
'eth:vvs' = 'eth:vvs',
'eth:bmx' = 'eth:bmx',
Expand Down
7 changes: 7 additions & 0 deletions modules/statics/src/coinFeatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,13 @@ export const TON_FEATURES = [
CoinFeature.ALPHANUMERIC_MEMO_ID,
CoinFeature.SUPPORTS_TOKENS,
];
export const TON_TOKEN_FEATURES = [
...ACCOUNT_COIN_DEFAULT_FEATURES,
CoinFeature.TSS,
CoinFeature.TSS_COLD,
CoinFeature.REBUILD_ON_CUSTODY_SIGNING,
CoinFeature.ALPHANUMERIC_MEMO_ID,
];
export const ARBETH_FEATURES = [
...ETH_FEATURES,
CoinFeature.TSS,
Expand Down
2 changes: 2 additions & 0 deletions modules/statics/src/coins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
eosToken,
erc20,
hederaToken,
jettonToken,
nep141Token,
opethErc20,
polygonErc20,
Expand Down Expand Up @@ -65,6 +66,7 @@ export function createToken(token: AmsTokenConfig): Readonly<BaseCoin> | undefin
xrp: xrpToken,
ofc: ofcToken,
ada: adaToken,
ton: jettonToken,
};

//return the BaseCoin from default coin map if present
Expand Down
16 changes: 16 additions & 0 deletions modules/statics/src/coins/jettonTokens.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { tjettonToken } from '../account';
import { UnderlyingAsset } from '../base';
import { TON_TOKEN_FEATURES } from '../coinFeatures';

export const jettonTokens = [
// testnet tokens
tjettonToken(
'a442d4fc-bc65-4ef5-92eb-fbefdd1f991f',
'tton:ukwny-us',
'Test Unknown TokenY-US',
9,
'kQD8EQMavE1w6gvgMXUhN8hi7pSk4bKYM-W2dgkNqV54Y16Y',
UnderlyingAsset['tton:ukwny-us'],
TON_TOKEN_FEATURES
),
];