@1shotapi/client-sdk 1.0.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 (86) hide show
  1. package/README.md +162 -0
  2. package/dist/categories/chains.d.ts +21 -0
  3. package/dist/categories/chains.js +44 -0
  4. package/dist/categories/chains.js.map +1 -0
  5. package/dist/categories/contractEvents.d.ts +103 -0
  6. package/dist/categories/contractEvents.js +115 -0
  7. package/dist/categories/contractEvents.js.map +1 -0
  8. package/dist/categories/contractMethods.d.ts +377 -0
  9. package/dist/categories/contractMethods.js +317 -0
  10. package/dist/categories/contractMethods.js.map +1 -0
  11. package/dist/categories/structs.d.ts +40 -0
  12. package/dist/categories/structs.js +68 -0
  13. package/dist/categories/structs.js.map +1 -0
  14. package/dist/categories/transactions.d.ts +31 -0
  15. package/dist/categories/transactions.js +51 -0
  16. package/dist/categories/transactions.js.map +1 -0
  17. package/dist/categories/wallets.d.ts +167 -0
  18. package/dist/categories/wallets.js +238 -0
  19. package/dist/categories/wallets.js.map +1 -0
  20. package/dist/client.d.ts +22 -0
  21. package/dist/client.js +61 -0
  22. package/dist/client.js.map +1 -0
  23. package/dist/index.d.ts +17 -0
  24. package/dist/index.js +22 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/types/abi.d.ts +32 -0
  27. package/dist/types/abi.js +2 -0
  28. package/dist/types/abi.js.map +1 -0
  29. package/dist/types/chain.d.ts +26 -0
  30. package/dist/types/chain.js +2 -0
  31. package/dist/types/chain.js.map +1 -0
  32. package/dist/types/client.d.ts +13 -0
  33. package/dist/types/client.js +2 -0
  34. package/dist/types/client.js.map +1 -0
  35. package/dist/types/common.d.ts +8 -0
  36. package/dist/types/common.js +2 -0
  37. package/dist/types/common.js.map +1 -0
  38. package/dist/types/contract.d.ts +5 -0
  39. package/dist/types/contract.js +2 -0
  40. package/dist/types/contract.js.map +1 -0
  41. package/dist/types/contractEvent.d.ts +46 -0
  42. package/dist/types/contractEvent.js +2 -0
  43. package/dist/types/contractEvent.js.map +1 -0
  44. package/dist/types/contractMethod.d.ts +31 -0
  45. package/dist/types/contractMethod.js +2 -0
  46. package/dist/types/contractMethod.js.map +1 -0
  47. package/dist/types/struct.d.ts +8 -0
  48. package/dist/types/struct.js +2 -0
  49. package/dist/types/struct.js.map +1 -0
  50. package/dist/types/transaction.d.ts +12 -0
  51. package/dist/types/transaction.js +2 -0
  52. package/dist/types/transaction.js.map +1 -0
  53. package/dist/types/wallet.d.ts +30 -0
  54. package/dist/types/wallet.js +2 -0
  55. package/dist/types/wallet.js.map +1 -0
  56. package/dist/types.d.ts +11 -0
  57. package/dist/types.js +2 -0
  58. package/dist/types.js.map +1 -0
  59. package/dist/utils/webhook.d.ts +19 -0
  60. package/dist/utils/webhook.js +66 -0
  61. package/dist/utils/webhook.js.map +1 -0
  62. package/dist/validation/abi.d.ts +470 -0
  63. package/dist/validation/abi.js +99 -0
  64. package/dist/validation/abi.js.map +1 -0
  65. package/dist/validation/chain.d.ts +157 -0
  66. package/dist/validation/chain.js +71 -0
  67. package/dist/validation/chain.js.map +1 -0
  68. package/dist/validation/common.d.ts +17 -0
  69. package/dist/validation/common.js +16 -0
  70. package/dist/validation/common.js.map +1 -0
  71. package/dist/validation/contractEvent.d.ts +323 -0
  72. package/dist/validation/contractEvent.js +148 -0
  73. package/dist/validation/contractEvent.js.map +1 -0
  74. package/dist/validation/contractMethod.d.ts +2746 -0
  75. package/dist/validation/contractMethod.js +787 -0
  76. package/dist/validation/contractMethod.js.map +1 -0
  77. package/dist/validation/struct.d.ts +495 -0
  78. package/dist/validation/struct.js +291 -0
  79. package/dist/validation/struct.js.map +1 -0
  80. package/dist/validation/transaction.d.ts +359 -0
  81. package/dist/validation/transaction.js +206 -0
  82. package/dist/validation/transaction.js.map +1 -0
  83. package/dist/validation/wallet.d.ts +537 -0
  84. package/dist/validation/wallet.js +287 -0
  85. package/dist/validation/wallet.js.map +1 -0
  86. package/package.json +71 -0
package/README.md ADDED
@@ -0,0 +1,162 @@
1
+ # @uxly/1shot-client
2
+
3
+ This is a TypeScript client SDK for 1Shot. It provides both a strongly typed REST client and a utility method for verifying webhook signatures.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @uxly/1shot-client
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### REST Client
14
+
15
+ ```typescript
16
+ import { OneShotClient } from '@uxly/1shot-client';
17
+
18
+ // Initialize the client
19
+ const client = new OneShotClient({
20
+ apiKey: 'your_api_key',
21
+ apiSecret: 'your_api_secret',
22
+ baseUrl: 'https://api.1shotapi.com/v1' // Optional, defaults to this URL
23
+ });
24
+
25
+ // List contractMethods for a business
26
+ const contractMethods = await client.contractMethods.list({
27
+ businessId: 'your_business_id',
28
+ params: { page: 1, pageSize: 10 }
29
+ });
30
+
31
+ // Execute a Contract Method
32
+ const transaction = await client.contractMethods.execute({
33
+ contractMethodId: 'your_contract_method_id',
34
+ params: {
35
+ amount: '1000000000000000000', // 1 ETH in wei
36
+ recipient: '0x123...'
37
+ }
38
+ });
39
+
40
+ // Get Contract Method details
41
+ const contractMethod = await client.contractMethods.get('your_contract_method_id');
42
+
43
+ // Create a new transaction
44
+ const newContractMethod = await client.contractMethods.create({
45
+ businessId: 'your_business_id',
46
+ params: {
47
+ name: 'Transfer ETH',
48
+ description: 'Transfer ETH to a recipient',
49
+ chainId: 1, // Ethereum mainnet
50
+ contractAddress: '0x...',
51
+ functionName: 'transfer',
52
+ stateMutability: 'nonpayable',
53
+ inputs: [
54
+ {
55
+ name: 'recipient',
56
+ type: 'address'
57
+ },
58
+ {
59
+ name: 'amount',
60
+ type: 'uint256'
61
+ }
62
+ ]
63
+ }
64
+ });
65
+ ```
66
+
67
+ ### Webhook Verification
68
+
69
+ #### Using the Standalone Function
70
+
71
+ ```typescript
72
+ import { verifyWebhook } from '@uxly/1shot-client';
73
+ import express from 'express';
74
+
75
+ const app = express();
76
+ app.use(express.json());
77
+
78
+ app.post('/webhook', async (req, res) => {
79
+ // Get the webhook body and signature
80
+ const body = req.body;
81
+ const signature = body.signature;
82
+ delete body.signature;
83
+
84
+ if (!signature) {
85
+ return res.status(400).json({ error: 'Signature missing' });
86
+ }
87
+
88
+ // Your webhook public key
89
+ const publicKey = 'your_webhook_public_key';
90
+
91
+ try {
92
+ // Verify the webhook signature
93
+ const isValid = verifyWebhook({
94
+ body,
95
+ signature,
96
+ publicKey
97
+ });
98
+
99
+ if (!isValid) {
100
+ return res.status(403).json({ error: 'Invalid signature' });
101
+ }
102
+
103
+ return res.json({ message: 'Webhook verified successfully' });
104
+
105
+ } catch (error) {
106
+ return res.status(403).json({ error: error.message });
107
+ }
108
+ });
109
+ ```
110
+
111
+
112
+ ## Error Handling
113
+
114
+ The client throws errors for various conditions:
115
+
116
+ - `RequestError` for HTTP request failures
117
+ - `ValidationError` for invalid parameters
118
+ - `InvalidSignatureError` for invalid webhook signatures
119
+
120
+ ## Type Safety
121
+
122
+ The client includes comprehensive TypeScript types for better IDE support and type checking. All models and responses are properly typed using TypeScript interfaces.
123
+
124
+ ## Publishing
125
+
126
+ This package is published to npm using modern Node.js packaging tools. Here's how to publish a new version:
127
+
128
+ 1. Update the version in `package.json`:
129
+ ```json
130
+ {
131
+ "version": "0.1.0" // Update this to your new version
132
+ }
133
+ ```
134
+
135
+ 2. Build the package:
136
+ ```bash
137
+ npm run build
138
+ ```
139
+
140
+ 3. Test the build:
141
+ ```bash
142
+ npm pack
143
+ npm install ./uxly-1shot-client-0.1.0.tgz
144
+ ```
145
+
146
+ 4. Publish to npm:
147
+ ```bash
148
+ npm publish
149
+ ```
150
+
151
+ Note: You'll need to have an npm account and be logged in. You can log in using:
152
+ ```bash
153
+ npm login
154
+ ```
155
+
156
+ ## Contributing
157
+
158
+ Contributions are welcome! Please feel free to submit a Pull Request.
159
+
160
+ ## License
161
+
162
+ This project is licensed under the MIT License - see the LICENSE file for details.
@@ -0,0 +1,21 @@
1
+ import { ChainInfo, ListChains, GasFees } from "../types/chain.js";
2
+ import { IOneShotClient } from "../types/client.js";
3
+ import { PagedResponse } from "../types/common.js";
4
+ export declare class Chains {
5
+ private client;
6
+ constructor(client: IOneShotClient);
7
+ /**
8
+ * List all chains supported by 1Shot API
9
+ * @param params Optional pagination parameters
10
+ * @returns Promise<PagedResponse<ChainInfo>>
11
+ * @throws {ZodError} If the parameters are invalid
12
+ */
13
+ list(params?: ListChains): Promise<PagedResponse<ChainInfo>>;
14
+ /**
15
+ * Get current gas fees for a specific chain
16
+ * @param chainId The ChainId of the chain to get fees for
17
+ * @returns Promise<GasFees>
18
+ * @throws {ZodError} If the chainId is invalid
19
+ */
20
+ getFees(chainId: number): Promise<GasFees>;
21
+ }
@@ -0,0 +1,44 @@
1
+ import { chainListSchema, listChainsSchema, gasFeesSchema, getFeesSchema, } from "../validation/chain.js";
2
+ export class Chains {
3
+ constructor(client) {
4
+ this.client = client;
5
+ }
6
+ /**
7
+ * List all chains supported by 1Shot API
8
+ * @param params Optional pagination parameters
9
+ * @returns Promise<PagedResponse<ChainInfo>>
10
+ * @throws {ZodError} If the parameters are invalid
11
+ */
12
+ async list(params) {
13
+ // Validate all parameters using the schema
14
+ const validatedParams = listChainsSchema.parse(params || {});
15
+ const queryParams = new URLSearchParams();
16
+ if (validatedParams.pageSize != undefined) {
17
+ queryParams.append("pageSize", validatedParams.pageSize.toString());
18
+ }
19
+ if (validatedParams.page != undefined) {
20
+ queryParams.append("page", validatedParams.page.toString());
21
+ }
22
+ const queryString = queryParams.toString();
23
+ const path = queryString ? `/chains?${queryString}` : "/chains";
24
+ const response = await this.client.request("GET", path);
25
+ // Validate the response
26
+ return chainListSchema.parse(response);
27
+ }
28
+ /**
29
+ * Get current gas fees for a specific chain
30
+ * @param chainId The ChainId of the chain to get fees for
31
+ * @returns Promise<GasFees>
32
+ * @throws {ZodError} If the chainId is invalid
33
+ */
34
+ async getFees(chainId) {
35
+ // Validate all parameters using the schema
36
+ const validatedParams = getFeesSchema.parse({
37
+ chainId,
38
+ });
39
+ const response = await this.client.request("GET", `/chains/${validatedParams.chainId}/fees`);
40
+ // Validate the response
41
+ return gasFeesSchema.parse(response);
42
+ }
43
+ }
44
+ //# sourceMappingURL=chains.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chains.js","sourceRoot":"","sources":["../../src/categories/chains.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,aAAa,GACd,MAAM,wBAAwB,CAAC;AAEhC,MAAM,OAAO,MAAM;IACjB,YAAoB,MAAsB;QAAtB,WAAM,GAAN,MAAM,CAAgB;IAAG,CAAC;IAE9C;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CAAC,MAAmB;QAC5B,2CAA2C;QAC3C,MAAM,eAAe,GAAG,gBAAgB,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;QAE7D,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;QAC1C,IAAI,eAAe,CAAC,QAAQ,IAAI,SAAS,EAAE,CAAC;YAC1C,WAAW,CAAC,MAAM,CAAC,UAAU,EAAE,eAAe,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;QACtE,CAAC;QACD,IAAI,eAAe,CAAC,IAAI,IAAI,SAAS,EAAE,CAAC;YACtC,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC9D,CAAC;QAED,MAAM,WAAW,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;QAC3C,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QAEhE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA2B,KAAK,EAAE,IAAI,CAAC,CAAC;QAElF,wBAAwB;QACxB,OAAO,eAAe,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,OAAO,CAAC,OAAe;QAC3B,2CAA2C;QAC3C,MAAM,eAAe,GAAG,aAAa,CAAC,KAAK,CAAC;YAC1C,OAAO;SACR,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CACxC,KAAK,EACL,WAAW,eAAe,CAAC,OAAO,OAAO,CAC1C,CAAC;QAEF,wBAAwB;QACxB,OAAO,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;CACF"}
@@ -0,0 +1,103 @@
1
+ import { z } from "zod";
2
+ import { IOneShotClient } from "../types/client.js";
3
+ import { PagedResponse } from "../types/common.js";
4
+ import { ContractEvent, UpdateContractEvent, SearchContractEventLogs, ContractEventSearchResult } from "../types/contractEvent.js";
5
+ declare const listContractEventsSchemaOptions: z.ZodObject<Omit<{
6
+ businessId: z.ZodString;
7
+ pageSize: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
8
+ page: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
9
+ chainId: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
10
+ name: z.ZodNullable<z.ZodOptional<z.ZodString>>;
11
+ status: z.ZodNullable<z.ZodOptional<z.ZodEnum<["active", "deleted", "all"]>>>;
12
+ contractAddress: z.ZodNullable<z.ZodOptional<z.ZodString>>;
13
+ eventName: z.ZodNullable<z.ZodOptional<z.ZodString>>;
14
+ }, "businessId">, "strip", z.ZodTypeAny, {
15
+ status?: "active" | "deleted" | "all" | null | undefined;
16
+ name?: string | null | undefined;
17
+ chainId?: number | null | undefined;
18
+ page?: number | null | undefined;
19
+ pageSize?: number | null | undefined;
20
+ eventName?: string | null | undefined;
21
+ contractAddress?: string | null | undefined;
22
+ }, {
23
+ status?: "active" | "deleted" | "all" | null | undefined;
24
+ name?: string | null | undefined;
25
+ chainId?: number | null | undefined;
26
+ page?: number | null | undefined;
27
+ pageSize?: number | null | undefined;
28
+ eventName?: string | null | undefined;
29
+ contractAddress?: string | null | undefined;
30
+ }>;
31
+ declare const createContractEventSchemaOptions: z.ZodObject<Omit<{
32
+ businessId: z.ZodString;
33
+ chainId: z.ZodNumber;
34
+ contractAddress: z.ZodString;
35
+ name: z.ZodString;
36
+ description: z.ZodString;
37
+ eventName: z.ZodString;
38
+ }, "businessId">, "strip", z.ZodTypeAny, {
39
+ name: string;
40
+ chainId: number;
41
+ eventName: string;
42
+ contractAddress: string;
43
+ description: string;
44
+ }, {
45
+ name: string;
46
+ chainId: number;
47
+ eventName: string;
48
+ contractAddress: string;
49
+ description: string;
50
+ }>;
51
+ export declare class ContractEvents {
52
+ private client;
53
+ constructor(client: IOneShotClient);
54
+ /**
55
+ * Create a new contract event definition for monitoring blockchain events
56
+ * @param businessId The business ID that owns this event definition
57
+ * @param params Contract event creation parameters
58
+ * @returns Promise<ContractEvent>
59
+ * @throws {ZodError} If the parameters are invalid
60
+ */
61
+ create(businessId: string, params: z.infer<typeof createContractEventSchemaOptions>): Promise<ContractEvent>;
62
+ /**
63
+ * List contract event definitions for a business with optional filtering
64
+ * @param businessId The business ID to list events for
65
+ * @param params Optional filtering and pagination parameters
66
+ * @returns Promise<PagedResponse<ContractEvent>>
67
+ * @throws {ZodError} If the parameters are invalid
68
+ */
69
+ list(businessId: string, params?: z.infer<typeof listContractEventsSchemaOptions>): Promise<PagedResponse<ContractEvent>>;
70
+ /**
71
+ * Get a specific contract event definition by ID
72
+ * @param contractEventId The ID of the contract event to retrieve
73
+ * @returns Promise<ContractEvent>
74
+ * @throws {ZodError} If the parameters are invalid
75
+ */
76
+ get(contractEventId: string): Promise<ContractEvent>;
77
+ /**
78
+ * Update an existing contract event definition
79
+ * @param contractEventId The ID of the contract event to update
80
+ * @param params Update parameters
81
+ * @returns Promise<ContractEvent>
82
+ * @throws {ZodError} If the parameters are invalid
83
+ */
84
+ update(contractEventId: string, params: UpdateContractEvent): Promise<ContractEvent>;
85
+ /**
86
+ * Delete a contract event definition
87
+ * @param contractEventId The ID of the contract event to delete
88
+ * @returns Promise<{ success: boolean }>
89
+ * @throws {ZodError} If the parameters are invalid
90
+ */
91
+ delete(contractEventId: string): Promise<{
92
+ success: boolean;
93
+ }>;
94
+ /**
95
+ * Search contract event logs from the blockchain for the specified event definition
96
+ * @param contractEventId The ID of the contract event to search logs for
97
+ * @param params Optional search parameters
98
+ * @returns Promise<ContractEventSearchResult>
99
+ * @throws {ZodError} If the parameters are invalid
100
+ */
101
+ searchLogs(contractEventId: string, params?: SearchContractEventLogs): Promise<ContractEventSearchResult>;
102
+ }
103
+ export {};
@@ -0,0 +1,115 @@
1
+ import { contractEventSchema, contractEventListSchema, createContractEventSchema, listContractEventsSchema, getContractEventSchema, updateContractEventSchema, deleteContractEventSchema, searchContractEventLogsSchema, contractEventSearchResultSchema, } from "../validation/contractEvent.js";
2
+ const listContractEventsSchemaOptions = listContractEventsSchema.omit({
3
+ businessId: true,
4
+ });
5
+ const createContractEventSchemaOptions = createContractEventSchema.omit({
6
+ businessId: true,
7
+ });
8
+ export class ContractEvents {
9
+ constructor(client) {
10
+ this.client = client;
11
+ }
12
+ /**
13
+ * Create a new contract event definition for monitoring blockchain events
14
+ * @param businessId The business ID that owns this event definition
15
+ * @param params Contract event creation parameters
16
+ * @returns Promise<ContractEvent>
17
+ * @throws {ZodError} If the parameters are invalid
18
+ */
19
+ async create(businessId, params) {
20
+ const validatedParams = createContractEventSchema.parse({
21
+ businessId,
22
+ ...params,
23
+ });
24
+ const response = await this.client.request("POST", `/business/${validatedParams.businessId}/events`, validatedParams);
25
+ return contractEventSchema.parse(response);
26
+ }
27
+ /**
28
+ * List contract event definitions for a business with optional filtering
29
+ * @param businessId The business ID to list events for
30
+ * @param params Optional filtering and pagination parameters
31
+ * @returns Promise<PagedResponse<ContractEvent>>
32
+ * @throws {ZodError} If the parameters are invalid
33
+ */
34
+ async list(businessId, params) {
35
+ const validatedParams = listContractEventsSchema.parse({
36
+ businessId,
37
+ ...params,
38
+ });
39
+ const queryParams = new URLSearchParams();
40
+ if (validatedParams.pageSize !== undefined && validatedParams.pageSize !== null) {
41
+ queryParams.append("pageSize", validatedParams.pageSize.toString());
42
+ }
43
+ if (validatedParams.page !== undefined && validatedParams.page !== null) {
44
+ queryParams.append("page", validatedParams.page.toString());
45
+ }
46
+ if (validatedParams.chainId !== undefined && validatedParams.chainId !== null) {
47
+ queryParams.append("chainId", validatedParams.chainId.toString());
48
+ }
49
+ if (validatedParams.name !== undefined && validatedParams.name !== null) {
50
+ queryParams.append("name", validatedParams.name);
51
+ }
52
+ if (validatedParams.status !== undefined && validatedParams.status !== null) {
53
+ queryParams.append("status", validatedParams.status);
54
+ }
55
+ if (validatedParams.contractAddress !== undefined && validatedParams.contractAddress !== null) {
56
+ queryParams.append("contractAddress", validatedParams.contractAddress);
57
+ }
58
+ if (validatedParams.eventName !== undefined && validatedParams.eventName !== null) {
59
+ queryParams.append("eventName", validatedParams.eventName);
60
+ }
61
+ const queryString = queryParams.toString();
62
+ const path = queryString
63
+ ? `/business/${validatedParams.businessId}/events?${queryString}`
64
+ : `/business/${validatedParams.businessId}/events`;
65
+ const response = await this.client.request("GET", path);
66
+ return contractEventListSchema.parse(response);
67
+ }
68
+ /**
69
+ * Get a specific contract event definition by ID
70
+ * @param contractEventId The ID of the contract event to retrieve
71
+ * @returns Promise<ContractEvent>
72
+ * @throws {ZodError} If the parameters are invalid
73
+ */
74
+ async get(contractEventId) {
75
+ const validatedParams = getContractEventSchema.parse({ contractEventId });
76
+ const response = await this.client.request("GET", `/events/${validatedParams.contractEventId}`);
77
+ return contractEventSchema.parse(response);
78
+ }
79
+ /**
80
+ * Update an existing contract event definition
81
+ * @param contractEventId The ID of the contract event to update
82
+ * @param params Update parameters
83
+ * @returns Promise<ContractEvent>
84
+ * @throws {ZodError} If the parameters are invalid
85
+ */
86
+ async update(contractEventId, params) {
87
+ const validatedParams = updateContractEventSchema.parse(params);
88
+ const response = await this.client.request("PUT", `/events/${contractEventId}`, validatedParams);
89
+ return contractEventSchema.parse(response);
90
+ }
91
+ /**
92
+ * Delete a contract event definition
93
+ * @param contractEventId The ID of the contract event to delete
94
+ * @returns Promise<{ success: boolean }>
95
+ * @throws {ZodError} If the parameters are invalid
96
+ */
97
+ async delete(contractEventId) {
98
+ const validatedParams = deleteContractEventSchema.parse({ contractEventId });
99
+ const response = await this.client.request("DELETE", `/events/${validatedParams.contractEventId}`);
100
+ return response;
101
+ }
102
+ /**
103
+ * Search contract event logs from the blockchain for the specified event definition
104
+ * @param contractEventId The ID of the contract event to search logs for
105
+ * @param params Optional search parameters
106
+ * @returns Promise<ContractEventSearchResult>
107
+ * @throws {ZodError} If the parameters are invalid
108
+ */
109
+ async searchLogs(contractEventId, params) {
110
+ const validatedParams = searchContractEventLogsSchema.parse(params || {});
111
+ const response = await this.client.request("POST", `/events/${contractEventId}/search`, validatedParams);
112
+ return contractEventSearchResultSchema.parse(response);
113
+ }
114
+ }
115
+ //# sourceMappingURL=contractEvents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contractEvents.js","sourceRoot":"","sources":["../../src/categories/contractEvents.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,EACtB,yBAAyB,EACzB,yBAAyB,EACzB,6BAA6B,EAC7B,+BAA+B,GAChC,MAAM,gCAAgC,CAAC;AAExC,MAAM,+BAA+B,GAAG,wBAAwB,CAAC,IAAI,CAAC;IACpE,UAAU,EAAE,IAAI;CACjB,CAAC,CAAC;AAEH,MAAM,gCAAgC,GAAG,yBAAyB,CAAC,IAAI,CAAC;IACtE,UAAU,EAAE,IAAI;CACjB,CAAC,CAAC;AAEH,MAAM,OAAO,cAAc;IACzB,YAAoB,MAAsB;QAAtB,WAAM,GAAN,MAAM,CAAgB;IAAG,CAAC;IAE9C;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,CACV,UAAkB,EAClB,MAAwD;QAExD,MAAM,eAAe,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