@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
|
@@ -2,132 +2,123 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AddressesResource = exports.ADDRESS_BATCH_SIZE = void 0;
|
|
4
4
|
const errors_js_1 = require("../core/errors.js");
|
|
5
|
-
const http_js_1 = require("../core/http.js");
|
|
6
5
|
const pagination_js_1 = require("../core/pagination.js");
|
|
7
|
-
/**
|
|
6
|
+
/** Maximum number of addresses the API accepts per request. Larger lists are split into batches automatically. */
|
|
8
7
|
exports.ADDRESS_BATCH_SIZE = 1000;
|
|
9
|
-
/**
|
|
10
|
-
* Адреса клиента на мониторинге и их подписка: какие активы и в каком направлении сообщать.
|
|
11
|
-
*
|
|
12
|
-
* Новый адрес начинает отслеживаться через несколько секунд после добавления.
|
|
13
|
-
*/
|
|
8
|
+
/** Addresses you monitor and their subscriptions: which assets and which direction you are notified about. */
|
|
14
9
|
class AddressesResource {
|
|
15
|
-
#
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
#scope;
|
|
11
|
+
/** @internal */
|
|
12
|
+
constructor(scope) {
|
|
13
|
+
this.#scope = scope;
|
|
18
14
|
}
|
|
19
15
|
/**
|
|
20
|
-
*
|
|
16
|
+
* Lists monitored addresses, one page at a time.
|
|
21
17
|
*
|
|
22
18
|
* @example
|
|
23
19
|
* ```ts
|
|
24
|
-
* const
|
|
20
|
+
* const { items, next } = await monitoring.addresses.list({ network: 'tron' })
|
|
25
21
|
* ```
|
|
26
22
|
*/
|
|
27
|
-
list(
|
|
28
|
-
return this.#http.request({ method: 'GET', path:
|
|
23
|
+
async list(params = {}, options) {
|
|
24
|
+
return this.#scope.http.request({ method: 'GET', path: `${await this.#scope.clientPath()}/addresses`, query: { ...params }, idempotent: true, options });
|
|
29
25
|
}
|
|
30
26
|
/**
|
|
31
|
-
*
|
|
27
|
+
* Iterates over all monitored addresses, fetching pages as needed.
|
|
32
28
|
*
|
|
33
29
|
* @example
|
|
34
30
|
* ```ts
|
|
35
|
-
* for await (const
|
|
31
|
+
* for await (const address of monitoring.addresses.iterate({ network: 'tron' })) {
|
|
32
|
+
* console.log(address.address, address.assets ?? 'all assets', address.direction)
|
|
33
|
+
* }
|
|
36
34
|
* ```
|
|
37
35
|
*/
|
|
38
|
-
iterate(
|
|
39
|
-
return (0, pagination_js_1.paginate)((after) => this.list(
|
|
36
|
+
iterate(params = {}, options) {
|
|
37
|
+
return (0, pagination_js_1.paginate)((after) => this.list({ ...params, after }, options));
|
|
40
38
|
}
|
|
41
39
|
/**
|
|
42
|
-
*
|
|
40
|
+
* Starts monitoring addresses. New addresses are picked up within seconds. Addresses that are already monitored are
|
|
41
|
+
* left unchanged — use {@link AddressesResource.update} to change their subscription.
|
|
43
42
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
43
|
+
* Each batch of up to {@link ADDRESS_BATCH_SIZE} addresses is validated as a whole: if any item is invalid, the
|
|
44
|
+
* batch is not applied. Larger lists are sent in batches, in order; if a batch fails, the previous batches have
|
|
45
|
+
* already been applied, and the indexes in `error.details` refer to your original list. Retrying is safe.
|
|
47
46
|
*
|
|
48
|
-
* @param
|
|
49
|
-
* @
|
|
47
|
+
* @param addresses - Addresses to monitor. An EVM address is monitored per network: add it once per network.
|
|
48
|
+
* @param defaults - Subscription for addresses that do not set their own.
|
|
49
|
+
* @throws {@link MonitoringApiError} `400` with `details` when an address is invalid for its network or an asset
|
|
50
|
+
* is unknown.
|
|
50
51
|
*
|
|
51
52
|
* @example
|
|
52
53
|
* ```ts
|
|
53
|
-
* //
|
|
54
|
-
* await monitoring.addresses.add(
|
|
54
|
+
* // deposit addresses: incoming USDT only
|
|
55
|
+
* await monitoring.addresses.add([{ network: 'tron', address: 'TA8Hg…', label: 'user-42' }], {
|
|
55
56
|
* assets: ['USDT'],
|
|
56
57
|
* direction: 'in',
|
|
57
58
|
* })
|
|
58
59
|
* ```
|
|
59
60
|
*/
|
|
60
|
-
async add(
|
|
61
|
+
async add(addresses, defaults = {}, options) {
|
|
61
62
|
const total = { added: 0, alreadyWatched: 0 };
|
|
62
|
-
await this.#
|
|
63
|
-
const r = await this.#http.request({
|
|
64
|
-
method: 'POST',
|
|
65
|
-
path: `/v1/clients/${(0, http_js_1.seg)(clientId)}/addresses`,
|
|
66
|
-
body: { ...defaults, addresses: batch },
|
|
67
|
-
idempotent: true,
|
|
68
|
-
options,
|
|
69
|
-
});
|
|
63
|
+
await this.#batches(addresses, async (batch, path) => {
|
|
64
|
+
const r = await this.#scope.http.request({ method: 'POST', path: `${path}/addresses`, body: { ...defaults, addresses: batch }, idempotent: true, options });
|
|
70
65
|
total.added += r.added;
|
|
71
66
|
total.alreadyWatched += r.alreadyWatched;
|
|
72
67
|
});
|
|
73
68
|
return total;
|
|
74
69
|
}
|
|
75
70
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
71
|
+
* Changes the subscription of monitored addresses. Only the fields you pass are changed: omit `assets` to keep the
|
|
72
|
+
* current assets, or pass `null` to subscribe to all assets of the network.
|
|
78
73
|
*
|
|
79
74
|
* @example
|
|
80
75
|
* ```ts
|
|
81
|
-
* await monitoring.addresses.update(
|
|
76
|
+
* await monitoring.addresses.update([{ network: 'tron', address: 'TA8Hg…' }], { direction: 'both' })
|
|
82
77
|
* ```
|
|
83
78
|
*/
|
|
84
|
-
async update(
|
|
79
|
+
async update(addresses, defaults = {}, options) {
|
|
85
80
|
const total = { updated: 0, notWatched: 0 };
|
|
86
|
-
await this.#
|
|
87
|
-
const r = await this.#http.request({
|
|
88
|
-
method: 'POST',
|
|
89
|
-
path: `/v1/clients/${(0, http_js_1.seg)(clientId)}/addresses/update`,
|
|
90
|
-
body: { ...defaults, addresses: batch },
|
|
91
|
-
idempotent: true,
|
|
92
|
-
options,
|
|
93
|
-
});
|
|
81
|
+
await this.#batches(addresses, async (batch, path) => {
|
|
82
|
+
const r = await this.#scope.http.request({ method: 'POST', path: `${path}/addresses/update`, body: { ...defaults, addresses: batch }, idempotent: true, options });
|
|
94
83
|
total.updated += r.updated;
|
|
95
84
|
total.notWatched += r.notWatched;
|
|
96
85
|
});
|
|
97
86
|
return total;
|
|
98
87
|
}
|
|
99
|
-
/**
|
|
100
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Stops monitoring addresses.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* await monitoring.addresses.remove([{ network: 'tron', address: 'TA8Hg…' }])
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
async remove(addresses, options) {
|
|
101
97
|
const total = { removed: 0, notWatched: 0 };
|
|
102
|
-
await this.#
|
|
103
|
-
const r = await this.#http.request({
|
|
104
|
-
method: 'POST',
|
|
105
|
-
path: `/v1/clients/${(0, http_js_1.seg)(clientId)}/addresses/remove`,
|
|
106
|
-
body: { addresses: batch },
|
|
107
|
-
idempotent: true,
|
|
108
|
-
options,
|
|
109
|
-
});
|
|
98
|
+
await this.#batches(addresses, async (batch, path) => {
|
|
99
|
+
const r = await this.#scope.http.request({ method: 'POST', path: `${path}/addresses/remove`, body: { addresses: batch }, idempotent: true, options });
|
|
110
100
|
total.removed += r.removed;
|
|
111
101
|
total.notWatched += r.notWatched;
|
|
112
102
|
});
|
|
113
103
|
return total;
|
|
114
104
|
}
|
|
115
|
-
/**
|
|
116
|
-
async #
|
|
105
|
+
/** Sends items in batches, in order; maps per-item error indexes back to the original list. */
|
|
106
|
+
async #batches(items, send) {
|
|
107
|
+
const path = await this.#scope.clientPath();
|
|
117
108
|
for (let offset = 0; offset < items.length; offset += exports.ADDRESS_BATCH_SIZE) {
|
|
118
109
|
try {
|
|
119
|
-
await send(items.slice(offset, offset + exports.ADDRESS_BATCH_SIZE));
|
|
110
|
+
await send(items.slice(offset, offset + exports.ADDRESS_BATCH_SIZE), path);
|
|
120
111
|
}
|
|
121
|
-
catch (
|
|
122
|
-
if (!(
|
|
123
|
-
throw
|
|
112
|
+
catch (error) {
|
|
113
|
+
if (!(error instanceof errors_js_1.MonitoringApiError) || offset === 0)
|
|
114
|
+
throw error;
|
|
124
115
|
throw new errors_js_1.MonitoringApiError({
|
|
125
|
-
status:
|
|
126
|
-
code:
|
|
127
|
-
message: `${
|
|
128
|
-
details:
|
|
129
|
-
requestId:
|
|
130
|
-
body:
|
|
116
|
+
status: error.status,
|
|
117
|
+
code: error.code,
|
|
118
|
+
message: `${error.message.replace(/ \(HTTP \d+, [\w-]+\)$/, '')}; addresses before index ${offset} were already applied`,
|
|
119
|
+
details: error.details.map((d) => ({ ...d, index: d.index + offset })),
|
|
120
|
+
requestId: error.requestId,
|
|
121
|
+
body: error.body,
|
|
131
122
|
});
|
|
132
123
|
}
|
|
133
124
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../../src/resources/addresses.ts"],"names":[],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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"}
|
|
@@ -2,44 +2,50 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AssetsResource = exports.NetworksResource = void 0;
|
|
4
4
|
const http_js_1 = require("../core/http.js");
|
|
5
|
-
/**
|
|
5
|
+
/** Supported networks. */
|
|
6
6
|
class NetworksResource {
|
|
7
|
-
#
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
#scope;
|
|
8
|
+
/** @internal */
|
|
9
|
+
constructor(scope) {
|
|
10
|
+
this.#scope = scope;
|
|
10
11
|
}
|
|
11
|
-
/**
|
|
12
|
+
/** Lists all networks. Transfers are monitored on networks with `enabled: true`. */
|
|
12
13
|
async list(options) {
|
|
13
|
-
const r = await this.#http.request({ method: 'GET', path: '/v1/networks', idempotent: true, options });
|
|
14
|
+
const r = await this.#scope.http.request({ method: 'GET', path: '/v1/networks', idempotent: true, options });
|
|
14
15
|
return r.items;
|
|
15
16
|
}
|
|
16
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Retrieves a network.
|
|
19
|
+
*
|
|
20
|
+
* @param network - Network slug (`tron`, `ethereum`) or CAIP-2 ID (`eip155:1`).
|
|
21
|
+
*/
|
|
17
22
|
get(network, options) {
|
|
18
|
-
return this.#http.request({ method: 'GET', path: `/v1/networks/${(0, http_js_1.seg)(network)}`, idempotent: true, options });
|
|
23
|
+
return this.#scope.http.request({ method: 'GET', path: `/v1/networks/${(0, http_js_1.seg)(network)}`, idempotent: true, options });
|
|
19
24
|
}
|
|
20
25
|
}
|
|
21
26
|
exports.NetworksResource = NetworksResource;
|
|
22
|
-
/**
|
|
27
|
+
/** Native coins and tokens. You are notified about transfers of enabled assets of at least `minAmount`. */
|
|
23
28
|
class AssetsResource {
|
|
24
|
-
#
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
#scope;
|
|
30
|
+
/** @internal */
|
|
31
|
+
constructor(scope) {
|
|
32
|
+
this.#scope = scope;
|
|
27
33
|
}
|
|
28
34
|
/**
|
|
29
|
-
*
|
|
35
|
+
* Lists assets, optionally of one network.
|
|
30
36
|
*
|
|
31
37
|
* @example
|
|
32
38
|
* ```ts
|
|
33
|
-
* const usdt = (await monitoring.assets.list({ network: 'tron' })).find((
|
|
34
|
-
* formatUnits(webhook.tx.value, usdt!.decimals)
|
|
39
|
+
* const usdt = (await monitoring.assets.list({ network: 'tron' })).find((asset) => asset.symbol === 'USDT')
|
|
35
40
|
* ```
|
|
36
41
|
*/
|
|
37
42
|
async list(params = {}, options) {
|
|
38
|
-
const r = await this.#http.request({ method: 'GET', path: '/v1/assets', query: params, idempotent: true, options });
|
|
43
|
+
const r = await this.#scope.http.request({ method: 'GET', path: '/v1/assets', query: params, idempotent: true, options });
|
|
39
44
|
return r.items;
|
|
40
45
|
}
|
|
46
|
+
/** Retrieves an asset by ID. */
|
|
41
47
|
get(assetId, options) {
|
|
42
|
-
return this.#http.request({ method: 'GET', path: `/v1/assets/${(0, http_js_1.seg)(assetId)}`, idempotent: true, options });
|
|
48
|
+
return this.#scope.http.request({ method: 'GET', path: `/v1/assets/${(0, http_js_1.seg)(assetId)}`, idempotent: true, options });
|
|
43
49
|
}
|
|
44
50
|
}
|
|
45
51
|
exports.AssetsResource = AssetsResource;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../../src/resources/catalog.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../../src/resources/catalog.ts"],"names":[],"mappings":";;;AAAA,6CAA0D;AAI1D,0BA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AC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,IAAA,aAAG,EAAC,OAAO,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;IACnH,CAAC;CACF"}
|
|
@@ -1,50 +1,61 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import {
|
|
3
|
-
import type { Delivery, DeliveryDetail, DeliveryStatus } from '../generated/types.js';
|
|
4
|
-
/**
|
|
1
|
+
import { type RequestOptions } from '../core/http.js';
|
|
2
|
+
import type { Scope } from '../core/scope.js';
|
|
3
|
+
import type { Delivery, DeliveryDetail, DeliveryPage, DeliveryStatus } from '../generated/types.js';
|
|
4
|
+
/** Filters for webhook deliveries. All are optional and can be combined. */
|
|
5
5
|
export interface DeliveryFilter {
|
|
6
|
-
/** `delivered
|
|
6
|
+
/** `delivered`, `retrying` or `failed`. */
|
|
7
7
|
status?: DeliveryStatus;
|
|
8
|
-
/**
|
|
8
|
+
/** Network slug or CAIP-2 ID. */
|
|
9
9
|
network?: string;
|
|
10
|
-
/**
|
|
10
|
+
/** Asset symbol. */
|
|
11
11
|
asset?: string;
|
|
12
|
-
/**
|
|
12
|
+
/** Transaction hash. */
|
|
13
13
|
tx?: string;
|
|
14
|
-
/**
|
|
14
|
+
/** Sender or recipient address. */
|
|
15
15
|
address?: string;
|
|
16
|
-
/**
|
|
16
|
+
/** First attempt at or after this time. */
|
|
17
17
|
since?: Date | string;
|
|
18
|
-
/**
|
|
18
|
+
/** First attempt before this time. */
|
|
19
19
|
until?: Date | string;
|
|
20
20
|
}
|
|
21
|
+
/** Parameters of {@link DeliveriesResource.list}. */
|
|
21
22
|
export interface ListDeliveriesParams extends DeliveryFilter {
|
|
22
|
-
/**
|
|
23
|
+
/** Page size, up to 500. Defaults to 100. */
|
|
23
24
|
limit?: number;
|
|
24
|
-
/**
|
|
25
|
+
/** Cursor: `next` of the previous page. */
|
|
25
26
|
before?: number;
|
|
26
27
|
}
|
|
27
28
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
29
|
+
* Every webhook sent to you: status, attempts and your endpoint's response. Retries of the same webhook are one
|
|
30
|
+
* delivery with an attempt count. Deliveries are kept for 90 days.
|
|
30
31
|
*/
|
|
31
32
|
export declare class DeliveriesResource {
|
|
32
33
|
#private;
|
|
33
|
-
|
|
34
|
+
/** @internal */
|
|
35
|
+
constructor(scope: Scope);
|
|
34
36
|
/**
|
|
35
|
-
*
|
|
37
|
+
* Lists deliveries, newest first, one page at a time.
|
|
36
38
|
*
|
|
37
39
|
* @example
|
|
38
40
|
* ```ts
|
|
39
|
-
* const { items } = await monitoring.deliveries.list(
|
|
41
|
+
* const { items } = await monitoring.deliveries.list({ status: 'failed', since: new Date(Date.now() - 86_400_000) })
|
|
40
42
|
* ```
|
|
41
43
|
*/
|
|
42
|
-
list(
|
|
43
|
-
/**
|
|
44
|
-
|
|
44
|
+
list(params?: ListDeliveriesParams, options?: RequestOptions): Promise<DeliveryPage>;
|
|
45
|
+
/**
|
|
46
|
+
* Iterates over all deliveries matching the filter, newest first.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* for await (const delivery of monitoring.deliveries.iterate({ status: 'failed' })) {
|
|
51
|
+
* console.log(delivery.txId, delivery.attempts, delivery.lastHttpStatus ?? delivery.lastError)
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
iterate(filter?: DeliveryFilter & {
|
|
45
56
|
limit?: number;
|
|
46
57
|
}, options?: RequestOptions): AsyncGenerator<Delivery, void, undefined>;
|
|
47
|
-
/**
|
|
48
|
-
get(
|
|
58
|
+
/** Retrieves a delivery with the URL of the last attempt and the exact request body. */
|
|
59
|
+
get(deliveryId: number, options?: RequestOptions): Promise<DeliveryDetail>;
|
|
49
60
|
}
|
|
50
61
|
//# sourceMappingURL=deliveries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deliveries.d.ts","sourceRoot":"","sources":["../../../src/resources/deliveries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"deliveries.d.ts","sourceRoot":"","sources":["../../../src/resources/deliveries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAE1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAEnG,4EAA4E;AAC5E,MAAM,WAAW,cAAc;IAC7B,2CAA2C;IAC3C,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,wBAAwB;IACxB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,CAAA;IACrB,sCAAsC;IACtC,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,CAAA;CACtB;AAED,qDAAqD;AACrD,MAAM,WAAW,oBAAqB,SAAQ,cAAc;IAC1D,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAID;;;GAGG;AACH,qBAAa,kBAAkB;;IAG7B,gBAAgB;IAChB,YAAY,KAAK,EAAE,KAAK,EAEvB;IAED;;;;;;;OAOG;IACG,IAAI,CAAC,MAAM,GAAE,oBAAyB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAQ7F;IAED;;;;;;;;;OASG;IACH,OAAO,CAAC,MAAM,GAAE,cAAc,GAAG;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,cAAc,CAAC,QAAQ,EAAE,IAAI,EAAE,SAAS,CAAC,CAE7H;IAED,wFAAwF;IAClF,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAE/E;CACF"}
|
|
@@ -3,40 +3,50 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DeliveriesResource = void 0;
|
|
4
4
|
const http_js_1 = require("../core/http.js");
|
|
5
5
|
const pagination_js_1 = require("../core/pagination.js");
|
|
6
|
-
const iso = (
|
|
6
|
+
const iso = (value) => (value instanceof Date ? value.toISOString() : value);
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* Every webhook sent to you: status, attempts and your endpoint's response. Retries of the same webhook are one
|
|
9
|
+
* delivery with an attempt count. Deliveries are kept for 90 days.
|
|
10
10
|
*/
|
|
11
11
|
class DeliveriesResource {
|
|
12
|
-
#
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
#scope;
|
|
13
|
+
/** @internal */
|
|
14
|
+
constructor(scope) {
|
|
15
|
+
this.#scope = scope;
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
|
-
*
|
|
18
|
+
* Lists deliveries, newest first, one page at a time.
|
|
18
19
|
*
|
|
19
20
|
* @example
|
|
20
21
|
* ```ts
|
|
21
|
-
* const { items } = await monitoring.deliveries.list(
|
|
22
|
+
* const { items } = await monitoring.deliveries.list({ status: 'failed', since: new Date(Date.now() - 86_400_000) })
|
|
22
23
|
* ```
|
|
23
24
|
*/
|
|
24
|
-
list(
|
|
25
|
-
return this.#http.request({
|
|
25
|
+
async list(params = {}, options) {
|
|
26
|
+
return this.#scope.http.request({
|
|
26
27
|
method: 'GET',
|
|
27
|
-
path:
|
|
28
|
+
path: `${await this.#scope.clientPath()}/deliveries`,
|
|
28
29
|
query: { ...params, since: iso(params.since), until: iso(params.until) },
|
|
29
30
|
idempotent: true,
|
|
30
31
|
options,
|
|
31
32
|
});
|
|
32
33
|
}
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Iterates over all deliveries matching the filter, newest first.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* for await (const delivery of monitoring.deliveries.iterate({ status: 'failed' })) {
|
|
40
|
+
* console.log(delivery.txId, delivery.attempts, delivery.lastHttpStatus ?? delivery.lastError)
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
iterate(filter = {}, options) {
|
|
45
|
+
return (0, pagination_js_1.paginate)((before) => this.list({ ...filter, before }, options));
|
|
36
46
|
}
|
|
37
|
-
/**
|
|
38
|
-
get(
|
|
39
|
-
return this.#http.request({ method: 'GET', path:
|
|
47
|
+
/** Retrieves a delivery with the URL of the last attempt and the exact request body. */
|
|
48
|
+
async get(deliveryId, options) {
|
|
49
|
+
return this.#scope.http.request({ method: 'GET', path: `${await this.#scope.clientPath()}/deliveries/${(0, http_js_1.seg)(deliveryId)}`, idempotent: true, options });
|
|
40
50
|
}
|
|
41
51
|
}
|
|
42
52
|
exports.DeliveriesResource = DeliveriesResource;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deliveries.js","sourceRoot":"","sources":["../../../src/resources/deliveries.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"deliveries.js","sourceRoot":"","sources":["../../../src/resources/deliveries.ts"],"names":[],"mappings":";;;AAAA,6CAA0D;AAC1D,yDAAgD;AA8BhD,MAAM,GAAG,GAAG,CAAC,KAAgC,EAAE,EAAE,CAAC,CAAC,KAAK,YAAY,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;A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type { Scope } from '../core/scope.js';
|
|
2
3
|
import type { Transaction } from '../generated/types.js';
|
|
3
|
-
/**
|
|
4
|
+
/** Any transaction on a supported network, by hash. */
|
|
4
5
|
export declare class TransactionsResource {
|
|
5
6
|
#private;
|
|
6
|
-
|
|
7
|
+
/** @internal */
|
|
8
|
+
constructor(scope: Scope);
|
|
7
9
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
+
* Retrieves a transaction — not only the ones you were notified about: status, confirmations, finality, fee and
|
|
11
|
+
* every transfer inside it, plus your monitored addresses and the webhooks sent to you for it.
|
|
10
12
|
*
|
|
11
|
-
* `final: true`
|
|
12
|
-
*
|
|
13
|
+
* `final: true` means the transaction can no longer be reverted: on TRON the block is solidified (about 1 minute),
|
|
14
|
+
* on EVM networks it is finalized (about 13 minutes on Ethereum). Credit large amounts once the transaction is final.
|
|
13
15
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* @
|
|
17
|
-
* @param hash - EVM — `0x` + 64 hex; TRON — 64 hex (можно с `0x`)
|
|
18
|
-
* @throws {@link MonitoringApiError} 404 — такой транзакции в сети нет
|
|
16
|
+
* @param network - Network slug (`tron`, `ethereum`) or CAIP-2 ID.
|
|
17
|
+
* @param hash - EVM: `0x` followed by 64 hex characters. TRON: 64 hex characters.
|
|
18
|
+
* @throws {@link MonitoringApiError} `404` when the transaction does not exist on the network.
|
|
19
19
|
*
|
|
20
20
|
* @example
|
|
21
21
|
* ```ts
|
|
22
|
-
* const tx = await monitoring.transactions.get('tron',
|
|
23
|
-
* if (tx.status === 'success' && tx.final) credit(
|
|
22
|
+
* const tx = await monitoring.transactions.get('tron', event.tx.id)
|
|
23
|
+
* if (tx.status === 'success' && tx.final) await credit(event.tx)
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
26
|
get(network: string, hash: string, options?: RequestOptions): Promise<Transaction>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transactions.d.ts","sourceRoot":"","sources":["../../../src/resources/transactions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"transactions.d.ts","sourceRoot":"","sources":["../../../src/resources/transactions.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,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,uDAAuD;AACvD,qBAAa,oBAAoB;;IAG/B,gBAAgB;IAChB,YAAY,KAAK,EAAE,KAAK,EAEvB;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,CAEjF;CACF"}
|