denotify-client 1.1.20 → 1.1.22

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.
@@ -56,18 +56,6 @@ export type PollFunctionV1 = {
56
56
  responseArgDecimals?: number;
57
57
  constant?: number;
58
58
  };
59
- export type HandlerFunctionCallRawConfig = {
60
- nBlocks: number;
61
- address: string;
62
- abi: any;
63
- fixedArgs?: (string | number)[];
64
- function: string;
65
- condition: Condition;
66
- responseArgIndex?: number;
67
- responseArgDecimals?: number;
68
- constant?: number;
69
- };
70
- export type HandlerFunctionCallUpdate = Partial<HandlerFunctionCallRawConfig>;
71
59
  export type OnchainEventV1 = {
72
60
  address: string;
73
61
  event: string;
@@ -77,30 +65,21 @@ export type OnchainEventV1 = {
77
65
  paramsDecimals?: number;
78
66
  constant?: number;
79
67
  };
80
- export type HandlerOnchainEventRawConfig = {
81
- address: string;
82
- event: string;
83
- abi: any;
84
- condition: Condition;
85
- paramsIndex?: number;
86
- paramsDecimals?: number;
87
- constant?: number;
88
- };
89
- export type HandlerOnchainEventUpdate = Partial<HandlerOnchainEventRawConfig>;
90
68
  export type FunctionCallerConfig = {
91
69
  address: string;
92
70
  bytecode: string;
93
71
  abiHash: string;
94
72
  function: string;
95
- }[];
73
+ };
96
74
  export declare class FunctionBuilder {
97
75
  private api?;
98
76
  private data;
99
77
  private constructor();
100
78
  static create(api?: DeNotifyClient): FunctionBuilder;
101
79
  getAbiHash(abi: any): Promise<string>;
80
+ static readFields(data: FunctionCallerConfig[], abis: any[][]): any[];
102
81
  addFunction<T = any>(address: string, func: string, args: T[], abi: any, abiHash?: string): Promise<this>;
103
- get(): FunctionCallerConfig;
82
+ get(): FunctionCallerConfig[];
104
83
  static schema(): yup.ArraySchema<{
105
84
  function: string;
106
85
  address: string;
@@ -158,36 +137,23 @@ export type PollFunctionV2 = {
158
137
  timePeriod?: string | null;
159
138
  startTime?: number;
160
139
  debounceCount?: number;
161
- functions: FunctionCallerConfig | null;
140
+ functions: FunctionCallerConfig[] | null;
162
141
  triggerOn: "always" | "filter";
163
142
  latch?: boolean;
164
143
  filterVersion: string | null;
165
144
  filter: FilterConfig | null;
166
145
  };
167
- export type HandlerFunctionCallV2Update = Partial<PollFunctionV2>;
168
146
  export type OnchainEventV2 = {
169
147
  addresses: string[];
170
148
  abiHash: string;
171
149
  event: string;
172
150
  debounceCount?: number;
173
- functions: FunctionCallerConfig | null;
151
+ functions: FunctionCallerConfig[] | null;
174
152
  triggerOn?: "always" | "filter";
175
153
  latch?: boolean;
176
154
  filterVersion: string | null;
177
155
  filter: FilterConfig | null;
178
156
  };
179
- export type HandlerOnchainEventV2RawConfig = {
180
- addresses: string[];
181
- abiHash: string;
182
- event: string;
183
- debounceCount?: number;
184
- functions: FunctionCallerConfig | null;
185
- triggerOn: "always" | "filter";
186
- latch: boolean;
187
- filterVersion: string | null;
188
- filter: FilterConfig | null;
189
- };
190
- export type HandlerOnchainEventV2Update = Partial<HandlerOnchainEventV2RawConfig>;
191
157
  export type Network = "ethereum" | "avalanche" | "bsc" | "polygon" | "fantom" | "optimism" | "arbitrum" | "canto";
192
158
  export type TriggerConfig = PollFunctionV2 | PollFunctionV1 | OnchainEventV1 | OnchainEventV2;
193
159
  export type TriggerTypeId = "PollFunctionV2" | "OnchainEventV1" | "PollFunctionV1" | "OnchainEventV2";
@@ -196,8 +162,14 @@ export type Trigger = TriggerConfig & {
196
162
  error_message?: string | null;
197
163
  error_timestamp?: number | null;
198
164
  };
199
- export type TriggerUpdate = HandlerFunctionCallV2Update | HandlerFunctionCallUpdate | HandlerOnchainEventUpdate | HandlerOnchainEventV2Update;
200
165
  export type TriggerTypeRawId = "handler_function_call" | "handler_onchain_event" | "handler_function_call_v2" | "handler_onchain_event_v2";
166
+ export type FieldDescription = {
167
+ source: string;
168
+ label: string;
169
+ type: string;
170
+ key: string;
171
+ index?: number;
172
+ };
201
173
  export type Condition = ">" | ">=" | "<" | "<=" | "=" | "true";
202
174
  export type DeNotifyOptions = {
203
175
  email?: string;
@@ -228,11 +200,18 @@ export type Alert = {
228
200
  name: string;
229
201
  network: Network;
230
202
  id?: number;
203
+ enabled?: boolean;
231
204
  triggerId: TriggerTypeId;
232
205
  trigger: Trigger;
233
206
  notificationId: NotificationTypeId;
234
207
  notification: Notification;
235
208
  };
209
+ export type AlertUpdate = {
210
+ name?: string;
211
+ enabled?: boolean;
212
+ trigger?: Partial<Trigger>;
213
+ notification?: Partial<Notification>;
214
+ };
236
215
  export declare class DeNotifyClient {
237
216
  private url;
238
217
  private headers;
@@ -244,22 +223,24 @@ export declare class DeNotifyClient {
244
223
  }>;
245
224
  getAlert(id: number): Promise<Alert>;
246
225
  getAlerts(): Promise<Alert[]>;
247
- createAlert(config: Alert): Promise<any>;
226
+ createAlert(config: Alert): Promise<number>;
227
+ private updateRawTrigger;
228
+ updateAlert(id: number, update: AlertUpdate): Promise<Alert>;
248
229
  deleteAlert(id: number): Promise<any>;
249
230
  private decode;
250
231
  private encode;
251
232
  private request;
233
+ readFields(typeId: TriggerTypeId, trigger: Trigger, abis: {
234
+ [key: string]: any;
235
+ }): FieldDescription[];
252
236
  getAbi(network: string, address: string): Promise<{
253
237
  abi: unknown[];
254
238
  proxy?: string;
255
239
  hash: string;
256
240
  }>;
257
241
  getAbiHash(abi: unknown): Promise<any>;
258
- setAlertName(_triggerId: number, _name: string): Promise<void>;
259
- enableAlert(_triggerId: number): Promise<void>;
260
- disableAlert(_triggerId: number): Promise<void>;
261
- updateNotification(_triggerId: number): Promise<void>;
262
- updateTrigger(triggerId: number, update: TriggerUpdate): Promise<any>;
242
+ private updateRawNotify;
243
+ private updateRawHandler;
263
244
  }
264
245
  export declare class AlertBuilder {
265
246
  private name;