@evefrontier/dapp-kit 0.1.1 → 0.1.3

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 (215) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +2 -2
  3. package/docs/api/assets/hierarchy.js +1 -1
  4. package/docs/api/assets/navigation.js +1 -1
  5. package/docs/api/assets/search.js +1 -1
  6. package/docs/api/classes/WalletNoAccountSelectedError.html +3 -3
  7. package/docs/api/classes/WalletNotConnectedError.html +3 -3
  8. package/docs/api/classes/WalletSponsoredTransactionNotSupportedError.html +3 -3
  9. package/docs/api/enums/ActionTypes.html +2 -2
  10. package/docs/api/enums/Assemblies.html +3 -2
  11. package/docs/api/enums/QueryParams.html +2 -2
  12. package/docs/api/enums/Severity.html +2 -2
  13. package/docs/api/enums/SponsoredTransactionActions.html +3 -3
  14. package/docs/api/enums/State.html +2 -2
  15. package/docs/api/enums/SupportedWallets.html +2 -2
  16. package/docs/api/enums/TYPEIDS.html +3 -3
  17. package/docs/api/functions/EveFrontierProvider.html +2 -2
  18. package/docs/api/functions/NotificationProvider.html +2 -2
  19. package/docs/api/functions/SmartObjectProvider.html +4 -4
  20. package/docs/api/functions/VaultProvider.html +1 -1
  21. package/docs/api/functions/abbreviateAddress.html +2 -2
  22. package/docs/api/functions/assertAssemblyType.html +2 -2
  23. package/docs/api/functions/clickToCopy.html +1 -1
  24. package/docs/api/functions/executeGraphQLQuery.html +2 -2
  25. package/docs/api/functions/findOwnerByAddress.html +2 -2
  26. package/docs/api/functions/formatDuration.html +2 -2
  27. package/docs/api/functions/formatM3.html +2 -2
  28. package/docs/api/functions/getAdjustedBurnRate.html +6 -0
  29. package/docs/api/functions/getAssemblyType.html +2 -2
  30. package/docs/api/functions/getAssemblyTypeApiString.html +2 -2
  31. package/docs/api/functions/getAssemblyWithOwner.html +3 -3
  32. package/docs/api/functions/getCharacterAndOwnedObjects.html +3 -0
  33. package/docs/api/functions/getCharacterOwnedObjects.html +5 -0
  34. package/docs/api/functions/getCharacterOwnedObjectsJson.html +5 -0
  35. package/docs/api/functions/getCharacterOwnerCapType.html +2 -2
  36. package/docs/api/functions/getCharacterPlayerProfileType.html +3 -0
  37. package/docs/api/functions/getCommonItems.html +1 -1
  38. package/docs/api/functions/getDappUrl.html +2 -2
  39. package/docs/api/functions/getDatahubGameInfo.html +2 -2
  40. package/docs/api/functions/getEnergyConfig.html +4 -0
  41. package/docs/api/functions/getEnergyConfigType.html +3 -0
  42. package/docs/api/functions/getEnergyUsageForType.html +5 -0
  43. package/docs/api/functions/getEnv.html +1 -1
  44. package/docs/api/functions/getEveWorldPackageId.html +2 -2
  45. package/docs/api/functions/getFuelEfficiencyConfig.html +4 -0
  46. package/docs/api/functions/getFuelEfficiencyConfigType.html +3 -0
  47. package/docs/api/functions/getFuelEfficiencyForType.html +5 -0
  48. package/docs/api/functions/getObjectByAddress.html +2 -2
  49. package/docs/api/functions/getObjectId.html +2 -2
  50. package/docs/api/functions/getObjectOwnerAndOwnedObjectsByType.html +2 -2
  51. package/docs/api/functions/getObjectOwnerAndOwnedObjectsWithJson.html +7 -0
  52. package/docs/api/functions/getObjectRegistryType.html +2 -2
  53. package/docs/api/functions/getObjectWithDynamicFields.html +2 -2
  54. package/docs/api/functions/getObjectWithJson.html +2 -2
  55. package/docs/api/functions/getObjectsByType.html +2 -2
  56. package/docs/api/functions/getOwnedObjectsByPackage.html +2 -2
  57. package/docs/api/functions/getOwnedObjectsByType.html +2 -2
  58. package/docs/api/functions/getRegistryAddress.html +2 -2
  59. package/docs/api/functions/getSingletonObjectByType.html +2 -2
  60. package/docs/api/functions/getSponsoredTransactionFeature.html +2 -2
  61. package/docs/api/functions/getSuiGraphqlEndpoint.html +2 -2
  62. package/docs/api/functions/getTxUrl.html +2 -2
  63. package/docs/api/functions/getVolumeM3.html +2 -2
  64. package/docs/api/functions/getWalletCharacters.html +3 -0
  65. package/docs/api/functions/hasSponsoredTransactionFeature.html +2 -2
  66. package/docs/api/functions/isOwner.html +3 -3
  67. package/docs/api/functions/parseCharacterFromJson.html +5 -0
  68. package/docs/api/functions/parseErrorFromMessage.html +1 -1
  69. package/docs/api/functions/parseStatus.html +2 -2
  70. package/docs/api/functions/parseURL.html +1 -1
  71. package/docs/api/functions/removeTrailingZeros.html +1 -1
  72. package/docs/api/functions/transformToAssembly.html +2 -2
  73. package/docs/api/functions/transformToCharacter.html +2 -2
  74. package/docs/api/functions/useConnection.html +2 -2
  75. package/docs/api/functions/useNotification.html +2 -2
  76. package/docs/api/functions/useSmartObject.html +4 -9
  77. package/docs/api/functions/useSponsoredTransaction.html +5 -5
  78. package/docs/api/functions/walletSupportsSponsoredTransaction.html +2 -2
  79. package/docs/api/hierarchy.html +1 -1
  80. package/docs/api/index.html +3 -5
  81. package/docs/api/interfaces/AddressOwner.html +2 -2
  82. package/docs/api/interfaces/AddressOwnerWithJson.html +2 -2
  83. package/docs/api/interfaces/AddressWithObjects.html +3 -0
  84. package/docs/api/interfaces/AdjustedBurnRate.html +8 -0
  85. package/docs/api/interfaces/AsMoveObjectRef.html +3 -0
  86. package/docs/api/interfaces/AssemblyProperties.html +6 -3
  87. package/docs/api/interfaces/CharacterAndOwnedObjectsNode.html +2 -0
  88. package/docs/api/interfaces/CharacterInfo.html +3 -3
  89. package/docs/api/interfaces/CharacterOwnerNode.html +3 -0
  90. package/docs/api/interfaces/ConfigExtractDynamicFieldNode.html +3 -0
  91. package/docs/api/interfaces/ContentsBcs.html +2 -0
  92. package/docs/api/interfaces/ContentsJsonAndBcs.html +3 -0
  93. package/docs/api/interfaces/ContentsJsonOnly.html +3 -0
  94. package/docs/api/interfaces/ContentsTypeAndBcs.html +3 -0
  95. package/docs/api/interfaces/ContentsTypeJsonAndBcs.html +4 -0
  96. package/docs/api/interfaces/DatahubGameInfo.html +14 -16
  97. package/docs/api/interfaces/DetailedAssemblyResponse.html +6 -3
  98. package/docs/api/interfaces/DetailedSmartCharacterResponse.html +2 -2
  99. package/docs/api/interfaces/DynamicFieldNode.html +2 -2
  100. package/docs/api/interfaces/EphemeralInventory.html +2 -2
  101. package/docs/api/interfaces/EveFrontierSponsoredTransactionFeature.html +3 -3
  102. package/docs/api/interfaces/ExtractAsMoveObjectNode.html +4 -0
  103. package/docs/api/interfaces/GateModule.html +2 -5
  104. package/docs/api/interfaces/GetCharacterAndOwnedObjectsResponse.html +2 -0
  105. package/docs/api/interfaces/GetObjectAndCharacterOwnerResponse.html +2 -0
  106. package/docs/api/interfaces/GetObjectByAddressResponse.html +2 -2
  107. package/docs/api/interfaces/GetObjectOwnerAndOwnedObjectsResponse.html +2 -2
  108. package/docs/api/interfaces/GetObjectOwnerAndOwnedObjectsWithJsonResponse.html +2 -2
  109. package/docs/api/interfaces/GetObjectResponse.html +2 -2
  110. package/docs/api/interfaces/GetObjectWithJsonResponse.html +2 -2
  111. package/docs/api/interfaces/GetObjectsByTypeResponse.html +2 -2
  112. package/docs/api/interfaces/GetOwnedObjectsByPackageResponse.html +2 -2
  113. package/docs/api/interfaces/GetOwnedObjectsByTypeResponse.html +2 -2
  114. package/docs/api/interfaces/GetSingletonConfigObjectByTypeResponse.html +2 -0
  115. package/docs/api/interfaces/GetSingletonObjectByTypeResponse.html +2 -2
  116. package/docs/api/interfaces/GetWalletCharactersResponse.html +2 -0
  117. package/docs/api/interfaces/GraphQLResponse.html +2 -2
  118. package/docs/api/interfaces/InventoryItem.html +2 -2
  119. package/docs/api/interfaces/ManufacturingModule.html +1 -2
  120. package/docs/api/interfaces/MoveObjectContents.html +2 -2
  121. package/docs/api/interfaces/MoveObjectData.html +2 -2
  122. package/docs/api/interfaces/NetworkNodeModule.html +2 -2
  123. package/docs/api/interfaces/NotificationContextType.html +2 -2
  124. package/docs/api/interfaces/NotificationState.html +2 -2
  125. package/docs/api/interfaces/Notify.html +2 -2
  126. package/docs/api/interfaces/ObjectNodes.html +2 -0
  127. package/docs/api/interfaces/ObjectWithContentsNode.html +2 -2
  128. package/docs/api/interfaces/OwnedObjectAddressNode.html +2 -2
  129. package/docs/api/interfaces/OwnedObjectFullNode.html +2 -2
  130. package/docs/api/interfaces/OwnedObjectNode.html +2 -2
  131. package/docs/api/interfaces/OwnedObjectNodeWithJson.html +2 -2
  132. package/docs/api/interfaces/OwnerCapData.html +3 -3
  133. package/docs/api/interfaces/PageInfo.html +2 -2
  134. package/docs/api/interfaces/PreviousTransaction.html +2 -0
  135. package/docs/api/interfaces/RawCharacterData.html +3 -3
  136. package/docs/api/interfaces/RawSuiObjectData.html +10 -6
  137. package/docs/api/interfaces/RefineryModule.html +1 -2
  138. package/docs/api/interfaces/SmartAssemblyResponse.html +6 -2
  139. package/docs/api/interfaces/SmartObjectContextType.html +4 -6
  140. package/docs/api/interfaces/SponsoredTransactionInput.html +6 -7
  141. package/docs/api/interfaces/SponsoredTransactionOutput.html +5 -5
  142. package/docs/api/interfaces/StorageModule.html +2 -3
  143. package/docs/api/interfaces/SuiObjectResponse.html +2 -2
  144. package/docs/api/interfaces/TransformOptions.html +8 -4
  145. package/docs/api/interfaces/TurretModule.html +1 -2
  146. package/docs/api/interfaces/TypeRepr.html +2 -0
  147. package/docs/api/interfaces/TypeReprWithLayout.html +3 -0
  148. package/docs/api/interfaces/VaultContextType.html +3 -3
  149. package/docs/api/modules.html +1 -1
  150. package/docs/api/types/AssemblyType.html +1 -1
  151. package/docs/api/types/ContentsTypeAndJson.html +2 -0
  152. package/docs/api/types/ErrorType.html +2 -2
  153. package/docs/api/types/MoveObjectRefWithJson.html +2 -0
  154. package/docs/api/types/SendSponsoredTransactionFn.html +1 -1
  155. package/docs/api/types/SponsoredTransactionArgs.html +2 -2
  156. package/docs/api/types/SponsoredTransactionAssemblyType.html +2 -2
  157. package/docs/api/types/SponsoredTransactionMethod.html +2 -2
  158. package/docs/api/types/UseSponsoredTransactionArgs.html +2 -2
  159. package/docs/api/types/UseSponsoredTransactionError.html +2 -2
  160. package/docs/api/types/UseSponsoredTransactionMutationOptions.html +2 -2
  161. package/docs/api/variables/ASSEMBLY_TYPE_API_STRING.html +2 -2
  162. package/docs/api/variables/ERRORS.html +1 -1
  163. package/docs/api/variables/ERROR_MESSAGES.html +1 -1
  164. package/docs/api/variables/EVEFRONTIER_SPONSORED_TRANSACTION.html +2 -2
  165. package/docs/api/variables/EXCLUDED_TYPEIDS.html +1 -1
  166. package/docs/api/variables/GET_OBJECTS_BY_TYPE.html +2 -2
  167. package/docs/api/variables/GET_OBJECT_BY_ADDRESS.html +2 -2
  168. package/docs/api/variables/GET_OBJECT_OWNER_AND_OWNED_OBJECTS_BY_TYPE.html +2 -2
  169. package/docs/api/variables/GET_OBJECT_OWNER_AND_OWNED_OBJECTS_WITH_JSON.html +2 -2
  170. package/docs/api/variables/GET_OBJECT_WITH_DYNAMIC_FIELDS.html +2 -2
  171. package/docs/api/variables/GET_OBJECT_WITH_JSON.html +2 -2
  172. package/docs/api/variables/GET_OWNED_OBJECTS_BY_PACKAGE.html +2 -2
  173. package/docs/api/variables/GET_OWNED_OBJECTS_BY_TYPE.html +2 -2
  174. package/docs/api/variables/GET_SINGLETON_CONFIG_OBJECT_BY_TYPE.html +2 -0
  175. package/docs/api/variables/GET_SINGLETON_OBJECT_BY_TYPE.html +2 -2
  176. package/docs/api/variables/GET_WALLET_CHARACTERS.html +3 -0
  177. package/docs/api/variables/NotificationContext.html +1 -1
  178. package/docs/api/variables/ONE_M3.html +2 -2
  179. package/docs/api/variables/POLLING_INTERVAL.html +2 -2
  180. package/docs/api/variables/STORAGE_KEYS.html +2 -2
  181. package/docs/api/variables/SmartObjectContext.html +1 -1
  182. package/docs/api/variables/VaultContext.html +1 -1
  183. package/docs/api/variables/dAppKit.html +2 -2
  184. package/graphql/client.ts +119 -24
  185. package/graphql/index.ts +5 -39
  186. package/graphql/queries.ts +166 -1
  187. package/graphql/types.ts +192 -167
  188. package/hooks/index.ts +1 -0
  189. package/hooks/useSmartObject.ts +2 -12
  190. package/hooks/useSponsoredTransaction.ts +60 -9
  191. package/index.ts +7 -71
  192. package/package.json +1 -1
  193. package/providers/SmartObjectProvider.tsx +84 -57
  194. package/types/contexts.ts +1 -3
  195. package/types/sponsoredTransaction.ts +1 -0
  196. package/types/types.ts +52 -10
  197. package/types/worldApiReturnTypes.ts +13 -37
  198. package/utils/__tests__/burnRate.test.ts +121 -0
  199. package/utils/__tests__/character.test.ts +112 -0
  200. package/utils/__tests__/characterOwnedObjects.test.ts +222 -0
  201. package/utils/__tests__/config.test.ts +424 -0
  202. package/utils/__tests__/mapping.test.ts +2 -2
  203. package/utils/burnRate.ts +46 -0
  204. package/utils/character.ts +46 -0
  205. package/utils/characterOwnedObjects.ts +52 -0
  206. package/utils/config.ts +151 -0
  207. package/utils/constants.ts +39 -5
  208. package/utils/datahub.ts +3 -41
  209. package/utils/errors.ts +1 -1
  210. package/utils/index.ts +10 -1
  211. package/utils/mapping.ts +5 -2
  212. package/utils/transforms.ts +34 -31
  213. package/vite-env.d.ts +2 -2
  214. package/wallet/features.ts +7 -2
  215. package/docs/api/interfaces/GameTypeResponse.html +0 -13
@@ -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
  ) {
@@ -113,6 +113,24 @@ query GetObjectOwnerCharacterOwnerAndInventory0(
113
113
  }
114
114
  }
115
115
  }
116
+ energySource: extract(path: "energy_source_id") {
117
+ asAddress {
118
+ asObject {
119
+ asMoveObject {
120
+ contents { bcs json }
121
+ }
122
+ }
123
+ }
124
+ }
125
+ destinationGate: extract(path: "linked_gate_id") {
126
+ asAddress {
127
+ asObject {
128
+ asMoveObject {
129
+ contents { bcs json }
130
+ }
131
+ }
132
+ }
133
+ }
116
134
  }
117
135
  dynamicFields {
118
136
  nodes {
@@ -310,6 +328,110 @@ export const GET_OWNED_OBJECTS_BY_PACKAGE = `
310
328
  }
311
329
  `;
312
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
+
313
435
  // ============================================================================
314
436
  // Singleton & Type-based Queries
315
437
  // ============================================================================
@@ -335,6 +457,49 @@ export const GET_SINGLETON_OBJECT_BY_TYPE = `
335
457
  }
336
458
  `;
337
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
+
338
503
  /**
339
504
  * Query to get all objects of a specific type (global search)
340
505
  * Use with caution - may return many results
package/graphql/types.ts CHANGED
@@ -9,9 +9,7 @@
9
9
  /** @category GraphQL */
10
10
  export interface GraphQLResponse<T = unknown> {
11
11
  data?: T;
12
- errors?: Array<{
13
- message: string;
14
- }>;
12
+ errors?: Array<{ message: string }>;
15
13
  }
16
14
 
17
15
  /** @category GraphQL */
@@ -20,6 +18,104 @@ export interface PageInfo {
20
18
  endCursor: string | null;
21
19
  }
22
20
 
21
+ // ============================================================================
22
+ // Shared building blocks (reused across response types)
23
+ // ============================================================================
24
+
25
+ /** @category GraphQL */
26
+ export interface TypeRepr {
27
+ repr: string;
28
+ }
29
+
30
+ /** @category GraphQL */
31
+ export interface TypeReprWithLayout extends TypeRepr {
32
+ layout?: string;
33
+ }
34
+
35
+ /** @category GraphQL */
36
+ export interface ContentsBcs {
37
+ bcs: string;
38
+ }
39
+
40
+ /** @category GraphQL */
41
+ export interface ContentsTypeAndBcs extends ContentsBcs {
42
+ type: TypeRepr;
43
+ }
44
+
45
+ /** @category GraphQL */
46
+ export interface ContentsJsonAndBcs extends ContentsBcs {
47
+ json: Record<string, unknown>;
48
+ }
49
+
50
+ /** @category GraphQL */
51
+ export interface ContentsTypeJsonAndBcs extends ContentsJsonAndBcs {
52
+ type: TypeRepr;
53
+ }
54
+
55
+ /** Contents with type + json only (no bcs). Reuses ContentsTypeJsonAndBcs shape.
56
+ * @category GraphQL
57
+ */
58
+ export type ContentsTypeAndJson = Pick<ContentsTypeJsonAndBcs, "type" | "json">;
59
+
60
+ /** Node shape: contents.extract.asAddress.asObject.asMoveObject.contents.
61
+ * Reusable for any extract-path node whose inner contents are typed as T.
62
+ * @category GraphQL
63
+ */
64
+ export interface ExtractAsMoveObjectNode<T = ContentsTypeAndJson> {
65
+ contents: {
66
+ extract: {
67
+ asAddress: {
68
+ asObject: {
69
+ asMoveObject: {
70
+ contents: T;
71
+ };
72
+ };
73
+ };
74
+ };
75
+ };
76
+ }
77
+
78
+ /** @category GraphQL */
79
+ export interface PreviousTransaction {
80
+ effects?: { timestamp?: string };
81
+ }
82
+
83
+ /** @category GraphQL */
84
+ export interface ObjectNodes<T> {
85
+ nodes: T[];
86
+ }
87
+
88
+ /** @category GraphQL */
89
+ export interface AddressWithObjects<T> {
90
+ address: string;
91
+ objects: ObjectNodes<T>;
92
+ }
93
+
94
+ /** GraphQL asAddress → asObject → asMoveObject ref chain.
95
+ * @category GraphQL
96
+ */
97
+ export interface AsMoveObjectRef<T> {
98
+ asAddress?: {
99
+ asObject?: {
100
+ asMoveObject?: T;
101
+ };
102
+ };
103
+ }
104
+
105
+ /** Contents with only json (optional payload).
106
+ * @category GraphQL
107
+ */
108
+ export interface ContentsJsonOnly {
109
+ json: Record<string, unknown>;
110
+ }
111
+
112
+ /** Move object ref whose contents have json of type T.
113
+ * @category GraphQL
114
+ */
115
+ export type MoveObjectRefWithJson<T> = AsMoveObjectRef<{
116
+ contents: { json: T };
117
+ }>;
118
+
23
119
  // ============================================================================
24
120
  // Move Object Types
25
121
  // ============================================================================
@@ -28,34 +124,25 @@ export interface PageInfo {
28
124
  export interface MoveObjectContents {
29
125
  json?: Record<string, unknown>;
30
126
  bcs?: string;
31
- type?: {
32
- repr: string;
33
- layout?: string;
34
- };
127
+ type?: TypeReprWithLayout;
35
128
  }
36
129
 
37
130
  /** @category GraphQL */
38
131
  export interface DynamicFieldNode {
39
132
  contents: {
40
133
  json: Record<string, unknown>;
41
- type: {
42
- layout: string;
43
- };
134
+ type: { layout: string };
44
135
  };
45
136
  name: {
46
137
  json: unknown;
47
- type: {
48
- repr: string;
49
- };
138
+ type: TypeRepr;
50
139
  };
51
140
  }
52
141
 
53
142
  /** @category GraphQL */
54
143
  export interface MoveObjectData {
55
144
  contents: MoveObjectContents;
56
- dynamicFields?: {
57
- nodes: DynamicFieldNode[];
58
- };
145
+ dynamicFields?: ObjectNodes<DynamicFieldNode>;
59
146
  }
60
147
 
61
148
  // ============================================================================
@@ -75,24 +162,13 @@ export interface GetObjectResponse {
75
162
  object?: SuiObjectResponse;
76
163
  }
77
164
 
78
- // ============================================================================
79
- // GetObjectByAddress Response Types
80
- // ============================================================================
81
-
82
165
  /** @category GraphQL */
83
166
  export interface GetObjectByAddressResponse {
84
167
  object?: {
85
168
  address: string;
86
169
  version: number;
87
170
  digest: string;
88
- asMoveObject: {
89
- contents: {
90
- type: {
91
- repr: string;
92
- };
93
- bcs: string;
94
- };
95
- } | null;
171
+ asMoveObject: { contents: ContentsTypeAndBcs } | null;
96
172
  };
97
173
  }
98
174
 
@@ -102,69 +178,43 @@ export interface GetObjectByAddressResponse {
102
178
 
103
179
  /** @category GraphQL */
104
180
  export interface OwnedObjectNode {
105
- contents: {
106
- bcs: string;
107
- };
108
- previousTransaction?: {
109
- effects?: {
110
- timestamp?: string;
111
- };
112
- };
181
+ contents: ContentsBcs;
182
+ previousTransaction?: PreviousTransaction;
113
183
  }
114
184
 
115
185
  /** @category GraphQL */
116
186
  export interface AddressOwner {
117
- address: {
118
- address: string;
119
- objects: {
120
- nodes: OwnedObjectNode[];
121
- };
122
- };
187
+ address: AddressWithObjects<OwnedObjectNode>;
123
188
  }
124
189
 
125
190
  /** @category GraphQL */
126
191
  export interface GetObjectOwnerAndOwnedObjectsResponse {
127
- object?: {
128
- owner?: {
129
- address?: AddressOwner["address"];
130
- };
131
- };
192
+ object?: { owner?: { address?: AddressOwner["address"] } };
132
193
  }
133
194
 
134
- // ============================================================================
135
- // Owner & Owned Objects with JSON Response Types
136
- // ============================================================================
137
-
138
195
  /** @category GraphQL */
139
196
  export interface OwnedObjectNodeWithJson {
140
197
  address: string;
141
- contents: {
142
- json: Record<string, unknown>;
143
- bcs: string;
144
- };
145
- previousTransaction?: {
146
- effects?: {
147
- timestamp?: string;
148
- };
149
- };
198
+ contents: ContentsJsonAndBcs;
199
+ previousTransaction?: PreviousTransaction;
150
200
  }
151
201
 
152
202
  /** @category GraphQL */
153
203
  export interface AddressOwnerWithJson {
154
- address: {
155
- address: string;
156
- objects: {
157
- nodes: OwnedObjectNodeWithJson[];
158
- };
159
- };
204
+ address: AddressWithObjects<OwnedObjectNodeWithJson>;
160
205
  }
161
206
 
162
207
  /** @category GraphQL */
163
208
  export interface GetObjectOwnerAndOwnedObjectsWithJsonResponse {
164
- object?: {
165
- owner?: {
166
- address?: AddressOwnerWithJson["address"];
167
- };
209
+ object?: { owner?: { address?: AddressOwnerWithJson["address"] } };
210
+ }
211
+
212
+ /** Node shape for owner's objects in GetObjectAndCharacterOwner (authorizedObj → character).
213
+ * @category GraphQL
214
+ */
215
+ export interface CharacterOwnerNode {
216
+ contents: {
217
+ authorizedObj: MoveObjectRefWithJson<RawCharacterData>;
168
218
  };
169
219
  }
170
220
 
@@ -172,96 +222,26 @@ export interface GetObjectOwnerAndOwnedObjectsWithJsonResponse {
172
222
  export interface GetObjectAndCharacterOwnerResponse {
173
223
  object: {
174
224
  asMoveObject: {
175
- contents: {
176
- json: Record<string, unknown>;
177
- bcs: string;
178
- type: {
179
- repr: string;
180
- };
181
- extract?: {
182
- asAddress?: {
183
- asObject?: {
184
- asMoveObject?: {
185
- owner: {
186
- address: {
187
- objects: {
188
- nodes: [
189
- {
190
- contents: {
191
- authorizedObj: {
192
- asAddress: {
193
- asObject: {
194
- asMoveObject: {
195
- contents: {
196
- json: RawCharacterData;
197
- };
198
- };
199
- };
200
- };
201
- };
202
- };
203
- },
204
- ];
205
- };
206
- };
207
- };
208
- contents?: {
209
- json: Record<string, unknown>;
210
- };
211
- };
212
- };
213
- };
214
- } | null;
215
- owner?: {
216
- address?: {
217
- address: string;
218
- objects: {
219
- nodes: Array<{
220
- contents: {
221
- json: Record<string, unknown>;
222
- extract?: {
223
- asAddress?: {
224
- asObject?: {
225
- asMoveObject?: {
226
- contents?: {
227
- json: Record<string, unknown>;
228
- };
229
- };
230
- };
231
- };
232
- };
233
- };
234
- }>;
235
- };
236
- };
237
- };
238
- };
239
- dynamicFields?: {
240
- nodes: DynamicFieldNode[];
225
+ contents: ContentsTypeJsonAndBcs & {
226
+ extract?: AsMoveObjectRef<{
227
+ owner: { address: AddressWithObjects<CharacterOwnerNode> };
228
+ contents?: ContentsJsonOnly;
229
+ }> | null;
230
+ energySource?: AsMoveObjectRef<{ contents?: ContentsJsonOnly }>;
231
+ destinationGate?: AsMoveObjectRef<{ contents?: ContentsJsonOnly }>;
241
232
  };
233
+ dynamicFields?: ObjectNodes<DynamicFieldNode>;
242
234
  };
243
235
  };
244
236
  }
245
237
 
246
- // ============================================================================
247
- // GetObjectWithJson Response Types
248
- // ============================================================================
249
-
250
238
  /** @category GraphQL */
251
239
  export interface GetObjectWithJsonResponse {
252
240
  object?: {
253
241
  address: string;
254
242
  version: number;
255
243
  digest: string;
256
- asMoveObject: {
257
- contents: {
258
- type: {
259
- repr: string;
260
- };
261
- json: Record<string, unknown>;
262
- bcs: string;
263
- };
264
- } | null;
244
+ asMoveObject: { contents: ContentsTypeJsonAndBcs } | null;
265
245
  };
266
246
  }
267
247
 
@@ -276,11 +256,7 @@ export interface OwnedObjectAddressNode {
276
256
 
277
257
  /** @category GraphQL */
278
258
  export interface GetOwnedObjectsByTypeResponse {
279
- address?: {
280
- objects: {
281
- nodes: OwnedObjectAddressNode[];
282
- };
283
- };
259
+ address?: { objects: ObjectNodes<OwnedObjectAddressNode> };
284
260
  }
285
261
 
286
262
  // ============================================================================
@@ -296,19 +272,72 @@ export interface OwnedObjectFullNode {
296
272
 
297
273
  /** @category GraphQL */
298
274
  export interface GetOwnedObjectsByPackageResponse {
299
- objects: {
300
- nodes: OwnedObjectFullNode[];
275
+ objects: ObjectNodes<OwnedObjectFullNode>;
276
+ }
277
+
278
+ /** @category GraphQL */
279
+ export interface GetWalletCharactersResponse {
280
+ address: AddressWithObjects<ExtractAsMoveObjectNode>;
281
+ }
282
+
283
+ /** @category GraphQL */
284
+ export interface CharacterAndOwnedObjectsNode {
285
+ contents: {
286
+ extract: {
287
+ asAddress: {
288
+ asObject?: {
289
+ asMoveObject?: {
290
+ contents: ContentsTypeAndJson;
291
+ };
292
+ };
293
+ objects: ObjectNodes<ExtractAsMoveObjectNode>;
294
+ };
295
+ };
301
296
  };
302
297
  }
303
298
 
299
+ /** @category GraphQL */
300
+ export interface GetCharacterAndOwnedObjectsResponse {
301
+ address: AddressWithObjects<CharacterAndOwnedObjectsNode>;
302
+ }
303
+
304
304
  // ============================================================================
305
305
  // Singleton & Type-based Query Response Types
306
306
  // ============================================================================
307
307
 
308
308
  /** @category GraphQL */
309
309
  export interface GetSingletonObjectByTypeResponse {
310
+ objects: ObjectNodes<OwnedObjectAddressNode>;
311
+ }
312
+
313
+ /** @category GraphQL */
314
+ export interface ConfigExtractDynamicFieldNode {
315
+ key: { json: string };
316
+ value: { json: string };
317
+ }
318
+
319
+ /** @category GraphQL */
320
+ export interface GetSingletonConfigObjectByTypeResponse {
310
321
  objects: {
311
- nodes: OwnedObjectAddressNode[];
322
+ nodes: Array<{
323
+ address: string;
324
+ asMoveObject: {
325
+ contents: {
326
+ extract: {
327
+ extract: {
328
+ asAddress: {
329
+ addressAt: {
330
+ dynamicFields: {
331
+ pageInfo: PageInfo;
332
+ nodes: ConfigExtractDynamicFieldNode[];
333
+ };
334
+ };
335
+ };
336
+ };
337
+ };
338
+ };
339
+ };
340
+ }>;
312
341
  };
313
342
  }
314
343
 
@@ -317,21 +346,13 @@ export interface ObjectWithContentsNode {
317
346
  address: string;
318
347
  version: number;
319
348
  asMoveObject: {
320
- contents: {
321
- json: Record<string, unknown>;
322
- type: {
323
- repr: string;
324
- };
325
- };
349
+ contents: { json: Record<string, unknown>; type: TypeRepr };
326
350
  } | null;
327
351
  }
328
352
 
329
353
  /** @category GraphQL */
330
354
  export interface GetObjectsByTypeResponse {
331
- objects: {
332
- nodes: ObjectWithContentsNode[];
333
- pageInfo: PageInfo;
334
- };
355
+ objects: ObjectNodes<ObjectWithContentsNode> & { pageInfo: PageInfo };
335
356
  }
336
357
 
337
358
  // ============================================================================
@@ -348,6 +369,10 @@ export interface RawSuiObjectData {
348
369
  type_id: string;
349
370
  extension: unknown;
350
371
  inventory_keys?: string[];
372
+ /** Linked gate ID for Smart Gates */
373
+ linked_gate_id?: string;
374
+ /** Energy source ID for linked assemblies of network nodes */
375
+ energy_source_id?: string;
351
376
  key?: {
352
377
  item_id: string;
353
378
  tenant: string;
package/hooks/index.ts CHANGED
@@ -6,6 +6,7 @@ export {
6
6
  WalletSponsoredTransactionNotSupportedError,
7
7
  WalletNotConnectedError,
8
8
  WalletNoAccountSelectedError,
9
+ AssemblyIdRequiredError,
9
10
  } from "./useSponsoredTransaction";
10
11
  export type {
11
12
  UseSponsoredTransactionError,