Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yougile-103, Linea Promo #3317

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,6 @@ Thumbs.db

# Test
/src/coverage/*

# settigns
.vscode
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export class WalletLinkWalletAdapter extends EvmWalletAdapter<ProviderInterface>

public async activate(): Promise<void> {
try {
// @ts-ignore
const [address] = await this.wallet.request<[string]>({ method: 'eth_requestAccounts' });
const chainId = (await this.wallet.request({ method: 'eth_chainId' })) as string;
this.isEnabled = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ import { AssetsSelectorService } from './services/assets-selector-service/assets
import { BlockchainsFilterListComponent } from './components/blockchains-filter-list/blockchains-filter-list.component';
import { FilterListElementComponent } from './components/blockchains-filter-list/components/filter-list-element/filter-list-element.component';
import { FilterQueryService } from './services/filter-query-service/filter-query.service';
import { BlockchainsPromoBadgeComponent } from './components/blockchains-promo-badge/blockchains-promo-badge.component';
import { AssetsSearchQueryService } from './services/assets-search-query-service/assets-search-query.service';
import { BlockchainBadgeComponent } from './components/blockchain-badge/blockchain-badge.component';

@NgModule({
declarations: [
Expand All @@ -51,7 +51,7 @@ import { AssetsSearchQueryService } from './services/assets-search-query-service
AssetsSelectorPageComponent,
BlockchainsFilterListComponent,
FilterListElementComponent,
BlockchainsPromoBadgeComponent
BlockchainBadgeComponent
],
imports: [
CommonModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
</div>
<ng-container *ngIf="!isMobile && getBlockchainTag(blockchainItem) as tag">
<div class="badge-container">
<app-blockchains-promo-badge
<app-blockchain-badge
[tag]="tag"
[blockchain]="blockchainItem.name"
></app-blockchains-promo-badge>
></app-blockchain-badge>
</div>
</ng-container>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
&._disabled {
cursor: not-allowed !important;

app-blockchains-promo-badge {
app-blockchain-badge {
z-index: 1;

pointer-events: auto;
Expand All @@ -134,7 +134,6 @@
.t-wrapper {
background: var(--tui-secondary-hover) !important;
opacity: 1 !important;

}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,12 @@ export class AssetTypesAsideComponent {
@Inject(Injector) private readonly injector: Injector
) {}

private getBlockchainsListForLandingIframe(): AvailableBlockchain[] {
const allAvailableBlockchains = this.blockchainsListService.availableBlockchains;
const zkSyncBlockchain = this.blockchainsListService.availableBlockchains.find(
blockchain => blockchain.name === 'ZK_SYNC'
);

if (this.swapFormService.inputValue.fromToken.blockchain !== 'ZK_SYNC') {
return this.formType === 'from' ? [...allAvailableBlockchains] : [zkSyncBlockchain];
} else {
return this.formType === 'from' ? [zkSyncBlockchain] : [...allAvailableBlockchains];
}
}

public getBlockchainTag(blockchain: AvailableBlockchain): string {
return SelectorUtils.getBlockchainTag(blockchain);
}

public setBlockchainFilterAll(): void {
this.filterQueryService.filterQuery = BlockchainTags.ALL;
this.filterQueryService.setFilterQuery(BlockchainTags.ALL);
}

public isBlockchainDisabled(blockchain: AvailableBlockchain): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</ng-container>

<ng-container *ngIf="tag === blockchainTags.BDAY_PROMO">
<a class="badge-element badge-element_full birthday" target="_blank">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Специально в новой вкладке открываем

<a class="badge-element badge-element_full birthday">
<img src="assets/images/icons/bday_promo.svg" />
</a>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { BlockchainTags } from '../blockchains-filter-list/models/BlockchainFilt
import { blockchainsPromoLinks } from './constants/blockchains-promo-links';

@Component({
selector: 'app-blockchains-promo-badge',
templateUrl: './blockchains-promo-badge.component.html',
styleUrls: ['./blockchains-promo-badge.component.scss'],
selector: 'app-blockchain-badge',
templateUrl: './blockchain-badge.component.html',
styleUrls: ['./blockchain-badge.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class BlockchainsPromoBadgeComponent {
export class BlockchainBadgeComponent {
@Input({ required: true }) tag!: string;

@Input({ required: true }) blockchain: BlockchainName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ export class BlockchainsFilterListComponent {
) {}

public onSelectFilter(filter: BlockchainFilters): void {
this.filterQueryService.filterQuery = filter;
this.filterQueryService.setFilterQuery(filter);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
</div>
<ng-container *ngIf="isMobile && getBlockchainTag(blockchain) as tag">
<div class="list__badge-container">
<app-blockchains-promo-badge
<app-blockchain-badge
[tag]="tag"
[blockchain]="blockchain.name"
></app-blockchains-promo-badge>
></app-blockchain-badge>
</div>
</ng-container>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,14 @@ export const blockchainsList: RankedBlockchain[] = [
{
name: BLOCKCHAIN_NAME.LINEA,
rank: 0.5,
tags: ['ETH', BlockchainTags.POPULAR, BlockchainTags.EVM, BlockchainTags.LAYER_2]
tags: [
'ETH',
BlockchainTags.POPULAR,
BlockchainTags.EVM,
BlockchainTags.LAYER_2,
BlockchainTags.BDAY_PROMO,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В linea не будет bday

BlockchainTags.PROMO
]
},
{
name: BLOCKCHAIN_NAME.MODE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,13 @@ export class FilterQueryService {
this.modalService.openMobileBlockchainList(this.injector);
}
}

public setFilterQuery(filter: BlockchainFilters): void {
if (filter === this._filterQuery$.getValue() && filter !== BlockchainTags.ALL) {
this._filterQuery$.next(BlockchainTags.ALL);
} else {
this._filterQuery$.next(filter);
this.modalService.openMobileBlockchainList(this.injector);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ export class SelectorUtils {
tag === BlockchainTags.NEW ||
tag === BlockchainTags.BDAY_PROMO
)
.sort((a, b) => {
if (a === BlockchainTags.BDAY_PROMO || a === BlockchainTags.PROMO) return -1;
if (b === BlockchainTags.BDAY_PROMO || a === BlockchainTags.PROMO) return 1;
.sort((a, _b) => {
if (a === BlockchainTags.BDAY_PROMO) return -1;
return 0;
});

Expand Down
1 change: 1 addition & 0 deletions src/app/features/trade/constants/calculation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export const TAIKO_INTEGRATOR_ADDRESS_CROSS_CHAIN = '0xD5DE355ce5300e65E8Bb87584
export const MERLIN_INTEGRATOR_ADDRESS = '0xB7BbFEe9b6A6a4b1A44e5275D333FB4F58031C2f';
export const XLAYER_INTEGRATOR_ADDRESS_ON_CHAIN = '0x77dC28028A09DF50Cf037cfFdC002B7969530CCb';
export const XLAYER_INTEGRATOR_ADDRESS_CROSS_CHAIN = '0xD5DE355ce5300e65E8Bb87584F3bc12324E3F9dc';
export const LINEA_INTEGRATOR_ADDRESS_CCR = '0xD5DE355ce5300e65E8Bb87584F3bc12324E3F9dc';
export const RUBIC_BDAY_ADDRESS = '0x1e4Dc518B54BA89F1e18dF77f3E6ebAA7Eeb7E19';
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,9 @@ export function showXLayerPromoLabel(trade: OnChainTrade | CrossChainTrade): boo
(trade.from.blockchain as BlockchainName) === BLOCKCHAIN_NAME.XLAYER)
);
}

export function showLineaLabel(trade: OnChainTrade | CrossChainTrade): boolean {
return (
trade.to.blockchain === BLOCKCHAIN_NAME.LINEA || trade.from.blockchain === BLOCKCHAIN_NAME.LINEA
);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { BadgeInfo } from '@app/features/trade/models/trade-state';
import { BLOCKCHAIN_NAME, BlockchainName } from 'rubic-sdk';
import {
showLineaLabel,
showMerlinLabel,
showScrollMarksPromoLabel,
showTaikoPointsPromoLabel,
Expand Down Expand Up @@ -34,6 +35,14 @@ export const SPECIFIC_BADGES_FOR_CHAINS: Partial<Record<BlockchainName, BadgeInf
}
],
[BLOCKCHAIN_NAME.BLAST]: [],
[BLOCKCHAIN_NAME.LINEA]: [
{
fromSdk: false,
getLabel: () => 'PROMO',
getHint: () => '0 fees',
showLabel: showLineaLabel
}
],
[BLOCKCHAIN_NAME.MERLIN]: [
{
bgColor: PURPLE_COLOR,
Expand Down
17 changes: 17 additions & 0 deletions src/app/features/trade/utils/handle-integrator-address.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { BLOCKCHAIN_NAME, BlockchainName, CrossChainManagerCalculationOptions } from 'rubic-sdk';
import {
LINEA_INTEGRATOR_ADDRESS_CCR,
MERLIN_INTEGRATOR_ADDRESS,
RUBIC_BDAY_ADDRESS,
TAIKO_INTEGRATOR_ADDRESS_CROSS_CHAIN,
Expand All @@ -23,23 +24,35 @@ export function handleIntegratorAddress(
fromBlockchain === toBlockchain &&
fromBlockchain === BLOCKCHAIN_NAME.TAIKO &&
!onChainIntegrator;

const useTaikoIntegratorCcr =
(fromBlockchain === BLOCKCHAIN_NAME.TAIKO || toBlockchain === BLOCKCHAIN_NAME.TAIKO) &&
!crossChainIntegrator;

const useMerlinIntegrator =
(fromBlockchain === BLOCKCHAIN_NAME.MERLIN || toBlockchain === BLOCKCHAIN_NAME.MERLIN) &&
!crossChainIntegrator &&
!onChainIntegrator;

const useXLayerIntegratorOnChain =
fromBlockchain === toBlockchain &&
fromBlockchain === BLOCKCHAIN_NAME.XLAYER &&
!onChainIntegrator;

const useXLayerIntegratorCcr =
(fromBlockchain === BLOCKCHAIN_NAME.XLAYER || toBlockchain === BLOCKCHAIN_NAME.XLAYER) &&
!crossChainIntegrator;

const useRubicBdayIntegrator =
fromBlockchain === BLOCKCHAIN_NAME.SCROLL || toBlockchain === BLOCKCHAIN_NAME.SCROLL;

const useLineaIntegratorCcr = fromBlockchain === BLOCKCHAIN_NAME.LINEA && !crossChainIntegrator;

const useLineaIntegratorOnChain =
fromBlockchain === BLOCKCHAIN_NAME.LINEA &&
toBlockchain === fromBlockchain &&
!onChainIntegrator;

if (useTaikoIntegratorOnChain) {
options.providerAddress = TAIKO_INTEGRATOR_ADDRESS_ON_CHAIN;
} else if (useTaikoIntegratorCcr) {
Expand All @@ -52,5 +65,9 @@ export function handleIntegratorAddress(
options.providerAddress = XLAYER_INTEGRATOR_ADDRESS_CROSS_CHAIN;
} else if (useRubicBdayIntegrator) {
options.providerAddress = RUBIC_BDAY_ADDRESS;
} else if (useLineaIntegratorOnChain) {
options.providerAddress = RUBIC_BDAY_ADDRESS;
} else if (useLineaIntegratorCcr) {
options.providerAddress = LINEA_INTEGRATOR_ADDRESS_CCR;
}
}
Loading
Loading