@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.
- package/README.md +13 -0
- package/graphql/client.ts +96 -24
- package/graphql/index.ts +5 -39
- package/graphql/queries.ts +157 -1
- package/graphql/types.ts +188 -155
- package/hooks/index.ts +1 -0
- package/hooks/useSponsoredTransaction.ts +11 -4
- package/index.ts +7 -71
- package/package.json +11 -1
- package/providers/SmartObjectProvider.tsx +17 -17
- package/types/contexts.ts +1 -1
- package/types/sponsoredTransaction.ts +9 -0
- package/types/types.ts +52 -10
- package/types/worldApiReturnTypes.ts +13 -37
- package/utils/__tests__/burnRate.test.ts +121 -0
- package/utils/__tests__/character.test.ts +112 -0
- package/utils/__tests__/characterOwnedObjects.test.ts +222 -0
- package/utils/__tests__/config.test.ts +424 -0
- package/utils/__tests__/mapping.test.ts +2 -2
- package/utils/burnRate.ts +46 -0
- package/utils/character.ts +46 -0
- package/utils/characterOwnedObjects.ts +52 -0
- package/utils/config.ts +151 -0
- package/utils/constants.ts +39 -5
- package/utils/datahub.ts +3 -41
- package/utils/errors.ts +1 -1
- package/utils/index.ts +10 -1
- package/utils/mapping.ts +5 -2
- package/utils/transforms.ts +27 -31
- package/wallet/features.ts +5 -5
- package/CHANGELOG.md +0 -13
- package/docs/api/.nojekyll +0 -1
- package/docs/api/assets/hierarchy.js +0 -1
- package/docs/api/assets/highlight.css +0 -120
- package/docs/api/assets/icons.js +0 -18
- package/docs/api/assets/icons.svg +0 -1
- package/docs/api/assets/main.js +0 -60
- package/docs/api/assets/navigation.js +0 -1
- package/docs/api/assets/search.js +0 -1
- package/docs/api/assets/style.css +0 -1633
- package/docs/api/classes/WalletNoAccountSelectedError.html +0 -3
- package/docs/api/classes/WalletNotConnectedError.html +0 -3
- package/docs/api/classes/WalletSponsoredTransactionNotSupportedError.html +0 -5
- package/docs/api/enums/ActionTypes.html +0 -6
- package/docs/api/enums/Assemblies.html +0 -7
- package/docs/api/enums/QueryParams.html +0 -3
- package/docs/api/enums/Severity.html +0 -5
- package/docs/api/enums/SponsoredTransactionActions.html +0 -7
- package/docs/api/enums/State.html +0 -6
- package/docs/api/enums/SupportedWallets.html +0 -3
- package/docs/api/enums/TYPEIDS.html +0 -15
- package/docs/api/functions/EveFrontierProvider.html +0 -11
- package/docs/api/functions/NotificationProvider.html +0 -2
- package/docs/api/functions/SmartObjectProvider.html +0 -10
- package/docs/api/functions/VaultProvider.html +0 -1
- package/docs/api/functions/abbreviateAddress.html +0 -11
- package/docs/api/functions/assertAssemblyType.html +0 -9
- package/docs/api/functions/clickToCopy.html +0 -1
- package/docs/api/functions/executeGraphQLQuery.html +0 -12
- package/docs/api/functions/findOwnerByAddress.html +0 -5
- package/docs/api/functions/formatDuration.html +0 -8
- package/docs/api/functions/formatM3.html +0 -8
- package/docs/api/functions/getAssemblyType.html +0 -4
- package/docs/api/functions/getAssemblyTypeApiString.html +0 -2
- package/docs/api/functions/getAssemblyWithOwner.html +0 -18
- package/docs/api/functions/getCharacterOwnerCapType.html +0 -3
- package/docs/api/functions/getCommonItems.html +0 -1
- package/docs/api/functions/getDappUrl.html +0 -7
- package/docs/api/functions/getDatahubGameInfo.html +0 -13
- package/docs/api/functions/getEnv.html +0 -1
- package/docs/api/functions/getEveWorldPackageId.html +0 -4
- package/docs/api/functions/getObjectByAddress.html +0 -9
- package/docs/api/functions/getObjectId.html +0 -4
- package/docs/api/functions/getObjectOwnerAndOwnedObjectsByType.html +0 -10
- package/docs/api/functions/getObjectRegistryType.html +0 -3
- package/docs/api/functions/getObjectWithDynamicFields.html +0 -10
- package/docs/api/functions/getObjectWithJson.html +0 -9
- package/docs/api/functions/getObjectsByType.html +0 -12
- package/docs/api/functions/getOwnedObjectsByPackage.html +0 -10
- package/docs/api/functions/getOwnedObjectsByType.html +0 -10
- package/docs/api/functions/getRegistryAddress.html +0 -3
- package/docs/api/functions/getSingletonObjectByType.html +0 -9
- package/docs/api/functions/getSponsoredTransactionFeature.html +0 -11
- package/docs/api/functions/getSuiGraphqlEndpoint.html +0 -4
- package/docs/api/functions/getTxUrl.html +0 -8
- package/docs/api/functions/getVolumeM3.html +0 -5
- package/docs/api/functions/hasSponsoredTransactionFeature.html +0 -3
- package/docs/api/functions/isOwner.html +0 -10
- package/docs/api/functions/parseErrorFromMessage.html +0 -1
- package/docs/api/functions/parseStatus.html +0 -2
- package/docs/api/functions/parseURL.html +0 -1
- package/docs/api/functions/removeTrailingZeros.html +0 -1
- package/docs/api/functions/transformToAssembly.html +0 -5
- package/docs/api/functions/transformToCharacter.html +0 -2
- package/docs/api/functions/useConnection.html +0 -21
- package/docs/api/functions/useNotification.html +0 -28
- package/docs/api/functions/useSmartObject.html +0 -21
- package/docs/api/functions/useSponsoredTransaction.html +0 -50
- package/docs/api/functions/walletSupportsSponsoredTransaction.html +0 -13
- package/docs/api/hierarchy.html +0 -1
- package/docs/api/index.html +0 -24
- package/docs/api/interfaces/AddressOwner.html +0 -2
- package/docs/api/interfaces/AddressOwnerWithJson.html +0 -2
- package/docs/api/interfaces/AssemblyProperties.html +0 -14
- package/docs/api/interfaces/CharacterInfo.html +0 -8
- package/docs/api/interfaces/DatahubGameInfo.html +0 -30
- package/docs/api/interfaces/DetailedAssemblyResponse.html +0 -14
- package/docs/api/interfaces/DetailedSmartCharacterResponse.html +0 -7
- package/docs/api/interfaces/DynamicFieldNode.html +0 -3
- package/docs/api/interfaces/EphemeralInventory.html +0 -6
- package/docs/api/interfaces/EveFrontierSponsoredTransactionFeature.html +0 -7
- package/docs/api/interfaces/GameTypeResponse.html +0 -13
- package/docs/api/interfaces/GateModule.html +0 -5
- package/docs/api/interfaces/GetObjectByAddressResponse.html +0 -2
- package/docs/api/interfaces/GetObjectOwnerAndOwnedObjectsResponse.html +0 -2
- package/docs/api/interfaces/GetObjectOwnerAndOwnedObjectsWithJsonResponse.html +0 -2
- package/docs/api/interfaces/GetObjectResponse.html +0 -2
- package/docs/api/interfaces/GetObjectWithJsonResponse.html +0 -2
- package/docs/api/interfaces/GetObjectsByTypeResponse.html +0 -2
- package/docs/api/interfaces/GetOwnedObjectsByPackageResponse.html +0 -2
- package/docs/api/interfaces/GetOwnedObjectsByTypeResponse.html +0 -2
- package/docs/api/interfaces/GetSingletonObjectByTypeResponse.html +0 -2
- package/docs/api/interfaces/GraphQLResponse.html +0 -3
- package/docs/api/interfaces/InventoryItem.html +0 -8
- package/docs/api/interfaces/ManufacturingModule.html +0 -2
- package/docs/api/interfaces/MoveObjectContents.html +0 -4
- package/docs/api/interfaces/MoveObjectData.html +0 -3
- package/docs/api/interfaces/NetworkNodeModule.html +0 -6
- package/docs/api/interfaces/NotificationContextType.html +0 -4
- package/docs/api/interfaces/NotificationState.html +0 -6
- package/docs/api/interfaces/Notify.html +0 -6
- package/docs/api/interfaces/ObjectWithContentsNode.html +0 -4
- package/docs/api/interfaces/OwnedObjectAddressNode.html +0 -2
- package/docs/api/interfaces/OwnedObjectFullNode.html +0 -4
- package/docs/api/interfaces/OwnedObjectNode.html +0 -3
- package/docs/api/interfaces/OwnedObjectNodeWithJson.html +0 -4
- package/docs/api/interfaces/OwnerCapData.html +0 -5
- package/docs/api/interfaces/PageInfo.html +0 -3
- package/docs/api/interfaces/RawCharacterData.html +0 -8
- package/docs/api/interfaces/RawSuiObjectData.html +0 -21
- package/docs/api/interfaces/RefineryModule.html +0 -2
- package/docs/api/interfaces/SmartAssemblyResponse.html +0 -11
- package/docs/api/interfaces/SmartObjectContextType.html +0 -7
- package/docs/api/interfaces/SponsoredTransactionInput.html +0 -14
- package/docs/api/interfaces/SponsoredTransactionOutput.html +0 -8
- package/docs/api/interfaces/StorageModule.html +0 -4
- package/docs/api/interfaces/SuiObjectResponse.html +0 -5
- package/docs/api/interfaces/TransformOptions.html +0 -8
- package/docs/api/interfaces/TurretModule.html +0 -2
- package/docs/api/interfaces/VaultContextType.html +0 -8
- package/docs/api/modules.html +0 -1
- package/docs/api/types/AssemblyType.html +0 -1
- package/docs/api/types/ErrorType.html +0 -5
- package/docs/api/types/SendSponsoredTransactionFn.html +0 -1
- package/docs/api/types/SponsoredTransactionArgs.html +0 -2
- package/docs/api/types/SponsoredTransactionAssemblyType.html +0 -2
- package/docs/api/types/SponsoredTransactionMethod.html +0 -2
- package/docs/api/types/UseSponsoredTransactionArgs.html +0 -3
- package/docs/api/types/UseSponsoredTransactionError.html +0 -2
- package/docs/api/types/UseSponsoredTransactionMutationOptions.html +0 -2
- package/docs/api/variables/ASSEMBLY_TYPE_API_STRING.html +0 -2
- package/docs/api/variables/ERRORS.html +0 -1
- package/docs/api/variables/ERROR_MESSAGES.html +0 -1
- package/docs/api/variables/EVEFRONTIER_SPONSORED_TRANSACTION.html +0 -4
- package/docs/api/variables/EXCLUDED_TYPEIDS.html +0 -1
- package/docs/api/variables/GET_OBJECTS_BY_TYPE.html +0 -3
- package/docs/api/variables/GET_OBJECT_BY_ADDRESS.html +0 -3
- package/docs/api/variables/GET_OBJECT_OWNER_AND_OWNED_OBJECTS_BY_TYPE.html +0 -4
- package/docs/api/variables/GET_OBJECT_OWNER_AND_OWNED_OBJECTS_WITH_JSON.html +0 -3
- package/docs/api/variables/GET_OBJECT_WITH_DYNAMIC_FIELDS.html +0 -4
- package/docs/api/variables/GET_OBJECT_WITH_JSON.html +0 -3
- package/docs/api/variables/GET_OWNED_OBJECTS_BY_PACKAGE.html +0 -3
- package/docs/api/variables/GET_OWNED_OBJECTS_BY_TYPE.html +0 -3
- package/docs/api/variables/GET_SINGLETON_OBJECT_BY_TYPE.html +0 -3
- package/docs/api/variables/NotificationContext.html +0 -1
- package/docs/api/variables/ONE_M3.html +0 -2
- package/docs/api/variables/POLLING_INTERVAL.html +0 -2
- package/docs/api/variables/STORAGE_KEYS.html +0 -2
- package/docs/api/variables/SmartObjectContext.html +0 -1
- package/docs/api/variables/VaultContext.html +0 -1
- package/docs/api/variables/dAppKit.html +0 -2
- package/tsconfig.json +0 -22
- package/typedoc.json +0 -38
- 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
|
-
|
|
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 {
|
|
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
|
-
|
|
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 (
|
|
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
|
-
|
|
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 {
|
|
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
|
|
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";
|
package/graphql/queries.ts
CHANGED
|
@@ -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
|
|
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
|