@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../src/resources/account.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../src/resources/account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAEnD,wDAAwD;AACxD,qBAAa,eAAe;;IAI1B,gBAAgB;IAChB,YAAY,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EAGzD;IAED;;;;;;;;OAQG;IACG,GAAG,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAEnD;IAED,uFAAuF;IACvF,EAAE,IAAI,OAAO,CAAC,MAAM,CAAC,CAEpB;CACF"}
|
|
@@ -1,69 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
/** Личные ключи: действуют от вашего имени с вашими правами — всё, что вы можете в панели */
|
|
3
|
-
export class PersonalKeysResource {
|
|
4
|
-
#http;
|
|
5
|
-
constructor(http) {
|
|
6
|
-
this.#http = http;
|
|
7
|
-
}
|
|
8
|
-
async list(options) {
|
|
9
|
-
const r = await this.#http.request({ method: 'GET', path: '/v1/me/keys', idempotent: true, options });
|
|
10
|
-
return r.items;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Выпускает личный ключ. Работает только с клиентом, вошедшим по паролю ({@link MonitoringClient.signIn}):
|
|
14
|
-
* ключ не может выпустить себе замену. Полный ключ — в `key`, показывается один раз.
|
|
15
|
-
*/
|
|
16
|
-
create(params = {}, options) {
|
|
17
|
-
return this.#http.request({ method: 'POST', path: '/v1/me/keys', body: params, idempotent: false, options });
|
|
18
|
-
}
|
|
19
|
-
async revoke(keyId, options) {
|
|
20
|
-
await this.#http.request({ method: 'DELETE', path: `/v1/me/keys/${seg(keyId)}`, idempotent: true, options });
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
/** Кто вы и ваши ключи */
|
|
1
|
+
/** Your client: the account your API key belongs to. */
|
|
24
2
|
export class AccountResource {
|
|
25
|
-
#
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
constructor(
|
|
29
|
-
this.#
|
|
30
|
-
this
|
|
3
|
+
#scope;
|
|
4
|
+
#resolveId;
|
|
5
|
+
/** @internal */
|
|
6
|
+
constructor(scope, resolveId) {
|
|
7
|
+
this.#scope = scope;
|
|
8
|
+
this.#resolveId = resolveId;
|
|
31
9
|
}
|
|
32
10
|
/**
|
|
33
|
-
*
|
|
34
|
-
* `actor.kind === 'client-key'` и `actor.clientId`.
|
|
11
|
+
* Retrieves your client, including its webhook URL and status.
|
|
35
12
|
*
|
|
36
13
|
* @example
|
|
37
14
|
* ```ts
|
|
38
|
-
* const
|
|
39
|
-
*
|
|
15
|
+
* const account = await monitoring.account.get()
|
|
16
|
+
* console.log(account.webhookUrl, account.status)
|
|
40
17
|
* ```
|
|
41
18
|
*/
|
|
42
|
-
|
|
43
|
-
return this.#http.request({ method: 'GET', path:
|
|
19
|
+
async get(options) {
|
|
20
|
+
return this.#scope.http.request({ method: 'GET', path: await this.#scope.clientPath(), idempotent: true, options });
|
|
44
21
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
#http;
|
|
49
|
-
constructor(http) {
|
|
50
|
-
this.#http = http;
|
|
51
|
-
}
|
|
52
|
-
/** Текущая сессия и пользователь; `null` — сессии нет или она истекла */
|
|
53
|
-
session(options) {
|
|
54
|
-
return this.#http.request({ method: 'GET', path: '/api/auth/get-session', idempotent: true, options });
|
|
55
|
-
}
|
|
56
|
-
/** Завершает сессию; токен перестаёт работать */
|
|
57
|
-
async signOut(options) {
|
|
58
|
-
await this.#http.request({ method: 'POST', path: '/api/auth/sign-out', body: {}, idempotent: true, options });
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Меняет пароль. Ключом пароль не сменить — только в сессии.
|
|
62
|
-
*
|
|
63
|
-
* @param params.revokeOtherSessions - завершить остальные сессии
|
|
64
|
-
*/
|
|
65
|
-
async changePassword(params, options) {
|
|
66
|
-
await this.#http.request({ method: 'POST', path: '/api/auth/change-password', body: params, idempotent: false, options });
|
|
22
|
+
/** Returns your client ID — the value of the `x-client-id` header on every webhook. */
|
|
23
|
+
id() {
|
|
24
|
+
return this.#resolveId();
|
|
67
25
|
}
|
|
68
26
|
}
|
|
69
27
|
//# sourceMappingURL=account.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../../src/resources/account.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../../src/resources/account.ts"],"names":[],"mappings":"AAIA,wDAAwD;AACxD,MAAM,OAAO,eAAe;IACjB,MAAM,CAAO;IACb,UAAU,CAAuB;IAE1C,gBAAgB;IAChB,YAAY,KAAY,EAAE,SAAgC;QACxD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAA;QACnB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA;IAC7B,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,GAAG,CAAC,OAAwB;QAChC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;IACrH,CAAC;IAED,uFAAuF;IACvF,EAAE;QACA,OAAO,IAAI,CAAC,UAAU,EAAE,CAAA;IAC1B,CAAC;CACF"}
|
|
@@ -1,109 +1,93 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import type { Address, AddressInput, AssetSelection, Direction,
|
|
4
|
-
/**
|
|
1
|
+
import type { RequestOptions } from '../core/http.js';
|
|
2
|
+
import type { Scope } from '../core/scope.js';
|
|
3
|
+
import type { AddAddressesResult, Address, AddressInput, AddressPage, AddressRef, AddressUpdate, AssetSelection, Direction, RemoveAddressesResult, UpdateAddressesResult } from '../generated/types.js';
|
|
4
|
+
/** Maximum number of addresses the API accepts per request. Larger lists are split into batches automatically. */
|
|
5
5
|
export declare const ADDRESS_BATCH_SIZE = 1000;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* Default subscription for every address in a request that does not set its own. Without it, an address is notified
|
|
8
|
+
* about all assets of its network in both directions.
|
|
9
9
|
*/
|
|
10
|
-
export interface
|
|
11
|
-
/**
|
|
10
|
+
export interface SubscriptionDefaults {
|
|
11
|
+
/** Asset symbols (`USDT`) or contract addresses. `null` — all assets of the network, including ones added later. */
|
|
12
12
|
assets?: AssetSelection;
|
|
13
|
-
/** `in` —
|
|
13
|
+
/** `in` — incoming only, `out` — outgoing only, `both` — either. */
|
|
14
14
|
direction?: Direction;
|
|
15
15
|
}
|
|
16
|
-
/**
|
|
17
|
-
export interface AddressRef {
|
|
18
|
-
/** Сеть: slug (`tron`, `ethereum`) или CAIP-2 (`eip155:1`) */
|
|
19
|
-
network: string;
|
|
20
|
-
address: string;
|
|
21
|
-
}
|
|
22
|
-
/** Новая подписка одного адреса; что не передано — не меняется */
|
|
23
|
-
export type AddressSubscriptionUpdate = UpdateAddressesRequest['addresses'][number];
|
|
24
|
-
export interface AddAddressesResult {
|
|
25
|
-
/** Добавлено новых адресов */
|
|
26
|
-
added: number;
|
|
27
|
-
/** Уже отслеживались — их подписка не менялась */
|
|
28
|
-
alreadyWatched: number;
|
|
29
|
-
}
|
|
30
|
-
export interface UpdateAddressesResult {
|
|
31
|
-
/** Найдено и изменено */
|
|
32
|
-
updated: number;
|
|
33
|
-
/** Не на мониторинге у этого клиента */
|
|
34
|
-
notWatched: number;
|
|
35
|
-
}
|
|
36
|
-
export interface RemoveAddressesResult {
|
|
37
|
-
/** Снято с мониторинга */
|
|
38
|
-
removed: number;
|
|
39
|
-
/** Не отслеживались */
|
|
40
|
-
notWatched: number;
|
|
41
|
-
}
|
|
16
|
+
/** Parameters of {@link AddressesResource.list}. */
|
|
42
17
|
export interface ListAddressesParams {
|
|
43
|
-
/**
|
|
18
|
+
/** Only addresses on this network. */
|
|
44
19
|
network?: string;
|
|
45
|
-
/**
|
|
20
|
+
/** Page size, up to 5000. Defaults to 500. */
|
|
46
21
|
limit?: number;
|
|
47
|
-
/**
|
|
22
|
+
/** Cursor: `next` of the previous page. */
|
|
48
23
|
after?: number;
|
|
49
24
|
}
|
|
50
|
-
/**
|
|
51
|
-
* Адреса клиента на мониторинге и их подписка: какие активы и в каком направлении сообщать.
|
|
52
|
-
*
|
|
53
|
-
* Новый адрес начинает отслеживаться через несколько секунд после добавления.
|
|
54
|
-
*/
|
|
25
|
+
/** Addresses you monitor and their subscriptions: which assets and which direction you are notified about. */
|
|
55
26
|
export declare class AddressesResource {
|
|
56
27
|
#private;
|
|
57
|
-
|
|
28
|
+
/** @internal */
|
|
29
|
+
constructor(scope: Scope);
|
|
58
30
|
/**
|
|
59
|
-
*
|
|
31
|
+
* Lists monitored addresses, one page at a time.
|
|
60
32
|
*
|
|
61
33
|
* @example
|
|
62
34
|
* ```ts
|
|
63
|
-
* const
|
|
35
|
+
* const { items, next } = await monitoring.addresses.list({ network: 'tron' })
|
|
64
36
|
* ```
|
|
65
37
|
*/
|
|
66
|
-
list(
|
|
38
|
+
list(params?: ListAddressesParams, options?: RequestOptions): Promise<AddressPage>;
|
|
67
39
|
/**
|
|
68
|
-
*
|
|
40
|
+
* Iterates over all monitored addresses, fetching pages as needed.
|
|
69
41
|
*
|
|
70
42
|
* @example
|
|
71
43
|
* ```ts
|
|
72
|
-
* for await (const
|
|
44
|
+
* for await (const address of monitoring.addresses.iterate({ network: 'tron' })) {
|
|
45
|
+
* console.log(address.address, address.assets ?? 'all assets', address.direction)
|
|
46
|
+
* }
|
|
73
47
|
* ```
|
|
74
48
|
*/
|
|
75
|
-
iterate(
|
|
49
|
+
iterate(params?: Omit<ListAddressesParams, 'after'>, options?: RequestOptions): AsyncGenerator<Address, void, undefined>;
|
|
76
50
|
/**
|
|
77
|
-
*
|
|
51
|
+
* Starts monitoring addresses. New addresses are picked up within seconds. Addresses that are already monitored are
|
|
52
|
+
* left unchanged — use {@link AddressesResource.update} to change their subscription.
|
|
78
53
|
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
54
|
+
* Each batch of up to {@link ADDRESS_BATCH_SIZE} addresses is validated as a whole: if any item is invalid, the
|
|
55
|
+
* batch is not applied. Larger lists are sent in batches, in order; if a batch fails, the previous batches have
|
|
56
|
+
* already been applied, and the indexes in `error.details` refer to your original list. Retrying is safe.
|
|
82
57
|
*
|
|
83
|
-
* @param
|
|
84
|
-
* @
|
|
58
|
+
* @param addresses - Addresses to monitor. An EVM address is monitored per network: add it once per network.
|
|
59
|
+
* @param defaults - Subscription for addresses that do not set their own.
|
|
60
|
+
* @throws {@link MonitoringApiError} `400` with `details` when an address is invalid for its network or an asset
|
|
61
|
+
* is unknown.
|
|
85
62
|
*
|
|
86
63
|
* @example
|
|
87
64
|
* ```ts
|
|
88
|
-
* //
|
|
89
|
-
* await monitoring.addresses.add(
|
|
65
|
+
* // deposit addresses: incoming USDT only
|
|
66
|
+
* await monitoring.addresses.add([{ network: 'tron', address: 'TA8Hg…', label: 'user-42' }], {
|
|
90
67
|
* assets: ['USDT'],
|
|
91
68
|
* direction: 'in',
|
|
92
69
|
* })
|
|
93
70
|
* ```
|
|
94
71
|
*/
|
|
95
|
-
add(
|
|
72
|
+
add(addresses: AddressInput[], defaults?: SubscriptionDefaults, options?: RequestOptions): Promise<AddAddressesResult>;
|
|
73
|
+
/**
|
|
74
|
+
* Changes the subscription of monitored addresses. Only the fields you pass are changed: omit `assets` to keep the
|
|
75
|
+
* current assets, or pass `null` to subscribe to all assets of the network.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* await monitoring.addresses.update([{ network: 'tron', address: 'TA8Hg…' }], { direction: 'both' })
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
update(addresses: AddressUpdate[], defaults?: SubscriptionDefaults, options?: RequestOptions): Promise<UpdateAddressesResult>;
|
|
96
83
|
/**
|
|
97
|
-
*
|
|
98
|
-
* `assets: null` — снова все активы сети.
|
|
84
|
+
* Stops monitoring addresses.
|
|
99
85
|
*
|
|
100
86
|
* @example
|
|
101
87
|
* ```ts
|
|
102
|
-
* await monitoring.addresses.
|
|
88
|
+
* await monitoring.addresses.remove([{ network: 'tron', address: 'TA8Hg…' }])
|
|
103
89
|
* ```
|
|
104
90
|
*/
|
|
105
|
-
|
|
106
|
-
/** Снимает адреса с мониторинга. Больше 1000 — несколькими пачками */
|
|
107
|
-
remove(clientId: string, addresses: AddressRef[], options?: RequestOptions): Promise<RemoveAddressesResult>;
|
|
91
|
+
remove(addresses: AddressRef[], options?: RequestOptions): Promise<RemoveAddressesResult>;
|
|
108
92
|
}
|
|
109
93
|
//# sourceMappingURL=addresses.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addresses.d.ts","sourceRoot":"","sources":["../../../src/resources/addresses.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"addresses.d.ts","sourceRoot":"","sources":["../../../src/resources/addresses.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAErD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,EACV,kBAAkB,EAClB,OAAO,EACP,YAAY,EACZ,WAAW,EACX,UAAU,EACV,aAAa,EACb,cAAc,EACd,SAAS,EACT,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,uBAAuB,CAAA;AAE9B,kHAAkH;AAClH,eAAO,MAAM,kBAAkB,OAAO,CAAA;AAEtC;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,oHAAoH;IACpH,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB,oEAAoE;IACpE,SAAS,CAAC,EAAE,SAAS,CAAA;CACtB;AAED,oDAAoD;AACpD,MAAM,WAAW,mBAAmB;IAClC,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,8GAA8G;AAC9G,qBAAa,iBAAiB;;IAG5B,gBAAgB;IAChB,YAAY,KAAK,EAAE,KAAK,EAEvB;IAED;;;;;;;OAOG;IACG,IAAI,CAAC,MAAM,GAAE,mBAAwB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,CAE3F;IAED;;;;;;;;;OASG;IACH,OAAO,CAAC,MAAM,GAAE,IAAI,CAAC,mBAAmB,EAAE,OAAO,CAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,CAAC,CAE3H;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,GAAG,CAAC,SAAS,EAAE,YAAY,EAAE,EAAE,QAAQ,GAAE,oBAAyB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAQ/H;IAED;;;;;;;;OAQG;IACG,MAAM,CAAC,SAAS,EAAE,aAAa,EAAE,EAAE,QAAQ,GAAE,oBAAyB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAQtI;IAED;;;;;;;OAOG;IACG,MAAM,CAAC,SAAS,EAAE,UAAU,EAAE,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAQ9F;CAqBF"}
|
|
@@ -1,130 +1,121 @@
|
|
|
1
1
|
import { MonitoringApiError } from '../core/errors.js';
|
|
2
|
-
import { seg } from '../core/http.js';
|
|
3
2
|
import { paginate } from '../core/pagination.js';
|
|
4
|
-
/**
|
|
3
|
+
/** Maximum number of addresses the API accepts per request. Larger lists are split into batches automatically. */
|
|
5
4
|
export const ADDRESS_BATCH_SIZE = 1000;
|
|
6
|
-
/**
|
|
7
|
-
* Адреса клиента на мониторинге и их подписка: какие активы и в каком направлении сообщать.
|
|
8
|
-
*
|
|
9
|
-
* Новый адрес начинает отслеживаться через несколько секунд после добавления.
|
|
10
|
-
*/
|
|
5
|
+
/** Addresses you monitor and their subscriptions: which assets and which direction you are notified about. */
|
|
11
6
|
export class AddressesResource {
|
|
12
|
-
#
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
#scope;
|
|
8
|
+
/** @internal */
|
|
9
|
+
constructor(scope) {
|
|
10
|
+
this.#scope = scope;
|
|
15
11
|
}
|
|
16
12
|
/**
|
|
17
|
-
*
|
|
13
|
+
* Lists monitored addresses, one page at a time.
|
|
18
14
|
*
|
|
19
15
|
* @example
|
|
20
16
|
* ```ts
|
|
21
|
-
* const
|
|
17
|
+
* const { items, next } = await monitoring.addresses.list({ network: 'tron' })
|
|
22
18
|
* ```
|
|
23
19
|
*/
|
|
24
|
-
list(
|
|
25
|
-
return this.#http.request({ method: 'GET', path:
|
|
20
|
+
async list(params = {}, options) {
|
|
21
|
+
return this.#scope.http.request({ method: 'GET', path: `${await this.#scope.clientPath()}/addresses`, query: { ...params }, idempotent: true, options });
|
|
26
22
|
}
|
|
27
23
|
/**
|
|
28
|
-
*
|
|
24
|
+
* Iterates over all monitored addresses, fetching pages as needed.
|
|
29
25
|
*
|
|
30
26
|
* @example
|
|
31
27
|
* ```ts
|
|
32
|
-
* for await (const
|
|
28
|
+
* for await (const address of monitoring.addresses.iterate({ network: 'tron' })) {
|
|
29
|
+
* console.log(address.address, address.assets ?? 'all assets', address.direction)
|
|
30
|
+
* }
|
|
33
31
|
* ```
|
|
34
32
|
*/
|
|
35
|
-
iterate(
|
|
36
|
-
return paginate((after) => this.list(
|
|
33
|
+
iterate(params = {}, options) {
|
|
34
|
+
return paginate((after) => this.list({ ...params, after }, options));
|
|
37
35
|
}
|
|
38
36
|
/**
|
|
39
|
-
*
|
|
37
|
+
* Starts monitoring addresses. New addresses are picked up within seconds. Addresses that are already monitored are
|
|
38
|
+
* left unchanged — use {@link AddressesResource.update} to change their subscription.
|
|
40
39
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
40
|
+
* Each batch of up to {@link ADDRESS_BATCH_SIZE} addresses is validated as a whole: if any item is invalid, the
|
|
41
|
+
* batch is not applied. Larger lists are sent in batches, in order; if a batch fails, the previous batches have
|
|
42
|
+
* already been applied, and the indexes in `error.details` refer to your original list. Retrying is safe.
|
|
44
43
|
*
|
|
45
|
-
* @param
|
|
46
|
-
* @
|
|
44
|
+
* @param addresses - Addresses to monitor. An EVM address is monitored per network: add it once per network.
|
|
45
|
+
* @param defaults - Subscription for addresses that do not set their own.
|
|
46
|
+
* @throws {@link MonitoringApiError} `400` with `details` when an address is invalid for its network or an asset
|
|
47
|
+
* is unknown.
|
|
47
48
|
*
|
|
48
49
|
* @example
|
|
49
50
|
* ```ts
|
|
50
|
-
* //
|
|
51
|
-
* await monitoring.addresses.add(
|
|
51
|
+
* // deposit addresses: incoming USDT only
|
|
52
|
+
* await monitoring.addresses.add([{ network: 'tron', address: 'TA8Hg…', label: 'user-42' }], {
|
|
52
53
|
* assets: ['USDT'],
|
|
53
54
|
* direction: 'in',
|
|
54
55
|
* })
|
|
55
56
|
* ```
|
|
56
57
|
*/
|
|
57
|
-
async add(
|
|
58
|
+
async add(addresses, defaults = {}, options) {
|
|
58
59
|
const total = { added: 0, alreadyWatched: 0 };
|
|
59
|
-
await this.#
|
|
60
|
-
const r = await this.#http.request({
|
|
61
|
-
method: 'POST',
|
|
62
|
-
path: `/v1/clients/${seg(clientId)}/addresses`,
|
|
63
|
-
body: { ...defaults, addresses: batch },
|
|
64
|
-
idempotent: true,
|
|
65
|
-
options,
|
|
66
|
-
});
|
|
60
|
+
await this.#batches(addresses, async (batch, path) => {
|
|
61
|
+
const r = await this.#scope.http.request({ method: 'POST', path: `${path}/addresses`, body: { ...defaults, addresses: batch }, idempotent: true, options });
|
|
67
62
|
total.added += r.added;
|
|
68
63
|
total.alreadyWatched += r.alreadyWatched;
|
|
69
64
|
});
|
|
70
65
|
return total;
|
|
71
66
|
}
|
|
72
67
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
68
|
+
* Changes the subscription of monitored addresses. Only the fields you pass are changed: omit `assets` to keep the
|
|
69
|
+
* current assets, or pass `null` to subscribe to all assets of the network.
|
|
75
70
|
*
|
|
76
71
|
* @example
|
|
77
72
|
* ```ts
|
|
78
|
-
* await monitoring.addresses.update(
|
|
73
|
+
* await monitoring.addresses.update([{ network: 'tron', address: 'TA8Hg…' }], { direction: 'both' })
|
|
79
74
|
* ```
|
|
80
75
|
*/
|
|
81
|
-
async update(
|
|
76
|
+
async update(addresses, defaults = {}, options) {
|
|
82
77
|
const total = { updated: 0, notWatched: 0 };
|
|
83
|
-
await this.#
|
|
84
|
-
const r = await this.#http.request({
|
|
85
|
-
method: 'POST',
|
|
86
|
-
path: `/v1/clients/${seg(clientId)}/addresses/update`,
|
|
87
|
-
body: { ...defaults, addresses: batch },
|
|
88
|
-
idempotent: true,
|
|
89
|
-
options,
|
|
90
|
-
});
|
|
78
|
+
await this.#batches(addresses, async (batch, path) => {
|
|
79
|
+
const r = await this.#scope.http.request({ method: 'POST', path: `${path}/addresses/update`, body: { ...defaults, addresses: batch }, idempotent: true, options });
|
|
91
80
|
total.updated += r.updated;
|
|
92
81
|
total.notWatched += r.notWatched;
|
|
93
82
|
});
|
|
94
83
|
return total;
|
|
95
84
|
}
|
|
96
|
-
/**
|
|
97
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Stops monitoring addresses.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```ts
|
|
90
|
+
* await monitoring.addresses.remove([{ network: 'tron', address: 'TA8Hg…' }])
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
async remove(addresses, options) {
|
|
98
94
|
const total = { removed: 0, notWatched: 0 };
|
|
99
|
-
await this.#
|
|
100
|
-
const r = await this.#http.request({
|
|
101
|
-
method: 'POST',
|
|
102
|
-
path: `/v1/clients/${seg(clientId)}/addresses/remove`,
|
|
103
|
-
body: { addresses: batch },
|
|
104
|
-
idempotent: true,
|
|
105
|
-
options,
|
|
106
|
-
});
|
|
95
|
+
await this.#batches(addresses, async (batch, path) => {
|
|
96
|
+
const r = await this.#scope.http.request({ method: 'POST', path: `${path}/addresses/remove`, body: { addresses: batch }, idempotent: true, options });
|
|
107
97
|
total.removed += r.removed;
|
|
108
98
|
total.notWatched += r.notWatched;
|
|
109
99
|
});
|
|
110
100
|
return total;
|
|
111
101
|
}
|
|
112
|
-
/**
|
|
113
|
-
async #
|
|
102
|
+
/** Sends items in batches, in order; maps per-item error indexes back to the original list. */
|
|
103
|
+
async #batches(items, send) {
|
|
104
|
+
const path = await this.#scope.clientPath();
|
|
114
105
|
for (let offset = 0; offset < items.length; offset += ADDRESS_BATCH_SIZE) {
|
|
115
106
|
try {
|
|
116
|
-
await send(items.slice(offset, offset + ADDRESS_BATCH_SIZE));
|
|
107
|
+
await send(items.slice(offset, offset + ADDRESS_BATCH_SIZE), path);
|
|
117
108
|
}
|
|
118
|
-
catch (
|
|
119
|
-
if (!(
|
|
120
|
-
throw
|
|
109
|
+
catch (error) {
|
|
110
|
+
if (!(error instanceof MonitoringApiError) || offset === 0)
|
|
111
|
+
throw error;
|
|
121
112
|
throw new MonitoringApiError({
|
|
122
|
-
status:
|
|
123
|
-
code:
|
|
124
|
-
message: `${
|
|
125
|
-
details:
|
|
126
|
-
requestId:
|
|
127
|
-
body:
|
|
113
|
+
status: error.status,
|
|
114
|
+
code: error.code,
|
|
115
|
+
message: `${error.message.replace(/ \(HTTP \d+, [\w-]+\)$/, '')}; addresses before index ${offset} were already applied`,
|
|
116
|
+
details: error.details.map((d) => ({ ...d, index: d.index + offset })),
|
|
117
|
+
requestId: error.requestId,
|
|
118
|
+
body: error.body,
|
|
128
119
|
});
|
|
129
120
|
}
|
|
130
121
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../../src/resources/addresses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../../src/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wB,EAAE,EAAE,CAAC,4BAA4B,MAAM,uBAAuB;oBACxH,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,GAAG,MAAM,EAAE,CAAC,CAAC;oBACtE,SAAS,EAAE,KAAK,CAAC,SAAS;oBAC1B,IAAI,EAAE,KAAK,CAAC,IAAI;iBACjB,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,30 +1,37 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type RequestOptions } from '../core/http.js';
|
|
2
|
+
import type { Scope } from '../core/scope.js';
|
|
2
3
|
import type { Asset, Network } from '../generated/types.js';
|
|
3
|
-
/**
|
|
4
|
+
/** Supported networks. */
|
|
4
5
|
export declare class NetworksResource {
|
|
5
6
|
#private;
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
/** @internal */
|
|
8
|
+
constructor(scope: Scope);
|
|
9
|
+
/** Lists all networks. Transfers are monitored on networks with `enabled: true`. */
|
|
8
10
|
list(options?: RequestOptions): Promise<Network[]>;
|
|
9
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves a network.
|
|
13
|
+
*
|
|
14
|
+
* @param network - Network slug (`tron`, `ethereum`) or CAIP-2 ID (`eip155:1`).
|
|
15
|
+
*/
|
|
10
16
|
get(network: string, options?: RequestOptions): Promise<Network>;
|
|
11
17
|
}
|
|
12
|
-
/**
|
|
18
|
+
/** Native coins and tokens. You are notified about transfers of enabled assets of at least `minAmount`. */
|
|
13
19
|
export declare class AssetsResource {
|
|
14
20
|
#private;
|
|
15
|
-
|
|
21
|
+
/** @internal */
|
|
22
|
+
constructor(scope: Scope);
|
|
16
23
|
/**
|
|
17
|
-
*
|
|
24
|
+
* Lists assets, optionally of one network.
|
|
18
25
|
*
|
|
19
26
|
* @example
|
|
20
27
|
* ```ts
|
|
21
|
-
* const usdt = (await monitoring.assets.list({ network: 'tron' })).find((
|
|
22
|
-
* formatUnits(webhook.tx.value, usdt!.decimals)
|
|
28
|
+
* const usdt = (await monitoring.assets.list({ network: 'tron' })).find((asset) => asset.symbol === 'USDT')
|
|
23
29
|
* ```
|
|
24
30
|
*/
|
|
25
31
|
list(params?: {
|
|
26
32
|
network?: string;
|
|
27
33
|
}, options?: RequestOptions): Promise<Asset[]>;
|
|
34
|
+
/** Retrieves an asset by ID. */
|
|
28
35
|
get(assetId: number, options?: RequestOptions): Promise<Asset>;
|
|
29
36
|
}
|
|
30
37
|
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/resources/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/resources/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,EAAE,KAAK,EAAa,OAAO,EAAe,MAAM,uBAAuB,CAAA;AAEnF,0BAA0B;AAC1B,qBAAa,gBAAgB;;IAG3B,gBAAgB;IAChB,YAAY,KAAK,EAAE,KAAK,EAEvB;IAED,oFAAoF;IAC9E,IAAI,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAGvD;IAED;;;;OAIG;IACH,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAE/D;CACF;AAED,2GAA2G;AAC3G,qBAAa,cAAc;;IAGzB,gBAAgB;IAChB,YAAY,KAAK,EAAE,KAAK,EAEvB;IAED;;;;;;;OAOG;IACG,IAAI,CAAC,MAAM,GAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAO,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAGxF;IAED,gCAAgC;IAChC,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,KAAK,CAAC,CAE7D;CACF"}
|