@evefrontier/dapp-kit 0.1.2 → 0.1.5

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.
Files changed (184) hide show
  1. package/README.md +13 -0
  2. package/graphql/client.ts +96 -24
  3. package/graphql/index.ts +5 -39
  4. package/graphql/queries.ts +157 -1
  5. package/graphql/types.ts +188 -155
  6. package/hooks/index.ts +1 -0
  7. package/hooks/useSponsoredTransaction.ts +11 -4
  8. package/index.ts +7 -71
  9. package/package.json +11 -1
  10. package/providers/SmartObjectProvider.tsx +17 -17
  11. package/types/contexts.ts +1 -1
  12. package/types/sponsoredTransaction.ts +9 -0
  13. package/types/types.ts +52 -10
  14. package/types/worldApiReturnTypes.ts +13 -37
  15. package/utils/__tests__/burnRate.test.ts +121 -0
  16. package/utils/__tests__/character.test.ts +112 -0
  17. package/utils/__tests__/characterOwnedObjects.test.ts +222 -0
  18. package/utils/__tests__/config.test.ts +424 -0
  19. package/utils/__tests__/mapping.test.ts +2 -2
  20. package/utils/burnRate.ts +46 -0
  21. package/utils/character.ts +46 -0
  22. package/utils/characterOwnedObjects.ts +52 -0
  23. package/utils/config.ts +151 -0
  24. package/utils/constants.ts +39 -5
  25. package/utils/datahub.ts +3 -41
  26. package/utils/errors.ts +1 -1
  27. package/utils/index.ts +10 -1
  28. package/utils/mapping.ts +5 -2
  29. package/utils/transforms.ts +27 -31
  30. package/wallet/features.ts +5 -5
  31. package/CHANGELOG.md +0 -13
  32. package/docs/api/.nojekyll +0 -1
  33. package/docs/api/assets/hierarchy.js +0 -1
  34. package/docs/api/assets/highlight.css +0 -120
  35. package/docs/api/assets/icons.js +0 -18
  36. package/docs/api/assets/icons.svg +0 -1
  37. package/docs/api/assets/main.js +0 -60
  38. package/docs/api/assets/navigation.js +0 -1
  39. package/docs/api/assets/search.js +0 -1
  40. package/docs/api/assets/style.css +0 -1633
  41. package/docs/api/classes/WalletNoAccountSelectedError.html +0 -3
  42. package/docs/api/classes/WalletNotConnectedError.html +0 -3
  43. package/docs/api/classes/WalletSponsoredTransactionNotSupportedError.html +0 -5
  44. package/docs/api/enums/ActionTypes.html +0 -6
  45. package/docs/api/enums/Assemblies.html +0 -7
  46. package/docs/api/enums/QueryParams.html +0 -3
  47. package/docs/api/enums/Severity.html +0 -5
  48. package/docs/api/enums/SponsoredTransactionActions.html +0 -7
  49. package/docs/api/enums/State.html +0 -6
  50. package/docs/api/enums/SupportedWallets.html +0 -3
  51. package/docs/api/enums/TYPEIDS.html +0 -15
  52. package/docs/api/functions/EveFrontierProvider.html +0 -11
  53. package/docs/api/functions/NotificationProvider.html +0 -2
  54. package/docs/api/functions/SmartObjectProvider.html +0 -10
  55. package/docs/api/functions/VaultProvider.html +0 -1
  56. package/docs/api/functions/abbreviateAddress.html +0 -11
  57. package/docs/api/functions/assertAssemblyType.html +0 -9
  58. package/docs/api/functions/clickToCopy.html +0 -1
  59. package/docs/api/functions/executeGraphQLQuery.html +0 -12
  60. package/docs/api/functions/findOwnerByAddress.html +0 -5
  61. package/docs/api/functions/formatDuration.html +0 -8
  62. package/docs/api/functions/formatM3.html +0 -8
  63. package/docs/api/functions/getAssemblyType.html +0 -4
  64. package/docs/api/functions/getAssemblyTypeApiString.html +0 -2
  65. package/docs/api/functions/getAssemblyWithOwner.html +0 -18
  66. package/docs/api/functions/getCharacterOwnerCapType.html +0 -3
  67. package/docs/api/functions/getCommonItems.html +0 -1
  68. package/docs/api/functions/getDappUrl.html +0 -7
  69. package/docs/api/functions/getDatahubGameInfo.html +0 -13
  70. package/docs/api/functions/getEnv.html +0 -1
  71. package/docs/api/functions/getEveWorldPackageId.html +0 -4
  72. package/docs/api/functions/getObjectByAddress.html +0 -9
  73. package/docs/api/functions/getObjectId.html +0 -4
  74. package/docs/api/functions/getObjectOwnerAndOwnedObjectsByType.html +0 -10
  75. package/docs/api/functions/getObjectRegistryType.html +0 -3
  76. package/docs/api/functions/getObjectWithDynamicFields.html +0 -10
  77. package/docs/api/functions/getObjectWithJson.html +0 -9
  78. package/docs/api/functions/getObjectsByType.html +0 -12
  79. package/docs/api/functions/getOwnedObjectsByPackage.html +0 -10
  80. package/docs/api/functions/getOwnedObjectsByType.html +0 -10
  81. package/docs/api/functions/getRegistryAddress.html +0 -3
  82. package/docs/api/functions/getSingletonObjectByType.html +0 -9
  83. package/docs/api/functions/getSponsoredTransactionFeature.html +0 -11
  84. package/docs/api/functions/getSuiGraphqlEndpoint.html +0 -4
  85. package/docs/api/functions/getTxUrl.html +0 -8
  86. package/docs/api/functions/getVolumeM3.html +0 -5
  87. package/docs/api/functions/hasSponsoredTransactionFeature.html +0 -3
  88. package/docs/api/functions/isOwner.html +0 -10
  89. package/docs/api/functions/parseErrorFromMessage.html +0 -1
  90. package/docs/api/functions/parseStatus.html +0 -2
  91. package/docs/api/functions/parseURL.html +0 -1
  92. package/docs/api/functions/removeTrailingZeros.html +0 -1
  93. package/docs/api/functions/transformToAssembly.html +0 -5
  94. package/docs/api/functions/transformToCharacter.html +0 -2
  95. package/docs/api/functions/useConnection.html +0 -21
  96. package/docs/api/functions/useNotification.html +0 -28
  97. package/docs/api/functions/useSmartObject.html +0 -21
  98. package/docs/api/functions/useSponsoredTransaction.html +0 -50
  99. package/docs/api/functions/walletSupportsSponsoredTransaction.html +0 -13
  100. package/docs/api/hierarchy.html +0 -1
  101. package/docs/api/index.html +0 -24
  102. package/docs/api/interfaces/AddressOwner.html +0 -2
  103. package/docs/api/interfaces/AddressOwnerWithJson.html +0 -2
  104. package/docs/api/interfaces/AssemblyProperties.html +0 -14
  105. package/docs/api/interfaces/CharacterInfo.html +0 -8
  106. package/docs/api/interfaces/DatahubGameInfo.html +0 -30
  107. package/docs/api/interfaces/DetailedAssemblyResponse.html +0 -14
  108. package/docs/api/interfaces/DetailedSmartCharacterResponse.html +0 -7
  109. package/docs/api/interfaces/DynamicFieldNode.html +0 -3
  110. package/docs/api/interfaces/EphemeralInventory.html +0 -6
  111. package/docs/api/interfaces/EveFrontierSponsoredTransactionFeature.html +0 -7
  112. package/docs/api/interfaces/GameTypeResponse.html +0 -13
  113. package/docs/api/interfaces/GateModule.html +0 -5
  114. package/docs/api/interfaces/GetObjectByAddressResponse.html +0 -2
  115. package/docs/api/interfaces/GetObjectOwnerAndOwnedObjectsResponse.html +0 -2
  116. package/docs/api/interfaces/GetObjectOwnerAndOwnedObjectsWithJsonResponse.html +0 -2
  117. package/docs/api/interfaces/GetObjectResponse.html +0 -2
  118. package/docs/api/interfaces/GetObjectWithJsonResponse.html +0 -2
  119. package/docs/api/interfaces/GetObjectsByTypeResponse.html +0 -2
  120. package/docs/api/interfaces/GetOwnedObjectsByPackageResponse.html +0 -2
  121. package/docs/api/interfaces/GetOwnedObjectsByTypeResponse.html +0 -2
  122. package/docs/api/interfaces/GetSingletonObjectByTypeResponse.html +0 -2
  123. package/docs/api/interfaces/GraphQLResponse.html +0 -3
  124. package/docs/api/interfaces/InventoryItem.html +0 -8
  125. package/docs/api/interfaces/ManufacturingModule.html +0 -2
  126. package/docs/api/interfaces/MoveObjectContents.html +0 -4
  127. package/docs/api/interfaces/MoveObjectData.html +0 -3
  128. package/docs/api/interfaces/NetworkNodeModule.html +0 -6
  129. package/docs/api/interfaces/NotificationContextType.html +0 -4
  130. package/docs/api/interfaces/NotificationState.html +0 -6
  131. package/docs/api/interfaces/Notify.html +0 -6
  132. package/docs/api/interfaces/ObjectWithContentsNode.html +0 -4
  133. package/docs/api/interfaces/OwnedObjectAddressNode.html +0 -2
  134. package/docs/api/interfaces/OwnedObjectFullNode.html +0 -4
  135. package/docs/api/interfaces/OwnedObjectNode.html +0 -3
  136. package/docs/api/interfaces/OwnedObjectNodeWithJson.html +0 -4
  137. package/docs/api/interfaces/OwnerCapData.html +0 -5
  138. package/docs/api/interfaces/PageInfo.html +0 -3
  139. package/docs/api/interfaces/RawCharacterData.html +0 -8
  140. package/docs/api/interfaces/RawSuiObjectData.html +0 -21
  141. package/docs/api/interfaces/RefineryModule.html +0 -2
  142. package/docs/api/interfaces/SmartAssemblyResponse.html +0 -11
  143. package/docs/api/interfaces/SmartObjectContextType.html +0 -7
  144. package/docs/api/interfaces/SponsoredTransactionInput.html +0 -14
  145. package/docs/api/interfaces/SponsoredTransactionOutput.html +0 -8
  146. package/docs/api/interfaces/StorageModule.html +0 -4
  147. package/docs/api/interfaces/SuiObjectResponse.html +0 -5
  148. package/docs/api/interfaces/TransformOptions.html +0 -8
  149. package/docs/api/interfaces/TurretModule.html +0 -2
  150. package/docs/api/interfaces/VaultContextType.html +0 -8
  151. package/docs/api/modules.html +0 -1
  152. package/docs/api/types/AssemblyType.html +0 -1
  153. package/docs/api/types/ErrorType.html +0 -5
  154. package/docs/api/types/SendSponsoredTransactionFn.html +0 -1
  155. package/docs/api/types/SponsoredTransactionArgs.html +0 -2
  156. package/docs/api/types/SponsoredTransactionAssemblyType.html +0 -2
  157. package/docs/api/types/SponsoredTransactionMethod.html +0 -2
  158. package/docs/api/types/UseSponsoredTransactionArgs.html +0 -3
  159. package/docs/api/types/UseSponsoredTransactionError.html +0 -2
  160. package/docs/api/types/UseSponsoredTransactionMutationOptions.html +0 -2
  161. package/docs/api/variables/ASSEMBLY_TYPE_API_STRING.html +0 -2
  162. package/docs/api/variables/ERRORS.html +0 -1
  163. package/docs/api/variables/ERROR_MESSAGES.html +0 -1
  164. package/docs/api/variables/EVEFRONTIER_SPONSORED_TRANSACTION.html +0 -4
  165. package/docs/api/variables/EXCLUDED_TYPEIDS.html +0 -1
  166. package/docs/api/variables/GET_OBJECTS_BY_TYPE.html +0 -3
  167. package/docs/api/variables/GET_OBJECT_BY_ADDRESS.html +0 -3
  168. package/docs/api/variables/GET_OBJECT_OWNER_AND_OWNED_OBJECTS_BY_TYPE.html +0 -4
  169. package/docs/api/variables/GET_OBJECT_OWNER_AND_OWNED_OBJECTS_WITH_JSON.html +0 -3
  170. package/docs/api/variables/GET_OBJECT_WITH_DYNAMIC_FIELDS.html +0 -4
  171. package/docs/api/variables/GET_OBJECT_WITH_JSON.html +0 -3
  172. package/docs/api/variables/GET_OWNED_OBJECTS_BY_PACKAGE.html +0 -3
  173. package/docs/api/variables/GET_OWNED_OBJECTS_BY_TYPE.html +0 -3
  174. package/docs/api/variables/GET_SINGLETON_OBJECT_BY_TYPE.html +0 -3
  175. package/docs/api/variables/NotificationContext.html +0 -1
  176. package/docs/api/variables/ONE_M3.html +0 -2
  177. package/docs/api/variables/POLLING_INTERVAL.html +0 -2
  178. package/docs/api/variables/STORAGE_KEYS.html +0 -2
  179. package/docs/api/variables/SmartObjectContext.html +0 -1
  180. package/docs/api/variables/VaultContext.html +0 -1
  181. package/docs/api/variables/dAppKit.html +0 -2
  182. package/tsconfig.json +0 -22
  183. package/typedoc.json +0 -38
  184. package/vite-env.d.ts +0 -14
package/README.md CHANGED
@@ -44,6 +44,19 @@ function MyDapp() {
44
44
 
45
45
  Configure assembly via env (`VITE_OBJECT_ID`, as Sui Object ID) or URL (`?itemId=...&tenant=...`, derived).
46
46
 
47
+ Install the package once; then import only what you need via subpaths.
48
+
49
+ | Subpath | Use when you need |
50
+ |--------|--------------------|
51
+ | `@evefrontier/dapp-kit` | Default: providers, hooks, types, utils |
52
+ | `@evefrontier/dapp-kit/graphql` | GraphQL client, queries, and response types |
53
+ | `@evefrontier/dapp-kit/types` | Type definitions only |
54
+ | `@evefrontier/dapp-kit/utils` | Utilities (parsing, transforms, config) |
55
+ | `@evefrontier/dapp-kit/hooks` | Hooks only |
56
+ | `@evefrontier/dapp-kit/providers` | Providers only |
57
+ | `@evefrontier/dapp-kit/config` | Config / dApp kit setup |
58
+
59
+
47
60
  ## More
48
61
 
49
62
  Hooks, types, GraphQL helpers, utilities, and wallet APIs are documented at **[http://sui-docs.evefrontier.com/](http://sui-docs.evefrontier.com/)**.
package/graphql/client.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  getCharacterOwnerCapType,
3
+ getCharacterPlayerProfileType,
3
4
  getSuiGraphqlEndpoint,
4
5
  } from "../utils/constants";
5
6
  import type {
@@ -13,12 +14,15 @@ import type {
13
14
  GetObjectsByTypeResponse,
14
15
  GetObjectResponse,
15
16
  GetObjectWithJsonResponse,
16
- RawCharacterData,
17
17
  CharacterInfo,
18
18
  GetObjectAndCharacterOwnerResponse,
19
19
  DynamicFieldNode,
20
20
  RawSuiObjectData,
21
+ GetSingletonConfigObjectByTypeResponse,
22
+ GetWalletCharactersResponse,
23
+ GetCharacterAndOwnedObjectsResponse,
21
24
  } from "./types";
25
+ import { parseCharacterFromJson } from "../utils/character";
22
26
  import {
23
27
  GET_OBJECT_BY_ADDRESS,
24
28
  GET_OBJECT_WITH_DYNAMIC_FIELDS,
@@ -27,9 +31,12 @@ import {
27
31
  GET_OBJECT_OWNER_AND_OWNED_OBJECTS_WITH_JSON,
28
32
  GET_OWNED_OBJECTS_BY_TYPE,
29
33
  GET_OWNED_OBJECTS_BY_PACKAGE,
34
+ GET_WALLET_CHARACTERS,
35
+ GET_CHARACTER_AND_OWNED_OBJECTS,
30
36
  GET_SINGLETON_OBJECT_BY_TYPE,
31
37
  GET_OBJECTS_BY_TYPE,
32
38
  GET_OBJECT_WITH_JSON,
39
+ GET_SINGLETON_CONFIG_OBJECT_BY_TYPE,
33
40
  } from "./queries";
34
41
 
35
42
  /**
@@ -301,6 +308,38 @@ export async function getOwnedObjectsByPackage(
301
308
  );
302
309
  }
303
310
 
311
+ /**
312
+ * Get all characters owned by a wallet
313
+ * Returns the most recent character owned by the wallet
314
+ *
315
+ * @category GraphQL
316
+ */
317
+ export async function getWalletCharacters(wallet: string) {
318
+ return executeGraphQLQuery<GetWalletCharactersResponse>(
319
+ GET_WALLET_CHARACTERS,
320
+ {
321
+ owner: wallet,
322
+ characterPlayerProfileType: getCharacterPlayerProfileType(),
323
+ },
324
+ );
325
+ }
326
+
327
+ /**
328
+ * Get all characters owned by a wallet
329
+ * Returns the characters owned by the wallet
330
+ *
331
+ * @category GraphQL
332
+ */
333
+ export async function getCharacterAndOwnedObjects(wallet: string) {
334
+ return executeGraphQLQuery<GetCharacterAndOwnedObjectsResponse>(
335
+ GET_CHARACTER_AND_OWNED_OBJECTS,
336
+ {
337
+ owner: wallet,
338
+ characterPlayerProfileType: getCharacterPlayerProfileType(),
339
+ },
340
+ );
341
+ }
342
+
304
343
  /**
305
344
  * Get a singleton object by its Move type.
306
345
  *
@@ -326,6 +365,37 @@ export async function getSingletonObjectByType(objectType: string) {
326
365
  );
327
366
  }
328
367
 
368
+ /**
369
+ * Get a singleton config object by its Move type and table name, with dynamic fields.
370
+ *
371
+ * Used for on-chain config singletons (e.g. EnergyConfig, FuelConfig) that expose
372
+ * a table of key/value entries via dynamic fields. Returns the first object's full
373
+ * response including contents.extract...addressAt.dynamicFields.nodes.
374
+ *
375
+ * @category GraphQL
376
+ * @param objectType - The full Move type string (e.g. from getEnergyConfigType())
377
+ * @param tableName - The table path for extract (e.g. "assembly_energy", "fuel_efficiency")
378
+ * @returns Promise resolving to the GraphQL response with objects.nodes[0] and dynamicFields.nodes
379
+ *
380
+ * @example
381
+ * ```typescript
382
+ * const result = await getSingletonConfigObjectByType(getEnergyConfigType(), "assembly_energy");
383
+ * const nodes = result.data?.objects?.nodes[0]?.asMoveObject?.contents?.extract?.extract?.asAddress?.addressAt?.dynamicFields?.nodes;
384
+ * ```
385
+ */
386
+ export async function getSingletonConfigObjectByType(
387
+ objectType: string,
388
+ tableName: string,
389
+ ) {
390
+ return executeGraphQLQuery<GetSingletonConfigObjectByTypeResponse>(
391
+ GET_SINGLETON_CONFIG_OBJECT_BY_TYPE,
392
+ {
393
+ object_type: objectType,
394
+ table_name: tableName,
395
+ },
396
+ );
397
+ }
398
+
329
399
  /**
330
400
  * Get all objects of a specific type with pagination.
331
401
  *
@@ -413,15 +483,21 @@ export async function getAssemblyWithOwner(assemblyId: string): Promise<{
413
483
  nodes: DynamicFieldNode[];
414
484
  };
415
485
  } | null;
416
- character: CharacterInfo | null;
486
+ assemblyOwner: CharacterInfo | null;
417
487
  energySource: RawSuiObjectData | null;
488
+ destinationGate: RawSuiObjectData | null;
418
489
  }> {
419
490
  try {
420
491
  const result = await getObjectAndCharacterOwner(assemblyId);
421
492
 
422
493
  if (!result.data?.object?.asMoveObject) {
423
494
  console.warn("[DappKit] getAssemblyWithOwner: Assembly not found");
424
- return { moveObject: null, character: null, energySource: null };
495
+ return {
496
+ moveObject: null,
497
+ assemblyOwner: null,
498
+ energySource: null,
499
+ destinationGate: null,
500
+ };
425
501
  }
426
502
 
427
503
  const moveObject = result.data.object.asMoveObject;
@@ -440,30 +516,15 @@ export async function getAssemblyWithOwner(assemblyId: string): Promise<{
440
516
  console.warn("[DappKit] getAssemblyWithOwner: Character not found");
441
517
  return {
442
518
  moveObject: result.data?.object?.asMoveObject,
443
- character: null,
519
+ assemblyOwner: null,
444
520
  energySource: null,
521
+ destinationGate: null,
445
522
  };
446
523
  }
447
524
 
448
525
  const characterJson = characterMoveObject?.contents.json;
449
-
450
- if (characterJson) {
451
- const rawCharacter = characterJson as RawCharacterData;
452
- characterInfo = {
453
- id: rawCharacter.id || "",
454
- address: characterJson.character_address || "",
455
- name: rawCharacter.metadata.name || "",
456
- tribeId:
457
- typeof rawCharacter.tribe_id === "string"
458
- ? parseInt(rawCharacter.tribe_id, 10)
459
- : (rawCharacter.tribe_id as number) || 0,
460
- characterId:
461
- typeof rawCharacter.key.item_id === "string"
462
- ? parseInt(rawCharacter.key.item_id, 10)
463
- : (rawCharacter.key.item_id as number) || 0,
464
- _raw: rawCharacter,
465
- };
466
- } else {
526
+ characterInfo = parseCharacterFromJson(characterJson);
527
+ if (!characterInfo) {
467
528
  console.warn(
468
529
  "[DappKit] getAssemblyWithOwner: Could not extract character JSON from owner chain",
469
530
  );
@@ -476,8 +537,13 @@ export async function getAssemblyWithOwner(assemblyId: string): Promise<{
476
537
  console.warn("[DappKit] getAssemblyWithOwner: Energy source not found");
477
538
  }
478
539
 
540
+ const destinationGateMoveObject =
541
+ moveObject.contents.destinationGate?.asAddress?.asObject?.asMoveObject;
542
+
479
543
  const energySourceJson = energySourceMoveObject?.contents
480
544
  ?.json as unknown as RawSuiObjectData | null;
545
+ const destinationGateJson = destinationGateMoveObject?.contents
546
+ ?.json as unknown as RawSuiObjectData | null;
481
547
 
482
548
  if (!energySourceJson) {
483
549
  console.warn(
@@ -493,11 +559,17 @@ export async function getAssemblyWithOwner(assemblyId: string): Promise<{
493
559
  },
494
560
  dynamicFields: dynamicFields || undefined,
495
561
  },
496
- character: characterInfo,
562
+ assemblyOwner: characterInfo,
497
563
  energySource: energySourceJson ?? null,
564
+ destinationGate: destinationGateJson ?? null,
498
565
  };
499
566
  } catch (error) {
500
567
  console.error("[DappKit] getAssemblyWithOwner error:", error);
501
- return { moveObject: null, character: null, energySource: null };
568
+ return {
569
+ moveObject: null,
570
+ assemblyOwner: null,
571
+ energySource: null,
572
+ destinationGate: null,
573
+ };
502
574
  }
503
575
  }
package/graphql/index.ts CHANGED
@@ -12,7 +12,9 @@ export {
12
12
  getSingletonObjectByType,
13
13
  getObjectsByType,
14
14
  // Character/owner resolution
15
+ getWalletCharacters,
15
16
  getAssemblyWithOwner,
17
+ getCharacterAndOwnedObjects,
16
18
  } from "./client";
17
19
 
18
20
  // Query Strings
@@ -26,48 +28,12 @@ export {
26
28
  GET_OBJECT_OWNER_AND_OWNED_OBJECTS_WITH_JSON,
27
29
  GET_OWNED_OBJECTS_BY_TYPE,
28
30
  GET_OWNED_OBJECTS_BY_PACKAGE,
31
+ GET_WALLET_CHARACTERS,
29
32
  // Singleton & type-based queries
30
33
  GET_SINGLETON_OBJECT_BY_TYPE,
34
+ GET_SINGLETON_CONFIG_OBJECT_BY_TYPE,
31
35
  GET_OBJECTS_BY_TYPE,
32
36
  } from "./queries";
33
37
 
34
38
  // Types
35
- export type {
36
- // Base types
37
- GraphQLResponse,
38
- PageInfo,
39
- // Move object types
40
- MoveObjectContents,
41
- DynamicFieldNode,
42
- MoveObjectData,
43
- // Object response types
44
- SuiObjectResponse,
45
- GetObjectResponse,
46
- // GetObjectByAddress types
47
- GetObjectByAddressResponse,
48
- // GetObjectWithJson types
49
- GetObjectWithJsonResponse,
50
- // Owner & owned objects types
51
- OwnedObjectNode,
52
- AddressOwner,
53
- GetObjectOwnerAndOwnedObjectsResponse,
54
- // Owner & owned objects with JSON types
55
- OwnedObjectNodeWithJson,
56
- AddressOwnerWithJson,
57
- GetObjectOwnerAndOwnedObjectsWithJsonResponse,
58
- // GetOwnedObjectsByType types
59
- OwnedObjectAddressNode,
60
- GetOwnedObjectsByTypeResponse,
61
- // GetOwnedObjectsByPackage types
62
- OwnedObjectFullNode,
63
- GetOwnedObjectsByPackageResponse,
64
- // Singleton & type-based types
65
- GetSingletonObjectByTypeResponse,
66
- ObjectWithContentsNode,
67
- GetObjectsByTypeResponse,
68
- // EVE Frontier specific types
69
- RawSuiObjectData,
70
- OwnerCapData,
71
- RawCharacterData,
72
- CharacterInfo,
73
- } from "./types";
39
+ export * from "./types";
@@ -73,7 +73,7 @@ export const GET_OBJECT_WITH_DYNAMIC_FIELDS = `
73
73
  * @category GraphQL
74
74
  */
75
75
  export const GET_OBJECT_DYNAMICFIELD_CHARACTER_WITH_JSON = `
76
- query GetObjectOwnerCharacterOwnerAndInventory0(
76
+ query GetObjectOwnerCharacterOwnerAndInventory(
77
77
  $objectId: SuiAddress!
78
78
  $characterOwnerType: String!
79
79
  ) {
@@ -122,6 +122,15 @@ query GetObjectOwnerCharacterOwnerAndInventory0(
122
122
  }
123
123
  }
124
124
  }
125
+ destinationGate: extract(path: "linked_gate_id") {
126
+ asAddress {
127
+ asObject {
128
+ asMoveObject {
129
+ contents { bcs json }
130
+ }
131
+ }
132
+ }
133
+ }
125
134
  }
126
135
  dynamicFields {
127
136
  nodes {
@@ -319,6 +328,110 @@ export const GET_OWNED_OBJECTS_BY_PACKAGE = `
319
328
  }
320
329
  `;
321
330
 
331
+ // ============================================================================
332
+ // Character Queries
333
+ // ============================================================================
334
+
335
+ /**
336
+ * Query to get all characters owned by a wallet
337
+ * Returns the characters owned by the wallet
338
+ *
339
+ * @category GraphQL
340
+ */
341
+ export const GET_WALLET_CHARACTERS = `
342
+ query GetWalletCharacters($owner: SuiAddress!, $characterPlayerProfileType: String!) {
343
+ address(
344
+ address: $owner
345
+ ) {
346
+ objects(
347
+ last: 1
348
+ filter: {
349
+ type: $characterPlayerProfileType
350
+ }
351
+ ) {
352
+ nodes {
353
+ contents {
354
+ extract(path: "character_id") {
355
+ asAddress {
356
+ asObject {
357
+ asMoveObject {
358
+ contents {
359
+ type {
360
+ repr
361
+ }
362
+ json
363
+ }
364
+ }
365
+ }
366
+ }
367
+ }
368
+ }
369
+ }
370
+ }
371
+ }
372
+ }
373
+ `;
374
+
375
+ /**
376
+ * Query to get character owned by a wallet and objects owned by the character
377
+ * Returns the character and objects owned by the character
378
+ *
379
+ * @category GraphQL
380
+ */
381
+ export const GET_CHARACTER_AND_OWNED_OBJECTS = `
382
+ query GetCharacterAndOwnedObjects($owner: SuiAddress!, $characterPlayerProfileType: String!) {
383
+ address(
384
+ address: $owner
385
+ ) {
386
+ objects(
387
+ last: 1
388
+ filter: {
389
+ type: $characterPlayerProfileType
390
+ }
391
+ ) {
392
+ nodes {
393
+ contents {
394
+ extract(path: "character_id") {
395
+ asAddress {
396
+ asObject {
397
+ asMoveObject {
398
+ contents {
399
+ type {
400
+ repr
401
+ }
402
+ json
403
+ }
404
+ }
405
+ }
406
+ objects {
407
+ nodes {
408
+ contents {
409
+ extract(path: "authorized_object_id") {
410
+ asAddress {
411
+ asObject {
412
+ asMoveObject {
413
+ contents {
414
+ type {
415
+ repr
416
+ }
417
+ json
418
+ }
419
+ }
420
+ }
421
+ }
422
+ }
423
+ }
424
+ }
425
+ }
426
+ }
427
+ }
428
+ }
429
+ }
430
+ }
431
+ }
432
+ }
433
+ `;
434
+
322
435
  // ============================================================================
323
436
  // Singleton & Type-based Queries
324
437
  // ============================================================================
@@ -344,6 +457,49 @@ export const GET_SINGLETON_OBJECT_BY_TYPE = `
344
457
  }
345
458
  `;
346
459
 
460
+ /**
461
+ * Query to get a singleton config object by its type
462
+ *
463
+ * @category GraphQL
464
+ */
465
+ export const GET_SINGLETON_CONFIG_OBJECT_BY_TYPE = `
466
+ query GetSingletonConfigObjectByType($object_type: String!, $table_name: String!) {
467
+ objects(filter: { type: $object_type }, first: 1) {
468
+ nodes {
469
+ address
470
+ asMoveObject {
471
+ contents {
472
+ extract(path: $table_name) {
473
+ extract(path: "id") {
474
+ asAddress {
475
+ addressAt {
476
+ dynamicFields {
477
+ pageInfo {
478
+ hasNextPage
479
+ endCursor
480
+ }
481
+ nodes {
482
+ key: name {
483
+ json
484
+ }
485
+ value: value {
486
+ ... on MoveValue {
487
+ json
488
+ }
489
+ }
490
+ }
491
+ }
492
+ }
493
+ }
494
+ }
495
+ }
496
+ }
497
+ }
498
+ }
499
+ }
500
+ }
501
+ `;
502
+
347
503
  /**
348
504
  * Query to get all objects of a specific type (global search)
349
505
  * Use with caution - may return many results