From b6a9a71a90b2c932e6090d86a0e8f253d0faabff Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Thu, 28 Nov 2024 16:54:05 +0100 Subject: [PATCH 01/12] fix(*): rustls RUSTSEC-2024-0399 (#4248) --- Cargo.lock | 38 +++++++++++++++++----------------- Cargo.toml | 2 +- crates/iota-storage/Cargo.toml | 2 +- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 029a587e761..a6985400c04 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -191,7 +191,7 @@ dependencies = [ "rand 0.8.5", "rcgen", "ring 0.17.8", - "rustls 0.23.13", + "rustls 0.23.18", "rustls-webpki 0.102.8", "serde", "serde_json", @@ -1625,7 +1625,7 @@ dependencies = [ "hyper 1.4.1", "hyper-util", "pin-project-lite", - "rustls 0.23.13", + "rustls 0.23.18", "rustls-pemfile 2.1.3", "rustls-pki-types", "tokio", @@ -2708,7 +2708,7 @@ dependencies = [ "quinn-proto", "rand 0.8.5", "rstest", - "rustls 0.23.13", + "rustls 0.23.18", "serde", "shared-crypto", "strum_macros 0.26.4", @@ -5436,7 +5436,7 @@ dependencies = [ "hyper 1.4.1", "hyper-util", "log", - "rustls 0.23.13", + "rustls 0.23.18", "rustls-native-certs 0.8.0", "rustls-pki-types", "tokio", @@ -7655,7 +7655,7 @@ dependencies = [ "move-core-types", "rand 0.8.5", "reqwest 0.12.7", - "rustls 0.23.13", + "rustls 0.23.18", "serde", "serde_json", "serde_with", @@ -7903,7 +7903,7 @@ dependencies = [ "percent-encoding", "prometheus", "reqwest 0.12.7", - "rustls 0.23.13", + "rustls 0.23.18", "serde", "serde_json", "tap", @@ -8023,7 +8023,7 @@ dependencies = [ "rand 0.8.5", "rcgen", "reqwest 0.12.7", - "rustls 0.23.13", + "rustls 0.23.18", "rustls-webpki 0.102.8", "tokio", "tokio-rustls 0.26.0", @@ -8510,7 +8510,7 @@ dependencies = [ "http 1.1.0", "jsonrpsee-core", "pin-project", - "rustls 0.23.13", + "rustls 0.23.18", "rustls-pki-types", "rustls-platform-verifier", "soketto", @@ -8563,7 +8563,7 @@ dependencies = [ "hyper-util", "jsonrpsee-core", "jsonrpsee-types", - "rustls 0.23.13", + "rustls 0.23.18", "rustls-platform-verifier", "serde", "serde_json", @@ -11949,7 +11949,7 @@ dependencies = [ "quinn-proto", "quinn-udp", "rustc-hash 2.0.0", - "rustls 0.23.13", + "rustls 0.23.18", "socket2", "thiserror", "tokio", @@ -11966,7 +11966,7 @@ dependencies = [ "rand 0.8.5", "ring 0.17.8", "rustc-hash 2.0.0", - "rustls 0.23.13", + "rustls 0.23.18", "slab", "thiserror", "tinyvec", @@ -12397,7 +12397,7 @@ dependencies = [ "percent-encoding", "pin-project-lite", "quinn", - "rustls 0.23.13", + "rustls 0.23.18", "rustls-native-certs 0.7.3", "rustls-pemfile 2.1.3", "rustls-pki-types", @@ -12865,9 +12865,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.13" +version = "0.23.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8" +checksum = "9c9cc1d47e243d655ace55ed38201c19ae02c148ae56412ab8750e8f0166ab7f" dependencies = [ "aws-lc-rs", "log", @@ -12938,9 +12938,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" +checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" [[package]] name = "rustls-platform-verifier" @@ -12953,7 +12953,7 @@ dependencies = [ "jni", "log", "once_cell", - "rustls 0.23.13", + "rustls 0.23.18", "rustls-native-certs 0.7.3", "rustls-platform-verifier-android", "rustls-webpki 0.102.8", @@ -14790,7 +14790,7 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.23.13", + "rustls 0.23.18", "rustls-pki-types", "tokio", ] @@ -15554,7 +15554,7 @@ dependencies = [ "flate2", "log", "once_cell", - "rustls 0.23.13", + "rustls 0.23.18", "rustls-pki-types", "url", "webpki-roots 0.26.6", diff --git a/Cargo.toml b/Cargo.toml index 55279866086..d9a5cb5b76b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -302,7 +302,7 @@ reqwest = { version = "0.12", default-features = false, features = ["http2", "js roaring = "0.10.6" rocksdb = { version = "0.21.0", default-features = false, features = ["snappy", "lz4", "zstd", "zlib", "multi-threaded-cf"] } rstest = "0.16.0" -rustls = { version = "0.23", default-features = false, features = ["std", "tls12", "ring"] } +rustls = { version = "0.23.18", default-features = false, features = ["std", "tls12", "ring"] } schemars = { version = "0.8.21", features = ["either"] } scopeguard = "1.1" serde = { version = "1.0.144", features = ["derive", "rc"] } diff --git a/crates/iota-storage/Cargo.toml b/crates/iota-storage/Cargo.toml index bc6d3a66e96..fda14adfb6e 100644 --- a/crates/iota-storage/Cargo.toml +++ b/crates/iota-storage/Cargo.toml @@ -70,7 +70,7 @@ iota-types = { workspace = true, features = ["test-utils"] } [target.'cfg(msim)'.dependencies] # external dependencies axum.workspace = true -rustls = "0.23" +rustls = "0.23.18" # internal dependencies iota-simulator.workspace = true From c4bcdf9f089520b160034ec0d4b299c2d4bddc92 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Thu, 28 Nov 2024 17:02:09 +0100 Subject: [PATCH 02/12] fix(ci): labeler.yml for explorer (#4295) --- .github/labeler.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/labeler.yml b/.github/labeler.yml index 83af79e05b4..9c85e15b9f1 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,6 +1,6 @@ -Documentation: +documentation: - changed-files: - any-glob-to-any-file: docs/content/**/* -iota-explorer: +explorer: - changed-files: - - any-glob-to-any-file: explorer/**/* + - any-glob-to-any-file: apps/explorer/**/* From 5a9a8f352b44f58a9b405794cc9f089f970ac0e3 Mon Sep 17 00:00:00 2001 From: Alexander Sporn Date: Thu, 28 Nov 2024 17:39:42 +0100 Subject: [PATCH 03/12] Adapt CODEOWNERS to new team names (#4302) --- .github/CODEOWNERS | 84 +++++++++++++++++++++++----------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 45652f18036..f77a9c2b71b 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,41 +1,41 @@ # Default fallback, if no other path below this matches -* @iotaledger/l1-core @iotaledger/core-node @iotaledger/core-consensus +* @iotaledger/sc-platform @iotaledger/core-protocol # Everything within the SDK folder -/sdk/ @iotaledger/boxfish @iotaledger/l1-core @iotaledger/tooling +/sdk/ @iotaledger/tooling # Changes to the genesis builder should be approved by Konstantinos or Mirko at least /crates/iota-genesis-builder/ @kodemartin @miker83z # vm-language team -/iota-execution/ @miker83z @valeriyr -/external-crates/ @miker83z @valeriyr +/iota-execution/ @iotaledger/vm-language +/external-crates/ @iotaledger/vm-language -# l1-core-infra team -/docker/ @iotaledger/l1-core-infra @iotaledger/core-node @iotaledger/devops-admin -/crates/iota-json-rpc*/ @iotaledger/l1-core-infra -/crates/iota-graphql*/ @iotaledger/l1-core-infra -/crates/iota-indexer*/ @iotaledger/l1-core-infra -/crates/iota-data-ingestion*/ @iotaledger/l1-core-infra -/crates/iota-analytics-indexer/ @iotaledger/l1-core-infra +# infrastructure team +/docker/ @iotaledger/infrastructure @iotaledger/node @iotaledger/devops-admin +/crates/iota-json-rpc*/ @iotaledger/infrastructure +/crates/iota-graphql*/ @iotaledger/infrastructure +/crates/iota-indexer*/ @iotaledger/infrastructure +/crates/iota-data-ingestion*/ @iotaledger/infrastructure +/crates/iota-analytics-indexer/ @iotaledger/infrastructure -# core-node team -/crates/iota-archival/ @iotaledger/core-node -/crates/iota-authority-aggregation/ @iotaledger/core-node @iotaledger/core-consensus -/crates/iota-config/ @iotaledger/core-node -/crates/iota-core/ @iotaledger/core-node @iotaledger/core-consensus -/crates/iota-network/ @iotaledger/core-node -/crates/iota-network-stack/ @iotaledger/core-node -/crates/iota-node/ @iotaledger/core-node -/crates/iota-types/ @iotaledger/core-node @iotaledger/l1-core -/crates/iota-protocol-config/ @iotaledger/core-node @iotaledger/l1-core -/crates/iota-protocol-config-macros/ @iotaledger/core-node @iotaledger/l1-core -/crates/iota-rest-api/ @iotaledger/core-node @iotaledger/l1-core-infra -/crates/iota-snapshot/ @iotaledger/core-node -/crates/iota-storage/ @iotaledger/core-node +# node team +/crates/iota-archival/ @iotaledger/node +/crates/iota-authority-aggregation/ @iotaledger/node @iotaledger/consensus +/crates/iota-config/ @iotaledger/node +/crates/iota-core/ @iotaledger/node @iotaledger/consensus +/crates/iota-network/ @iotaledger/node +/crates/iota-network-stack/ @iotaledger/node +/crates/iota-node/ @iotaledger/node +/crates/iota-types/ @iotaledger/node @iotaledger/sc-platform +/crates/iota-protocol-config/ @iotaledger/node @iotaledger/sc-platform +/crates/iota-protocol-config-macros/ @iotaledger/node @iotaledger/sc-platform +/crates/iota-rest-api/ @iotaledger/node @iotaledger/infrastructure +/crates/iota-snapshot/ @iotaledger/node +/crates/iota-storage/ @iotaledger/node -# core-consensus team -/consensus/ @iotaledger/core-consensus +# consensus team +/consensus/ @iotaledger/consensus # dev-tools team /crates/iota/ @iotaledger/dev-tools @@ -45,21 +45,21 @@ /crates/iota-transaction-builder/ @iotaledger/dev-tools # Frontend apps to be looked after by Boxfish Studio or the tooling team -/apps/ @iotaledger/boxfish @iotaledger/tooling -/dapps/ @iotaledger/boxfish @iotaledger/tooling -/linting/ @iotaledger/boxfish @iotaledger/tooling -/.husky/ @iotaledger/boxfish @iotaledger/tooling -/.changeset/ @iotaledger/boxfish @iotaledger/tooling -.eslintrc.js @iotaledger/boxfish @iotaledger/tooling -.lintstagedrc.json @iotaledger/boxfish @iotaledger/tooling -.npmrc @iotaledger/boxfish @iotaledger/tooling -.prettierignore @iotaledger/boxfish @iotaledger/tooling -graphql.config.ts @iotaledger/boxfish @iotaledger/tooling -package.json @iotaledger/boxfish @iotaledger/tooling -pnpm-workspace.yaml @iotaledger/boxfish @iotaledger/tooling -prettier.config.js @iotaledger/boxfish @iotaledger/tooling -turbo.json @iotaledger/boxfish @iotaledger/tooling -vercel.json @iotaledger/boxfish @iotaledger/tooling +/apps/ @iotaledger/tooling +/dapps/ @iotaledger/tooling +/linting/ @iotaledger/tooling +/.husky/ @iotaledger/tooling +/.changeset/ @iotaledger/tooling +.eslintrc.js @iotaledger/tooling +.lintstagedrc.json @iotaledger/tooling +.npmrc @iotaledger/tooling +.prettierignore @iotaledger/tooling +graphql.config.ts @iotaledger/tooling +package.json @iotaledger/tooling +pnpm-workspace.yaml @iotaledger/tooling +prettier.config.js @iotaledger/tooling +turbo.json @iotaledger/tooling +vercel.json @iotaledger/tooling # Docs and examples are for DevEx to approve upon /docs/ @iotaledger/devx From 74c388e94f284f148538be031d02a43740d8c208 Mon Sep 17 00:00:00 2001 From: Luca Moser Date: Thu, 28 Nov 2024 21:01:36 +0100 Subject: [PATCH 04/12] fix(docs): Typo in node docker install (#4304) Signed-off-by: Luca Moser --- nre/docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nre/docker/README.md b/nre/docker/README.md index e015e6077f6..640e94dabd3 100644 --- a/nre/docker/README.md +++ b/nre/docker/README.md @@ -7,7 +7,7 @@ Tested using: ## Prerequisites and Setup -1. Confirm you have either [Docker Engine](https://docs.docker.com/engine/install/) or [Docker Desktop](https://docs.docker.com/desktop/install/linux-install/) instllled, as well as [Docker Compose](https://github.com/docker/compose#linux). +1. Confirm you have either [Docker Engine](https://docs.docker.com/engine/install/) or [Docker Desktop](https://docs.docker.com/desktop/install/linux-install/) installed, as well as [Docker Compose](https://github.com/docker/compose#linux). 2. Update [validator.yaml](../config/validator.yaml) and place it in the same directory as `docker-compose.yaml`. From 42fbfb284929d17876e1e20cc9aba5dc1b68cefa Mon Sep 17 00:00:00 2001 From: Hans Moog <3293976+hmoog@users.noreply.github.com> Date: Fri, 29 Nov 2024 07:32:26 +0000 Subject: [PATCH 05/12] fix(docker):iota-private-network (#4293) * fixed config * addressed dprint error --------- Co-authored-by: Hans Moog --- docker/iota-private-network/configs/genesis-template.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/iota-private-network/configs/genesis-template.yaml b/docker/iota-private-network/configs/genesis-template.yaml index 0ce6832306c..1650e388275 100644 --- a/docker/iota-private-network/configs/genesis-template.yaml +++ b/docker/iota-private-network/configs/genesis-template.yaml @@ -45,3 +45,4 @@ validator_config_info: network_address: /dns/validator-4/tcp/8080/http p2p_address: /dns/validator-4/udp/8084 stake: 20000000000000000 +migration_sources: [] From d26dc3c1f3e436df38a2ce8e403a3bd727a0cb97 Mon Sep 17 00:00:00 2001 From: Valerii Reutov Date: Fri, 29 Nov 2024 11:01:15 +0200 Subject: [PATCH 06/12] fix(move-analyzer): change the publisher name (#4294) --- .../move/crates/move-analyzer/editors/code/package.json | 2 +- .../crates/move-analyzer/editors/code/src/extension.ts | 2 +- .../crates/move-analyzer/editors/code/tests/ext.test.ts | 2 +- .../crates/move-analyzer/editors/code/tests/lsp.test.ts | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/external-crates/move/crates/move-analyzer/editors/code/package.json b/external-crates/move/crates/move-analyzer/editors/code/package.json index 0f6737c2c29..7528263217d 100644 --- a/external-crates/move/crates/move-analyzer/editors/code/package.json +++ b/external-crates/move/crates/move-analyzer/editors/code/package.json @@ -2,7 +2,7 @@ "name": "iota-move", "displayName": "IOTA Move", "description": "A Move language integrated development environment for IOTA.", - "publisher": "iota-foundation", + "publisher": "iotaledger", "icon": "images/move.png", "license": "Apache-2.0", "version": "1.0.0", diff --git a/external-crates/move/crates/move-analyzer/editors/code/src/extension.ts b/external-crates/move/crates/move-analyzer/editors/code/src/extension.ts index a414f1827a6..b9115931b95 100644 --- a/external-crates/move/crates/move-analyzer/editors/code/src/extension.ts +++ b/external-crates/move/crates/move-analyzer/editors/code/src/extension.ts @@ -9,7 +9,7 @@ import * as vscode from 'vscode'; /** Information related to this extension itself, such as its identifier and version. */ export class Extension { /** The string used to uniquely identify this particular extension to VS Code. */ - readonly identifier = 'iota-foundation.iota-move'; + readonly identifier = 'iotaledger.iota-move'; private readonly extension: vscode.Extension; diff --git a/external-crates/move/crates/move-analyzer/editors/code/tests/ext.test.ts b/external-crates/move/crates/move-analyzer/editors/code/tests/ext.test.ts index 093d0b24f62..266761ed8e8 100644 --- a/external-crates/move/crates/move-analyzer/editors/code/tests/ext.test.ts +++ b/external-crates/move/crates/move-analyzer/editors/code/tests/ext.test.ts @@ -8,7 +8,7 @@ import * as vscode from 'vscode'; Mocha.suite('ext', () => { Mocha.test('ext_exists', () => { - const ext = vscode.extensions.getExtension('iota-foundation.iota-move'); + const ext = vscode.extensions.getExtension('iotaledger.iota-move'); assert.ok(ext); }); }); diff --git a/external-crates/move/crates/move-analyzer/editors/code/tests/lsp.test.ts b/external-crates/move/crates/move-analyzer/editors/code/tests/lsp.test.ts index 0dc0512d528..f824eb30d98 100644 --- a/external-crates/move/crates/move-analyzer/editors/code/tests/lsp.test.ts +++ b/external-crates/move/crates/move-analyzer/editors/code/tests/lsp.test.ts @@ -24,7 +24,7 @@ const PRIMITIVE_TYPES = ['u8', 'u16', 'u32', 'u64', 'u128', 'u256', 'bool', 'vec Mocha.suite('LSP', () => { Mocha.test('textDocument/documentSymbol', async () => { - const ext = vscode.extensions.getExtension('iota-foundation.iota-move'); + const ext = vscode.extensions.getExtension('iotaledger.iota-move'); assert.ok(ext); await ext.activate(); // Synchronous waiting for activation to complete @@ -69,7 +69,7 @@ Mocha.suite('LSP', () => { }); Mocha.test('textDocument/hover for definition in the same module', async () => { - const ext = vscode.extensions.getExtension('iota-foundation.iota-move'); + const ext = vscode.extensions.getExtension('iotaledger.iota-move'); assert.ok(ext); await ext.activate(); // Synchronous waiting for activation to complete @@ -108,7 +108,7 @@ Mocha.suite('LSP', () => { }); Mocha.test('textDocument/hover for definition in an external module', async () => { - const ext = vscode.extensions.getExtension('iota-foundation.iota-move'); + const ext = vscode.extensions.getExtension('iotaledger.iota-move'); assert.ok(ext); await ext.activate(); // Synchronous waiting for activation to complete @@ -147,7 +147,7 @@ Mocha.suite('LSP', () => { }); Mocha.test('textDocument/completion', async () => { - const ext = vscode.extensions.getExtension('iota-foundation.iota-move'); + const ext = vscode.extensions.getExtension('iotaledger.iota-move'); assert.ok(ext); await ext.activate(); // Synchronous waiting for activation to complete From d899a6c404871ba0e3374209ef059ba744e83a60 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 29 Nov 2024 10:50:28 +0100 Subject: [PATCH 07/12] feat(core): Add hook with logic to check if an asset is 'Transferable'. (#4159) * feat(tooling-core): Add hook with logic to check if an asset is 'Transferabe'. Remove old util * feat(apps-core): Use useQuery in place of useEffect in useIsAssetTransferable * feat(apps-core): Improve early return condition in useIsAssetTransferable * feat(apps-core): Improve per PR comments --- apps/core/src/hooks/index.ts | 1 + apps/core/src/hooks/useIsAssetTransferable.ts | 50 +++++++++++++++++++ apps/core/src/utils/index.ts | 1 - apps/core/src/utils/isAssetTransferable.ts | 10 ---- .../(protected)/assets/[objectId]/page.tsx | 7 ++- .../ui/app/pages/home/nft-details/index.tsx | 10 ++-- .../ui/app/pages/home/nft-transfer/index.tsx | 8 +-- 7 files changed, 65 insertions(+), 22 deletions(-) create mode 100644 apps/core/src/hooks/useIsAssetTransferable.ts delete mode 100644 apps/core/src/utils/isAssetTransferable.ts diff --git a/apps/core/src/hooks/index.ts b/apps/core/src/hooks/index.ts index 2ffa7f95688..026f01c6656 100644 --- a/apps/core/src/hooks/index.ts +++ b/apps/core/src/hooks/index.ts @@ -24,6 +24,7 @@ export * from './useGetKioskContents'; export * from './useZodForm'; export * from './useElementDimensions'; export * from './useIotaCoinData'; +export * from './useIsAssetTransferable'; export * from './useLocalStorage'; export * from './useTokenPrice'; export * from './useKioskClient'; diff --git a/apps/core/src/hooks/useIsAssetTransferable.ts b/apps/core/src/hooks/useIsAssetTransferable.ts new file mode 100644 index 00000000000..7f5e75890a8 --- /dev/null +++ b/apps/core/src/hooks/useIsAssetTransferable.ts @@ -0,0 +1,50 @@ +// Copyright (c) 2024 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +import { useIotaClient } from '@iota/dapp-kit'; +import { IotaMoveNormalizedStruct, IotaObjectData } from '@iota/iota-sdk/client'; +import { useQuery } from '@tanstack/react-query'; + +function getObjectTypeParams(obj: IotaObjectData | null | undefined) { + const objectType = + obj?.type ?? + (obj?.content?.dataType === 'package' ? 'package' : obj?.content?.type) ?? + null; + + return objectType?.split('<')[0]?.split('::') || []; +} + +export function useIsAssetTransferable(obj: IotaObjectData | null | undefined) { + const client = useIotaClient(); + const [packageId, moduleName, functionName] = getObjectTypeParams(obj); + + return useQuery({ + // eslint-disable-next-line @tanstack/query/exhaustive-deps + queryKey: ['is-asset-transferable', packageId, moduleName, functionName], + queryFn: async () => { + if (!packageId || !moduleName || !functionName) { + return undefined; + } + + return await client.getNormalizedMoveStruct({ + package: packageId, + module: moduleName, + struct: functionName, + }); + }, + select: (moveNormalizedStruct: IotaMoveNormalizedStruct | undefined): boolean => { + if (!moveNormalizedStruct) { + return false; + } + + const structAbilities = moveNormalizedStruct?.abilities?.abilities ?? null; + + if (!structAbilities) { + return false; + } + + return structAbilities.includes('Store'); + }, + enabled: !!packageId && !!moduleName && !!functionName, + }); +} diff --git a/apps/core/src/utils/index.ts b/apps/core/src/utils/index.ts index 8cbb31afa73..4d57564fa92 100644 --- a/apps/core/src/utils/index.ts +++ b/apps/core/src/utils/index.ts @@ -1,7 +1,6 @@ // Copyright (c) 2024 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -export * from './isAssetTransferable'; export * from './calculateStakeShare'; export * from './chunkArray'; export * from './formatAmount'; diff --git a/apps/core/src/utils/isAssetTransferable.ts b/apps/core/src/utils/isAssetTransferable.ts deleted file mode 100644 index 4dad0779706..00000000000 --- a/apps/core/src/utils/isAssetTransferable.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) 2024 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -import { IotaObjectData } from '@iota/iota-sdk/client'; - -export const isAssetTransferable = (obj: IotaObjectData | null | undefined): boolean => - // TODO: Either the type abilities will be added to 'IotaParsedData' and - // we need to check if the object has the 'store' ability or there will be a new endpoint - // that returns the "transferable" status of a MoveType. - !!obj && obj.content?.dataType === 'moveObject'; // && obj.content.hasPublicTransfer; diff --git a/apps/wallet-dashboard/app/(protected)/assets/[objectId]/page.tsx b/apps/wallet-dashboard/app/(protected)/assets/[objectId]/page.tsx index 7f42d41f04b..563d7a9e9c0 100644 --- a/apps/wallet-dashboard/app/(protected)/assets/[objectId]/page.tsx +++ b/apps/wallet-dashboard/app/(protected)/assets/[objectId]/page.tsx @@ -6,7 +6,7 @@ import React, { useCallback } from 'react'; import { useParams } from 'next/navigation'; import { Button, RouteLink, SendAssetPopup, VisualAssetDetailsCard } from '@/components'; -import { isAssetTransferable, useGetObject } from '@iota/core'; +import { useIsAssetTransferable, useGetObject } from '@iota/core'; import { usePopups } from '@/hooks'; import { useCurrentAccount } from '@iota/dapp-kit'; import { ASSETS_ROUTE } from '@/lib/constants/routes.constants'; @@ -15,6 +15,7 @@ const VisualAssetDetailPage = () => { const params = useParams(); const objectId = params.objectId as string; const { data: asset } = useGetObject(objectId); + const { data: isAssetTransferable } = useIsAssetTransferable(asset?.data); const activeAccount = useCurrentAccount(); const { openPopup, closePopup } = usePopups(); @@ -25,8 +26,6 @@ const VisualAssetDetailPage = () => { } }, [asset, openPopup, closePopup]); - const assetIsTransferable = asset?.data ? isAssetTransferable(asset?.data) : false; - return (
@@ -35,7 +34,7 @@ const VisualAssetDetailPage = () => { ) : (
Asset not found
)} - {assetIsTransferable && activeAccount ? ( + {isAssetTransferable && activeAccount ? ( ) : null}
diff --git a/apps/wallet/src/ui/app/pages/home/nft-details/index.tsx b/apps/wallet/src/ui/app/pages/home/nft-details/index.tsx index ab9508a19f0..3879f492cea 100644 --- a/apps/wallet/src/ui/app/pages/home/nft-details/index.tsx +++ b/apps/wallet/src/ui/app/pages/home/nft-details/index.tsx @@ -7,7 +7,7 @@ import { Collapsible } from '_app/shared/collapse'; import { ExplorerLink, ExplorerLinkType, Loading, NFTDisplayCard, PageTemplate } from '_components'; import { useNFTBasicData, useOwnedNFT } from '_hooks'; import { useUnlockedGuard } from '_src/ui/app/hooks/useUnlockedGuard'; -import { isAssetTransferable, useGetKioskContents, useGetNFTMeta } from '@iota/core'; +import { useIsAssetTransferable, useGetKioskContents, useGetNFTMeta } from '@iota/core'; import { formatAddress } from '@iota/iota-sdk/utils'; import cl from 'clsx'; import { Link, Navigate, useNavigate, useSearchParams } from 'react-router-dom'; @@ -24,7 +24,8 @@ function NFTDetailsPage() { const nftId = searchParams.get('objectId'); const accountAddress = useActiveAddress(); const { data: objectData, isPending: isNftLoading } = useOwnedNFT(nftId || '', accountAddress); - const isTransferable = isAssetTransferable(objectData); + const { data: isAssetTransferable, isLoading: isCheckingAssetTransferability } = + useIsAssetTransferable(objectData); const { nftFields, fileExtensionType, filePath } = useNFTBasicData(objectData); const address = useActiveAddress(); const { data } = useGetKioskContents(address); @@ -55,7 +56,8 @@ function NFTDetailsPage() { objectData.owner.AddressOwner) || ''; const isGuardLoading = useUnlockedGuard(); - const isPending = isNftLoading || isPendingDisplay || isGuardLoading; + const isPending = + isNftLoading || isPendingDisplay || isGuardLoading || isCheckingAssetTransferability; function handleMoreAboutKiosk() { window.open('https://docs.iota.org/references/ts-sdk/kiosk/', '_blank'); @@ -241,7 +243,7 @@ function NFTDetailsPage() { ) : (