@@ -139,6 +139,11 @@ export interface TaoCoinConstructorOptions extends AccountConstructorOptions {
139139 subnetId : string ;
140140}
141141
142+ export interface PolyxCoinConstructorOptions extends AccountConstructorOptions {
143+ ticker : string ;
144+ assetId : string ;
145+ }
146+
142147type FiatCoinName = `fiat${string } ` | `tfiat${string } `;
143148export interface FiatCoinConstructorOptions extends AccountConstructorOptions {
144149 name : FiatCoinName ;
@@ -672,6 +677,23 @@ export class TaoCoin extends AccountCoinToken {
672677 }
673678}
674679
680+ /**
681+ * The Bittensor network supports tokens
682+ * The token name is determined by the subnetId on chain.
683+ */
684+ export class PolyxCoin extends AccountCoinToken {
685+ public ticker : string ;
686+ public assetId : string ;
687+
688+ constructor ( options : PolyxCoinConstructorOptions ) {
689+ super ( {
690+ ...options ,
691+ } ) ;
692+ this . ticker = options . ticker ;
693+ this . assetId = options . assetId ;
694+ }
695+ }
696+
675697/**
676698 * Factory function for account coin instances.
677699 *
@@ -3408,3 +3430,98 @@ export function ttaoToken(
34083430 primaryKeyCurve
34093431 ) ;
34103432}
3433+
3434+ /**
3435+ * Factory function for tao token instances.
3436+ *
3437+ * @param id uuid v4
3438+ * @param name unique identifier of the token
3439+ * @param fullName Complete human-readable name of the token
3440+ * @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
3441+ * @param subnetId The uid of the subnet this token belongs to, numerical string
3442+ * @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
3443+ * @param features? Features of this coin. Defaults to the DEFAULT_FEATURES
3444+ * @param prefix? Optional token prefix. Defaults to empty string
3445+ * @param suffix? Optional token suffix. Defaults to token name.
3446+ * @param network? Optional token network. Defaults to TAO main network.
3447+ * @param primaryKeyCurve The elliptic curve for this chain/token
3448+ */
3449+ export function polyxToken (
3450+ id : string ,
3451+ name : string ,
3452+ fullName : string ,
3453+ decimalPlaces : number ,
3454+ ticker : string ,
3455+ assetId : string ,
3456+ asset : UnderlyingAsset ,
3457+ features : CoinFeature [ ] = AccountCoin . DEFAULT_FEATURES ,
3458+ prefix = '' ,
3459+ suffix : string = name . toUpperCase ( ) ,
3460+ network : AccountNetwork = Networks . main . tao ,
3461+ primaryKeyCurve : KeyCurve = KeyCurve . Ed25519
3462+ ) : Readonly < PolyxCoin > {
3463+ return Object . freeze (
3464+ new PolyxCoin ( {
3465+ id,
3466+ name,
3467+ fullName,
3468+ network,
3469+ ticker,
3470+ assetId,
3471+ prefix,
3472+ suffix,
3473+ features,
3474+ decimalPlaces,
3475+ asset,
3476+ isToken : true ,
3477+ primaryKeyCurve,
3478+ baseUnit : BaseUnit . TAO ,
3479+ } )
3480+ ) ;
3481+ }
3482+
3483+ /**
3484+ * Factory function for testnet tao token instances.
3485+ *
3486+ * @param id uuid v4
3487+ * @param name unique identifier of the token
3488+ * @param fullName Complete human-readable name of the token
3489+ * @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
3490+ * @param subnetId The uid of the subnet this token belongs to, numerical string
3491+ * @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
3492+ * @param features? Features of this coin. Defaults to the DEFAULT_FEATURES
3493+ * @param prefix? Optional token prefix. Defaults to empty string
3494+ * @param suffix? Optional token suffix. Defaults to token name.
3495+ * @param network? Optional token network. Defaults to TAO test network.
3496+ * @param primaryKeyCurve The elliptic curve for this chain/token
3497+ */
3498+
3499+ export function tpolyxToken (
3500+ id : string ,
3501+ name : string ,
3502+ fullName : string ,
3503+ decimalPlaces : number ,
3504+ ticker : string ,
3505+ assetId : string ,
3506+ asset : UnderlyingAsset ,
3507+ features : CoinFeature [ ] = AccountCoin . DEFAULT_FEATURES ,
3508+ prefix = '' ,
3509+ suffix : string = name . toUpperCase ( ) ,
3510+ network : AccountNetwork = Networks . test . tao ,
3511+ primaryKeyCurve : KeyCurve = KeyCurve . Ed25519
3512+ ) : Readonly < PolyxCoin > {
3513+ return polyxToken (
3514+ id ,
3515+ name ,
3516+ fullName ,
3517+ decimalPlaces ,
3518+ ticker ,
3519+ assetId ,
3520+ asset ,
3521+ features ,
3522+ prefix ,
3523+ suffix ,
3524+ network ,
3525+ primaryKeyCurve
3526+ ) ;
3527+ }
0 commit comments