Skip to content

Commit e1583ae

Browse files
committed
fix: custodial wallets are not supported for celo
TICKET: COIN-3463
1 parent 0795883 commit e1583ae

File tree

3 files changed

+101
-77
lines changed

3 files changed

+101
-77
lines changed

modules/statics/src/account.ts

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import { BaseCoin, BaseUnit, CoinFeature, CoinKind, KeyCurve, UnderlyingAsset }
22
import { DOMAIN_PATTERN, HEDERA_NODE_ACCCOUNT_ID } from './constants';
33
import { InvalidContractAddressError, InvalidDomainError } from './errors';
44
import { AccountNetwork, BaseNetwork, EthereumNetwork, Networks, TronNetwork } from './networks';
5+
import {
6+
ACCOUNT_COIN_DEFAULT_FEATURES,
7+
ACCOUNT_COIN_DEFAULT_FEATURES_EXCLUDE_SINGAPORE,
8+
CELO_FEATURES,
9+
} from './coinFeatures';
510

611
export interface AccountConstructorOptions {
712
id: string;
@@ -27,25 +32,10 @@ export interface AccountConstructorOptions {
2732
* "pieces" of coin which belong to an address.
2833
*/
2934
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;
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

@@ -987,12 +977,11 @@ export function erc20CompatibleAccountCoin(
987977
* @param fullName Complete human-readable name of the token
988978
* @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
989979
* @param contractAddress Contract address of this token
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 defined in `AccountCoin`
995-
* @param primaryKeyCurve The elliptic curve for this chain/token
980+
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin
981+
* @param prefix ? Optional token prefix. Defaults to empty string
982+
* @param suffix ? Optional token suffix. Defaults to token name.
983+
* @param network ? Optional token network. Defaults to the testnet CELO network.
984+
* @param features ? Features of this coin. Defaults to the CELO_FEATURES
996985
*/
997986
export function celoToken(
998987
id: string,
@@ -1001,7 +990,7 @@ export function celoToken(
1001990
decimalPlaces: number,
1002991
contractAddress: string,
1003992
asset: UnderlyingAsset,
1004-
features: CoinFeature[] = AccountCoin.DEFAULT_FEATURES,
993+
features: CoinFeature[] = CELO_FEATURES,
1005994
prefix = '',
1006995
suffix: string = name.toUpperCase(),
1007996
network: EthereumNetwork = Networks.main.celo,
@@ -1035,10 +1024,10 @@ export function celoToken(
10351024
* @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
10361025
* @param contractAddress Contract address of this token
10371026
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
1038-
* @param prefix? Optional token prefix. Defaults to empty string
1039-
* @param suffix? Optional token suffix. Defaults to token name.
1040-
* @param network? Optional token network. Defaults to the testnet CELO network.
1041-
* @param features? Features of this coin. Defaults to the DEFAULT_FEATURES defined in `AccountCoin`
1027+
* @param features ? Features of this coin. Defaults to the CELO_FEATURES excluding CUSTODY feature
1028+
* @param prefix ? Optional token prefix. Defaults to empty string
1029+
* @param suffix ? Optional token suffix. Defaults to token name.
1030+
* @param network ? Optional token network. Defaults to the testnet CELO network.
10421031
*/
10431032
export function tceloToken(
10441033
id: string,
@@ -1047,7 +1036,7 @@ export function tceloToken(
10471036
decimalPlaces: number,
10481037
contractAddress: string,
10491038
asset: UnderlyingAsset,
1050-
features: CoinFeature[] = AccountCoin.DEFAULT_FEATURES,
1039+
features: CoinFeature[] = CELO_FEATURES,
10511040
prefix = '',
10521041
suffix: string = name.toUpperCase(),
10531042
network: EthereumNetwork = Networks.test.celo

0 commit comments

Comments
 (0)