Skip to content

Commit 95185ff

Browse files
author
Tyler Levine
committed
Add ENTERPRISE_PAYS_FEES and accountExplorerUrl
A common use case in the front end is building a URL to a block explorer for a specific transaction, so a user can see the status of their transaction on chain. For some account coins, fees are paid from the Enterprise, instead of from the wallet itself. For those coins, we'd like to be able to: 1) Know that this is one of those coins where the enterprise pays fees 2) How to build an explorer URL so a user can look at the on chain balance of their Enterprise fee address This commit adds the ENTEPRISE_PAYS_FEES coin feature, and adds this feature to XTZ and ETH (the only two coins which currently pay fees from the Enterprise gas tank). This solves for case #1. This commit also adds a new optional field to `AccountNetwork` called `accountExplorerUrl`. This can be used for building urls just like the `explorerUrl`, and therefore solves case #2 above. Ticket: BG-19107
1 parent baf6d9b commit 95185ff

3 files changed

Lines changed: 18 additions & 4 deletions

File tree

modules/statics/src/base.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ export const enum CoinFeature {
112112
* For example, Ethereum's ERC 20 token standard means that it supports tokens, so it shall have this feature.
113113
*/
114114
SUPPORTS_TOKENS = 'supports-tokens',
115+
/*
116+
* Are fees for transactions of this coin paid for by the Enterprise (eg, Enterprise gas tank)?
117+
*/
118+
ENTERPRISE_PAYS_FEES = 'enterprise-pays-fees',
115119
}
116120

117121
/**

modules/statics/src/coins.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import { Networks } from './networks';
55
import { ofc, tofc, ofcerc20, tofcerc20 } from './ofc';
66
import { utxo } from './utxo';
77

8-
const ETH_FEATURES = [...AccountCoin.DEFAULT_FEATURES, CoinFeature.SUPPORTS_TOKENS];
8+
const ETH_FEATURES = [...AccountCoin.DEFAULT_FEATURES, CoinFeature.SUPPORTS_TOKENS, CoinFeature.ENTERPRISE_PAYS_FEES];
99
const XLM_FEATURES = [...AccountCoin.DEFAULT_FEATURES, CoinFeature.SUPPORTS_TOKENS];
10+
const XTZ_FEATURES = [...AccountCoin.DEFAULT_FEATURES, CoinFeature.ENTERPRISE_PAYS_FEES];
1011

1112
export const coins = CoinMap.fromCoins([
1213
utxo('bch', 'Bitcoin Cash', Networks.main.bitcoinCash, UnderlyingAsset.BCH),
@@ -34,8 +35,8 @@ export const coins = CoinMap.fromCoins([
3435
account('txrp', 'Testnet Ripple', Networks.test.xrp, 6, UnderlyingAsset.XRP),
3536
account('xlm', 'Stellar', Networks.main.stellar, 7, UnderlyingAsset.XLM, XLM_FEATURES),
3637
account('txlm', 'Testnet Stellar', Networks.test.stellar, 7, UnderlyingAsset.XLM, XLM_FEATURES),
37-
account('xtz', 'Tezos', Networks.main.xtz, 6, UnderlyingAsset.XTZ),
38-
account('txtz', 'Testnet Tezos Babylonnet', Networks.test.xtz, 6, UnderlyingAsset.XTZ),
38+
account('xtz', 'Tezos', Networks.main.xtz, 6, UnderlyingAsset.XTZ, XTZ_FEATURES),
39+
account('txtz', 'Testnet Tezos Babylonnet', Networks.test.xtz, 6, UnderlyingAsset.XTZ, XTZ_FEATURES),
3940
account('susd', 'Silvergate USD', Networks.main.susd, 2, UnderlyingAsset.USD),
4041
account('tsusd', 'Testnet Silvergate USD', Networks.test.susd, 2, UnderlyingAsset.USD),
4142
ofc('ofcusd', 'USD', 2, UnderlyingAsset.USD, CoinKind.FIAT),

modules/statics/src/networks.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,13 @@ export interface UtxoNetwork extends BaseNetwork {
3636
wif: number;
3737
}
3838

39-
export interface AccountNetwork extends BaseNetwork {}
39+
export interface AccountNetwork extends BaseNetwork {
40+
// some chains pay fees via an enterprise gas task. The account explorer url
41+
// is a url that can be used to look up the account for the gas tank on-chain.
42+
readonly accountExplorerUrl?: string;
43+
}
4044

45+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
4146
export interface OfcNetwork extends BaseNetwork {}
4247

4348
abstract class Mainnet extends BaseNetwork {
@@ -171,11 +176,13 @@ class DashTestnet extends BitcoinLikeTestnet {
171176
class Ethereum extends Mainnet implements AccountNetwork {
172177
family = CoinFamily.ETH;
173178
explorerUrl = 'https://etherscan.io/tx/';
179+
accountExplorerUrl = 'https://etherscan.io/address/';
174180
}
175181

176182
class Kovan extends Testnet implements AccountNetwork {
177183
family = CoinFamily.ETH;
178184
explorerUrl = 'https://kovan.etherscan.io/tx/';
185+
accountExplorerUrl = 'https://kovan.etherscan.io/address/';
179186
}
180187

181188
class Eos extends Mainnet implements AccountNetwork {
@@ -261,11 +268,13 @@ class XrpTestnet extends Testnet implements AccountNetwork {
261268
class Xtz extends Mainnet implements AccountNetwork {
262269
family = CoinFamily.XTZ;
263270
explorerUrl = 'https://tezblock.io/transaction/';
271+
accountExplorerUrl = 'https://tezblock.io/account/';
264272
}
265273

266274
class XtzTestnet extends Testnet implements AccountNetwork {
267275
family = CoinFamily.XTZ;
268276
explorerUrl = 'https://babylonnet.tezblock.io/transaction/';
277+
accountExplorerUrl = 'https://babylonnet.tezblock.io/account/';
269278
}
270279

271280
// https://github.com/zcash/zcash/blob/master/src/validation.cpp

0 commit comments

Comments
 (0)