tapimo 0.7.0 → 0.7.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/dist/ApiKeys.d.ts +24 -7
- package/dist/ApiKeys.d.ts.map +1 -1
- package/dist/ApiKeys.js +17 -5
- package/dist/ApiKeys.js.map +1 -1
- package/dist/App.d.ts +12104 -7861
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +191 -128
- package/dist/App.js.map +1 -1
- package/dist/Assets.d.ts +10 -0
- package/dist/Assets.d.ts.map +1 -1
- package/dist/Assets.js +17 -4
- package/dist/Assets.js.map +1 -1
- package/dist/Scope.d.ts +19 -8
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +25 -9
- package/dist/Scope.js.map +1 -1
- package/dist/Webhooks.d.ts +1 -1
- package/dist/admin/App.d.ts +601 -20
- package/dist/admin/App.d.ts.map +1 -1
- package/dist/admin/App.js +12 -2
- package/dist/admin/App.js.map +1 -1
- package/dist/admin/apps/api-keys.d.ts +94 -11
- package/dist/admin/apps/api-keys.d.ts.map +1 -1
- package/dist/admin/apps/api-keys.js +141 -32
- package/dist/admin/apps/api-keys.js.map +1 -1
- package/dist/admin/apps/earn-vaults.d.ts +1069 -0
- package/dist/admin/apps/earn-vaults.d.ts.map +1 -0
- package/dist/admin/apps/earn-vaults.js +409 -0
- package/dist/admin/apps/earn-vaults.js.map +1 -0
- package/dist/admin/apps/verified-tokens.d.ts +166 -166
- package/dist/admin/ui.generated.d.ts +1 -1
- package/dist/admin/ui.generated.d.ts.map +1 -1
- package/dist/admin/ui.generated.js +151 -95
- package/dist/admin/ui.generated.js.map +1 -1
- package/dist/analytics/Analytics.d.ts +2 -0
- package/dist/analytics/Analytics.d.ts.map +1 -1
- package/dist/analytics/Analytics.js +18 -2
- package/dist/analytics/Analytics.js.map +1 -1
- package/dist/analytics/tables/requestEvents.d.ts +22 -1
- package/dist/analytics/tables/requestEvents.d.ts.map +1 -1
- package/dist/analytics/tables/requestEvents.js +59 -39
- package/dist/analytics/tables/requestEvents.js.map +1 -1
- package/dist/apps/Zones.d.ts +8335 -0
- package/dist/apps/Zones.d.ts.map +1 -0
- package/dist/apps/Zones.js +38 -0
- package/dist/apps/Zones.js.map +1 -0
- package/dist/apps/data/App.d.ts +14377 -10165
- package/dist/apps/data/App.d.ts.map +1 -1
- package/dist/apps/data/App.js +91 -19
- package/dist/apps/data/App.js.map +1 -1
- package/dist/apps/data/FxOracle.d.ts +1 -1
- package/dist/apps/data/FxOracle.d.ts.map +1 -1
- package/dist/apps/data/index.d.ts +0 -1
- package/dist/apps/data/index.d.ts.map +1 -1
- package/dist/apps/data/index.js +0 -1
- package/dist/apps/data/index.js.map +1 -1
- package/dist/apps/data/routes/activities.d.ts +32 -32
- package/dist/apps/data/routes/activities.d.ts.map +1 -1
- package/dist/apps/data/routes/activities.js +130 -65
- package/dist/apps/data/routes/activities.js.map +1 -1
- package/dist/apps/data/routes/addresses.d.ts +312 -312
- package/dist/apps/data/routes/balances.d.ts +18 -18
- package/dist/apps/data/routes/balances.js +5 -5
- package/dist/apps/data/routes/balances.js.map +1 -1
- package/dist/apps/data/routes/coingecko.d.ts +176 -176
- package/dist/apps/data/routes/coingecko.d.ts.map +1 -1
- package/dist/apps/data/routes/coingecko.js +62 -35
- package/dist/apps/data/routes/coingecko.js.map +1 -1
- package/dist/apps/data/routes/earn.d.ts +2144 -0
- package/dist/apps/data/routes/earn.d.ts.map +1 -0
- package/dist/apps/data/routes/earn.js +947 -0
- package/dist/apps/data/routes/earn.js.map +1 -0
- package/dist/apps/data/routes/exchanges.d.ts +1231 -324
- package/dist/apps/data/routes/exchanges.d.ts.map +1 -1
- package/dist/apps/data/routes/exchanges.js +656 -193
- package/dist/apps/data/routes/exchanges.js.map +1 -1
- package/dist/apps/data/routes/fee-amm.d.ts.map +1 -1
- package/dist/apps/data/routes/fee-amm.js +59 -8
- package/dist/apps/data/routes/fee-amm.js.map +1 -1
- package/dist/apps/data/routes/funding.d.ts +4092 -387
- package/dist/apps/data/routes/funding.d.ts.map +1 -1
- package/dist/apps/data/routes/funding.js +1403 -256
- package/dist/apps/data/routes/funding.js.map +1 -1
- package/dist/apps/data/routes/indexer.d.ts +5 -5
- package/dist/apps/data/routes/indexer.d.ts.map +1 -1
- package/dist/apps/data/routes/indexer.js +19 -2
- package/dist/apps/data/routes/indexer.js.map +1 -1
- package/dist/apps/data/routes/receipts.d.ts +265 -265
- package/dist/apps/data/routes/receipts.d.ts.map +1 -1
- package/dist/apps/data/routes/receipts.js +11 -11
- package/dist/apps/data/routes/receipts.js.map +1 -1
- package/dist/apps/data/routes/rpc.d.ts +5 -5
- package/dist/apps/data/routes/rpc.d.ts.map +1 -1
- package/dist/apps/data/routes/rpc.js +211 -22
- package/dist/apps/data/routes/rpc.js.map +1 -1
- package/dist/apps/data/routes/tokenlist.d.ts +36 -36
- package/dist/apps/data/routes/tokenlist.d.ts.map +1 -1
- package/dist/apps/data/routes/tokenlist.js +49 -9
- package/dist/apps/data/routes/tokenlist.js.map +1 -1
- package/dist/apps/data/routes/tokens.d.ts +116 -88
- package/dist/apps/data/routes/tokens.d.ts.map +1 -1
- package/dist/apps/data/routes/tokens.js +198 -91
- package/dist/apps/data/routes/tokens.js.map +1 -1
- package/dist/apps/data/routes/transactions.d.ts +55 -55
- package/dist/apps/data/routes/transactions.d.ts.map +1 -1
- package/dist/apps/data/routes/transactions.js +78 -39
- package/dist/apps/data/routes/transactions.js.map +1 -1
- package/dist/apps/data/routes/transfers.d.ts +78 -29
- package/dist/apps/data/routes/transfers.d.ts.map +1 -1
- package/dist/apps/data/routes/transfers.js +165 -67
- package/dist/apps/data/routes/transfers.js.map +1 -1
- package/dist/apps/data/routes/valuation.d.ts +10 -10
- package/dist/apps/data/routes/valuation.js +2 -2
- package/dist/apps/data/routes/valuation.js.map +1 -1
- package/dist/apps/data/routes/verified-tokens.d.ts.map +1 -1
- package/dist/apps/data/routes/verified-tokens.js +34 -9
- package/dist/apps/data/routes/verified-tokens.js.map +1 -1
- package/dist/apps/data/routes/webhooks.d.ts +5 -3
- package/dist/apps/data/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/data/routes/webhooks.js +175 -65
- package/dist/apps/data/routes/webhooks.js.map +1 -1
- package/dist/apps/data/routes/zones.d.ts +281 -0
- package/dist/apps/data/routes/zones.d.ts.map +1 -0
- package/dist/apps/data/routes/zones.js +252 -0
- package/dist/apps/data/routes/zones.js.map +1 -0
- package/dist/apps/docs/reference.js +6 -5
- package/dist/apps/docs/reference.js.map +1 -1
- package/dist/apps/index.d.ts +2 -1
- package/dist/apps/index.d.ts.map +1 -1
- package/dist/apps/index.js +2 -1
- package/dist/apps/index.js.map +1 -1
- package/dist/apps/management/App.d.ts +670 -670
- package/dist/apps/management/Billing.d.ts +8 -0
- package/dist/apps/management/Billing.d.ts.map +1 -1
- package/dist/apps/management/Billing.js +12 -0
- package/dist/apps/management/Billing.js.map +1 -1
- package/dist/apps/management/Error.d.ts +12 -0
- package/dist/apps/management/Error.d.ts.map +1 -0
- package/dist/apps/management/Error.js +10 -0
- package/dist/apps/management/Error.js.map +1 -0
- package/dist/apps/management/routes/api-keys.d.ts +5 -5
- package/dist/apps/management/routes/api-keys.d.ts.map +1 -1
- package/dist/apps/management/routes/api-keys.js +2 -8
- package/dist/apps/management/routes/api-keys.js.map +1 -1
- package/dist/apps/management/routes/billing.d.ts +119 -119
- package/dist/apps/management/routes/faucet.d.ts +35 -35
- package/dist/apps/management/routes/invitations.d.ts +62 -62
- package/dist/apps/management/routes/invitations.d.ts.map +1 -1
- package/dist/apps/management/routes/invitations.js +4 -10
- package/dist/apps/management/routes/invitations.js.map +1 -1
- package/dist/apps/management/routes/invite-links.d.ts +30 -30
- package/dist/apps/management/routes/me.d.ts +6 -6
- package/dist/apps/management/routes/members.d.ts +78 -78
- package/dist/apps/management/routes/orgs.d.ts +48 -48
- package/dist/apps/management/routes/orgs.d.ts.map +1 -1
- package/dist/apps/management/routes/orgs.js +2 -8
- package/dist/apps/management/routes/orgs.js.map +1 -1
- package/dist/apps/management/routes/projects.d.ts +9 -9
- package/dist/apps/management/routes/scopes.js +2 -2
- package/dist/apps/management/routes/scopes.js.map +1 -1
- package/dist/apps/management/routes/usage.d.ts +80 -80
- package/dist/apps/management/routes/verified-token-requests.d.ts +36 -36
- package/dist/apps/management/routes/webhooks.d.ts +50 -50
- package/dist/apps/management/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/management/routes/webhooks.js +15 -3
- package/dist/apps/management/routes/webhooks.js.map +1 -1
- package/dist/apps/mpp/App.d.ts +55 -56
- package/dist/apps/mpp/App.d.ts.map +1 -1
- package/dist/apps/mpp/App.js +192 -27
- package/dist/apps/mpp/App.js.map +1 -1
- package/dist/apps/mpp/Mpp.d.ts +0 -20
- package/dist/apps/mpp/Mpp.d.ts.map +1 -1
- package/dist/apps/mpp/Mpp.js +0 -24
- package/dist/apps/mpp/Mpp.js.map +1 -1
- package/dist/apps/mpp/internal/Adapter.d.ts +40 -0
- package/dist/apps/mpp/internal/Adapter.d.ts.map +1 -0
- package/dist/apps/mpp/internal/Adapter.js +66 -0
- package/dist/apps/mpp/internal/Adapter.js.map +1 -0
- package/dist/apps/mpp/internal/Error.d.ts +4 -0
- package/dist/apps/mpp/internal/Error.d.ts.map +1 -0
- package/dist/apps/mpp/internal/Error.js +41 -0
- package/dist/apps/mpp/internal/Error.js.map +1 -0
- package/dist/apps/mpp/internal/Idempotency.d.ts +33 -0
- package/dist/apps/mpp/internal/Idempotency.d.ts.map +1 -0
- package/dist/apps/mpp/internal/Idempotency.js +28 -0
- package/dist/apps/mpp/internal/Idempotency.js.map +1 -0
- package/dist/apps/mpp/internal/Policy.d.ts +46 -0
- package/dist/apps/mpp/internal/Policy.d.ts.map +1 -0
- package/dist/apps/mpp/internal/Policy.js +57 -0
- package/dist/apps/mpp/internal/Policy.js.map +1 -0
- package/dist/apps/mpp/internal/ScreenManager.d.ts +27 -0
- package/dist/apps/mpp/internal/ScreenManager.d.ts.map +1 -0
- package/dist/apps/mpp/internal/ScreenManager.js +18 -0
- package/dist/apps/mpp/internal/ScreenManager.js.map +1 -0
- package/dist/apps/mpp/internal/Screening.d.ts +35 -0
- package/dist/apps/mpp/internal/Screening.d.ts.map +1 -0
- package/dist/apps/mpp/internal/Screening.js +20 -0
- package/dist/apps/mpp/internal/Screening.js.map +1 -0
- package/dist/apps/mpp/internal/Sponsorship.d.ts +36 -0
- package/dist/apps/mpp/internal/Sponsorship.d.ts.map +1 -0
- package/dist/apps/mpp/internal/Sponsorship.js +103 -0
- package/dist/apps/mpp/internal/Sponsorship.js.map +1 -0
- package/dist/apps/mpp/internal/Utils.d.ts +7 -0
- package/dist/apps/mpp/internal/Utils.d.ts.map +1 -0
- package/dist/apps/mpp/internal/Utils.js +24 -0
- package/dist/apps/mpp/internal/Utils.js.map +1 -0
- package/dist/apps/relay/App.js +184 -24
- package/dist/apps/relay/App.js.map +1 -1
- package/dist/apps/relay/Sponsorships.d.ts +4 -0
- package/dist/apps/relay/Sponsorships.d.ts.map +1 -1
- package/dist/apps/relay/Sponsorships.js +16 -7
- package/dist/apps/relay/Sponsorships.js.map +1 -1
- package/dist/db/Db.d.ts +20 -0
- package/dist/db/Db.d.ts.map +1 -1
- package/dist/db/Db.js +342 -0
- package/dist/db/Db.js.map +1 -1
- package/dist/db/Schema.d.ts +921 -1
- package/dist/db/Schema.d.ts.map +1 -1
- package/dist/db/Schema.js +269 -1
- package/dist/db/Schema.js.map +1 -1
- package/dist/db/tables/earnVaults.d.ts +68 -0
- package/dist/db/tables/earnVaults.d.ts.map +1 -0
- package/dist/db/tables/earnVaults.js +72 -0
- package/dist/db/tables/earnVaults.js.map +1 -0
- package/dist/db/tables/fundingCatalog.d.ts +56 -0
- package/dist/db/tables/fundingCatalog.d.ts.map +1 -0
- package/dist/db/tables/fundingCatalog.js +85 -0
- package/dist/db/tables/fundingCatalog.js.map +1 -0
- package/dist/db/tables/fundingDepositAddresses.d.ts +159 -0
- package/dist/db/tables/fundingDepositAddresses.d.ts.map +1 -0
- package/dist/db/tables/fundingDepositAddresses.js +206 -0
- package/dist/db/tables/fundingDepositAddresses.js.map +1 -0
- package/dist/db/tables/fundingDeposits.d.ts +115 -0
- package/dist/db/tables/fundingDeposits.d.ts.map +1 -0
- package/dist/db/tables/fundingDeposits.js +100 -0
- package/dist/db/tables/fundingDeposits.js.map +1 -0
- package/dist/db/tables/fundingIdempotency.d.ts +91 -0
- package/dist/db/tables/fundingIdempotency.d.ts.map +1 -0
- package/dist/db/tables/fundingIdempotency.js +103 -0
- package/dist/db/tables/fundingIdempotency.js.map +1 -0
- package/dist/db/tables/fundingTransferEvents.d.ts +12 -0
- package/dist/db/tables/fundingTransferEvents.d.ts.map +1 -0
- package/dist/db/tables/fundingTransferEvents.js +18 -0
- package/dist/db/tables/fundingTransferEvents.js.map +1 -0
- package/dist/db/tables/fundingTransferTransactions.d.ts +15 -0
- package/dist/db/tables/fundingTransferTransactions.d.ts.map +1 -0
- package/dist/db/tables/fundingTransferTransactions.js +27 -0
- package/dist/db/tables/fundingTransferTransactions.js.map +1 -0
- package/dist/db/tables/fundingTransfers.d.ts +82 -0
- package/dist/db/tables/fundingTransfers.d.ts.map +1 -0
- package/dist/db/tables/fundingTransfers.js +89 -0
- package/dist/db/tables/fundingTransfers.js.map +1 -0
- package/dist/db/tables/organizations.d.ts +8 -0
- package/dist/db/tables/organizations.d.ts.map +1 -1
- package/dist/db/tables/organizations.js +35 -0
- package/dist/db/tables/organizations.js.map +1 -1
- package/dist/db/tables/projects.d.ts +8 -0
- package/dist/db/tables/projects.d.ts.map +1 -1
- package/dist/db/tables/projects.js +16 -0
- package/dist/db/tables/projects.js.map +1 -1
- package/dist/db/tables/requestUsage.d.ts +13 -0
- package/dist/db/tables/requestUsage.d.ts.map +1 -1
- package/dist/db/tables/requestUsage.js +16 -0
- package/dist/db/tables/requestUsage.js.map +1 -1
- package/dist/db/tables/sponsoredTransactions.d.ts +4 -2
- package/dist/db/tables/sponsoredTransactions.d.ts.map +1 -1
- package/dist/db/tables/sponsoredTransactions.js +14 -4
- package/dist/db/tables/sponsoredTransactions.js.map +1 -1
- package/dist/db/tables/users.d.ts +8 -0
- package/dist/db/tables/users.d.ts.map +1 -1
- package/dist/db/tables/users.js +16 -0
- package/dist/db/tables/users.js.map +1 -1
- package/dist/db/tables/verifiedTokens.d.ts +14 -7
- package/dist/db/tables/verifiedTokens.d.ts.map +1 -1
- package/dist/db/tables/verifiedTokens.js +9 -7
- package/dist/db/tables/verifiedTokens.js.map +1 -1
- package/dist/db/tables/webhookSubscriptions.d.ts +31 -1
- package/dist/db/tables/webhookSubscriptions.d.ts.map +1 -1
- package/dist/db/tables/webhookSubscriptions.js +24 -3
- package/dist/db/tables/webhookSubscriptions.js.map +1 -1
- package/dist/handlers/relay.js +108 -108
- package/dist/handlers/relay.js.map +1 -1
- package/dist/internal/Auth.d.ts +26 -0
- package/dist/internal/Auth.d.ts.map +1 -1
- package/dist/internal/Auth.js +35 -2
- package/dist/internal/Auth.js.map +1 -1
- package/dist/internal/Cache.d.ts.map +1 -1
- package/dist/internal/Cache.js +16 -10
- package/dist/internal/Cache.js.map +1 -1
- package/dist/internal/Cursor.js +1 -1
- package/dist/internal/Cursor.js.map +1 -1
- package/dist/internal/EarnRates.d.ts +89 -0
- package/dist/internal/EarnRates.d.ts.map +1 -0
- package/dist/internal/EarnRates.js +266 -0
- package/dist/internal/EarnRates.js.map +1 -0
- package/dist/internal/EarnVaults.d.ts +171 -0
- package/dist/internal/EarnVaults.d.ts.map +1 -0
- package/dist/internal/EarnVaults.js +547 -0
- package/dist/internal/EarnVaults.js.map +1 -0
- package/dist/internal/EdgeCache.d.ts +9 -2
- package/dist/internal/EdgeCache.d.ts.map +1 -1
- package/dist/internal/EdgeCache.js +36 -9
- package/dist/internal/EdgeCache.js.map +1 -1
- package/dist/internal/Id.d.ts +11 -0
- package/dist/internal/Id.d.ts.map +1 -1
- package/dist/internal/Id.js +13 -0
- package/dist/internal/Id.js.map +1 -1
- package/dist/internal/Idempotency.d.ts +83 -0
- package/dist/internal/Idempotency.d.ts.map +1 -0
- package/dist/internal/Idempotency.js +113 -0
- package/dist/internal/Idempotency.js.map +1 -0
- package/dist/internal/Log.d.ts +64 -9
- package/dist/internal/Log.d.ts.map +1 -1
- package/dist/internal/Log.js +29 -7
- package/dist/internal/Log.js.map +1 -1
- package/dist/internal/MetricSink.d.ts.map +1 -1
- package/dist/internal/MetricSink.js +47 -1
- package/dist/internal/MetricSink.js.map +1 -1
- package/dist/internal/OpenApi.d.ts +1 -1
- package/dist/internal/OpenApi.d.ts.map +1 -1
- package/dist/internal/OpenApi.js +3 -0
- package/dist/internal/OpenApi.js.map +1 -1
- package/dist/internal/Provider.d.ts +14 -0
- package/dist/internal/Provider.d.ts.map +1 -0
- package/dist/internal/Provider.js +5 -0
- package/dist/internal/Provider.js.map +1 -0
- package/dist/internal/Schema.d.ts +8 -3
- package/dist/internal/Schema.d.ts.map +1 -1
- package/dist/internal/Schema.js +24 -13
- package/dist/internal/Schema.js.map +1 -1
- package/dist/internal/Store.d.ts +6 -0
- package/dist/internal/Store.d.ts.map +1 -1
- package/dist/internal/Store.js +35 -0
- package/dist/internal/Store.js.map +1 -1
- package/dist/internal/Tidx.d.ts +43 -24
- package/dist/internal/Tidx.d.ts.map +1 -1
- package/dist/internal/Tidx.js +79 -11
- package/dist/internal/Tidx.js.map +1 -1
- package/dist/internal/Viem.d.ts +82 -65
- package/dist/internal/Viem.d.ts.map +1 -1
- package/dist/internal/Viem.js +83 -12
- package/dist/internal/Viem.js.map +1 -1
- package/dist/internal/WebhookDestination.d.ts.map +1 -1
- package/dist/internal/WebhookDestination.js +34 -28
- package/dist/internal/WebhookDestination.js.map +1 -1
- package/dist/internal/Webhooks.d.ts +9 -0
- package/dist/internal/Webhooks.d.ts.map +1 -1
- package/dist/internal/Webhooks.js +15 -10
- package/dist/internal/Webhooks.js.map +1 -1
- package/dist/internal/exchange/Provider.d.ts +219 -0
- package/dist/internal/exchange/Provider.d.ts.map +1 -0
- package/dist/internal/exchange/Provider.js +117 -0
- package/dist/internal/exchange/Provider.js.map +1 -0
- package/dist/internal/exchange/index.d.ts +2 -0
- package/dist/internal/exchange/index.d.ts.map +1 -0
- package/dist/internal/exchange/index.js +2 -0
- package/dist/internal/exchange/index.js.map +1 -0
- package/dist/internal/exchange/providers/uniswap.d.ts +57 -0
- package/dist/internal/exchange/providers/uniswap.d.ts.map +1 -0
- package/dist/internal/exchange/providers/uniswap.js +553 -0
- package/dist/internal/exchange/providers/uniswap.js.map +1 -0
- package/dist/internal/funding/Action.d.ts +55 -0
- package/dist/internal/funding/Action.d.ts.map +1 -0
- package/dist/internal/funding/Action.js +74 -0
- package/dist/internal/funding/Action.js.map +1 -0
- package/dist/internal/funding/Catalog.d.ts +107 -0
- package/dist/internal/funding/Catalog.d.ts.map +1 -0
- package/dist/internal/funding/Catalog.js +270 -0
- package/dist/internal/funding/Catalog.js.map +1 -0
- package/dist/internal/funding/Chain.d.ts +76 -0
- package/dist/internal/funding/Chain.d.ts.map +1 -0
- package/dist/internal/funding/Chain.js +38 -0
- package/dist/internal/funding/Chain.js.map +1 -0
- package/dist/internal/funding/Deposit.d.ts +366 -0
- package/dist/internal/funding/Deposit.d.ts.map +1 -0
- package/dist/internal/funding/Deposit.js +286 -0
- package/dist/internal/funding/Deposit.js.map +1 -0
- package/dist/internal/funding/DepositAddress.d.ts +345 -0
- package/dist/internal/funding/DepositAddress.d.ts.map +1 -0
- package/dist/internal/funding/DepositAddress.js +189 -0
- package/dist/internal/funding/DepositAddress.js.map +1 -0
- package/dist/internal/funding/Evidence.d.ts +52 -0
- package/dist/internal/funding/Evidence.d.ts.map +1 -0
- package/dist/internal/funding/Evidence.js +314 -0
- package/dist/internal/funding/Evidence.js.map +1 -0
- package/dist/internal/funding/Provider.d.ts +1186 -0
- package/dist/internal/funding/Provider.d.ts.map +1 -0
- package/dist/internal/funding/Provider.js +1081 -0
- package/dist/internal/funding/Provider.js.map +1 -0
- package/dist/internal/funding/Reconciliation.d.ts +113 -0
- package/dist/internal/funding/Reconciliation.d.ts.map +1 -0
- package/dist/internal/funding/Reconciliation.js +676 -0
- package/dist/internal/funding/Reconciliation.js.map +1 -0
- package/dist/internal/funding/Route.d.ts +21 -0
- package/dist/internal/funding/Route.d.ts.map +1 -0
- package/dist/internal/funding/Route.js +5 -0
- package/dist/internal/funding/Route.js.map +1 -0
- package/dist/internal/funding/Subsidy.d.ts +113 -0
- package/dist/internal/funding/Subsidy.d.ts.map +1 -0
- package/dist/internal/funding/Subsidy.js +138 -0
- package/dist/internal/funding/Subsidy.js.map +1 -0
- package/dist/internal/funding/Token.d.ts +41 -0
- package/dist/internal/funding/Token.d.ts.map +1 -0
- package/dist/internal/funding/Token.js +22 -0
- package/dist/internal/funding/Token.js.map +1 -0
- package/dist/internal/funding/Transfer.d.ts +643 -0
- package/dist/internal/funding/Transfer.d.ts.map +1 -0
- package/dist/internal/funding/Transfer.js +332 -0
- package/dist/internal/funding/Transfer.js.map +1 -0
- package/dist/internal/funding/index.d.ts +13 -0
- package/dist/internal/funding/index.d.ts.map +1 -0
- package/dist/internal/funding/index.js +13 -0
- package/dist/internal/funding/index.js.map +1 -0
- package/dist/internal/funding/providers/across.d.ts +21 -0
- package/dist/internal/funding/providers/across.d.ts.map +1 -0
- package/dist/internal/funding/providers/across.js +117 -0
- package/dist/internal/funding/providers/across.js.map +1 -0
- package/dist/internal/funding/providers/relay.d.ts +46 -0
- package/dist/internal/funding/providers/relay.d.ts.map +1 -0
- package/dist/internal/funding/providers/relay.js +464 -0
- package/dist/internal/funding/providers/relay.js.map +1 -0
- package/dist/internal/funding/providers/rhino.d.ts +15 -0
- package/dist/internal/funding/providers/rhino.d.ts.map +1 -0
- package/dist/internal/funding/providers/rhino.js +116 -0
- package/dist/internal/funding/providers/rhino.js.map +1 -0
- package/dist/internal/funding/providers/squid.d.ts +19 -0
- package/dist/internal/funding/providers/squid.d.ts.map +1 -0
- package/dist/internal/funding/providers/squid.js +120 -0
- package/dist/internal/funding/providers/squid.js.map +1 -0
- package/dist/internal/funding/providers/symbiosis.d.ts +20 -0
- package/dist/internal/funding/providers/symbiosis.d.ts.map +1 -0
- package/dist/internal/funding/providers/symbiosis.js +176 -0
- package/dist/internal/funding/providers/symbiosis.js.map +1 -0
- package/dist/internal/index.d.ts +5 -1
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +5 -1
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/webhookDestinations/url.js +61 -57
- package/dist/internal/webhookDestinations/url.js.map +1 -1
- package/dist/providers/index.d.ts +43 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +19 -0
- package/dist/providers/index.js.map +1 -0
- package/package.json +9 -4
- package/src/ApiKeys.test.ts +11 -7
- package/src/ApiKeys.ts +37 -9
- package/src/App.test.ts +85 -10
- package/src/App.ts +224 -137
- package/src/Assets.ts +29 -4
- package/src/Client.test-d.ts +650 -30
- package/src/Scope.test.ts +19 -0
- package/src/Scope.ts +28 -11
- package/src/Webhooks.test.ts +25 -0
- package/src/Webhooks.ts +1 -1
- package/src/admin/App.test.ts +9 -2
- package/src/admin/App.ts +32 -9
- package/src/admin/apps/api-keys.test.ts +167 -23
- package/src/admin/apps/api-keys.ts +166 -28
- package/src/admin/apps/earn-vaults.test.ts +338 -0
- package/src/admin/apps/earn-vaults.ts +572 -0
- package/src/admin/apps/scopes.test.ts +16 -1
- package/src/admin/ui/plugin.ts +2 -2
- package/src/admin/ui/src/components/EarnVaultForm.tsx +137 -0
- package/src/admin/ui/src/components/MobileProfile.tsx +2 -2
- package/src/admin/ui/src/components/Page.tsx +1 -1
- package/src/admin/ui/src/components/ThemeToggle.tsx +1 -1
- package/src/admin/ui/src/lib/api-keys.ts +37 -7
- package/src/admin/ui/src/lib/client.ts +1 -1
- package/src/admin/ui/src/lib/config.ts +1 -1
- package/src/admin/ui/src/lib/early-access.ts +8 -9
- package/src/admin/ui/src/lib/earn-vaults.ts +207 -0
- package/src/admin/ui/src/lib/format.ts +13 -0
- package/src/admin/ui/src/lib/organizations.test.ts +14 -4
- package/src/admin/ui/src/lib/organizations.ts +7 -1
- package/src/admin/ui/src/lib/response.ts +22 -0
- package/src/admin/ui/src/lib/scopes.test.ts +19 -11
- package/src/admin/ui/src/lib/scopes.ts +28 -7
- package/src/admin/ui/src/lib/verified-tokens.ts +10 -9
- package/src/admin/ui/src/routeTree.gen.ts +70 -7
- package/src/admin/ui/src/router.tsx +2 -2
- package/src/admin/ui/src/routes/__root.tsx +9 -8
- package/src/admin/ui/src/routes/api-keys.tsx +475 -64
- package/src/admin/ui/src/routes/early-access.tsx +5 -12
- package/src/admin/ui/src/routes/earn.vaults.tsx +348 -0
- package/src/admin/ui/src/routes/earn.vaults_.$vaultId.edit.tsx +154 -0
- package/src/admin/ui/src/routes/earn.vaults_.new.tsx +190 -0
- package/src/admin/ui/src/routes/organizations.tsx +4 -7
- package/src/admin/ui/src/routes/organizations_.$orgId.tsx +56 -54
- package/src/admin/ui/src/routes/verified-tokens.tsx +4 -4
- package/src/admin/ui/vite.config.ts +4 -1
- package/src/admin/ui.generated.ts +189 -95
- package/src/analytics/Analytics.test.ts +69 -10
- package/src/analytics/Analytics.ts +20 -1
- package/src/analytics/tables/requestEvents.ts +79 -37
- package/src/apps/Zones.test.ts +33 -0
- package/src/apps/Zones.ts +40 -0
- package/src/apps/composition.test.ts +84 -1
- package/src/apps/data/App.test.ts +38 -9
- package/src/apps/data/App.ts +96 -33
- package/src/apps/data/FxOracle.ts +1 -1
- package/src/apps/data/index.ts +0 -1
- package/src/apps/data/routes/activities.test.ts +82 -6
- package/src/apps/data/routes/activities.ts +131 -71
- package/src/apps/data/routes/balances.test.ts +50 -37
- package/src/apps/data/routes/balances.ts +5 -5
- package/src/apps/data/routes/blocks.test.ts +2 -0
- package/src/apps/data/routes/coingecko.test.ts +22 -0
- package/src/apps/data/routes/coingecko.ts +84 -48
- package/src/apps/data/routes/earn.test.ts +1108 -0
- package/src/apps/data/routes/earn.ts +1391 -0
- package/src/apps/data/routes/exchanges.test.ts +82 -33
- package/src/apps/data/routes/exchanges.ts +842 -227
- package/src/apps/data/routes/fee-amm.test.ts +4 -6
- package/src/apps/data/routes/fee-amm.ts +69 -12
- package/src/apps/data/routes/funding.test.ts +2712 -221
- package/src/apps/data/routes/funding.ts +1604 -387
- package/src/apps/data/routes/indexer.test.ts +43 -34
- package/src/apps/data/routes/indexer.ts +19 -2
- package/src/apps/data/routes/receipts.test.ts +5 -3
- package/src/apps/data/routes/receipts.ts +13 -11
- package/src/apps/data/routes/rpc.test.ts +446 -28
- package/src/apps/data/routes/rpc.ts +243 -25
- package/src/apps/data/routes/tokenlist.test.ts +15 -0
- package/src/apps/data/routes/tokenlist.ts +88 -22
- package/src/apps/data/routes/tokens.ts +262 -86
- package/src/apps/data/routes/transactions.test.ts +2 -0
- package/src/apps/data/routes/transactions.ts +77 -42
- package/src/apps/data/routes/transfers.test.ts +166 -4
- package/src/apps/data/routes/transfers.ts +216 -78
- package/src/apps/data/routes/valuation.test.ts +62 -9
- package/src/apps/data/routes/valuation.ts +2 -2
- package/src/apps/data/routes/verified-tokens.test.ts +51 -0
- package/src/apps/data/routes/verified-tokens.ts +52 -15
- package/src/apps/data/routes/webhooks.test.ts +432 -33
- package/src/apps/data/routes/webhooks.ts +189 -79
- package/src/apps/data/routes/zones.test.ts +473 -0
- package/src/apps/data/routes/zones.ts +338 -0
- package/src/apps/docs/reference.ts +8 -6
- package/src/apps/index.ts +2 -1
- package/src/apps/management/Billing.test.ts +29 -0
- package/src/apps/management/Billing.ts +23 -0
- package/src/apps/management/Error.ts +12 -0
- package/src/apps/management/routes/api-keys.test.ts +5 -3
- package/src/apps/management/routes/api-keys.ts +2 -9
- package/src/apps/management/routes/invitations.ts +4 -11
- package/src/apps/management/routes/orgs.ts +2 -9
- package/src/apps/management/routes/scopes.test.ts +7 -2
- package/src/apps/management/routes/scopes.ts +2 -2
- package/src/apps/management/routes/webhooks.test.ts +6 -1
- package/src/apps/management/routes/webhooks.ts +15 -3
- package/src/apps/mpp/App.ts +276 -29
- package/src/apps/mpp/Mpp.test.ts +631 -26
- package/src/apps/mpp/Mpp.ts +0 -42
- package/src/apps/mpp/internal/Adapter.ts +108 -3
- package/src/apps/mpp/internal/Error.test.ts +33 -0
- package/src/apps/mpp/internal/Error.ts +44 -6
- package/src/apps/mpp/internal/Idempotency.test.ts +213 -0
- package/src/apps/mpp/internal/Idempotency.ts +59 -5
- package/src/apps/mpp/internal/Policy.test.ts +122 -0
- package/src/apps/mpp/internal/Policy.ts +98 -0
- package/src/apps/mpp/internal/ScreenManager.test.ts +68 -0
- package/src/apps/mpp/internal/ScreenManager.ts +41 -0
- package/src/apps/mpp/internal/Screening.ts +40 -3
- package/src/apps/mpp/internal/Sponsorship.ts +144 -0
- package/src/apps/mpp/internal/Utils.ts +30 -0
- package/src/apps/relay/App.test.ts +495 -64
- package/src/apps/relay/App.ts +234 -24
- package/src/apps/relay/Sponsorships.test.ts +51 -0
- package/src/apps/relay/Sponsorships.ts +19 -7
- package/src/db/Db.ts +439 -0
- package/src/db/Schema.ts +325 -2
- package/src/db/tables/earnVaults.test.ts +185 -0
- package/src/db/tables/earnVaults.ts +151 -0
- package/src/db/tables/fundingCatalog.test.ts +108 -0
- package/src/db/tables/fundingCatalog.ts +157 -0
- package/src/db/tables/fundingDepositAddresses.test.ts +580 -0
- package/src/db/tables/fundingDepositAddresses.ts +376 -0
- package/src/db/tables/fundingDeposits.test.ts +261 -0
- package/src/db/tables/fundingDeposits.ts +229 -0
- package/src/db/tables/fundingIdempotency.test.ts +182 -0
- package/src/db/tables/fundingIdempotency.ts +180 -0
- package/src/db/tables/fundingTransferEvents.ts +28 -0
- package/src/db/tables/fundingTransferTransactions.test.ts +69 -0
- package/src/db/tables/fundingTransferTransactions.ts +37 -0
- package/src/db/tables/fundingTransfers.test.ts +89 -0
- package/src/db/tables/fundingTransfers.ts +153 -0
- package/src/db/tables/organizations.test.ts +88 -0
- package/src/db/tables/organizations.ts +42 -1
- package/src/db/tables/projects.ts +16 -0
- package/src/db/tables/requestUsage.ts +23 -0
- package/src/db/tables/sponsoredTransactions.test.ts +52 -2
- package/src/db/tables/sponsoredTransactions.ts +18 -6
- package/src/db/tables/users.ts +16 -0
- package/src/db/tables/verifiedTokens.ts +19 -14
- package/src/db/tables/webhookSubscriptions.ts +58 -3
- package/src/handlers/relay.test.ts +2 -0
- package/src/handlers/relay.ts +95 -99
- package/src/internal/Auth.test.ts +48 -0
- package/src/internal/Auth.ts +61 -2
- package/src/internal/Cache.ts +13 -9
- package/src/internal/Cursor.test.ts +2 -2
- package/src/internal/Cursor.ts +1 -1
- package/src/internal/EarnRates.test.ts +125 -0
- package/src/internal/EarnRates.ts +409 -0
- package/src/internal/EarnVaults.test.ts +195 -0
- package/src/internal/EarnVaults.ts +876 -0
- package/src/internal/EdgeCache.test.ts +37 -5
- package/src/internal/EdgeCache.ts +39 -7
- package/src/internal/Id.ts +14 -0
- package/src/internal/Idempotency.test.ts +109 -0
- package/src/internal/Idempotency.ts +237 -0
- package/src/internal/Log.test-d.ts +41 -8
- package/src/internal/Log.test.ts +189 -8
- package/src/internal/Log.ts +124 -17
- package/src/internal/MetricSink.test.ts +244 -4
- package/src/internal/MetricSink.ts +51 -1
- package/src/internal/OpenApi.ts +3 -0
- package/src/internal/Provider.test.ts +17 -0
- package/src/internal/Provider.ts +17 -0
- package/src/internal/Schema.test.ts +13 -0
- package/src/internal/Schema.ts +41 -24
- package/src/internal/Store.test.ts +25 -0
- package/src/internal/Store.ts +46 -0
- package/src/internal/Tidx.local.test.ts +78 -3
- package/src/internal/Tidx.test.ts +212 -18
- package/src/internal/Tidx.ts +112 -32
- package/src/internal/VerifiedTokens.test.ts +15 -0
- package/src/internal/Viem.test.ts +170 -17
- package/src/internal/Viem.ts +111 -28
- package/src/internal/WebhookDestination.ts +25 -23
- package/src/internal/Webhooks.test.ts +59 -0
- package/src/internal/Webhooks.ts +34 -10
- package/src/internal/exchange/Provider.test.ts +216 -0
- package/src/internal/exchange/Provider.ts +326 -0
- package/src/internal/exchange/index.test.ts +6 -0
- package/src/internal/exchange/index.ts +1 -0
- package/src/internal/exchange/providers/uniswap.test.ts +122 -0
- package/src/internal/exchange/providers/uniswap.ts +682 -0
- package/src/internal/funding/Action.test.ts +138 -0
- package/src/internal/funding/Action.ts +117 -0
- package/src/internal/funding/Catalog.test.ts +311 -0
- package/src/internal/funding/Catalog.ts +347 -0
- package/src/internal/funding/Chain.test.ts +79 -0
- package/src/internal/funding/Chain.ts +120 -0
- package/src/internal/funding/Deposit.test.ts +26 -0
- package/src/internal/funding/Deposit.ts +453 -0
- package/src/internal/funding/DepositAddress.test.ts +18 -0
- package/src/internal/funding/DepositAddress.ts +312 -0
- package/src/internal/funding/Evidence.test.ts +297 -0
- package/src/internal/funding/Evidence.ts +430 -0
- package/src/internal/funding/Provider.test.ts +1328 -0
- package/src/internal/funding/Provider.ts +1796 -0
- package/src/internal/funding/Reconciliation.local.test.ts +504 -0
- package/src/internal/funding/Reconciliation.test.ts +2020 -0
- package/src/internal/funding/Reconciliation.ts +930 -0
- package/src/internal/funding/Route.test.ts +66 -0
- package/src/internal/funding/Route.ts +29 -0
- package/src/internal/funding/Subsidy.local.test.ts +152 -0
- package/src/internal/funding/Subsidy.test.ts +75 -0
- package/src/internal/funding/Subsidy.ts +260 -0
- package/src/internal/funding/Token.test.ts +47 -0
- package/src/internal/funding/Token.ts +59 -0
- package/src/internal/funding/Transfer.test.ts +369 -0
- package/src/internal/funding/Transfer.ts +522 -0
- package/src/internal/funding/index.test.ts +20 -0
- package/src/internal/funding/index.ts +12 -0
- package/src/internal/funding/providers/across.ts +149 -0
- package/src/{apps/data/FundingQuoteProviders.test.ts → internal/funding/providers/index.test.ts} +178 -157
- package/src/internal/funding/providers/relay.test.ts +474 -0
- package/src/internal/funding/providers/relay.ts +559 -0
- package/src/internal/funding/providers/rhino.ts +139 -0
- package/src/internal/funding/providers/squid.ts +151 -0
- package/src/internal/funding/providers/symbiosis.ts +221 -0
- package/src/internal/index.test.ts +5 -1
- package/src/internal/index.ts +5 -1
- package/src/internal/webhookDestinations/url.ts +49 -45
- package/src/providers/index.test.ts +14 -0
- package/src/providers/index.ts +54 -0
- package/dist/apps/data/FundingQuoteProviders.d.ts +0 -174
- package/dist/apps/data/FundingQuoteProviders.d.ts.map +0 -1
- package/dist/apps/data/FundingQuoteProviders.js +0 -775
- package/dist/apps/data/FundingQuoteProviders.js.map +0 -1
- package/dist/internal/FundingQuotes.d.ts +0 -864
- package/dist/internal/FundingQuotes.d.ts.map +0 -1
- package/dist/internal/FundingQuotes.js +0 -672
- package/dist/internal/FundingQuotes.js.map +0 -1
- package/src/apps/data/FundingQuoteProviders.ts +0 -1043
- package/src/internal/FundingQuotes.test.ts +0 -456
- package/src/internal/FundingQuotes.ts +0 -944
package/src/internal/Webhooks.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type * as Db from '../db/Db.js'
|
|
|
5
5
|
import * as WebhookDeliveries from '../db/tables/webhookDeliveries.js'
|
|
6
6
|
import * as WebhookSubscriptions from '../db/tables/webhookSubscriptions.js'
|
|
7
7
|
import type * as Metrics from '../Metrics.js'
|
|
8
|
+
import * as Cursor from './Cursor.js'
|
|
8
9
|
import * as Id from './Id.js'
|
|
9
10
|
import * as MetricSink from './MetricSink.js'
|
|
10
11
|
import * as WebhookDestination from './WebhookDestination.js'
|
|
@@ -170,9 +171,18 @@ export async function createSubscription(
|
|
|
170
171
|
options: createSubscription.Options = {},
|
|
171
172
|
): Promise<Subscription> {
|
|
172
173
|
WebhookDestination.assertDestination(input.destination)
|
|
174
|
+
if (
|
|
175
|
+
options.startBlockNumber !== undefined &&
|
|
176
|
+
(!Number.isSafeInteger(options.startBlockNumber) || options.startBlockNumber < 0)
|
|
177
|
+
)
|
|
178
|
+
throw new RangeError('startBlockNumber must be a non-negative safe integer.')
|
|
173
179
|
|
|
174
180
|
const now = (options.now ?? (() => new Date()))()
|
|
175
181
|
const iso = now.toISOString()
|
|
182
|
+
// A one-field checkpoint records the live creation head without claiming it
|
|
183
|
+
// was scanned. The poller expands it using its confirmation depth.
|
|
184
|
+
const pollerCursor =
|
|
185
|
+
options.startBlockNumber === undefined ? undefined : Cursor.encode([options.startBlockNumber])
|
|
176
186
|
|
|
177
187
|
const subscription: Subscription = {
|
|
178
188
|
chainId: input.chainId,
|
|
@@ -196,9 +206,15 @@ export async function createSubscription(
|
|
|
196
206
|
const inserted = await WebhookSubscriptions.insertWithinLimit(db, subscription, {
|
|
197
207
|
maxPerOwner: options.maxPerOwner,
|
|
198
208
|
now: iso,
|
|
209
|
+
...(pollerCursor === undefined ? {} : { pollerCursor }),
|
|
199
210
|
})
|
|
200
211
|
if (!inserted) throw new LimitExceededError(options.maxPerOwner)
|
|
201
|
-
} else
|
|
212
|
+
} else
|
|
213
|
+
await WebhookSubscriptions.insert(
|
|
214
|
+
db,
|
|
215
|
+
subscription,
|
|
216
|
+
pollerCursor === undefined ? {} : { pollerCursor },
|
|
217
|
+
)
|
|
202
218
|
return subscription
|
|
203
219
|
}
|
|
204
220
|
|
|
@@ -209,6 +225,8 @@ export declare namespace createSubscription {
|
|
|
209
225
|
maxPerOwner?: number | undefined
|
|
210
226
|
/** Clock used for timestamps (injectable for tests). */
|
|
211
227
|
now?: (() => Date) | undefined
|
|
228
|
+
/** Chain head observed immediately before the subscription becomes visible. */
|
|
229
|
+
startBlockNumber?: number | undefined
|
|
212
230
|
}
|
|
213
231
|
}
|
|
214
232
|
|
|
@@ -316,6 +334,19 @@ export async function getCursor(db: Db.Db, subscriptionId: string): Promise<stri
|
|
|
316
334
|
return WebhookSubscriptions.getCursor(db, subscriptionId)
|
|
317
335
|
}
|
|
318
336
|
|
|
337
|
+
/** Writes a cursor only when its stored value matches the expected cursor. */
|
|
338
|
+
export async function compareAndSetCursor(
|
|
339
|
+
db: Db.Db,
|
|
340
|
+
options: compareAndSetCursor.Options,
|
|
341
|
+
): Promise<boolean> {
|
|
342
|
+
return WebhookSubscriptions.compareAndSetCursor(db, options)
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
export declare namespace compareAndSetCursor {
|
|
346
|
+
/** Options for {@link compareAndSetCursor}. */
|
|
347
|
+
type Options = WebhookSubscriptions.compareAndSetCursor.Options
|
|
348
|
+
}
|
|
349
|
+
|
|
319
350
|
/** Writes a subscription's keyset cursor. */
|
|
320
351
|
export async function setCursor(db: Db.Db, subscriptionId: string, cursor: string): Promise<void> {
|
|
321
352
|
await WebhookSubscriptions.setCursor(db, subscriptionId, cursor)
|
|
@@ -790,18 +821,11 @@ export declare namespace ping {
|
|
|
790
821
|
}
|
|
791
822
|
|
|
792
823
|
function generateId(now: Date): string {
|
|
793
|
-
|
|
794
|
-
// (mirroring delivery ids), letting listSubscriptions page newest-first; 15
|
|
795
|
-
// digits leaves headroom well past the year 5138.
|
|
796
|
-
const timestamp = now.getTime().toString().padStart(15, '0')
|
|
797
|
-
return `wh_${timestamp}_${Id.random()}`
|
|
824
|
+
return Id.generateSortable('wh', now)
|
|
798
825
|
}
|
|
799
826
|
|
|
800
827
|
function generateDeliveryId(now: Date): string {
|
|
801
|
-
|
|
802
|
-
// digits leaves headroom well past the year 5138.
|
|
803
|
-
const timestamp = now.getTime().toString().padStart(15, '0')
|
|
804
|
-
return `whd_${timestamp}_${Id.random()}`
|
|
828
|
+
return Id.generateSortable('whd', now)
|
|
805
829
|
}
|
|
806
830
|
|
|
807
831
|
function generateSecret(): string {
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import * as core_Provider from '../Provider.js'
|
|
2
|
+
import * as Provider from './Provider.js'
|
|
3
|
+
|
|
4
|
+
describe('from', () => {
|
|
5
|
+
test('preserves provider identity and adds the exchange category', () => {
|
|
6
|
+
const provider = Provider.from({
|
|
7
|
+
id: 'example',
|
|
8
|
+
name: 'Example',
|
|
9
|
+
async quote() {
|
|
10
|
+
throw new Provider.RouteUnavailableError()
|
|
11
|
+
},
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
expect(provider).toMatchObject({
|
|
15
|
+
id: 'example',
|
|
16
|
+
name: 'Example',
|
|
17
|
+
type: 'exchange',
|
|
18
|
+
})
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
test('rejects provider ids that are not normalized', () => {
|
|
22
|
+
expect(() =>
|
|
23
|
+
Provider.from({
|
|
24
|
+
id: ' Example ',
|
|
25
|
+
name: 'Example',
|
|
26
|
+
async quote() {
|
|
27
|
+
throw new Provider.RouteUnavailableError()
|
|
28
|
+
},
|
|
29
|
+
}),
|
|
30
|
+
).toThrowErrorMatchingInlineSnapshot(
|
|
31
|
+
`[ExchangeProvider.ProviderConfigurationError: Provider ids must be lowercase and trimmed.]`,
|
|
32
|
+
)
|
|
33
|
+
})
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
describe('is', () => {
|
|
37
|
+
test('accepts only exchange providers with quote capability', () => {
|
|
38
|
+
const exchange = Provider.from({
|
|
39
|
+
id: 'exchange',
|
|
40
|
+
name: 'Exchange',
|
|
41
|
+
async quote() {
|
|
42
|
+
throw new Provider.RouteUnavailableError()
|
|
43
|
+
},
|
|
44
|
+
})
|
|
45
|
+
const incomplete = core_Provider.from({
|
|
46
|
+
id: 'incomplete',
|
|
47
|
+
name: 'Incomplete',
|
|
48
|
+
type: 'exchange',
|
|
49
|
+
})
|
|
50
|
+
const funding = core_Provider.from({ id: 'funding', name: 'Funding', type: 'funding' })
|
|
51
|
+
|
|
52
|
+
expect([exchange, incomplete, funding].map(Provider.is)).toEqual([true, false, false])
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
describe('failure', () => {
|
|
57
|
+
const provider = Provider.from({
|
|
58
|
+
id: 'example',
|
|
59
|
+
name: 'Example',
|
|
60
|
+
async quote() {
|
|
61
|
+
throw new Provider.RouteUnavailableError()
|
|
62
|
+
},
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
test('reports the upstream operation and status', () => {
|
|
66
|
+
expect(
|
|
67
|
+
Provider.failure(
|
|
68
|
+
new Provider.ProviderResponseError({ operation: 'check_approval', status: 429 }),
|
|
69
|
+
{ chainId: 4217, operation: 'quote', provider },
|
|
70
|
+
),
|
|
71
|
+
).toMatchInlineSnapshot(`
|
|
72
|
+
{
|
|
73
|
+
"chainId": 4217,
|
|
74
|
+
"failure": "rate_limit",
|
|
75
|
+
"id": "example",
|
|
76
|
+
"operation": "check_approval",
|
|
77
|
+
"status": 429,
|
|
78
|
+
}
|
|
79
|
+
`)
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
test('reports payload failures at the enclosing operation', () => {
|
|
83
|
+
expect(
|
|
84
|
+
Provider.failure(new Provider.ProviderPayloadError(), {
|
|
85
|
+
chainId: 4217,
|
|
86
|
+
operation: 'finalize',
|
|
87
|
+
provider,
|
|
88
|
+
}),
|
|
89
|
+
).toMatchInlineSnapshot(`
|
|
90
|
+
{
|
|
91
|
+
"chainId": 4217,
|
|
92
|
+
"failure": "payload",
|
|
93
|
+
"id": "example",
|
|
94
|
+
"operation": "finalize",
|
|
95
|
+
}
|
|
96
|
+
`)
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
test('reports bounded payload validation codes', () => {
|
|
100
|
+
expect(
|
|
101
|
+
Provider.failure(new Provider.ProviderPayloadError({ code: 'quote.response.permitData' }), {
|
|
102
|
+
chainId: 4217,
|
|
103
|
+
operation: 'quote',
|
|
104
|
+
provider,
|
|
105
|
+
}),
|
|
106
|
+
).toMatchInlineSnapshot(`
|
|
107
|
+
{
|
|
108
|
+
"chainId": 4217,
|
|
109
|
+
"code": "quote.response.permitData",
|
|
110
|
+
"failure": "payload",
|
|
111
|
+
"id": "example",
|
|
112
|
+
"operation": "quote",
|
|
113
|
+
}
|
|
114
|
+
`)
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
test('reports the upstream operation for network failures', () => {
|
|
118
|
+
expect(
|
|
119
|
+
Provider.failure(
|
|
120
|
+
new Provider.ProviderNetworkError({
|
|
121
|
+
cause: new TypeError('secret network detail'),
|
|
122
|
+
operation: 'check_approval',
|
|
123
|
+
}),
|
|
124
|
+
{ chainId: 4217, operation: 'quote', provider },
|
|
125
|
+
),
|
|
126
|
+
).toMatchInlineSnapshot(`
|
|
127
|
+
{
|
|
128
|
+
"chainId": 4217,
|
|
129
|
+
"failure": "network",
|
|
130
|
+
"id": "example",
|
|
131
|
+
"operation": "check_approval",
|
|
132
|
+
}
|
|
133
|
+
`)
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
test('ignores failures outside the provider boundary', () => {
|
|
137
|
+
expect(
|
|
138
|
+
Provider.failure(new Error('metadata lookup failed'), {
|
|
139
|
+
chainId: 4217,
|
|
140
|
+
operation: 'quote',
|
|
141
|
+
provider,
|
|
142
|
+
}),
|
|
143
|
+
).toBeUndefined()
|
|
144
|
+
})
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
describe('validateExecution', () => {
|
|
148
|
+
const account = '0x1111111111111111111111111111111111111111'
|
|
149
|
+
const destinationToken = '0x20c0000000000000000000000000000000000002'
|
|
150
|
+
const sourceToken = '0x20c0000000000000000000000000000000000001'
|
|
151
|
+
const router = '0x2222222222222222222222222222222222222222'
|
|
152
|
+
|
|
153
|
+
test('accepts transfers within exact-source bounds', () => {
|
|
154
|
+
expect(() =>
|
|
155
|
+
Provider.validateExecution({
|
|
156
|
+
account,
|
|
157
|
+
execution: {
|
|
158
|
+
destinationAmount: '100',
|
|
159
|
+
destinationToken,
|
|
160
|
+
gasUnits: '1',
|
|
161
|
+
minimumDestinationAmount: '99',
|
|
162
|
+
mode: 'exactSource',
|
|
163
|
+
sourceAmount: '50',
|
|
164
|
+
sourceToken,
|
|
165
|
+
},
|
|
166
|
+
transfers: [
|
|
167
|
+
{ amount: 50n, from: account, to: router, token: sourceToken },
|
|
168
|
+
{ amount: 99n, from: router, to: account, token: destinationToken },
|
|
169
|
+
],
|
|
170
|
+
}),
|
|
171
|
+
).not.toThrow()
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
test('rejects a different outgoing token', () => {
|
|
175
|
+
expect(() =>
|
|
176
|
+
Provider.validateExecution({
|
|
177
|
+
account,
|
|
178
|
+
execution: {
|
|
179
|
+
destinationAmount: '100',
|
|
180
|
+
destinationToken,
|
|
181
|
+
gasUnits: '1',
|
|
182
|
+
minimumDestinationAmount: '99',
|
|
183
|
+
mode: 'exactSource',
|
|
184
|
+
sourceAmount: '50',
|
|
185
|
+
sourceToken,
|
|
186
|
+
},
|
|
187
|
+
transfers: [
|
|
188
|
+
{ amount: 1n, from: account, to: router, token: destinationToken },
|
|
189
|
+
{ amount: 50n, from: account, to: router, token: sourceToken },
|
|
190
|
+
{ amount: 100n, from: router, to: account, token: destinationToken },
|
|
191
|
+
],
|
|
192
|
+
}),
|
|
193
|
+
).toThrow(Provider.ProviderPayloadError)
|
|
194
|
+
})
|
|
195
|
+
|
|
196
|
+
test('rejects execution outside exact-destination bounds', () => {
|
|
197
|
+
expect(() =>
|
|
198
|
+
Provider.validateExecution({
|
|
199
|
+
account,
|
|
200
|
+
execution: {
|
|
201
|
+
destinationAmount: '100',
|
|
202
|
+
destinationToken,
|
|
203
|
+
gasUnits: '1',
|
|
204
|
+
maximumSourceAmount: '50',
|
|
205
|
+
mode: 'exactDestination',
|
|
206
|
+
sourceAmount: '49',
|
|
207
|
+
sourceToken,
|
|
208
|
+
},
|
|
209
|
+
transfers: [
|
|
210
|
+
{ amount: 51n, from: account, to: router, token: sourceToken },
|
|
211
|
+
{ amount: 100n, from: router, to: account, token: destinationToken },
|
|
212
|
+
],
|
|
213
|
+
}),
|
|
214
|
+
).toThrow(Provider.ProviderPayloadError)
|
|
215
|
+
})
|
|
216
|
+
})
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
import type { Hex } from 'ox'
|
|
2
|
+
|
|
3
|
+
import * as core_Provider from '../Provider.js'
|
|
4
|
+
import type * as Log from '../Log.js'
|
|
5
|
+
|
|
6
|
+
/** Exchange quote provider called after the native DEX cannot route a swap. */
|
|
7
|
+
export type Provider<id extends string = string> = core_Provider.Provider<id, 'exchange'> & {
|
|
8
|
+
/** Converts a signed continuation into final executable calls. */
|
|
9
|
+
finalizeQuote?(
|
|
10
|
+
this: void,
|
|
11
|
+
input: FinalizeQuoteInput,
|
|
12
|
+
signal: AbortSignal,
|
|
13
|
+
): Promise<FinalizeQuoteResult>
|
|
14
|
+
/** Returns the approvals, signature, or executable calls needed to continue. */
|
|
15
|
+
quote(this: void, input: QuoteInput, signal: AbortSignal): Promise<QuoteResult>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Provider-neutral unsigned transaction call. */
|
|
19
|
+
export type Call = {
|
|
20
|
+
/** ABI-encoded call data. */
|
|
21
|
+
data: Hex.Hex
|
|
22
|
+
/** Contract receiving the call. */
|
|
23
|
+
to: `0x${string}`
|
|
24
|
+
/** Native token value as a JSON-RPC quantity. */
|
|
25
|
+
value: Hex.Hex
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Input used to finish a provider quote after signing. */
|
|
29
|
+
export type FinalizeQuoteInput = {
|
|
30
|
+
/** Wallet signing and executing the swap. */
|
|
31
|
+
account: `0x${string}`
|
|
32
|
+
/** Tempo chain id. */
|
|
33
|
+
chainId: number
|
|
34
|
+
/** Opaque provider state returned by `quote`. */
|
|
35
|
+
continuation: string
|
|
36
|
+
/** EIP-712 signature requested by the quote result. */
|
|
37
|
+
signature: Hex.Hex
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Final executable calls returned after a signature. */
|
|
41
|
+
export type FinalizeQuoteResult = {
|
|
42
|
+
/** Calls to execute in order. */
|
|
43
|
+
calls: readonly Call[]
|
|
44
|
+
/** Quote constraints that the final calls must satisfy. */
|
|
45
|
+
execution: Execution
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Constraints used to validate executable provider calls. */
|
|
49
|
+
export type Execution = QuoteAmounts & {
|
|
50
|
+
/** Token received by the swap. */
|
|
51
|
+
destinationToken: `0x${string}`
|
|
52
|
+
/** Side whose requested amount remains exact. */
|
|
53
|
+
mode: 'exactDestination' | 'exactSource'
|
|
54
|
+
/** Token spent by the swap. */
|
|
55
|
+
sourceToken: `0x${string}`
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Token movement observed while simulating provider calls. */
|
|
59
|
+
export type Transfer = {
|
|
60
|
+
/** Amount moved in base units. */
|
|
61
|
+
amount: bigint
|
|
62
|
+
/** Account sending the tokens. */
|
|
63
|
+
from: `0x${string}`
|
|
64
|
+
/** Account receiving the tokens. */
|
|
65
|
+
to: `0x${string}`
|
|
66
|
+
/** Token contract that emitted the transfer. */
|
|
67
|
+
token: `0x${string}`
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Provider-neutral quote input. */
|
|
71
|
+
export type QuoteInput = {
|
|
72
|
+
/** Wallet receiving and executing the swap. */
|
|
73
|
+
account: `0x${string}`
|
|
74
|
+
/** Exact source or destination amount in base units. */
|
|
75
|
+
amount: string
|
|
76
|
+
/** Tempo chain id. */
|
|
77
|
+
chainId: number
|
|
78
|
+
/** Token received by the swap. */
|
|
79
|
+
destinationToken: `0x${string}`
|
|
80
|
+
/** Side whose requested amount remains exact. */
|
|
81
|
+
mode: 'exactDestination' | 'exactSource'
|
|
82
|
+
/** Maximum execution slippage in basis points. */
|
|
83
|
+
slippageBps: number
|
|
84
|
+
/** Token spent by the swap. */
|
|
85
|
+
sourceToken: `0x${string}`
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** Quote with the approvals, signature, or transaction needed for its next step. */
|
|
89
|
+
export type QuoteResult =
|
|
90
|
+
| (QuoteAmounts & {
|
|
91
|
+
/** Calls that must confirm before requesting a fresh quote. */
|
|
92
|
+
approval: { calls: readonly Call[] }
|
|
93
|
+
/** Onchain approval is required before this swap can be quoted for execution. */
|
|
94
|
+
status: 'approvalRequired'
|
|
95
|
+
})
|
|
96
|
+
| (QuoteAmounts & {
|
|
97
|
+
/** Quote is ready for execution. */
|
|
98
|
+
status: 'ready'
|
|
99
|
+
/** Ordered calls required to execute the quote. */
|
|
100
|
+
transaction: { calls: readonly Call[] }
|
|
101
|
+
})
|
|
102
|
+
| (QuoteAmounts & {
|
|
103
|
+
/** Opaque provider state passed to `finalizeQuote`. */
|
|
104
|
+
continuation: string
|
|
105
|
+
/** Quote needs a wallet signature before final calldata can be built. */
|
|
106
|
+
status: 'signatureRequired'
|
|
107
|
+
/** EIP-712 payload the wallet must sign. */
|
|
108
|
+
typedData: TypedData
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
/** Defines an exchange provider while preserving its concrete identity. */
|
|
112
|
+
export function from<const id extends string>(options: from.Options<id>): Provider<id> {
|
|
113
|
+
if (options.id !== options.id.trim().toLowerCase() || options.id.length === 0)
|
|
114
|
+
throw new ProviderConfigurationError('Provider ids must be lowercase and trimmed.')
|
|
115
|
+
return core_Provider.from({ ...options, type: 'exchange' })
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export declare namespace from {
|
|
119
|
+
/** Exchange provider definition. */
|
|
120
|
+
type Options<id extends string> = Omit<Provider<id>, 'type'>
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** Returns whether a registered provider implements exchange quotes. */
|
|
124
|
+
export function is(provider: core_Provider.Provider): provider is Provider {
|
|
125
|
+
return provider.type === 'exchange' && 'quote' in provider && typeof provider.quote === 'function'
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** Returns bounded exchange-provider failure details for structured request logs. */
|
|
129
|
+
export function failure(cause: unknown, options: failure.Options): Log.ProviderFailure | undefined {
|
|
130
|
+
const { chainId, operation, provider } = options
|
|
131
|
+
if (cause instanceof ProviderResponseError)
|
|
132
|
+
return {
|
|
133
|
+
chainId,
|
|
134
|
+
failure: cause.status === 429 ? 'rate_limit' : 'http',
|
|
135
|
+
id: provider.id,
|
|
136
|
+
operation: cause.operation,
|
|
137
|
+
status: cause.status,
|
|
138
|
+
}
|
|
139
|
+
if (cause instanceof ProviderNetworkError)
|
|
140
|
+
return { chainId, failure: 'network', id: provider.id, operation: cause.operation }
|
|
141
|
+
if (cause instanceof ProviderPayloadError)
|
|
142
|
+
return {
|
|
143
|
+
chainId,
|
|
144
|
+
...(cause.code ? { code: cause.code } : {}),
|
|
145
|
+
failure: 'payload',
|
|
146
|
+
id: provider.id,
|
|
147
|
+
operation,
|
|
148
|
+
}
|
|
149
|
+
return undefined
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export declare namespace failure {
|
|
153
|
+
/** Exchange-provider context retained when a quote operation fails. */
|
|
154
|
+
type Options = {
|
|
155
|
+
/** Chain selected by the quote request. */
|
|
156
|
+
chainId: number
|
|
157
|
+
/** Provider operation used when the error has no narrower operation. */
|
|
158
|
+
operation: string
|
|
159
|
+
/** Exchange provider that handled the request. */
|
|
160
|
+
provider: Provider
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/** Validates simulated token movements against an executable quote. */
|
|
165
|
+
export function validateExecution(options: validateExecution.Options): void {
|
|
166
|
+
const account = options.account.toLowerCase()
|
|
167
|
+
const destinationToken = options.execution.destinationToken.toLowerCase()
|
|
168
|
+
const sourceToken = options.execution.sourceToken.toLowerCase()
|
|
169
|
+
let destinationReceived = 0n
|
|
170
|
+
let sourceIncoming = 0n
|
|
171
|
+
let sourceOutgoing = 0n
|
|
172
|
+
|
|
173
|
+
for (const transfer of options.transfers) {
|
|
174
|
+
const token = transfer.token.toLowerCase()
|
|
175
|
+
if (transfer.from.toLowerCase() === account) {
|
|
176
|
+
if (token !== sourceToken) throw new ProviderPayloadError()
|
|
177
|
+
sourceOutgoing += transfer.amount
|
|
178
|
+
}
|
|
179
|
+
if (transfer.to.toLowerCase() !== account) continue
|
|
180
|
+
if (token === sourceToken) sourceIncoming += transfer.amount
|
|
181
|
+
if (token === destinationToken) destinationReceived += transfer.amount
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const sourceSpent = sourceOutgoing - sourceIncoming
|
|
185
|
+
if (sourceSpent <= 0n) throw new ProviderPayloadError()
|
|
186
|
+
if (options.execution.mode === 'exactSource') {
|
|
187
|
+
if (
|
|
188
|
+
sourceSpent !== BigInt(options.execution.sourceAmount) ||
|
|
189
|
+
options.execution.minimumDestinationAmount === undefined ||
|
|
190
|
+
destinationReceived < BigInt(options.execution.minimumDestinationAmount)
|
|
191
|
+
)
|
|
192
|
+
throw new ProviderPayloadError()
|
|
193
|
+
return
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (
|
|
197
|
+
options.execution.maximumSourceAmount === undefined ||
|
|
198
|
+
sourceSpent > BigInt(options.execution.maximumSourceAmount) ||
|
|
199
|
+
destinationReceived < BigInt(options.execution.destinationAmount)
|
|
200
|
+
)
|
|
201
|
+
throw new ProviderPayloadError()
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export declare namespace validateExecution {
|
|
205
|
+
/** Simulated transfers and quote constraints to validate. */
|
|
206
|
+
type Options = {
|
|
207
|
+
/** Wallet executing the provider calls. */
|
|
208
|
+
account: `0x${string}`
|
|
209
|
+
/** Quote constraints bound to the executable calls. */
|
|
210
|
+
execution: Execution
|
|
211
|
+
/** Token transfers emitted by the simulated calls. */
|
|
212
|
+
transfers: readonly Transfer[]
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** Amount bounds returned by an exchange provider. */
|
|
217
|
+
export type QuoteAmounts = {
|
|
218
|
+
/** Expected destination amount in base units. */
|
|
219
|
+
destinationAmount: string
|
|
220
|
+
/** Estimated execution gas units. */
|
|
221
|
+
gasUnits: string
|
|
222
|
+
/** Maximum source amount for an exact-destination quote. */
|
|
223
|
+
maximumSourceAmount?: string | undefined
|
|
224
|
+
/** Minimum destination amount for an exact-source quote. */
|
|
225
|
+
minimumDestinationAmount?: string | undefined
|
|
226
|
+
/** Expected source amount in base units. */
|
|
227
|
+
sourceAmount: string
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/** Provider-neutral EIP-712 payload accepted by Privy and common wallet clients. */
|
|
231
|
+
export type TypedData = {
|
|
232
|
+
/** EIP-712 signing domain. */
|
|
233
|
+
domain: Record<string, unknown>
|
|
234
|
+
/** EIP-712 message values. */
|
|
235
|
+
message: Record<string, unknown>
|
|
236
|
+
/** Root EIP-712 type. */
|
|
237
|
+
primaryType: string
|
|
238
|
+
/** EIP-712 type definitions. */
|
|
239
|
+
types: Record<string, readonly { name: string; type: string }[]>
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/** Raised when a provider has no executable route for the requested swap. */
|
|
243
|
+
export class RouteUnavailableError extends Error {
|
|
244
|
+
override name = 'ExchangeProvider.RouteUnavailableError'
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/** Raised when a continuation cannot be decoded or validated. */
|
|
248
|
+
export class ProviderContinuationError extends Error {
|
|
249
|
+
override name = 'ExchangeProvider.ProviderContinuationError'
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/** Raised when required provider configuration is invalid. */
|
|
253
|
+
export class ProviderConfigurationError extends Error {
|
|
254
|
+
override name = 'ExchangeProvider.ProviderConfigurationError'
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/** Raised when an upstream provider request fails before receiving a response. */
|
|
258
|
+
export class ProviderNetworkError extends Error {
|
|
259
|
+
override name = 'ExchangeProvider.ProviderNetworkError'
|
|
260
|
+
|
|
261
|
+
/** Upstream operation that failed. */
|
|
262
|
+
operation: string
|
|
263
|
+
|
|
264
|
+
constructor(options: ProviderNetworkError.Options) {
|
|
265
|
+
super(`Provider ${options.operation} request failed`, { cause: options.cause })
|
|
266
|
+
this.operation = options.operation
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export declare namespace ProviderNetworkError {
|
|
271
|
+
/** Safe request details retained for operational reporting. */
|
|
272
|
+
type Options = {
|
|
273
|
+
/** Original network error. */
|
|
274
|
+
cause: TypeError
|
|
275
|
+
/** Stable upstream operation identifier. */
|
|
276
|
+
operation: string
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/** Raised when an upstream provider returns an invalid payload. */
|
|
281
|
+
export class ProviderPayloadError extends Error {
|
|
282
|
+
override name = 'ExchangeProvider.ProviderPayloadError'
|
|
283
|
+
|
|
284
|
+
/** Stable validation code safe for operational reporting. */
|
|
285
|
+
code?: string | undefined
|
|
286
|
+
|
|
287
|
+
constructor(options: ProviderPayloadError.Options = {}) {
|
|
288
|
+
super(options.code ? `Provider payload failed ${options.code}` : undefined)
|
|
289
|
+
this.code = options.code
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export declare namespace ProviderPayloadError {
|
|
294
|
+
/** Bounded invalid-payload details. */
|
|
295
|
+
type Options = {
|
|
296
|
+
/** Stable validation code safe for operational reporting. */
|
|
297
|
+
code?: string | undefined
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/** Raised when an upstream provider request fails. */
|
|
302
|
+
export class ProviderResponseError extends Error {
|
|
303
|
+
override name = 'ExchangeProvider.ProviderResponseError'
|
|
304
|
+
|
|
305
|
+
/** Upstream operation that returned the response. */
|
|
306
|
+
operation: string
|
|
307
|
+
|
|
308
|
+
/** Upstream HTTP status. */
|
|
309
|
+
status: number
|
|
310
|
+
|
|
311
|
+
constructor(options: ProviderResponseError.Options) {
|
|
312
|
+
super(`Provider ${options.operation} request failed with status ${options.status}`)
|
|
313
|
+
this.operation = options.operation
|
|
314
|
+
this.status = options.status
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
export declare namespace ProviderResponseError {
|
|
319
|
+
/** Safe upstream response details retained for operational reporting. */
|
|
320
|
+
type Options = {
|
|
321
|
+
/** Stable upstream operation identifier. */
|
|
322
|
+
operation: string
|
|
323
|
+
/** Upstream HTTP status. */
|
|
324
|
+
status: number
|
|
325
|
+
}
|
|
326
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as Provider from './Provider.js'
|