@turtleclub/hooks 0.5.0-beta.76 → 0.5.0-beta.77
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/dist/index.cjs +28 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +25 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/v2/covers/api.ts +22 -3
- package/src/v2/covers/index.ts +3 -3
- package/src/v2/covers/schema.ts +16 -0
package/dist/index.cjs
CHANGED
|
@@ -183,6 +183,9 @@ __export(index_exports, {
|
|
|
183
183
|
streamWalletSchema: () => streamWalletSchema,
|
|
184
184
|
streamWalletSnapshotSchema: () => streamWalletSnapshotSchema,
|
|
185
185
|
streamsQueries: () => streamsQueries,
|
|
186
|
+
submitCoverPurchase: () => submitCoverPurchase,
|
|
187
|
+
submitCoverPurchaseDataSchema: () => submitCoverPurchaseDataSchema,
|
|
188
|
+
submitCoverPurchaseResponseSchema: () => submitCoverPurchaseResponseSchema,
|
|
186
189
|
submitCoverRequest: () => submitCoverRequest,
|
|
187
190
|
submitCoverRequestResponseSchema: () => submitCoverRequestResponseSchema,
|
|
188
191
|
supportedChainEcosystemSchema: () => supportedChainEcosystemSchema,
|
|
@@ -2238,6 +2241,15 @@ var checkCoverRequestResponseSchema = import_zod16.z.object({
|
|
|
2238
2241
|
canSubmit: import_zod16.z.boolean(),
|
|
2239
2242
|
existingRequest: coverRequestDataSchema.nullable()
|
|
2240
2243
|
});
|
|
2244
|
+
var submitCoverPurchaseDataSchema = import_zod16.z.object({
|
|
2245
|
+
walletAddress: import_zod16.z.string().regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address"),
|
|
2246
|
+
txHash: import_zod16.z.string().regex(/^0x[a-fA-F0-9]{64}$/, "Invalid transaction hash")
|
|
2247
|
+
});
|
|
2248
|
+
var submitCoverPurchaseResponseSchema = import_zod16.z.object({
|
|
2249
|
+
success: import_zod16.z.boolean(),
|
|
2250
|
+
message: import_zod16.z.string(),
|
|
2251
|
+
id: import_zod16.z.string()
|
|
2252
|
+
});
|
|
2241
2253
|
|
|
2242
2254
|
// src/v2/covers/api.ts
|
|
2243
2255
|
async function submitCoverRequest(data) {
|
|
@@ -2247,11 +2259,23 @@ async function submitCoverRequest(data) {
|
|
|
2247
2259
|
});
|
|
2248
2260
|
const result = submitCoverRequestResponseSchema.safeParse(response);
|
|
2249
2261
|
if (!result.success) {
|
|
2250
|
-
console.
|
|
2262
|
+
console.error("[ZOD ERROR]", result.error);
|
|
2251
2263
|
throw new Error(`Failed to submit cover request due to an invalid server response.`);
|
|
2252
2264
|
}
|
|
2253
2265
|
return result.data;
|
|
2254
2266
|
}
|
|
2267
|
+
async function submitCoverPurchase(data) {
|
|
2268
|
+
const response = await apiClient.fetch("/turtle/nexus-cover-purchases", {
|
|
2269
|
+
method: "POST",
|
|
2270
|
+
body: data
|
|
2271
|
+
});
|
|
2272
|
+
const result = submitCoverPurchaseResponseSchema.safeParse(response);
|
|
2273
|
+
if (!result.success) {
|
|
2274
|
+
console.error("[ZOD ERROR]", result.error);
|
|
2275
|
+
throw new Error("Failed to submit cover purchase tracking due to an invalid server response.");
|
|
2276
|
+
}
|
|
2277
|
+
return result.data;
|
|
2278
|
+
}
|
|
2255
2279
|
async function checkCoverRequest({
|
|
2256
2280
|
protocolName
|
|
2257
2281
|
}) {
|
|
@@ -4762,6 +4786,9 @@ var queries = (0, import_query_key_factory21.mergeQueryKeys)(
|
|
|
4762
4786
|
streamWalletSchema,
|
|
4763
4787
|
streamWalletSnapshotSchema,
|
|
4764
4788
|
streamsQueries,
|
|
4789
|
+
submitCoverPurchase,
|
|
4790
|
+
submitCoverPurchaseDataSchema,
|
|
4791
|
+
submitCoverPurchaseResponseSchema,
|
|
4765
4792
|
submitCoverRequest,
|
|
4766
4793
|
submitCoverRequestResponseSchema,
|
|
4767
4794
|
supportedChainEcosystemSchema,
|