@@ -2,6 +2,11 @@ import { BaseCoin, BaseUnit, CoinFeature, CoinKind, KeyCurve, UnderlyingAsset }
2
2
import { DOMAIN_PATTERN , HEDERA_NODE_ACCCOUNT_ID } from './constants' ;
3
3
import { InvalidContractAddressError , InvalidDomainError } from './errors' ;
4
4
import { 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' ;
5
10
6
11
export interface AccountConstructorOptions {
7
12
id : string ;
@@ -27,25 +32,10 @@ export interface AccountConstructorOptions {
27
32
* "pieces" of coin which belong to an address.
28
33
*/
29
34
export 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 ;
44
36
45
37
// 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 ;
49
39
50
40
public readonly network : AccountNetwork ;
51
41
@@ -997,11 +987,11 @@ export function erc20CompatibleAccountCoin(
997
987
* @param fullName Complete human-readable name of the token
998
988
* @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
999
989
* @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 the testnet CELO network.
994
+ * @param features ? Features of this coin. Defaults to the DEFAULT_FEATURES excluding CUSTODY feature
1005
995
* @param primaryKeyCurve The elliptic curve for this chain/token
1006
996
*/
1007
997
export function celoToken (
@@ -1011,7 +1001,7 @@ export function celoToken(
1011
1001
decimalPlaces : number ,
1012
1002
contractAddress : string ,
1013
1003
asset : UnderlyingAsset ,
1014
- features : CoinFeature [ ] = AccountCoin . DEFAULT_FEATURES ,
1004
+ features : CoinFeature [ ] = CELO_TOKEN_FEATURES ,
1015
1005
prefix = '' ,
1016
1006
suffix : string = name . toUpperCase ( ) ,
1017
1007
network : EthereumNetwork = Networks . main . celo ,
@@ -1045,10 +1035,10 @@ export function celoToken(
1045
1035
* @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
1046
1036
* @param contractAddress Contract address of this token
1047
1037
* @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.
1052
1042
*/
1053
1043
export function tceloToken (
1054
1044
id : string ,
@@ -1057,7 +1047,7 @@ export function tceloToken(
1057
1047
decimalPlaces : number ,
1058
1048
contractAddress : string ,
1059
1049
asset : UnderlyingAsset ,
1060
- features : CoinFeature [ ] = AccountCoin . DEFAULT_FEATURES ,
1050
+ features : CoinFeature [ ] = CELO_TOKEN_FEATURES ,
1061
1051
prefix = '' ,
1062
1052
suffix : string = name . toUpperCase ( ) ,
1063
1053
network : EthereumNetwork = Networks . test . celo
0 commit comments