@txnod/sdk 1.0.1
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/AGENTS.md +29 -0
- package/CHANGELOG.md +22 -0
- package/LICENSE +21 -0
- package/README.md +434 -0
- package/dist/_shared/index.d.ts +68 -0
- package/dist/client-sandbox.d.ts +396 -0
- package/dist/client-sandbox.d.ts.map +1 -0
- package/dist/client-sandbox.js +448 -0
- package/dist/client-sandbox.js.map +1 -0
- package/dist/client.d.ts +429 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +588 -0
- package/dist/client.js.map +1 -0
- package/dist/env.d.ts +29 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +44 -0
- package/dist/env.js.map +1 -0
- package/dist/errors.d.ts +1887 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +2107 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/internals/error-ctor-map.d.ts +11 -0
- package/dist/internals/error-ctor-map.d.ts.map +1 -0
- package/dist/internals/error-ctor-map.js +75 -0
- package/dist/internals/error-ctor-map.js.map +1 -0
- package/dist/internals/fetch-with-retry.d.ts +34 -0
- package/dist/internals/fetch-with-retry.d.ts.map +1 -0
- package/dist/internals/fetch-with-retry.js +233 -0
- package/dist/internals/fetch-with-retry.js.map +1 -0
- package/dist/internals/hmac.d.ts +2 -0
- package/dist/internals/hmac.d.ts.map +1 -0
- package/dist/internals/hmac.js +10 -0
- package/dist/internals/hmac.js.map +1 -0
- package/dist/internals/logger.d.ts +9 -0
- package/dist/internals/logger.d.ts.map +1 -0
- package/dist/internals/logger.js +16 -0
- package/dist/internals/logger.js.map +1 -0
- package/dist/internals/parse-problem-details.d.ts +3 -0
- package/dist/internals/parse-problem-details.d.ts.map +1 -0
- package/dist/internals/parse-problem-details.js +76 -0
- package/dist/internals/parse-problem-details.js.map +1 -0
- package/dist/internals/synthetic-details.d.ts +12 -0
- package/dist/internals/synthetic-details.d.ts.map +1 -0
- package/dist/internals/synthetic-details.js +19 -0
- package/dist/internals/synthetic-details.js.map +1 -0
- package/dist/verify/chains/bsc.d.ts +17 -0
- package/dist/verify/chains/bsc.d.ts.map +1 -0
- package/dist/verify/chains/bsc.js +15 -0
- package/dist/verify/chains/bsc.js.map +1 -0
- package/dist/verify/chains/btc.d.ts +22 -0
- package/dist/verify/chains/btc.d.ts.map +1 -0
- package/dist/verify/chains/btc.js +55 -0
- package/dist/verify/chains/btc.js.map +1 -0
- package/dist/verify/chains/cardano.d.ts +73 -0
- package/dist/verify/chains/cardano.d.ts.map +1 -0
- package/dist/verify/chains/cardano.js +175 -0
- package/dist/verify/chains/cardano.js.map +1 -0
- package/dist/verify/chains/evm.d.ts +21 -0
- package/dist/verify/chains/evm.d.ts.map +1 -0
- package/dist/verify/chains/evm.js +46 -0
- package/dist/verify/chains/evm.js.map +1 -0
- package/dist/verify/chains/polygon.d.ts +17 -0
- package/dist/verify/chains/polygon.d.ts.map +1 -0
- package/dist/verify/chains/polygon.js +15 -0
- package/dist/verify/chains/polygon.js.map +1 -0
- package/dist/verify/chains/secp256k1-bip32.d.ts +20 -0
- package/dist/verify/chains/secp256k1-bip32.d.ts.map +1 -0
- package/dist/verify/chains/secp256k1-bip32.js +88 -0
- package/dist/verify/chains/secp256k1-bip32.js.map +1 -0
- package/dist/verify/chains/ton-cell.d.ts +179 -0
- package/dist/verify/chains/ton-cell.d.ts.map +1 -0
- package/dist/verify/chains/ton-cell.js +614 -0
- package/dist/verify/chains/ton-cell.js.map +1 -0
- package/dist/verify/chains/ton.d.ts +84 -0
- package/dist/verify/chains/ton.d.ts.map +1 -0
- package/dist/verify/chains/ton.js +131 -0
- package/dist/verify/chains/ton.js.map +1 -0
- package/dist/verify/chains/tron.d.ts +21 -0
- package/dist/verify/chains/tron.d.ts.map +1 -0
- package/dist/verify/chains/tron.js +42 -0
- package/dist/verify/chains/tron.js.map +1 -0
- package/dist/verify/config.d.ts +41 -0
- package/dist/verify/config.d.ts.map +1 -0
- package/dist/verify/config.js +120 -0
- package/dist/verify/config.js.map +1 -0
- package/dist/verify/errors.d.ts +56 -0
- package/dist/verify/errors.d.ts.map +1 -0
- package/dist/verify/errors.js +58 -0
- package/dist/verify/errors.js.map +1 -0
- package/dist/verify/index.d.ts +119 -0
- package/dist/verify/index.d.ts.map +1 -0
- package/dist/verify/index.js +166 -0
- package/dist/verify/index.js.map +1 -0
- package/dist/verify/xpub-safety.d.ts +33 -0
- package/dist/verify/xpub-safety.d.ts.map +1 -0
- package/dist/verify/xpub-safety.js +54 -0
- package/dist/verify/xpub-safety.js.map +1 -0
- package/dist/verify-webhook-signature.d.ts +30 -0
- package/dist/verify-webhook-signature.d.ts.map +1 -0
- package/dist/verify-webhook-signature.js +84 -0
- package/dist/verify-webhook-signature.js.map +1 -0
- package/docs/00-getting-started.md +135 -0
- package/docs/01-authentication.md +114 -0
- package/docs/02-invoices.md +216 -0
- package/docs/03-rates-and-quotes.md +82 -0
- package/docs/04-webhooks.md +126 -0
- package/docs/05-errors.md +199 -0
- package/docs/05-sandbox.md +159 -0
- package/docs/06-idempotency.md +132 -0
- package/docs/examples/express-webhook-receiver.md +97 -0
- package/docs/examples/nextjs-route-handler.md +206 -0
- package/docs/examples/sandbox-vitest-suite.md +263 -0
- package/docs/index.md +66 -0
- package/docs/reference/client.md +392 -0
- package/docs/reference/errors.md +161 -0
- package/docs/reference/types.md +400 -0
- package/package.json +53 -0
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import type { ClockAdvance, SimulateEvent, SimulateLatePayment, SimulateOverpaid, SimulatePartial, WalletsListResponse } from './_shared/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Result envelope returned by every `simulate*` method. `event_id` is the
|
|
4
|
+
* outbox `id` whose webhook payload your handler will receive (or `null` when
|
|
5
|
+
* the simulate-* call did not enqueue a webhook — e.g.
|
|
6
|
+
* `simulateDuplicateDelivery` re-emits an existing event).
|
|
7
|
+
*/
|
|
8
|
+
export interface SandboxSimulateResult {
|
|
9
|
+
event_id: string | null;
|
|
10
|
+
status: string;
|
|
11
|
+
}
|
|
12
|
+
/** Result envelope for `clock/advance`. */
|
|
13
|
+
export interface SandboxClockAdvanceResult {
|
|
14
|
+
advanced: number;
|
|
15
|
+
remaining: number;
|
|
16
|
+
}
|
|
17
|
+
/** Result envelope for `reset` and `destroy`. */
|
|
18
|
+
export interface SandboxLifecycleResult {
|
|
19
|
+
status: 'reset' | 'deleted';
|
|
20
|
+
}
|
|
21
|
+
interface RequestFn {
|
|
22
|
+
<T>(input: {
|
|
23
|
+
method: 'GET' | 'POST' | 'DELETE';
|
|
24
|
+
path: string;
|
|
25
|
+
query?: Record<string, string | number | undefined>;
|
|
26
|
+
body?: unknown;
|
|
27
|
+
}): Promise<T>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Thin HTTP-wrapper class for the 14 sandbox-mode endpoints introduced by
|
|
31
|
+
* Story 37.2. Constructed lazily by `TxnodClient.sandbox` so unused sandbox
|
|
32
|
+
* code is dead-code-eliminated by the bundler. Methods sign requests with the
|
|
33
|
+
* underlying HMAC scheme, parse RFC 7807 errors into typed sandbox-* error
|
|
34
|
+
* classes, and return JSON-decoded result envelopes.
|
|
35
|
+
*
|
|
36
|
+
* **Do not instantiate this class directly.** Always go through
|
|
37
|
+
* `client.sandbox` so the client's HMAC + retry + telemetry pipeline is
|
|
38
|
+
* preserved.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* import { TxnodClient } from '@txnod/sdk';
|
|
43
|
+
*
|
|
44
|
+
* const client = new TxnodClient({
|
|
45
|
+
* projectId: process.env.TXNOD_PROJECT_ID!,
|
|
46
|
+
* apiSecret: process.env.TXNOD_API_SECRET!,
|
|
47
|
+
* environment: 'non-production',
|
|
48
|
+
* });
|
|
49
|
+
*
|
|
50
|
+
* // Lazy access — TxnodClientSandbox is constructed on first use.
|
|
51
|
+
* const result = await client.sandbox.simulatePaid(
|
|
52
|
+
* '01HK8MAR2QEXAMPLE000000000',
|
|
53
|
+
* );
|
|
54
|
+
* console.log(result.event_id, result.status);
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare class TxnodClientSandbox {
|
|
58
|
+
#private;
|
|
59
|
+
constructor(request: RequestFn);
|
|
60
|
+
/**
|
|
61
|
+
* `POST /api/v1/sandbox/invoices/{invoiceId}/simulate-detect` — synthesize
|
|
62
|
+
* an `invoice.detected` event (status `pending` → `detected`) and write a
|
|
63
|
+
* synthetic `invoice_transactions` row whose `confirmations=0` is the
|
|
64
|
+
* starting point for subsequent `clockAdvance` calls.
|
|
65
|
+
*
|
|
66
|
+
* Throws `TxnodSandboxInvoiceTransitionInvalidError` when the invoice is
|
|
67
|
+
* not in `pending` status, `TxnodSandboxInvoiceNotFoundError` when the
|
|
68
|
+
* invoice does not belong to the project, and `TxnodSandboxRateLimitExceededError`
|
|
69
|
+
* when the per-project rate cap is hit.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* import { TxnodClient } from '@txnod/sdk';
|
|
74
|
+
*
|
|
75
|
+
* const client = new TxnodClient({
|
|
76
|
+
* projectId: process.env.TXNOD_PROJECT_ID!,
|
|
77
|
+
* apiSecret: process.env.TXNOD_API_SECRET!,
|
|
78
|
+
* environment: 'non-production',
|
|
79
|
+
* });
|
|
80
|
+
*
|
|
81
|
+
* const result = await client.sandbox.simulateDetect(
|
|
82
|
+
* '01HK8MAR2QEXAMPLE000000000',
|
|
83
|
+
* { seed: 'order-42' },
|
|
84
|
+
* );
|
|
85
|
+
* console.log(result.event_id, result.status);
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
simulateDetect(invoiceId: string, opts?: {
|
|
89
|
+
seed?: string;
|
|
90
|
+
}): Promise<SandboxSimulateResult>;
|
|
91
|
+
/**
|
|
92
|
+
* `POST /api/v1/sandbox/invoices/{invoiceId}/simulate-paid` — finalise
|
|
93
|
+
* a `detected` invoice into `paid` and emit `invoice.paid`.
|
|
94
|
+
*
|
|
95
|
+
* Throws `TxnodSandboxInvoiceTransitionInvalidError` if the invoice is not
|
|
96
|
+
* in `detected` status.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* import { TxnodClient } from '@txnod/sdk';
|
|
101
|
+
*
|
|
102
|
+
* const client = new TxnodClient({
|
|
103
|
+
* projectId: process.env.TXNOD_PROJECT_ID!,
|
|
104
|
+
* apiSecret: process.env.TXNOD_API_SECRET!,
|
|
105
|
+
* environment: 'non-production',
|
|
106
|
+
* });
|
|
107
|
+
*
|
|
108
|
+
* await client.sandbox.simulateDetect('01HK8MAR2QEXAMPLE000000000');
|
|
109
|
+
* const paid = await client.sandbox.simulatePaid(
|
|
110
|
+
* '01HK8MAR2QEXAMPLE000000000',
|
|
111
|
+
* );
|
|
112
|
+
* console.log(paid.status);
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
simulatePaid(invoiceId: string, opts?: {
|
|
116
|
+
seed?: string;
|
|
117
|
+
}): Promise<SandboxSimulateResult>;
|
|
118
|
+
/**
|
|
119
|
+
* `POST /api/v1/sandbox/invoices/{invoiceId}/simulate-overpaid` — finalise
|
|
120
|
+
* a `detected` invoice into `overpaid` with an overpayment (>amount_crypto)
|
|
121
|
+
* and emit `invoice.overpaid`. Provide either `multiplier` (× the configured
|
|
122
|
+
* amount) or `extraUnits` (added on top of the configured amount).
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```ts
|
|
126
|
+
* import { TxnodClient } from '@txnod/sdk';
|
|
127
|
+
*
|
|
128
|
+
* const client = new TxnodClient({
|
|
129
|
+
* projectId: process.env.TXNOD_PROJECT_ID!,
|
|
130
|
+
* apiSecret: process.env.TXNOD_API_SECRET!,
|
|
131
|
+
* environment: 'non-production',
|
|
132
|
+
* });
|
|
133
|
+
*
|
|
134
|
+
* await client.sandbox.simulateDetect('01HK8MAR2QEXAMPLE000000000');
|
|
135
|
+
* const r = await client.sandbox.simulateOverpaid(
|
|
136
|
+
* '01HK8MAR2QEXAMPLE000000000',
|
|
137
|
+
* { multiplier: 1.5 },
|
|
138
|
+
* );
|
|
139
|
+
* console.log(r.status);
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
simulateOverpaid(invoiceId: string, params: SimulateOverpaid): Promise<SandboxSimulateResult>;
|
|
143
|
+
/**
|
|
144
|
+
* `POST /api/v1/sandbox/invoices/{invoiceId}/simulate-partial` — emit
|
|
145
|
+
* `invoice.partial` with a sub-amount receipt; invoice stays open. Provide
|
|
146
|
+
* either `fraction` (0 < fraction < 1) or `amountUnits` (a positive integer
|
|
147
|
+
* less than amount_crypto).
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```ts
|
|
151
|
+
* import { TxnodClient } from '@txnod/sdk';
|
|
152
|
+
*
|
|
153
|
+
* const client = new TxnodClient({
|
|
154
|
+
* projectId: process.env.TXNOD_PROJECT_ID!,
|
|
155
|
+
* apiSecret: process.env.TXNOD_API_SECRET!,
|
|
156
|
+
* environment: 'non-production',
|
|
157
|
+
* });
|
|
158
|
+
*
|
|
159
|
+
* const r = await client.sandbox.simulatePartial(
|
|
160
|
+
* '01HK8MAR2QEXAMPLE000000000',
|
|
161
|
+
* { fraction: 0.5 },
|
|
162
|
+
* );
|
|
163
|
+
* console.log(r.status);
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
simulatePartial(invoiceId: string, params: SimulatePartial): Promise<SandboxSimulateResult>;
|
|
167
|
+
/**
|
|
168
|
+
* `POST /api/v1/sandbox/invoices/{invoiceId}/simulate-expire` — transition
|
|
169
|
+
* a non-paid invoice into `expired` and emit `invoice.expired`.
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```ts
|
|
173
|
+
* import { TxnodClient } from '@txnod/sdk';
|
|
174
|
+
*
|
|
175
|
+
* const client = new TxnodClient({
|
|
176
|
+
* projectId: process.env.TXNOD_PROJECT_ID!,
|
|
177
|
+
* apiSecret: process.env.TXNOD_API_SECRET!,
|
|
178
|
+
* environment: 'non-production',
|
|
179
|
+
* });
|
|
180
|
+
*
|
|
181
|
+
* const r = await client.sandbox.simulateExpire(
|
|
182
|
+
* '01HK8MAR2QEXAMPLE000000000',
|
|
183
|
+
* );
|
|
184
|
+
* console.log(r.status);
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
simulateExpire(invoiceId: string): Promise<SandboxSimulateResult>;
|
|
188
|
+
/**
|
|
189
|
+
* `POST /api/v1/sandbox/invoices/{invoiceId}/simulate-late-payment` —
|
|
190
|
+
* transition an `expired` invoice to `expired_paid_late` and emit
|
|
191
|
+
* `invoice.expired_paid_late`. Optional `amountUnits` overrides the
|
|
192
|
+
* payment size; default mirrors the invoice's configured amount.
|
|
193
|
+
*
|
|
194
|
+
* @example
|
|
195
|
+
* ```ts
|
|
196
|
+
* import { TxnodClient } from '@txnod/sdk';
|
|
197
|
+
*
|
|
198
|
+
* const client = new TxnodClient({
|
|
199
|
+
* projectId: process.env.TXNOD_PROJECT_ID!,
|
|
200
|
+
* apiSecret: process.env.TXNOD_API_SECRET!,
|
|
201
|
+
* environment: 'non-production',
|
|
202
|
+
* });
|
|
203
|
+
*
|
|
204
|
+
* await client.sandbox.simulateExpire('01HK8MAR2QEXAMPLE000000000');
|
|
205
|
+
* const r = await client.sandbox.simulateLatePayment(
|
|
206
|
+
* '01HK8MAR2QEXAMPLE000000000',
|
|
207
|
+
* );
|
|
208
|
+
* console.log(r.status);
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
simulateLatePayment(invoiceId: string, params?: SimulateLatePayment): Promise<SandboxSimulateResult>;
|
|
212
|
+
/**
|
|
213
|
+
* `POST /api/v1/sandbox/invoices/{invoiceId}/simulate-reorg` — flip a
|
|
214
|
+
* `paid`/`overpaid` invoice to `reverted` and emit `invoice.reverted`.
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ```ts
|
|
218
|
+
* import { TxnodClient } from '@txnod/sdk';
|
|
219
|
+
*
|
|
220
|
+
* const client = new TxnodClient({
|
|
221
|
+
* projectId: process.env.TXNOD_PROJECT_ID!,
|
|
222
|
+
* apiSecret: process.env.TXNOD_API_SECRET!,
|
|
223
|
+
* environment: 'non-production',
|
|
224
|
+
* });
|
|
225
|
+
*
|
|
226
|
+
* const r = await client.sandbox.simulateReorg(
|
|
227
|
+
* '01HK8MAR2QEXAMPLE000000000',
|
|
228
|
+
* );
|
|
229
|
+
* console.log(r.status);
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
simulateReorg(invoiceId: string): Promise<SandboxSimulateResult>;
|
|
233
|
+
/**
|
|
234
|
+
* `POST /api/v1/sandbox/invoices/{invoiceId}/simulate-reconfirm` — flip a
|
|
235
|
+
* `reverted` invoice back to `paid` and emit a re-confirmation
|
|
236
|
+
* `invoice.paid` (with a fresh `event_id` per spec).
|
|
237
|
+
*
|
|
238
|
+
* @example
|
|
239
|
+
* ```ts
|
|
240
|
+
* import { TxnodClient } from '@txnod/sdk';
|
|
241
|
+
*
|
|
242
|
+
* const client = new TxnodClient({
|
|
243
|
+
* projectId: process.env.TXNOD_PROJECT_ID!,
|
|
244
|
+
* apiSecret: process.env.TXNOD_API_SECRET!,
|
|
245
|
+
* environment: 'non-production',
|
|
246
|
+
* });
|
|
247
|
+
*
|
|
248
|
+
* const r = await client.sandbox.simulateReconfirm(
|
|
249
|
+
* '01HK8MAR2QEXAMPLE000000000',
|
|
250
|
+
* );
|
|
251
|
+
* console.log(r.status);
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
simulateReconfirm(invoiceId: string): Promise<SandboxSimulateResult>;
|
|
255
|
+
/**
|
|
256
|
+
* `POST /api/v1/sandbox/invoices/{invoiceId}/simulate-duplicate-delivery` —
|
|
257
|
+
* re-emit the most recent webhook event for the invoice with the same
|
|
258
|
+
* `event_id`, exercising the integrator's idempotency layer.
|
|
259
|
+
*
|
|
260
|
+
* @example
|
|
261
|
+
* ```ts
|
|
262
|
+
* import { TxnodClient } from '@txnod/sdk';
|
|
263
|
+
*
|
|
264
|
+
* const client = new TxnodClient({
|
|
265
|
+
* projectId: process.env.TXNOD_PROJECT_ID!,
|
|
266
|
+
* apiSecret: process.env.TXNOD_API_SECRET!,
|
|
267
|
+
* environment: 'non-production',
|
|
268
|
+
* });
|
|
269
|
+
*
|
|
270
|
+
* const r = await client.sandbox.simulateDuplicateDelivery(
|
|
271
|
+
* '01HK8MAR2QEXAMPLE000000000',
|
|
272
|
+
* );
|
|
273
|
+
* console.log(r.status);
|
|
274
|
+
* ```
|
|
275
|
+
*/
|
|
276
|
+
simulateDuplicateDelivery(invoiceId: string): Promise<SandboxSimulateResult>;
|
|
277
|
+
/**
|
|
278
|
+
* `POST /api/v1/sandbox/invoices/{invoiceId}/simulate-event` — emit any
|
|
279
|
+
* webhook event with caller-controlled fields. Use for negative testing
|
|
280
|
+
* (unexpected `event_type` for the current invoice status, custom
|
|
281
|
+
* `confirmations`, custom `block_height`, custom chain-specific payload).
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* ```ts
|
|
285
|
+
* import { TxnodClient } from '@txnod/sdk';
|
|
286
|
+
*
|
|
287
|
+
* const client = new TxnodClient({
|
|
288
|
+
* projectId: process.env.TXNOD_PROJECT_ID!,
|
|
289
|
+
* apiSecret: process.env.TXNOD_API_SECRET!,
|
|
290
|
+
* environment: 'non-production',
|
|
291
|
+
* });
|
|
292
|
+
*
|
|
293
|
+
* const r = await client.sandbox.simulateEvent(
|
|
294
|
+
* '01HK8MAR2QEXAMPLE000000000',
|
|
295
|
+
* {
|
|
296
|
+
* eventType: 'invoice.partial',
|
|
297
|
+
* amountUnits: '1000',
|
|
298
|
+
* confirmations: 1,
|
|
299
|
+
* blockHeight: 100,
|
|
300
|
+
* expectedCurrentStatus: 'detected',
|
|
301
|
+
* },
|
|
302
|
+
* );
|
|
303
|
+
* console.log(r.status);
|
|
304
|
+
* ```
|
|
305
|
+
*/
|
|
306
|
+
simulateEvent(invoiceId: string, eventInput: SimulateEvent): Promise<SandboxSimulateResult>;
|
|
307
|
+
/**
|
|
308
|
+
* `POST /api/v1/sandbox/{projectId}/clock/advance` — bump the
|
|
309
|
+
* `confirmations` counter on every `detected` invoice for the given chain
|
|
310
|
+
* and finalise any whose `confirmations >= confirmation_threshold`. Throws
|
|
311
|
+
* `TxnodSandboxRateLimitExceededError` (10/min/project per spec §6.1).
|
|
312
|
+
*
|
|
313
|
+
* @example
|
|
314
|
+
* ```ts
|
|
315
|
+
* import { TxnodClient } from '@txnod/sdk';
|
|
316
|
+
*
|
|
317
|
+
* const client = new TxnodClient({
|
|
318
|
+
* projectId: process.env.TXNOD_PROJECT_ID!,
|
|
319
|
+
* apiSecret: process.env.TXNOD_API_SECRET!,
|
|
320
|
+
* environment: 'non-production',
|
|
321
|
+
* });
|
|
322
|
+
*
|
|
323
|
+
* const r = await client.sandbox.clockAdvance(
|
|
324
|
+
* '01HK8MAR2QEXAMPLEPROJECT000',
|
|
325
|
+
* { chain: 'btc', blocks: 6 },
|
|
326
|
+
* );
|
|
327
|
+
* console.log('finalized', r.advanced, 'remaining', r.remaining);
|
|
328
|
+
* ```
|
|
329
|
+
*/
|
|
330
|
+
clockAdvance(projectId: string, params: ClockAdvance): Promise<SandboxClockAdvanceResult>;
|
|
331
|
+
/**
|
|
332
|
+
* `POST /api/v1/sandbox/{projectId}/reset` — soft-purge the data tail of
|
|
333
|
+
* a sandbox project (invoices, transactions, outbox events, address pool)
|
|
334
|
+
* while preserving the project shell + xpubs + bindings + sandbox PAT +
|
|
335
|
+
* api_keys. Throws `TxnodSandboxResetFailedError` on internal failure.
|
|
336
|
+
*
|
|
337
|
+
* @example
|
|
338
|
+
* ```ts
|
|
339
|
+
* import { TxnodClient } from '@txnod/sdk';
|
|
340
|
+
*
|
|
341
|
+
* const client = new TxnodClient({
|
|
342
|
+
* projectId: process.env.TXNOD_PROJECT_ID!,
|
|
343
|
+
* apiSecret: process.env.TXNOD_API_SECRET!,
|
|
344
|
+
* environment: 'non-production',
|
|
345
|
+
* });
|
|
346
|
+
*
|
|
347
|
+
* await client.sandbox.reset('01HK8MAR2QEXAMPLEPROJECT000');
|
|
348
|
+
* console.log('sandbox project reset');
|
|
349
|
+
* ```
|
|
350
|
+
*/
|
|
351
|
+
reset(projectId: string): Promise<SandboxLifecycleResult>;
|
|
352
|
+
/**
|
|
353
|
+
* `DELETE /api/v1/sandbox/{projectId}` — full-delete the sandbox project
|
|
354
|
+
* (per F-20: dashboard owns the create flow, SDK + MCP own destructive
|
|
355
|
+
* lifecycle). Throws `TxnodSandboxDeleteFailedError` on internal failure.
|
|
356
|
+
*
|
|
357
|
+
* @example
|
|
358
|
+
* ```ts
|
|
359
|
+
* import { TxnodClient } from '@txnod/sdk';
|
|
360
|
+
*
|
|
361
|
+
* const client = new TxnodClient({
|
|
362
|
+
* projectId: process.env.TXNOD_PROJECT_ID!,
|
|
363
|
+
* apiSecret: process.env.TXNOD_API_SECRET!,
|
|
364
|
+
* environment: 'non-production',
|
|
365
|
+
* });
|
|
366
|
+
*
|
|
367
|
+
* await client.sandbox.destroy('01HK8MAR2QEXAMPLEPROJECT000');
|
|
368
|
+
* console.log('sandbox project deleted');
|
|
369
|
+
* ```
|
|
370
|
+
*/
|
|
371
|
+
destroy(projectId: string): Promise<SandboxLifecycleResult>;
|
|
372
|
+
/**
|
|
373
|
+
* `GET /api/v1/sandbox/{projectId}/wallets` — list the per-chain xpubs +
|
|
374
|
+
* derivation paths the sandbox project routes against. Useful for
|
|
375
|
+
* integrators wiring the sandbox into a derivation-aware test harness.
|
|
376
|
+
*
|
|
377
|
+
* @example
|
|
378
|
+
* ```ts
|
|
379
|
+
* import { TxnodClient } from '@txnod/sdk';
|
|
380
|
+
*
|
|
381
|
+
* const client = new TxnodClient({
|
|
382
|
+
* projectId: process.env.TXNOD_PROJECT_ID!,
|
|
383
|
+
* apiSecret: process.env.TXNOD_API_SECRET!,
|
|
384
|
+
* environment: 'non-production',
|
|
385
|
+
* });
|
|
386
|
+
*
|
|
387
|
+
* const wallets = await client.sandbox.listWallets(
|
|
388
|
+
* '01HK8MAR2QEXAMPLEPROJECT000',
|
|
389
|
+
* );
|
|
390
|
+
* for (const w of wallets.items) console.log(w.chain, w.derivation_path);
|
|
391
|
+
* ```
|
|
392
|
+
*/
|
|
393
|
+
listWallets(projectId: string): Promise<WalletsListResponse>;
|
|
394
|
+
}
|
|
395
|
+
export {};
|
|
396
|
+
//# sourceMappingURL=client-sandbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-sandbox.d.ts","sourceRoot":"","sources":["../src/client-sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACpB,MAAM,eAAe,CAAC;AAEvB;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,2CAA2C;AAC3C,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,iDAAiD;AACjD,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC;CAC7B;AAED,UAAU,SAAS;IACjB,CAAC,CAAC,EAAE,KAAK,EAAE;QACT,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC;QAClC,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;Q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