Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 18 additions & 28 deletions modules/statics/src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ import { BaseCoin, BaseUnit, CoinFeature, CoinKind, KeyCurve, UnderlyingAsset }
import { DOMAIN_PATTERN, HEDERA_NODE_ACCCOUNT_ID } from './constants';
import { InvalidContractAddressError, InvalidDomainError } from './errors';
import { AccountNetwork, BaseNetwork, EthereumNetwork, Networks, TronNetwork } from './networks';
import {
ACCOUNT_COIN_DEFAULT_FEATURES,
ACCOUNT_COIN_DEFAULT_FEATURES_EXCLUDE_SINGAPORE,
CELO_TOKEN_FEATURES,
} from './coinFeatures';

export interface AccountConstructorOptions {
id: string;
Expand All @@ -27,25 +32,10 @@ export interface AccountConstructorOptions {
* "pieces" of coin which belong to an address.
*/
export class AccountCoin extends BaseCoin {
public static readonly DEFAULT_FEATURES = [
CoinFeature.ACCOUNT_MODEL,
CoinFeature.REQUIRES_BIG_NUMBER,
CoinFeature.VALUELESS_TRANSFER,
CoinFeature.TRANSACTION_DATA,
CoinFeature.CUSTODY,
CoinFeature.CUSTODY_BITGO_TRUST,
CoinFeature.CUSTODY_BITGO_MENA_FZE,
CoinFeature.CUSTODY_BITGO_CUSTODY_MENA_FZE,
CoinFeature.CUSTODY_BITGO_SINGAPORE,
CoinFeature.CUSTODY_BITGO_KOREA,
CoinFeature.CUSTODY_BITGO_EUROPE_APS,
CoinFeature.CUSTODY_BITGO_FRANKFURT,
];
public static readonly DEFAULT_FEATURES = ACCOUNT_COIN_DEFAULT_FEATURES;

// Need to gate some high risk coin from SINGAPORE trust
public static readonly DEFAULT_FEATURES_EXCLUDE_SINGAPORE = AccountCoin.DEFAULT_FEATURES.filter(
(feature) => feature !== CoinFeature.CUSTODY_BITGO_SINGAPORE
);
public static readonly DEFAULT_FEATURES_EXCLUDE_SINGAPORE = ACCOUNT_COIN_DEFAULT_FEATURES_EXCLUDE_SINGAPORE;

public readonly network: AccountNetwork;

Expand Down Expand Up @@ -997,11 +987,11 @@ export function erc20CompatibleAccountCoin(
* @param fullName Complete human-readable name of the token
* @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
* @param contractAddress Contract address of this token
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
* @param prefix? Optional token prefix. Defaults to empty string
* @param suffix? Optional token suffix. Defaults to token name.
* @param network? Optional token network. Defaults to CELO main network.
* @param features? Features of this coin. Defaults to the DEFAULT_FEATURES defined in `AccountCoin`
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin
* @param prefix ? Optional token prefix. Defaults to empty string
* @param suffix ? Optional token suffix. Defaults to token name.
* @param network ? Optional token network. Defaults to CELO main network.
* @param features ? Features of this coin. Defaults to the DEFAULT_FEATURES excluding CUSTODY feature
* @param primaryKeyCurve The elliptic curve for this chain/token
*/
export function celoToken(
Expand All @@ -1011,7 +1001,7 @@ export function celoToken(
decimalPlaces: number,
contractAddress: string,
asset: UnderlyingAsset,
features: CoinFeature[] = AccountCoin.DEFAULT_FEATURES,
features: CoinFeature[] = CELO_TOKEN_FEATURES,
prefix = '',
suffix: string = name.toUpperCase(),
network: EthereumNetwork = Networks.main.celo,
Expand Down Expand Up @@ -1045,10 +1035,10 @@ export function celoToken(
* @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
* @param contractAddress Contract address of this token
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
* @param prefix? Optional token prefix. Defaults to empty string
* @param suffix? Optional token suffix. Defaults to token name.
* @param network? Optional token network. Defaults to the testnet CELO network.
* @param features? Features of this coin. Defaults to the DEFAULT_FEATURES defined in `AccountCoin`
* @param features ? Features of this coin. Defaults to the DEFAULT_FEATURES excluding CUSTODY feature
* @param prefix ? Optional token prefix. Defaults to empty string
* @param suffix ? Optional token suffix. Defaults to token name.
* @param network ? Optional token network. Defaults to the testnet CELO network.
*/
export function tceloToken(
id: string,
Expand All @@ -1057,7 +1047,7 @@ export function tceloToken(
decimalPlaces: number,
contractAddress: string,
asset: UnderlyingAsset,
features: CoinFeature[] = AccountCoin.DEFAULT_FEATURES,
features: CoinFeature[] = CELO_TOKEN_FEATURES,
prefix = '',
suffix: string = name.toUpperCase(),
network: EthereumNetwork = Networks.test.celo
Expand Down
Loading