Skip to content

Commit

Permalink
feat: add prelim support for silos
Browse files Browse the repository at this point in the history
  • Loading branch information
diegofigs committed Feb 12, 2024
1 parent 33c118a commit 3cc9b1e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/fuzzy-ladybugs-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@aurora-is-near/backstage-plugin-blockchainradar-backend': patch
---

feat: add prelim support for silos
14 changes: 14 additions & 0 deletions plugins/blockchainradar-backend/src/adapters/EvmAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import Web3 from 'web3';
import { getRootLogger } from '@backstage/backend-common';
import { Config } from '@backstage/config';
import { BlockchainAdapter } from './BlockchainAdapter';
import { ethers } from 'ethers';
import {
Expand All @@ -12,6 +14,18 @@ import {
import { StaticJsonRpcProvider } from '@ethersproject/providers';

export class EvmAdapter extends BlockchainAdapter {
constructor(
config: Config,
network: string,
networkType: string,
logger = getRootLogger(),
) {
super(config, network, networkType, logger);
this.networkType = this.networkType.includes('aurora-silo.near')
? 'mainnet'
: this.networkType;
}

isValidAddress(address: string): boolean {
return Web3.utils.isAddress(address);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ export class BlockchainAddress extends BlockchainHandler {
// long entity names need to be truncated to pass validation
entityName() {
let name = [this.network, this.networkType, this.address].join('-');
if (this.networkType.includes('aurora-silo.near')) {
name = [this.network, this.networkType.split('.')[0], this.address].join(
'-',
);
}
if (name.length > 63)
name = [
this.network,
Expand Down

0 comments on commit 3cc9b1e

Please sign in to comment.