@txnod/sdk 1.0.1 → 1.0.2
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 +1 -1
- package/CHANGELOG.md +17 -0
- package/dist/_shared/index.d.ts +14 -14
- package/dist/client-sandbox.d.ts +35 -6
- package/dist/client-sandbox.d.ts.map +1 -1
- package/dist/client-sandbox.js +37 -5
- package/dist/client-sandbox.js.map +1 -1
- package/dist/client.d.ts +57 -7
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +58 -6
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +122 -4
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +136 -4
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/internals/error-ctor-map.d.ts.map +1 -1
- package/dist/internals/error-ctor-map.js +2 -1
- package/dist/internals/error-ctor-map.js.map +1 -1
- package/dist/verify/chains/bsc.d.ts +1 -7
- package/dist/verify/chains/bsc.d.ts.map +1 -1
- package/dist/verify/chains/bsc.js +1 -7
- package/dist/verify/chains/bsc.js.map +1 -1
- package/dist/verify/chains/btc.d.ts +1 -8
- package/dist/verify/chains/btc.d.ts.map +1 -1
- package/dist/verify/chains/btc.js +1 -8
- package/dist/verify/chains/btc.js.map +1 -1
- package/dist/verify/chains/cardano.d.ts +6 -13
- package/dist/verify/chains/cardano.d.ts.map +1 -1
- package/dist/verify/chains/cardano.js +6 -13
- package/dist/verify/chains/cardano.js.map +1 -1
- package/dist/verify/chains/evm.d.ts +1 -6
- package/dist/verify/chains/evm.d.ts.map +1 -1
- package/dist/verify/chains/evm.js +1 -6
- package/dist/verify/chains/evm.js.map +1 -1
- package/dist/verify/chains/polygon.d.ts +1 -7
- package/dist/verify/chains/polygon.d.ts.map +1 -1
- package/dist/verify/chains/polygon.js +1 -7
- package/dist/verify/chains/polygon.js.map +1 -1
- package/dist/verify/chains/secp256k1-bip32.d.ts +2 -8
- package/dist/verify/chains/secp256k1-bip32.d.ts.map +1 -1
- package/dist/verify/chains/secp256k1-bip32.js +5 -13
- package/dist/verify/chains/secp256k1-bip32.js.map +1 -1
- package/dist/verify/chains/ton-cell.d.ts.map +1 -1
- package/dist/verify/chains/ton-cell.js +4 -7
- package/dist/verify/chains/ton-cell.js.map +1 -1
- package/dist/verify/chains/ton.d.ts +3 -7
- package/dist/verify/chains/ton.d.ts.map +1 -1
- package/dist/verify/chains/ton.js +1 -3
- package/dist/verify/chains/ton.js.map +1 -1
- package/dist/verify/chains/tron.d.ts +1 -7
- package/dist/verify/chains/tron.d.ts.map +1 -1
- package/dist/verify/chains/tron.js +1 -7
- package/dist/verify/chains/tron.js.map +1 -1
- package/dist/verify/errors.d.ts +6 -8
- package/dist/verify/errors.d.ts.map +1 -1
- package/dist/verify/errors.js +6 -8
- package/dist/verify/errors.js.map +1 -1
- package/dist/verify/index.d.ts +1 -1
- package/dist/verify/index.js +2 -2
- package/dist/verify/index.js.map +1 -1
- package/docs/02-invoices.md +46 -2
- package/docs/04-webhooks.md +2 -1
- package/docs/05-errors.md +24 -4
- package/docs/05-sandbox.md +4 -3
- package/docs/reference/client.md +32 -2
- package/docs/reference/errors.md +13 -2
- package/docs/reference/types.md +5 -4
- package/package.json +1 -1
package/AGENTS.md
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,23 @@ All notable changes to `@txnod/sdk` are documented here. Format: [Keep a Changel
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [1.0.2] - 2026-05-11
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- 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.
|
|
12
|
+
- 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.
|
|
13
|
+
- 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.
|
|
14
|
+
- 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.
|
|
15
|
+
- 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).
|
|
16
|
+
- 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'`.
|
|
17
|
+
- New re-exported types `ClaimByTxRequest`, `ClaimByTxResponse`, `ResolvedFacts`, `ManualClaimFinalityThreshold` from `@txnod/shared`.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- 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.
|
|
22
|
+
- 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.
|
|
23
|
+
|
|
7
24
|
## [1.0.1] - 2026-05-05
|
|
8
25
|
|
|
9
26
|
Initial public release of `@txnod/sdk` — the official TypeScript client for the txnod non-custodial crypto payment gateway.
|
package/dist/_shared/index.d.ts
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
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: "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 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; };
|
|
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 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" | "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; };
|
|
15
15
|
|
|
16
16
|
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
17
|
|
|
@@ -19,19 +19,19 @@ export type CursorPaginatedOrphanPaymentResponse = { items: { id: string; chain:
|
|
|
19
19
|
|
|
20
20
|
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
21
|
|
|
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; };
|
|
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" | "invoice.ambiguous" | undefined; since?: string | undefined; invoice_id?: string | undefined; cursor?: string | undefined; limit?: number | undefined; };
|
|
23
23
|
|
|
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; };
|
|
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" | "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
25
|
|
|
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; };
|
|
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" | "invoice.ambiguous"; project_id: string; invoice_id: string | null; target_url: string | null; created_at: number; created_at_iso: string; };
|
|
27
27
|
|
|
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"; };
|
|
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"; } | { 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
29
|
|
|
30
30
|
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
31
|
|
|
32
32
|
export type WebhookEventMode = "production" | "testnet" | "sandbox";
|
|
33
33
|
|
|
34
|
-
export type WebhookEventType = "invoice.detected" | "invoice.paid" | "invoice.overpaid" | "invoice.partial" | "invoice.expired" | "invoice.expired_paid_late" | "invoice.reverted";
|
|
34
|
+
export type WebhookEventType = "invoice.detected" | "invoice.paid" | "invoice.overpaid" | "invoice.partial" | "invoice.expired" | "invoice.expired_paid_late" | "invoice.reverted" | "invoice.ambiguous";
|
|
35
35
|
|
|
36
36
|
export type RatesQuery = { coins?: string | undefined; };
|
|
37
37
|
|
|
@@ -41,9 +41,9 @@ export type QuoteQuery = { amount_usd: number; coins?: string | undefined; };
|
|
|
41
41
|
|
|
42
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; };
|
|
43
43
|
|
|
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";
|
|
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" | "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";
|
|
45
45
|
|
|
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; };
|
|
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" | "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"; 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
47
|
|
|
48
48
|
export type Chain = "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc";
|
|
49
49
|
|
|
@@ -53,7 +53,7 @@ export type WalletEdgeKind = "production" | "testnet";
|
|
|
53
53
|
|
|
54
54
|
export type ClockAdvance = { chain: "btc" | "eth" | "ada" | "ton" | "tron" | "polygon" | "bsc"; blocks: number; };
|
|
55
55
|
|
|
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; };
|
|
56
|
+
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
57
|
|
|
58
58
|
export type SimulateLatePayment = { amountUnits?: string | undefined; seed?: string | undefined; };
|
|
59
59
|
|
|
@@ -63,6 +63,6 @@ export type SimulatePartial = { fraction?: number | undefined; amountUnits?: str
|
|
|
63
63
|
|
|
64
64
|
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
65
|
|
|
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"];
|
|
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", "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"];
|
|
67
67
|
|
|
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; };
|
|
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; 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; };
|
package/dist/client-sandbox.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ClockAdvance, SimulateEvent, SimulateLatePayment, SimulateOverpaid, SimulatePartial, WalletsListResponse } from './_shared/index.js';
|
|
1
|
+
import type { Chain, ClaimByTxResponse, ClockAdvance, SimulateEvent, SimulateLatePayment, SimulateOverpaid, SimulatePartial, WalletsListResponse } 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
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
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
|
|
@@ -304,6 +304,35 @@ export declare class TxnodClientSandbox {
|
|
|
304
304
|
* ```
|
|
305
305
|
*/
|
|
306
306
|
simulateEvent(invoiceId: string, eventInput: SimulateEvent): Promise<SandboxSimulateResult>;
|
|
307
|
+
/**
|
|
308
|
+
* `POST /api/v1/sandbox/invoices/{invoiceId}/claim-by-tx` — sandbox parity
|
|
309
|
+
* for `client.claimInvoiceByTx`. Skips the real chain-provider lookup and
|
|
310
|
+
* synthesises resolved facts from the invoice itself, so the full manual
|
|
311
|
+
* tx-hash claim lifecycle (auto-attribution, pending-review, rejection)
|
|
312
|
+
* can be exercised without on-chain spend. Response shape is identical to
|
|
313
|
+
* the production endpoint.
|
|
314
|
+
*
|
|
315
|
+
* @example
|
|
316
|
+
* ```ts
|
|
317
|
+
* import { TxnodClient } from '@txnod/sdk';
|
|
318
|
+
*
|
|
319
|
+
* const client = new TxnodClient({
|
|
320
|
+
* projectId: process.env.TXNOD_PROJECT_ID!,
|
|
321
|
+
* apiSecret: process.env.TXNOD_API_SECRET!,
|
|
322
|
+
* environment: 'non-production',
|
|
323
|
+
* });
|
|
324
|
+
*
|
|
325
|
+
* const result = await client.sandbox.simulateClaimByTx(
|
|
326
|
+
* '01HK8MAR2QEXAMPLE000000000',
|
|
327
|
+
* { txHash: '0xabc...def', chain: 'eth' },
|
|
328
|
+
* );
|
|
329
|
+
* console.log(result.status);
|
|
330
|
+
* ```
|
|
331
|
+
*/
|
|
332
|
+
simulateClaimByTx(invoiceId: string, args: {
|
|
333
|
+
txHash: string;
|
|
334
|
+
chain: Chain;
|
|
335
|
+
}): Promise<ClaimByTxResponse>;
|
|
307
336
|
/**
|
|
308
337
|
* `POST /api/v1/sandbox/{projectId}/clock/advance` — bump the
|
|
309
338
|
* `confirmations` counter on every `detected` invoice for the given chain
|
|
@@ -1 +1 @@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,aAAa,GACxB,OAAO,CAAC,qBAAqB,CAAC;IAQjC;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,iBAAiB,CACf,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,KAAK,CAAA;KAAE,GACrC,OAAO,CAAC,iBAAiB,CAAC;IAQ7B;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,YAAY,CACV,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,yBAAyB,CAAC;IAQrC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAQzD;;;;;;;;;;;;;;;;;;OAkBG;IACH,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAQ3D;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAM7D"}
|
package/dist/client-sandbox.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Thin HTTP-wrapper class for the
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
2
|
+
* Thin HTTP-wrapper class for the sandbox-mode endpoints. Constructed lazily
|
|
3
|
+
* by `TxnodClient.sandbox` so unused sandbox code is dead-code-eliminated by
|
|
4
|
+
* the bundler. Methods sign requests with the underlying HMAC scheme, parse
|
|
5
|
+
* RFC 7807 errors into typed sandbox-* error classes, and return JSON-decoded
|
|
6
|
+
* result envelopes.
|
|
7
7
|
*
|
|
8
8
|
* **Do not instantiate this class directly.** Always go through
|
|
9
9
|
* `client.sandbox` so the client's HMAC + retry + telemetry pipeline is
|
|
@@ -334,6 +334,38 @@ export class TxnodClientSandbox {
|
|
|
334
334
|
body: eventInput,
|
|
335
335
|
});
|
|
336
336
|
}
|
|
337
|
+
/**
|
|
338
|
+
* `POST /api/v1/sandbox/invoices/{invoiceId}/claim-by-tx` — sandbox parity
|
|
339
|
+
* for `client.claimInvoiceByTx`. Skips the real chain-provider lookup and
|
|
340
|
+
* synthesises resolved facts from the invoice itself, so the full manual
|
|
341
|
+
* tx-hash claim lifecycle (auto-attribution, pending-review, rejection)
|
|
342
|
+
* can be exercised without on-chain spend. Response shape is identical to
|
|
343
|
+
* the production endpoint.
|
|
344
|
+
*
|
|
345
|
+
* @example
|
|
346
|
+
* ```ts
|
|
347
|
+
* import { TxnodClient } from '@txnod/sdk';
|
|
348
|
+
*
|
|
349
|
+
* const client = new TxnodClient({
|
|
350
|
+
* projectId: process.env.TXNOD_PROJECT_ID!,
|
|
351
|
+
* apiSecret: process.env.TXNOD_API_SECRET!,
|
|
352
|
+
* environment: 'non-production',
|
|
353
|
+
* });
|
|
354
|
+
*
|
|
355
|
+
* const result = await client.sandbox.simulateClaimByTx(
|
|
356
|
+
* '01HK8MAR2QEXAMPLE000000000',
|
|
357
|
+
* { txHash: '0xabc...def', chain: 'eth' },
|
|
358
|
+
* );
|
|
359
|
+
* console.log(result.status);
|
|
360
|
+
* ```
|
|
361
|
+
*/
|
|
362
|
+
simulateClaimByTx(invoiceId, args) {
|
|
363
|
+
return this.#request({
|
|
364
|
+
method: 'POST',
|
|
365
|
+
path: `/api/v1/sandbox/invoices/${invoiceId}/claim-by-tx`,
|
|
366
|
+
body: { tx_hash: args.txHash, chain: args.chain },
|
|
367
|
+
});
|
|
368
|
+
}
|
|
337
369
|
/**
|
|
338
370
|
* `POST /api/v1/sandbox/{projectId}/clock/advance` — bump the
|
|
339
371
|
* `confirmations` counter on every `detected` invoice for the given chain
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-sandbox.js","sourceRoot":"","sources":["../src/client-sandbox.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client-sandbox.js","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;;;;;;;;OAoBG;IACH,WAAW,CAAC,SAAiB;QAC3B,OAAO,IAAI,CAAC,QAAQ,CAAsB;YACxC,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,mBAAmB,SAAS,UAAU;SAC7C,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InvoiceCreateRequest, InvoiceResponse, InvoiceSearchQuery, CursorPaginatedInvoiceResponse, OrphanPaymentListQuery, CursorPaginatedOrphanPaymentResponse, OrphanAttributeRequest, WebhookEventListApiQuery, WebhookEventListResponse, WebhookEventResendResponse, RatesQuery, RatesResponse, QuoteQuery, QuoteResponse } from './_shared/index.js';
|
|
1
|
+
import type { Chain, ClaimByTxResponse, InvoiceCreateRequest, InvoiceResponse, InvoiceSearchQuery, CursorPaginatedInvoiceResponse, OrphanPaymentListQuery, CursorPaginatedOrphanPaymentResponse, OrphanAttributeRequest, WebhookEventListApiQuery, WebhookEventListResponse, WebhookEventResendResponse, RatesQuery, RatesResponse, QuoteQuery, QuoteResponse } from './_shared/index.js';
|
|
2
2
|
import { type SignedFetchRequestLogEntry, type SignedFetchRequestLogger } from './internals/fetch-with-retry.js';
|
|
3
3
|
import { TxnodClientSandbox } from './client-sandbox.js';
|
|
4
4
|
/**
|
|
@@ -93,16 +93,16 @@ export declare class TxnodClient {
|
|
|
93
93
|
lastRequestId: string | undefined;
|
|
94
94
|
constructor(options: TxnodClientOptions);
|
|
95
95
|
/**
|
|
96
|
-
* Lazy accessor for the `client.sandbox.*` namespace exposing
|
|
96
|
+
* Lazy accessor for the `client.sandbox.*` namespace exposing the thin HTTP
|
|
97
97
|
* wrappers around `/api/v1/sandbox/...` endpoints. The namespace class is
|
|
98
98
|
* only constructed on first access — when an integrator never references
|
|
99
99
|
* `client.sandbox`, the bundler's tree-shaker drops the entire
|
|
100
100
|
* `TxnodClientSandbox` class graph from the produced bundle.
|
|
101
101
|
*
|
|
102
102
|
* Methods throw the typed sandbox-specific error classes (e.g.
|
|
103
|
-
* `TxnodSandboxInvoiceTransitionInvalidError`) on 4xx/5xx server responses
|
|
104
|
-
*
|
|
105
|
-
*
|
|
103
|
+
* `TxnodSandboxInvoiceTransitionInvalidError`) on 4xx/5xx server responses.
|
|
104
|
+
* See `docs/05-sandbox.md` in the bundled tarball for the full surface and
|
|
105
|
+
* code examples.
|
|
106
106
|
*
|
|
107
107
|
* @example
|
|
108
108
|
* ```ts
|
|
@@ -279,6 +279,56 @@ export declare class TxnodClient {
|
|
|
279
279
|
* ```
|
|
280
280
|
*/
|
|
281
281
|
cancelInvoice(id: string): Promise<InvoiceResponse>;
|
|
282
|
+
/**
|
|
283
|
+
* Submit a manual tx-hash claim for an open invoice.
|
|
284
|
+
*
|
|
285
|
+
* Forwards an end-customer-submitted tx hash; txnod resolves the tx via the
|
|
286
|
+
* chain provider, verifies sender / recipient / amount / timestamp, and
|
|
287
|
+
* either auto-attributes the tx (response `status: 'auto_attributed'`) or
|
|
288
|
+
* queues the claim for operator review (`pending_review`) — or, when the
|
|
289
|
+
* tx is not yet finalised, returns `pending_finality` and re-checks
|
|
290
|
+
* asynchronously.
|
|
291
|
+
*
|
|
292
|
+
* The two non-auto-attributed rejection paths (`tx_not_found_or_incomplete`
|
|
293
|
+
* and `tx_already_attributed`) are returned in the response body
|
|
294
|
+
* (`status: 'rejected'`, `rejection_reason`) — NOT thrown — so that callers
|
|
295
|
+
* can pattern-match on `response.rejection_reason`. The
|
|
296
|
+
* `manual_claim_rate_limit_exceeded` exhaustion path IS thrown via the
|
|
297
|
+
* standard `TxnodError`.
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* ```ts
|
|
301
|
+
* import { TxnodClient, TxnodError } from '@txnod/sdk';
|
|
302
|
+
*
|
|
303
|
+
* const client = new TxnodClient({
|
|
304
|
+
* projectId: process.env.TXNOD_PROJECT_ID!,
|
|
305
|
+
* apiSecret: process.env.TXNOD_API_SECRET!,
|
|
306
|
+
* });
|
|
307
|
+
*
|
|
308
|
+
* try {
|
|
309
|
+
* const result = await client.claimInvoiceByTx({
|
|
310
|
+
* invoiceId: '01HK8MAR2QEXAMPLE000000000',
|
|
311
|
+
* txHash: '0xabc...def',
|
|
312
|
+
* chain: 'eth',
|
|
313
|
+
* });
|
|
314
|
+
* if (result.status === 'auto_attributed') {
|
|
315
|
+
* console.log('attributed; terminal_status:', result.terminal_status);
|
|
316
|
+
* } else if (result.status === 'rejected') {
|
|
317
|
+
* console.log('rejected:', result.rejection_reason);
|
|
318
|
+
* } else {
|
|
319
|
+
* console.log('queued; status:', result.status);
|
|
320
|
+
* }
|
|
321
|
+
* } catch (err) {
|
|
322
|
+
* if (err instanceof TxnodError) console.error(err.error_code);
|
|
323
|
+
* throw err;
|
|
324
|
+
* }
|
|
325
|
+
* ```
|
|
326
|
+
*/
|
|
327
|
+
claimInvoiceByTx(args: {
|
|
328
|
+
invoiceId: string;
|
|
329
|
+
txHash: string;
|
|
330
|
+
chain: Chain;
|
|
331
|
+
}): Promise<ClaimByTxResponse>;
|
|
282
332
|
/**
|
|
283
333
|
* List on-chain receipts that did not match any invoice address.
|
|
284
334
|
*
|
|
@@ -377,7 +427,7 @@ export declare class TxnodClient {
|
|
|
377
427
|
/**
|
|
378
428
|
* Returns an indicative rate for pre-invoice pricing. The binding rate is
|
|
379
429
|
* captured by `createInvoice` in `rate_snapshot`; any delta between this
|
|
380
|
-
* quote and the invoice is the partner's responsibility
|
|
430
|
+
* quote and the invoice is the partner's responsibility.
|
|
381
431
|
*
|
|
382
432
|
* @example
|
|
383
433
|
* ```ts
|
|
@@ -401,7 +451,7 @@ export declare class TxnodClient {
|
|
|
401
451
|
/**
|
|
402
452
|
* Returns an indicative rate for pre-invoice pricing. The binding rate is
|
|
403
453
|
* captured by `createInvoice` in `rate_snapshot`; any delta between this
|
|
404
|
-
* quote and the invoice is the partner's responsibility
|
|
454
|
+
* quote and the invoice is the partner's responsibility.
|
|
405
455
|
*
|
|
406
456
|
* @example
|
|
407
457
|
* ```ts
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EAClB,8BAA8B,EAC9B,sBAAsB,EACtB,oCAAoC,EACpC,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC1B,UAAU,EACV,aAAa,EACb,UAAU,EACV,aAAa,EACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAGL,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC9B,MAAM,iCAAiC,CAAC;AAWzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAmBzD;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,0BAA0B,CAAC;AAE9D;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,wBAAwB,CAAC;AAE1D,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,aAAa,CAAC,EAAE,kBAAkB,CAAC;IACnC;;;;OAIG;IACH,WAAW,CAAC,EAAE,YAAY,GAAG,gBAAgB,CAAC;IAC9C;;;;;;;;OAQG;IACH,sDAAsD,CAAC,EAAE,OAAO,CAAC;CAClE;AAyDD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,WAAW;;IAq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,GAC3B,OAAO,CAAC,eAAe,CAAC;IAQ3B;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,iBAAiB,CACf,KAAK,EAAE,wBAAwB,GAC9B,OAAO,CAAC,wBAAwB,CAAC;IAUpC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAOxE;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC;IAQnD;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC;CAOvD"}
|
package/dist/client.js
CHANGED
|
@@ -123,16 +123,16 @@ export class TxnodClient {
|
|
|
123
123
|
assertNoTestnetXpubsInProduction(this.#xpubConfig, getSdkEnv(this.#environmentOption));
|
|
124
124
|
}
|
|
125
125
|
/**
|
|
126
|
-
* Lazy accessor for the `client.sandbox.*` namespace exposing
|
|
126
|
+
* Lazy accessor for the `client.sandbox.*` namespace exposing the thin HTTP
|
|
127
127
|
* wrappers around `/api/v1/sandbox/...` endpoints. The namespace class is
|
|
128
128
|
* only constructed on first access — when an integrator never references
|
|
129
129
|
* `client.sandbox`, the bundler's tree-shaker drops the entire
|
|
130
130
|
* `TxnodClientSandbox` class graph from the produced bundle.
|
|
131
131
|
*
|
|
132
132
|
* Methods throw the typed sandbox-specific error classes (e.g.
|
|
133
|
-
* `TxnodSandboxInvoiceTransitionInvalidError`) on 4xx/5xx server responses
|
|
134
|
-
*
|
|
135
|
-
*
|
|
133
|
+
* `TxnodSandboxInvoiceTransitionInvalidError`) on 4xx/5xx server responses.
|
|
134
|
+
* See `docs/05-sandbox.md` in the bundled tarball for the full surface and
|
|
135
|
+
* code examples.
|
|
136
136
|
*
|
|
137
137
|
* @example
|
|
138
138
|
* ```ts
|
|
@@ -403,6 +403,58 @@ export class TxnodClient {
|
|
|
403
403
|
path: `/api/v1/invoices/${id}/cancel`,
|
|
404
404
|
});
|
|
405
405
|
}
|
|
406
|
+
/**
|
|
407
|
+
* Submit a manual tx-hash claim for an open invoice.
|
|
408
|
+
*
|
|
409
|
+
* Forwards an end-customer-submitted tx hash; txnod resolves the tx via the
|
|
410
|
+
* chain provider, verifies sender / recipient / amount / timestamp, and
|
|
411
|
+
* either auto-attributes the tx (response `status: 'auto_attributed'`) or
|
|
412
|
+
* queues the claim for operator review (`pending_review`) — or, when the
|
|
413
|
+
* tx is not yet finalised, returns `pending_finality` and re-checks
|
|
414
|
+
* asynchronously.
|
|
415
|
+
*
|
|
416
|
+
* The two non-auto-attributed rejection paths (`tx_not_found_or_incomplete`
|
|
417
|
+
* and `tx_already_attributed`) are returned in the response body
|
|
418
|
+
* (`status: 'rejected'`, `rejection_reason`) — NOT thrown — so that callers
|
|
419
|
+
* can pattern-match on `response.rejection_reason`. The
|
|
420
|
+
* `manual_claim_rate_limit_exceeded` exhaustion path IS thrown via the
|
|
421
|
+
* standard `TxnodError`.
|
|
422
|
+
*
|
|
423
|
+
* @example
|
|
424
|
+
* ```ts
|
|
425
|
+
* import { TxnodClient, TxnodError } from '@txnod/sdk';
|
|
426
|
+
*
|
|
427
|
+
* const client = new TxnodClient({
|
|
428
|
+
* projectId: process.env.TXNOD_PROJECT_ID!,
|
|
429
|
+
* apiSecret: process.env.TXNOD_API_SECRET!,
|
|
430
|
+
* });
|
|
431
|
+
*
|
|
432
|
+
* try {
|
|
433
|
+
* const result = await client.claimInvoiceByTx({
|
|
434
|
+
* invoiceId: '01HK8MAR2QEXAMPLE000000000',
|
|
435
|
+
* txHash: '0xabc...def',
|
|
436
|
+
* chain: 'eth',
|
|
437
|
+
* });
|
|
438
|
+
* if (result.status === 'auto_attributed') {
|
|
439
|
+
* console.log('attributed; terminal_status:', result.terminal_status);
|
|
440
|
+
* } else if (result.status === 'rejected') {
|
|
441
|
+
* console.log('rejected:', result.rejection_reason);
|
|
442
|
+
* } else {
|
|
443
|
+
* console.log('queued; status:', result.status);
|
|
444
|
+
* }
|
|
445
|
+
* } catch (err) {
|
|
446
|
+
* if (err instanceof TxnodError) console.error(err.error_code);
|
|
447
|
+
* throw err;
|
|
448
|
+
* }
|
|
449
|
+
* ```
|
|
450
|
+
*/
|
|
451
|
+
claimInvoiceByTx(args) {
|
|
452
|
+
return this.#request({
|
|
453
|
+
method: 'POST',
|
|
454
|
+
path: `/api/v1/invoices/${args.invoiceId}/claim-by-tx`,
|
|
455
|
+
body: { tx_hash: args.txHash, chain: args.chain },
|
|
456
|
+
});
|
|
457
|
+
}
|
|
406
458
|
/**
|
|
407
459
|
* List on-chain receipts that did not match any invoice address.
|
|
408
460
|
*
|
|
@@ -524,7 +576,7 @@ export class TxnodClient {
|
|
|
524
576
|
/**
|
|
525
577
|
* Returns an indicative rate for pre-invoice pricing. The binding rate is
|
|
526
578
|
* captured by `createInvoice` in `rate_snapshot`; any delta between this
|
|
527
|
-
* quote and the invoice is the partner's responsibility
|
|
579
|
+
* quote and the invoice is the partner's responsibility.
|
|
528
580
|
*
|
|
529
581
|
* @example
|
|
530
582
|
* ```ts
|
|
@@ -554,7 +606,7 @@ export class TxnodClient {
|
|
|
554
606
|
/**
|
|
555
607
|
* Returns an indicative rate for pre-invoice pricing. The binding rate is
|
|
556
608
|
* captured by `createInvoice` in `rate_snapshot`; any delta between this
|
|
557
|
-
* quote and the invoice is the partner's responsibility
|
|
609
|
+
* quote and the invoice is the partner's responsibility.
|
|
558
610
|
*
|
|
559
611
|
* @example
|
|
560
612
|
* ```ts
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,WAAW,GAIZ,MAAM,iCAAiC,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