denotify-client 1.1.15 → 1.1.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,18 +1,18 @@
1
1
  // eslint-disable-next-line @typescript-eslint/no-var-requires
2
- const packageJson = require("./package.json");
2
+ const packageJson = require('./package.json')
3
3
 
4
4
  const getPackageName = () => {
5
- return packageJson.name;
6
- };
5
+ return packageJson.name
6
+ }
7
7
 
8
8
  const config = {
9
- entries: [
10
- {
11
- filePath: "./src/index.ts",
12
- outFile: `./dist/${getPackageName()}.d.ts`,
13
- noCheck: false,
14
- },
15
- ],
16
- };
9
+ entries: [
10
+ {
11
+ filePath: './src/index.ts',
12
+ outFile: `./dist/${getPackageName()}.d.ts`,
13
+ noCheck: false
14
+ }
15
+ ]
16
+ }
17
17
 
18
- module.exports = config;
18
+ module.exports = config
package/index.html CHANGED
@@ -1,13 +1,13 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/svg+xml" href="favicon.svg" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>Vite App</title>
8
- </head>
9
- <body>
10
- <div id="app"></div>
11
- <script type="module" src="/src/index.ts"></script>
12
- </body>
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="favicon.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Vite App</title>
8
+ </head>
9
+ <body>
10
+ <div id="app"></div>
11
+ <script type="module" src="/src/index.ts"></script>
12
+ </body>
13
13
  </html>
package/package.json CHANGED
@@ -1,54 +1,59 @@
1
1
  {
2
- "name": "denotify-client",
3
- "private": false,
4
- "version": "1.1.15",
5
- "main": "./dist/denotify-client.cjs",
6
- "module": "./dist/denotify-client.mjs",
7
- "types": "./dist/denotify-client.d.ts",
8
- "exports": {
9
- ".": {
10
- "require": "./dist/denotify-client.cjs",
11
- "import": "./dist/denotify-client.mjs"
12
- }
13
- },
14
- "scripts": {
15
- "dev": "vite --host",
16
- "build": "tsc && vite build && dts-bundle-generator --config ./dts-bundle-generator.config.ts",
17
- "test": "jest --runInBand",
18
- "test:coverage": "jest --runInBand --coverage",
19
- "lint:scripts": "eslint . --ext .ts",
20
- "lint:styles": "stylelint ./**/*.{css,scss}",
21
- "format:scripts": "prettier . --write",
22
- "format:styles": "stylelint ./**/*.{css,scss} --fix",
23
- "format": "npm run format:scripts && npm run format:styles",
24
- "uninstall-husky": "npm uninstall husky --no-save && git config --unset core.hooksPath && npx rimraf .husky"
25
- },
26
- "devDependencies": {
27
- "@types/jest": "^29.2.5",
28
- "@types/jsdom": "^20.0.1",
29
- "@types/node": "^18.11.18",
30
- "@typescript-eslint/eslint-plugin": "^5.48.2",
31
- "@typescript-eslint/parser": "^5.48.2",
32
- "dts-bundle-generator": "^7.1.0",
33
- "eslint": "^8.32.0",
34
- "eslint-config-prettier": "^8.6.0",
35
- "eslint-plugin-prettier": "^4.2.1",
36
- "husky": "^8.0.3",
37
- "jest": "^29.3.1",
38
- "lint-staged": "^13.1.0",
39
- "prettier": "^2.8.3",
40
- "stylelint": "^14.16.1",
41
- "stylelint-config-recommended": "^9.0.0",
42
- "stylelint-config-sass-guidelines": "^9.0.1",
43
- "ts-jest": "^29.0.5",
44
- "ts-node": "^10.9.1",
45
- "typescript": "^4.9.4",
46
- "vite": "^4.0.4"
47
- },
48
- "dependencies": {
49
- "@supabase/supabase-js": "^2.10.0",
50
- "axios": "^1.3.4",
51
- "ethers": "^6.1.0",
52
- "yup": "^1.0.2"
53
- }
2
+ "name": "denotify-client",
3
+ "private": false,
4
+ "version": "1.1.17",
5
+ "main": "./dist/denotify-client.cjs",
6
+ "module": "./dist/denotify-client.mjs",
7
+ "types": "./dist/denotify-client.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "require": "./dist/denotify-client.cjs",
11
+ "import": "./dist/denotify-client.mjs"
12
+ }
13
+ },
14
+ "scripts": {
15
+ "dev": "vite --host",
16
+ "build": "tsc && vite build && dts-bundle-generator --config ./dts-bundle-generator.config.ts",
17
+ "test": "jest --runInBand",
18
+ "test:coverage": "jest --runInBand --coverage",
19
+ "lint:scripts": "eslint . --ext .ts",
20
+ "lint:styles": "stylelint ./**/*.{css,scss}",
21
+ "format:scripts": "prettier . --write",
22
+ "format:styles": "stylelint ./**/*.{css,scss} --fix",
23
+ "format": "npm run format:scripts && npm run format:styles",
24
+ "uninstall-husky": "npm uninstall husky --no-save && git config --unset core.hooksPath && npx rimraf .husky"
25
+ },
26
+ "devDependencies": {
27
+ "@types/jest": "^29.2.5",
28
+ "@types/jsdom": "^20.0.1",
29
+ "@types/node": "^18.11.18",
30
+ "@typescript-eslint/eslint-plugin": "^5.48.2",
31
+ "@typescript-eslint/parser": "^5.48.2",
32
+ "dotenv": "^16.0.3",
33
+ "dts-bundle-generator": "^7.1.0",
34
+ "eslint": "^8.32.0",
35
+ "eslint-config-prettier": "^8.6.0",
36
+ "eslint-plugin-prettier": "^4.2.1",
37
+ "husky": "^8.0.3",
38
+ "jest": "^29.3.1",
39
+ "lint-staged": "^13.1.0",
40
+ "prettier": "^2.8.3",
41
+ "stylelint": "^14.16.1",
42
+ "stylelint-config-recommended": "^9.0.0",
43
+ "stylelint-config-sass-guidelines": "^9.0.1",
44
+ "ts-jest": "^29.0.5",
45
+ "ts-node": "^10.9.1",
46
+ "typescript": "^4.9.4",
47
+ "vite": "^4.0.4"
48
+ },
49
+ "dependencies": {
50
+ "@supabase/supabase-js": "^2.10.0",
51
+ "@trpc/client": "^10.16.0",
52
+ "@trpc/react-query": "^10.16.0",
53
+ "@trpc/server": "^10.16.0",
54
+ "axios": "^1.3.4",
55
+ "ethers": "^6.1.0",
56
+ "yup": "^1.0.2",
57
+ "zod": "^3.21.4"
58
+ }
54
59
  }
package/tsconfig.json CHANGED
@@ -1,15 +1,13 @@
1
- {
1
+ {
2
2
  "ts-node": {
3
3
  "esm": true,
4
4
  "transpileOnly": true,
5
5
  "compilerOptions": {
6
6
  "module": "ES6",
7
7
  "sourceMap": true,
8
- "esModuleInterop": true,
8
+ "esModuleInterop": true
9
9
  },
10
- "include": [
11
- "test/**/*"
12
- ]
10
+ "include": ["test/**/*"]
13
11
  },
14
12
  "compilerOptions": {
15
13
  "rootDir": "./src",
@@ -1,101 +1,101 @@
1
1
  import {
2
- NotificationConfig,
3
- NotificationTypeId
2
+ NotificationConfig,
3
+ NotificationTypeId
4
4
  } from './notifications/notification.js'
5
5
  import { Network, TriggerTypeId } from './triggers/trigger.js'
6
6
  import { AlertConfig } from './types/types.js'
7
7
  export declare class AlertBuilder {
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>
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>
101
101
  }
package/types/client.d.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  import { DeNotifyOptions } from './types/types'
2
2
  export declare class DeNotifyClient {
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>
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,65 +1,65 @@
1
1
  import {
2
- NotificationRawResponse,
3
- NotifyRawId
2
+ NotificationRawResponse,
3
+ NotifyRawId
4
4
  } from './notifications/notification.js'
5
5
  import { AlertConfig, DeNotifyOptions } from './types/types.js'
6
6
  import {
7
- TriggerRawResponse,
8
- TriggerTypeRawId,
9
- TriggerUpdate
7
+ TriggerRawResponse,
8
+ TriggerTypeRawId,
9
+ TriggerUpdate
10
10
  } from './triggers/trigger.js'
11
11
  type Pagination = {
12
- page?: number
13
- size?: number
12
+ page?: number
13
+ size?: number
14
14
  }
15
15
  type HistoryParams = {
16
- id?: number
17
- page?: number
18
- size?: number
16
+ id?: number
17
+ page?: number
18
+ size?: number
19
19
  }
20
20
  type AlertHistory = {
21
- type: 'trigger' | 'notification'
22
- set: boolean
23
- alert_id: number
24
- block: number
25
- metadata: any
26
- subtype: TriggerTypeRawId | NotifyRawId
21
+ type: 'trigger' | 'notification'
22
+ set: boolean
23
+ alert_id: number
24
+ block: number
25
+ metadata: any
26
+ subtype: TriggerTypeRawId | NotifyRawId
27
27
  }
28
28
  type AlertRawResponse = {
29
- alertId: number
30
- trigger: TriggerRawResponse
31
- notification: NotificationRawResponse
29
+ alertId: number
30
+ trigger: TriggerRawResponse
31
+ notification: NotificationRawResponse
32
32
  }
33
33
  export declare class DeNotifyClient {
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>
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>
64
64
  }
65
65
  export {}
@@ -1,34 +1,34 @@
1
1
  import { DeNotifyClient } from './denotifyclient.js'
2
2
  import * as yup from 'yup'
3
3
  export type FunctionCallerConfig = {
4
- address: string
5
- bytecode: string
6
- abiHash: string
7
- function: string
4
+ address: string
5
+ bytecode: string
6
+ abiHash: string
7
+ function: string
8
8
  }[]
9
9
  export declare class FunctionBuilder {
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
- >
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
+ >
34
34
  }
package/types/index.d.ts CHANGED
@@ -5,10 +5,10 @@ import { FilterBuilder } from './util/filter.js'
5
5
  import * as Trigger from './triggers/index.js'
6
6
  import * as Notification from './notifications/index.js'
7
7
  export {
8
- DeNotifyClient,
9
- AlertBuilder,
10
- FilterBuilder,
11
- FunctionBuilder,
12
- Trigger,
13
- Notification
8
+ DeNotifyClient,
9
+ AlertBuilder,
10
+ FilterBuilder,
11
+ FunctionBuilder,
12
+ Trigger,
13
+ Notification
14
14
  }