@evefrontier/dapp-kit 0.1.0

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 (186) hide show
  1. package/README.md +53 -0
  2. package/config/dapp-kit.ts +20 -0
  3. package/config/index.ts +1 -0
  4. package/docs/api/.nojekyll +1 -0
  5. package/docs/api/assets/hierarchy.js +1 -0
  6. package/docs/api/assets/highlight.css +120 -0
  7. package/docs/api/assets/icons.js +18 -0
  8. package/docs/api/assets/icons.svg +1 -0
  9. package/docs/api/assets/main.js +60 -0
  10. package/docs/api/assets/navigation.js +1 -0
  11. package/docs/api/assets/search.js +1 -0
  12. package/docs/api/assets/style.css +1633 -0
  13. package/docs/api/classes/WalletNoAccountSelectedError.html +3 -0
  14. package/docs/api/classes/WalletNotConnectedError.html +3 -0
  15. package/docs/api/classes/WalletSponsoredTransactionNotSupportedError.html +5 -0
  16. package/docs/api/enums/ActionTypes.html +6 -0
  17. package/docs/api/enums/Assemblies.html +7 -0
  18. package/docs/api/enums/QueryParams.html +3 -0
  19. package/docs/api/enums/Severity.html +5 -0
  20. package/docs/api/enums/SponsoredTransactionActions.html +7 -0
  21. package/docs/api/enums/State.html +6 -0
  22. package/docs/api/enums/TYPEIDS.html +15 -0
  23. package/docs/api/functions/EveFrontierProvider.html +11 -0
  24. package/docs/api/functions/NotificationProvider.html +2 -0
  25. package/docs/api/functions/SmartObjectProvider.html +10 -0
  26. package/docs/api/functions/VaultProvider.html +1 -0
  27. package/docs/api/functions/abbreviateAddress.html +11 -0
  28. package/docs/api/functions/assertAssemblyType.html +9 -0
  29. package/docs/api/functions/clickToCopy.html +1 -0
  30. package/docs/api/functions/executeGraphQLQuery.html +12 -0
  31. package/docs/api/functions/findOwnerByAddress.html +5 -0
  32. package/docs/api/functions/formatDuration.html +8 -0
  33. package/docs/api/functions/formatM3.html +8 -0
  34. package/docs/api/functions/getAssemblyType.html +4 -0
  35. package/docs/api/functions/getAssemblyTypeApiString.html +2 -0
  36. package/docs/api/functions/getAssemblyWithOwner.html +18 -0
  37. package/docs/api/functions/getCharacterOwnerCapType.html +3 -0
  38. package/docs/api/functions/getCommonItems.html +1 -0
  39. package/docs/api/functions/getDappUrl.html +7 -0
  40. package/docs/api/functions/getDatahubGameInfo.html +13 -0
  41. package/docs/api/functions/getEnv.html +1 -0
  42. package/docs/api/functions/getEveWorldPackageId.html +4 -0
  43. package/docs/api/functions/getObjectByAddress.html +9 -0
  44. package/docs/api/functions/getObjectId.html +4 -0
  45. package/docs/api/functions/getObjectOwnerAndOwnedObjectsByType.html +10 -0
  46. package/docs/api/functions/getObjectRegistryType.html +3 -0
  47. package/docs/api/functions/getObjectWithDynamicFields.html +10 -0
  48. package/docs/api/functions/getObjectWithJson.html +9 -0
  49. package/docs/api/functions/getObjectsByType.html +12 -0
  50. package/docs/api/functions/getOwnedObjectsByPackage.html +10 -0
  51. package/docs/api/functions/getOwnedObjectsByType.html +10 -0
  52. package/docs/api/functions/getRegistryAddress.html +3 -0
  53. package/docs/api/functions/getSingletonObjectByType.html +9 -0
  54. package/docs/api/functions/getSponsoredTransactionFeature.html +11 -0
  55. package/docs/api/functions/getSuiGraphqlEndpoint.html +4 -0
  56. package/docs/api/functions/getTxUrl.html +8 -0
  57. package/docs/api/functions/getVolumeM3.html +5 -0
  58. package/docs/api/functions/hasSponsoredTransactionFeature.html +3 -0
  59. package/docs/api/functions/isOwner.html +10 -0
  60. package/docs/api/functions/parseErrorFromMessage.html +1 -0
  61. package/docs/api/functions/parseStatus.html +2 -0
  62. package/docs/api/functions/parseURL.html +1 -0
  63. package/docs/api/functions/removeTrailingZeros.html +1 -0
  64. package/docs/api/functions/transformToAssembly.html +5 -0
  65. package/docs/api/functions/transformToCharacter.html +2 -0
  66. package/docs/api/functions/useConnection.html +21 -0
  67. package/docs/api/functions/useNotification.html +28 -0
  68. package/docs/api/functions/useSmartObject.html +26 -0
  69. package/docs/api/functions/useSponsoredTransaction.html +50 -0
  70. package/docs/api/functions/walletSupportsSponsoredTransaction.html +13 -0
  71. package/docs/api/hierarchy.html +1 -0
  72. package/docs/api/index.html +26 -0
  73. package/docs/api/interfaces/AddressOwner.html +2 -0
  74. package/docs/api/interfaces/AddressOwnerWithJson.html +2 -0
  75. package/docs/api/interfaces/AssemblyProperties.html +14 -0
  76. package/docs/api/interfaces/CharacterInfo.html +8 -0
  77. package/docs/api/interfaces/DatahubGameInfo.html +30 -0
  78. package/docs/api/interfaces/DetailedAssemblyResponse.html +14 -0
  79. package/docs/api/interfaces/DetailedSmartCharacterResponse.html +7 -0
  80. package/docs/api/interfaces/DynamicFieldNode.html +3 -0
  81. package/docs/api/interfaces/EphemeralInventory.html +6 -0
  82. package/docs/api/interfaces/EveFrontierSponsoredTransactionFeature.html +7 -0
  83. package/docs/api/interfaces/GameTypeResponse.html +13 -0
  84. package/docs/api/interfaces/GateModule.html +5 -0
  85. package/docs/api/interfaces/GetObjectByAddressResponse.html +2 -0
  86. package/docs/api/interfaces/GetObjectOwnerAndOwnedObjectsResponse.html +2 -0
  87. package/docs/api/interfaces/GetObjectOwnerAndOwnedObjectsWithJsonResponse.html +2 -0
  88. package/docs/api/interfaces/GetObjectResponse.html +2 -0
  89. package/docs/api/interfaces/GetObjectWithJsonResponse.html +2 -0
  90. package/docs/api/interfaces/GetObjectsByTypeResponse.html +2 -0
  91. package/docs/api/interfaces/GetOwnedObjectsByPackageResponse.html +2 -0
  92. package/docs/api/interfaces/GetOwnedObjectsByTypeResponse.html +2 -0
  93. package/docs/api/interfaces/GetSingletonObjectByTypeResponse.html +2 -0
  94. package/docs/api/interfaces/GraphQLResponse.html +3 -0
  95. package/docs/api/interfaces/InventoryItem.html +8 -0
  96. package/docs/api/interfaces/ManufacturingModule.html +2 -0
  97. package/docs/api/interfaces/MoveObjectContents.html +4 -0
  98. package/docs/api/interfaces/MoveObjectData.html +3 -0
  99. package/docs/api/interfaces/NetworkNodeModule.html +7 -0
  100. package/docs/api/interfaces/NotificationContextType.html +4 -0
  101. package/docs/api/interfaces/NotificationState.html +6 -0
  102. package/docs/api/interfaces/Notify.html +6 -0
  103. package/docs/api/interfaces/ObjectWithContentsNode.html +4 -0
  104. package/docs/api/interfaces/OwnedObjectAddressNode.html +2 -0
  105. package/docs/api/interfaces/OwnedObjectFullNode.html +4 -0
  106. package/docs/api/interfaces/OwnedObjectNode.html +3 -0
  107. package/docs/api/interfaces/OwnedObjectNodeWithJson.html +4 -0
  108. package/docs/api/interfaces/OwnerCapData.html +5 -0
  109. package/docs/api/interfaces/PageInfo.html +3 -0
  110. package/docs/api/interfaces/RawCharacterData.html +8 -0
  111. package/docs/api/interfaces/RawSuiObjectData.html +17 -0
  112. package/docs/api/interfaces/RefineryModule.html +2 -0
  113. package/docs/api/interfaces/SmartAssemblyResponse.html +11 -0
  114. package/docs/api/interfaces/SmartObjectContextType.html +8 -0
  115. package/docs/api/interfaces/SponsoredTransactionInput.html +15 -0
  116. package/docs/api/interfaces/SponsoredTransactionOutput.html +8 -0
  117. package/docs/api/interfaces/StorageModule.html +4 -0
  118. package/docs/api/interfaces/SuiObjectResponse.html +5 -0
  119. package/docs/api/interfaces/TransformOptions.html +6 -0
  120. package/docs/api/interfaces/TurretModule.html +2 -0
  121. package/docs/api/interfaces/VaultContextType.html +7 -0
  122. package/docs/api/modules.html +1 -0
  123. package/docs/api/types/AssemblyType.html +1 -0
  124. package/docs/api/types/ErrorType.html +5 -0
  125. package/docs/api/types/SendSponsoredTransactionFn.html +1 -0
  126. package/docs/api/types/SponsoredTransactionArgs.html +2 -0
  127. package/docs/api/types/SponsoredTransactionAssemblyType.html +2 -0
  128. package/docs/api/types/SponsoredTransactionMethod.html +2 -0
  129. package/docs/api/types/UseSponsoredTransactionArgs.html +3 -0
  130. package/docs/api/types/UseSponsoredTransactionError.html +2 -0
  131. package/docs/api/types/UseSponsoredTransactionMutationOptions.html +2 -0
  132. package/docs/api/variables/ERRORS.html +1 -0
  133. package/docs/api/variables/ERROR_MESSAGES.html +1 -0
  134. package/docs/api/variables/EVEFRONTIER_SPONSORED_TRANSACTION.html +4 -0
  135. package/docs/api/variables/EXCLUDED_TYPEIDS.html +1 -0
  136. package/docs/api/variables/GET_OBJECTS_BY_TYPE.html +3 -0
  137. package/docs/api/variables/GET_OBJECT_BY_ADDRESS.html +3 -0
  138. package/docs/api/variables/GET_OBJECT_OWNER_AND_OWNED_OBJECTS_BY_TYPE.html +4 -0
  139. package/docs/api/variables/GET_OBJECT_OWNER_AND_OWNED_OBJECTS_WITH_JSON.html +3 -0
  140. package/docs/api/variables/GET_OBJECT_WITH_DYNAMIC_FIELDS.html +4 -0
  141. package/docs/api/variables/GET_OBJECT_WITH_JSON.html +3 -0
  142. package/docs/api/variables/GET_OWNED_OBJECTS_BY_PACKAGE.html +3 -0
  143. package/docs/api/variables/GET_OWNED_OBJECTS_BY_TYPE.html +3 -0
  144. package/docs/api/variables/GET_SINGLETON_OBJECT_BY_TYPE.html +3 -0
  145. package/docs/api/variables/NotificationContext.html +1 -0
  146. package/docs/api/variables/ONE_M3.html +2 -0
  147. package/docs/api/variables/POLLING_INTERVAL.html +2 -0
  148. package/docs/api/variables/STORAGE_KEYS.html +2 -0
  149. package/docs/api/variables/SmartObjectContext.html +1 -0
  150. package/docs/api/variables/VaultContext.html +1 -0
  151. package/docs/api/variables/dAppKit.html +2 -0
  152. package/graphql/client.ts +480 -0
  153. package/graphql/index.ts +73 -0
  154. package/graphql/queries.ts +371 -0
  155. package/graphql/types.ts +443 -0
  156. package/hooks/index.ts +14 -0
  157. package/hooks/useConnection.ts +58 -0
  158. package/hooks/useNotification.ts +80 -0
  159. package/hooks/useSmartObject.ts +78 -0
  160. package/hooks/useSponsoredTransaction.ts +323 -0
  161. package/index.ts +162 -0
  162. package/package.json +48 -0
  163. package/providers/EveFrontierProvider.tsx +41 -0
  164. package/providers/NotificationProvider.tsx +115 -0
  165. package/providers/SmartObjectProvider.tsx +282 -0
  166. package/providers/VaultProvider.tsx +114 -0
  167. package/providers/index.ts +17 -0
  168. package/tsconfig.json +22 -0
  169. package/typedoc.json +38 -0
  170. package/types/global.d.ts +7 -0
  171. package/types/index.ts +4 -0
  172. package/types/sponsoredTransaction.ts +26 -0
  173. package/types/types.ts +113 -0
  174. package/types/worldApiReturnTypes.ts +166 -0
  175. package/utils/__tests__/mapping.test.ts +441 -0
  176. package/utils/constants.ts +96 -0
  177. package/utils/datahub.ts +76 -0
  178. package/utils/errors.ts +171 -0
  179. package/utils/index.ts +38 -0
  180. package/utils/mapping.ts +115 -0
  181. package/utils/transforms.ts +258 -0
  182. package/utils/utils.ts +270 -0
  183. package/vite-env.d.ts +16 -0
  184. package/wallet/features.ts +165 -0
  185. package/wallet/index.ts +28 -0
  186. package/wallet/utils.ts +117 -0
@@ -0,0 +1,371 @@
1
+ /**
2
+ * GraphQL queries for fetching Sui objects
3
+ */
4
+
5
+ // ============================================================================
6
+ // Core Object Queries
7
+ // ============================================================================
8
+
9
+ /**
10
+ * Query for fetching a specific object by address with BCS-encoded contents
11
+ * Use this for low-level object access with raw BCS data
12
+ *
13
+ * @category GraphQL
14
+ */
15
+ export const GET_OBJECT_BY_ADDRESS = `
16
+ query GetObjectByAddress($address: SuiAddress!) {
17
+ object(address: $address) {
18
+ address
19
+ version
20
+ digest
21
+ asMoveObject {
22
+ contents {
23
+ type {
24
+ repr
25
+ }
26
+ bcs
27
+ }
28
+ }
29
+ }
30
+ }
31
+ `;
32
+
33
+ /**
34
+ * Query for fetching a specific assembly by ID with JSON-decoded contents
35
+ * Retrieves the assembly contents and dynamic fields from the EVE Frontier world package
36
+ * Use this for higher-level object access with parsed JSON data
37
+ *
38
+ * @category GraphQL
39
+ */
40
+ export const GET_OBJECT_WITH_DYNAMIC_FIELDS = `
41
+ query GetObjectWithDynamicFields($objectId: SuiAddress!) {
42
+ object(address: $objectId) {
43
+ asMoveObject {
44
+ contents {
45
+ json
46
+ }
47
+ dynamicFields {
48
+ nodes {
49
+ contents {
50
+ json
51
+ type {
52
+ layout
53
+ }
54
+ }
55
+ name {
56
+ json
57
+ type {
58
+ repr
59
+ }
60
+ }
61
+ }
62
+ }
63
+ }
64
+ }
65
+ }
66
+ `;
67
+
68
+ /**
69
+ * Query for fetching a specific assembly by ID with JSON-decoded contents
70
+ * Retrieves the assembly contents and dynamic fields from the EVE Frontier world package
71
+ * Use this for higher-level object access with parsed JSON data
72
+ *
73
+ * @category GraphQL
74
+ */
75
+ export const GET_OBJECT_DYNAMICFIELD_CHARACTER_WITH_JSON = `
76
+ query GetObjectOwnerCharacterOwnerAndInventory0(
77
+ $objectId: SuiAddress!
78
+ $characterOwnerType: String!
79
+ ) {
80
+ object(address: $objectId) {
81
+ asMoveObject {
82
+ contents {
83
+ json
84
+ type { repr }
85
+ bcs
86
+ extract(path: "owner_cap_id") {
87
+ asAddress {
88
+ asObject {
89
+ asMoveObject {
90
+ owner {
91
+ ... on AddressOwner {
92
+ address {
93
+ objects(filter: { type: $characterOwnerType }, last: 1) {
94
+ nodes {
95
+ contents {
96
+ authorizedObj: extract(path: "authorized_object_id") {
97
+ asAddress {
98
+ asObject {
99
+ asMoveObject {
100
+ contents { bcs json }
101
+
102
+ }
103
+ }
104
+ }
105
+ }
106
+ }
107
+ }
108
+ }
109
+ }
110
+ }
111
+ }
112
+ }
113
+ }
114
+ }
115
+ }
116
+ }
117
+ dynamicFields {
118
+ nodes {
119
+ contents {
120
+ json
121
+ extract(path: "id") {
122
+ asAddress {
123
+ asObject {
124
+ asMoveObject {
125
+ contents { bcs json }
126
+ }
127
+ }
128
+ }
129
+ }
130
+ }
131
+ name {
132
+ json
133
+ type {
134
+ repr
135
+ }
136
+ }
137
+ }
138
+ }
139
+ }
140
+ }
141
+ }
142
+ `;
143
+
144
+ // ============================================================================
145
+ // Owner & Ownership Queries
146
+ // ============================================================================
147
+
148
+ /**
149
+ * Query to get an object's owner and their owned objects of a specific type
150
+ * Useful for finding related objects (e.g., getting a character's assemblies)
151
+ * Returns BCS-encoded data only
152
+ *
153
+ * @category GraphQL
154
+ */
155
+ export const GET_OBJECT_OWNER_AND_OWNED_OBJECTS_BY_TYPE = `
156
+ query GetObjectOwnerAndOwnedObjectByType($object: SuiAddress!, $owned_object_type: String) {
157
+ object(address: $object) {
158
+ owner {
159
+ ... on AddressOwner {
160
+ address {
161
+ address
162
+ objects(
163
+ filter: {
164
+ type: $owned_object_type
165
+ }
166
+ ) {
167
+ nodes {
168
+ contents {
169
+ bcs
170
+ }
171
+ previousTransaction {
172
+ effects {
173
+ timestamp
174
+ }
175
+ }
176
+ }
177
+ }
178
+ }
179
+ }
180
+ }
181
+ }
182
+ }
183
+ `;
184
+
185
+ /**
186
+ * Query to get an object's owner and their owned objects of a specific type
187
+ * Returns both BCS and JSON-decoded data for easier consumption
188
+ *
189
+ * @category GraphQL
190
+ */
191
+ export const GET_OBJECT_OWNER_AND_OWNED_OBJECTS_WITH_JSON = `
192
+ query GetObjectOwnerAndOwnedObjectWithJson($object: SuiAddress!, $owned_object_type: String) {
193
+ object(address: $object) {
194
+ owner {
195
+ ... on AddressOwner {
196
+ address {
197
+ address
198
+ objects(
199
+ filter: {
200
+ type: $owned_object_type
201
+ }
202
+ ) {
203
+ nodes {
204
+ address
205
+ contents {
206
+ json
207
+ bcs
208
+ }
209
+ previousTransaction {
210
+ effects {
211
+ timestamp
212
+ }
213
+ }
214
+ }
215
+ }
216
+ }
217
+ }
218
+ }
219
+ }
220
+ }
221
+ `;
222
+
223
+ /**
224
+ * Query to get full object details with JSON contents
225
+ * Used to fetch character details after getting the character ID from OwnerCap
226
+ *
227
+ * @category GraphQL
228
+ */
229
+ export const GET_OBJECT_WITH_JSON = `
230
+ query GetObjectWithJson($address: SuiAddress!) {
231
+ object(address: $address) {
232
+ address
233
+ version
234
+ digest
235
+ asMoveObject {
236
+ contents {
237
+ type {
238
+ repr
239
+ }
240
+ json
241
+ bcs
242
+ }
243
+ }
244
+ }
245
+ }
246
+ `;
247
+
248
+ /**
249
+ * Query to get all objects of a specific type owned by an address
250
+ * Returns object addresses only (lightweight)
251
+ *
252
+ * @category GraphQL
253
+ */
254
+ export const GET_OWNED_OBJECTS_BY_TYPE = `
255
+ query GetOwnedObjectsByType($owner: SuiAddress!, $object_type: String) {
256
+ address(address: $owner) {
257
+ objects(
258
+ filter: {
259
+ type: $object_type
260
+ }
261
+ ) {
262
+ nodes {
263
+ address
264
+ }
265
+ }
266
+ }
267
+ }
268
+ `;
269
+
270
+ /**
271
+ * Query for fetching objects owned by an address filtered by package
272
+ * Returns full object data with dynamic fields
273
+ *
274
+ * @category GraphQL
275
+ */
276
+ export const GET_OWNED_OBJECTS_BY_PACKAGE = `
277
+ query GetOwnedObjectsByPackage($owner: SuiAddress!, $packageId: SuiAddress!) {
278
+ objects(
279
+ filter: {
280
+ owner: $owner
281
+ type: { package: $packageId }
282
+ }
283
+ ) {
284
+ nodes {
285
+ address
286
+ version
287
+ asMoveObject {
288
+ contents {
289
+ json
290
+ }
291
+ dynamicFields {
292
+ nodes {
293
+ contents {
294
+ json
295
+ type {
296
+ layout
297
+ }
298
+ }
299
+ name {
300
+ json
301
+ type {
302
+ repr
303
+ }
304
+ }
305
+ }
306
+ }
307
+ }
308
+ }
309
+ }
310
+ }
311
+ `;
312
+
313
+ // ============================================================================
314
+ // Singleton & Type-based Queries
315
+ // ============================================================================
316
+
317
+ /**
318
+ * Query to get a singleton object by its type
319
+ * Returns the first object of the specified type (useful for global/singleton objects)
320
+ *
321
+ * @category GraphQL
322
+ */
323
+ export const GET_SINGLETON_OBJECT_BY_TYPE = `
324
+ query GetSingletonObjectByType($object_type: String) {
325
+ objects(
326
+ filter: {
327
+ type: $object_type
328
+ }
329
+ first: 1
330
+ ) {
331
+ nodes {
332
+ address
333
+ }
334
+ }
335
+ }
336
+ `;
337
+
338
+ /**
339
+ * Query to get all objects of a specific type (global search)
340
+ * Use with caution - may return many results
341
+ *
342
+ * @category GraphQL
343
+ */
344
+ export const GET_OBJECTS_BY_TYPE = `
345
+ query GetObjectsByType($object_type: String, $first: Int, $after: String) {
346
+ objects(
347
+ filter: {
348
+ type: $object_type
349
+ }
350
+ first: $first
351
+ after: $after
352
+ ) {
353
+ nodes {
354
+ address
355
+ version
356
+ asMoveObject {
357
+ contents {
358
+ json
359
+ type {
360
+ repr
361
+ }
362
+ }
363
+ }
364
+ }
365
+ pageInfo {
366
+ hasNextPage
367
+ endCursor
368
+ }
369
+ }
370
+ }
371
+ `;