@txnod/sdk 1.0.1 → 1.1.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.
Files changed (74) hide show
  1. package/AGENTS.md +1 -1
  2. package/CHANGELOG.md +33 -0
  3. package/dist/_shared/index.d.ts +26 -16
  4. package/dist/client-sandbox.d.ts +181 -6
  5. package/dist/client-sandbox.d.ts.map +1 -1
  6. package/dist/client-sandbox.js +216 -5
  7. package/dist/client-sandbox.js.map +1 -1
  8. package/dist/client.d.ts +59 -9
  9. package/dist/client.d.ts.map +1 -1
  10. package/dist/client.js +58 -6
  11. package/dist/client.js.map +1 -1
  12. package/dist/errors.d.ts +187 -4
  13. package/dist/errors.d.ts.map +1 -1
  14. package/dist/errors.js +208 -4
  15. package/dist/errors.js.map +1 -1
  16. package/dist/index.d.ts +4 -4
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +3 -3
  19. package/dist/index.js.map +1 -1
  20. package/dist/internals/error-ctor-map.d.ts +4 -3
  21. package/dist/internals/error-ctor-map.d.ts.map +1 -1
  22. package/dist/internals/error-ctor-map.js +5 -1
  23. package/dist/internals/error-ctor-map.js.map +1 -1
  24. package/dist/verify/chains/bsc.d.ts +1 -7
  25. package/dist/verify/chains/bsc.d.ts.map +1 -1
  26. package/dist/verify/chains/bsc.js +1 -7
  27. package/dist/verify/chains/bsc.js.map +1 -1
  28. package/dist/verify/chains/btc.d.ts +1 -8
  29. package/dist/verify/chains/btc.d.ts.map +1 -1
  30. package/dist/verify/chains/btc.js +1 -8
  31. package/dist/verify/chains/btc.js.map +1 -1
  32. package/dist/verify/chains/cardano.d.ts +6 -13
  33. package/dist/verify/chains/cardano.d.ts.map +1 -1
  34. package/dist/verify/chains/cardano.js +6 -13
  35. package/dist/verify/chains/cardano.js.map +1 -1
  36. package/dist/verify/chains/evm.d.ts +1 -6
  37. package/dist/verify/chains/evm.d.ts.map +1 -1
  38. package/dist/verify/chains/evm.js +8 -7
  39. package/dist/verify/chains/evm.js.map +1 -1
  40. package/dist/verify/chains/polygon.d.ts +1 -7
  41. package/dist/verify/chains/polygon.d.ts.map +1 -1
  42. package/dist/verify/chains/polygon.js +1 -7
  43. package/dist/verify/chains/polygon.js.map +1 -1
  44. package/dist/verify/chains/secp256k1-bip32.d.ts +2 -8
  45. package/dist/verify/chains/secp256k1-bip32.d.ts.map +1 -1
  46. package/dist/verify/chains/secp256k1-bip32.js +5 -13
  47. package/dist/verify/chains/secp256k1-bip32.js.map +1 -1
  48. package/dist/verify/chains/ton-cell.d.ts.map +1 -1
  49. package/dist/verify/chains/ton-cell.js +4 -7
  50. package/dist/verify/chains/ton-cell.js.map +1 -1
  51. package/dist/verify/chains/ton.d.ts +3 -7
  52. package/dist/verify/chains/ton.d.ts.map +1 -1
  53. package/dist/verify/chains/ton.js +1 -3
  54. package/dist/verify/chains/ton.js.map +1 -1
  55. package/dist/verify/chains/tron.d.ts +1 -7
  56. package/dist/verify/chains/tron.d.ts.map +1 -1
  57. package/dist/verify/chains/tron.js +1 -7
  58. package/dist/verify/chains/tron.js.map +1 -1
  59. package/dist/verify/errors.d.ts +6 -8
  60. package/dist/verify/errors.d.ts.map +1 -1
  61. package/dist/verify/errors.js +6 -8
  62. package/dist/verify/errors.js.map +1 -1
  63. package/dist/verify/index.d.ts +1 -1
  64. package/dist/verify/index.js +2 -2
  65. package/dist/verify/index.js.map +1 -1
  66. package/docs/02-invoices.md +46 -2
  67. package/docs/04-webhooks.md +4 -1
  68. package/docs/05-errors.md +24 -4
  69. package/docs/05-sandbox.md +13 -5
  70. package/docs/examples/sandbox-vitest-suite.md +2 -2
  71. package/docs/reference/client.md +39 -2
  72. package/docs/reference/errors.md +13 -2
  73. package/docs/reference/types.md +5 -4
  74. package/package.json +13 -13
package/AGENTS.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: "@txnod/sdk — agent entry point"
3
3
  description: "How AI coding agents should consume @txnod/sdk documentation shipped inside the npm tarball."
4
- sdk_version: 1.0.0
4
+ sdk_version: 1.1.0
5
5
  ---
6
6
 
7
7
  # @txnod/sdk — agent entry point
package/CHANGELOG.md CHANGED
@@ -4,6 +4,39 @@ All notable changes to `@txnod/sdk` are documented here. Format: [Keep a Changel
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [1.1.0] - 2026-06-11
8
+
9
+ ### Added
10
+
11
+ - New sandbox invoice CRUD methods on `client.sandbox.*` — `createInvoice(body)`, `getInvoice(invoiceId)`, `listInvoices(query?)`, `cancelInvoice(invoiceId)` — mirroring the kind-locked production invoice surface against `/api/v1/sandbox/invoices`. The production `/api/v1/invoices` endpoints are production-kind-only and reject sandbox projects with `production_project_required`; sandbox projects must use these mirrors. Same request/response schemas and `(project_id, external_id)` idempotency contract; subject to the sandbox 10k active-invoice cap (`TxnodSandboxActiveInvoiceCapReachedError`).
12
+ - New sandbox webhook delivery-log methods on `client.sandbox.*` — `listWebhookEvents(query?)` and `resendWebhookEvent(eventId)` — mirroring the kind-locked production `/api/v1/webhooks/events` surface against `/api/v1/sandbox/webhooks/events`. Same snake_case filters and response envelopes (`WebhookEventListResponse`, `WebhookEventResendResponse`); every listed row corresponds to an envelope delivered with `mode: 'sandbox'`.
13
+ - New re-exported types from `@txnod/shared`: `ClockAdvance`, `CursorPaginatedInvoiceResponse`, `CursorPaginatedOrphanPaymentResponse`, `InvoiceCreateRequest`, `InvoiceResponse`, `InvoiceSearchQuery`, `OrphanAttributeRequest`, `OrphanPaymentListQuery`, `QuoteQuery`, `QuoteResponse`, `RatesQuery`, `RatesResponse`, `SimulateEvent`, `SimulateLatePayment`, `SimulateOverpaid`, `SimulatePartial`, `WalletsListResponse`, `WebhookEventListApiQuery`, `WebhookEventListResponse`, `WebhookEventResendResponse`.
14
+
15
+ ### Changed
16
+
17
+ - `amount_usd` on invoice creation now enforces server-side bounds: minimum `0.01`, maximum `1_000_000_000`. Sub-cent values previously scaled to 0 base units and surfaced as an opaque HTTP 500; out-of-bounds values now reject at the validation edge with a typed message. (Pre-launch stance: shipped as a minor with no compatibility shim.)
18
+
19
+ ### Fixed
20
+
21
+ - `verifyAddress` no longer throws `AddressVerificationError` for every EVM invoice (ETH / Polygon / BSC). The gateway serves canonical-lowercase EVM addresses while the verifier derives the EIP-55 checksummed form; the comparison was strict-equality and failed on casing alone. EVM hex addresses are case-insensitive by definition (EIP-55 is a display-layer checksum), so the comparison now lowercases both sides. TRON (base58check), TON (base64url), and bech32-chain comparisons remain exact.
22
+
23
+ ## [1.0.2] - 2026-05-11
24
+
25
+ ### Added
26
+
27
+ - New method `client.claimInvoiceByTx({ invoiceId, txHash, chain })` — partner-facing manual tx-hash claim flow for the "I paid but it's not showing up" recovery path. The merchant's backend forwards an end-customer-submitted tx hash; txnod resolves the tx via the chain provider, verifies sender / recipient / amount / timestamp, and either auto-attributes the tx (response `status: 'auto_attributed'`) or queues the claim for operator review (`pending_review`) — or, when the tx is not yet finalised against the per-chain finality threshold, returns `pending_finality` and re-checks asynchronously.
28
+ - New sandbox-parity method `client.sandbox.simulateClaimByTx(invoiceId, { txHash, chain })` — drives the same manual tx-hash claim lifecycle without on-chain spend by synthesising resolved facts from the sandbox invoice. Response shape matches the production method.
29
+ - New error classes `TxnodTxNotFoundError` and `TxnodTxAlreadyAttributedError` for the two non-auto-attributed rejection paths of `claimInvoiceByTx`. **Note:** the endpoint returns these as `{ status: 'rejected', rejection_reason }` in the response body (HTTP 200) rather than throwing — partners pattern-match on `response.rejection_reason`. The error classes are provided for consumers who prefer error-handling-style code.
30
+ - New error class `TxnodOverlayMatchingModeError` (`error_code: 'overlay_matching_mode_required_exact'`, HTTP 422). Surfaced when the overlay allocator's saturation-fallback kicks in and the project's matching mode is `at_least` or `any` — those modes require a unique address per invoice, which the saturation path cannot guarantee. Switch the project to `required_exact` or wait for the pool to drain.
31
+ - New error code `manual_claim_rate_limit_exceeded` (HTTP 429 with `Retry-After`) for the per-user hourly throttle on `claimInvoiceByTx` (10 claims / hour / user).
32
+ - New webhook event type `invoice.ambiguous` and new invoice status `ambiguous`. Emitted when a deposit could not be attributed to a single open invoice (multiple candidates matched). SDK consumers branching on `WebhookEvent.event_type` should add a case for `'invoice.ambiguous'`.
33
+ - New re-exported types `ClaimByTxRequest`, `ClaimByTxResponse`, `ResolvedFacts`, `ManualClaimFinalityThreshold` from `@txnod/shared`.
34
+
35
+ ### Changed
36
+
37
+ - TON `payment_token` entropy widened from 8 hex chars to 8 or 16 hex chars. The change is **additive** at every layer: the generator now emits 16-hex tokens going forward, the parser regex accepts both 8-hex (legacy) and 16-hex (post-bump) tokens (`^[0-9a-f]{8}([0-9a-f]{8})?$`), and the Zod schemas backing every SDK consumer type (`InvoiceResponse.payment_token`, `WebhookEventData.payment_token`, `WebhookEventData.matched_payment_token`) are widened to the same shape. Existing 8-hex tokens already in flight continue to attribute correctly. SDK consumers that hard-coded a `^[0-9a-f]{8}$` regex on these fields locally must widen to the new shape; the SDK's own type signatures (`string | null`) are unchanged.
38
+ - Per-chain pool cooldowns. `TxnodPoolExhaustedError.retry_after_seconds` is now derived from `cooldownSecondsPerChain[chain]` instead of a single project-wide scalar. JSDoc updated accordingly; no wire-protocol change on the error envelope.
39
+
7
40
  ## [1.0.1] - 2026-05-05
8
41
 
9
42
  Initial public release of `@txnod/sdk` — the official TypeScript client for the txnod non-custodial crypto payment gateway.
@@ -3,15 +3,25 @@
3
3
  // No zod / drizzle / @txnod/* references — safe for ANY consumer
4
4
  // regardless of what zod (or other internal deps) they already have.
5
5
 
6
- export type InvoiceStatus = "pending" | "detected" | "paid" | "overpaid" | "partial" | "expired" | "expired_paid_late" | "reverted" | "cancelled";
6
+ export type InvoiceStatus = "pending" | "detected" | "paid" | "overpaid" | "partial" | "expired" | "expired_paid_late" | "reverted" | "cancelled" | "ambiguous";
7
7
 
8
8
  export type InvoiceCreateRequest = { external_id: string; coin: "btc" | "eth" | "usdt_erc20" | "usdc_erc20" | "trx" | "usdt_trc20" | "ada" | "pol" | "usdt_polygon" | "usdc_polygon" | "bnb" | "usdt_bep20" | "usdc_bep20" | "ton" | "usdt_ton"; amount_usd?: number | undefined; amount_crypto?: string | undefined; callback_url?: string | undefined; metadata?: Record<string, unknown> | undefined; };
9
9
 
10
- export type InvoiceResponse = { id: string; project_id: string; external_id: string; coin: "btc" | "eth" | "usdt_erc20" | "usdc_erc20" | "trx" | "usdt_trc20" | "ada" | "pol" | "usdt_polygon" | "usdc_polygon" | "bnb" | "usdt_bep20" | "usdc_bep20" | "ton" | "usdt_ton"; address: string; amount_crypto: string; amount_crypto_units: string; amount_usd: number | null; rate_snapshot: { rate: string; source: "coingecko"; quoted_at: string; rate_is_stale: boolean; rate_age_seconds: number; } | null; payment_token: string | null; payment_uri: string; callback_url: string | null; metadata: Record<string, unknown> | null; matching_mode: "any" | "exact" | "at_least"; confirmation_threshold: number; status: "pending" | "detected" | "paid" | "overpaid" | "partial" | "expired" | "expired_paid_late" | "reverted" | "cancelled"; expires_at: number; expires_at_iso: string; created_at: number; created_at_iso: string; derivation_path?: string | undefined; verification_standard?: "bip84" | "bip44" | "cip1852" | "bip44_ed25519" | undefined; transactions?: { id: string; chain: "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc"; tx_hash: string; to_address: string | null; tx_output_index: number | null; amount_units: string; block_height: number | null; confirmations: number; received_at: number; received_at_iso: string; orphaned_at: number | null; orphaned_at_iso: string | null; }[] | undefined; confirmations?: number | undefined; };
10
+ export type InvoiceResponse = { id: string; project_id: string; external_id: string; coin: "btc" | "eth" | "usdt_erc20" | "usdc_erc20" | "trx" | "usdt_trc20" | "ada" | "pol" | "usdt_polygon" | "usdc_polygon" | "bnb" | "usdt_bep20" | "usdc_bep20" | "ton" | "usdt_ton"; address: string; amount_crypto: string; amount_crypto_units: string; amount_usd: number | null; rate_snapshot: { rate: string; source: "coinpaprika" | "coingecko"; quoted_at: string; rate_is_stale: boolean; rate_age_seconds: number; } | null; payment_token: string | null; payment_uri: string; callback_url: string | null; metadata: Record<string, unknown> | null; matching_mode: "any" | "exact" | "at_least"; confirmation_threshold: number; status: "pending" | "detected" | "paid" | "overpaid" | "partial" | "expired" | "expired_paid_late" | "reverted" | "cancelled" | "ambiguous"; expires_at: number; expires_at_iso: string; created_at: number; created_at_iso: string; derivation_path?: string | undefined; verification_standard?: "bip84" | "bip44" | "cip1852" | "bip44_ed25519" | undefined; transactions?: { id: string; chain: "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc"; tx_hash: string; to_address: string | null; tx_output_index: number | null; amount_units: string; block_height: number | null; confirmations: number; received_at: number; received_at_iso: string; orphaned_at: number | null; orphaned_at_iso: string | null; }[] | undefined; confirmations?: number | undefined; };
11
11
 
12
- export type InvoiceSearchQuery = { external_id?: string | undefined; address?: string | undefined; tx_hash?: string | undefined; amount?: string | undefined; status?: "pending" | "detected" | "paid" | "overpaid" | "partial" | "expired" | "expired_paid_late" | "reverted" | "cancelled" | undefined; date_from?: string | undefined; date_to?: string | undefined; cursor?: string | undefined; limit?: number | undefined; };
12
+ export type InvoiceDetailResponse = { id: string; project_id: string; external_id: string; coin: "btc" | "eth" | "usdt_erc20" | "usdc_erc20" | "trx" | "usdt_trc20" | "ada" | "pol" | "usdt_polygon" | "usdc_polygon" | "bnb" | "usdt_bep20" | "usdc_bep20" | "ton" | "usdt_ton"; address: string; amount_crypto: string; amount_crypto_units: string; amount_usd: number | null; rate_snapshot: { rate: string; source: "coinpaprika" | "coingecko"; quoted_at: string; rate_is_stale: boolean; rate_age_seconds: number; } | null; payment_token: string | null; payment_uri: string; callback_url: string | null; metadata: Record<string, unknown> | null; matching_mode: "any" | "exact" | "at_least"; confirmation_threshold: number; status: "pending" | "detected" | "paid" | "overpaid" | "partial" | "expired" | "expired_paid_late" | "reverted" | "cancelled" | "ambiguous"; expires_at: number; expires_at_iso: string; created_at: number; created_at_iso: string; transactions: { id: string; chain: "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc"; tx_hash: string; to_address: string | null; tx_output_index: number | null; amount_units: string; block_height: number | null; confirmations: number; received_at: number; received_at_iso: string; orphaned_at: number | null; orphaned_at_iso: string | null; }[]; confirmations: number; derivation_path?: string | undefined; verification_standard?: "bip84" | "bip44" | "cip1852" | "bip44_ed25519" | undefined; };
13
13
 
14
- export type CursorPaginatedInvoiceResponse = { items: { id: string; project_id: string; external_id: string; coin: "btc" | "eth" | "usdt_erc20" | "usdc_erc20" | "trx" | "usdt_trc20" | "ada" | "pol" | "usdt_polygon" | "usdc_polygon" | "bnb" | "usdt_bep20" | "usdc_bep20" | "ton" | "usdt_ton"; address: string; amount_crypto: string; amount_crypto_units: string; amount_usd: number | null; rate_snapshot: { rate: string; source: "coingecko"; quoted_at: string; rate_is_stale: boolean; rate_age_seconds: number; } | null; payment_token: string | null; payment_uri: string; callback_url: string | null; metadata: Record<string, unknown> | null; matching_mode: "any" | "exact" | "at_least"; confirmation_threshold: number; status: "pending" | "detected" | "paid" | "overpaid" | "partial" | "expired" | "expired_paid_late" | "reverted" | "cancelled"; expires_at: number; expires_at_iso: string; created_at: number; created_at_iso: string; derivation_path?: string | undefined; verification_standard?: "bip84" | "bip44" | "cip1852" | "bip44_ed25519" | undefined; transactions?: { id: string; chain: "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc"; tx_hash: string; to_address: string | null; tx_output_index: number | null; amount_units: string; block_height: number | null; confirmations: number; received_at: number; received_at_iso: string; orphaned_at: number | null; orphaned_at_iso: string | null; }[] | undefined; confirmations?: number | undefined; }[]; next_cursor?: string | undefined; };
14
+ export type InvoiceSearchQuery = { external_id?: string | undefined; address?: string | undefined; tx_hash?: string | undefined; amount?: string | undefined; status?: "pending" | "detected" | "paid" | "overpaid" | "partial" | "expired" | "expired_paid_late" | "reverted" | "cancelled" | "ambiguous" | undefined; date_from?: string | undefined; date_to?: string | undefined; cursor?: string | undefined; limit?: number | undefined; };
15
+
16
+ export type CursorPaginatedInvoiceResponse = { items: { id: string; project_id: string; external_id: string; coin: "btc" | "eth" | "usdt_erc20" | "usdc_erc20" | "trx" | "usdt_trc20" | "ada" | "pol" | "usdt_polygon" | "usdc_polygon" | "bnb" | "usdt_bep20" | "usdc_bep20" | "ton" | "usdt_ton"; address: string; amount_crypto: string; amount_crypto_units: string; amount_usd: number | null; rate_snapshot: { rate: string; source: "coinpaprika" | "coingecko"; quoted_at: string; rate_is_stale: boolean; rate_age_seconds: number; } | null; payment_token: string | null; payment_uri: string; callback_url: string | null; metadata: Record<string, unknown> | null; matching_mode: "any" | "exact" | "at_least"; confirmation_threshold: number; status: "pending" | "detected" | "paid" | "overpaid" | "partial" | "expired" | "expired_paid_late" | "reverted" | "cancelled" | "ambiguous"; expires_at: number; expires_at_iso: string; created_at: number; created_at_iso: string; derivation_path?: string | undefined; verification_standard?: "bip84" | "bip44" | "cip1852" | "bip44_ed25519" | undefined; transactions?: { id: string; chain: "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc"; tx_hash: string; to_address: string | null; tx_output_index: number | null; amount_units: string; block_height: number | null; confirmations: number; received_at: number; received_at_iso: string; orphaned_at: number | null; orphaned_at_iso: string | null; }[] | undefined; confirmations?: number | undefined; }[]; next_cursor?: string | undefined; };
17
+
18
+ export type ClaimByTxRequest = { tx_hash: string; chain: "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc"; };
19
+
20
+ export type ClaimByTxResponse = { request_id: string; status: "auto_attributed" | "pending_finality" | "pending_review" | "rejected"; resolved_facts: { sender_address?: string | undefined; recipient_address?: string | undefined; amount_units?: string | undefined; tx_timestamp_ms?: number | undefined; confirmations?: number | undefined; tx_output_index?: number | null | undefined; tx_lt?: string | null | undefined; ton_mc_block_depth?: number | null | undefined; token_contract?: string | undefined; }; terminal_status?: "paid" | "overpaid" | "partial" | undefined; rejection_reason?: "tx_not_found_or_incomplete" | "tx_already_attributed" | undefined; };
21
+
22
+ export type ManualClaimFinalityThreshold = ManualClaimFinalityThreshold;
23
+
24
+ export type ResolvedFacts = { sender_address: string; recipient_address: string; amount_units: string; tx_timestamp_ms: number; confirmations: number; tx_output_index: number | null; tx_lt: string | null; ton_mc_block_depth: number | null; token_contract?: string | undefined; };
15
25
 
16
26
  export type OrphanPaymentListQuery = { attributed?: boolean | undefined; chain?: "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc" | undefined; tx_hash?: string | undefined; date_from?: string | undefined; date_to?: string | undefined; amount_units_gte?: string | undefined; amount_units_lte?: string | undefined; cursor?: string | undefined; limit?: number | undefined; };
17
27
 
@@ -19,31 +29,31 @@ export type CursorPaginatedOrphanPaymentResponse = { items: { id: string; chain:
19
29
 
20
30
  export type OrphanAttributeRequest = { external_id: string; user_id?: string | undefined; metadata?: Record<string, unknown> | undefined; to_address?: string | undefined; tx_output_index?: number | undefined; };
21
31
 
22
- export type WebhookEventListApiQuery = { status?: "delivered" | "retrying" | "dlq" | "skipped" | undefined; event_type?: "invoice.detected" | "invoice.paid" | "invoice.overpaid" | "invoice.partial" | "invoice.expired" | "invoice.expired_paid_late" | "invoice.reverted" | undefined; since?: string | undefined; invoice_id?: string | undefined; cursor?: string | undefined; limit?: number | undefined; };
32
+ export type WebhookEventListApiQuery = { status?: "delivered" | "retrying" | "dlq" | "skipped" | undefined; event_type?: "invoice.detected" | "invoice.paid" | "invoice.overpaid" | "invoice.partial" | "invoice.expired" | "invoice.expired_paid_late" | "invoice.reverted" | "invoice.ambiguous" | undefined; since?: string | undefined; invoice_id?: string | undefined; cursor?: string | undefined; limit?: number | undefined; };
23
33
 
24
- export type WebhookEventListResponse = { items: { id: string; event_type: "invoice.detected" | "invoice.paid" | "invoice.overpaid" | "invoice.partial" | "invoice.expired" | "invoice.expired_paid_late" | "invoice.reverted"; status: "delivered" | "retrying" | "dlq" | "skipped"; created_at: string; target_url: string | null; attempt_count: number; last_response_status: number | null; invoice_id: string | null; dlq_at: string | null; delivered_at: string | null; skip_reason: "not_subscribed" | "no_target_url" | null; }[]; next_cursor?: string | undefined; };
34
+ export type WebhookEventListResponse = { items: { id: string; event_type: "invoice.detected" | "invoice.paid" | "invoice.overpaid" | "invoice.partial" | "invoice.expired" | "invoice.expired_paid_late" | "invoice.reverted" | "invoice.ambiguous"; status: "delivered" | "retrying" | "dlq" | "skipped"; created_at: string; target_url: string | null; attempt_count: number; last_response_status: number | null; invoice_id: string | null; dlq_at: string | null; delivered_at: string | null; skip_reason: "not_subscribed" | "no_target_url" | null; }[]; next_cursor?: string | undefined; };
25
35
 
26
- export type WebhookEventResendResponse = { event_id: string; original_event_id: string; event_type: "invoice.detected" | "invoice.paid" | "invoice.overpaid" | "invoice.partial" | "invoice.expired" | "invoice.expired_paid_late" | "invoice.reverted"; project_id: string; invoice_id: string | null; target_url: string | null; created_at: number; created_at_iso: string; };
36
+ export type WebhookEventResendResponse = { event_id: string; original_event_id: string; event_type: "invoice.detected" | "invoice.paid" | "invoice.overpaid" | "invoice.partial" | "invoice.expired" | "invoice.expired_paid_late" | "invoice.reverted" | "invoice.ambiguous"; project_id: string; invoice_id: string | null; target_url: string | null; created_at: number; created_at_iso: string; };
27
37
 
28
- export type WebhookEvent = { event_id: string; event_type: "invoice.detected"; created_at: number; created_at_iso: string; project_id: string; data: { invoice_id: string; project_id: string; chain: "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc"; coin: "btc" | "eth" | "usdt_erc20" | "usdc_erc20" | "trx" | "usdt_trc20" | "ada" | "pol" | "usdt_polygon" | "usdc_polygon" | "bnb" | "usdt_bep20" | "usdc_bep20" | "ton" | "usdt_ton"; tx_hash: string; to_address: string | null; amount_units: string; confirmations: number; block_height: number | null; payment_token: string | null; matched_payment_token: string | null; chain_specific: { ton?: { tx_lt: string; mc_block_seqno: number; block_ref: { workchain: number; shard: string; seqno: number; }; jetton_master?: string | undefined; } | undefined; } | null; reason?: "reorg" | "late_arrival" | undefined; }; attempt: number; mode: "production" | "testnet" | "sandbox"; } | { event_id: string; event_type: "invoice.paid"; created_at: number; created_at_iso: string; project_id: string; data: { invoice_id: string; project_id: string; chain: "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc"; coin: "btc" | "eth" | "usdt_erc20" | "usdc_erc20" | "trx" | "usdt_trc20" | "ada" | "pol" | "usdt_polygon" | "usdc_polygon" | "bnb" | "usdt_bep20" | "usdc_bep20" | "ton" | "usdt_ton"; tx_hash: string; to_address: string | null; amount_units: string; confirmations: number; block_height: number | null; payment_token: string | null; matched_payment_token: string | null; chain_specific: { ton?: { tx_lt: string; mc_block_seqno: number; block_ref: { workchain: number; shard: string; seqno: number; }; jetton_master?: string | undefined; } | undefined; } | null; reason?: "reorg" | "late_arrival" | undefined; }; attempt: number; mode: "production" | "testnet" | "sandbox"; } | { event_id: string; event_type: "invoice.overpaid"; created_at: number; created_at_iso: string; project_id: string; data: { invoice_id: string; project_id: string; chain: "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc"; coin: "btc" | "eth" | "usdt_erc20" | "usdc_erc20" | "trx" | "usdt_trc20" | "ada" | "pol" | "usdt_polygon" | "usdc_polygon" | "bnb" | "usdt_bep20" | "usdc_bep20" | "ton" | "usdt_ton"; tx_hash: string; to_address: string | null; amount_units: string; confirmations: number; block_height: number | null; payment_token: string | null; matched_payment_token: string | null; chain_specific: { ton?: { tx_lt: string; mc_block_seqno: number; block_ref: { workchain: number; shard: string; seqno: number; }; jetton_master?: string | undefined; } | undefined; } | null; reason?: "reorg" | "late_arrival" | undefined; }; attempt: number; mode: "production" | "testnet" | "sandbox"; } | { event_id: string; event_type: "invoice.partial"; created_at: number; created_at_iso: string; project_id: string; data: { invoice_id: string; project_id: string; chain: "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc"; coin: "btc" | "eth" | "usdt_erc20" | "usdc_erc20" | "trx" | "usdt_trc20" | "ada" | "pol" | "usdt_polygon" | "usdc_polygon" | "bnb" | "usdt_bep20" | "usdc_bep20" | "ton" | "usdt_ton"; tx_hash: string; to_address: string | null; amount_units: string; confirmations: number; block_height: number | null; payment_token: string | null; matched_payment_token: string | null; chain_specific: { ton?: { tx_lt: string; mc_block_seqno: number; block_ref: { workchain: number; shard: string; seqno: number; }; jetton_master?: string | undefined; } | undefined; } | null; reason?: "reorg" | "late_arrival" | undefined; }; attempt: number; mode: "production" | "testnet" | "sandbox"; } | { event_id: string; event_type: "invoice.expired"; created_at: number; created_at_iso: string; project_id: string; data: { invoice_id: string; project_id: string; chain: "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc"; coin: "btc" | "eth" | "usdt_erc20" | "usdc_erc20" | "trx" | "usdt_trc20" | "ada" | "pol" | "usdt_polygon" | "usdc_polygon" | "bnb" | "usdt_bep20" | "usdc_bep20" | "ton" | "usdt_ton"; tx_hash: string; to_address: string | null; amount_units: string; confirmations: number; block_height: number | null; payment_token: string | null; matched_payment_token: string | null; chain_specific: { ton?: { tx_lt: string; mc_block_seqno: number; block_ref: { workchain: number; shard: string; seqno: number; }; jetton_master?: string | undefined; } | undefined; } | null; reason?: "reorg" | "late_arrival" | undefined; }; attempt: number; mode: "production" | "testnet" | "sandbox"; } | { event_id: string; event_type: "invoice.expired_paid_late"; created_at: number; created_at_iso: string; project_id: string; data: { invoice_id: string; project_id: string; chain: "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc"; coin: "btc" | "eth" | "usdt_erc20" | "usdc_erc20" | "trx" | "usdt_trc20" | "ada" | "pol" | "usdt_polygon" | "usdc_polygon" | "bnb" | "usdt_bep20" | "usdc_bep20" | "ton" | "usdt_ton"; tx_hash: string; to_address: string | null; amount_units: string; confirmations: number; block_height: number | null; payment_token: string | null; matched_payment_token: string | null; chain_specific: { ton?: { tx_lt: string; mc_block_seqno: number; block_ref: { workchain: number; shard: string; seqno: number; }; jetton_master?: string | undefined; } | undefined; } | null; reason?: "reorg" | "late_arrival" | undefined; }; attempt: number; mode: "production" | "testnet" | "sandbox"; } | { event_id: string; event_type: "invoice.reverted"; created_at: number; created_at_iso: string; project_id: string; data: { invoice_id: string; project_id: string; chain: "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc"; coin: "btc" | "eth" | "usdt_erc20" | "usdc_erc20" | "trx" | "usdt_trc20" | "ada" | "pol" | "usdt_polygon" | "usdc_polygon" | "bnb" | "usdt_bep20" | "usdc_bep20" | "ton" | "usdt_ton"; tx_hash: string; to_address: string | null; amount_units: string; confirmations: number; block_height: number | null; payment_token: string | null; matched_payment_token: string | null; chain_specific: { ton?: { tx_lt: string; mc_block_seqno: number; block_ref: { workchain: number; shard: string; seqno: number; }; jetton_master?: string | undefined; } | undefined; } | null; reason?: "reorg" | "late_arrival" | undefined; }; attempt: number; mode: "production" | "testnet" | "sandbox"; };
38
+ export type WebhookEvent = { event_id: string; event_type: "invoice.detected"; created_at: number; created_at_iso: string; project_id: string; data: { invoice_id: string; project_id: string; chain: "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc"; coin: "btc" | "eth" | "usdt_erc20" | "usdc_erc20" | "trx" | "usdt_trc20" | "ada" | "pol" | "usdt_polygon" | "usdc_polygon" | "bnb" | "usdt_bep20" | "usdc_bep20" | "ton" | "usdt_ton"; tx_hash: string; to_address: string | null; amount_units: string; confirmations: number; block_height: number | null; payment_token: string | null; matched_payment_token: string | null; chain_specific: { ton?: { tx_lt: string; mc_block_seqno: number; block_ref: { workchain: number; shard: string; seqno: number; }; jetton_master?: string | undefined; } | undefined; } | null; reason?: "reorg" | "late_arrival" | undefined; }; attempt: number; mode: "production" | "testnet" | "sandbox"; } | { event_id: string; event_type: "invoice.paid"; created_at: number; created_at_iso: string; project_id: string; data: { invoice_id: string; project_id: string; chain: "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc"; coin: "btc" | "eth" | "usdt_erc20" | "usdc_erc20" | "trx" | "usdt_trc20" | "ada" | "pol" | "usdt_polygon" | "usdc_polygon" | "bnb" | "usdt_bep20" | "usdc_bep20" | "ton" | "usdt_ton"; tx_hash: string; to_address: string | null; amount_units: string; confirmations: number; block_height: number | null; payment_token: string | null; matched_payment_token: string | null; chain_specific: { ton?: { tx_lt: string; mc_block_seqno: number; block_ref: { workchain: number; shard: string; seqno: number; }; jetton_master?: string | undefined; } | undefined; } | null; reason?: "reorg" | "late_arrival" | undefined; }; attempt: number; mode: "production" | "testnet" | "sandbox"; } | { event_id: string; event_type: "invoice.overpaid"; created_at: number; created_at_iso: string; project_id: string; data: { invoice_id: string; project_id: string; chain: "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc"; coin: "btc" | "eth" | "usdt_erc20" | "usdc_erc20" | "trx" | "usdt_trc20" | "ada" | "pol" | "usdt_polygon" | "usdc_polygon" | "bnb" | "usdt_bep20" | "usdc_bep20" | "ton" | "usdt_ton"; tx_hash: string; to_address: string | null; amount_units: string; confirmations: number; block_height: number | null; payment_token: string | null; matched_payment_token: string | null; chain_specific: { ton?: { tx_lt: string; mc_block_seqno: number; block_ref: { workchain: number; shard: string; seqno: number; }; jetton_master?: string | undefined; } | undefined; } | null; reason?: "reorg" | "late_arrival" | undefined; }; attempt: number; mode: "production" | "testnet" | "sandbox"; } | { event_id: string; event_type: "invoice.partial"; created_at: number; created_at_iso: string; project_id: string; data: { invoice_id: string; project_id: string; chain: "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc"; coin: "btc" | "eth" | "usdt_erc20" | "usdc_erc20" | "trx" | "usdt_trc20" | "ada" | "pol" | "usdt_polygon" | "usdc_polygon" | "bnb" | "usdt_bep20" | "usdc_bep20" | "ton" | "usdt_ton"; tx_hash: string; to_address: string | null; amount_units: string; confirmations: number; block_height: number | null; payment_token: string | null; matched_payment_token: string | null; chain_specific: { ton?: { tx_lt: string; mc_block_seqno: number; block_ref: { workchain: number; shard: string; seqno: number; }; jetton_master?: string | undefined; } | undefined; } | null; reason?: "reorg" | "late_arrival" | undefined; }; attempt: number; mode: "production" | "testnet" | "sandbox"; } | { event_id: string; event_type: "invoice.expired"; created_at: number; created_at_iso: string; project_id: string; data: { invoice_id: string; project_id: string; chain: "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc"; coin: "btc" | "eth" | "usdt_erc20" | "usdc_erc20" | "trx" | "usdt_trc20" | "ada" | "pol" | "usdt_polygon" | "usdc_polygon" | "bnb" | "usdt_bep20" | "usdc_bep20" | "ton" | "usdt_ton"; tx_hash: string; to_address: string | null; amount_units: string; confirmations: number; block_height: number | null; payment_token: string | null; matched_payment_token: string | null; chain_specific: { ton?: { tx_lt: string; mc_block_seqno: number; block_ref: { workchain: number; shard: string; seqno: number; }; jetton_master?: string | undefined; } | undefined; } | null; reason?: "reorg" | "late_arrival" | undefined; }; attempt: number; mode: "production" | "testnet" | "sandbox"; } | { event_id: string; event_type: "invoice.expired_paid_late"; created_at: number; created_at_iso: string; project_id: string; data: { invoice_id: string; project_id: string; chain: "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc"; coin: "btc" | "eth" | "usdt_erc20" | "usdc_erc20" | "trx" | "usdt_trc20" | "ada" | "pol" | "usdt_polygon" | "usdc_polygon" | "bnb" | "usdt_bep20" | "usdc_bep20" | "ton" | "usdt_ton"; tx_hash: string; to_address: string | null; amount_units: string; confirmations: number; block_height: number | null; payment_token: string | null; matched_payment_token: string | null; chain_specific: { ton?: { tx_lt: string; mc_block_seqno: number; block_ref: { workchain: number; shard: string; seqno: number; }; jetton_master?: string | undefined; } | undefined; } | null; reason?: "reorg" | "late_arrival" | undefined; }; attempt: number; mode: "production" | "testnet" | "sandbox"; } | { event_id: string; event_type: "invoice.reverted"; created_at: number; created_at_iso: string; project_id: string; data: { invoice_id: string; project_id: string; chain: "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc"; coin: "btc" | "eth" | "usdt_erc20" | "usdc_erc20" | "trx" | "usdt_trc20" | "ada" | "pol" | "usdt_polygon" | "usdc_polygon" | "bnb" | "usdt_bep20" | "usdc_bep20" | "ton" | "usdt_ton"; tx_hash: string; to_address: string | null; amount_units: string; confirmations: number; block_height: number | null; payment_token: string | null; matched_payment_token: string | null; chain_specific: { ton?: { tx_lt: string; mc_block_seqno: number; block_ref: { workchain: number; shard: string; seqno: number; }; jetton_master?: string | undefined; } | undefined; } | null; reason?: "reorg" | "late_arrival" | undefined; }; attempt: number; mode: "production" | "testnet" | "sandbox"; } | { event_id: string; event_type: "invoice.ambiguous"; created_at: number; created_at_iso: string; project_id: string; data: { invoice_id: string; project_id: string; chain: "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc"; coin: "btc" | "eth" | "usdt_erc20" | "usdc_erc20" | "trx" | "usdt_trc20" | "ada" | "pol" | "usdt_polygon" | "usdc_polygon" | "bnb" | "usdt_bep20" | "usdc_bep20" | "ton" | "usdt_ton"; tx_hash: string; to_address: string | null; amount_units: string; confirmations: number; block_height: number | null; payment_token: string | null; matched_payment_token: string | null; chain_specific: { ton?: { tx_lt: string; mc_block_seqno: number; block_ref: { workchain: number; shard: string; seqno: number; }; jetton_master?: string | undefined; } | undefined; } | null; reason?: "reorg" | "late_arrival" | undefined; }; attempt: number; mode: "production" | "testnet" | "sandbox"; };
29
39
 
30
40
  export type WebhookEventData = { invoice_id: string; project_id: string; chain: "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc"; coin: "btc" | "eth" | "usdt_erc20" | "usdc_erc20" | "trx" | "usdt_trc20" | "ada" | "pol" | "usdt_polygon" | "usdc_polygon" | "bnb" | "usdt_bep20" | "usdc_bep20" | "ton" | "usdt_ton"; tx_hash: string; to_address: string | null; amount_units: string; confirmations: number; block_height: number | null; payment_token: string | null; matched_payment_token: string | null; chain_specific: { ton?: { tx_lt: string; mc_block_seqno: number; block_ref: { workchain: number; shard: string; seqno: number; }; jetton_master?: string | undefined; } | undefined; } | null; reason?: "reorg" | "late_arrival" | undefined; };
31
41
 
32
42
  export type WebhookEventMode = "production" | "testnet" | "sandbox";
33
43
 
34
- export type WebhookEventType = "invoice.detected" | "invoice.paid" | "invoice.overpaid" | "invoice.partial" | "invoice.expired" | "invoice.expired_paid_late" | "invoice.reverted";
44
+ export type WebhookEventType = "invoice.detected" | "invoice.paid" | "invoice.overpaid" | "invoice.partial" | "invoice.expired" | "invoice.expired_paid_late" | "invoice.reverted" | "invoice.ambiguous";
35
45
 
36
46
  export type RatesQuery = { coins?: string | undefined; };
37
47
 
38
- export type RatesResponse = { quoted_at: string; source: "coingecko"; rates: Partial<Record<"btc" | "eth" | "usdt_erc20" | "usdc_erc20" | "trx" | "usdt_trc20" | "ada" | "pol" | "usdt_polygon" | "usdc_polygon" | "bnb" | "usdt_bep20" | "usdc_bep20" | "ton" | "usdt_ton", { rate: string; rate_is_stale: boolean; rate_age_seconds: number; }>>; indicative_notice: string; };
48
+ export type RatesResponse = { quoted_at: string; source: "coinpaprika" | "coingecko"; rates: Partial<Record<"btc" | "eth" | "usdt_erc20" | "usdc_erc20" | "trx" | "usdt_trc20" | "ada" | "pol" | "usdt_polygon" | "usdc_polygon" | "bnb" | "usdt_bep20" | "usdc_bep20" | "ton" | "usdt_ton", { rate: string; rate_is_stale: boolean; rate_age_seconds: number; }>>; indicative_notice: string; };
39
49
 
40
50
  export type QuoteQuery = { amount_usd: number; coins?: string | undefined; };
41
51
 
42
- export type QuoteResponse = { amount_usd: number; quoted_at: string; source: "coingecko"; quotes: Partial<Record<"btc" | "eth" | "usdt_erc20" | "usdc_erc20" | "trx" | "usdt_trc20" | "ada" | "pol" | "usdt_polygon" | "usdc_polygon" | "bnb" | "usdt_bep20" | "usdc_bep20" | "ton" | "usdt_ton", { amount_crypto: string; amount_crypto_units: string; rate: string; rate_is_stale: boolean; rate_age_seconds: number; }>>; indicative_notice: string; };
52
+ export type QuoteResponse = { amount_usd: number; quoted_at: string; source: "coinpaprika" | "coingecko"; quotes: Partial<Record<"btc" | "eth" | "usdt_erc20" | "usdc_erc20" | "trx" | "usdt_trc20" | "ada" | "pol" | "usdt_polygon" | "usdc_polygon" | "bnb" | "usdt_bep20" | "usdc_bep20" | "ton" | "usdt_ton", { amount_crypto: string; amount_crypto_units: string; rate: string; rate_is_stale: boolean; rate_age_seconds: number; }>>; indicative_notice: string; };
43
53
 
44
- export type ErrorCode = "validation_error" | "invalid_coin" | "invalid_xpub_format" | "invalid_webhook_url" | "auth_invalid" | "signature_invalid" | "signature_replayed" | "timestamp_out_of_window" | "key_suspended" | "project_suspended" | "permission_denied" | "key_revoked" | "invoice_not_found" | "project_not_found" | "wallet_not_found" | "external_id_conflict" | "xpub_not_verified" | "coin_not_enabled" | "amount_out_of_range" | "rate_limit_exceeded" | "pool_exhausted" | "webhook_capacity_exhausted" | "duplicate_provider_webhook_id" | "otp_expired" | "otp_used" | "invite_invalid" | "internal_error" | "invoice_not_cancellable" | "invalid_state_transition" | "orphan_not_found" | "orphan_already_attributed" | "event_not_found" | "wallet_not_bound" | "wallet_not_owned" | "wallet_has_active_bindings" | "wallet_kind_mismatch" | "subscription_expired" | "tron_no_activated_addresses_available" | "ton_operator_wallet_not_deployed" | "ton_invalid_wallet_version" | "ton_jetton_resolve_failed" | "ton_comment_parse_failed" | "tonconnect_payload_expired" | "tonconnect_payload_unknown" | "tonconnect_domain_mismatch" | "tonconnect_timestamp_skew" | "tonconnect_unknown_wallet_version" | "tonconnect_signature_invalid" | "tonconnect_network_mismatch" | "sandbox_project_required" | "production_project_required" | "sandbox_per_operator_cap_reached" | "sandbox_key_against_production_project" | "production_key_against_sandbox_project" | "sandbox_provisioning_failed" | "sandbox_invoice_transition_invalid" | "sandbox_invoice_not_found" | "sandbox_invoice_terminal" | "sandbox_rate_limit_exceeded" | "sandbox_reset_failed" | "sandbox_delete_failed" | "sandbox_active_invoice_cap_reached";
54
+ export type ErrorCode = "tx_not_found_or_incomplete" | "tx_already_attributed" | "validation_error" | "invalid_coin" | "invalid_xpub_format" | "invalid_webhook_url" | "auth_invalid" | "signature_invalid" | "signature_replayed" | "timestamp_out_of_window" | "key_suspended" | "project_suspended" | "permission_denied" | "key_revoked" | "invoice_not_found" | "project_not_found" | "wallet_not_found" | "external_id_conflict" | "xpub_not_verified" | "coin_not_enabled" | "amount_out_of_range" | "rate_limit_exceeded" | "pool_exhausted" | "webhook_capacity_exhausted" | "duplicate_provider_webhook_id" | "otp_expired" | "otp_used" | "invite_invalid" | "internal_error" | "invoice_not_cancellable" | "invalid_state_transition" | "orphan_not_found" | "orphan_already_attributed" | "event_not_found" | "wallet_not_bound" | "wallet_not_owned" | "wallet_has_active_bindings" | "wallet_kind_mismatch" | "subscription_expired" | "tron_no_activated_addresses_available" | "ton_operator_wallet_not_deployed" | "ton_invalid_wallet_version" | "ton_jetton_resolve_failed" | "ton_comment_parse_failed" | "tonconnect_payload_expired" | "tonconnect_payload_unknown" | "tonconnect_domain_mismatch" | "tonconnect_timestamp_skew" | "tonconnect_unknown_wallet_version" | "tonconnect_signature_invalid" | "tonconnect_network_mismatch" | "sandbox_project_required" | "production_project_required" | "sandbox_per_operator_cap_reached" | "sandbox_key_against_production_project" | "production_key_against_sandbox_project" | "sandbox_provisioning_failed" | "sandbox_invoice_transition_invalid" | "sandbox_invoice_not_found" | "sandbox_invoice_terminal" | "sandbox_rate_limit_exceeded" | "sandbox_reset_failed" | "sandbox_delete_failed" | "sandbox_active_invoice_cap_reached" | "overlay_matching_mode_required_exact" | "manual_claim_rate_limit_exceeded" | "manual_claim_not_pending_review" | "manual_claim_invoice_not_open" | "event_not_resendable" | "rate_quote_unavailable";
45
55
 
46
- export type ProblemDetails = { type: "about:blank"; title: string; status: number; error_code: "validation_error" | "invalid_coin" | "invalid_xpub_format" | "invalid_webhook_url" | "auth_invalid" | "signature_invalid" | "signature_replayed" | "timestamp_out_of_window" | "key_suspended" | "project_suspended" | "permission_denied" | "key_revoked" | "invoice_not_found" | "project_not_found" | "wallet_not_found" | "external_id_conflict" | "xpub_not_verified" | "coin_not_enabled" | "amount_out_of_range" | "rate_limit_exceeded" | "pool_exhausted" | "webhook_capacity_exhausted" | "duplicate_provider_webhook_id" | "otp_expired" | "otp_used" | "invite_invalid" | "internal_error" | "invoice_not_cancellable" | "invalid_state_transition" | "orphan_not_found" | "orphan_already_attributed" | "event_not_found" | "wallet_not_bound" | "wallet_not_owned" | "wallet_has_active_bindings" | "wallet_kind_mismatch" | "subscription_expired" | "tron_no_activated_addresses_available" | "ton_operator_wallet_not_deployed" | "ton_invalid_wallet_version" | "ton_jetton_resolve_failed" | "ton_comment_parse_failed" | "tonconnect_payload_expired" | "tonconnect_payload_unknown" | "tonconnect_domain_mismatch" | "tonconnect_timestamp_skew" | "tonconnect_unknown_wallet_version" | "tonconnect_signature_invalid" | "tonconnect_network_mismatch" | "sandbox_project_required" | "production_project_required" | "sandbox_per_operator_cap_reached" | "sandbox_key_against_production_project" | "production_key_against_sandbox_project" | "sandbox_provisioning_failed" | "sandbox_invoice_transition_invalid" | "sandbox_invoice_not_found" | "sandbox_invoice_terminal" | "sandbox_rate_limit_exceeded" | "sandbox_reset_failed" | "sandbox_delete_failed" | "sandbox_active_invoice_cap_reached"; request_id: string; errors?: unknown[] | undefined; wallet_id?: string | undefined; current_status?: string | undefined; requested_event?: string | undefined; current_count?: number | undefined; reset_url?: string | undefined; failed_step?: string | null | undefined; wallet_kind?: "production" | "testnet" | "sandbox" | undefined; project_kind?: "production" | "testnet" | "sandbox" | undefined; };
56
+ export type ProblemDetails = { type: "about:blank"; title: string; status: number; error_code: "tx_not_found_or_incomplete" | "tx_already_attributed" | "validation_error" | "invalid_coin" | "invalid_xpub_format" | "invalid_webhook_url" | "auth_invalid" | "signature_invalid" | "signature_replayed" | "timestamp_out_of_window" | "key_suspended" | "project_suspended" | "permission_denied" | "key_revoked" | "invoice_not_found" | "project_not_found" | "wallet_not_found" | "external_id_conflict" | "xpub_not_verified" | "coin_not_enabled" | "amount_out_of_range" | "rate_limit_exceeded" | "pool_exhausted" | "webhook_capacity_exhausted" | "duplicate_provider_webhook_id" | "otp_expired" | "otp_used" | "invite_invalid" | "internal_error" | "invoice_not_cancellable" | "invalid_state_transition" | "orphan_not_found" | "orphan_already_attributed" | "event_not_found" | "wallet_not_bound" | "wallet_not_owned" | "wallet_has_active_bindings" | "wallet_kind_mismatch" | "subscription_expired" | "tron_no_activated_addresses_available" | "ton_operator_wallet_not_deployed" | "ton_invalid_wallet_version" | "ton_jetton_resolve_failed" | "ton_comment_parse_failed" | "tonconnect_payload_expired" | "tonconnect_payload_unknown" | "tonconnect_domain_mismatch" | "tonconnect_timestamp_skew" | "tonconnect_unknown_wallet_version" | "tonconnect_signature_invalid" | "tonconnect_network_mismatch" | "sandbox_project_required" | "production_project_required" | "sandbox_per_operator_cap_reached" | "sandbox_key_against_production_project" | "production_key_against_sandbox_project" | "sandbox_provisioning_failed" | "sandbox_invoice_transition_invalid" | "sandbox_invoice_not_found" | "sandbox_invoice_terminal" | "sandbox_rate_limit_exceeded" | "sandbox_reset_failed" | "sandbox_delete_failed" | "sandbox_active_invoice_cap_reached" | "overlay_matching_mode_required_exact" | "manual_claim_rate_limit_exceeded" | "manual_claim_not_pending_review" | "manual_claim_invoice_not_open" | "event_not_resendable" | "rate_quote_unavailable"; request_id: string; errors?: unknown[] | undefined; wallet_id?: string | undefined; current_status?: string | undefined; requested_event?: string | undefined; current_count?: number | undefined; reset_url?: string | undefined; failed_step?: string | null | undefined; wallet_kind?: "production" | "testnet" | "sandbox" | undefined; project_kind?: "production" | "testnet" | "sandbox" | undefined; attempted_mode?: "any" | "at_least" | undefined; };
47
57
 
48
58
  export type Chain = "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc";
49
59
 
@@ -53,7 +63,7 @@ export type WalletEdgeKind = "production" | "testnet";
53
63
 
54
64
  export type ClockAdvance = { chain: "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc"; blocks: number; };
55
65
 
56
- export type SimulateEvent = { eventType: "invoice.detected" | "invoice.paid" | "invoice.overpaid" | "invoice.partial" | "invoice.expired" | "invoice.expired_paid_late" | "invoice.reverted"; amountUnits: string; confirmations: number; blockHeight: number; expectedCurrentStatus: "pending" | "detected" | "paid" | "overpaid" | "partial" | "expired" | "expired_paid_late" | "reverted" | "cancelled"; chainSpecific?: unknown; seed?: string | undefined; };
66
+ export type SimulateEvent = { eventType: "invoice.detected" | "invoice.paid" | "invoice.overpaid" | "invoice.partial" | "invoice.expired" | "invoice.expired_paid_late" | "invoice.reverted" | "invoice.ambiguous"; amountUnits: string; confirmations: number; blockHeight: number; expectedCurrentStatus: "pending" | "detected" | "paid" | "overpaid" | "partial" | "expired" | "expired_paid_late" | "reverted" | "cancelled" | "ambiguous"; chainSpecific?: unknown; seed?: string | undefined; };
57
67
 
58
68
  export type SimulateLatePayment = { amountUnits?: string | undefined; seed?: string | undefined; };
59
69
 
@@ -63,6 +73,6 @@ export type SimulatePartial = { fraction?: number | undefined; amountUnits?: str
63
73
 
64
74
  export type WalletsListResponse = { items: { chain: "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc"; xpub: string | null; derivation_path: string; stake_address: string | null; ed25519_pubkey_hex: string | null; }[]; };
65
75
 
66
- export declare const ERROR_CODES: readonly ["validation_error", "invalid_coin", "invalid_xpub_format", "invalid_webhook_url", "auth_invalid", "signature_invalid", "signature_replayed", "timestamp_out_of_window", "key_suspended", "project_suspended", "permission_denied", "key_revoked", "invoice_not_found", "project_not_found", "wallet_not_found", "external_id_conflict", "xpub_not_verified", "coin_not_enabled", "amount_out_of_range", "rate_limit_exceeded", "pool_exhausted", "webhook_capacity_exhausted", "duplicate_provider_webhook_id", "otp_expired", "otp_used", "invite_invalid", "internal_error", "invoice_not_cancellable", "invalid_state_transition", "orphan_not_found", "orphan_already_attributed", "event_not_found", "wallet_not_bound", "wallet_not_owned", "wallet_has_active_bindings", "wallet_kind_mismatch", "subscription_expired", "tron_no_activated_addresses_available", "ton_operator_wallet_not_deployed", "ton_invalid_wallet_version", "ton_jetton_resolve_failed", "ton_comment_parse_failed", "tonconnect_payload_expired", "tonconnect_payload_unknown", "tonconnect_domain_mismatch", "tonconnect_timestamp_skew", "tonconnect_unknown_wallet_version", "tonconnect_signature_invalid", "tonconnect_network_mismatch", "sandbox_project_required", "production_project_required", "sandbox_per_operator_cap_reached", "sandbox_key_against_production_project", "production_key_against_sandbox_project", "sandbox_provisioning_failed", "sandbox_invoice_transition_invalid", "sandbox_invoice_not_found", "sandbox_invoice_terminal", "sandbox_rate_limit_exceeded", "sandbox_reset_failed", "sandbox_delete_failed", "sandbox_active_invoice_cap_reached"];
76
+ export declare const ERROR_CODES: readonly ["validation_error", "invalid_coin", "invalid_xpub_format", "invalid_webhook_url", "auth_invalid", "signature_invalid", "signature_replayed", "timestamp_out_of_window", "key_suspended", "project_suspended", "permission_denied", "key_revoked", "invoice_not_found", "project_not_found", "wallet_not_found", "external_id_conflict", "xpub_not_verified", "coin_not_enabled", "amount_out_of_range", "rate_limit_exceeded", "pool_exhausted", "webhook_capacity_exhausted", "duplicate_provider_webhook_id", "otp_expired", "otp_used", "invite_invalid", "internal_error", "invoice_not_cancellable", "invalid_state_transition", "orphan_not_found", "orphan_already_attributed", "event_not_found", "wallet_not_bound", "wallet_not_owned", "wallet_has_active_bindings", "wallet_kind_mismatch", "subscription_expired", "tron_no_activated_addresses_available", "ton_operator_wallet_not_deployed", "ton_invalid_wallet_version", "ton_jetton_resolve_failed", "ton_comment_parse_failed", "tonconnect_payload_expired", "tonconnect_payload_unknown", "tonconnect_domain_mismatch", "tonconnect_timestamp_skew", "tonconnect_unknown_wallet_version", "tonconnect_signature_invalid", "tonconnect_network_mismatch", "sandbox_project_required", "production_project_required", "sandbox_per_operator_cap_reached", "sandbox_key_against_production_project", "production_key_against_sandbox_project", "sandbox_provisioning_failed", "sandbox_invoice_transition_invalid", "sandbox_invoice_not_found", "sandbox_invoice_terminal", "sandbox_rate_limit_exceeded", "sandbox_reset_failed", "sandbox_delete_failed", "sandbox_active_invoice_cap_reached", "overlay_matching_mode_required_exact", "tx_not_found_or_incomplete", "tx_already_attributed", "manual_claim_rate_limit_exceeded", "manual_claim_not_pending_review", "manual_claim_invoice_not_open", "event_not_resendable", "rate_quote_unavailable"];
67
77
 
68
- export declare const ERROR_CODE_STATUS: { readonly validation_error: 400; readonly invalid_coin: 400; readonly invalid_xpub_format: 400; readonly invalid_webhook_url: 400; readonly auth_invalid: 401; readonly signature_invalid: 401; readonly signature_replayed: 401; readonly timestamp_out_of_window: 401; readonly key_suspended: 403; readonly project_suspended: 403; readonly permission_denied: 403; readonly key_revoked: 403; readonly invoice_not_found: 404; readonly project_not_found: 404; readonly wallet_not_found: 404; readonly external_id_conflict: 409; readonly xpub_not_verified: 409; readonly coin_not_enabled: 422; readonly amount_out_of_range: 422; readonly rate_limit_exceeded: 429; readonly pool_exhausted: 503; readonly webhook_capacity_exhausted: 503; readonly duplicate_provider_webhook_id: 409; readonly otp_expired: 400; readonly otp_used: 400; readonly invite_invalid: 400; readonly internal_error: 500; readonly invoice_not_cancellable: 409; readonly invalid_state_transition: 409; readonly orphan_not_found: 404; readonly orphan_already_attributed: 409; readonly event_not_found: 404; readonly wallet_not_bound: 422; readonly wallet_not_owned: 403; readonly wallet_has_active_bindings: 409; readonly wallet_kind_mismatch: 422; readonly subscription_expired: 402; readonly tron_no_activated_addresses_available: 422; readonly ton_operator_wallet_not_deployed: 422; readonly ton_invalid_wallet_version: 422; readonly ton_jetton_resolve_failed: 503; readonly ton_comment_parse_failed: 422; readonly tonconnect_payload_expired: 400; readonly tonconnect_payload_unknown: 400; readonly tonconnect_domain_mismatch: 400; readonly tonconnect_timestamp_skew: 400; readonly tonconnect_unknown_wallet_version: 400; readonly tonconnect_signature_invalid: 400; readonly tonconnect_network_mismatch: 400; readonly sandbox_project_required: 403; readonly production_project_required: 403; readonly sandbox_per_operator_cap_reached: 422; readonly sandbox_key_against_production_project: 400; readonly production_key_against_sandbox_project: 400; readonly sandbox_provisioning_failed: 500; readonly sandbox_invoice_transition_invalid: 422; readonly sandbox_invoice_not_found: 404; readonly sandbox_invoice_terminal: 422; readonly sandbox_rate_limit_exceeded: 429; readonly sandbox_reset_failed: 500; readonly sandbox_delete_failed: 500; readonly sandbox_active_invoice_cap_reached: 422; };
78
+ export declare const ERROR_CODE_STATUS: { readonly validation_error: 400; readonly invalid_coin: 400; readonly invalid_xpub_format: 400; readonly invalid_webhook_url: 400; readonly auth_invalid: 401; readonly signature_invalid: 401; readonly signature_replayed: 401; readonly timestamp_out_of_window: 401; readonly key_suspended: 403; readonly project_suspended: 403; readonly permission_denied: 403; readonly key_revoked: 403; readonly invoice_not_found: 404; readonly project_not_found: 404; readonly wallet_not_found: 404; readonly external_id_conflict: 409; readonly xpub_not_verified: 409; readonly coin_not_enabled: 422; readonly amount_out_of_range: 422; readonly rate_limit_exceeded: 429; readonly pool_exhausted: 503; readonly webhook_capacity_exhausted: 503; readonly duplicate_provider_webhook_id: 409; readonly otp_expired: 400; readonly otp_used: 400; readonly invite_invalid: 400; readonly internal_error: 500; readonly invoice_not_cancellable: 409; readonly invalid_state_transition: 409; readonly orphan_not_found: 404; readonly orphan_already_attributed: 409; readonly event_not_found: 404; readonly wallet_not_bound: 422; readonly wallet_not_owned: 403; readonly wallet_has_active_bindings: 409; readonly wallet_kind_mismatch: 422; readonly subscription_expired: 402; readonly tron_no_activated_addresses_available: 422; readonly ton_operator_wallet_not_deployed: 422; readonly ton_invalid_wallet_version: 422; readonly ton_jetton_resolve_failed: 503; readonly ton_comment_parse_failed: 422; readonly tonconnect_payload_expired: 400; readonly tonconnect_payload_unknown: 400; readonly tonconnect_domain_mismatch: 400; readonly tonconnect_timestamp_skew: 400; readonly tonconnect_unknown_wallet_version: 400; readonly tonconnect_signature_invalid: 400; readonly tonconnect_network_mismatch: 400; readonly sandbox_project_required: 403; readonly production_project_required: 403; readonly sandbox_per_operator_cap_reached: 422; readonly sandbox_key_against_production_project: 400; readonly production_key_against_sandbox_project: 400; readonly sandbox_provisioning_failed: 500; readonly sandbox_invoice_transition_invalid: 422; readonly sandbox_invoice_not_found: 404; readonly sandbox_invoice_terminal: 422; readonly sandbox_rate_limit_exceeded: 429; readonly sandbox_reset_failed: 500; readonly sandbox_delete_failed: 500; readonly sandbox_active_invoice_cap_reached: 422; readonly overlay_matching_mode_required_exact: 422; readonly tx_not_found_or_incomplete: 200; readonly tx_already_attributed: 200; readonly manual_claim_rate_limit_exceeded: 429; readonly manual_claim_not_pending_review: 409; readonly manual_claim_invoice_not_open: 409; readonly event_not_resendable: 409; readonly rate_quote_unavailable: 503; };
@@ -1,4 +1,4 @@
1
- import type { ClockAdvance, SimulateEvent, SimulateLatePayment, SimulateOverpaid, SimulatePartial, WalletsListResponse } from './_shared/index.js';
1
+ import type { Chain, ClaimByTxResponse, ClockAdvance, CursorPaginatedInvoiceResponse, InvoiceCreateRequest, InvoiceDetailResponse, InvoiceResponse, InvoiceSearchQuery, SimulateEvent, SimulateLatePayment, SimulateOverpaid, SimulatePartial, WalletsListResponse, WebhookEventListApiQuery, WebhookEventListResponse, WebhookEventResendResponse } from './_shared/index.js';
2
2
  /**
3
3
  * Result envelope returned by every `simulate*` method. `event_id` is the
4
4
  * outbox `id` whose webhook payload your handler will receive (or `null` when
@@ -27,11 +27,11 @@ interface RequestFn {
27
27
  }): Promise<T>;
28
28
  }
29
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.
30
+ * Thin HTTP-wrapper class for the sandbox-mode endpoints. Constructed lazily
31
+ * by `TxnodClient.sandbox` so unused sandbox code is dead-code-eliminated by
32
+ * the bundler. Methods sign requests with the underlying HMAC scheme, parse
33
+ * RFC 7807 errors into typed sandbox-* error classes, and return JSON-decoded
34
+ * result envelopes.
35
35
  *
36
36
  * **Do not instantiate this class directly.** Always go through
37
37
  * `client.sandbox` so the client's HMAC + retry + telemetry pipeline is
@@ -57,6 +57,152 @@ interface RequestFn {
57
57
  export declare class TxnodClientSandbox {
58
58
  #private;
59
59
  constructor(request: RequestFn);
60
+ /**
61
+ * `POST /api/v1/sandbox/invoices` — create an invoice on a sandbox project.
62
+ * The sandbox mirror of `client.createInvoice` (the production endpoint is
63
+ * kind-locked and rejects sandbox projects with
64
+ * `production_project_required`). Idempotent on `(project_id, external_id)`.
65
+ * Subject to the sandbox 10k active-invoice cap
66
+ * (`TxnodSandboxActiveInvoiceCapReachedError`).
67
+ *
68
+ * Unlike `client.createInvoice`, no xpub address-verification runs on the
69
+ * response — sandbox addresses derive from server-provisioned testnet xpubs
70
+ * and never carry real funds; use `client.sandbox.listWallets` if you want
71
+ * to verify derivation in a test harness.
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * import { TxnodClient } from '@txnod/sdk';
76
+ *
77
+ * const client = new TxnodClient({
78
+ * projectId: process.env.TXNOD_PROJECT_ID!,
79
+ * apiSecret: process.env.TXNOD_API_SECRET!, // sk_sandbox_...
80
+ * environment: 'non-production',
81
+ * });
82
+ *
83
+ * const invoice = await client.sandbox.createInvoice({
84
+ * amount_usd: 9.99,
85
+ * coin: 'usdt_trc20',
86
+ * external_id: 'order-42',
87
+ * });
88
+ * await client.sandbox.simulateDetect(invoice.id, { seed: 'order-42' });
89
+ * ```
90
+ */
91
+ createInvoice(body: InvoiceCreateRequest): Promise<InvoiceResponse>;
92
+ /**
93
+ * `GET /api/v1/sandbox/invoices/{invoiceId}` — fetch a sandbox invoice by
94
+ * ULID. The sandbox mirror of `client.getInvoice`; same
95
+ * `TxnodInvoiceNotFoundError` semantics on cross-project lookups.
96
+ *
97
+ * @example
98
+ * ```ts
99
+ * import { TxnodClient } from '@txnod/sdk';
100
+ *
101
+ * const client = new TxnodClient({
102
+ * projectId: process.env.TXNOD_PROJECT_ID!,
103
+ * apiSecret: process.env.TXNOD_API_SECRET!,
104
+ * environment: 'non-production',
105
+ * });
106
+ *
107
+ * const invoice = await client.sandbox.getInvoice(
108
+ * '01HK8MAR2QEXAMPLE000000000',
109
+ * );
110
+ * console.log(invoice.status, invoice.confirmations);
111
+ * ```
112
+ */
113
+ getInvoice(id: string): Promise<InvoiceDetailResponse>;
114
+ /**
115
+ * `GET /api/v1/sandbox/invoices` — cursor-paginated search over the sandbox
116
+ * project's invoices. The sandbox mirror of `client.searchInvoices`; takes
117
+ * the same snake_case query filters.
118
+ *
119
+ * @example
120
+ * ```ts
121
+ * import { TxnodClient } from '@txnod/sdk';
122
+ *
123
+ * const client = new TxnodClient({
124
+ * projectId: process.env.TXNOD_PROJECT_ID!,
125
+ * apiSecret: process.env.TXNOD_API_SECRET!,
126
+ * environment: 'non-production',
127
+ * });
128
+ *
129
+ * const page = await client.sandbox.listInvoices({ status: 'paid', limit: 20 });
130
+ * for (const invoice of page.items) console.log(invoice.id);
131
+ * ```
132
+ */
133
+ listInvoices(query?: InvoiceSearchQuery): Promise<CursorPaginatedInvoiceResponse>;
134
+ /**
135
+ * `POST /api/v1/sandbox/invoices/{invoiceId}/cancel` — cancel a sandbox
136
+ * invoice in `pending` or `detected` state. The sandbox mirror of
137
+ * `client.cancelInvoice`; throws `TxnodInvoiceNotCancellableError` on
138
+ * terminal-status invoices.
139
+ *
140
+ * @example
141
+ * ```ts
142
+ * import { TxnodClient } from '@txnod/sdk';
143
+ *
144
+ * const client = new TxnodClient({
145
+ * projectId: process.env.TXNOD_PROJECT_ID!,
146
+ * apiSecret: process.env.TXNOD_API_SECRET!,
147
+ * environment: 'non-production',
148
+ * });
149
+ *
150
+ * const cancelled = await client.sandbox.cancelInvoice(
151
+ * '01HK8MAR2QEXAMPLE000000000',
152
+ * );
153
+ * console.log(cancelled.status); // 'cancelled'
154
+ * ```
155
+ */
156
+ cancelInvoice(id: string): Promise<InvoiceDetailResponse>;
157
+ /**
158
+ * `GET /api/v1/sandbox/webhooks/events` — cursor-paginated delivery log for
159
+ * the sandbox project's outbound webhook events. The sandbox mirror of
160
+ * `client.listWebhookEvents` (the production endpoint is kind-locked and
161
+ * rejects sandbox projects); takes the same snake_case query filters. Every
162
+ * row corresponds to an envelope with `mode: 'sandbox'`.
163
+ *
164
+ * @example
165
+ * ```ts
166
+ * import { TxnodClient } from '@txnod/sdk';
167
+ *
168
+ * const client = new TxnodClient({
169
+ * projectId: process.env.TXNOD_PROJECT_ID!,
170
+ * apiSecret: process.env.TXNOD_API_SECRET!, // sk_sandbox_...
171
+ * environment: 'non-production',
172
+ * });
173
+ *
174
+ * const page = await client.sandbox.listWebhookEvents({
175
+ * invoice_id: '01HK8MAR2QEXAMPLE000000000',
176
+ * limit: 50,
177
+ * });
178
+ * for (const event of page.items) console.log(event.id, event.event_type);
179
+ * ```
180
+ */
181
+ listWebhookEvents(query?: WebhookEventListApiQuery): Promise<WebhookEventListResponse>;
182
+ /**
183
+ * `POST /api/v1/sandbox/webhooks/events/{eventId}/resend` — re-enqueue a
184
+ * previously-delivered sandbox webhook event. The sandbox mirror of
185
+ * `client.resendWebhookEvent`; the resend mints a fresh `event_id` and the
186
+ * response carries `original_event_id` for lineage. In-flight or
187
+ * dead-lettered events throw `TxnodEventNotResendableError`.
188
+ *
189
+ * @example
190
+ * ```ts
191
+ * import { TxnodClient } from '@txnod/sdk';
192
+ *
193
+ * const client = new TxnodClient({
194
+ * projectId: process.env.TXNOD_PROJECT_ID!,
195
+ * apiSecret: process.env.TXNOD_API_SECRET!,
196
+ * environment: 'non-production',
197
+ * });
198
+ *
199
+ * const resent = await client.sandbox.resendWebhookEvent(
200
+ * '01HK8MAR2QEXAMPLE000000000',
201
+ * );
202
+ * console.log(resent.event_id, resent.original_event_id);
203
+ * ```
204
+ */
205
+ resendWebhookEvent(eventId: string): Promise<WebhookEventResendResponse>;
60
206
  /**
61
207
  * `POST /api/v1/sandbox/invoices/{invoiceId}/simulate-detect` — synthesize
62
208
  * an `invoice.detected` event (status `pending` → `detected`) and write a
@@ -304,6 +450,35 @@ export declare class TxnodClientSandbox {
304
450
  * ```
305
451
  */
306
452
  simulateEvent(invoiceId: string, eventInput: SimulateEvent): Promise<SandboxSimulateResult>;
453
+ /**
454
+ * `POST /api/v1/sandbox/invoices/{invoiceId}/claim-by-tx` — sandbox parity
455
+ * for `client.claimInvoiceByTx`. Skips the real chain-provider lookup and
456
+ * synthesises resolved facts from the invoice itself, so the full manual
457
+ * tx-hash claim lifecycle (auto-attribution, pending-review, rejection)
458
+ * can be exercised without on-chain spend. Response shape is identical to
459
+ * the production endpoint.
460
+ *
461
+ * @example
462
+ * ```ts
463
+ * import { TxnodClient } from '@txnod/sdk';
464
+ *
465
+ * const client = new TxnodClient({
466
+ * projectId: process.env.TXNOD_PROJECT_ID!,
467
+ * apiSecret: process.env.TXNOD_API_SECRET!,
468
+ * environment: 'non-production',
469
+ * });
470
+ *
471
+ * const result = await client.sandbox.simulateClaimByTx(
472
+ * '01HK8MAR2QEXAMPLE000000000',
473
+ * { txHash: '0xabc...def', chain: 'eth' },
474
+ * );
475
+ * console.log(result.status);
476
+ * ```
477
+ */
478
+ simulateClaimByTx(invoiceId: string, args: {
479
+ txHash: string;
480
+ chain: Chain;
481
+ }): Promise<ClaimByTxResponse>;
307
482
  /**
308
483
  * `POST /api/v1/sandbox/{projectId}/clock/advance` — bump the
309
484
  * `confirmations` counter on every `detected` invoice for the given chain
@@ -1 +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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