@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/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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
166
|
-
|
|
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
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
|
|
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
|
-
|
|
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:
|
|
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
|
@@ -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:
|
|
382
|
-
|
|
388
|
+
assemblyType: assemblyType,
|
|
389
|
+
metadata: args.metadata,
|
|
383
390
|
tenant,
|
|
384
391
|
};
|
|
385
392
|
|
|
386
|
-
console.log("
|
|
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.
|
|
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",
|