Skip to content

Commit bf210b5

Browse files
Merge pull request #6986 from BitGo/COIN-5624-onboard-tokens
feat: onboard testnet ton token
2 parents e99c1d7 + e9e720b commit bf210b5

File tree

6 files changed

+63
-0
lines changed

6 files changed

+63
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import 'should';
2+
3+
import { TestBitGo, TestBitGoAPI } from '@bitgo/sdk-test';
4+
import { BitGoAPI } from '@bitgo/sdk-api';
5+
import { JettonToken } from '../../src';
6+
7+
describe('Jetton Tokens', function () {
8+
let bitgo: TestBitGoAPI;
9+
let testnetJettonToken;
10+
const testnetTokenName = 'tton:ukwny-us';
11+
12+
before(function () {
13+
bitgo = TestBitGo.decorate(BitGoAPI, { env: 'test' });
14+
JettonToken.createTokenConstructors().forEach(({ name, coinConstructor }) => {
15+
bitgo.safeRegister(name, coinConstructor);
16+
});
17+
bitgo.initializeTestVars();
18+
testnetJettonToken = bitgo.coin(testnetTokenName);
19+
});
20+
21+
it('should return constants for Testnet Ton token', function () {
22+
testnetJettonToken.getChain().should.equal(testnetTokenName);
23+
testnetJettonToken.getBaseChain().should.equal('tton');
24+
testnetJettonToken.getFullName().should.equal('Ton Token');
25+
testnetJettonToken.getBaseFactor().should.equal(1e9);
26+
testnetJettonToken.type.should.equal(testnetTokenName);
27+
testnetJettonToken.name.should.equal('Test Unknown TokenY-US');
28+
testnetJettonToken.coin.should.equal('tton');
29+
testnetJettonToken.network.should.equal('Testnet');
30+
testnetJettonToken.contractAddress.should.equal('kQD8EQMavE1w6gvgMXUhN8hi7pSk4bKYM-W2dgkNqV54Y16Y');
31+
testnetJettonToken.decimalPlaces.should.equal(9);
32+
});
33+
});

modules/statics/src/allCoinsAndTokens.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ import { sip10Tokens } from './coins/sip10Tokens';
6363
import { nep141Tokens } from './coins/nep141Tokens';
6464
import { vetTokens } from './coins/vetTokens';
6565
import { cosmosTokens } from './coins/cosmosTokens';
66+
import { jettonTokens } from './coins/jettonTokens';
6667
import { flrp } from './flrp';
6768
import {
6869
ADA_FEATURES_WITH_FRANKFURT,
@@ -146,6 +147,7 @@ export const allCoinsAndTokens = [
146147
...botTokens,
147148
...botOfcTokens,
148149
...adaTokens,
150+
...jettonTokens,
149151
avaxp(
150152
'5436386e-9e4d-4d82-92df-59d9720d1738',
151153
'avaxp',

modules/statics/src/base.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3116,6 +3116,9 @@ export enum UnderlyingAsset {
31163116
// COSMOS testnet tokens
31173117
'thash:ylds' = 'thash:ylds',
31183118

3119+
// TON testnet tokens
3120+
'tton:ukwny-us' = 'tton:ukwny-us',
3121+
31193122
'eth:0x0' = 'eth:0x0',
31203123
'eth:vvs' = 'eth:vvs',
31213124
'eth:bmx' = 'eth:bmx',

modules/statics/src/coinFeatures.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,13 @@ export const TON_FEATURES = [
430430
CoinFeature.ALPHANUMERIC_MEMO_ID,
431431
CoinFeature.SUPPORTS_TOKENS,
432432
];
433+
export const TON_TOKEN_FEATURES = [
434+
...ACCOUNT_COIN_DEFAULT_FEATURES,
435+
CoinFeature.TSS,
436+
CoinFeature.TSS_COLD,
437+
CoinFeature.REBUILD_ON_CUSTODY_SIGNING,
438+
CoinFeature.ALPHANUMERIC_MEMO_ID,
439+
];
433440
export const ARBETH_FEATURES = [
434441
...ETH_FEATURES,
435442
CoinFeature.TSS,

modules/statics/src/coins.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
eosToken,
1212
erc20,
1313
hederaToken,
14+
jettonToken,
1415
nep141Token,
1516
opethErc20,
1617
polygonErc20,
@@ -65,6 +66,7 @@ export function createToken(token: AmsTokenConfig): Readonly<BaseCoin> | undefin
6566
xrp: xrpToken,
6667
ofc: ofcToken,
6768
ada: adaToken,
69+
ton: jettonToken,
6870
};
6971

7072
//return the BaseCoin from default coin map if present
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { tjettonToken } from '../account';
2+
import { UnderlyingAsset } from '../base';
3+
import { TON_TOKEN_FEATURES } from '../coinFeatures';
4+
5+
export const jettonTokens = [
6+
// testnet tokens
7+
tjettonToken(
8+
'a442d4fc-bc65-4ef5-92eb-fbefdd1f991f',
9+
'tton:ukwny-us',
10+
'Test Unknown TokenY-US',
11+
9,
12+
'kQD8EQMavE1w6gvgMXUhN8hi7pSk4bKYM-W2dgkNqV54Y16Y',
13+
UnderlyingAsset['tton:ukwny-us'],
14+
TON_TOKEN_FEATURES
15+
),
16+
];

0 commit comments

Comments
 (0)