denotify-client 1.1.13 → 1.1.14
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/.eslintrc +1 -1
- package/.prettierrc +2 -2
- package/.vscode/settings.json +4 -0
- package/dist/denotify-client.cjs +1 -1
- package/dist/denotify-client.d.ts +2 -2
- package/dist/denotify-client.iife.js +1 -1
- package/dist/denotify-client.mjs +1 -1
- package/package.json +1 -1
- package/tsconfig.json +33 -21
- package/types/alertbuilder.d.ts +99 -69
- package/types/client.d.ts +12 -12
- package/types/denotifyclient.d.ts +59 -46
- package/types/examples/aave-healthcheck.d.ts +1 -1
- package/types/examples/balance-monitor.d.ts +1 -1
- package/types/examples/delete-alert.d.ts +1 -1
- package/types/functionbuilder.d.ts +31 -20
- package/types/index.d.ts +14 -7
- package/types/notifications/index.d.ts +36 -3
- package/types/notifications/notification.d.ts +27 -18
- package/types/notifications/notify_discord_webhook.d.ts +32 -32
- package/types/temp.d.ts +1 -1
- package/types/triggers/handler_function_call.d.ts +60 -56
- package/types/triggers/handler_function_call_v2.d.ts +94 -79
- package/types/triggers/handler_onchain_event.d.ts +51 -47
- package/types/triggers/index.d.ts +64 -5
- package/types/triggers/trigger.d.ts +66 -31
- package/types/types/notification.d.ts +6 -6
- package/types/types/trigger.d.ts +24 -21
- package/types/types/types.d.ts +21 -18
- package/types/util/filter.d.ts +67 -40
package/dist/denotify-client.mjs
CHANGED
@@ -7790,7 +7790,7 @@ class ds {
|
|
7790
7790
|
};
|
7791
7791
|
}
|
7792
7792
|
static validateCreate(e) {
|
7793
|
-
const t = /^(https?|ftp):\/\/(-\.)?([^\s
|
7793
|
+
const t = /^(https?|ftp):\/\/(-\.)?([^\s/?.#]+\.?)+([^\s.?#]+)?(\?\S*)?$/;
|
7794
7794
|
return et({
|
7795
7795
|
url: j().matches(t, "url is not a valid url").required(),
|
7796
7796
|
username: j(),
|
package/package.json
CHANGED
package/tsconfig.json
CHANGED
@@ -1,22 +1,34 @@
|
|
1
|
-
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
1
|
+
{
|
2
|
+
"ts-node": {
|
3
|
+
"esm": true,
|
4
|
+
"transpileOnly": true,
|
5
|
+
"compilerOptions": {
|
6
|
+
"module": "ES6",
|
7
|
+
"sourceMap": true,
|
8
|
+
"esModuleInterop": true,
|
9
|
+
},
|
10
|
+
"include": [
|
11
|
+
"test/**/*"
|
12
|
+
]
|
13
|
+
},
|
14
|
+
"compilerOptions": {
|
15
|
+
"rootDir": "./src",
|
16
|
+
"target": "ESNext",
|
17
|
+
"useDefineForClassFields": true,
|
18
|
+
"module": "ESNext",
|
19
|
+
"lib": ["ESNext", "DOM"],
|
20
|
+
"moduleResolution": "nodenext",
|
21
|
+
"strict": true,
|
22
|
+
"sourceMap": true,
|
23
|
+
"resolveJsonModule": true,
|
24
|
+
"esModuleInterop": true,
|
25
|
+
"noEmit": true,
|
26
|
+
"noUnusedLocals": true,
|
27
|
+
"noUnusedParameters": true,
|
28
|
+
"noImplicitReturns": true,
|
29
|
+
"forceConsistentCasingInFileNames": true,
|
30
|
+
"types": ["vite/client", "node", "jest"]
|
31
|
+
},
|
32
|
+
"include": ["src"],
|
33
|
+
"exclude": ["**/*.test.ts", "node_modules", "test/**", ".history/**"]
|
22
34
|
}
|
package/types/alertbuilder.d.ts
CHANGED
@@ -1,71 +1,101 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
|
1
|
+
import {
|
2
|
+
NotificationConfig,
|
3
|
+
NotificationTypeId
|
4
|
+
} from './notifications/notification.js'
|
5
|
+
import { Network, TriggerTypeId } from './triggers/trigger.js'
|
6
|
+
import { AlertConfig } from './types/types.js'
|
4
7
|
export declare class AlertBuilder {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
8
|
+
private name
|
9
|
+
private network?
|
10
|
+
private triggerId?
|
11
|
+
private trigger?
|
12
|
+
private notificationId?
|
13
|
+
private notification?
|
14
|
+
private constructor()
|
15
|
+
static create(name: string): AlertBuilder
|
16
|
+
onNetwork(network: Network): AlertBuilder
|
17
|
+
/**
|
18
|
+
* Call withTrigger with one of the TriggerConfig types:
|
19
|
+
* PollFunctionV2 | PollFunctionV1 | OnchainEventV1
|
20
|
+
* @param id Simple ID
|
21
|
+
* @param options Desired trigger configuration
|
22
|
+
* @returns self for piping
|
23
|
+
*/
|
24
|
+
withTrigger<T>(id: TriggerTypeId, options: T): AlertBuilder
|
25
|
+
withNotification<T = NotificationConfig>(
|
26
|
+
id: NotificationTypeId,
|
27
|
+
options: T
|
28
|
+
): AlertBuilder
|
29
|
+
validate(): Promise<
|
30
|
+
| {
|
31
|
+
condition?: string | undefined
|
32
|
+
constant?: number | undefined
|
33
|
+
paramsIndex?: number | undefined
|
34
|
+
paramsDecimals?: number | undefined
|
35
|
+
address: string
|
36
|
+
event: string
|
37
|
+
abi: any[]
|
38
|
+
}
|
39
|
+
| {
|
40
|
+
condition?: string | undefined
|
41
|
+
constant?: number | undefined
|
42
|
+
nBlocks?: number | undefined
|
43
|
+
responseArgIndex?: number | undefined
|
44
|
+
responseArgDecimals?: number | undefined
|
45
|
+
address: string
|
46
|
+
abi: any[]
|
47
|
+
}
|
48
|
+
| {
|
49
|
+
nBlocks?: number | undefined
|
50
|
+
timePeriod?: string | undefined
|
51
|
+
debounceCount?: number | undefined
|
52
|
+
functions?:
|
53
|
+
| {
|
54
|
+
function: string
|
55
|
+
address: string
|
56
|
+
bytecode: string
|
57
|
+
abiHash: string
|
58
|
+
}[]
|
59
|
+
| undefined
|
60
|
+
filter?:
|
61
|
+
| {
|
62
|
+
conditions?:
|
63
|
+
| {
|
64
|
+
constant?: {} | undefined
|
65
|
+
operation?: string | undefined
|
66
|
+
logic: NonNullable<
|
67
|
+
| 'AND'
|
68
|
+
| 'OR'
|
69
|
+
| 'XOR'
|
70
|
+
| 'NAND'
|
71
|
+
| 'NOR'
|
72
|
+
| 'WHERE'
|
73
|
+
| undefined
|
74
|
+
>
|
75
|
+
key: string
|
76
|
+
type: NonNullable<
|
77
|
+
'String' | 'Address' | 'Number' | undefined
|
78
|
+
>
|
79
|
+
}[]
|
80
|
+
| undefined
|
81
|
+
logic: NonNullable<
|
82
|
+
'AND' | 'OR' | 'XOR' | 'NAND' | 'NOR' | 'WHERE' | undefined
|
83
|
+
>
|
84
|
+
}[]
|
85
|
+
| undefined
|
86
|
+
filterVersion?: string | undefined
|
87
|
+
timeBase: NonNullable<'blocks' | 'time' | undefined>
|
88
|
+
startTime: number
|
89
|
+
triggerOn: 'always' | 'filter'
|
90
|
+
latch: boolean
|
91
|
+
}
|
92
|
+
| {
|
93
|
+
username?: string | undefined
|
94
|
+
avatar_url?: string | undefined
|
95
|
+
message: string
|
96
|
+
url: string
|
97
|
+
}
|
98
|
+
| undefined
|
99
|
+
>
|
100
|
+
config(): Promise<AlertConfig>
|
71
101
|
}
|
package/types/client.d.ts
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
import { DeNotifyOptions } from
|
1
|
+
import { DeNotifyOptions } from './types/types'
|
2
2
|
export declare class DeNotifyClient {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
3
|
+
private url
|
4
|
+
private token
|
5
|
+
private headers
|
6
|
+
private constructor()
|
7
|
+
static create(options: DeNotifyOptions): Promise<DeNotifyClient>
|
8
|
+
getAlert(id: number): Promise<any>
|
9
|
+
getAlerts(): Promise<any>
|
10
|
+
createAlert(): Promise<void>
|
11
|
+
deleteAlert(id: number): Promise<any>
|
12
|
+
private request
|
13
|
+
getAbiHash(abi: any): Promise<any>
|
14
14
|
}
|
@@ -1,52 +1,65 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
|
1
|
+
import {
|
2
|
+
NotificationRawResponse,
|
3
|
+
NotifyRawId
|
4
|
+
} from './notifications/notification.js'
|
5
|
+
import { AlertConfig, DeNotifyOptions } from './types/types.js'
|
6
|
+
import {
|
7
|
+
TriggerRawResponse,
|
8
|
+
TriggerTypeRawId,
|
9
|
+
TriggerUpdate
|
10
|
+
} from './triggers/trigger.js'
|
4
11
|
type Pagination = {
|
5
|
-
|
6
|
-
|
7
|
-
}
|
12
|
+
page?: number
|
13
|
+
size?: number
|
14
|
+
}
|
8
15
|
type HistoryParams = {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
}
|
16
|
+
id?: number
|
17
|
+
page?: number
|
18
|
+
size?: number
|
19
|
+
}
|
13
20
|
type AlertHistory = {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
}
|
21
|
+
type: 'trigger' | 'notification'
|
22
|
+
set: boolean
|
23
|
+
alert_id: number
|
24
|
+
block: number
|
25
|
+
metadata: any
|
26
|
+
subtype: TriggerTypeRawId | NotifyRawId
|
27
|
+
}
|
21
28
|
type AlertRawResponse = {
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
}
|
29
|
+
alertId: number
|
30
|
+
trigger: TriggerRawResponse
|
31
|
+
notification: NotificationRawResponse
|
32
|
+
}
|
26
33
|
export declare class DeNotifyClient {
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
34
|
+
private url
|
35
|
+
private token
|
36
|
+
private headers
|
37
|
+
private constructor()
|
38
|
+
static create(options: DeNotifyOptions): Promise<DeNotifyClient>
|
39
|
+
alertHistory(
|
40
|
+
id?: number | null,
|
41
|
+
pagination?: Pagination
|
42
|
+
): Promise<{
|
43
|
+
params: HistoryParams
|
44
|
+
history: AlertHistory[]
|
45
|
+
}>
|
46
|
+
getAlert(id: number): Promise<AlertRawResponse>
|
47
|
+
getAlerts(): Promise<AlertRawResponse[]>
|
48
|
+
createAlert(config: AlertConfig): Promise<any>
|
49
|
+
deleteAlert(id: number): Promise<any>
|
50
|
+
private request
|
51
|
+
getAbi(
|
52
|
+
network: string,
|
53
|
+
address: string
|
54
|
+
): Promise<{
|
55
|
+
abi: any[]
|
56
|
+
proxy?: string
|
57
|
+
}>
|
58
|
+
getAbiHash(abi: any): Promise<any>
|
59
|
+
setAlertName(triggerId: number, name: string): Promise<void>
|
60
|
+
enableAlert(triggerId: number): Promise<void>
|
61
|
+
disableAlert(triggerId: number): Promise<void>
|
62
|
+
updateNotification(triggerId: number): Promise<void>
|
63
|
+
updateTrigger(triggerId: number, update: TriggerUpdate): Promise<any>
|
51
64
|
}
|
52
|
-
export {}
|
65
|
+
export {}
|
@@ -1 +1 @@
|
|
1
|
-
export {}
|
1
|
+
export {}
|
@@ -1 +1 @@
|
|
1
|
-
export {}
|
1
|
+
export {}
|
@@ -1 +1 @@
|
|
1
|
-
export {}
|
1
|
+
export {}
|
@@ -1,23 +1,34 @@
|
|
1
|
-
import { DeNotifyClient } from
|
2
|
-
import * as yup from 'yup'
|
1
|
+
import { DeNotifyClient } from './denotifyclient.js'
|
2
|
+
import * as yup from 'yup'
|
3
3
|
export type FunctionCallerConfig = {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
}[]
|
4
|
+
address: string
|
5
|
+
bytecode: string
|
6
|
+
abiHash: string
|
7
|
+
function: string
|
8
|
+
}[]
|
9
9
|
export declare class FunctionBuilder {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
10
|
+
private api?
|
11
|
+
private data
|
12
|
+
private constructor()
|
13
|
+
static create(api?: DeNotifyClient): FunctionBuilder
|
14
|
+
getAbiHash(abi: any): Promise<string>
|
15
|
+
addFunction<T = any>(
|
16
|
+
address: string,
|
17
|
+
func: string,
|
18
|
+
args: T[],
|
19
|
+
abi: any
|
20
|
+
): Promise<this>
|
21
|
+
get(): FunctionCallerConfig
|
22
|
+
static schema(): yup.ArraySchema<
|
23
|
+
| {
|
24
|
+
function: string
|
25
|
+
address: string
|
26
|
+
bytecode: string
|
27
|
+
abiHash: string
|
28
|
+
}[]
|
29
|
+
| undefined,
|
30
|
+
yup.AnyObject,
|
31
|
+
'',
|
32
|
+
''
|
33
|
+
>
|
23
34
|
}
|
package/types/index.d.ts
CHANGED
@@ -1,7 +1,14 @@
|
|
1
|
-
import { DeNotifyClient } from
|
2
|
-
import { AlertBuilder } from
|
3
|
-
import { FunctionBuilder } from
|
4
|
-
import { FilterBuilder } from
|
5
|
-
import * as Trigger from
|
6
|
-
import * as Notification from
|
7
|
-
export {
|
1
|
+
import { DeNotifyClient } from './denotifyclient.js'
|
2
|
+
import { AlertBuilder } from './alertbuilder.js'
|
3
|
+
import { FunctionBuilder } from './functionbuilder.js'
|
4
|
+
import { FilterBuilder } from './util/filter.js'
|
5
|
+
import * as Trigger from './triggers/index.js'
|
6
|
+
import * as Notification from './notifications/index.js'
|
7
|
+
export {
|
8
|
+
DeNotifyClient,
|
9
|
+
AlertBuilder,
|
10
|
+
FilterBuilder,
|
11
|
+
FunctionBuilder,
|
12
|
+
Trigger,
|
13
|
+
Notification
|
14
|
+
}
|
@@ -1,3 +1,36 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
|
1
|
+
import {
|
2
|
+
NotificationTypeId,
|
3
|
+
NotificationConfig,
|
4
|
+
NotifyRawId,
|
5
|
+
NotifyRawConfig,
|
6
|
+
NotifyRawResponse,
|
7
|
+
NotifyRawUpdate,
|
8
|
+
NotificationRawConfig,
|
9
|
+
Notification
|
10
|
+
} from './notification.js'
|
11
|
+
import {
|
12
|
+
DiscordWebhook,
|
13
|
+
NotifyDiscordWebhookRawId,
|
14
|
+
NOTIFY_DISCORD_WEBHOOK_RAW_ID,
|
15
|
+
NotifyDiscordWebhookRawConfig,
|
16
|
+
NotifyDiscordWebhookRawResponse,
|
17
|
+
NotifyDiscordWebhookRawUpdate,
|
18
|
+
NotifyDiscordWebhook
|
19
|
+
} from './notify_discord_webhook.js'
|
20
|
+
export {
|
21
|
+
DiscordWebhook,
|
22
|
+
NotifyDiscordWebhookRawId,
|
23
|
+
NOTIFY_DISCORD_WEBHOOK_RAW_ID,
|
24
|
+
NotifyDiscordWebhookRawConfig,
|
25
|
+
NotifyDiscordWebhookRawResponse,
|
26
|
+
NotifyDiscordWebhookRawUpdate,
|
27
|
+
NotifyDiscordWebhook,
|
28
|
+
NotificationTypeId,
|
29
|
+
NotificationConfig,
|
30
|
+
NotifyRawId,
|
31
|
+
NotifyRawConfig,
|
32
|
+
NotifyRawResponse,
|
33
|
+
NotifyRawUpdate,
|
34
|
+
NotificationRawConfig,
|
35
|
+
Notification
|
36
|
+
}
|
@@ -1,22 +1,31 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
import {
|
2
|
+
DiscordWebhook,
|
3
|
+
NotifyDiscordWebhookRawConfig,
|
4
|
+
NotifyDiscordWebhookRawId,
|
5
|
+
NotifyDiscordWebhookRawResponse,
|
6
|
+
NotifyDiscordWebhookRawUpdate
|
7
|
+
} from './notify_discord_webhook.js'
|
8
|
+
export type NotificationTypeId = 'Discord'
|
9
|
+
export type NotificationConfig = DiscordWebhook
|
10
|
+
export type NotifyRawId = NotifyDiscordWebhookRawId
|
11
|
+
export type NotifyRawConfig = NotifyDiscordWebhookRawConfig
|
12
|
+
export type NotifyRawResponse = NotifyDiscordWebhookRawResponse
|
13
|
+
export type NotifyRawUpdate = NotifyDiscordWebhookRawUpdate
|
8
14
|
export type NotificationRawConfig = {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
}
|
15
|
+
name: string
|
16
|
+
notify_type: NotifyRawId
|
17
|
+
notify: NotifyRawConfig
|
18
|
+
}
|
13
19
|
export type NotificationRawResponse = {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
}
|
20
|
+
notify_type: NotifyRawId
|
21
|
+
notify: NotifyRawResponse
|
22
|
+
error: boolean
|
23
|
+
error_message: string | null
|
24
|
+
error_timestamp: number | null
|
25
|
+
}
|
20
26
|
export declare class Notification {
|
21
|
-
|
27
|
+
static SimpleToRaw(
|
28
|
+
id: NotificationTypeId,
|
29
|
+
config: NotificationConfig
|
30
|
+
): NotificationRawConfig
|
22
31
|
}
|
@@ -1,38 +1,38 @@
|
|
1
|
-
import { NotificationRawConfig } from
|
1
|
+
import { NotificationRawConfig } from './notification.js'
|
2
2
|
export type DiscordWebhook = {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
}
|
8
|
-
export type NotifyDiscordWebhookRawId = 'notify_discord_webhook'
|
9
|
-
export declare const NOTIFY_DISCORD_WEBHOOK_RAW_ID =
|
3
|
+
url: string
|
4
|
+
username?: string
|
5
|
+
avatar_url?: string
|
6
|
+
message: string
|
7
|
+
}
|
8
|
+
export type NotifyDiscordWebhookRawId = 'notify_discord_webhook'
|
9
|
+
export declare const NOTIFY_DISCORD_WEBHOOK_RAW_ID = 'notify_discord_webhook'
|
10
10
|
export type NotifyDiscordWebhookRawConfig = {
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
}
|
11
|
+
url: string
|
12
|
+
username?: string
|
13
|
+
avatar_url?: string
|
14
|
+
message: string
|
15
|
+
}
|
16
16
|
export type NotifyDiscordWebhookRawResponse = {
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
}
|
17
|
+
id: number
|
18
|
+
created_at: string
|
19
|
+
url: string
|
20
|
+
username: string
|
21
|
+
avatar_url: string
|
22
|
+
message: string
|
23
|
+
}
|
24
24
|
export type NotifyDiscordWebhookRawUpdate = {
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
}
|
25
|
+
url?: string
|
26
|
+
username?: string
|
27
|
+
avatar_url?: string
|
28
|
+
message?: string
|
29
|
+
}
|
30
30
|
export declare class NotifyDiscordWebhook {
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
31
|
+
static SimpleToRaw(config: DiscordWebhook): NotificationRawConfig
|
32
|
+
static validateCreate(options: any): Promise<{
|
33
|
+
username?: string | undefined
|
34
|
+
avatar_url?: string | undefined
|
35
|
+
message: string
|
36
|
+
url: string
|
37
|
+
}>
|
38
38
|
}
|
package/types/temp.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export {}
|
1
|
+
export {}
|