@@ -2,6 +2,11 @@ import { BaseCoin, BaseUnit, CoinFeature, CoinKind, KeyCurve, UnderlyingAsset }
22import { DOMAIN_PATTERN , HEDERA_NODE_ACCCOUNT_ID } from './constants' ;
33import { InvalidContractAddressError , InvalidDomainError } from './errors' ;
44import { AccountNetwork , BaseNetwork , EthereumNetwork , Networks , TronNetwork } from './networks' ;
5+ import {
6+ ACCOUNT_COIN_DEFAULT_FEATURES ,
7+ ACCOUNT_COIN_DEFAULT_FEATURES_EXCLUDE_SINGAPORE ,
8+ CELO_TOKEN_FEATURES ,
9+ } from './coinFeatures' ;
510
611export interface AccountConstructorOptions {
712 id : string ;
@@ -27,25 +32,10 @@ export interface AccountConstructorOptions {
2732 * "pieces" of coin which belong to an address.
2833 */
2934export class AccountCoin extends BaseCoin {
30- public static readonly DEFAULT_FEATURES = [
31- CoinFeature . ACCOUNT_MODEL ,
32- CoinFeature . REQUIRES_BIG_NUMBER ,
33- CoinFeature . VALUELESS_TRANSFER ,
34- CoinFeature . TRANSACTION_DATA ,
35- CoinFeature . CUSTODY ,
36- CoinFeature . CUSTODY_BITGO_TRUST ,
37- CoinFeature . CUSTODY_BITGO_MENA_FZE ,
38- CoinFeature . CUSTODY_BITGO_CUSTODY_MENA_FZE ,
39- CoinFeature . CUSTODY_BITGO_SINGAPORE ,
40- CoinFeature . CUSTODY_BITGO_KOREA ,
41- CoinFeature . CUSTODY_BITGO_EUROPE_APS ,
42- CoinFeature . CUSTODY_BITGO_FRANKFURT ,
43- ] ;
35+ public static readonly DEFAULT_FEATURES = ACCOUNT_COIN_DEFAULT_FEATURES ;
4436
4537 // Need to gate some high risk coin from SINGAPORE trust
46- public static readonly DEFAULT_FEATURES_EXCLUDE_SINGAPORE = AccountCoin . DEFAULT_FEATURES . filter (
47- ( feature ) => feature !== CoinFeature . CUSTODY_BITGO_SINGAPORE
48- ) ;
38+ public static readonly DEFAULT_FEATURES_EXCLUDE_SINGAPORE = ACCOUNT_COIN_DEFAULT_FEATURES_EXCLUDE_SINGAPORE ;
4939
5040 public readonly network : AccountNetwork ;
5141
@@ -997,11 +987,11 @@ export function erc20CompatibleAccountCoin(
997987 * @param fullName Complete human-readable name of the token
998988 * @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
999989 * @param contractAddress Contract address of this token
1000- * @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
1001- * @param prefix? Optional token prefix. Defaults to empty string
1002- * @param suffix? Optional token suffix. Defaults to token name.
1003- * @param network? Optional token network. Defaults to CELO main network.
1004- * @param features? Features of this coin. Defaults to the DEFAULT_FEATURES defined in `AccountCoin`
990+ * @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin
991+ * @param prefix ? Optional token prefix. Defaults to empty string
992+ * @param suffix ? Optional token suffix. Defaults to token name.
993+ * @param network ? Optional token network. Defaults to CELO main network.
994+ * @param features ? Features of this coin. Defaults to the DEFAULT_FEATURES excluding CUSTODY feature
1005995 * @param primaryKeyCurve The elliptic curve for this chain/token
1006996 */
1007997export function celoToken (
@@ -1011,7 +1001,7 @@ export function celoToken(
10111001 decimalPlaces : number ,
10121002 contractAddress : string ,
10131003 asset : UnderlyingAsset ,
1014- features : CoinFeature [ ] = AccountCoin . DEFAULT_FEATURES ,
1004+ features : CoinFeature [ ] = CELO_TOKEN_FEATURES ,
10151005 prefix = '' ,
10161006 suffix : string = name . toUpperCase ( ) ,
10171007 network : EthereumNetwork = Networks . main . celo ,
@@ -1045,10 +1035,10 @@ export function celoToken(
10451035 * @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
10461036 * @param contractAddress Contract address of this token
10471037 * @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
1048- * @param prefix? Optional token prefix . Defaults to empty string
1049- * @param suffix ? Optional token suffix . Defaults to token name.
1050- * @param network ? Optional token network . Defaults to the testnet CELO network .
1051- * @param features? Features of this coin . Defaults to the DEFAULT_FEATURES defined in `AccountCoin`
1038+ * @param features ? Features of this coin . Defaults to the DEFAULT_FEATURES excluding CUSTODY feature
1039+ * @param prefix ? Optional token prefix . Defaults to empty string
1040+ * @param suffix ? Optional token suffix . Defaults to token name .
1041+ * @param network ? Optional token network . Defaults to the testnet CELO network.
10521042 */
10531043export function tceloToken (
10541044 id : string ,
@@ -1057,7 +1047,7 @@ export function tceloToken(
10571047 decimalPlaces : number ,
10581048 contractAddress : string ,
10591049 asset : UnderlyingAsset ,
1060- features : CoinFeature [ ] = AccountCoin . DEFAULT_FEATURES ,
1050+ features : CoinFeature [ ] = CELO_TOKEN_FEATURES ,
10611051 prefix = '' ,
10621052 suffix : string = name . toUpperCase ( ) ,
10631053 network : EthereumNetwork = Networks . test . celo
0 commit comments