Skip to content

Commit

Permalink
chore: rename ae coin name to aeternity
Browse files Browse the repository at this point in the history
  • Loading branch information
peronczyk committed May 27, 2024
1 parent b1b72c3 commit c9489d6
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 36 deletions.
7 changes: 2 additions & 5 deletions src/composables/transactionData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,20 +218,17 @@ export function useTransactionData({
}

const amount = (isDexAllowance.value)
? toShiftedBigNumber(innerTx.value?.fee || 0, -adapter.coinPrecision)
? toShiftedBigNumber(innerTx.value?.fee || 0, -adapter.coinPrecision).toString()
: getTxAmountTotal(activeTransaction.value, direction.value);
const isReceived = direction.value === TX_DIRECTION.received;

if (isTransactionCoin.value || isDexAllowance.value || isMultisig.value || convertToCoin) {
return [{
...innerTx.value || {},
...adapter.getDefaultCoin(),
amount,
assetType: ASSET_TYPES.coin,
contractId: adapter.coinContractId,
isReceived,
name: adapter.coinName,
protocol,
symbol: adapter.coinSymbol,
}];
}

Expand Down
4 changes: 2 additions & 2 deletions src/popup/components/SwapRoute.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default defineComponent({
tokens[0].isWrappedCoin = false;
tokens.unshift({
...tokens[0],
...adapter.getDefaultCoin({} as any),
...adapter.getDefaultCoin(),
isWrappedCoin: false,
});
} else if (
Expand All @@ -117,7 +117,7 @@ export default defineComponent({
tokens[tokenLastIndex].isWrappedCoin = false;
tokens.push({
...tokens[tokenLastIndex],
...adapter.getDefaultCoin({} as any),
...adapter.getDefaultCoin(),
isWrappedCoin: true,
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/protocols/BaseProtocolAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export abstract class BaseProtocolAdapter {
abstract getCoinGeckoCoinId(): string;

abstract getDefaultCoin(
marketData: MarketData,
marketData?: MarketData,
convertedBalance?: number | BigNumber,
): ICoin;

Expand Down
1 change: 0 additions & 1 deletion src/protocols/aeternity/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export * from './libs/multisig';
export const AE_PROTOCOL_NAME = 'æternity';
export const AE_CONTRACT_ID = 'aeternity';

export const AE_COIN_NAME = 'Æ Coin';
export const AE_SYMBOL = 'AE'; // TODO rename to `AE_COIN_SYMBOL`
export const AE_COIN_PRECISION = 18; // Amount of decimals

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
AE_SYMBOL,
AE_COIN_PRECISION,
AE_CONTRACT_ID,
AE_COIN_NAME,
AE_PROTOCOL_NAME,
} from '@/protocols/aeternity/config';

interface TransactionResolverReturnData {
Expand All @@ -34,7 +34,7 @@ type TransactionResolvers = Partial<Record<TxFunctionParsed, TransactionResolver

const defaultToken: ITokenResolved = {
symbol: AE_SYMBOL,
name: AE_COIN_NAME,
name: AE_PROTOCOL_NAME,
decimals: AE_COIN_PRECISION,
contractId: AE_CONTRACT_ID,
};
Expand Down
7 changes: 3 additions & 4 deletions src/protocols/aeternity/libs/AeternityAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ import type {
ContractInitializeOptions,
} from '@/protocols/aeternity/types';
import {
AE_COIN_NAME,
AE_COIN_PRECISION,
AE_COINGECKO_COIN_ID,
AE_CONTRACT_ID,
Expand All @@ -71,7 +70,7 @@ export class AeternityAdapter extends BaseProtocolAdapter {

override protocolName = AE_PROTOCOL_NAME;

override coinName = AE_COIN_NAME;
override coinName = AE_PROTOCOL_NAME;

override coinSymbol = AE_SYMBOL;

Expand Down Expand Up @@ -131,11 +130,11 @@ export class AeternityAdapter extends BaseProtocolAdapter {
}

override getDefaultCoin(
marketData: MarketData,
marketData?: MarketData,
convertedBalance?: number,
): ICoin {
return {
...(marketData?.[PROTOCOLS.aeternity] || {} as MarketData),
...(marketData?.[PROTOCOLS.aeternity]! || {} as MarketData),
protocol: PROTOCOLS.aeternity,
contractId: this.coinContractId,
decimals: this.coinPrecision,
Expand Down
6 changes: 3 additions & 3 deletions src/protocols/bitcoin/components/TransferSendForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
:fee="numericFee"
:fee-symbol="BTC_SYMBOL"
:protocol="PROTOCOLS.bitcoin"
:custom-title="$t('modals.send.sendAsset', { name: BTC_COIN_NAME })"
:custom-title="$t('modals.send.sendAsset', { name: BTC_PROTOCOL_NAME })"
class="transfer-send-form"
>
<template #recipient>
Expand Down Expand Up @@ -93,7 +93,7 @@ import {
import { ProtocolAdapterFactory } from '@/lib/ProtocolAdapterFactory';
import Logger from '@/lib/logger';
import {
BTC_COIN_NAME,
BTC_PROTOCOL_NAME,
BTC_SYMBOL,
DUST_AMOUNT,
} from '@/protocols/bitcoin/config';
Expand Down Expand Up @@ -271,8 +271,8 @@ export default defineComponent({
return {
INFO_BOX_TYPES,
BTC_PROTOCOL_NAME,
BTC_SYMBOL,
BTC_COIN_NAME,
DUST_AMOUNT,
PROTOCOLS,
NETWORK_TYPE_TESTNET,
Expand Down
2 changes: 1 addition & 1 deletion src/protocols/bitcoin/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { NETWORK_TYPE_MAINNET, NETWORK_TYPE_TESTNET } from '@/constants';

export const BTC_CONTRACT_ID = 'bitcoin';
export const BTC_SYMBOL = 'BTC';
export const BTC_COIN_NAME = 'Bitcoin';
export const BTC_PROTOCOL_NAME = 'Bitcoin';
export const BTC_COIN_PRECISION = 8; // Amount of decimals
export const BTC_COINGECKO_COIN_ID = 'bitcoin';
/**
Expand Down
10 changes: 5 additions & 5 deletions src/protocols/bitcoin/libs/BitcoinAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ import {
import { tg } from '@/popup/plugins/i18n';
import { BaseProtocolAdapter } from '@/protocols/BaseProtocolAdapter';
import {
BTC_COIN_NAME,
BTC_COIN_PRECISION,
BTC_NETWORK_DEFAULT_SETTINGS,
BTC_COINGECKO_COIN_ID,
BTC_CONTRACT_ID,
BTC_PROTOCOL_NAME,
BTC_SYMBOL,
DUST_AMOUNT,
} from '@/protocols/bitcoin/config';
Expand All @@ -58,7 +58,7 @@ export class BitcoinAdapter extends BaseProtocolAdapter {

override protocolName = 'Bitcoin';

override coinName = BTC_COIN_NAME;
override coinName = BTC_PROTOCOL_NAME;

override coinSymbol = BTC_SYMBOL;

Expand Down Expand Up @@ -117,16 +117,16 @@ export class BitcoinAdapter extends BaseProtocolAdapter {
}

override getDefaultCoin(
marketData: MarketData,
marketData?: MarketData,
convertedBalance?: number,
): ICoin {
return {
...(marketData?.[PROTOCOLS.bitcoin] || {}),
...(marketData?.[PROTOCOLS.bitcoin]! || {} as MarketData),
protocol: PROTOCOLS.bitcoin,
contractId: this.coinContractId,
symbol: this.coinSymbol,
decimals: this.getAmountPrecision(),
name: BTC_COIN_NAME,
name: this.coinName,
convertedBalance,
};
}
Expand Down
4 changes: 2 additions & 2 deletions src/protocols/bitcoin/views/TransactionDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import { TX_DIRECTION, PROTOCOLS } from '@/constants';
import { useUi } from '@/composables';
import { ProtocolAdapterFactory } from '@/lib/ProtocolAdapterFactory';
import { ROUTE_NOT_FOUND } from '@/popup/router/routeNames';
import { BTC_COIN_NAME, BTC_SYMBOL } from '@/protocols/bitcoin/config';
import { BTC_PROTOCOL_NAME, BTC_SYMBOL } from '@/protocols/bitcoin/config';
import { getTxAmountTotal } from '@/protocols/bitcoin/helpers';
import TransactionDetailsBase from '@/popup/components/TransactionDetailsBase.vue';
Expand Down Expand Up @@ -80,7 +80,7 @@ export default defineComponent({
const assets = computed((): ITokenResolved[] => [{
amount: amount.value,
symbol: BTC_SYMBOL,
name: BTC_COIN_NAME,
name: BTC_PROTOCOL_NAME,
isReceived: direction.value === TX_DIRECTION.received,
contractId: adapter.coinContractId,
}]);
Expand Down
6 changes: 3 additions & 3 deletions src/protocols/ethereum/components/TransferSendForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
:max-fee="numericMaxFee"
:fee-symbol="ETH_COIN_SYMBOL"
:protocol="PROTOCOLS.ethereum"
:custom-title="$t('modals.send.sendAsset', { name: ETH_COIN_NAME })"
:custom-title="$t('modals.send.sendAsset', { name: ETH_PROTOCOL_NAME })"
class="transfer-send-form"
>
<template #recipient>
Expand Down Expand Up @@ -90,9 +90,9 @@ import { NETWORK_TYPE_TESTNET, PROTOCOLS } from '@/constants';
import { executeAndSetInterval } from '@/utils';
import { ProtocolAdapterFactory } from '@/lib/ProtocolAdapterFactory';
import {
ETH_COIN_NAME,
ETH_COIN_PRECISION,
ETH_COIN_SYMBOL,
ETH_PROTOCOL_NAME,
} from '@/protocols/ethereum/config';
import { useEthMaxAmount } from '@/protocols/ethereum/composables/ethMaxAmount';
import { useEthNetworkSettings } from '@/protocols/ethereum/composables/ethNetworkSettings';
Expand Down Expand Up @@ -279,7 +279,7 @@ export default defineComponent({
);
return {
ETH_COIN_NAME,
ETH_PROTOCOL_NAME,
ETH_COIN_SYMBOL,
PROTOCOLS,
NETWORK_TYPE_TESTNET,
Expand Down
1 change: 0 additions & 1 deletion src/protocols/ethereum/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export const ETH_PROTOCOL_NAME = 'Ethereum';
export const ETH_CONTRACT_ID = 'ethereum';
export const ETH_CONTRACT_ID_EXTERNAL = '0x0000000000000000000000000000000000000000';

export const ETH_COIN_NAME = 'Ethereum';
export const ETH_COIN_SYMBOL = 'ETH';
export const ETH_COIN_PRECISION = 18; // Amount of decimals

Expand Down
9 changes: 4 additions & 5 deletions src/protocols/ethereum/libs/EthereumAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ import { BaseProtocolAdapter } from '@/protocols/BaseProtocolAdapter';
import { tg } from '@/popup/plugins/i18n';
import {
ERC20_ABI,
ETH_COIN_NAME,
ETH_COIN_PRECISION,
ETH_COIN_SYMBOL,
ETH_COINGECKO_COIN_ID,
Expand All @@ -74,7 +73,7 @@ export class EthereumAdapter extends BaseProtocolAdapter {

override protocolName = ETH_PROTOCOL_NAME;

override coinName = ETH_COIN_NAME;
override coinName = ETH_PROTOCOL_NAME;

override coinSymbol = ETH_COIN_SYMBOL;

Expand Down Expand Up @@ -136,16 +135,16 @@ export class EthereumAdapter extends BaseProtocolAdapter {
}

override getDefaultCoin(
marketData: MarketData,
marketData?: MarketData,
convertedBalance?: number,
): ICoin {
return {
...(marketData?.[PROTOCOLS.ethereum] || {}),
...(marketData?.[PROTOCOLS.ethereum]! || {} as MarketData),
protocol: PROTOCOLS.ethereum,
contractId: this.coinContractId,
symbol: this.coinSymbol,
decimals: this.coinPrecision,
name: ETH_COIN_NAME,
name: this.coinName,
convertedBalance,
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export function convertWrappedCoinTokenToCoin(asset: ITokenResolved): ITokenReso
return (asset.isWrappedCoin && asset.protocol)
? {
...asset,
...ProtocolAdapterFactory.getAdapter(asset.protocol).getDefaultCoin({} as any),
...ProtocolAdapterFactory.getAdapter(asset.protocol).getDefaultCoin(),
}
: asset;
}
Expand Down

0 comments on commit c9489d6

Please sign in to comment.