Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
363 changes: 363 additions & 0 deletions ATTESTATION-INTEGRATION.md

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions app/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@
# Example:
# SERVERVAR="foo"
# NEXT_PUBLIC_CLIENTVAR="bar"

# Optional: point ALL networks at a local stack (a localnet + the attestation
# demo server) so the app doesn't depend on live Sui infra. Leave unset for
# production. See ATTESTATION-INTEGRATION.md.
# NEXT_PUBLIC_LOCAL_RPC_URL="http://127.0.0.1:9000"
# NEXT_PUBLIC_LOCAL_MVR_ENDPOINT="http://127.0.0.1:8000"
39 changes: 27 additions & 12 deletions app/src/components/providers/client-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export type Clients = {
};

// gRPC (gRPC-web) full node endpoints. Swap to a preferred / higher-rate-limit
// gRPC endpoint if needed (the previous JSON-RPC setup pointed at suins-rpc.*.sui.io).
// gRPC endpoint if needed.
const GRPC_URLS = {
mainnet: "https://fullnode.mainnet.sui.io:443",
testnet: "https://fullnode.testnet.sui.io:443",
Expand All @@ -43,30 +43,42 @@ const MVR_ENDPOINTS = {
testnet: "https://testnet.mvr.mystenlabs.com",
};

// When set (the local demo stack — a localnet + the attestation demo server),
// ALL networks are pointed at it so the app does not depend on live Sui infra.
// NEXT_PUBLIC_LOCAL_RPC_URL now holds the localnet *gRPC* base URL (the JSON-RPC
// port is gone post-migration). Unset in production, where the per-network
// defaults apply. See ATTESTATION-INTEGRATION.md.
const LOCAL_GRPC = process.env.NEXT_PUBLIC_LOCAL_RPC_URL;
const LOCAL_MVR = process.env.NEXT_PUBLIC_LOCAL_MVR_ENDPOINT;
const LOCAL_GRAPHQL = process.env.NEXT_PUBLIC_LOCAL_GRAPHQL;

// gRPC clients resolve `@mvr/...` named packages during transaction building via
// the `mvr` option (replaces the old `namedPackagesPlugin`).
const mainnet = new SuiGrpcClient({
network: "mainnet",
baseUrl: GRPC_URLS.mainnet,
mvr: { url: MVR_ENDPOINTS.mainnet },
baseUrl: LOCAL_GRPC ?? GRPC_URLS.mainnet,
mvr: { url: LOCAL_MVR ?? MVR_ENDPOINTS.mainnet },
});

const mainnetGraphql = new SuiGraphQLClient({
url: "https://graphql.mainnet.sui.io/graphql",
url: LOCAL_GRAPHQL ?? "https://graphql.mainnet.sui.io/graphql",
network: "mainnet",
});

export const DefaultClients: Clients = {
mainnet,
testnet: new SuiGrpcClient({
network: "testnet",
baseUrl: GRPC_URLS.testnet,
mvr: { url: MVR_ENDPOINTS.testnet },
baseUrl: LOCAL_GRPC ?? GRPC_URLS.testnet,
mvr: { url: LOCAL_MVR ?? MVR_ENDPOINTS.testnet },
}),
devnet: new SuiGrpcClient({
network: "devnet",
baseUrl: LOCAL_GRPC ?? GRPC_URLS.devnet,
}),
devnet: new SuiGrpcClient({ network: "devnet", baseUrl: GRPC_URLS.devnet }),
localnet: new SuiGrpcClient({
network: "localnet",
baseUrl: GRPC_URLS.localnet,
baseUrl: LOCAL_GRPC ?? GRPC_URLS.localnet,
}),
kiosk: {
// kiosk 1.x's KioskCompatibleClient is JSON-RPC | GraphQL (not gRPC), so the
Expand All @@ -79,14 +91,17 @@ export const DefaultClients: Clients = {
graphql: {
mainnet: mainnetGraphql,
testnet: new SuiGraphQLClient({
url: "https://graphql.testnet.sui.io/graphql",
url: LOCAL_GRAPHQL ?? "https://graphql.testnet.sui.io/graphql",
network: "testnet",
}),
},
mvrEndpoints: MVR_ENDPOINTS,
mvrEndpoints: {
mainnet: LOCAL_MVR ?? MVR_ENDPOINTS.mainnet,
testnet: LOCAL_MVR ?? MVR_ENDPOINTS.testnet,
},
mvrExperimentalEndpoints: {
mainnet: "https://qa.mainnet.mvr.mystenlabs.com",
testnet: "https://qa.testnet.mvr.mystenlabs.com",
mainnet: LOCAL_MVR ?? "https://qa.mainnet.mvr.mystenlabs.com",
testnet: LOCAL_MVR ?? "https://qa.testnet.mvr.mystenlabs.com",
},
};

Expand Down
Loading