Skip to content

Commit e99c1d7

Browse files
Merge pull request #6985 from BitGo/COIN-5624-
feat: add jetton to coinFactory
2 parents 6c0fb6c + cce273f commit e99c1d7

File tree

5 files changed

+19
-2
lines changed

5 files changed

+19
-2
lines changed

modules/bitgo/src/v2/coinFactory.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {
3737
VetTokenConfig,
3838
TaoTokenConfig,
3939
PolyxTokenConfig,
40+
JettonTokenConfig,
4041
} from '@bitgo/statics';
4142
import {
4243
Ada,
@@ -99,6 +100,7 @@ import {
99100
Injective,
100101
Iota,
101102
Islm,
103+
JettonToken,
102104
Lnbtc,
103105
Ltc,
104106
Mon,
@@ -528,6 +530,10 @@ export function registerCoinConstructors(coinFactory: CoinFactory, coinMap: Coin
528530
({ name, coinConstructor }) => coinFactory.register(name, coinConstructor)
529531
);
530532

533+
JettonToken.createTokenConstructors([...tokens.bitcoin.ton.tokens, ...tokens.testnet.ton.tokens]).forEach(
534+
({ name, coinConstructor }) => coinFactory.register(name, coinConstructor)
535+
);
536+
531537
VetToken.createTokenConstructors().forEach(({ name, coinConstructor }) =>
532538
coinFactory.register(name, coinConstructor)
533539
);
@@ -971,6 +977,9 @@ export function getTokenConstructor(tokenConfig: TokenConfig): CoinConstructor |
971977
case 'flr':
972978
case 'tflr':
973979
return FlrToken.createTokenConstructor(tokenConfig as EthLikeTokenConfig);
980+
case 'ton':
981+
case 'tton':
982+
return JettonToken.createTokenConstructor(tokenConfig as JettonTokenConfig);
974983
default:
975984
return undefined;
976985
}

modules/bitgo/src/v2/coins/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ import { Stx, Tstx, Sip10Token } from '@bitgo/sdk-coin-stx';
6060
import { Sui, Tsui, SuiToken } from '@bitgo/sdk-coin-sui';
6161
import { Tao, Ttao, TaoToken } from '@bitgo/sdk-coin-tao';
6262
import { Tia, Ttia } from '@bitgo/sdk-coin-tia';
63-
import { Ton, Tton } from '@bitgo/sdk-coin-ton';
63+
import { Ton, Tton, JettonToken } from '@bitgo/sdk-coin-ton';
6464
import { Trx, Ttrx } from '@bitgo/sdk-coin-trx';
6565
import { StellarToken, Txlm, Xlm } from '@bitgo/sdk-coin-xlm';
6666
import { Vet, Tvet, VetToken } from '@bitgo/sdk-coin-vet';
@@ -131,7 +131,7 @@ export { Stx, Tstx, Sip10Token };
131131
export { Sui, Tsui, SuiToken };
132132
export { Tao, Ttao, TaoToken };
133133
export { Tia, Ttia };
134-
export { Ton, Tton };
134+
export { Ton, Tton, JettonToken };
135135
export { Bld, Tbld };
136136
export { Sei, Tsei };
137137
export { Injective, Tinjective };

modules/bitgo/test/browser/browser.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ describe('Coins', () => {
5757
EthLikeErc20Token: 1,
5858
HashToken: 1,
5959
FlrToken: 1,
60+
JettonToken: 1,
6061
};
6162
Object.keys(BitGoJS.Coin)
6263
.filter((coinName) => !excludedKeys[coinName])

modules/statics/src/coinFeatures.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ export const TON_FEATURES = [
428428
CoinFeature.REBUILD_ON_CUSTODY_SIGNING,
429429
CoinFeature.CUSTODY_BITGO_FRANKFURT,
430430
CoinFeature.ALPHANUMERIC_MEMO_ID,
431+
CoinFeature.SUPPORTS_TOKENS,
431432
];
432433
export const ARBETH_FEATURES = [
433434
...ETH_FEATURES,

modules/statics/src/coins.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,12 @@ export function createToken(token: AmsTokenConfig): Readonly<BaseCoin> | undefin
263263
token.contractAddress,
264264
...commonArgs.slice(4) // asset, features, prefix, suffix, network, primaryKeyCurve
265265
);
266+
case 'ton':
267+
return initializer(
268+
...commonArgs.slice(0, 4), // id, name, fullName, decimalPlaces
269+
token.contractAddress, // contractAddress
270+
...commonArgs.slice(4) // asset, features, prefix, suffix, network, primaryKeyCurve
271+
);
266272
default:
267273
return undefined;
268274
}

0 commit comments

Comments
 (0)