@@ -168,6 +168,10 @@ export interface CosmosTokenConstructorOptions extends AccountConstructorOptions
168168 denom : string ;
169169}
170170
171+ export interface JettonTokenConstructorOptions extends AccountConstructorOptions {
172+ contractAddress : string ;
173+ }
174+
171175export interface AdaTokenConstructorOptions extends AccountConstructorOptions {
172176 policyId : string ;
173177 assetName : string ;
@@ -680,6 +684,19 @@ export class CosmosChainToken extends AccountCoinToken {
680684 this . denom = options . denom ;
681685 }
682686}
687+ /**
688+ * TON supports tokens and Jetton is a token standard on TON
689+ * Jetton tokens work similar to native TON coin
690+ */
691+ export class JettonToken extends AccountCoinToken {
692+ public contractAddress : string ;
693+ constructor ( options : JettonTokenConstructorOptions ) {
694+ super ( {
695+ ...options ,
696+ } ) ;
697+ this . contractAddress = options . contractAddress ;
698+ }
699+ }
683700
684701/**
685702 * The Bittensor network supports tokens
@@ -3809,3 +3826,94 @@ export function tpolyxToken(
38093826 primaryKeyCurve
38103827 ) ;
38113828}
3829+
3830+ /**
3831+ * Factory function for Jetton token instances.
3832+ * Jetton is the token standard on TON blockchain.
3833+ *
3834+ * @param id uuid v4
3835+ * @param name unique identifier of the token
3836+ * @param fullName Complete human-readable name of the token
3837+ * @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
3838+ * @param contractAddress Contract address of this token
3839+ * @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
3840+ * @param features Features of this coin. Defaults to the DEFAULT_FEATURES defined in `AccountCoin`
3841+ * @param prefix Optional token prefix. Defaults to empty string
3842+ * @param suffix Optional token suffix. Defaults to token name.
3843+ * @param network Optional token network. Defaults to TON main network.
3844+ * @param primaryKeyCurve The elliptic curve for this chain/token
3845+ */
3846+ export function jettonToken (
3847+ id : string ,
3848+ name : string ,
3849+ fullName : string ,
3850+ decimalPlaces : number ,
3851+ contractAddress : string ,
3852+ asset : UnderlyingAsset ,
3853+ features : CoinFeature [ ] = AccountCoin . DEFAULT_FEATURES ,
3854+ prefix = '' ,
3855+ suffix : string = name . toUpperCase ( ) ,
3856+ network : AccountNetwork = Networks . main . ton ,
3857+ primaryKeyCurve : KeyCurve = KeyCurve . Ed25519
3858+ ) {
3859+ return Object . freeze (
3860+ new JettonToken ( {
3861+ id,
3862+ name,
3863+ fullName,
3864+ network,
3865+ contractAddress,
3866+ prefix,
3867+ suffix,
3868+ features,
3869+ decimalPlaces,
3870+ asset,
3871+ isToken : true ,
3872+ primaryKeyCurve,
3873+ baseUnit : BaseUnit . TON ,
3874+ } )
3875+ ) ;
3876+ }
3877+
3878+ /**
3879+ * Factory function for testnet jetton token instances.
3880+ * Jetton is the token standard on TON blockchain.
3881+ *
3882+ * @param id uuid v4
3883+ * @param name unique identifier of the token
3884+ * @param fullName Complete human-readable name of the token
3885+ * @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
3886+ * @param contractAddress Contract address of this token
3887+ * @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
3888+ * @param features Features of this coin. Defaults to the DEFAULT_FEATURES defined in `AccountCoin`
3889+ * @param prefix Optional token prefix. Defaults to empty string
3890+ * @param suffix Optional token suffix. Defaults to token name.
3891+ * @param network Optional token network. Defaults to the testnet TON network.
3892+ */
3893+ export function tjettonToken (
3894+ id : string ,
3895+ name : string ,
3896+ fullName : string ,
3897+ decimalPlaces : number ,
3898+ contractAddress : string ,
3899+ asset : UnderlyingAsset ,
3900+ features : CoinFeature [ ] = AccountCoin . DEFAULT_FEATURES ,
3901+ prefix = '' ,
3902+ suffix : string = name . toUpperCase ( ) ,
3903+ network : AccountNetwork = Networks . test . ton ,
3904+ primaryKeyCurve : KeyCurve = KeyCurve . Ed25519
3905+ ) {
3906+ return jettonToken (
3907+ id ,
3908+ name ,
3909+ fullName ,
3910+ decimalPlaces ,
3911+ contractAddress ,
3912+ asset ,
3913+ features ,
3914+ prefix ,
3915+ suffix ,
3916+ network ,
3917+ primaryKeyCurve
3918+ ) ;
3919+ }
0 commit comments