@@ -2183,3 +2183,106 @@ export function tofcVetToken(
21832183 } )
21842184 ) ;
21852185}
2186+
2187+ /**
2188+ * Factory function for ofc hash token instances.
2189+ *
2190+ * @param id uuid v4
2191+ * @param name unique identifier of the coin
2192+ * @param fullName Complete human-readable name of the coin
2193+ * @param network Network object for this coin
2194+ * @param decimalPlaces Number of decimal places this coin supports (divisibility exponent)
2195+ * @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
2196+ * @param kind Differentiates coins which represent fiat assets from those which represent crypto assets
2197+ * @param prefix? Optional coin prefix. Defaults to empty string
2198+ * @param suffix? Optional coin suffix. Defaults to coin name.
2199+ * @param isToken? Whether or not this account coin is a token of another coin
2200+ * @param features? Features of this coin. Defaults to the DEFAULT_FEATURES defined in `OfcCoin`
2201+ * @param primaryKeyCurve The elliptic curve for this chain/token
2202+ */
2203+ export function ofcHashToken (
2204+ id : string ,
2205+ name : string ,
2206+ fullName : string ,
2207+ decimalPlaces : number ,
2208+ asset : UnderlyingAsset ,
2209+ kind : CoinKind = CoinKind . CRYPTO ,
2210+ features : CoinFeature [ ] = OfcCoin . DEFAULT_FEATURES ,
2211+ prefix = '' ,
2212+ suffix : string = name . replace ( / ^ o f c / , '' ) . toUpperCase ( ) ,
2213+ network : OfcNetwork = Networks . main . ofc ,
2214+ isToken = true ,
2215+ addressCoin = 'hash' ,
2216+ primaryKeyCurve : KeyCurve = KeyCurve . Secp256k1
2217+ ) {
2218+ const filteredFeatures = getFilteredFeatures ( suffix ) ;
2219+ if ( filteredFeatures . length > 0 ) {
2220+ features = filteredFeatures ;
2221+ }
2222+ return Object . freeze (
2223+ new OfcCoin ( {
2224+ id,
2225+ name,
2226+ fullName,
2227+ network,
2228+ prefix,
2229+ suffix,
2230+ features,
2231+ decimalPlaces,
2232+ isToken,
2233+ asset,
2234+ kind,
2235+ addressCoin,
2236+ primaryKeyCurve,
2237+ baseUnit : BaseUnit . HASH ,
2238+ } )
2239+ ) ;
2240+ }
2241+
2242+ /**
2243+ * Factory function for testnet ofc hash token instances.
2244+ *
2245+ * @param id uuid v4
2246+ * @param name unique identifier of the coin
2247+ * @param fullName Complete human-readable name of the coin
2248+ * @param network Network object for this coin
2249+ * @param decimalPlaces Number of decimal places this coin supports (divisibility exponent)
2250+ * @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
2251+ * @param kind Differentiates coins which represent fiat assets from those which represent crypto assets
2252+ * @param prefix? Optional coin prefix. Defaults to empty string
2253+ * @param suffix? Optional coin suffix. Defaults to coin name.
2254+ * @param isToken? Whether or not this account coin is a token of another coin
2255+ * @param features? Features of this coin. Defaults to the DEFAULT_FEATURES defined in `OfcCoin`
2256+ * @param primaryKeyCurve The elliptic curve for this chain/token
2257+ */
2258+ export function tofcHashToken (
2259+ id : string ,
2260+ name : string ,
2261+ fullName : string ,
2262+ decimalPlaces : number ,
2263+ asset : UnderlyingAsset ,
2264+ kind : CoinKind = CoinKind . CRYPTO ,
2265+ features : CoinFeature [ ] = OfcCoin . DEFAULT_FEATURES ,
2266+ prefix = '' ,
2267+ suffix : string = name . replace ( / ^ o f c / , '' ) . toUpperCase ( ) ,
2268+ network : OfcNetwork = Networks . test . ofc ,
2269+ isToken = true ,
2270+ addressCoin = 'thash' ,
2271+ primaryKeyCurve : KeyCurve = KeyCurve . Secp256k1
2272+ ) {
2273+ return ofcHashToken (
2274+ id ,
2275+ name ,
2276+ fullName ,
2277+ decimalPlaces ,
2278+ asset ,
2279+ kind ,
2280+ features ,
2281+ prefix ,
2282+ suffix ,
2283+ network ,
2284+ isToken ,
2285+ addressCoin ,
2286+ primaryKeyCurve
2287+ ) ;
2288+ }
0 commit comments