From e7d57aea71e555927c589cec10ade80662fc5cf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bego=C3=B1a=20Alvarez?= Date: Fri, 1 Mar 2024 16:06:45 +0100 Subject: [PATCH 1/8] chore: bump sdk hash --- .github/workflows/nova-build-temp.yaml | 2 +- setup_nova.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nova-build-temp.yaml b/.github/workflows/nova-build-temp.yaml index d604f5850..a01c312e5 100644 --- a/.github/workflows/nova-build-temp.yaml +++ b/.github/workflows/nova-build-temp.yaml @@ -6,7 +6,7 @@ on: TARGET_COMMIT: description: "Target Commit Hash for the SDK" required: false - default: "772a5665afb7663b5ddb2c1e4780d03401fc7aa2" + default: "37d52aae84960f087e0687d741e9e2e820ce2e7b" environment: type: choice description: "Select the environment to deploy to" diff --git a/setup_nova.sh b/setup_nova.sh index 65cbc7009..1341b483e 100755 --- a/setup_nova.sh +++ b/setup_nova.sh @@ -1,6 +1,6 @@ #!/bin/bash SDK_DIR="iota-sdk" -TARGET_COMMIT="772a5665afb7663b5ddb2c1e4780d03401fc7aa2" +TARGET_COMMIT="37d52aae84960f087e0687d741e9e2e820ce2e7b" if [ ! -d "$SDK_DIR" ]; then git clone -b 2.0 git@github.com:iotaledger/iota-sdk.git From 5c544f9f17c25e2e7a3b25955c2e7ceeb0320728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bego=C3=B1a=20Alvarez?= Date: Sun, 3 Mar 2024 18:56:07 +0100 Subject: [PATCH 2/8] chore: sync types to latest sdk --- api/src/initServices.ts | 2 +- .../api/nova/IAccountDetailsResponse.ts | 4 ++-- .../api/nova/IAddressDetailsResponse.ts | 4 ++-- .../models/api/nova/IAnchorDetailsResponse.ts | 4 ++-- .../models/api/nova/IBlockDetailsResponse.ts | 4 ++-- .../models/api/nova/INftDetailsResponse.ts | 4 ++-- api/src/models/api/nova/INodeInfoResponse.ts | 4 ++-- .../models/api/nova/IOutputDetailsResponse.ts | 4 ++-- api/src/models/api/nova/ISearchResponse.ts | 4 ++-- api/src/models/api/nova/feed/IFeedUpdate.ts | 4 ++-- .../api/nova/foundry/IFoundriesResponse.ts | 4 ++-- .../api/nova/foundry/IFoundryResponse.ts | 4 ++-- api/src/services/nova/feed/novaFeed.ts | 4 ++-- api/src/services/nova/nodeInfoService.ts | 12 +++++------ api/src/services/nova/novaApiService.ts | 10 +++++----- .../services/nova/stats/novaStatsService.ts | 4 ++-- api/src/utils/nova/associatedOutputsHelper.ts | 4 ++-- client/src/app/AppUtils.tsx | 3 ++- client/src/app/components/nova/OutputView.tsx | 4 ++-- .../section/native-tokens/AssetsTable.tsx | 11 ++++++++-- .../nova/address/section/nft/NftSection.tsx | 6 +++--- .../nova/block/BlockTangleState.tsx | 5 ++--- .../section/TransactionMetadataSection.tsx | 2 +- .../visualizer-threejs/VisualizerInstance.tsx | 4 ++-- .../nova/hooks/useAccountAddressState.ts | 6 +++--- .../nova/hooks/useAddressBasicOutputs.ts | 6 +++--- .../helpers/nova/hooks/useAddressHistory.ts | 6 +++--- .../nova/hooks/useAddressNftOutputs.ts | 6 +++--- .../nova/hooks/useAnchorAddressState.ts | 6 +++--- .../nova/hooks/useEd25519AddressState.ts | 6 +++--- .../helpers/nova/hooks/useFoundryDetails.ts | 6 +++--- .../useImplicitAccountCreationAddressState.ts | 6 +++--- .../helpers/nova/hooks/useNftAddressState.ts | 6 +++--- .../helpers/nova/hooks/useOutputDetails.ts | 6 +++--- .../helpers/nova/hooks/useOutputsDetails.ts | 5 +++-- client/src/helpers/nova/networkInfo.ts | 6 +++--- client/src/helpers/nova/novaTimeUtils.spec.ts | 13 ++++++------ client/src/helpers/nova/novaTimeUtils.ts | 20 +++++++++++-------- .../helpers/nova/transactionHistoryUtils.ts | 4 ++-- client/src/helpers/nova/transactionsHelper.ts | 1 + .../api/nova/IAccountDetailsResponse.ts | 4 ++-- .../models/api/nova/IAnchorDetailsResponse.ts | 4 ++-- client/src/models/api/nova/IInput.ts | 4 ++-- .../models/api/nova/INftDetailsResponse.ts | 4 ++-- .../src/models/api/nova/INodeInfoResponse.ts | 4 ++-- .../models/api/nova/IOutputDetailsResponse.ts | 4 ++-- client/src/models/api/nova/ISearchResponse.ts | 10 +++++----- .../nova/address/IAddressDetailsResponse.ts | 4 ++-- .../api/nova/block/IBlockDetailsResponse.ts | 4 ++-- .../models/api/nova/block/IBlockMetadata.ts | 4 ++-- .../src/models/api/nova/feed/IFeedUpdate.ts | 4 ++-- .../api/nova/foundry/IFoundriesResponse.ts | 4 ++-- .../api/nova/foundry/IFoundryResponse.ts | 4 ++-- client/src/services/nova/novaFeedClient.ts | 4 ++-- 54 files changed, 149 insertions(+), 137 deletions(-) diff --git a/api/src/initServices.ts b/api/src/initServices.ts index b16e3b8ec..63a983360 100644 --- a/api/src/initServices.ts +++ b/api/src/initServices.ts @@ -1,7 +1,7 @@ /* eslint-disable import/no-unresolved */ import { MqttClient as ChrysalisMqttClient } from "@iota/mqtt.js"; import { IClientOptions as IStardustClientOptions, Client as StardustClient } from "@iota/sdk"; -import { IClientOptions as INovaClientOptions, Client as NovaClient } from "@iota/sdk-nova"; +import { ClientOptions as INovaClientOptions, Client as NovaClient } from "@iota/sdk-nova"; import { ServiceFactory } from "./factories/serviceFactory"; import logger from "./logger"; import { IConfiguration } from "./models/configuration/IConfiguration"; diff --git a/api/src/models/api/nova/IAccountDetailsResponse.ts b/api/src/models/api/nova/IAccountDetailsResponse.ts index 665bbf30a..2c2fddd9f 100644 --- a/api/src/models/api/nova/IAccountDetailsResponse.ts +++ b/api/src/models/api/nova/IAccountDetailsResponse.ts @@ -1,11 +1,11 @@ /* eslint-disable import/no-unresolved */ /* eslint-disable @typescript-eslint/no-unsafe-argument */ -import { OutputResponse } from "@iota/sdk-nova"; +import { OutputWithMetadataResponse } from "@iota/sdk-nova"; import { IResponse } from "./IResponse"; export interface IAccountDetailsResponse extends IResponse { /** * The account details response. */ - accountOutputDetails?: OutputResponse; + accountOutputDetails?: OutputWithMetadataResponse; } diff --git a/api/src/models/api/nova/IAddressDetailsResponse.ts b/api/src/models/api/nova/IAddressDetailsResponse.ts index 56329c303..6b47774b5 100644 --- a/api/src/models/api/nova/IAddressDetailsResponse.ts +++ b/api/src/models/api/nova/IAddressDetailsResponse.ts @@ -1,11 +1,11 @@ /* eslint-disable import/no-unresolved */ /* eslint-disable @typescript-eslint/no-unsafe-argument */ -import { OutputResponse } from "@iota/sdk-nova"; +import { OutputWithMetadataResponse } from "@iota/sdk-nova"; import { IResponse } from "./IResponse"; export interface IAddressDetailsResponse extends IResponse { /** * The outputs data. */ - outputs?: OutputResponse[]; + outputs?: OutputWithMetadataResponse[]; } diff --git a/api/src/models/api/nova/IAnchorDetailsResponse.ts b/api/src/models/api/nova/IAnchorDetailsResponse.ts index db961a868..f13ce7410 100644 --- a/api/src/models/api/nova/IAnchorDetailsResponse.ts +++ b/api/src/models/api/nova/IAnchorDetailsResponse.ts @@ -1,11 +1,11 @@ /* eslint-disable import/no-unresolved */ /* eslint-disable @typescript-eslint/no-unsafe-argument */ -import { OutputResponse } from "@iota/sdk-nova"; +import { OutputWithMetadataResponse } from "@iota/sdk-nova"; import { IResponse } from "./IResponse"; export interface IAnchorDetailsResponse extends IResponse { /** * The anchor details response. */ - anchorOutputDetails?: OutputResponse; + anchorOutputDetails?: OutputWithMetadataResponse; } diff --git a/api/src/models/api/nova/IBlockDetailsResponse.ts b/api/src/models/api/nova/IBlockDetailsResponse.ts index 87521803f..e4c478ab4 100644 --- a/api/src/models/api/nova/IBlockDetailsResponse.ts +++ b/api/src/models/api/nova/IBlockDetailsResponse.ts @@ -1,10 +1,10 @@ /* eslint-disable import/no-unresolved */ -import { IBlockMetadata } from "@iota/sdk-nova"; +import { BlockMetadataResponse } from "@iota/sdk-nova"; import { IResponse } from "../IResponse"; export interface IBlockDetailsResponse extends IResponse { /** * Block metadata. */ - metadata?: IBlockMetadata; + metadata?: BlockMetadataResponse; } diff --git a/api/src/models/api/nova/INftDetailsResponse.ts b/api/src/models/api/nova/INftDetailsResponse.ts index 7ebf5ccf0..677a2ee50 100644 --- a/api/src/models/api/nova/INftDetailsResponse.ts +++ b/api/src/models/api/nova/INftDetailsResponse.ts @@ -1,11 +1,11 @@ /* eslint-disable import/no-unresolved */ /* eslint-disable @typescript-eslint/no-unsafe-argument */ -import { OutputResponse } from "@iota/sdk-nova"; +import { OutputWithMetadataResponse } from "@iota/sdk-nova"; import { IResponse } from "./IResponse"; export interface INftDetailsResponse extends IResponse { /** * The nft output details response. */ - nftOutputDetails?: OutputResponse; + nftOutputDetails?: OutputWithMetadataResponse; } diff --git a/api/src/models/api/nova/INodeInfoResponse.ts b/api/src/models/api/nova/INodeInfoResponse.ts index a7f1e6a4c..f19cf28ab 100644 --- a/api/src/models/api/nova/INodeInfoResponse.ts +++ b/api/src/models/api/nova/INodeInfoResponse.ts @@ -1,9 +1,9 @@ /* eslint-disable import/no-unresolved */ /* eslint-disable @typescript-eslint/no-redundant-type-constituents */ -import { INodeInfo } from "@iota/sdk-nova"; +import { InfoResponse } from "@iota/sdk-nova"; import { IResponse } from "../IResponse"; /** * The response with node info for a specific network. */ -export type INodeInfoResponse = INodeInfo & IResponse; +export type INodeInfoResponse = InfoResponse & IResponse; diff --git a/api/src/models/api/nova/IOutputDetailsResponse.ts b/api/src/models/api/nova/IOutputDetailsResponse.ts index e1b86671b..726f13f89 100644 --- a/api/src/models/api/nova/IOutputDetailsResponse.ts +++ b/api/src/models/api/nova/IOutputDetailsResponse.ts @@ -1,11 +1,11 @@ /* eslint-disable import/no-unresolved */ /* eslint-disable @typescript-eslint/no-redundant-type-constituents */ -import { OutputResponse } from "@iota/sdk-nova"; +import { OutputWithMetadataResponse } from "@iota/sdk-nova"; import { IResponse } from "./IResponse"; export interface IOutputDetailsResponse extends IResponse { /** * The output data. */ - output?: OutputResponse; + output?: OutputWithMetadataResponse; } diff --git a/api/src/models/api/nova/ISearchResponse.ts b/api/src/models/api/nova/ISearchResponse.ts index f9762dd30..9fbebfcd1 100644 --- a/api/src/models/api/nova/ISearchResponse.ts +++ b/api/src/models/api/nova/ISearchResponse.ts @@ -1,6 +1,6 @@ /* eslint-disable import/no-unresolved */ /* eslint-disable @typescript-eslint/no-unsafe-argument */ -import { Block, OutputResponse } from "@iota/sdk-nova"; +import { Block, OutputWithMetadataResponse } from "@iota/sdk-nova"; import { IAddressDetails } from "./IAddressDetails"; import { IResponse } from "../IResponse"; @@ -18,7 +18,7 @@ export interface ISearchResponse extends IResponse { /** * Output if it was found (block will also be populated). */ - output?: OutputResponse; + output?: OutputWithMetadataResponse; /** * Account id if it was found. diff --git a/api/src/models/api/nova/feed/IFeedUpdate.ts b/api/src/models/api/nova/feed/IFeedUpdate.ts index 384062fe9..41c313795 100644 --- a/api/src/models/api/nova/feed/IFeedUpdate.ts +++ b/api/src/models/api/nova/feed/IFeedUpdate.ts @@ -1,6 +1,6 @@ /* eslint-disable import/no-unresolved */ /* eslint-disable @typescript-eslint/no-redundant-type-constituents */ -import { Block, IBlockMetadata, SlotIndex } from "@iota/sdk-nova"; +import { Block, BlockMetadataResponse, SlotIndex } from "@iota/sdk-nova"; interface IFeedBlockUpdate { blockId: string; @@ -10,6 +10,6 @@ interface IFeedBlockUpdate { export interface IFeedUpdate { subscriptionId: string; blockUpdate?: IFeedBlockUpdate; - blockMetadataUpdate?: IBlockMetadata; + blockMetadataUpdate?: BlockMetadataResponse; slotFinalized?: SlotIndex; } diff --git a/api/src/models/api/nova/foundry/IFoundriesResponse.ts b/api/src/models/api/nova/foundry/IFoundriesResponse.ts index 4f6db863b..4fdd39c24 100644 --- a/api/src/models/api/nova/foundry/IFoundriesResponse.ts +++ b/api/src/models/api/nova/foundry/IFoundriesResponse.ts @@ -1,11 +1,11 @@ /* eslint-disable import/no-unresolved */ /* eslint-disable @typescript-eslint/no-unsafe-argument */ -import { IOutputsResponse } from "@iota/sdk-nova"; +import { OutputsResponse } from "@iota/sdk-nova"; import { IResponse } from "../IResponse"; export interface IFoundriesResponse extends IResponse { /** * The output ids response. */ - foundryOutputsResponse?: IOutputsResponse; + foundryOutputsResponse?: OutputsResponse; } diff --git a/api/src/models/api/nova/foundry/IFoundryResponse.ts b/api/src/models/api/nova/foundry/IFoundryResponse.ts index 9bd84790d..1dde7ba09 100644 --- a/api/src/models/api/nova/foundry/IFoundryResponse.ts +++ b/api/src/models/api/nova/foundry/IFoundryResponse.ts @@ -1,11 +1,11 @@ /* eslint-disable import/no-unresolved */ /* eslint-disable @typescript-eslint/no-unsafe-argument */ -import { OutputResponse } from "@iota/sdk-nova"; +import { OutputWithMetadataResponse } from "@iota/sdk-nova"; import { IResponse } from "../IResponse"; export interface IFoundryResponse extends IResponse { /** * The foundry details response. */ - foundryDetails?: OutputResponse; + foundryDetails?: OutputWithMetadataResponse; } diff --git a/api/src/services/nova/feed/novaFeed.ts b/api/src/services/nova/feed/novaFeed.ts index e7b7a8a44..139e5c29e 100644 --- a/api/src/services/nova/feed/novaFeed.ts +++ b/api/src/services/nova/feed/novaFeed.ts @@ -1,7 +1,7 @@ /* eslint-disable import/no-unresolved */ /* eslint-disable @typescript-eslint/no-unsafe-argument */ /* eslint-disable @typescript-eslint/no-unsafe-return */ -import { Block, Client, IBlockMetadata, SlotCommitment } from "@iota/sdk-nova"; +import { Block, Client, BlockMetadataResponse, SlotCommitment } from "@iota/sdk-nova"; import { ClassConstructor, plainToInstance } from "class-transformer"; import { ServiceFactory } from "../../../factories/serviceFactory"; import logger from "../../../logger"; @@ -117,7 +117,7 @@ export class NovaFeed { void this._mqttClient.listenMqtt(["block-metadata/accepted", "block-metadata/confirmed"], async (_, message) => { try { const deserializedMessage: { topic: string; payload: string } = JSON.parse(message); - const blockMetadataUpdate: IBlockMetadata = JSON.parse(deserializedMessage.payload); + const blockMetadataUpdate: BlockMetadataResponse = JSON.parse(deserializedMessage.payload); const update: Partial = { blockMetadataUpdate, diff --git a/api/src/services/nova/nodeInfoService.ts b/api/src/services/nova/nodeInfoService.ts index 4ae5d3b82..d6c7c7458 100644 --- a/api/src/services/nova/nodeInfoService.ts +++ b/api/src/services/nova/nodeInfoService.ts @@ -1,5 +1,5 @@ /* eslint-disable import/no-unresolved */ -import { Client, INodeInfo } from "@iota/sdk-nova"; +import { Client, InfoResponse } from "@iota/sdk-nova"; import { NodeInfoError } from "../../errors/nodeInfoError"; import { ServiceFactory } from "../../factories/serviceFactory"; import { INetwork } from "../../models/db/INetwork"; @@ -16,14 +16,14 @@ export class NodeInfoService { /** * The node and token info. */ - protected _nodeInfo: INodeInfo; + protected _nodeInfo: InfoResponse; /** * Create a new instance of NodeInfoService. * @param network The network config. * @param nodeInfo The fetched node info */ - private constructor(network: INetwork, nodeInfo: INodeInfo) { + private constructor(network: INetwork, nodeInfo: InfoResponse) { this._network = network; this._nodeInfo = nodeInfo; } @@ -32,14 +32,14 @@ export class NodeInfoService { const apiClient = ServiceFactory.get(`client-${network.network}`); try { - const response = await apiClient.getInfo(); - return new NodeInfoService(network, response.nodeInfo); + const response = await apiClient.getNodeInfo(); + return new NodeInfoService(network, response.info); } catch (err) { throw new NodeInfoError(`Failed to fetch node info for "${network.network}" with error:\n${err}`); } } - public getNodeInfo(): INodeInfo { + public getNodeInfo(): InfoResponse { return this._nodeInfo; } } diff --git a/api/src/services/nova/novaApiService.ts b/api/src/services/nova/novaApiService.ts index 4a3c31637..67876007b 100644 --- a/api/src/services/nova/novaApiService.ts +++ b/api/src/services/nova/novaApiService.ts @@ -1,7 +1,7 @@ /* eslint-disable import/no-unresolved */ /* eslint-disable @typescript-eslint/no-unsafe-argument */ /* eslint-disable @typescript-eslint/no-unsafe-return */ -import { Client, OutputResponse } from "@iota/sdk-nova"; +import { Client, OutputWithMetadataResponse } from "@iota/sdk-nova"; import { ServiceFactory } from "../../factories/serviceFactory"; import logger from "../../logger"; import { IFoundriesResponse } from "../../models/api/nova/foundry/IFoundriesResponse"; @@ -120,7 +120,7 @@ export class NovaApiService { */ public async outputDetails(outputId: string): Promise { try { - const outputResponse = await this.client.getOutput(outputId); + const outputResponse = await this.client.getOutputWithMetadata(outputId); return { output: outputResponse }; } catch (e) { logger.error(`Failed fetching output with output id ${outputId}. Cause: ${e}`); @@ -247,9 +247,9 @@ export class NovaApiService { * @param outputIds The output ids to get the details. * @returns The item details. */ - public async outputsDetails(outputIds: string[]): Promise { + public async outputsDetails(outputIds: string[]): Promise { const promises: Promise[] = []; - const outputResponses: OutputResponse[] = []; + const outputResponses: OutputWithMetadataResponse[] = []; for (const outputId of outputIds) { const promise = this.outputDetails(outputId); @@ -379,7 +379,7 @@ export class NovaApiService { */ public async getSlotCommitment(slotIndex: number): Promise { try { - const slot = await this.client.getCommitmentByIndex(slotIndex); + const slot = await this.client.getCommitmentBySlot(slotIndex); return { slot }; } catch (e) { diff --git a/api/src/services/nova/stats/novaStatsService.ts b/api/src/services/nova/stats/novaStatsService.ts index 88bef4c80..5d31c5ad8 100644 --- a/api/src/services/nova/stats/novaStatsService.ts +++ b/api/src/services/nova/stats/novaStatsService.ts @@ -14,10 +14,10 @@ export class NovaStatsService extends BaseStatsService { protected async updateStatistics(): Promise { try { const client = ServiceFactory.get(`client-${this._networkConfiguration.network}`); - const response = await client.getInfo(); + const response = await client.getNodeInfo(); if (response) { - const metrics = response.nodeInfo.metrics; + const metrics = response.info.metrics; this._statistics.push({ itemsPerSecond: Number(metrics.blocksPerSecond), confirmedItemsPerSecond: Number(metrics.confirmedBlocksPerSecond), diff --git a/api/src/utils/nova/associatedOutputsHelper.ts b/api/src/utils/nova/associatedOutputsHelper.ts index e87289895..405532ebf 100644 --- a/api/src/utils/nova/associatedOutputsHelper.ts +++ b/api/src/utils/nova/associatedOutputsHelper.ts @@ -4,7 +4,7 @@ /* eslint-disable @typescript-eslint/no-unsafe-return */ import { Client, - IOutputsResponse, + OutputsResponse, AddressType, BasicOutputQueryParameters, AccountOutputQueryParameters, @@ -260,7 +260,7 @@ export class AssociatedOutputsHelper { * @param association The association we are looking for. */ private async fetchAssociatedOutputIds( - fetch: (req: T) => Promise, + fetch: (req: T) => Promise, args: T, association: AssociationType, ): Promise { diff --git a/client/src/app/AppUtils.tsx b/client/src/app/AppUtils.tsx index cb6d9eb89..a0417264f 100644 --- a/client/src/app/AppUtils.tsx +++ b/client/src/app/AppUtils.tsx @@ -9,6 +9,7 @@ import { ServiceFactory } from "~/factories/serviceFactory"; import { NodeInfoService as NodeInfoServiceNova } from "~services/nova/nodeInfoService"; import { useNetworkInfoNova } from "~/helpers/nova/networkInfo"; import { NavigationRoute } from "./lib/interfaces"; +import { InfoResponse } from "@iota/sdk-wasm-nova/web"; export const networkContextWrapper = (currentNetwork: string | undefined, nodeInfo: IStardustNodeInfo | null, uiTheme: Theme | undefined) => function withNetworkContext(wrappedComponent: ReactNode) { @@ -152,7 +153,7 @@ export const getFaviconHelmet = (isShimmer: boolean) => { export const populateNetworkInfoNova = (networkName: string) => { const nodeService = ServiceFactory.get("node-info-nova"); if (nodeService) { - const nodeInfo = nodeService.get(networkName); + const nodeInfo: InfoResponse = nodeService.get(networkName); const protocolInfo = nodeInfo?.protocolParameters.reduce((params, cur) => { return params.startEpoch > cur.startEpoch ? params : cur; diff --git a/client/src/app/components/nova/OutputView.tsx b/client/src/app/components/nova/OutputView.tsx index ba50b8c58..3514a7ef0 100644 --- a/client/src/app/components/nova/OutputView.tsx +++ b/client/src/app/components/nova/OutputView.tsx @@ -172,8 +172,8 @@ const OutputView: React.FC = ({ outputId, output, showCopyAmoun
{Number((output as DelegationOutput).delegatedAmount)}
Delegation Id:
{(output as DelegationOutput).delegationId}
-
Validator Id:
-
{(output as DelegationOutput).validatorId}
+
Validator Address:
+
{Utils.addressToBech32((output as DelegationOutput).validatorAddress, bech32Hrp)}
Start epoch:
{(output as DelegationOutput).startEpoch}
End epoch:
diff --git a/client/src/app/components/nova/address/section/native-tokens/AssetsTable.tsx b/client/src/app/components/nova/address/section/native-tokens/AssetsTable.tsx index 011e35dcf..a76fb88b5 100644 --- a/client/src/app/components/nova/address/section/native-tokens/AssetsTable.tsx +++ b/client/src/app/components/nova/address/section/native-tokens/AssetsTable.tsx @@ -1,4 +1,11 @@ -import { OutputType, OutputResponse, CommonOutput, NativeToken, FeatureType, NativeTokenFeature } from "@iota/sdk-wasm-nova/web"; +import { + OutputType, + OutputWithMetadataResponse, + CommonOutput, + NativeToken, + FeatureType, + NativeTokenFeature, +} from "@iota/sdk-wasm-nova/web"; import React, { useEffect, useState } from "react"; import Asset from "./Asset"; import Pagination from "~/app/components/Pagination"; @@ -6,7 +13,7 @@ import { plainToInstance } from "class-transformer"; import "./AssetsTable.scss"; interface AssetsTableProps { - readonly outputs: OutputResponse[] | null; + readonly outputs: OutputWithMetadataResponse[] | null; readonly setTokensCount?: (count: number) => void; } diff --git a/client/src/app/components/nova/address/section/nft/NftSection.tsx b/client/src/app/components/nova/address/section/nft/NftSection.tsx index e640aa2c5..ec7907801 100644 --- a/client/src/app/components/nova/address/section/nft/NftSection.tsx +++ b/client/src/app/components/nova/address/section/nft/NftSection.tsx @@ -1,11 +1,11 @@ -import { NftOutput, OutputResponse } from "@iota/sdk-wasm-nova/web"; +import { NftOutput, OutputWithMetadataResponse } from "@iota/sdk-wasm-nova/web"; import React, { useEffect, useState } from "react"; import Nft from "./Nft"; import { useIsMounted } from "~helpers/hooks/useIsMounted"; import Pagination from "~/app/components/Pagination"; interface NftSectionProps { - readonly outputs: OutputResponse[] | null; + readonly outputs: OutputWithMetadataResponse[] | null; readonly setNftCount?: (count: number) => void; } @@ -13,7 +13,7 @@ const PAGE_SIZE = 10; const NftSection: React.FC = ({ outputs }) => { const isMounted = useIsMounted(); - const [page, setPage] = useState([]); + const [page, setPage] = useState([]); const [pageNumber, setPageNumber] = useState(1); // On page change handler diff --git a/client/src/app/components/nova/block/BlockTangleState.tsx b/client/src/app/components/nova/block/BlockTangleState.tsx index 1d8630c6c..739ecc185 100644 --- a/client/src/app/components/nova/block/BlockTangleState.tsx +++ b/client/src/app/components/nova/block/BlockTangleState.tsx @@ -1,7 +1,6 @@ -import React from "react"; +import { BLOCK_FAILURE_REASON_STRINGS, BlockFailureReason, BlockState, u64 } from "@iota/sdk-wasm-nova/web"; import moment from "moment"; -import { BlockState, u64 } from "@iota/sdk-wasm-nova/web"; -import { BLOCK_FAILURE_REASON_STRINGS, BlockFailureReason } from "@iota/sdk-wasm-nova/web/lib/types/models/block-failure-reason"; +import React from "react"; import StatusPill from "~/app/components/nova/StatusPill"; import { PillStatus } from "~/app/lib/ui/enums"; import "./BlockTangleState.scss"; diff --git a/client/src/app/components/nova/block/section/TransactionMetadataSection.tsx b/client/src/app/components/nova/block/section/TransactionMetadataSection.tsx index 9199f53aa..aefe75924 100644 --- a/client/src/app/components/nova/block/section/TransactionMetadataSection.tsx +++ b/client/src/app/components/nova/block/section/TransactionMetadataSection.tsx @@ -1,7 +1,7 @@ import { TRANSACTION_FAILURE_REASON_STRINGS, Transaction, - TransactionMetadata, + TransactionMetadataResponse as TransactionMetadata, TransactionState, Utils, AccountAddress, diff --git a/client/src/features/visualizer-threejs/VisualizerInstance.tsx b/client/src/features/visualizer-threejs/VisualizerInstance.tsx index b61688bee..dbd443fa0 100644 --- a/client/src/features/visualizer-threejs/VisualizerInstance.tsx +++ b/client/src/features/visualizer-threejs/VisualizerInstance.tsx @@ -17,7 +17,7 @@ import { Wrapper } from "./wrapper/Wrapper"; import { CanvasElement } from "./enums"; import { useGetThemeMode } from "~/helpers/hooks/useGetThemeMode"; import { TSelectFeedItemNova } from "~/app/types/visualizer.types"; -import { BasicBlockBody, Utils, type IBlockMetadata, type BlockState, type SlotIndex } from "@iota/sdk-wasm-nova/web"; +import { BasicBlockBody, Utils, type BlockMetadataResponse, type BlockState, type SlotIndex } from "@iota/sdk-wasm-nova/web"; import { IFeedBlockData } from "~/models/api/nova/feed/IFeedBlockData"; import CameraControls from "./CameraControls"; import useVisualizerTimer from "~/helpers/nova/hooks/useVisualizerTimer"; @@ -243,7 +243,7 @@ const VisualizerInstance: React.FC> = } }; - function onBlockMetadataUpdate(metadataUpdate: IBlockMetadata): void { + function onBlockMetadataUpdate(metadataUpdate: BlockMetadataResponse): void { if (metadataUpdate?.blockState) { const selectedColor = getBlockColorByState(themeMode, metadataUpdate.blockState); if (selectedColor) { diff --git a/client/src/helpers/nova/hooks/useAccountAddressState.ts b/client/src/helpers/nova/hooks/useAccountAddressState.ts index a865357df..80fa7dc10 100644 --- a/client/src/helpers/nova/hooks/useAccountAddressState.ts +++ b/client/src/helpers/nova/hooks/useAccountAddressState.ts @@ -5,7 +5,7 @@ import { BlockIssuerFeature, CongestionResponse, FeatureType, - OutputResponse, + OutputWithMetadataResponse, StakingFeature, ValidatorResponse, } from "@iota/sdk-wasm-nova/web"; @@ -30,8 +30,8 @@ export interface IAccountAddressState { blockIssuerFeature: BlockIssuerFeature | null; stakingFeature: StakingFeature | null; validatorDetails: ValidatorResponse | null; - addressBasicOutputs: OutputResponse[] | null; - addressNftOutputs: OutputResponse[] | null; + addressBasicOutputs: OutputWithMetadataResponse[] | null; + addressNftOutputs: OutputWithMetadataResponse[] | null; foundries: string[] | null; congestion: CongestionResponse | null; isAccountDetailsLoading: boolean; diff --git a/client/src/helpers/nova/hooks/useAddressBasicOutputs.ts b/client/src/helpers/nova/hooks/useAddressBasicOutputs.ts index a9e8fc920..f72f60d26 100644 --- a/client/src/helpers/nova/hooks/useAddressBasicOutputs.ts +++ b/client/src/helpers/nova/hooks/useAddressBasicOutputs.ts @@ -1,4 +1,4 @@ -import { OutputResponse } from "@iota/sdk-wasm-nova/web"; +import { OutputWithMetadataResponse } from "@iota/sdk-wasm-nova/web"; import { useEffect, useState } from "react"; import { useIsMounted } from "~helpers/hooks/useIsMounted"; import { ServiceFactory } from "~factories/serviceFactory"; @@ -11,10 +11,10 @@ import { NovaApiClient } from "~/services/nova/novaApiClient"; * @param addressBech32 The address in bech32 format * @returns The output responses and loading bool. */ -export function useAddressBasicOutputs(network: string, addressBech32: string | null): [OutputResponse[] | null, boolean] { +export function useAddressBasicOutputs(network: string, addressBech32: string | null): [OutputWithMetadataResponse[] | null, boolean] { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${NOVA}`)); - const [outputs, setOutputs] = useState(null); + const [outputs, setOutputs] = useState(null); const [isLoading, setIsLoading] = useState(true); useEffect(() => { diff --git a/client/src/helpers/nova/hooks/useAddressHistory.ts b/client/src/helpers/nova/hooks/useAddressHistory.ts index 8423de2d3..56a3194e4 100644 --- a/client/src/helpers/nova/hooks/useAddressHistory.ts +++ b/client/src/helpers/nova/hooks/useAddressHistory.ts @@ -5,7 +5,7 @@ import { ITransactionHistoryRequest } from "~models/api/nova/ITransactionHistory import { ITransactionHistoryItem, ITransactionHistoryResponse } from "~models/api/nova/ITransactionHistoryResponse"; import { NOVA } from "~/models/config/protocolVersion"; import { NovaApiClient } from "~services/nova/novaApiClient"; -import { OutputResponse } from "@iota/sdk-wasm-nova/web"; +import { OutputWithMetadataResponse } from "@iota/sdk-wasm-nova/web"; import { groupOutputsByTransactionId } from "../transactionHistoryUtils"; const OUTPUT_PAGE_SIZE = 10; @@ -20,7 +20,7 @@ interface IHistoryState { cursor: string | undefined; } -export type OutputWithDetails = ITransactionHistoryItem & { details: OutputResponse | null; amount?: string }; +export type OutputWithDetails = ITransactionHistoryItem & { details: OutputWithMetadataResponse | null; amount?: string }; /** * Fetch Address history @@ -71,7 +71,7 @@ export function useAddressHistory( }; }; - const requestOutputDetails = async (outputId: string): Promise => { + const requestOutputDetails = async (outputId: string): Promise => { if (!outputId) return null; try { diff --git a/client/src/helpers/nova/hooks/useAddressNftOutputs.ts b/client/src/helpers/nova/hooks/useAddressNftOutputs.ts index b9ee4cd0d..9a47846ff 100644 --- a/client/src/helpers/nova/hooks/useAddressNftOutputs.ts +++ b/client/src/helpers/nova/hooks/useAddressNftOutputs.ts @@ -1,4 +1,4 @@ -import { OutputResponse } from "@iota/sdk-wasm-nova/web"; +import { OutputWithMetadataResponse } from "@iota/sdk-wasm-nova/web"; import { useEffect, useState } from "react"; import { useIsMounted } from "~helpers/hooks/useIsMounted"; import { ServiceFactory } from "~factories/serviceFactory"; @@ -11,10 +11,10 @@ import { NovaApiClient } from "~/services/nova/novaApiClient"; * @param addressBech32 The address in bech32 format * @returns The output responses and loading bool. */ -export function useAddressNftOutputs(network: string, addressBech32: string | null): [OutputResponse[] | null, boolean] { +export function useAddressNftOutputs(network: string, addressBech32: string | null): [OutputWithMetadataResponse[] | null, boolean] { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${NOVA}`)); - const [outputs, setOutputs] = useState(null); + const [outputs, setOutputs] = useState(null); const [isLoading, setIsLoading] = useState(true); useEffect(() => { diff --git a/client/src/helpers/nova/hooks/useAnchorAddressState.ts b/client/src/helpers/nova/hooks/useAnchorAddressState.ts index 5fb62255e..1a5a247d2 100644 --- a/client/src/helpers/nova/hooks/useAnchorAddressState.ts +++ b/client/src/helpers/nova/hooks/useAnchorAddressState.ts @@ -1,5 +1,5 @@ import { Reducer, useEffect, useReducer } from "react"; -import { AnchorAddress, AnchorOutput, OutputResponse } from "@iota/sdk-wasm-nova/web"; +import { AnchorAddress, AnchorOutput, OutputWithMetadataResponse } from "@iota/sdk-wasm-nova/web"; import { IAddressDetails } from "~/models/api/nova/IAddressDetails"; import { useAnchorDetails } from "./useAnchorDetails"; import { useLocation, useParams } from "react-router-dom"; @@ -15,8 +15,8 @@ export interface IAnchorAddressState { anchorOutput: AnchorOutput | null; availableBalance: number | null; totalBalance: number | null; - addressBasicOutputs: OutputResponse[] | null; - addressNftOutputs: OutputResponse[] | null; + addressBasicOutputs: OutputWithMetadataResponse[] | null; + addressNftOutputs: OutputWithMetadataResponse[] | null; isBasicOutputsLoading: boolean; isNftOutputsLoading: boolean; isAnchorDetailsLoading: boolean; diff --git a/client/src/helpers/nova/hooks/useEd25519AddressState.ts b/client/src/helpers/nova/hooks/useEd25519AddressState.ts index 7c9d8fcc7..82c84d749 100644 --- a/client/src/helpers/nova/hooks/useEd25519AddressState.ts +++ b/client/src/helpers/nova/hooks/useEd25519AddressState.ts @@ -1,4 +1,4 @@ -import { Ed25519Address, OutputResponse } from "@iota/sdk-wasm-nova/web"; +import { Ed25519Address, OutputWithMetadataResponse } from "@iota/sdk-wasm-nova/web"; import { Reducer, useEffect, useReducer } from "react"; import { useLocation } from "react-router-dom"; import { useNetworkInfoNova } from "../networkInfo"; @@ -12,8 +12,8 @@ export interface IEd25519AddressState { addressDetails: IAddressDetails | null; totalBalance: number | null; availableBalance: number | null; - addressBasicOutputs: OutputResponse[] | null; - addressNftOutputs: OutputResponse[] | null; + addressBasicOutputs: OutputWithMetadataResponse[] | null; + addressNftOutputs: OutputWithMetadataResponse[] | null; isBasicOutputsLoading: boolean; isNftOutputsLoading: boolean; isAssociatedOutputsLoading: boolean; diff --git a/client/src/helpers/nova/hooks/useFoundryDetails.ts b/client/src/helpers/nova/hooks/useFoundryDetails.ts index 0e17bda35..a35be7152 100644 --- a/client/src/helpers/nova/hooks/useFoundryDetails.ts +++ b/client/src/helpers/nova/hooks/useFoundryDetails.ts @@ -1,4 +1,4 @@ -import { OutputResponse } from "@iota/sdk-wasm-nova/web"; +import { OutputWithMetadataResponse } from "@iota/sdk-wasm-nova/web"; import { useEffect, useState } from "react"; import { useIsMounted } from "~helpers/hooks/useIsMounted"; import { ServiceFactory } from "~factories/serviceFactory"; @@ -12,10 +12,10 @@ import { NovaApiClient } from "~/services/nova/novaApiClient"; * @param foundryId The foundry id * @returns The output response, loading bool and an error message. */ -export function useFoundryDetails(network: string, foundryId: string | null): [OutputResponse | null, boolean, string?] { +export function useFoundryDetails(network: string, foundryId: string | null): [OutputWithMetadataResponse | null, boolean, string?] { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${NOVA}`)); - const [foundryDetails, setFoundryDetails] = useState(null); + const [foundryDetails, setFoundryDetails] = useState(null); const [error, setError] = useState(); const [isLoading, setIsLoading] = useState(true); diff --git a/client/src/helpers/nova/hooks/useImplicitAccountCreationAddressState.ts b/client/src/helpers/nova/hooks/useImplicitAccountCreationAddressState.ts index e880441e5..b9eee2ca1 100644 --- a/client/src/helpers/nova/hooks/useImplicitAccountCreationAddressState.ts +++ b/client/src/helpers/nova/hooks/useImplicitAccountCreationAddressState.ts @@ -1,4 +1,4 @@ -import { ImplicitAccountCreationAddress, OutputResponse } from "@iota/sdk-wasm-nova/web"; +import { ImplicitAccountCreationAddress, OutputWithMetadataResponse } from "@iota/sdk-wasm-nova/web"; import { Reducer, useEffect, useReducer } from "react"; import { useLocation, useParams } from "react-router-dom"; import { AddressRouteProps } from "~/app/routes/AddressRouteProps"; @@ -13,8 +13,8 @@ export interface IImplicitAccountCreationAddressState { addressDetails: IAddressDetails | null; totalBalance: number | null; availableBalance: number | null; - addressBasicOutputs: OutputResponse[] | null; - addressNftOutputs: OutputResponse[] | null; + addressBasicOutputs: OutputWithMetadataResponse[] | null; + addressNftOutputs: OutputWithMetadataResponse[] | null; isBasicOutputsLoading: boolean; isNftOutputsLoading: boolean; isAssociatedOutputsLoading: boolean; diff --git a/client/src/helpers/nova/hooks/useNftAddressState.ts b/client/src/helpers/nova/hooks/useNftAddressState.ts index 2f09b59b8..c9f4b8974 100644 --- a/client/src/helpers/nova/hooks/useNftAddressState.ts +++ b/client/src/helpers/nova/hooks/useNftAddressState.ts @@ -1,5 +1,5 @@ import { Reducer, useEffect, useReducer } from "react"; -import { NftAddress, NftOutput, OutputResponse } from "@iota/sdk-wasm-nova/web"; +import { NftAddress, NftOutput, OutputWithMetadataResponse } from "@iota/sdk-wasm-nova/web"; import { IAddressDetails } from "~/models/api/nova/IAddressDetails"; import { useNftDetails } from "./useNftDetails"; import { useLocation, useParams } from "react-router-dom"; @@ -15,8 +15,8 @@ export interface INftAddressState { nftOutput: NftOutput | null; totalBalance: number | null; availableBalance: number | null; - addressBasicOutputs: OutputResponse[] | null; - addressNftOutputs: OutputResponse[] | null; + addressBasicOutputs: OutputWithMetadataResponse[] | null; + addressNftOutputs: OutputWithMetadataResponse[] | null; isBasicOutputsLoading: boolean; isNftOutputsLoading: boolean; isNftDetailsLoading: boolean; diff --git a/client/src/helpers/nova/hooks/useOutputDetails.ts b/client/src/helpers/nova/hooks/useOutputDetails.ts index d51aea704..9d6346b9d 100644 --- a/client/src/helpers/nova/hooks/useOutputDetails.ts +++ b/client/src/helpers/nova/hooks/useOutputDetails.ts @@ -1,4 +1,4 @@ -import { IOutputMetadataResponse, Output } from "@iota/sdk-wasm-nova/web"; +import { OutputMetadataResponse, Output } from "@iota/sdk-wasm-nova/web"; import { useEffect, useState } from "react"; import { ServiceFactory } from "~/factories/serviceFactory"; import { useIsMounted } from "~/helpers/hooks/useIsMounted"; @@ -17,14 +17,14 @@ export function useOutputDetails( outputId: string | null, ): { output: Output | null; - outputMetadataResponse: IOutputMetadataResponse | null; + outputMetadataResponse: OutputMetadataResponse | null; isLoading: boolean; error: string | null; } { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${NOVA}`)); const [output, setOutput] = useState(null); - const [metadata, setMetadata] = useState(null); + const [metadata, setMetadata] = useState(null); const [error, setError] = useState(null); const [isLoading, setIsLoading] = useState(true); diff --git a/client/src/helpers/nova/hooks/useOutputsDetails.ts b/client/src/helpers/nova/hooks/useOutputsDetails.ts index c9e2d4a4f..0416f32e9 100644 --- a/client/src/helpers/nova/hooks/useOutputsDetails.ts +++ b/client/src/helpers/nova/hooks/useOutputsDetails.ts @@ -1,4 +1,4 @@ -import { OutputResponse } from "@iota/sdk-wasm-nova/web"; +import { OutputWithMetadataResponse } from "@iota/sdk-wasm-nova/web"; import { useEffect, useState } from "react"; import { useIsMounted } from "~helpers/hooks/useIsMounted"; import { ServiceFactory } from "~factories/serviceFactory"; @@ -7,7 +7,7 @@ import { NovaApiClient } from "~services/nova/novaApiClient"; import { HexHelper } from "~helpers/stardust/hexHelper"; interface IOutputDetails { - outputDetails: OutputResponse; + outputDetails: OutputWithMetadataResponse; outputId: string; } @@ -42,6 +42,7 @@ export function useOutputsDetails(network: string, outputIds: string[] | null): const fetchedOutputDetails = { output: details.output, metadata: details.metadata, + outputIdProof: details.outputIdProof, }; const item: IOutputDetails = { outputDetails: fetchedOutputDetails, diff --git a/client/src/helpers/nova/networkInfo.ts b/client/src/helpers/nova/networkInfo.ts index f0cc5944f..78228100a 100644 --- a/client/src/helpers/nova/networkInfo.ts +++ b/client/src/helpers/nova/networkInfo.ts @@ -1,11 +1,11 @@ -import { INodeInfoBaseToken, ProtocolInfo } from "@iota/sdk-wasm-nova/web"; +import { BaseTokenResponse, ProtocolParametersResponse } from "@iota/sdk-wasm-nova/web"; import { create } from "zustand"; interface INetworkInfo { name: string; - tokenInfo: INodeInfoBaseToken; + tokenInfo: BaseTokenResponse; protocolVersion: number; - protocolInfo: ProtocolInfo | null; + protocolInfo: ProtocolParametersResponse | null; latestConfirmedSlot: number; bech32Hrp: string; } diff --git a/client/src/helpers/nova/novaTimeUtils.spec.ts b/client/src/helpers/nova/novaTimeUtils.spec.ts index 0b26f9585..ee4284adf 100644 --- a/client/src/helpers/nova/novaTimeUtils.spec.ts +++ b/client/src/helpers/nova/novaTimeUtils.spec.ts @@ -1,4 +1,4 @@ -import { ProtocolInfo } from "@iota/sdk-wasm-nova/web"; +import { ProtocolParametersResponse } from "@iota/sdk-wasm-nova/web"; import { unixTimestampToSlotIndexConverter, slotIndexToUnixTimeRangeConverter, @@ -9,22 +9,21 @@ import { getRegistrationSlotFromEpochIndex, } from "./novaTimeUtils"; -const mockProtocolInfo: ProtocolInfo = { - // @ts-expect-error Irrelevant fields omitted +const mockProtocolInfo: ProtocolParametersResponse = { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore parameters: { type: 0, version: 3, networkName: "test", bech32Hrp: "rms", - tokenSupply: 1813620509061365n, - + tokenSupply: "1813620509061365", // genesisSlot: 5, - genesisUnixTimestamp: 1707321857n, // 7 February 2024 16:04:17 + genesisUnixTimestamp: "1707321857", slotDurationInSeconds: 10, slotsPerEpochExponent: 13, // - stakingUnbondingPeriod: 10, validationBlocksPerSlot: 10, punishmentEpochs: 10, diff --git a/client/src/helpers/nova/novaTimeUtils.ts b/client/src/helpers/nova/novaTimeUtils.ts index a2c244105..d63699af1 100644 --- a/client/src/helpers/nova/novaTimeUtils.ts +++ b/client/src/helpers/nova/novaTimeUtils.ts @@ -1,4 +1,4 @@ -import { ProtocolInfo } from "@iota/sdk-wasm-nova/web"; +import { ProtocolParametersResponse } from "@iota/sdk-wasm-nova/web"; // Note: genesisUnixTimestamp is the first second that falls into genesisSlot + 1 @@ -8,7 +8,7 @@ import { ProtocolInfo } from "@iota/sdk-wasm-nova/web"; * @param unixTimestampSeconds The UNIX timestamp in seconds. * @returns The slot index. */ -export function unixTimestampToSlotIndexConverter(protocolInfo: ProtocolInfo): (unixTimestampSeconds: number) => number { +export function unixTimestampToSlotIndexConverter(protocolInfo: ProtocolParametersResponse): (unixTimestampSeconds: number) => number { return (unixTimestampSeconds: number) => { const genesisSlot = protocolInfo.parameters.genesisSlot; const genesisUnixTimestamp = protocolInfo.parameters.genesisUnixTimestamp; @@ -30,7 +30,9 @@ export function unixTimestampToSlotIndexConverter(protocolInfo: ProtocolInfo): ( * @param targetSlotIndex The target slot index. * @returns The UNIX time range in seconds: from (inclusive) and to (exclusive). */ -export function slotIndexToUnixTimeRangeConverter(protocolInfo: ProtocolInfo): (targetSlotIndex: number) => { from: number; to: number } { +export function slotIndexToUnixTimeRangeConverter( + protocolInfo: ProtocolParametersResponse, +): (targetSlotIndex: number) => { from: number; to: number } { return (targetSlotIndex: number) => { const genesisSlot = protocolInfo.parameters.genesisSlot; const genesisUnixTimestamp = Number(protocolInfo.parameters.genesisUnixTimestamp); @@ -60,7 +62,7 @@ export function slotIndexToUnixTimeRangeConverter(protocolInfo: ProtocolInfo): ( * @param targetSlotIndex The target slot index. * @returns The epoch index. */ -export function slotIndexToEpochIndexConverter(protocolInfo: ProtocolInfo): (targetSlotIndex: number) => number { +export function slotIndexToEpochIndexConverter(protocolInfo: ProtocolParametersResponse): (targetSlotIndex: number) => number { return (targetSlotIndex: number) => { const genesisSlot = protocolInfo.parameters.genesisSlot; const slotsPerEpochExponent = protocolInfo.parameters.slotsPerEpochExponent; @@ -79,7 +81,7 @@ export function slotIndexToEpochIndexConverter(protocolInfo: ProtocolInfo): (tar * @param unixTimestampSeconds The UNIX timestamp in seconds. * @returns The epoch index. */ -export function unixTimestampToEpochIndexConverter(protocolInfo: ProtocolInfo): (unixTimestampSeconds: number) => number { +export function unixTimestampToEpochIndexConverter(protocolInfo: ProtocolParametersResponse): (unixTimestampSeconds: number) => number { return (unixTimestampSeconds: number) => { const unixTimestampToSlotIndex = unixTimestampToSlotIndexConverter(protocolInfo); const slotIndexToEpochIndex = slotIndexToEpochIndexConverter(protocolInfo); @@ -97,7 +99,7 @@ export function unixTimestampToEpochIndexConverter(protocolInfo: ProtocolInfo): * @returns The slot index range in seconds: from (inclusive) and to (exclusive). */ export function epochIndexToSlotIndexRangeConverter( - protocolInfo: ProtocolInfo, + protocolInfo: ProtocolParametersResponse, ): (targetEpochIndex: number) => { from: number; to: number } { return (targetEpochIndex: number) => { const slotsPerEpochExponent = protocolInfo.parameters.slotsPerEpochExponent; @@ -116,7 +118,9 @@ export function epochIndexToSlotIndexRangeConverter( * @param targetEpochIndex The target epoch index. * @returns The UNIX time range in seconds: from (inclusive) and to (exclusive). */ -export function epochIndexToUnixTimeRangeConverter(protocolInfo: ProtocolInfo): (targetEpochIndex: number) => { from: number; to: number } { +export function epochIndexToUnixTimeRangeConverter( + protocolInfo: ProtocolParametersResponse, +): (targetEpochIndex: number) => { from: number; to: number } { return (targetEpochIndex: number) => { const epochIndexToSlotIndexRange = epochIndexToSlotIndexRangeConverter(protocolInfo); const slotIndexToUnixTimeRange = slotIndexToUnixTimeRangeConverter(protocolInfo); @@ -136,7 +140,7 @@ export function epochIndexToUnixTimeRangeConverter(protocolInfo: ProtocolInfo): * @param targetEpochIndex The target epoch index. * @returns The registration slot index. */ -export function getRegistrationSlotFromEpochIndex(protocolInfo: ProtocolInfo): (targetEpochIndex: number) => number { +export function getRegistrationSlotFromEpochIndex(protocolInfo: ProtocolParametersResponse): (targetEpochIndex: number) => number { return (targetEpochIndex: number) => { const epochNearingThreshold = protocolInfo.parameters.epochNearingThreshold; const epochIndexToSlotIndexRange = epochIndexToSlotIndexRangeConverter(protocolInfo); diff --git a/client/src/helpers/nova/transactionHistoryUtils.ts b/client/src/helpers/nova/transactionHistoryUtils.ts index b36f79249..146d34ffb 100644 --- a/client/src/helpers/nova/transactionHistoryUtils.ts +++ b/client/src/helpers/nova/transactionHistoryUtils.ts @@ -1,4 +1,4 @@ -import { CommonOutput, INodeInfoBaseToken } from "@iota/sdk-wasm-nova/web"; +import { CommonOutput, BaseTokenResponse } from "@iota/sdk-wasm-nova/web"; import moment from "moment/moment"; import { DateHelper } from "~helpers/dateHelper"; @@ -48,7 +48,7 @@ export const groupOutputsByTransactionId = (outputsWithDetails: OutputWithDetail export const getTransactionHistoryRecords = ( transactionIdToOutputs: Map, network: string, - tokenInfo: INodeInfoBaseToken, + tokenInfo: BaseTokenResponse, isFormattedAmounts: boolean, slotIndexToUnixTimeRange: (slotIndex: number) => { from: number; to: number }, ): ITransactionHistoryRecord[] => { diff --git a/client/src/helpers/nova/transactionsHelper.ts b/client/src/helpers/nova/transactionsHelper.ts index 8ba2261ca..3fab492d0 100644 --- a/client/src/helpers/nova/transactionsHelper.ts +++ b/client/src/helpers/nova/transactionsHelper.ts @@ -123,6 +123,7 @@ export class TransactionsHelper { outputDetails = { output: details.output, metadata: details.metadata, + outputIdProof: details.outputIdProof, }; amount = Number(details.output.amount); } diff --git a/client/src/models/api/nova/IAccountDetailsResponse.ts b/client/src/models/api/nova/IAccountDetailsResponse.ts index 22722dddc..b33a39549 100644 --- a/client/src/models/api/nova/IAccountDetailsResponse.ts +++ b/client/src/models/api/nova/IAccountDetailsResponse.ts @@ -1,9 +1,9 @@ -import { OutputResponse } from "@iota/sdk-wasm-nova/web"; +import { OutputWithMetadataResponse } from "@iota/sdk-wasm-nova/web"; import { IResponse } from "./IResponse"; export interface IAccountDetailsResponse extends IResponse { /** * The account details response. */ - accountOutputDetails?: OutputResponse; + accountOutputDetails?: OutputWithMetadataResponse; } diff --git a/client/src/models/api/nova/IAnchorDetailsResponse.ts b/client/src/models/api/nova/IAnchorDetailsResponse.ts index 436f607af..6d2d712b2 100644 --- a/client/src/models/api/nova/IAnchorDetailsResponse.ts +++ b/client/src/models/api/nova/IAnchorDetailsResponse.ts @@ -1,9 +1,9 @@ -import { OutputResponse } from "@iota/sdk-wasm-nova/web"; +import { OutputWithMetadataResponse } from "@iota/sdk-wasm-nova/web"; import { IResponse } from "../IResponse"; export interface IAnchorDetailsResponse extends IResponse { /** * The anchor details response. */ - anchorOutputDetails?: OutputResponse; + anchorOutputDetails?: OutputWithMetadataResponse; } diff --git a/client/src/models/api/nova/IInput.ts b/client/src/models/api/nova/IInput.ts index c2ab16ce0..8802079a0 100644 --- a/client/src/models/api/nova/IInput.ts +++ b/client/src/models/api/nova/IInput.ts @@ -1,4 +1,4 @@ -import { HexEncodedString, OutputResponse } from "@iota/sdk-wasm-nova/web"; +import { HexEncodedString, OutputWithMetadataResponse } from "@iota/sdk-wasm-nova/web"; import { IAddressDetails } from "./IAddressDetails"; export interface IInput { @@ -17,7 +17,7 @@ export interface IInput { /** * The output used as input. */ - output?: OutputResponse; + output?: OutputWithMetadataResponse; /** * The transaction address details. */ diff --git a/client/src/models/api/nova/INftDetailsResponse.ts b/client/src/models/api/nova/INftDetailsResponse.ts index 5ac2cfd11..5d91b9f11 100644 --- a/client/src/models/api/nova/INftDetailsResponse.ts +++ b/client/src/models/api/nova/INftDetailsResponse.ts @@ -1,9 +1,9 @@ -import { OutputResponse } from "@iota/sdk-wasm-nova/web"; +import { OutputWithMetadataResponse } from "@iota/sdk-wasm-nova/web"; import { IResponse } from "./IResponse"; export interface INftDetailsResponse extends IResponse { /** * The nft output details response. */ - nftOutputDetails?: OutputResponse; + nftOutputDetails?: OutputWithMetadataResponse; } diff --git a/client/src/models/api/nova/INodeInfoResponse.ts b/client/src/models/api/nova/INodeInfoResponse.ts index 1ad4a114c..0c622706a 100644 --- a/client/src/models/api/nova/INodeInfoResponse.ts +++ b/client/src/models/api/nova/INodeInfoResponse.ts @@ -1,7 +1,7 @@ -import { INodeInfo } from "@iota/sdk-wasm-nova/web"; +import { InfoResponse } from "@iota/sdk-wasm-nova/web"; import { IResponse } from "../IResponse"; /** * The response with node info for a specific network. */ -export type INodeInfoResponse = INodeInfo & IResponse; +export type INodeInfoResponse = InfoResponse & IResponse; diff --git a/client/src/models/api/nova/IOutputDetailsResponse.ts b/client/src/models/api/nova/IOutputDetailsResponse.ts index 5b749c3e1..ff0dcaffe 100644 --- a/client/src/models/api/nova/IOutputDetailsResponse.ts +++ b/client/src/models/api/nova/IOutputDetailsResponse.ts @@ -1,9 +1,9 @@ -import { OutputResponse } from "@iota/sdk-wasm-nova/web"; +import { OutputWithMetadataResponse } from "@iota/sdk-wasm-nova/web"; import { IResponse } from "./IResponse"; export interface IOutputDetailsResponse extends IResponse { /** * The output data. */ - output?: OutputResponse; + output?: OutputWithMetadataResponse; } diff --git a/client/src/models/api/nova/ISearchResponse.ts b/client/src/models/api/nova/ISearchResponse.ts index 220d64bf9..f860e6620 100644 --- a/client/src/models/api/nova/ISearchResponse.ts +++ b/client/src/models/api/nova/ISearchResponse.ts @@ -1,4 +1,4 @@ -import { Block, OutputResponse } from "@iota/sdk-wasm-nova/web"; +import { Block, OutputWithMetadataResponse } from "@iota/sdk-wasm-nova/web"; import { IResponse } from "./IResponse"; import { IAddressDetails } from "./IAddressDetails"; @@ -11,7 +11,7 @@ export interface ISearchResponse extends IResponse { /** * Output if it was found (block will also be populated). */ - output?: OutputResponse; + output?: OutputWithMetadataResponse; /** * Address details. @@ -31,7 +31,7 @@ export interface ISearchResponse extends IResponse { /** * Account details. */ - accountDetails?: OutputResponse; + accountDetails?: OutputWithMetadataResponse; /** * Anchor id if it was found. @@ -46,7 +46,7 @@ export interface ISearchResponse extends IResponse { /** * Foundry details. */ - foundryDetails?: OutputResponse; + foundryDetails?: OutputWithMetadataResponse; /** * Nft id if it was found. @@ -56,7 +56,7 @@ export interface ISearchResponse extends IResponse { /** * Nft details. */ - nftDetails?: OutputResponse; + nftDetails?: OutputWithMetadataResponse; /** * Transaction included block. diff --git a/client/src/models/api/nova/address/IAddressDetailsResponse.ts b/client/src/models/api/nova/address/IAddressDetailsResponse.ts index 5a075e38f..c3043cee1 100644 --- a/client/src/models/api/nova/address/IAddressDetailsResponse.ts +++ b/client/src/models/api/nova/address/IAddressDetailsResponse.ts @@ -1,9 +1,9 @@ -import { OutputResponse } from "@iota/sdk-wasm-nova/web"; +import { OutputWithMetadataResponse } from "@iota/sdk-wasm-nova/web"; import { IResponse } from "../IResponse"; export interface IAddressDetailsResponse extends IResponse { /** * The outputs data. */ - outputs?: OutputResponse[]; + outputs?: OutputWithMetadataResponse[]; } diff --git a/client/src/models/api/nova/block/IBlockDetailsResponse.ts b/client/src/models/api/nova/block/IBlockDetailsResponse.ts index cbf47c622..b9e08ec32 100644 --- a/client/src/models/api/nova/block/IBlockDetailsResponse.ts +++ b/client/src/models/api/nova/block/IBlockDetailsResponse.ts @@ -1,9 +1,9 @@ -import { IBlockMetadata } from "@iota/sdk-wasm-nova/web"; +import { BlockMetadataResponse } from "@iota/sdk-wasm-nova/web"; import { IResponse } from "../IResponse"; export interface IBlockDetailsResponse extends IResponse { /** * Block metadata. */ - metadata?: IBlockMetadata; + metadata?: BlockMetadataResponse; } diff --git a/client/src/models/api/nova/block/IBlockMetadata.ts b/client/src/models/api/nova/block/IBlockMetadata.ts index 54c035144..ec00bbf64 100644 --- a/client/src/models/api/nova/block/IBlockMetadata.ts +++ b/client/src/models/api/nova/block/IBlockMetadata.ts @@ -1,10 +1,10 @@ -import { IBlockMetadata as BlockMetadata } from "@iota/sdk-wasm-nova/web"; +import { BlockMetadataResponse } from "@iota/sdk-wasm-nova/web"; export interface IBlockMetadata { /** * Metadata. */ - metadata?: BlockMetadata; + metadata?: BlockMetadataResponse; /** * The metadata failed. diff --git a/client/src/models/api/nova/feed/IFeedUpdate.ts b/client/src/models/api/nova/feed/IFeedUpdate.ts index e66b46181..0051ecdf5 100644 --- a/client/src/models/api/nova/feed/IFeedUpdate.ts +++ b/client/src/models/api/nova/feed/IFeedUpdate.ts @@ -1,4 +1,4 @@ -import { Block, IBlockMetadata, SlotIndex } from "@iota/sdk-wasm-nova/web"; +import { Block, BlockMetadataResponse, SlotIndex } from "@iota/sdk-wasm-nova/web"; interface IFeedBlockUpdate { blockId: string; @@ -8,6 +8,6 @@ interface IFeedBlockUpdate { export interface IFeedUpdate { subscriptionId: string; blockUpdate?: IFeedBlockUpdate; - blockMetadataUpdate?: IBlockMetadata; + blockMetadataUpdate?: BlockMetadataResponse; slotFinalized?: SlotIndex; } diff --git a/client/src/models/api/nova/foundry/IFoundriesResponse.ts b/client/src/models/api/nova/foundry/IFoundriesResponse.ts index 00e860042..a865f70a3 100644 --- a/client/src/models/api/nova/foundry/IFoundriesResponse.ts +++ b/client/src/models/api/nova/foundry/IFoundriesResponse.ts @@ -1,9 +1,9 @@ -import { IOutputsResponse } from "@iota/sdk-wasm-nova/web"; +import { OutputsResponse } from "@iota/sdk-wasm-nova/web"; import { IResponse } from "../IResponse"; export interface IFoundriesResponse extends IResponse { /** * The output ids response. */ - foundryOutputsResponse?: IOutputsResponse; + foundryOutputsResponse?: OutputsResponse; } diff --git a/client/src/models/api/nova/foundry/IFoundryResponse.ts b/client/src/models/api/nova/foundry/IFoundryResponse.ts index 6fed01eca..27e9dcbf6 100644 --- a/client/src/models/api/nova/foundry/IFoundryResponse.ts +++ b/client/src/models/api/nova/foundry/IFoundryResponse.ts @@ -1,9 +1,9 @@ -import { OutputResponse } from "@iota/sdk-wasm-nova/web"; +import { OutputWithMetadataResponse } from "@iota/sdk-wasm-nova/web"; import { IResponse } from "../IResponse"; export interface IFoundryResponse extends IResponse { /** * The foundry details response. */ - foundryDetails?: OutputResponse; + foundryDetails?: OutputWithMetadataResponse; } diff --git a/client/src/services/nova/novaFeedClient.ts b/client/src/services/nova/novaFeedClient.ts index fb6781487..41d3d8317 100644 --- a/client/src/services/nova/novaFeedClient.ts +++ b/client/src/services/nova/novaFeedClient.ts @@ -1,4 +1,4 @@ -import { IBlockMetadata, SlotIndex } from "@iota/sdk-wasm-nova/web"; +import { BlockMetadataResponse, SlotIndex } from "@iota/sdk-wasm-nova/web"; import { io, Socket } from "socket.io-client"; import { ServiceFactory } from "~/factories/serviceFactory"; import { IFeedSubscribeResponse } from "~/models/api/IFeedSubscribeResponse"; @@ -53,7 +53,7 @@ export class NovaFeedClient { */ public subscribeBlocks( onBlockDataCallback?: (blockData: IFeedBlockData) => void, - onMetadataUpdatedCallback?: (blockMetadata: IBlockMetadata) => void, + onMetadataUpdatedCallback?: (blockMetadata: BlockMetadataResponse) => void, onSlotFinalizedCallback?: (slotFinalized: SlotIndex) => void, ) { this.socket = io(this.endpoint, { upgrade: true, transports: ["websocket"] }); From 4cf4f6601b42a16012ea8a321fa7804068338df2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bego=C3=B1a=20Alvarez?= Date: Mon, 4 Mar 2024 13:47:07 +0100 Subject: [PATCH 3/8] tmp: temporary forked sdk to fix missing stuff --- setup_nova.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup_nova.sh b/setup_nova.sh index 1341b483e..726355b1f 100755 --- a/setup_nova.sh +++ b/setup_nova.sh @@ -1,9 +1,9 @@ #!/bin/bash SDK_DIR="iota-sdk" -TARGET_COMMIT="37d52aae84960f087e0687d741e9e2e820ce2e7b" +TARGET_COMMIT="e04e40bb1e4362a50adc4cfb1a12aa2413b663d4" if [ ! -d "$SDK_DIR" ]; then - git clone -b 2.0 git@github.com:iotaledger/iota-sdk.git + git clone -b 2.0 git@github.com:boxfish-studio/iota-sdk.git cd "./$SDK_DIR" else echo "Pulling nova-sdk..." From ee347b4fff281011bd175409afbd0aabb0b72257 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bego=C3=B1a=20Alvarez?= Date: Mon, 4 Mar 2024 14:10:42 +0100 Subject: [PATCH 4/8] tmp: temporary forked sdk to fix missing stuff --- setup_nova.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup_nova.sh b/setup_nova.sh index 726355b1f..e24f51cac 100755 --- a/setup_nova.sh +++ b/setup_nova.sh @@ -1,6 +1,6 @@ #!/bin/bash SDK_DIR="iota-sdk" -TARGET_COMMIT="e04e40bb1e4362a50adc4cfb1a12aa2413b663d4" +TARGET_COMMIT="5e1bd797f85b47f3a9afa0462d78edd90d8e2bfd" if [ ! -d "$SDK_DIR" ]; then git clone -b 2.0 git@github.com:boxfish-studio/iota-sdk.git From 8a4d208614ccfccb80b4a48c62518f17ff71c5ba Mon Sep 17 00:00:00 2001 From: Mario Sarcevic Date: Mon, 4 Mar 2024 14:39:35 +0100 Subject: [PATCH 5/8] fix: Fix import names for BaseTokenInfo and OutputMetadata in some files --- client/src/app/components/nova/address/AddressBalance.tsx | 4 ++-- client/src/helpers/nova/hooks/useAccountDetails.ts | 6 +++--- client/src/helpers/nova/hooks/useAddressBalance.ts | 4 ++-- client/src/helpers/nova/hooks/useAnchorDetails.ts | 6 +++--- client/src/helpers/nova/hooks/useNftDetails.ts | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/client/src/app/components/nova/address/AddressBalance.tsx b/client/src/app/components/nova/address/AddressBalance.tsx index 02782d1ed..ec08897c9 100644 --- a/client/src/app/components/nova/address/AddressBalance.tsx +++ b/client/src/app/components/nova/address/AddressBalance.tsx @@ -1,4 +1,4 @@ -import { INodeInfoBaseToken } from "@iota/sdk-wasm-nova/web"; +import { BaseTokenResponse } from "@iota/sdk-wasm-nova/web"; import React, { useState } from "react"; import { useNetworkInfoNova } from "~/helpers/nova/networkInfo"; import { IManaBalance } from "~/models/api/nova/address/IAddressBalanceResponse"; @@ -109,7 +109,7 @@ const AddressBalance: React.FC = ({ ); }; -function buildBaseTokenBalanceView(tokenInfo: INodeInfoBaseToken) { +function buildBaseTokenBalanceView(tokenInfo: BaseTokenResponse) { const baseTokenBalanceView = ( label: string, isFormatFull: boolean, diff --git a/client/src/helpers/nova/hooks/useAccountDetails.ts b/client/src/helpers/nova/hooks/useAccountDetails.ts index ef7608b13..c63b381c5 100644 --- a/client/src/helpers/nova/hooks/useAccountDetails.ts +++ b/client/src/helpers/nova/hooks/useAccountDetails.ts @@ -1,4 +1,4 @@ -import { AccountOutput, IOutputMetadataResponse } from "@iota/sdk-wasm-nova/web"; +import { AccountOutput, OutputMetadataResponse } from "@iota/sdk-wasm-nova/web"; import { useEffect, useState } from "react"; import { ServiceFactory } from "~/factories/serviceFactory"; import { useIsMounted } from "~/helpers/hooks/useIsMounted"; @@ -15,11 +15,11 @@ import { NovaApiClient } from "~/services/nova/novaApiClient"; export function useAccountDetails( network: string, accountId: string | null, -): { accountOutput: AccountOutput | null; accountOutputMetadata: IOutputMetadataResponse | null; isLoading: boolean } { +): { accountOutput: AccountOutput | null; accountOutputMetadata: OutputMetadataResponse | null; isLoading: boolean } { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${NOVA}`)); const [accountOutput, setAccountOutput] = useState(null); - const [accountOutputMetadata, setAccountOutputMetadata] = useState(null); + const [accountOutputMetadata, setAccountOutputMetadata] = useState(null); const [isLoading, setIsLoading] = useState(true); useEffect(() => { diff --git a/client/src/helpers/nova/hooks/useAddressBalance.ts b/client/src/helpers/nova/hooks/useAddressBalance.ts index e5335cd0f..076af2e7c 100644 --- a/client/src/helpers/nova/hooks/useAddressBalance.ts +++ b/client/src/helpers/nova/hooks/useAddressBalance.ts @@ -1,4 +1,4 @@ -import { AddressType, NftOutput, AccountOutput, AnchorOutput, IOutputMetadataResponse, ManaRewardsResponse } from "@iota/sdk-wasm-nova/web"; +import { AddressType, NftOutput, AccountOutput, AnchorOutput, OutputMetadataResponse, ManaRewardsResponse } from "@iota/sdk-wasm-nova/web"; import { useEffect, useState } from "react"; import { IManaBalance } from "~/models/api/nova/address/IAddressBalanceResponse"; import { IAddressDetails } from "~/models/api/nova/IAddressDetails"; @@ -20,7 +20,7 @@ export function useAddressBalance( network: string, addressDetails: IAddressDetails | null, output: AccountOutput | NftOutput | AnchorOutput | null, - outputMetadata?: IOutputMetadataResponse | null, + outputMetadata?: OutputMetadataResponse | null, outputManaRewards?: ManaRewardsResponse | null, ): { totalBaseTokenBalance: number | null; diff --git a/client/src/helpers/nova/hooks/useAnchorDetails.ts b/client/src/helpers/nova/hooks/useAnchorDetails.ts index 27cbfe40f..e00e1ece3 100644 --- a/client/src/helpers/nova/hooks/useAnchorDetails.ts +++ b/client/src/helpers/nova/hooks/useAnchorDetails.ts @@ -1,4 +1,4 @@ -import { AnchorOutput, IOutputMetadataResponse } from "@iota/sdk-wasm-nova/web"; +import { AnchorOutput, OutputMetadataResponse } from "@iota/sdk-wasm-nova/web"; import { useEffect, useState } from "react"; import { ServiceFactory } from "~/factories/serviceFactory"; import { useIsMounted } from "~/helpers/hooks/useIsMounted"; @@ -15,11 +15,11 @@ import { NovaApiClient } from "~/services/nova/novaApiClient"; export function useAnchorDetails( network: string, anchorId: string | null, -): { anchorOutput: AnchorOutput | null; anchorOutputMetadata: IOutputMetadataResponse | null; isLoading: boolean } { +): { anchorOutput: AnchorOutput | null; anchorOutputMetadata: OutputMetadataResponse | null; isLoading: boolean } { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${NOVA}`)); const [anchorOutput, setAnchorOutput] = useState(null); - const [anchorOutputMetadata, setAnchorOutputMetadata] = useState(null); + const [anchorOutputMetadata, setAnchorOutputMetadata] = useState(null); const [isLoading, setIsLoading] = useState(true); useEffect(() => { diff --git a/client/src/helpers/nova/hooks/useNftDetails.ts b/client/src/helpers/nova/hooks/useNftDetails.ts index 5c01252d7..02614b739 100644 --- a/client/src/helpers/nova/hooks/useNftDetails.ts +++ b/client/src/helpers/nova/hooks/useNftDetails.ts @@ -1,4 +1,4 @@ -import { IOutputMetadataResponse, NftOutput } from "@iota/sdk-wasm-nova/web"; +import { OutputMetadataResponse, NftOutput } from "@iota/sdk-wasm-nova/web"; import { useEffect, useState } from "react"; import { ServiceFactory } from "~/factories/serviceFactory"; import { useIsMounted } from "~/helpers/hooks/useIsMounted"; @@ -15,11 +15,11 @@ import { NovaApiClient } from "~/services/nova/novaApiClient"; export function useNftDetails( network: string, nftId: string | null, -): { nftOutput: NftOutput | null; nftOutputMetadata: IOutputMetadataResponse | null; isLoading: boolean } { +): { nftOutput: NftOutput | null; nftOutputMetadata: OutputMetadataResponse | null; isLoading: boolean } { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${NOVA}`)); const [nftOutput, setNftOutput] = useState(null); - const [nftOutputMetadata, setNftOutputMetadata] = useState(null); + const [nftOutputMetadata, setNftOutputMetadata] = useState(null); const [isLoading, setIsLoading] = useState(true); useEffect(() => { From 1077fa6a8861e67fa8066cf1162a89b3595d924e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bego=C3=B1a=20Alvarez?= Date: Mon, 4 Mar 2024 15:56:24 +0100 Subject: [PATCH 6/8] chore: bump sdk commit --- setup_nova.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup_nova.sh b/setup_nova.sh index e24f51cac..15033ae90 100755 --- a/setup_nova.sh +++ b/setup_nova.sh @@ -1,9 +1,9 @@ #!/bin/bash SDK_DIR="iota-sdk" -TARGET_COMMIT="5e1bd797f85b47f3a9afa0462d78edd90d8e2bfd" +TARGET_COMMIT="9578e0e98bc7293e9781c75cc45c8d01d326da32" if [ ! -d "$SDK_DIR" ]; then - git clone -b 2.0 git@github.com:boxfish-studio/iota-sdk.git + git clone -b 2.0 git@github.com:iotaledger/iota-sdk.git cd "./$SDK_DIR" else echo "Pulling nova-sdk..." From fe06eb66df72293b8059e183daed81d9bc2eff28 Mon Sep 17 00:00:00 2001 From: Mario Sarcevic Date: Mon, 4 Mar 2024 16:35:17 +0100 Subject: [PATCH 7/8] fix: Update getRewards method in novaApiService --- api/src/services/nova/novaApiService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/services/nova/novaApiService.ts b/api/src/services/nova/novaApiService.ts index 67876007b..db58c0969 100644 --- a/api/src/services/nova/novaApiService.ts +++ b/api/src/services/nova/novaApiService.ts @@ -367,7 +367,7 @@ export class NovaApiService { * @returns The mana rewards. */ public async getRewards(outputId: string): Promise { - const manaRewardsResponse = await this.client.getRewards(outputId); + const manaRewardsResponse = await this.client.getOutputManaRewards(outputId); return manaRewardsResponse ? { outputId, manaRewards: manaRewardsResponse } : { outputId, message: "Rewards data not found" }; } From e74587a56179cece86ec1f1d9892004579ea5952 Mon Sep 17 00:00:00 2001 From: Mario Sarcevic Date: Mon, 4 Mar 2024 16:42:12 +0100 Subject: [PATCH 8/8] chore: Update SDK commit in nova workflow --- .github/workflows/nova-build-temp.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nova-build-temp.yaml b/.github/workflows/nova-build-temp.yaml index a01c312e5..41e251c29 100644 --- a/.github/workflows/nova-build-temp.yaml +++ b/.github/workflows/nova-build-temp.yaml @@ -6,7 +6,7 @@ on: TARGET_COMMIT: description: "Target Commit Hash for the SDK" required: false - default: "37d52aae84960f087e0687d741e9e2e820ce2e7b" + default: "9578e0e98bc7293e9781c75cc45c8d01d326da32" environment: type: choice description: "Select the environment to deploy to"