Skip to content

Commit 44d9b4f

Browse files
authored
Update graphql client and schema for graphql beta (#596)
* Update test infrastructure for GraphQL beta * update graphql urls * add changeset
1 parent d868907 commit 44d9b4f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+9044
-12019
lines changed

.changeset/funny-lies-kneel.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@mysten/sui': minor
3+
---
4+
5+
Update GraphQL client to use beta schema"

packages/dapp-kit-next/packages/dapp-kit-core/src/core/types.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
// Copyright (c) Mysten Labs, Inc.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
import type { ClientWithExtensions, Experimental_SuiClientTypes } from '@mysten/sui/experimental';
4+
import type { ClientWithCoreApi } from '@mysten/sui/experimental';
55
import type { Networks } from '../utils/networks.js';
66
import type { StateStorage } from '../utils/storage.js';
77
import type { WalletInitializer } from '../wallets/index.js';
88

9-
export type DAppKitCompatibleClient = ClientWithExtensions<{
10-
core: {
11-
resolveNameServiceNames: Experimental_SuiClientTypes.TransportMethods['resolveNameServiceNames'];
12-
verifyZkLoginSignature: Experimental_SuiClientTypes.TransportMethods['verifyZkLoginSignature'];
13-
};
14-
}>;
9+
export type DAppKitCompatibleClient = ClientWithCoreApi;
1510

1611
export type SlushWalletConfig = {
1712
/**

packages/dapp-kit-next/packages/dapp-kit-core/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export type { DAppKitCompatibleClient } from './core/types.js';
88
export type { WalletConnection } from './core/store.js';
99
export type { Register, ResolvedRegister, RegisteredDAppKit } from './types.js';
1010
export type { StateStorage } from './utils/storage.js';
11+
export type { ClientWithCoreApi } from '@mysten/sui/experimental';
1112

1213
export { getWalletUniqueIdentifier } from './utils/wallets.js';
1314
export type { UiWallet, UiWalletAccount } from '@wallet-standard/ui';

packages/dapp-kit-next/packages/dapp-kit-core/src/utils/name.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@ export async function resolveNameServiceName(client: DAppKitCompatibleClient, ad
1212
}
1313

1414
try {
15-
const result = await client.core.resolveNameServiceNames?.({
15+
const result = await client.core.defaultNameServiceName?.({
1616
address,
17-
limit: 1,
1817
});
1918

20-
const name = result?.data.at(0) ?? null;
19+
const name = result?.data.name;
2120
cache.set(address, name ? normalizeSuiNSName(name, 'at') : null);
2221
return name;
2322
} catch {
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# @generated by Move, please check-in and do not edit manually.
2+
3+
[move]
4+
version = 3
5+
manifest_digest = "B91E3C47E3DDCEBB83E2E09903B6ABF57B877A5B8E64562A51509EA7D8192CBB"
6+
deps_digest = "F9B494B64F0615AED0E98FC12A85B85ECD2BC5185C22D30E7F67786BB52E507C"
7+
dependencies = [
8+
{ id = "Bridge", name = "Bridge" },
9+
{ id = "MoveStdlib", name = "MoveStdlib" },
10+
{ id = "Sui", name = "Sui" },
11+
{ id = "SuiSystem", name = "SuiSystem" },
12+
]
13+
14+
[[move.package]]
15+
id = "Bridge"
16+
source = { git = "https://github.com/MystenLabs/sui.git", rev = "494fa6ede17f366f1cd850f01ccb9f42dc75c470", subdir = "crates/sui-framework/packages/bridge" }
17+
18+
dependencies = [
19+
{ id = "MoveStdlib", name = "MoveStdlib" },
20+
{ id = "Sui", name = "Sui" },
21+
{ id = "SuiSystem", name = "SuiSystem" },
22+
]
23+
24+
[[move.package]]
25+
id = "MoveStdlib"
26+
source = { git = "https://github.com/MystenLabs/sui.git", rev = "494fa6ede17f366f1cd850f01ccb9f42dc75c470", subdir = "crates/sui-framework/packages/move-stdlib" }
27+
28+
[[move.package]]
29+
id = "Sui"
30+
source = { git = "https://github.com/MystenLabs/sui.git", rev = "494fa6ede17f366f1cd850f01ccb9f42dc75c470", subdir = "crates/sui-framework/packages/sui-framework" }
31+
32+
dependencies = [
33+
{ id = "MoveStdlib", name = "MoveStdlib" },
34+
]
35+
36+
[[move.package]]
37+
id = "SuiSystem"
38+
source = { git = "https://github.com/MystenLabs/sui.git", rev = "494fa6ede17f366f1cd850f01ccb9f42dc75c470", subdir = "crates/sui-framework/packages/sui-system" }
39+
40+
dependencies = [
41+
{ id = "MoveStdlib", name = "MoveStdlib" },
42+
{ id = "Sui", name = "Sui" },
43+
]
44+
45+
[move.toolchain-version]
46+
compiler-version = "1.60.0"
47+
edition = "2024.beta"
48+
flavor = "sui"

packages/deepbook/test/e2e/data/test_coin/Move.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ name = "test_coin"
33
version = "0.0.1"
44
edition = "2024.beta"
55

6-
[dependencies]
7-
Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" }
8-
96

107
[addresses]
118
test_coin = "0x0"

packages/deepbook/test/e2e/globalSetup.ts

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ declare module 'vitest' {
1515
}
1616

1717
const SUI_TOOLS_TAG =
18-
process.env.SUI_TOOLS_TAG || process.arch === 'arm64'
19-
? '28dc33fc8fc43e50819c42c22b0d557b889c107e-arm64'
20-
: '28dc33fc8fc43e50819c42c22b0d557b889c107e';
18+
process.env.SUI_TOOLS_TAG ||
19+
(process.arch === 'arm64'
20+
? '06204e155ea3b35fe4c949321d70091ad0ed8437-arm64'
21+
: '06204e155ea3b35fe4c949321d70091ad0ed8437');
2122

2223
export default async function setup({ provide }: GlobalSetupContext) {
2324
console.log('Starting test containers');
@@ -30,7 +31,6 @@ export default async function setup({ provide }: GlobalSetupContext) {
3031
POSTGRES_DB: 'sui_indexer_v2',
3132
})
3233
.withCommand(['-c', 'max_connections=500'])
33-
3434
.withExposedPorts(5432)
3535
.withNetwork(network)
3636
.withPullPolicy(PullPolicy.alwaysPull())
@@ -42,18 +42,8 @@ export default async function setup({ provide }: GlobalSetupContext) {
4242
'start',
4343
'--with-faucet',
4444
'--force-regenesis',
45-
'--with-indexer',
46-
'--pg-port',
47-
'5432',
48-
'--pg-db-name',
49-
'sui_indexer_v2',
50-
'--pg-host',
51-
pg.getIpAddress(network.getName()),
52-
'--pg-user',
53-
'postgres',
54-
'--pg-password',
55-
'postgrespw',
5645
'--with-graphql',
46+
`--with-indexer=postgres://postgres:postgrespw@${pg.getIpAddress(network.getName())}:5432/sui_indexer_v2`,
5747
])
5848
.withCopyDirectoriesToContainer([
5949
{ source: resolve(__dirname, './data'), target: '/test-data' },
@@ -68,7 +58,7 @@ export default async function setup({ provide }: GlobalSetupContext) {
6858
.start();
6959

7060
provide('faucetPort', localnet.getMappedPort(9123));
71-
provide('localnetPort', localnet.getMappedPort(9124));
61+
provide('localnetPort', localnet.getMappedPort(9000));
7262
provide('graphqlPort', localnet.getMappedPort(9125));
7363
provide('suiToolsContainerId', localnet.getId());
7464
}

packages/deepbook/test/e2e/setupEnv.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { inject } from 'vitest';
66
Object.entries({
77
FAUCET_URL: `http://localhost:${inject('faucetPort')}`,
88
FULLNODE_URL: `http://localhost:${inject('localnetPort')}`,
9-
GRAPHQL_URL: `http://localhost:${inject('graphqlPort')}`,
9+
GRAPHQL_URL: `http://localhost:${inject('graphqlPort')}/graphql`,
1010
}).forEach(([key, value]) => {
1111
process.env[key] = value;
1212
});

packages/docs/content/typescript/cryptography/keypairs.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ import { verifyPersonalMessageSignature } from '@mysten/sui/verify';
150150

151151
const publicKey = await verifyPersonalMessageSignature(message, zkSignature, {
152152
client: new SuiGraphQLClient({
153-
url: 'https://sui-testnet.mystenlabs.com/graphql',
153+
url: 'https://graphql.testnet.sui.io/graphql',
154154
}),
155155
});
156156
```
@@ -168,7 +168,7 @@ import { verifyPersonalMessageSignature } from '@mysten/sui/verify';
168168

169169
const publicKey = await verifyPersonalMessageSignature(message, zkSignature, {
170170
client: new SuiGraphQLClient({
171-
url: 'https://sui-testnet.mystenlabs.com/graphql',
171+
url: 'https://graphql.testnet.sui.io/graphql',
172172
}),
173173
// Pass in the expected address, and the verification method will throw an error if the signature is not valid for the provided address
174174
address: '0x...expectedAddress',

packages/docs/content/typescript/graphql.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { SuiGraphQLClient } from '@mysten/sui/graphql';
1818
import { graphql } from '@mysten/sui/graphql/schemas/latest';
1919

2020
const gqlClient = new SuiGraphQLClient({
21-
url: 'https://sui-testnet.mystenlabs.com/graphql',
21+
url: 'https://graphql.testnet.sui.io/graphql',
2222
});
2323

2424
const chainIdentifierQuery = graphql(`

0 commit comments

Comments
 (0)