Skip to content

Commit

Permalink
Merge pull request #252 from proximax-foundry/develop
Browse files Browse the repository at this point in the history
Release 1.6.0
  • Loading branch information
shinneng authored Jan 2, 2024
2 parents ba01038 + da47a07 commit 309a01e
Show file tree
Hide file tree
Showing 27 changed files with 4,589 additions and 3,995 deletions.
5,922 changes: 2,724 additions & 3,198 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "explorer-vite",
"version": "1.5.0",
"version": "1.6.0",
"private": true,
"scripts": {
"dev": "vite ",
Expand All @@ -22,7 +22,6 @@
"animate.css": "^4.1.1",
"cross-env": "^7.0.3",
"jdenticon": "^3.2.0",
"js-joda": "^1.11.0",
"luxon": "^3.2.1",
"mathjs": "^11.5.1",
"mitt": "^3.0.0",
Expand Down
59 changes: 45 additions & 14 deletions src/components/headerComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,61 @@
<div class="container mx-auto py-2">
<div class="md:flex md:justify-between">
<div class="flex items-center justify-center mb-3 md:mb-0">
<router-link :to="{ name: 'Home' }"><img src="@/assets/img/sirius-explorer-logo-whitetext.svg"
class="w-40 mr-7"></router-link>
<router-link :to="{ name: 'Home' }"
><img
src="@/assets/img/sirius-explorer-logo-whitetext.svg"
class="w-40 mr-7"
/></router-link>
</div>
<div class="mx-3 md:mx-0">
<div class="border border-gray-300 my-1 searchbar flex bg-white">
<selectFilter :selected="searchFilter" class="inline-block border-r border-gray-300"
@selected-filter="updateFilter" />
<input type="text" :placeholder="searchPlaceHolder" v-model="searchText"
class="text-tsm sm:w-48 lg:w-96 outline-none px-2 py-1 flex-grow" @keyup.enter="search" />
<div v-if="isSearching" class="flex justify-center items-center w-10">
<selectFilter
:selected="searchFilter"
class="inline-block border-r border-gray-300"
@selected-filter="updateFilter"
/>
<input
type="text"
:placeholder="searchPlaceHolder"
v-model="searchText"
class="text-tsm sm:w-48 lg:w-96 outline-none px-2 py-1 flex-grow"
@keyup.enter="search"
/>
<div
v-if="isSearching"
class="flex justify-center items-center w-10"
>
<div class="flex justify-center items-center border-gray-400">
<div class="animate-spin rounded-full h-5 w-5 border-b-2 border-navy-primary mr-2"></div>
<div
class="animate-spin rounded-full h-5 w-5 border-b-2 border-navy-primary mr-2"
></div>
</div>
</div>
<div v-else class="hover:bg-blue-100 cursor-pointer flex justify-center items-center w-10">
<img src="@/assets/img/icon-search.svg" class="w-4 inline-block search" @click="search" />
<div
v-else
class="hover:bg-blue-100 cursor-pointer flex justify-center items-center w-10"
>
<img
src="@/assets/img/icon-search.svg"
class="w-4 inline-block search"
@click="search"
/>
</div>
</div>
<div class="flex items-center justify-end">
<router-link :to="{ name: 'Home' }"><img src="@/assets/img/icon-home.svg"
class="h-5 w-5 mr-4" /></router-link>
<router-link :to="{ name: 'Home' }"
><img src="@/assets/img/icon-home.svg" class="h-5 w-5 mr-4"
/></router-link>
<div class="header-links">
<router-link :to="{ name: 'ViewBlockList' }">Blocks</router-link>
<router-link :to="{ name: 'ViewTransactionList' }">Transactions</router-link>
<router-link :to="{ name: 'ViewBlockList' }"
>Blocks</router-link
>
<router-link :to="{ name: 'ViewTransactionList' }"
>Transactions</router-link
>
<router-link :to="{ name: 'ViewHarvesterList' }"
>Harvesters</router-link
>
<!-- <a href="#">Accounts</a> -->
</div>
<selectNetwork class="ml-5" />
Expand Down
9 changes: 9 additions & 0 deletions src/models/REST/chainAPICall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import { NamespaceAPI } from "./namespace";
import { NetworkAPI } from "./network";
import { NodeAPI } from "./node";
import { TransactionAPI } from "./transaction";
import { StorageAPI } from "./storage";
import { LiquidityProviderAPI } from "./liquidityProvider";
import { HarvesterAPI } from "./harvester";

export class ChainAPICall {
endpoint: string;
Expand All @@ -25,6 +28,9 @@ export class ChainAPICall {
networkAPI: NetworkAPI;
nodeAPI: NodeAPI;
transactionAPI: TransactionAPI;
storageAPI: StorageAPI;
liquidityProviderAPI: LiquidityProviderAPI;
harvesterAPI: HarvesterAPI;

constructor(endpoint: string) {
this.endpoint = endpoint;
Expand All @@ -43,5 +49,8 @@ export class ChainAPICall {
this.diagnosticAPI = new DiagnosticAPI(endpoint);
this.nodeAPI = new NodeAPI(endpoint);
this.transactionAPI = new TransactionAPI(endpoint);
this.storageAPI = new StorageAPI(endpoint);
this.liquidityProviderAPI = new LiquidityProviderAPI(endpoint);
this.harvesterAPI = new HarvesterAPI(endpoint);
}
}
35 changes: 35 additions & 0 deletions src/models/REST/harvester.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { firstValueFrom } from "rxjs";
import {
PaginationQueryParams,
HarvesterHttp,
Address,
PublicAccount,
HarvesterInfo,
HarvesterSearch
} from "tsjs-xpx-chain-sdk";

export class HarvesterAPI {
harvesterHttp: HarvesterHttp;

constructor(endpoint: string) {
this.harvesterHttp = new HarvesterHttp(endpoint);
}

/**
* Get account harvesters info
* @param accountId - account Id.
*/
getAccountHarvestingHarvesterInfo(accountId: Address | PublicAccount): Promise<HarvesterInfo[]> {
return firstValueFrom(this.harvesterHttp.getAccountHarvestingHarvesterInfo(accountId));
}

/**
* Search harvesters
* @param qp - Pagination query params.
*/
searchHarvesters(qp: PaginationQueryParams): Promise<HarvesterSearch> {
return firstValueFrom(this.harvesterHttp
.searchHarvesters(qp));
}

}
33 changes: 33 additions & 0 deletions src/models/REST/liquidityProvider.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { firstValueFrom } from "rxjs";
import {
PaginationQueryParams,
LiquidityProviderSearch,
LiquidityProvider,
LiquidityProviderHttp,
} from "tsjs-xpx-chain-sdk";

export class LiquidityProviderAPI {
liquidityProviderHttp: LiquidityProviderHttp;

constructor(endpoint: string) {
this.liquidityProviderHttp = new LiquidityProviderHttp(endpoint);
}

/**
* Get Liquidity Provider info
* @param providerKey - provider key.
*/
getLiquidityProvider(providerKey: string): Promise<LiquidityProvider> {
return firstValueFrom(this.liquidityProviderHttp.getLiquidityProvider(providerKey));
}

/**
* Search liquidity provider
* @param qp - Drive query params.
*/
searchLiquidityProviders(): Promise<LiquidityProviderSearch> {
return firstValueFrom(this.liquidityProviderHttp
.searchLiquidityProviders());
}

}
75 changes: 75 additions & 0 deletions src/models/REST/storage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import { firstValueFrom } from "rxjs";
import {
StorageHttp,
DriveQueryParams,
ReplicatorQueryParams,
DownloadChannelQueryParams,
DriveInfo,
DownloadChannel,
Replicator,
DriveInfoSearch,
DownloadChannelSearch,
ReplicatorSearch,
} from "tsjs-xpx-chain-sdk";

export class StorageAPI {
storageHttp: StorageHttp;

constructor(endpoint: string) {
this.storageHttp = new StorageHttp(endpoint);
}

/**
* Get drive info
* @param accountId - account id.
*/
getBcDrive(accountId: string): Promise<DriveInfo | undefined> {
return firstValueFrom(this.storageHttp.getBcDrive(accountId));
}

/**
* Get download channel
* @param channelId - Channel id.
*/
getDownloadChannel(channelId: string): Promise<DownloadChannel | undefined> {
return firstValueFrom(this.storageHttp
.getDownloadChannel(channelId));
}

/**
* Get replicator from account
* @param accountId - Transaction id or hash.
*/
getReplicator(accountId: string): Promise<Replicator | undefined> {
return firstValueFrom(this.storageHttp
.getReplicator(accountId));
}

/**
* Search drives info
* @param qp - Drive query params.
*/
searchBcDrives(qp: DriveQueryParams): Promise<DriveInfoSearch> {
return firstValueFrom(this.storageHttp
.searchBcDrives(qp));
}

/**
* Search download channels info
* @param qp - download channels query params.
*/
searchDownloadChannels(qp: DownloadChannelQueryParams): Promise<DownloadChannelSearch> {
return firstValueFrom(this.storageHttp
.searchDownloadChannels(qp));
}

/**
* Search replicators
* @param qp - Replicators query params.
*/
searchReplicators(qp: ReplicatorQueryParams): Promise<ReplicatorSearch> {
return firstValueFrom(this.storageHttp
.searchReplicators(qp));
}

}
2 changes: 1 addition & 1 deletion src/models/transactions/inner/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class InnerMetadataTransaction extends InnerTransaction {
valueChange: string = "";
oldValue?: string = "";
newValue?: string = "";

value: string = "";
constructor() {
super();
}
Expand Down
2 changes: 1 addition & 1 deletion src/models/transactions/transactionFilterType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,5 @@ export enum TransactionFilterType {
RESTRICTION = "Restriction",
SECRET = "Secret",
CHAIN = "Chain",
'SDA EXCHANGE' = "SDA Exchange"
'SDA EXCHANGE' = "SDA Exchange",
}
19 changes: 19 additions & 0 deletions src/modules/account/components/AccountComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,21 @@
MULTISIG
</p>
</div>
<div
v-if="harvester"
class="px-2 py-1 flex mt-4 bg-teal-600 rounded-sm items-center"
>
<img
src="@/modules/account/img/icon-harvester.svg"
class="h-3 w-3 mr-1"
/>
<p
class="font-semibold text-white text-xxs pt-px cursor-default"
title="This account is a registered harvesters. It is eligible to get the transaction fees in the block that the node has successfully harvest."
>
HARVESTER
</p>
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -144,6 +159,10 @@ const props = defineProps({
type: Array<{ name: string }>,
required: true,
},
harvester: {
type: Boolean,
required: true,
}
});
const invalidPublicKey =
Expand Down
19 changes: 17 additions & 2 deletions src/modules/account/components/MetadataComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@
>
<div class="text-left py-3 col-span-2">
<div class="flex">
<div>{{ metadata.scopedMetadataKeyHex }}</div>
<router-link
:to="{
name: 'ViewMetadata',
params: { compositeHash: metadata.compositeHash },
}"
class="text-blue-600 hover:text-blue-primary uppercase hover:underline"
>{{ metadata.scopedMetadataKeyHex }}
</router-link>
<div
class="ml-3 text-gray-400 font-semibold"
v-if="metadata.scopedMetadataKeyUtf8"
Expand All @@ -44,7 +51,14 @@
>
<div class="px-2 py-3 col-span-4">
<div class="flex">
<div>{{ metadata.scopedMetadataKeyHex }}</div>
<router-link
:to="{
name: 'ViewMetadata',
params: { compositeHash: metadata.compositeHash },
}"
class="text-blue-600 hover:text-blue-primary uppercase hover:underline"
>{{ metadata.scopedMetadataKeyHex }}
</router-link>
<div
class="ml-3 text-gray-400 font-semibold"
v-if="metadata.scopedMetadataKeyUtf8"
Expand All @@ -69,6 +83,7 @@
defineProps({
accountMetadata: {
type: Array<{
compositeHash: string;
scopedMetadataKeyUtf8: string | null;
scopedMetadataKeyHex: string;
value: string;
Expand Down
Loading

0 comments on commit 309a01e

Please sign in to comment.