@evefrontier/dapp-kit 0.1.9 → 0.2.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -25
- package/dist/config/dapp-kit.d.ts +4 -0
- package/dist/config/dapp-kit.d.ts.map +1 -0
- package/dist/config/dapp-kit.js +14 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +1 -0
- package/dist/graphql/client.d.ts +277 -0
- package/dist/graphql/client.d.ts.map +1 -0
- package/dist/graphql/client.js +346 -0
- package/dist/graphql/index.d.ts +4 -0
- package/dist/graphql/index.d.ts.map +1 -0
- package/dist/graphql/index.js +16 -0
- package/dist/graphql/queries.d.ts +103 -0
- package/dist/graphql/queries.d.ts.map +1 -0
- package/{graphql/queries.ts → dist/graphql/queries.js} +113 -223
- package/dist/graphql/types.d.ts +396 -0
- package/dist/graphql/types.d.ts.map +1 -0
- package/dist/graphql/types.js +4 -0
- package/dist/hooks/index.d.ts +10 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +8 -0
- package/dist/hooks/useCharacterDirectory.d.ts +16 -0
- package/dist/hooks/useCharacterDirectory.d.ts.map +1 -0
- package/dist/hooks/useCharacterDirectory.js +23 -0
- package/dist/hooks/useCharacterSearch.d.ts +24 -0
- package/dist/hooks/useCharacterSearch.d.ts.map +1 -0
- package/dist/hooks/useCharacterSearch.js +24 -0
- package/dist/hooks/useConnection.d.ts +51 -0
- package/dist/hooks/useConnection.d.ts.map +1 -0
- package/{hooks/useConnection.ts → dist/hooks/useConnection.js} +8 -10
- package/dist/hooks/useEntityRole.d.ts +26 -0
- package/dist/hooks/useEntityRole.d.ts.map +1 -0
- package/dist/hooks/useEntityRole.js +91 -0
- package/dist/hooks/useNotification.d.ts +72 -0
- package/dist/hooks/useNotification.d.ts.map +1 -0
- package/{hooks/useNotification.ts → dist/hooks/useNotification.js} +8 -12
- package/dist/hooks/useSmartObject.d.ts +44 -0
- package/dist/hooks/useSmartObject.d.ts.map +1 -0
- package/dist/hooks/useSmartObject.js +50 -0
- package/dist/hooks/useSponsoredTransaction.d.ts +147 -0
- package/dist/hooks/useSponsoredTransaction.d.ts.map +1 -0
- package/dist/hooks/useSponsoredTransaction.js +240 -0
- package/dist/hooks/useTypeNames.d.ts +11 -0
- package/dist/hooks/useTypeNames.d.ts.map +1 -0
- package/dist/hooks/useTypeNames.js +24 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/providers/EveFrontierProvider.d.ts +23 -0
- package/dist/providers/EveFrontierProvider.d.ts.map +1 -0
- package/dist/providers/EveFrontierProvider.js +23 -0
- package/dist/providers/NotificationProvider.d.ts +14 -0
- package/dist/providers/NotificationProvider.d.ts.map +1 -0
- package/dist/providers/NotificationProvider.js +66 -0
- package/dist/providers/SmartObjectProvider.d.ts +31 -0
- package/dist/providers/SmartObjectProvider.d.ts.map +1 -0
- package/dist/providers/SmartObjectProvider.js +80 -0
- package/dist/providers/VaultProvider.d.ts +10 -0
- package/dist/providers/VaultProvider.d.ts.map +1 -0
- package/dist/providers/VaultProvider.js +79 -0
- package/dist/providers/index.d.ts +5 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +4 -0
- package/dist/providers/smartObject/useEntityData.d.ts +29 -0
- package/dist/providers/smartObject/useEntityData.d.ts.map +1 -0
- package/dist/providers/smartObject/useEntityData.js +135 -0
- package/dist/providers/smartObject/useEntitySubscription.d.ts +14 -0
- package/dist/providers/smartObject/useEntitySubscription.d.ts.map +1 -0
- package/dist/providers/smartObject/useEntitySubscription.js +58 -0
- package/dist/providers/smartObject/useObjectSelection.d.ts +11 -0
- package/dist/providers/smartObject/useObjectSelection.d.ts.map +1 -0
- package/dist/providers/smartObject/useObjectSelection.js +27 -0
- package/dist/providers/smartObject/usePollingBackstop.d.ts +18 -0
- package/dist/providers/smartObject/usePollingBackstop.d.ts.map +1 -0
- package/dist/providers/smartObject/usePollingBackstop.js +38 -0
- package/dist/types/character.d.ts +21 -0
- package/dist/types/character.d.ts.map +1 -0
- package/dist/types/character.js +1 -0
- package/dist/types/contexts.d.ts +61 -0
- package/dist/types/contexts.d.ts.map +1 -0
- package/dist/types/contexts.js +6 -0
- package/dist/types/entity.d.ts +245 -0
- package/dist/types/entity.d.ts.map +1 -0
- package/dist/types/entity.js +6 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/sponsoredTransaction.d.ts +26 -0
- package/dist/types/sponsoredTransaction.d.ts.map +1 -0
- package/dist/types/sponsoredTransaction.js +10 -0
- package/dist/types/types.d.ts +110 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/types.js +41 -0
- package/dist/types/worldApiReturnTypes.d.ts +68 -0
- package/dist/types/worldApiReturnTypes.d.ts.map +1 -0
- package/dist/types/worldApiReturnTypes.js +1 -0
- package/{utils/burnRate.ts → dist/utils/burnRate.d.ts} +4 -29
- package/dist/utils/burnRate.d.ts.map +1 -0
- package/dist/utils/burnRate.js +25 -0
- package/dist/utils/characters.d.ts +26 -0
- package/dist/utils/characters.d.ts.map +1 -0
- package/dist/utils/characters.js +84 -0
- package/dist/utils/constants.d.ts +153 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +190 -0
- package/dist/utils/datahub.d.ts +40 -0
- package/dist/utils/datahub.d.ts.map +1 -0
- package/{utils/datahub.ts → dist/utils/datahub.js} +32 -25
- package/dist/utils/entity.d.ts +58 -0
- package/dist/utils/entity.d.ts.map +1 -0
- package/dist/utils/entity.js +386 -0
- package/dist/utils/errors.d.ts +18 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +128 -0
- package/dist/utils/events/entityEvents.d.ts +44 -0
- package/dist/utils/events/entityEvents.d.ts.map +1 -0
- package/dist/utils/events/entityEvents.js +95 -0
- package/dist/utils/events/entitySubscription.d.ts +30 -0
- package/dist/utils/events/entitySubscription.d.ts.map +1 -0
- package/dist/utils/events/entitySubscription.js +84 -0
- package/dist/utils/events/graphqlEventStream.d.ts +90 -0
- package/dist/utils/events/graphqlEventStream.d.ts.map +1 -0
- package/dist/utils/events/graphqlEventStream.js +198 -0
- package/dist/utils/events/refetchScheduler.d.ts +30 -0
- package/dist/utils/events/refetchScheduler.d.ts.map +1 -0
- package/dist/utils/events/refetchScheduler.js +57 -0
- package/dist/utils/events/sseClient.d.ts +42 -0
- package/dist/utils/events/sseClient.d.ts.map +1 -0
- package/dist/utils/events/sseClient.js +97 -0
- package/dist/utils/fuel.d.ts +231 -0
- package/dist/utils/fuel.d.ts.map +1 -0
- package/dist/utils/fuel.js +652 -0
- package/dist/utils/grid.d.ts +115 -0
- package/dist/utils/grid.d.ts.map +1 -0
- package/dist/utils/grid.js +115 -0
- package/dist/utils/index.d.ts +15 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +22 -0
- package/dist/utils/inventory.d.ts +3 -0
- package/dist/utils/inventory.d.ts.map +1 -0
- package/dist/utils/inventory.js +12 -0
- package/dist/utils/logger.d.ts +25 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +228 -0
- package/dist/utils/mapping.d.ts +30 -0
- package/dist/utils/mapping.d.ts.map +1 -0
- package/dist/utils/mapping.js +73 -0
- package/dist/utils/mvr/worldTypes.d.ts +35 -0
- package/dist/utils/mvr/worldTypes.d.ts.map +1 -0
- package/dist/utils/mvr/worldTypes.js +54 -0
- package/dist/utils/role.d.ts +116 -0
- package/dist/utils/role.d.ts.map +1 -0
- package/dist/utils/role.js +120 -0
- package/dist/utils/smartObject.d.ts +24 -0
- package/dist/utils/smartObject.d.ts.map +1 -0
- package/dist/utils/smartObject.js +24 -0
- package/dist/utils/utils.d.ts +133 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/utils/utils.js +213 -0
- package/dist/wallet/features.d.ts +28 -0
- package/dist/wallet/features.d.ts.map +1 -0
- package/dist/wallet/features.js +22 -0
- package/dist/wallet/index.d.ts +9 -0
- package/dist/wallet/index.d.ts.map +1 -0
- package/dist/wallet/index.js +9 -0
- package/dist/wallet/utils.d.ts +71 -0
- package/dist/wallet/utils.d.ts.map +1 -0
- package/dist/wallet/utils.js +79 -0
- package/package.json +69 -35
- package/config/dapp-kit.ts +0 -20
- package/config/index.ts +0 -1
- package/graphql/client.ts +0 -578
- package/graphql/index.ts +0 -39
- package/graphql/types.ts +0 -468
- package/hooks/index.ts +0 -15
- package/hooks/useSmartObject.ts +0 -66
- package/hooks/useSponsoredTransaction.ts +0 -442
- package/index.ts +0 -88
- package/providers/EveFrontierProvider.tsx +0 -41
- package/providers/NotificationProvider.tsx +0 -108
- package/providers/SmartObjectProvider.tsx +0 -296
- package/providers/VaultProvider.tsx +0 -108
- package/providers/index.ts +0 -10
- package/types/contexts.ts +0 -67
- package/types/global.d.ts +0 -7
- package/types/index.ts +0 -4
- package/types/sponsoredTransaction.ts +0 -70
- package/types/types.ts +0 -198
- package/types/worldApiReturnTypes.ts +0 -144
- package/utils/__tests__/burnRate.test.ts +0 -121
- package/utils/__tests__/character.test.ts +0 -112
- package/utils/__tests__/characterOwnedObjects.test.ts +0 -225
- package/utils/__tests__/config.test.ts +0 -424
- package/utils/__tests__/datahub.test.ts +0 -58
- package/utils/__tests__/logger.test.ts +0 -145
- package/utils/__tests__/mapping.test.ts +0 -439
- package/utils/__tests__/utils.test.ts +0 -299
- package/utils/character.ts +0 -46
- package/utils/characterOwnedObjects.ts +0 -53
- package/utils/config.ts +0 -151
- package/utils/constants.ts +0 -254
- package/utils/errors.ts +0 -171
- package/utils/index.ts +0 -47
- package/utils/logger.ts +0 -300
- package/utils/mapping.ts +0 -118
- package/utils/transforms.ts +0 -263
- package/utils/utils.ts +0 -270
- package/wallet/features.ts +0 -136
- package/wallet/index.ts +0 -26
- package/wallet/utils.ts +0 -117
package/README.md
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
React SDK for building EVE Frontier dApps on the Sui blockchain.
|
|
4
4
|
|
|
5
|
-
**Full API documentation (TypeDoc): [
|
|
5
|
+
**Full API documentation (TypeDoc): [https://sui-docs.evefrontier.com/](https://sui-docs.evefrontier.com/)**
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
10
|
+
bun add @evefrontier/dapp-kit
|
|
11
11
|
# peer deps
|
|
12
|
-
|
|
12
|
+
bun add @tanstack/react-query react
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
> Keep your app’s versions of **react**, **@mysten/dapp-kit-react**, and **@mysten/sui** in sync with the versions used by this package to avoid type or runtime mismatches. Check `package.json` for the current ranges.
|
|
15
|
+
> Keep your app’s versions of **react**, **@mysten/dapp-kit-core**, **@mysten/dapp-kit-react**, and **@mysten/sui** in sync with the versions used by this package to avoid type or runtime mismatches. Check `package.json` for the current ranges.
|
|
16
16
|
|
|
17
17
|
## Quick start
|
|
18
18
|
|
|
@@ -20,46 +20,49 @@ pnpm add @tanstack/react-query react
|
|
|
20
20
|
2. Use `useConnection`, `useSmartObject`, `useNotification`, and `useSponsoredTransaction` as needed.
|
|
21
21
|
|
|
22
22
|
```tsx
|
|
23
|
-
import {
|
|
24
|
-
|
|
23
|
+
import {
|
|
24
|
+
EveFrontierProvider,
|
|
25
|
+
useConnection,
|
|
26
|
+
useSmartObject,
|
|
27
|
+
} from '@evefrontier/dapp-kit'
|
|
28
|
+
import { QueryClient } from '@tanstack/react-query'
|
|
25
29
|
|
|
26
|
-
const queryClient = new QueryClient()
|
|
30
|
+
const queryClient = new QueryClient()
|
|
27
31
|
|
|
28
32
|
function App() {
|
|
29
33
|
return (
|
|
30
34
|
<EveFrontierProvider queryClient={queryClient}>
|
|
31
35
|
<MyDapp />
|
|
32
36
|
</EveFrontierProvider>
|
|
33
|
-
)
|
|
37
|
+
)
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
function MyDapp() {
|
|
37
|
-
const { isConnected, handleConnect } = useConnection()
|
|
38
|
-
const {
|
|
39
|
-
if (!isConnected) return <button onClick={handleConnect}>Connect</button
|
|
40
|
-
if (loading) return <div>Loading...</div
|
|
41
|
-
return <div>{
|
|
41
|
+
const { isConnected, handleConnect } = useConnection()
|
|
42
|
+
const { entity, loading } = useSmartObject()
|
|
43
|
+
if (!isConnected) return <button onClick={handleConnect}>Connect</button>
|
|
44
|
+
if (loading) return <div>Loading...</div>
|
|
45
|
+
return <div>{entity?.name}</div>
|
|
42
46
|
}
|
|
43
47
|
```
|
|
44
48
|
|
|
45
|
-
Configure
|
|
49
|
+
Configure the world tier via `VITE_EVE_WORLD_TIER` (`dev` | `test` | `uat` | `ptu` | `live`), or override the GraphQL endpoint with `VITE_SUI_GRAPHQL_SUBSCRIPTION_URL`. Choose the object via `VITE_OBJECT_ID` (a Sui object ID) or URL params (`?itemId=...&tenant=...`). `EveFrontierProvider` accepts an optional `updateTransport` prop (`'subscription'` | `'polling'`, default `'subscription'`).
|
|
46
50
|
|
|
47
51
|
Install the package once; then import only what you need via subpaths.
|
|
48
52
|
|
|
49
|
-
| Subpath
|
|
50
|
-
|
|
51
|
-
| `@evefrontier/dapp-kit`
|
|
52
|
-
| `@evefrontier/dapp-kit/graphql`
|
|
53
|
-
| `@evefrontier/dapp-kit/types`
|
|
54
|
-
| `@evefrontier/dapp-kit/utils`
|
|
55
|
-
| `@evefrontier/dapp-kit/hooks`
|
|
56
|
-
| `@evefrontier/dapp-kit/providers` | Providers only
|
|
57
|
-
| `@evefrontier/dapp-kit/config`
|
|
58
|
-
|
|
53
|
+
| Subpath | Use when you need |
|
|
54
|
+
| --------------------------------- | ------------------------------------------- |
|
|
55
|
+
| `@evefrontier/dapp-kit` | Default: providers, hooks, types, utils |
|
|
56
|
+
| `@evefrontier/dapp-kit/graphql` | GraphQL client, queries, and response types |
|
|
57
|
+
| `@evefrontier/dapp-kit/types` | Type definitions only |
|
|
58
|
+
| `@evefrontier/dapp-kit/utils` | Utilities (parsing, transforms, config) |
|
|
59
|
+
| `@evefrontier/dapp-kit/hooks` | Hooks only |
|
|
60
|
+
| `@evefrontier/dapp-kit/providers` | Providers only |
|
|
61
|
+
| `@evefrontier/dapp-kit/config` | Config / dApp kit setup |
|
|
59
62
|
|
|
60
63
|
## More
|
|
61
64
|
|
|
62
|
-
Hooks, types, GraphQL helpers, utilities, and wallet APIs are documented at **[
|
|
65
|
+
Hooks, types, GraphQL helpers, utilities, and wallet APIs are documented at **[https://sui-docs.evefrontier.com/](https://sui-docs.evefrontier.com/)**.
|
|
63
66
|
|
|
64
67
|
## License
|
|
65
68
|
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
2
|
+
/** DApp Kit instance for Sui wallet and network. @category Config */
|
|
3
|
+
export declare const dAppKit: import("@mysten/dapp-kit-core").DAppKit<("devnet" | "mainnet" | "testnet")[], SuiGrpcClient>;
|
|
4
|
+
//# sourceMappingURL=dapp-kit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dapp-kit.d.ts","sourceRoot":"","sources":["../../config/dapp-kit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAOhD,qEAAqE;AACrE,eAAO,MAAM,OAAO,8FAQlB,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createDAppKit } from '@mysten/dapp-kit-react';
|
|
2
|
+
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
3
|
+
import { SUI_GRPC_URLS } from '../utils/constants.js';
|
|
4
|
+
const SUPPORTED_NETWORKS = Object.keys(SUI_GRPC_URLS);
|
|
5
|
+
/** DApp Kit instance for Sui wallet and network. @category Config */
|
|
6
|
+
export const dAppKit = createDAppKit({
|
|
7
|
+
networks: SUPPORTED_NETWORKS,
|
|
8
|
+
createClient(network) {
|
|
9
|
+
return new SuiGrpcClient({
|
|
10
|
+
network,
|
|
11
|
+
baseUrl: SUI_GRPC_URLS[network],
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { dAppKit } from './dapp-kit.js';
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import type { GetEntityResponse, GetEventsByTypeResponse, GetObjectByAddressResponse, GetObjectLatestVersionResponse, GetObjectOwnerAndOwnedObjectsResponse, GetObjectOwnerAndOwnedObjectsWithJsonResponse, GetObjectOwnerResponse, GetObjectResponse, GetObjectsByTypeResponse, GetObjectWithJsonResponse, GetOwnedObjectsByPackageResponse, GetOwnedObjectsByTypeResponse, GetSingletonObjectByTypeResponse, GetTableEntriesResponse, GraphQLResponse } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Execute a GraphQL query against the Sui blockchain endpoint.
|
|
4
|
+
*
|
|
5
|
+
* This is the low-level function used by all other GraphQL helper functions.
|
|
6
|
+
* Use this when you need to execute custom queries not covered by the helper functions.
|
|
7
|
+
*
|
|
8
|
+
* @category GraphQL Client
|
|
9
|
+
* @typeParam T - The expected response data type
|
|
10
|
+
* @param query - The GraphQL query string
|
|
11
|
+
* @param variables - Variables to pass to the query
|
|
12
|
+
* @returns Promise resolving to the GraphQL response
|
|
13
|
+
* @throws {Error} If the HTTP request fails
|
|
14
|
+
*
|
|
15
|
+
* @example Custom query
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const result = await executeGraphQLQuery<MyResponseType>(
|
|
18
|
+
* `query GetObject($address: SuiAddress!) {
|
|
19
|
+
* object(address: $address) {
|
|
20
|
+
* asMoveObject { contents { json } }
|
|
21
|
+
* }
|
|
22
|
+
* }`,
|
|
23
|
+
* { address: "0x123..." }
|
|
24
|
+
* );
|
|
25
|
+
* console.log(result.data?.object?.asMoveObject?.contents?.json);
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function executeGraphQLQuery<T = unknown>(query: string, variables: Record<string, unknown>): Promise<GraphQLResponse<T>>;
|
|
29
|
+
/**
|
|
30
|
+
* Fetch a Sui object by its address with BCS-encoded contents.
|
|
31
|
+
*
|
|
32
|
+
* Use this for low-level object access when you need raw BCS data.
|
|
33
|
+
* For JSON-decoded data, use {@link getObjectWithJson} instead.
|
|
34
|
+
*
|
|
35
|
+
* @category GraphQL Client
|
|
36
|
+
* @param address - The Sui object address (0x...)
|
|
37
|
+
* @returns Promise resolving to object with BCS contents
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* const result = await getObjectByAddress("0x123...");
|
|
42
|
+
* const bcsData = result.data?.object?.asMoveObject?.contents?.bcs;
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function getObjectByAddress(address: string): Promise<GraphQLResponse<GetObjectByAddressResponse>>;
|
|
46
|
+
/**
|
|
47
|
+
* Fetch a Sui object with its dynamic fields in JSON format.
|
|
48
|
+
*
|
|
49
|
+
* Retrieves the object's contents and all associated dynamic fields,
|
|
50
|
+
* which is useful for assemblies that store data in dynamic fields
|
|
51
|
+
* (e.g., inventory items, configuration).
|
|
52
|
+
*
|
|
53
|
+
* @category GraphQL Client
|
|
54
|
+
* @param objectId - The Sui object ID
|
|
55
|
+
* @returns Promise resolving to object with dynamic fields
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* const result = await getObjectWithDynamicFields("0x123...");
|
|
60
|
+
* const dynamicFields = result.data?.object?.asMoveObject?.dynamicFields?.nodes;
|
|
61
|
+
* dynamicFields?.forEach(field => {
|
|
62
|
+
* console.log(field.name.json, field.contents.json);
|
|
63
|
+
* });
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export declare function getObjectWithDynamicFields(objectId: string): Promise<GraphQLResponse<GetObjectResponse>>;
|
|
67
|
+
/**
|
|
68
|
+
* Fetch a world entity: latest version, contents, and a page of its dynamic
|
|
69
|
+
* fields (components and action maps).
|
|
70
|
+
*
|
|
71
|
+
* Layout sections and inventory item tables nested in component values are
|
|
72
|
+
* resolved inline, up to `tableFirst` entries each. Page the rest with
|
|
73
|
+
* {@link getTableEntries} using the table id from the component JSON.
|
|
74
|
+
*
|
|
75
|
+
* @category GraphQL Client
|
|
76
|
+
* @param address - The entity's Sui object ID
|
|
77
|
+
* @param options - Pagination options
|
|
78
|
+
* @param options.cursor - Cursor for the next page of the entity's dynamicFields
|
|
79
|
+
* @param options.tableFirst - Max entries per nested table (default: 50)
|
|
80
|
+
* @returns Promise resolving to the entity's version, contents and dynamic fields
|
|
81
|
+
*/
|
|
82
|
+
export declare function getEntity(address: string, options?: {
|
|
83
|
+
cursor?: string;
|
|
84
|
+
tableFirst?: number;
|
|
85
|
+
}): Promise<GraphQLResponse<GetEntityResponse>>;
|
|
86
|
+
/**
|
|
87
|
+
* Fetch one page of a Move table's entries by the table's UID.
|
|
88
|
+
*
|
|
89
|
+
* @category GraphQL Client
|
|
90
|
+
* @param tableId - The table's UID (e.g. a Layout's `inner.sections.id`)
|
|
91
|
+
* @param options - Pagination options
|
|
92
|
+
* @param options.first - Number of entries per page (default: 50)
|
|
93
|
+
* @param options.after - Cursor for the next page
|
|
94
|
+
* @returns Promise resolving to a page of table entries
|
|
95
|
+
*/
|
|
96
|
+
export declare function getTableEntries(tableId: string, options?: {
|
|
97
|
+
first?: number;
|
|
98
|
+
after?: string;
|
|
99
|
+
}): Promise<GraphQLResponse<GetTableEntriesResponse>>;
|
|
100
|
+
/**
|
|
101
|
+
* Fetch only an object's latest version, to detect changes cheaply.
|
|
102
|
+
*
|
|
103
|
+
* @category GraphQL Client
|
|
104
|
+
* @param address - The Sui object ID
|
|
105
|
+
* @returns Promise resolving to the latest version node
|
|
106
|
+
*/
|
|
107
|
+
export declare function getObjectLatestVersion(address: string): Promise<GraphQLResponse<GetObjectLatestVersionResponse>>;
|
|
108
|
+
/**
|
|
109
|
+
* Fetch an object's owner.
|
|
110
|
+
*
|
|
111
|
+
* @category GraphQL Client
|
|
112
|
+
* @param address - The Sui object ID
|
|
113
|
+
* @returns Promise resolving to the owner (`__typename` plus address when owned)
|
|
114
|
+
*/
|
|
115
|
+
export declare function getObjectOwner(address: string): Promise<GraphQLResponse<GetObjectOwnerResponse>>;
|
|
116
|
+
/**
|
|
117
|
+
* Fetch a Sui object with JSON-decoded contents.
|
|
118
|
+
*
|
|
119
|
+
* This is the most common way to fetch object data when you need
|
|
120
|
+
* to read the object's fields as JavaScript objects.
|
|
121
|
+
*
|
|
122
|
+
* @category GraphQL Client
|
|
123
|
+
* @param address - The Sui object address
|
|
124
|
+
* @returns Promise resolving to object with JSON contents
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```typescript
|
|
128
|
+
* const result = await getObjectWithJson("0x123...");
|
|
129
|
+
* const json = result.data?.object?.asMoveObject?.contents?.json;
|
|
130
|
+
* console.log(json); // { id: "...", name: "...", ... }
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
export declare function getObjectWithJson(address: string): Promise<GraphQLResponse<GetObjectWithJsonResponse>>;
|
|
134
|
+
/**
|
|
135
|
+
* Get an object's owner and their owned objects of a specific type.
|
|
136
|
+
*
|
|
137
|
+
* Useful for traversing ownership chains, e.g., finding all assemblies
|
|
138
|
+
* owned by a specific character.
|
|
139
|
+
*
|
|
140
|
+
* @category GraphQL Client
|
|
141
|
+
* @param objectAddress - The Sui object address to query owner of
|
|
142
|
+
* @param ownedObjectType - Optional type filter for owned objects
|
|
143
|
+
* @returns Promise resolving to owner info and owned objects (BCS format)
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* ```typescript
|
|
147
|
+
* const result = await getObjectOwnerAndOwnedObjectsByType(
|
|
148
|
+
* "0x123...",
|
|
149
|
+
* "0xpackage::module::MyType"
|
|
150
|
+
* );
|
|
151
|
+
* const ownerAddress = result.data?.object?.owner?.address?.address;
|
|
152
|
+
* ```
|
|
153
|
+
* @deprecated Walks `object.owner`, which is empty for shared `Entity` objects. Find a wallet's entities with {@link getOwnedObjectsByType} on the `AccessCap` type instead.
|
|
154
|
+
*/
|
|
155
|
+
export declare function getObjectOwnerAndOwnedObjectsByType(objectAddress: string, ownedObjectType?: string): Promise<GraphQLResponse<GetObjectOwnerAndOwnedObjectsResponse>>;
|
|
156
|
+
/**
|
|
157
|
+
* Get an object's owner and their owned objects with JSON data.
|
|
158
|
+
*
|
|
159
|
+
* Similar to {@link getObjectOwnerAndOwnedObjectsByType} but returns
|
|
160
|
+
* JSON-decoded contents for easier consumption.
|
|
161
|
+
*
|
|
162
|
+
* @category GraphQL Client
|
|
163
|
+
* @param objectAddress - The Sui object address
|
|
164
|
+
* @param ownedObjectType - Optional type filter for owned objects
|
|
165
|
+
* @returns Promise resolving to owner info and owned objects (JSON format)
|
|
166
|
+
* @deprecated Walks `object.owner`, which is empty for shared `Entity` objects. Find a wallet's entities with {@link getOwnedObjectsByType} on the `AccessCap` type instead.
|
|
167
|
+
*/
|
|
168
|
+
export declare function getObjectOwnerAndOwnedObjectsWithJson(objectAddress: string, ownedObjectType?: string): Promise<GraphQLResponse<GetObjectOwnerAndOwnedObjectsWithJsonResponse>>;
|
|
169
|
+
/**
|
|
170
|
+
* Get all objects of a specific type owned by an address.
|
|
171
|
+
*
|
|
172
|
+
* Returns only object addresses (lightweight). Use this when you need
|
|
173
|
+
* to find objects and will fetch their details separately.
|
|
174
|
+
*
|
|
175
|
+
* @category GraphQL Client
|
|
176
|
+
* @param owner - The owner's Sui address
|
|
177
|
+
* @param objectType - Optional Move type filter (e.g., "0xpkg::module::Type")
|
|
178
|
+
* @returns Promise resolving to list of owned object addresses
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ```typescript
|
|
182
|
+
* const result = await getOwnedObjectsByType(
|
|
183
|
+
* "0xowner...",
|
|
184
|
+
* "0xworld::smart_storage_unit::SmartStorageUnit"
|
|
185
|
+
* );
|
|
186
|
+
* const addresses = result.data?.address?.objects?.nodes.map(n => n.address);
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
export declare function getOwnedObjectsByType(owner: string, objectType?: string): Promise<GraphQLResponse<GetOwnedObjectsByTypeResponse>>;
|
|
190
|
+
/**
|
|
191
|
+
* Get all objects owned by an address filtered by package.
|
|
192
|
+
*
|
|
193
|
+
* Returns full object data with dynamic fields. Use this when you need
|
|
194
|
+
* all objects from a specific package (e.g., all EVE Frontier objects).
|
|
195
|
+
*
|
|
196
|
+
* @category GraphQL Client
|
|
197
|
+
* @param owner - The owner's Sui address
|
|
198
|
+
* @param packageId - The Move package ID to filter by
|
|
199
|
+
* @returns Promise resolving to full object data including dynamic fields
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```typescript
|
|
203
|
+
* const result = await getOwnedObjectsByPackage(
|
|
204
|
+
* "0xowner...",
|
|
205
|
+
* "0xworld_package_id..."
|
|
206
|
+
* );
|
|
207
|
+
* const objects = result.data?.objects?.nodes;
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
export declare function getOwnedObjectsByPackage(owner: string, packageId: string): Promise<GraphQLResponse<GetOwnedObjectsByPackageResponse>>;
|
|
211
|
+
/**
|
|
212
|
+
* Get a singleton object by its Move type.
|
|
213
|
+
*
|
|
214
|
+
* Useful for global/singleton objects where there's only one instance
|
|
215
|
+
* of a particular type on-chain.
|
|
216
|
+
*
|
|
217
|
+
* @category GraphQL Client
|
|
218
|
+
* @param objectType - The full Move type string
|
|
219
|
+
* @returns Promise resolving to the singleton object address
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```typescript
|
|
223
|
+
* const result = await getSingletonObjectByType("0xpkg::config::GlobalConfig");
|
|
224
|
+
* const address = result.data?.objects?.nodes[0]?.address;
|
|
225
|
+
* ```
|
|
226
|
+
*/
|
|
227
|
+
export declare function getSingletonObjectByType(objectType: string): Promise<GraphQLResponse<GetSingletonObjectByTypeResponse>>;
|
|
228
|
+
/**
|
|
229
|
+
* Get all objects of a specific type with pagination.
|
|
230
|
+
*
|
|
231
|
+
* Use with caution as this may return many results. Supports cursor-based
|
|
232
|
+
* pagination for iterating through large result sets.
|
|
233
|
+
*
|
|
234
|
+
* @category GraphQL Client
|
|
235
|
+
* @param objectType - The full Move type string
|
|
236
|
+
* @param options - Pagination options
|
|
237
|
+
* @param options.first - Number of results per page (default: 50)
|
|
238
|
+
* @param options.after - Cursor for next page
|
|
239
|
+
* @returns Promise resolving to paginated object list
|
|
240
|
+
*
|
|
241
|
+
* @example Paginated fetch
|
|
242
|
+
* ```typescript
|
|
243
|
+
* let cursor: string | undefined;
|
|
244
|
+
* do {
|
|
245
|
+
* const result = await getObjectsByType("0xpkg::module::Type", {
|
|
246
|
+
* first: 50,
|
|
247
|
+
* after: cursor
|
|
248
|
+
* });
|
|
249
|
+
* const objects = result.data?.objects?.nodes;
|
|
250
|
+
* cursor = result.data?.objects?.pageInfo?.hasNextPage
|
|
251
|
+
* ? result.data?.objects?.pageInfo?.endCursor
|
|
252
|
+
* : undefined;
|
|
253
|
+
* } while (cursor);
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
export declare function getObjectsByType(objectType: string, options?: {
|
|
257
|
+
first?: number;
|
|
258
|
+
after?: string;
|
|
259
|
+
}): Promise<GraphQLResponse<GetObjectsByTypeResponse>>;
|
|
260
|
+
/**
|
|
261
|
+
* Get events of a Move event type with pagination, oldest first.
|
|
262
|
+
*
|
|
263
|
+
* Use with caution as this may return many results. Event fields cannot be
|
|
264
|
+
* filtered on, so callers page through every event of the type.
|
|
265
|
+
*
|
|
266
|
+
* @category GraphQL Client
|
|
267
|
+
* @param eventType - The full Move event type string
|
|
268
|
+
* @param options - Pagination options
|
|
269
|
+
* @param options.first - Number of results per page (default: 50)
|
|
270
|
+
* @param options.after - Cursor for next page
|
|
271
|
+
* @returns Promise resolving to paginated event list
|
|
272
|
+
*/
|
|
273
|
+
export declare function getEventsByType(eventType: string, options?: {
|
|
274
|
+
first?: number;
|
|
275
|
+
after?: string;
|
|
276
|
+
}): Promise<GraphQLResponse<GetEventsByTypeResponse>>;
|
|
277
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../graphql/client.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACvB,0BAA0B,EAC1B,8BAA8B,EAC9B,qCAAqC,EACrC,6CAA6C,EAC7C,sBAAsB,EACtB,iBAAiB,EACjB,wBAAwB,EACxB,yBAAyB,EACzB,gCAAgC,EAChC,6BAA6B,EAC7B,gCAAgC,EAChC,uBAAuB,EACvB,eAAe,EAChB,MAAM,SAAS,CAAA;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,mBAAmB,CAAC,CAAC,GAAG,OAAO,EACnD,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAkB7B;AAMD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,MAAM,wDAKvD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,+CAKhE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,SAAS,CAC7B,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,+CAOnD;AAED;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,qDAO7C;AAED;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,MAAM,4DAK3D;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,MAAM,oDAInD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,MAAM,uDAItD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,mCAAmC,CACvD,aAAa,EAAE,MAAM,EACrB,eAAe,CAAC,EAAE,MAAM,mEASzB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,qCAAqC,CACzD,aAAa,EAAE,MAAM,EACrB,eAAe,CAAC,EAAE,MAAM,2EASzB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,MAAM,EACb,UAAU,CAAC,EAAE,MAAM,2DASpB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,wBAAwB,CAC5C,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,8DASlB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,wBAAwB,CAAC,UAAU,EAAE,MAAM,8DAOhE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,gBAAgB,CACpC,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,sDAO7C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CACnC,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3C,OAAO,CAAC,eAAe,CAAC,uBAAuB,CAAC,CAAC,CAMnD"}
|