@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/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,84 +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
- energySource?: {
216
- asAddress?: {
217
- asObject?: {
218
- asMoveObject?: {
219
- contents?: {
220
- json: Record<string, unknown>;
221
- };
222
- };
223
- };
224
- };
225
- };
226
- };
227
- dynamicFields?: {
228
- 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 }>;
229
232
  };
233
+ dynamicFields?: ObjectNodes<DynamicFieldNode>;
230
234
  };
231
235
  };
232
236
  }
233
237
 
234
- // ============================================================================
235
- // GetObjectWithJson Response Types
236
- // ============================================================================
237
-
238
238
  /** @category GraphQL */
239
239
  export interface GetObjectWithJsonResponse {
240
240
  object?: {
241
241
  address: string;
242
242
  version: number;
243
243
  digest: string;
244
- asMoveObject: {
245
- contents: {
246
- type: {
247
- repr: string;
248
- };
249
- json: Record<string, unknown>;
250
- bcs: string;
251
- };
252
- } | null;
244
+ asMoveObject: { contents: ContentsTypeJsonAndBcs } | null;
253
245
  };
254
246
  }
255
247
 
@@ -264,11 +256,7 @@ export interface OwnedObjectAddressNode {
264
256
 
265
257
  /** @category GraphQL */
266
258
  export interface GetOwnedObjectsByTypeResponse {
267
- address?: {
268
- objects: {
269
- nodes: OwnedObjectAddressNode[];
270
- };
271
- };
259
+ address?: { objects: ObjectNodes<OwnedObjectAddressNode> };
272
260
  }
273
261
 
274
262
  // ============================================================================
@@ -284,19 +272,72 @@ export interface OwnedObjectFullNode {
284
272
 
285
273
  /** @category GraphQL */
286
274
  export interface GetOwnedObjectsByPackageResponse {
287
- objects: {
288
- 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
+ };
289
296
  };
290
297
  }
291
298
 
299
+ /** @category GraphQL */
300
+ export interface GetCharacterAndOwnedObjectsResponse {
301
+ address: AddressWithObjects<CharacterAndOwnedObjectsNode>;
302
+ }
303
+
292
304
  // ============================================================================
293
305
  // Singleton & Type-based Query Response Types
294
306
  // ============================================================================
295
307
 
296
308
  /** @category GraphQL */
297
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 {
298
321
  objects: {
299
- 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
+ }>;
300
341
  };
301
342
  }
302
343
 
@@ -305,21 +346,13 @@ export interface ObjectWithContentsNode {
305
346
  address: string;
306
347
  version: number;
307
348
  asMoveObject: {
308
- contents: {
309
- json: Record<string, unknown>;
310
- type: {
311
- repr: string;
312
- };
313
- };
349
+ contents: { json: Record<string, unknown>; type: TypeRepr };
314
350
  } | null;
315
351
  }
316
352
 
317
353
  /** @category GraphQL */
318
354
  export interface GetObjectsByTypeResponse {
319
- objects: {
320
- nodes: ObjectWithContentsNode[];
321
- pageInfo: PageInfo;
322
- };
355
+ objects: ObjectNodes<ObjectWithContentsNode> & { pageInfo: PageInfo };
323
356
  }
324
357
 
325
358
  // ============================================================================
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,
@@ -17,7 +17,7 @@ import {
17
17
  type SponsoredTransactionOutput,
18
18
  SponsoredTransactionArgs,
19
19
  } from "../wallet";
20
- import { QueryParams, SponsoredTransactionActions } from "../types";
20
+ import { Assemblies, QueryParams, SponsoredTransactionActions } from "../types";
21
21
 
22
22
  /** Wallet-like shape from dApp Kit (UiWallet or connection store). */
23
23
  type ResolvableWallet = {
@@ -375,15 +375,22 @@ export function useSponsoredTransaction({
375
375
 
376
376
  const assemblyId = resolveAssemblyId(args.assembly.item_id, queryItemId);
377
377
 
378
+ // If the txAction is UPDATE_METADATA, it goes through the standard assembly type
379
+ const assemblyType = getAssemblyTypeApiString(
380
+ args.txAction === SponsoredTransactionActions.UPDATE_METADATA
381
+ ? Assemblies.Assembly
382
+ : args.assembly.type,
383
+ );
384
+
378
385
  const payload: SponsoredTransactionInput = {
379
386
  txAction: args.txAction,
380
387
  assembly: assemblyId,
381
- assemblyType: getAssemblyTypeApiString(args.assembly.type),
382
- chain: args.chain,
388
+ assemblyType: assemblyType,
389
+ metadata: args.metadata,
383
390
  tenant,
384
391
  };
385
392
 
386
- console.log("payload", payload);
393
+ console.log("Sponsored Transaction Payload:", payload);
387
394
 
388
395
  return await signSponsoredTransaction(payload);
389
396
  },
package/index.ts CHANGED
@@ -44,82 +44,18 @@ export * from "./utils";
44
44
  // =========================================
45
45
  // GraphQL - Query execution & helper functions
46
46
  // =========================================
47
- export {
48
- executeGraphQLQuery,
49
- getObjectByAddress,
50
- getObjectWithDynamicFields,
51
- getObjectWithJson,
52
- getObjectOwnerAndOwnedObjectsByType,
53
- getObjectAndCharacterOwner,
54
- getOwnedObjectsByType,
55
- getOwnedObjectsByPackage,
56
- getSingletonObjectByType,
57
- getObjectsByType,
58
- // Character/owner resolution
59
- getAssemblyWithOwner,
60
- } from "./graphql";
61
-
62
- // GraphQL - Query strings
63
- export {
64
- // Core object queries
65
- GET_OBJECT_BY_ADDRESS,
66
- GET_OBJECT_WITH_DYNAMIC_FIELDS,
67
- GET_OBJECT_WITH_JSON,
68
- // Owner & ownership queries
69
- GET_OBJECT_OWNER_AND_OWNED_OBJECTS_BY_TYPE,
70
- GET_OBJECT_OWNER_AND_OWNED_OBJECTS_WITH_JSON,
71
- GET_OWNED_OBJECTS_BY_TYPE,
72
- GET_OWNED_OBJECTS_BY_PACKAGE,
73
- // Singleton & type-based queries
74
- GET_SINGLETON_OBJECT_BY_TYPE,
75
- GET_OBJECTS_BY_TYPE,
76
- } from "./graphql";
77
-
78
- // GraphQL - Types
79
- export type {
80
- // Base types
81
- GraphQLResponse,
82
- PageInfo,
83
- // Move object types
84
- MoveObjectContents,
85
- DynamicFieldNode,
86
- MoveObjectData,
87
- // Object response types
88
- SuiObjectResponse,
89
- GetObjectResponse,
90
- // GetObjectByAddress types
91
- GetObjectByAddressResponse,
92
- // GetObjectWithJson types
93
- GetObjectWithJsonResponse,
94
- // Owner & owned objects types
95
- OwnedObjectNode,
96
- AddressOwner,
97
- GetObjectOwnerAndOwnedObjectsResponse,
98
- // Owner & owned objects with JSON types
99
- OwnedObjectNodeWithJson,
100
- AddressOwnerWithJson,
101
- GetObjectOwnerAndOwnedObjectsWithJsonResponse,
102
- // GetOwnedObjectsByType types
103
- OwnedObjectAddressNode,
104
- GetOwnedObjectsByTypeResponse,
105
- // GetOwnedObjectsByPackage types
106
- OwnedObjectFullNode,
107
- GetOwnedObjectsByPackageResponse,
108
- // Singleton & type-based types
109
- GetSingletonObjectByTypeResponse,
110
- ObjectWithContentsNode,
111
- GetObjectsByTypeResponse,
112
- // EVE Frontier specific types
113
- RawSuiObjectData,
114
- OwnerCapData,
115
- RawCharacterData,
116
- CharacterInfo,
117
- } from "./graphql";
47
+ export * from "./graphql";
118
48
 
119
49
  // =========================================
120
50
  // Config
121
51
  // =========================================
122
52
  export { dAppKit } from "./config/dapp-kit";
53
+ export {
54
+ getEnergyConfig,
55
+ getFuelEfficiencyConfig,
56
+ getFuelEfficiencyForType,
57
+ getEnergyUsageForType,
58
+ } from "./utils/config";
123
59
 
124
60
  // =========================================
125
61
  // Constants & Configuration
package/package.json CHANGED
@@ -1,11 +1,21 @@
1
1
  {
2
2
  "name": "@evefrontier/dapp-kit",
3
- "version": "0.1.2",
3
+ "version": "0.1.5",
4
4
  "description": "React SDK for EVE Frontier dApps on Sui",
5
5
  "main": "index.ts",
6
6
  "author": "",
7
7
  "license": "MIT",
8
8
  "type": "module",
9
+ "files": [
10
+ "index.ts",
11
+ "config",
12
+ "graphql",
13
+ "hooks",
14
+ "providers",
15
+ "types",
16
+ "utils",
17
+ "wallet"
18
+ ],
9
19
  "exports": {
10
20
  ".": "./index.ts",
11
21
  "./types": "./types/index.ts",