Skip to content

Commit 1e02d86

Browse files
feat(sdk): enable and use getNormalizedMoveFunction (#1117)
* feat(dappp): bring back getNormalizedMoveFunction * feat(dapp): changeset * Change version to minor and remove isMethodSupported Updated versioning for @iota/iota-names-sdk and removed isMethodSupported. * new line --------- Co-authored-by: Marc Espin <mespinsanz@gmail.com>
1 parent c0455e1 commit 1e02d86

File tree

4 files changed

+19
-33
lines changed

4 files changed

+19
-33
lines changed

.changeset/soft-carpets-watch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@iota/iota-names-sdk': minor
3+
---
4+
5+
Remove `isMethodSupported`
Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
// Copyright (c) 2025 IOTA Stiftung
22
// SPDX-License-Identifier: Apache-2.0
33

4+
import { useIotaClient } from '@iota/dapp-kit';
45
import { useQuery } from '@tanstack/react-query';
56

6-
import { useIotaNamesClient } from '@/contexts';
7-
87
import { queryKey } from './queryKey';
98

109
export function useIsMethodSupported({
@@ -16,11 +15,21 @@ export function useIsMethodSupported({
1615
module: string;
1716
functionName: string;
1817
}) {
19-
const { iotaNamesClient } = useIotaNamesClient();
18+
const client = useIotaClient();
19+
2020
return useQuery({
2121
queryKey: [...queryKey.methodSupported(packageId, module, functionName)],
22-
queryFn() {
23-
return iotaNamesClient.isMethodSupported(packageId, module, functionName);
22+
async queryFn() {
23+
try {
24+
const result = await client.getNormalizedMoveFunction({
25+
package: packageId,
26+
module,
27+
function: functionName,
28+
});
29+
return result != null;
30+
} catch {
31+
return false;
32+
}
2433
},
2534
});
2635
}

dapp/src/lib/utils/defaultRpcClient.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export const createIotaClient = (network: NetworkId): IotaClient => {
2525
unsupportedMethods: [
2626
'multiGetObjects',
2727
'getReferenceGasPrice',
28-
'getNormalizedMoveFunction',
2928
'getOwnedObjects',
3029
'executeTransactionBlock',
3130
],

sdk/src/iota-names-client.ts

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -52,33 +52,6 @@ export class IotaNamesClient {
5252
}
5353
}
5454

55-
async isMethodSupported(
56-
packageId: string,
57-
module: string,
58-
functionName: string,
59-
): Promise<boolean> {
60-
const methodData = await this.graphQlClient.query<{
61-
package: { module: { function: unknown } };
62-
}>({
63-
query: `query getMethod($package: IotaAddress!, $module: String!, $function: String!) {
64-
package(address: $package) {
65-
module(name: $module) {
66-
function(name: $function) {
67-
name
68-
}
69-
}
70-
}
71-
}`,
72-
variables: {
73-
package: packageId,
74-
module,
75-
function: functionName,
76-
},
77-
});
78-
79-
return methodData.data?.package?.module?.function != null;
80-
}
81-
8255
/**
8356
* Get the corresponding address for the given package.
8457
* Sometimes new versions might contain new types,

0 commit comments

Comments
 (0)