@v3finance/monitoring-sdk 0.1.0 → 0.2.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.
- package/CHANGELOG.md +21 -11
- package/README.md +223 -148
- package/dist/cjs/client.d.ts +23 -42
- package/dist/cjs/client.d.ts.map +1 -1
- package/dist/cjs/client.js +44 -53
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/core/errors.d.ts +18 -18
- package/dist/cjs/core/errors.d.ts.map +1 -1
- package/dist/cjs/core/errors.js +17 -17
- package/dist/cjs/core/errors.js.map +1 -1
- package/dist/cjs/core/http.d.ts +22 -26
- package/dist/cjs/core/http.d.ts.map +1 -1
- package/dist/cjs/core/http.js +28 -36
- package/dist/cjs/core/http.js.map +1 -1
- package/dist/cjs/core/pagination.d.ts +6 -7
- package/dist/cjs/core/pagination.d.ts.map +1 -1
- package/dist/cjs/core/pagination.js +1 -1
- package/dist/cjs/core/pagination.js.map +1 -1
- package/dist/cjs/core/scope.d.ts +8 -0
- package/dist/cjs/core/scope.d.ts.map +1 -0
- package/dist/cjs/core/scope.js +3 -0
- package/dist/cjs/core/scope.js.map +1 -0
- package/dist/cjs/generated/types.d.ts +129 -117
- package/dist/cjs/generated/types.d.ts.map +1 -1
- package/dist/cjs/generated/types.js +1 -1
- package/dist/cjs/generated/types.js.map +1 -1
- package/dist/cjs/index.d.ts +6 -6
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +13 -16
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/resources/account.d.ts +12 -51
- package/dist/cjs/resources/account.d.ts.map +1 -1
- package/dist/cjs/resources/account.js +17 -61
- package/dist/cjs/resources/account.js.map +1 -1
- package/dist/cjs/resources/addresses.d.ts +49 -65
- package/dist/cjs/resources/addresses.d.ts.map +1 -1
- package/dist/cjs/resources/addresses.js +60 -69
- package/dist/cjs/resources/addresses.js.map +1 -1
- package/dist/cjs/resources/catalog.d.ts +17 -10
- package/dist/cjs/resources/catalog.d.ts.map +1 -1
- package/dist/cjs/resources/catalog.js +23 -17
- package/dist/cjs/resources/catalog.js.map +1 -1
- package/dist/cjs/resources/deliveries.d.ts +34 -23
- package/dist/cjs/resources/deliveries.d.ts.map +1 -1
- package/dist/cjs/resources/deliveries.js +27 -17
- package/dist/cjs/resources/deliveries.js.map +1 -1
- package/dist/cjs/resources/transactions.d.ts +14 -14
- package/dist/cjs/resources/transactions.d.ts.map +1 -1
- package/dist/cjs/resources/transactions.js +15 -16
- package/dist/cjs/resources/transactions.js.map +1 -1
- package/dist/cjs/resources/webhooks.d.ts +22 -0
- package/dist/cjs/resources/webhooks.d.ts.map +1 -0
- package/dist/cjs/resources/webhooks.js +35 -0
- package/dist/cjs/resources/webhooks.js.map +1 -0
- package/dist/cjs/units.d.ts +11 -11
- package/dist/cjs/units.js +14 -14
- package/dist/cjs/units.js.map +1 -1
- package/dist/cjs/version.d.ts +3 -3
- package/dist/cjs/version.d.ts.map +1 -1
- package/dist/cjs/version.js +3 -3
- package/dist/cjs/version.js.map +1 -1
- package/dist/cjs/webhooks.d.ts +33 -28
- package/dist/cjs/webhooks.d.ts.map +1 -1
- package/dist/cjs/webhooks.js +33 -28
- package/dist/cjs/webhooks.js.map +1 -1
- package/dist/esm/client.d.ts +23 -42
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +46 -55
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/core/errors.d.ts +18 -18
- package/dist/esm/core/errors.d.ts.map +1 -1
- package/dist/esm/core/errors.js +17 -17
- package/dist/esm/core/errors.js.map +1 -1
- package/dist/esm/core/http.d.ts +22 -26
- package/dist/esm/core/http.d.ts.map +1 -1
- package/dist/esm/core/http.js +28 -36
- package/dist/esm/core/http.js.map +1 -1
- package/dist/esm/core/pagination.d.ts +6 -7
- package/dist/esm/core/pagination.d.ts.map +1 -1
- package/dist/esm/core/pagination.js +1 -1
- package/dist/esm/core/pagination.js.map +1 -1
- package/dist/esm/core/scope.d.ts +8 -0
- package/dist/esm/core/scope.d.ts.map +1 -0
- package/dist/esm/core/scope.js +2 -0
- package/dist/esm/core/scope.js.map +1 -0
- package/dist/esm/generated/types.d.ts +129 -117
- package/dist/esm/generated/types.d.ts.map +1 -1
- package/dist/esm/generated/types.js +1 -1
- package/dist/esm/generated/types.js.map +1 -1
- package/dist/esm/index.d.ts +6 -6
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +6 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/resources/account.d.ts +12 -51
- package/dist/esm/resources/account.d.ts.map +1 -1
- package/dist/esm/resources/account.js +15 -57
- package/dist/esm/resources/account.js.map +1 -1
- package/dist/esm/resources/addresses.d.ts +49 -65
- package/dist/esm/resources/addresses.d.ts.map +1 -1
- package/dist/esm/resources/addresses.js +60 -69
- package/dist/esm/resources/addresses.js.map +1 -1
- package/dist/esm/resources/catalog.d.ts +17 -10
- package/dist/esm/resources/catalog.d.ts.map +1 -1
- package/dist/esm/resources/catalog.js +23 -17
- package/dist/esm/resources/catalog.js.map +1 -1
- package/dist/esm/resources/deliveries.d.ts +34 -23
- package/dist/esm/resources/deliveries.d.ts.map +1 -1
- package/dist/esm/resources/deliveries.js +27 -17
- package/dist/esm/resources/deliveries.js.map +1 -1
- package/dist/esm/resources/transactions.d.ts +14 -14
- package/dist/esm/resources/transactions.d.ts.map +1 -1
- package/dist/esm/resources/transactions.js +15 -16
- package/dist/esm/resources/transactions.js.map +1 -1
- package/dist/esm/resources/webhooks.d.ts +22 -0
- package/dist/esm/resources/webhooks.d.ts.map +1 -0
- package/dist/esm/resources/webhooks.js +31 -0
- package/dist/esm/resources/webhooks.js.map +1 -0
- package/dist/esm/units.d.ts +11 -11
- package/dist/esm/units.js +14 -14
- package/dist/esm/units.js.map +1 -1
- package/dist/esm/version.d.ts +3 -3
- package/dist/esm/version.d.ts.map +1 -1
- package/dist/esm/version.js +3 -3
- package/dist/esm/version.js.map +1 -1
- package/dist/esm/webhooks.d.ts +33 -28
- package/dist/esm/webhooks.d.ts.map +1 -1
- package/dist/esm/webhooks.js +33 -28
- package/dist/esm/webhooks.js.map +1 -1
- package/package.json +8 -5
- package/src/client.ts +50 -61
- package/src/core/errors.ts +18 -18
- package/src/core/http.ts +45 -55
- package/src/core/pagination.ts +7 -8
- package/src/core/scope.ts +8 -0
- package/src/generated/types.ts +139 -125
- package/src/index.ts +7 -24
- package/src/resources/account.ts +18 -72
- package/src/resources/addresses.ts +84 -109
- package/src/resources/catalog.ts +28 -19
- package/src/resources/deliveries.ts +43 -30
- package/src/resources/transactions.ts +18 -17
- package/src/resources/webhooks.ts +36 -0
- package/src/units.ts +14 -14
- package/src/version.ts +3 -3
- package/src/webhooks.ts +37 -32
- package/dist/cjs/resources/clients.d.ts +0 -84
- package/dist/cjs/resources/clients.d.ts.map +0 -1
- package/dist/cjs/resources/clients.js +0 -102
- package/dist/cjs/resources/clients.js.map +0 -1
- package/dist/esm/resources/clients.d.ts +0 -84
- package/dist/esm/resources/clients.d.ts.map +0 -1
- package/dist/esm/resources/clients.js +0 -97
- package/dist/esm/resources/clients.js.map +0 -1
- package/src/resources/clients.ts +0 -135
package/src/generated/types.ts
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
// Generated from openapi/openapi.json by scripts/generate.ts — do not edit by hand.
|
|
2
|
-
//
|
|
2
|
+
// V3 Finance Monitoring API 1.0.0. Regenerate: npm run spec:update && npm run generate
|
|
3
3
|
|
|
4
4
|
export interface ApiErrorBody {
|
|
5
5
|
error: {
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Machine-readable error code.
|
|
8
|
+
* @example "invalid_request"
|
|
9
|
+
*/
|
|
7
10
|
code: string
|
|
11
|
+
/** Human-readable description. */
|
|
8
12
|
message: string
|
|
13
|
+
/** Per-item problems of a batch request. */
|
|
9
14
|
details?: Array<{
|
|
15
|
+
/** Index of the item in the request. */
|
|
10
16
|
index: number
|
|
11
17
|
message: string
|
|
12
18
|
}>
|
|
@@ -24,12 +30,14 @@ export interface User {
|
|
|
24
30
|
|
|
25
31
|
export interface Identity {
|
|
26
32
|
actor: {
|
|
27
|
-
/**
|
|
28
|
-
kind: "
|
|
29
|
-
|
|
30
|
-
userId?: string | null
|
|
33
|
+
/** `client-key` for a client API key. */
|
|
34
|
+
kind: "client-key" | "user" | "admin"
|
|
35
|
+
/** Your client ID (client API keys). */
|
|
31
36
|
clientId?: string
|
|
37
|
+
/** ID of the API key (client API keys). */
|
|
32
38
|
keyId?: string
|
|
39
|
+
userId?: string | null
|
|
40
|
+
via?: "session" | "api-key" | "token"
|
|
33
41
|
}
|
|
34
42
|
user: User | null
|
|
35
43
|
memberships: Array<{
|
|
@@ -38,101 +46,82 @@ export interface Identity {
|
|
|
38
46
|
}>
|
|
39
47
|
}
|
|
40
48
|
|
|
41
|
-
export interface
|
|
49
|
+
export interface Client {
|
|
50
|
+
/** Client ID. */
|
|
42
51
|
id: string
|
|
43
52
|
name: string | null
|
|
44
|
-
/**
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
53
|
+
/** Where webhooks are sent. */
|
|
54
|
+
webhookUrl: string
|
|
55
|
+
/** `disabled` — webhooks are not sent. */
|
|
56
|
+
status: "active" | "disabled"
|
|
57
|
+
/** format: date-time */
|
|
49
58
|
createdAt: string
|
|
50
59
|
}
|
|
51
60
|
|
|
52
|
-
export interface IssueKeyRequest {
|
|
53
|
-
/** length: 0..100 */
|
|
54
|
-
name?: string
|
|
55
|
-
/**
|
|
56
|
-
* срок; без него — бессрочный
|
|
57
|
-
*
|
|
58
|
-
* range: 1..3650
|
|
59
|
-
*/
|
|
60
|
-
expiresInDays?: number
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface IssuedKey {
|
|
64
|
-
id: string
|
|
65
|
-
/** полный ключ — показывается один раз */
|
|
66
|
-
key: string
|
|
67
|
-
start: string
|
|
68
|
-
name: string | null
|
|
69
|
-
expiresAt: string | null
|
|
70
|
-
}
|
|
71
|
-
|
|
72
61
|
export interface Network {
|
|
73
62
|
id: number
|
|
74
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* Network identifier used across the API.
|
|
65
|
+
* @example "tron"
|
|
66
|
+
*/
|
|
75
67
|
slug: string
|
|
76
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* CAIP-2 chain ID.
|
|
70
|
+
* @example "tron:0x2b6653dc"
|
|
71
|
+
*/
|
|
77
72
|
caip2: string
|
|
78
73
|
chainId: number
|
|
79
74
|
name: string
|
|
80
75
|
shortName: string | null
|
|
81
|
-
/** 1
|
|
76
|
+
/** 1 for L1 networks, 2 for L2 rollups. */
|
|
82
77
|
layer: 1 | 2
|
|
83
78
|
parent: string | null
|
|
84
79
|
l2Type: string | null
|
|
85
80
|
l2Stack: string | null
|
|
86
81
|
isTestnet: boolean
|
|
87
82
|
explorerUrl: string | null
|
|
88
|
-
/**
|
|
83
|
+
/** Transfers on this network are monitored. */
|
|
89
84
|
enabled: boolean
|
|
90
85
|
}
|
|
91
86
|
|
|
87
|
+
export interface NetworkList {
|
|
88
|
+
items: Network[]
|
|
89
|
+
}
|
|
90
|
+
|
|
92
91
|
export interface Asset {
|
|
93
92
|
id: number
|
|
93
|
+
/** Network slug. */
|
|
94
94
|
network: string
|
|
95
|
+
/** CAIP-19 asset ID. */
|
|
95
96
|
caip19: string
|
|
96
97
|
standard: "native" | "erc20" | "trc20"
|
|
97
98
|
contract: string | null
|
|
99
|
+
/** @example "USDT" */
|
|
98
100
|
symbol: string
|
|
99
101
|
name: string
|
|
100
102
|
decimals: number
|
|
101
|
-
/**
|
|
103
|
+
/** Smallest transfer you are notified about, in the smallest unit (inclusive). */
|
|
102
104
|
minAmount: string
|
|
103
|
-
/**
|
|
105
|
+
/** Transfers of this asset are monitored. */
|
|
104
106
|
enabled: boolean
|
|
105
107
|
}
|
|
106
108
|
|
|
107
|
-
export interface
|
|
108
|
-
|
|
109
|
-
name: string | null
|
|
110
|
-
webhookUrl: string
|
|
111
|
-
/** disabled — вебхуки не отправляются */
|
|
112
|
-
status: "active" | "disabled"
|
|
113
|
-
createdAt: string
|
|
109
|
+
export interface AssetList {
|
|
110
|
+
items: Asset[]
|
|
114
111
|
}
|
|
115
112
|
|
|
116
|
-
|
|
117
|
-
userId: string
|
|
118
|
-
email: string
|
|
119
|
-
name: string
|
|
120
|
-
role: "owner" | "admin" | "member"
|
|
121
|
-
createdAt: string
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/** in — адрес получатель, out — отправитель, both — любой */
|
|
113
|
+
/** `in` — the address receives, `out` — the address sends, `both` — either. */
|
|
125
114
|
export type Direction = "in" | "out" | "both"
|
|
126
115
|
|
|
127
|
-
/**
|
|
116
|
+
/** Asset symbols (`USDT`) or contract addresses. `null` — all assets of the network, including ones added later. */
|
|
128
117
|
export type AssetSelection = string[] | null
|
|
129
118
|
|
|
130
119
|
export interface AddressInput {
|
|
131
|
-
/** slug
|
|
120
|
+
/** Network slug or CAIP-2 ID. */
|
|
132
121
|
network: string
|
|
133
122
|
address: string
|
|
134
123
|
/**
|
|
135
|
-
*
|
|
124
|
+
* Your reference, e.g. a user or account ID.
|
|
136
125
|
*
|
|
137
126
|
* length: 0..200
|
|
138
127
|
*/
|
|
@@ -148,31 +137,74 @@ export interface AddAddressesRequest {
|
|
|
148
137
|
direction?: Direction
|
|
149
138
|
}
|
|
150
139
|
|
|
140
|
+
export interface AddAddressesResult {
|
|
141
|
+
/** Addresses that started being monitored. */
|
|
142
|
+
added: number
|
|
143
|
+
/** Addresses that were already monitored and left unchanged. */
|
|
144
|
+
alreadyWatched: number
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export interface AddressUpdate {
|
|
148
|
+
network: string
|
|
149
|
+
address: string
|
|
150
|
+
assets?: AssetSelection
|
|
151
|
+
direction?: Direction
|
|
152
|
+
}
|
|
153
|
+
|
|
151
154
|
export interface UpdateAddressesRequest {
|
|
152
155
|
/** items: 1..1000 */
|
|
153
|
-
addresses:
|
|
154
|
-
network: string
|
|
155
|
-
address: string
|
|
156
|
-
assets?: AssetSelection
|
|
157
|
-
direction?: Direction
|
|
158
|
-
}>
|
|
156
|
+
addresses: AddressUpdate[]
|
|
159
157
|
assets?: AssetSelection
|
|
160
158
|
direction?: Direction
|
|
161
159
|
}
|
|
162
160
|
|
|
161
|
+
export interface UpdateAddressesResult {
|
|
162
|
+
/** Addresses whose subscription was changed. */
|
|
163
|
+
updated: number
|
|
164
|
+
/** Addresses that are not monitored. */
|
|
165
|
+
notWatched: number
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface AddressRef {
|
|
169
|
+
/** Network slug or CAIP-2 ID. */
|
|
170
|
+
network: string
|
|
171
|
+
address: string
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export interface RemoveAddressesRequest {
|
|
175
|
+
/** items: 1..1000 */
|
|
176
|
+
addresses: AddressRef[]
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export interface RemoveAddressesResult {
|
|
180
|
+
/** Addresses that stopped being monitored. */
|
|
181
|
+
removed: number
|
|
182
|
+
/** Addresses that were not monitored. */
|
|
183
|
+
notWatched: number
|
|
184
|
+
}
|
|
185
|
+
|
|
163
186
|
export interface Address {
|
|
164
187
|
id: number
|
|
165
188
|
network: string
|
|
189
|
+
/** CAIP-10 account ID. */
|
|
166
190
|
caip10: string
|
|
167
191
|
address: string
|
|
168
192
|
label: string | null
|
|
169
|
-
/**
|
|
193
|
+
/** Subscribed asset symbols; `null` — all assets. */
|
|
170
194
|
assets: string[] | null
|
|
171
195
|
direction: Direction
|
|
196
|
+
/** format: date-time */
|
|
172
197
|
createdAt: string
|
|
173
198
|
}
|
|
174
199
|
|
|
175
|
-
/**
|
|
200
|
+
/** A page of addresses. */
|
|
201
|
+
export interface AddressPage {
|
|
202
|
+
items: Address[]
|
|
203
|
+
/** Cursor for the next page — pass it as `after`. `null` when there are no more pages. */
|
|
204
|
+
next: number | null
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/** `delivered` — you responded with 2xx; `retrying` — the last attempt failed and will be retried; `failed` — all attempts failed. */
|
|
176
208
|
export type DeliveryStatus = "delivered" | "retrying" | "failed"
|
|
177
209
|
|
|
178
210
|
export interface Delivery {
|
|
@@ -181,42 +213,54 @@ export interface Delivery {
|
|
|
181
213
|
network: string
|
|
182
214
|
asset: string
|
|
183
215
|
contract: string
|
|
216
|
+
/** Transaction hash. */
|
|
184
217
|
txId: string
|
|
185
218
|
logIndex: number | null
|
|
186
219
|
block: number
|
|
187
|
-
/**
|
|
220
|
+
/** Block time, milliseconds since epoch. */
|
|
188
221
|
blockTime: number
|
|
189
222
|
from: string
|
|
190
223
|
to: string
|
|
224
|
+
/** Amount in the smallest unit. */
|
|
191
225
|
value: string
|
|
192
226
|
status: DeliveryStatus
|
|
193
227
|
attempts: number
|
|
194
228
|
lastHttpStatus: number | null
|
|
195
229
|
lastError: string | null
|
|
196
230
|
lastDurationMs: number | null
|
|
231
|
+
/** format: date-time */
|
|
197
232
|
firstAttemptAt: string
|
|
233
|
+
/** format: date-time */
|
|
198
234
|
lastAttemptAt: string
|
|
199
235
|
deliveredAt: string | null
|
|
200
236
|
}
|
|
201
237
|
|
|
202
238
|
export type DeliveryDetail = Delivery & {
|
|
203
|
-
/**
|
|
239
|
+
/** URL of the last attempt. */
|
|
204
240
|
url: string
|
|
205
|
-
/**
|
|
241
|
+
/** Exact request body. */
|
|
206
242
|
body: string
|
|
207
243
|
}
|
|
208
244
|
|
|
245
|
+
/** A page of deliveries, newest first. */
|
|
246
|
+
export interface DeliveryPage {
|
|
247
|
+
items: Delivery[]
|
|
248
|
+
/** Cursor for the next page — pass it as `before`. `null` when there are no more pages. */
|
|
249
|
+
next: number | null
|
|
250
|
+
}
|
|
251
|
+
|
|
209
252
|
export interface TxTransfer {
|
|
210
|
-
/** native —
|
|
253
|
+
/** `native` — sent by the transaction itself; `token` — a token Transfer event; `internal` — TRX sent by a contract; `trc10` — a TRC-10 token. */
|
|
211
254
|
kind: "native" | "token" | "internal" | "trc10"
|
|
212
255
|
asset: string | null
|
|
213
|
-
/**
|
|
256
|
+
/** Token contract address, `native`, or the TRC-10 token ID. */
|
|
214
257
|
contract: string
|
|
215
258
|
from: string
|
|
216
259
|
to: string
|
|
260
|
+
/** Amount in the smallest unit. */
|
|
217
261
|
value: string
|
|
218
262
|
logIndex?: number
|
|
219
|
-
/**
|
|
263
|
+
/** The asset is monitored: transfers of at least its `minAmount` are notified. */
|
|
220
264
|
tracked: boolean
|
|
221
265
|
}
|
|
222
266
|
|
|
@@ -224,34 +268,34 @@ export interface Transaction {
|
|
|
224
268
|
network: string
|
|
225
269
|
caip2: string
|
|
226
270
|
txId: string
|
|
227
|
-
/** pending —
|
|
271
|
+
/** `pending` — not yet included in a block. */
|
|
228
272
|
status: "success" | "failed" | "pending"
|
|
229
273
|
failure: string | null
|
|
230
274
|
block: number | null
|
|
231
275
|
blockTime: number | null
|
|
232
|
-
/**
|
|
276
|
+
/** Blocks since inclusion, counting the block itself; `0` when pending. */
|
|
233
277
|
confirmations: number
|
|
234
|
-
/**
|
|
278
|
+
/** The transaction can no longer be reverted. */
|
|
235
279
|
final: boolean
|
|
236
|
-
/**
|
|
280
|
+
/** Signer of the transaction. */
|
|
237
281
|
from: string
|
|
238
282
|
to: string | null
|
|
239
|
-
/** TRON
|
|
283
|
+
/** TRON contract type (`TransferContract`, `TriggerSmartContract`, …) or, on EVM networks, `transfer`, `contract_call` or `contract_creation`. */
|
|
240
284
|
type: string
|
|
241
|
-
/**
|
|
285
|
+
/** Native amount sent by the transaction itself. */
|
|
242
286
|
value: string
|
|
243
287
|
fee: {
|
|
244
288
|
asset: string
|
|
245
289
|
value: string
|
|
246
290
|
} | null
|
|
247
291
|
transfers: TxTransfer[]
|
|
248
|
-
/**
|
|
292
|
+
/** Your monitored addresses involved in the transaction. */
|
|
249
293
|
watched: Array<{
|
|
250
294
|
clientId: string
|
|
251
295
|
address: string
|
|
252
296
|
direction: Direction
|
|
253
297
|
}>
|
|
254
|
-
/**
|
|
298
|
+
/** Webhooks sent to you for this transaction. */
|
|
255
299
|
webhooks: Array<{
|
|
256
300
|
id: number
|
|
257
301
|
clientId: string
|
|
@@ -265,91 +309,61 @@ export interface Transaction {
|
|
|
265
309
|
|
|
266
310
|
export interface WebhookTx {
|
|
267
311
|
/**
|
|
268
|
-
*
|
|
312
|
+
* Network slug in upper case.
|
|
269
313
|
* @example "TRON"
|
|
270
314
|
* @example "ETHEREUM"
|
|
271
315
|
*/
|
|
272
316
|
network: string
|
|
273
317
|
/** @example "USDT" */
|
|
274
318
|
asset: string
|
|
275
|
-
/**
|
|
319
|
+
/** Token contract address or `native`. */
|
|
276
320
|
contract: string
|
|
277
|
-
/**
|
|
321
|
+
/** Always `TOPUP`, for both directions: compare `from` and `to` with your addresses. */
|
|
278
322
|
type: "TOPUP"
|
|
279
|
-
/**
|
|
323
|
+
/** Transaction hash. */
|
|
280
324
|
id: string
|
|
281
325
|
block: number
|
|
282
|
-
/**
|
|
326
|
+
/** Block time, milliseconds since epoch. */
|
|
283
327
|
timestamp: number
|
|
284
328
|
from: string
|
|
285
329
|
to: string
|
|
286
|
-
/**
|
|
330
|
+
/** Amount in the smallest unit. */
|
|
287
331
|
value: string
|
|
288
|
-
/**
|
|
332
|
+
/** Position of the transfer in the block, for EVM token transfers. */
|
|
289
333
|
logIndex?: number
|
|
290
334
|
}
|
|
291
335
|
|
|
292
336
|
export interface WebhookPayload {
|
|
293
337
|
tx: WebhookTx
|
|
294
|
-
/**
|
|
338
|
+
/** Present on test webhooks only. */
|
|
295
339
|
test?: true
|
|
296
340
|
}
|
|
297
341
|
|
|
298
342
|
export interface TestWebhookRequest {
|
|
299
343
|
/** @defaultValue "USDT" */
|
|
300
344
|
asset?: "USDT" | "A7A5" | "TRX"
|
|
301
|
-
/**
|
|
345
|
+
/** TRON address. */
|
|
302
346
|
from?: string
|
|
303
|
-
/**
|
|
347
|
+
/** TRON address. */
|
|
304
348
|
to?: string
|
|
305
|
-
/**
|
|
349
|
+
/** Amount in the smallest unit. */
|
|
306
350
|
value?: string
|
|
307
351
|
}
|
|
308
352
|
|
|
309
353
|
export interface TestDelivery {
|
|
354
|
+
/** Your endpoint responded with 2xx. */
|
|
310
355
|
ok: boolean
|
|
311
|
-
/**
|
|
356
|
+
/** Status code of your response. */
|
|
312
357
|
status?: number
|
|
358
|
+
/** Connection error. */
|
|
313
359
|
error?: string
|
|
314
360
|
durationMs: number
|
|
315
361
|
}
|
|
316
362
|
|
|
317
363
|
export interface TestWebhookResult {
|
|
318
364
|
delivery: TestDelivery
|
|
319
|
-
/** x-signature
|
|
320
|
-
signature: string
|
|
321
|
-
/** точное тело запроса */
|
|
322
|
-
body: string
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
export interface LegacyAddresses {
|
|
326
|
-
/** items: 0..1000 */
|
|
327
|
-
addresses: string[]
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
export interface LegacyClientResult {
|
|
331
|
-
ok: true
|
|
332
|
-
client: {
|
|
333
|
-
id: string
|
|
334
|
-
webhookUrl: string
|
|
335
|
-
addresses: string[]
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
export interface LegacyError {
|
|
340
|
-
ok: false
|
|
341
|
-
error: string
|
|
342
|
-
details?: Array<{
|
|
343
|
-
index: number
|
|
344
|
-
message: string
|
|
345
|
-
}>
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
export interface LegacyTestResult {
|
|
349
|
-
ok: boolean
|
|
350
|
-
clientId: string
|
|
351
|
-
webhookUrl: string
|
|
352
|
-
delivery: TestDelivery
|
|
365
|
+
/** Value of the `x-signature` header. */
|
|
353
366
|
signature: string
|
|
367
|
+
/** Exact request body. */
|
|
354
368
|
body: string
|
|
355
369
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Official TypeScript SDK for the V3 Finance Monitoring API: monitor addresses on TRON and EVM networks and receive
|
|
3
|
+
* signed webhooks for every incoming and outgoing transfer.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* API reference: https://monitoring.v3.finance/docs
|
|
6
6
|
*
|
|
7
7
|
* @packageDocumentation
|
|
8
8
|
*/
|
|
@@ -19,29 +19,12 @@ export {
|
|
|
19
19
|
type ErrorDetail,
|
|
20
20
|
} from './core/errors.js'
|
|
21
21
|
|
|
22
|
-
export { AccountResource
|
|
23
|
-
export {
|
|
24
|
-
ADDRESS_BATCH_SIZE,
|
|
25
|
-
AddressesResource,
|
|
26
|
-
type AddAddressesResult,
|
|
27
|
-
type AddressDefaults,
|
|
28
|
-
type AddressRef,
|
|
29
|
-
type AddressSubscriptionUpdate,
|
|
30
|
-
type ListAddressesParams,
|
|
31
|
-
type RemoveAddressesResult,
|
|
32
|
-
type UpdateAddressesResult,
|
|
33
|
-
} from './resources/addresses.js'
|
|
22
|
+
export { AccountResource } from './resources/account.js'
|
|
23
|
+
export { ADDRESS_BATCH_SIZE, AddressesResource, type ListAddressesParams, type SubscriptionDefaults } from './resources/addresses.js'
|
|
34
24
|
export { AssetsResource, NetworksResource } from './resources/catalog.js'
|
|
35
|
-
export {
|
|
36
|
-
ClientKeysResource,
|
|
37
|
-
ClientsResource,
|
|
38
|
-
type ListClientsParams,
|
|
39
|
-
type RotateSecretParams,
|
|
40
|
-
type RotateSecretResult,
|
|
41
|
-
type UpdateClientParams,
|
|
42
|
-
} from './resources/clients.js'
|
|
43
25
|
export { DeliveriesResource, type DeliveryFilter, type ListDeliveriesParams } from './resources/deliveries.js'
|
|
44
26
|
export { TransactionsResource } from './resources/transactions.js'
|
|
27
|
+
export { WebhooksResource } from './resources/webhooks.js'
|
|
45
28
|
|
|
46
29
|
export {
|
|
47
30
|
isTestWebhook,
|
|
@@ -56,5 +39,5 @@ export {
|
|
|
56
39
|
export { formatUnits, parseUnits } from './units.js'
|
|
57
40
|
export { DEFAULT_BASE_URL, SDK_VERSION } from './version.js'
|
|
58
41
|
|
|
59
|
-
//
|
|
42
|
+
// Request and response types, generated from the OpenAPI specification
|
|
60
43
|
export type * from './generated/types.js'
|
package/src/resources/account.ts
CHANGED
|
@@ -1,87 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
1
|
+
import type { RequestOptions } from '../core/http.js'
|
|
2
|
+
import type { Scope } from '../core/scope.js'
|
|
3
|
+
import type { Client } from '../generated/types.js'
|
|
3
4
|
|
|
4
|
-
/**
|
|
5
|
-
export class PersonalKeysResource {
|
|
6
|
-
readonly #http: HttpClient
|
|
7
|
-
constructor(http: HttpClient) {
|
|
8
|
-
this.#http = http
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
async list(options?: RequestOptions): Promise<ApiKey[]> {
|
|
12
|
-
const r = await this.#http.request<{ items: ApiKey[] }>({ method: 'GET', path: '/v1/me/keys', idempotent: true, options })
|
|
13
|
-
return r.items
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Выпускает личный ключ. Работает только с клиентом, вошедшим по паролю ({@link MonitoringClient.signIn}):
|
|
18
|
-
* ключ не может выпустить себе замену. Полный ключ — в `key`, показывается один раз.
|
|
19
|
-
*/
|
|
20
|
-
create(params: IssueKeyRequest = {}, options?: RequestOptions): Promise<IssuedKey> {
|
|
21
|
-
return this.#http.request({ method: 'POST', path: '/v1/me/keys', body: params, idempotent: false, options })
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
async revoke(keyId: string, options?: RequestOptions): Promise<void> {
|
|
25
|
-
await this.#http.request({ method: 'DELETE', path: `/v1/me/keys/${seg(keyId)}`, idempotent: true, options })
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/** Кто вы и ваши ключи */
|
|
5
|
+
/** Your client: the account your API key belongs to. */
|
|
30
6
|
export class AccountResource {
|
|
31
|
-
readonly #
|
|
32
|
-
|
|
33
|
-
readonly keys: PersonalKeysResource
|
|
7
|
+
readonly #scope: Scope
|
|
8
|
+
readonly #resolveId: () => Promise<string>
|
|
34
9
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
this
|
|
10
|
+
/** @internal */
|
|
11
|
+
constructor(scope: Scope, resolveId: () => Promise<string>) {
|
|
12
|
+
this.#scope = scope
|
|
13
|
+
this.#resolveId = resolveId
|
|
38
14
|
}
|
|
39
15
|
|
|
40
16
|
/**
|
|
41
|
-
*
|
|
42
|
-
* `actor.kind === 'client-key'` и `actor.clientId`.
|
|
17
|
+
* Retrieves your client, including its webhook URL and status.
|
|
43
18
|
*
|
|
44
19
|
* @example
|
|
45
20
|
* ```ts
|
|
46
|
-
* const
|
|
47
|
-
*
|
|
21
|
+
* const account = await monitoring.account.get()
|
|
22
|
+
* console.log(account.webhookUrl, account.status)
|
|
48
23
|
* ```
|
|
49
24
|
*/
|
|
50
|
-
|
|
51
|
-
return this.#http.request({ method: 'GET', path:
|
|
25
|
+
async get(options?: RequestOptions): Promise<Client> {
|
|
26
|
+
return this.#scope.http.request({ method: 'GET', path: await this.#scope.clientPath(), idempotent: true, options })
|
|
52
27
|
}
|
|
53
|
-
}
|
|
54
28
|
|
|
55
|
-
/**
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
token: string
|
|
59
|
-
user: User
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/** Сессия: выход и смена пароля. Нужен клиент, вошедший по паролю */
|
|
63
|
-
export class AuthResource {
|
|
64
|
-
readonly #http: HttpClient
|
|
65
|
-
constructor(http: HttpClient) {
|
|
66
|
-
this.#http = http
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/** Текущая сессия и пользователь; `null` — сессии нет или она истекла */
|
|
70
|
-
session(options?: RequestOptions): Promise<{ session: Record<string, unknown>; user: User } | null> {
|
|
71
|
-
return this.#http.request({ method: 'GET', path: '/api/auth/get-session', idempotent: true, options })
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/** Завершает сессию; токен перестаёт работать */
|
|
75
|
-
async signOut(options?: RequestOptions): Promise<void> {
|
|
76
|
-
await this.#http.request({ method: 'POST', path: '/api/auth/sign-out', body: {}, idempotent: true, options })
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Меняет пароль. Ключом пароль не сменить — только в сессии.
|
|
81
|
-
*
|
|
82
|
-
* @param params.revokeOtherSessions - завершить остальные сессии
|
|
83
|
-
*/
|
|
84
|
-
async changePassword(params: { currentPassword: string; newPassword: string; revokeOtherSessions?: boolean }, options?: RequestOptions): Promise<void> {
|
|
85
|
-
await this.#http.request({ method: 'POST', path: '/api/auth/change-password', body: params, idempotent: false, options })
|
|
29
|
+
/** Returns your client ID — the value of the `x-client-id` header on every webhook. */
|
|
30
|
+
id(): Promise<string> {
|
|
31
|
+
return this.#resolveId()
|
|
86
32
|
}
|
|
87
33
|
}
|