@@ -146,6 +146,10 @@ export interface Nep141TokenConstructorOptions extends AccountConstructorOptions
146146 storageDepositAmount : string ;
147147}
148148
149+ export interface VetTokenConstructorOptions extends AccountConstructorOptions {
150+ contractAddress : string ;
151+ }
152+
149153export interface ContractAddress extends String {
150154 __contractaddress_phantom__ : never ;
151155}
@@ -603,6 +607,16 @@ export class Nep141Token extends AccountCoinToken {
603607 }
604608}
605609
610+ export class VetToken extends AccountCoinToken {
611+ public contractAddress : string ;
612+ constructor ( options : VetTokenConstructorOptions ) {
613+ super ( {
614+ ...options ,
615+ } ) ;
616+ this . contractAddress = options . contractAddress ;
617+ }
618+ }
619+
606620/**
607621 * Factory function for account coin instances.
608622 *
@@ -3015,3 +3029,79 @@ export function tnep141Token(
30153029 network
30163030 ) ;
30173031}
3032+
3033+ /**
3034+ * Factory function for vet token instances.
3035+ *
3036+ * @param id uuid v4
3037+ * @param name unique identifier of the token
3038+ * @param fullName Complete human-readable name of the token
3039+ * @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
3040+ * @param contractAddress Contract address of this token
3041+ * @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
3042+ * @param features Features of this coin. Defaults to the DEFAULT_FEATURES defined in `AccountCoin`
3043+ * @param prefix Optional token prefix. Defaults to empty string
3044+ * @param suffix Optional token suffix. Defaults to token name.
3045+ * @param network Optional token network. Defaults to Near main network.
3046+ * @param primaryKeyCurve The elliptic curve for this chain/token
3047+ */
3048+ export function vetToken (
3049+ id : string ,
3050+ name : string ,
3051+ fullName : string ,
3052+ decimalPlaces : number ,
3053+ contractAddress : string ,
3054+ asset : UnderlyingAsset ,
3055+ features : CoinFeature [ ] = AccountCoin . DEFAULT_FEATURES ,
3056+ prefix = '' ,
3057+ suffix : string = name . toUpperCase ( ) ,
3058+ network : AccountNetwork = Networks . main . vet ,
3059+ primaryKeyCurve : KeyCurve = KeyCurve . Secp256k1
3060+ ) {
3061+ return Object . freeze (
3062+ new VetToken ( {
3063+ id,
3064+ name,
3065+ fullName,
3066+ network,
3067+ contractAddress,
3068+ prefix,
3069+ suffix,
3070+ features,
3071+ decimalPlaces,
3072+ asset,
3073+ isToken : true ,
3074+ primaryKeyCurve,
3075+ baseUnit : BaseUnit . VET ,
3076+ } )
3077+ ) ;
3078+ }
3079+
3080+ /**
3081+ * Factory function for testnet vet token instances.
3082+ *
3083+ * @param id uuid v4
3084+ * @param name unique identifier of the token
3085+ * @param fullName Complete human-readable name of the token
3086+ * @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
3087+ * @param contractAddress Contract address of this token
3088+ * @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
3089+ * @param features Features of this coin. Defaults to the DEFAULT_FEATURES defined in `AccountCoin`
3090+ * @param prefix Optional token prefix. Defaults to empty string
3091+ * @param suffix Optional token suffix. Defaults to token name.
3092+ * @param network Optional token network. Defaults to the testnet Near network.
3093+ */
3094+ export function tvetToken (
3095+ id : string ,
3096+ name : string ,
3097+ fullName : string ,
3098+ decimalPlaces : number ,
3099+ contractAddress : string ,
3100+ asset : UnderlyingAsset ,
3101+ features : CoinFeature [ ] = AccountCoin . DEFAULT_FEATURES ,
3102+ prefix = '' ,
3103+ suffix : string = name . toUpperCase ( ) ,
3104+ network : AccountNetwork = Networks . test . vet
3105+ ) {
3106+ return vetToken ( id , name , fullName , decimalPlaces , contractAddress , asset , features , prefix , suffix , network ) ;
3107+ }
0 commit comments