Skip to content

Commit

Permalink
Merge branch 'develop' into sc-platform/issue-3087-display-object-ext
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriyr committed Nov 7, 2024
2 parents afde423 + 543cdf8 commit 4860b6f
Show file tree
Hide file tree
Showing 178 changed files with 10,571 additions and 3,279 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/_rust_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,3 +243,6 @@ jobs:
cargo nextest run --no-fail-fast --test-threads 8 --package iota-graphql-e2e-tests --features pg_integration
cargo nextest run --no-fail-fast --test-threads 1 --package iota-cluster-test --test local_cluster_test --features pg_integration
cargo nextest run --no-fail-fast --test-threads 1 --package iota-indexer --test ingestion_tests --features pg_integration
# Iota-indexer's RPC tests, which depend on a shared runtime, are incompatible with nextest due to its process-per-test execution model.
# cargo test, on the other hand, allows tests to share state and resources by default.
cargo test --profile simulator --package iota-indexer --test rpc-tests --features shared_test_runtime
46 changes: 46 additions & 0 deletions .github/workflows/apps_wallet_prod_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build Wallet App (Prod)

on:
push:
tags:
- "wallet-v[0-9]+.[0-9]+.[0-9]+"

env:
DEFAULT_NETWORK: ${{ secrets.WALLET_PROD_DEFAULT_NETWORK }}
IOTA_NETWORKS: ${{ secrets.WALLET_PROD_IOTA_NETWORKS }}
APPS_BACKEND: ${{ secrets.WALLET_PROD_APPS_BACKEND }}

jobs:
wallet-prod-build:
permissions:
contents: read
runs-on: [self-hosted]
steps:
- name: Checking out the repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # pin@v3
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # [email protected]
- name: Install Nodejs
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # [email protected]
with:
node-version: "20"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@3cf273023a0dda27efcd3164bdfb51908dd46a5b # [email protected]
with:
path: apps/wallet
- name: Create artifact name
shell: bash
run: |
export artifact_name="iota-wallet-${{ steps.package-version.outputs.current-version }}"
echo "artifact_name=${artifact_name}" >> $GITHUB_ENV
- name: Build Wallet
run: pnpm wallet build
- name: Upload artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # pin@v4
with:
name: ${{ env.artifact_name }}
path: |
./apps/wallet/dist
14 changes: 3 additions & 11 deletions .github/workflows/links_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,16 @@ jobs:
'./**/*.md'
- name: Find the last report issue open
uses: micalevisk/last-issue-action@305829d9728f47beb0029417167a0af890edfd6e # pin@v2.1
id: last_issue
uses: micalevisk/last-issue-action@0d40124cc99ac8601c2516007f0c98ef3d27537b # pin@v2.3
id: last-issue
with:
state: open
labels: broken-links
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create or update report
uses: peter-evans/create-issue-from-file@e8ef132d6df98ed982188e460ebb3b5d4ef3a9cd # pin@v4
with:
title: Link checker report
content-filepath: ${{ env.LYCHEE_OUT }}
issue-number: ${{ steps.last_issue.outputs.issue_number }}
issue-number: ${{ steps.last-issue.outputs.issue-number }}
labels: broken-links

- name: Close last report open issue
if: steps.lychee.outputs.exit_code == 0
uses: peter-evans/close-issue@276d7966e389d888f011539a86c8920025ea0626 # pin@v3
with:
issue-number: ${{ steps.last_issue.outputs.issue_number }}
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions apps/core/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export * from './staking.constants';
export * from './recognizedPackages.constants';
export * from './coins.constants';
export * from './timelock.constants';
export * from './migration.constants';
export * from './features.enum';
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

export const STARDUST_PACKAGE_ID =
'000000000000000000000000000000000000000000000000000000000000107a';
export const STARDUST_BASIC_OUTPUT_TYPE = `${STARDUST_PACKAGE_ID}::basic_output::BasicOutput<0x2::iota::IOTA>`;
Expand Down
1 change: 1 addition & 0 deletions apps/core/src/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@ export * from './useUnlockTimelockedObjectsTransaction';
export * from './useGetAllOwnedObjects';
export * from './useGetTimelockedStakedObjects';
export * from './useGetActiveValidatorsInfo';
export * from './useCursorPagination';

export * from './stake';
56 changes: 56 additions & 0 deletions apps/core/src/hooks/useCursorPagination.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { useState } from 'react';
import { type InfiniteData, type UseInfiniteQueryResult } from '@tanstack/react-query';

interface PaginationProps {
hasFirst: boolean;
hasPrev: boolean;
hasNext: boolean;
onFirst(): void;
onPrev(): void;
onNext(): void;
}

interface CursorPaginationProps extends PaginationProps {
currentPage: number;
}

export interface PaginationResponse<Cursor = string> {
nextCursor: Cursor | null;
hasNextPage: boolean;
}

export function useCursorPagination<T>(query: UseInfiniteQueryResult<InfiniteData<T>>) {
const [currentPage, setCurrentPage] = useState(0);

return {
...query,
data: query.data?.pages[currentPage],
pagination: {
onFirst: () => setCurrentPage(0),
onNext: () => {
if (!query.data || query.isFetchingNextPage) {
return;
}

// Make sure we are at the end before fetching another page
if (currentPage >= query.data.pages.length - 1) {
query.fetchNextPage();
}

setCurrentPage(currentPage + 1);
},
onPrev: () => {
setCurrentPage(Math.max(currentPage - 1, 0));
},
hasFirst: currentPage !== 0,
hasNext:
!query.isFetchingNextPage &&
(currentPage < (query.data?.pages.length ?? 0) - 1 || !!query.hasNextPage),
hasPrev: currentPage !== 0,
currentPage,
} satisfies CursorPaginationProps,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

import { InfoBox, InfoBoxStyle, InfoBoxType, Select, SelectSize } from '@iota/apps-ui-kit';
import { useIotaClientQuery, useIotaClient, useIotaClientInfiniteQuery } from '@iota/dapp-kit';
import { useCursorPagination } from '@iota/core';
import { Warning } from '@iota/ui-icons';
import { useQuery } from '@tanstack/react-query';
import { useState } from 'react';
import { PlaceholderTable, TableCard, useCursorPagination } from '~/components/ui';
import { PlaceholderTable, TableCard } from '~/components/ui';
import { PAGE_SIZES_RANGE_20_60 } from '~/lib/constants';
import { generateEpochsTableColumns } from '~/lib/ui';
import { numberSuffix } from '~/lib/utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import { useIotaClient } from '@iota/dapp-kit';
import { useQuery } from '@tanstack/react-query';
import { useEffect, useRef, useState } from 'react';
import { PlaceholderTable, TableCard, useCursorPagination } from '~/components/ui';
import { PlaceholderTable, TableCard } from '~/components/ui';
import { useCursorPagination } from '@iota/core';
import {
DEFAULT_TRANSACTIONS_LIMIT,
useGetTransactionBlocks,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import { InfoBox, InfoBoxStyle, InfoBoxType, Select, SelectSize } from '@iota/ap
import { useIotaClientQuery } from '@iota/dapp-kit';
import { Warning } from '@iota/ui-icons';
import { useMemo, useState } from 'react';
import { PlaceholderTable, TableCard, useCursorPagination } from '~/components/ui';
import { PlaceholderTable, TableCard } from '~/components/ui';
import { DEFAULT_CHECKPOINTS_LIMIT, useGetCheckpoints } from '~/hooks/useGetCheckpoints';
import { PAGE_SIZES_RANGE_20_60 } from '~/lib/constants';
import { generateCheckpointsTableColumns } from '~/lib/ui';
import { numberSuffix } from '~/lib/utils';
import { useCursorPagination } from '@iota/core';

interface CheckpointsTableProps {
disablePagination?: boolean;
Expand Down
9 changes: 7 additions & 2 deletions apps/explorer/src/components/owned-objects/OwnedObjects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
// Modifications Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { useGetKioskContents, useGetOwnedObjects, useLocalStorage } from '@iota/core';
import {
useGetKioskContents,
useGetOwnedObjects,
useLocalStorage,
useCursorPagination,
} from '@iota/core';
import {
Button,
ButtonSize,
Expand All @@ -27,7 +32,7 @@ import clsx from 'clsx';
import { useEffect, useMemo, useState } from 'react';
import { ListView, SmallThumbnailsView, ThumbnailsView } from '~/components';
import { ObjectViewMode } from '~/lib/enums';
import { Pagination, useCursorPagination } from '~/components/ui';
import { Pagination } from '~/components/ui';
import { PAGE_SIZES_RANGE_10_50 } from '~/lib/constants';

const SHOW_PAGINATION_MAX_ITEMS = 9;
Expand Down
40 changes: 1 addition & 39 deletions apps/explorer/src/components/ui/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import { Button, ButtonSize, ButtonType } from '@iota/apps-ui-kit';
import { ArrowLeft, ArrowRight, DoubleArrowLeft } from '@iota/ui-icons';
import { type InfiniteData, type UseInfiniteQueryResult } from '@tanstack/react-query';
import { useState } from 'react';

interface PaginationProps {
Expand All @@ -16,49 +15,12 @@ interface PaginationProps {
onNext(): void;
}

interface CursorPaginationProps extends PaginationProps {
currentPage: number;
}

export interface PaginationResponse<Cursor = string> {
nextCursor: Cursor | null;
hasNextPage: boolean;
}

export function useCursorPagination<T>(query: UseInfiniteQueryResult<InfiniteData<T>>) {
const [currentPage, setCurrentPage] = useState(0);

return {
...query,
data: query.data?.pages[currentPage],
pagination: {
onFirst: () => setCurrentPage(0),
onNext: () => {
if (!query.data || query.isFetchingNextPage) {
return;
}

// Make sure we are at the end before fetching another page
if (currentPage >= query.data.pages.length - 1) {
query.fetchNextPage();
}

setCurrentPage(currentPage + 1);
},
onPrev: () => {
setCurrentPage(Math.max(currentPage - 1, 0));
},
hasFirst: currentPage !== 0,
hasNext:
!query.isFetchingNextPage &&
(currentPage < (query.data?.pages.length ?? 0) - 1 || !!query.hasNextPage),
hasPrev: currentPage !== 0,
currentPage,
} satisfies CursorPaginationProps,
};
}

/** @deprecated Prefer `useCursorPagination` + `useInfiniteQuery` for pagination. */
/** @deprecated Prefer `useCursorPagination` from core + `useInfiniteQuery` for pagination. */
export function usePaginationStack<Cursor = string>() {
const [stack, setStack] = useState<Cursor[]>([]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

import { DropdownPosition, Select, SelectSize } from '@iota/apps-ui-kit';
import { useState } from 'react';
import { PlaceholderTable, TableCard, useCursorPagination } from '~/components/ui';
import { PlaceholderTable, TableCard } from '~/components/ui';
import { useCursorPagination } from '@iota/core';
import {
DEFAULT_TRANSACTIONS_LIMIT,
useGetTransactionBlocks,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

export { VisualAssetCard } from './VisualAssetCard';
export * from './VisualAssetCard';
export * from './visual-asset-card.enums';
6 changes: 3 additions & 3 deletions apps/ui-kit/src/lib/components/molecules/card/card.classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export const IMAGE_VARIANT_CLASSES: { [key in ImageShape]: string } = {
};

export const IMAGE_BG_CLASSES: { [key in ImageType]: string } = {
[ImageType.Placeholder]: ``,
[ImageType.BgSolid]: `bg-neutral-96`,
[ImageType.BgTransparent]: ``,
[ImageType.Placeholder]: '',
[ImageType.BgSolid]: 'bg-neutral-96 dark:bg-neutral-10',
[ImageType.BgTransparent]: '',
};

export const CARD_TYPE_CLASSES: Record<CardType, string> = {
Expand Down
Loading

0 comments on commit 4860b6f

Please sign in to comment.