tapimo 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -4
- package/dist/ApiKey.js +1 -1
- package/dist/ApiKey.js.map +1 -1
- package/dist/ApiKeys.d.ts +95 -14
- package/dist/ApiKeys.d.ts.map +1 -1
- package/dist/ApiKeys.js +360 -49
- package/dist/ApiKeys.js.map +1 -1
- package/dist/App.d.ts +12457 -10365
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +300 -22
- package/dist/App.js.map +1 -1
- package/dist/Assets.d.ts.map +1 -1
- package/dist/Assets.js +2 -1
- package/dist/Assets.js.map +1 -1
- package/dist/Handler.d.ts +0 -1
- package/dist/Handler.d.ts.map +1 -1
- package/dist/Handler.js +0 -1
- package/dist/Handler.js.map +1 -1
- package/dist/Scope.d.ts +13 -5
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +16 -5
- package/dist/Scope.js.map +1 -1
- package/dist/Webhooks.js +1 -1
- package/dist/Webhooks.js.map +1 -1
- package/dist/admin/App.d.ts +3057 -549
- package/dist/admin/App.d.ts.map +1 -1
- package/dist/admin/App.js +26 -5
- package/dist/admin/App.js.map +1 -1
- package/dist/admin/apps/api-keys.d.ts +159 -7
- package/dist/admin/apps/api-keys.d.ts.map +1 -1
- package/dist/admin/apps/api-keys.js +95 -43
- package/dist/admin/apps/api-keys.js.map +1 -1
- package/dist/admin/apps/earn-vaults.d.ts +1398 -0
- package/dist/admin/apps/earn-vaults.d.ts.map +1 -1
- package/dist/admin/apps/earn-vaults.js +463 -7
- package/dist/admin/apps/earn-vaults.js.map +1 -1
- package/dist/admin/apps/organizations.d.ts +267 -15
- package/dist/admin/apps/organizations.d.ts.map +1 -1
- package/dist/admin/apps/organizations.js +241 -25
- package/dist/admin/apps/organizations.js.map +1 -1
- package/dist/admin/apps/routes-support.d.ts +95 -0
- package/dist/admin/apps/routes-support.d.ts.map +1 -0
- package/dist/admin/apps/routes-support.js +151 -0
- package/dist/admin/apps/routes-support.js.map +1 -0
- package/dist/admin/apps/routes.d.ts +2764 -0
- package/dist/admin/apps/routes.d.ts.map +1 -0
- package/dist/admin/apps/routes.js +728 -0
- package/dist/admin/apps/routes.js.map +1 -0
- package/dist/admin/apps/subsidies.d.ts +501 -0
- package/dist/admin/apps/subsidies.d.ts.map +1 -0
- package/dist/admin/apps/subsidies.js +384 -0
- package/dist/admin/apps/subsidies.js.map +1 -0
- package/dist/admin/apps/verified-tokens.d.ts +88 -88
- package/dist/admin/apps/verified-tokens.d.ts.map +1 -1
- package/dist/admin/apps/verified-tokens.js +3 -3
- package/dist/admin/apps/verified-tokens.js.map +1 -1
- 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 +129 -69
- package/dist/admin/ui.generated.js.map +1 -1
- package/dist/analytics/Analytics.d.ts +5 -2
- package/dist/analytics/Analytics.d.ts.map +1 -1
- package/dist/analytics/Analytics.js +31 -1
- package/dist/analytics/Analytics.js.map +1 -1
- package/dist/analytics/tables/requestEvents.d.ts +2 -1
- package/dist/analytics/tables/requestEvents.d.ts.map +1 -1
- package/dist/analytics/tables/requestEvents.js +10 -1
- package/dist/analytics/tables/requestEvents.js.map +1 -1
- package/dist/analytics/tables/routesLifecycleIntervals.d.ts +72 -0
- package/dist/analytics/tables/routesLifecycleIntervals.d.ts.map +1 -0
- package/dist/analytics/tables/routesLifecycleIntervals.js +56 -0
- package/dist/analytics/tables/routesLifecycleIntervals.js.map +1 -0
- package/dist/apps/Zones.d.ts +21 -12526
- package/dist/apps/Zones.d.ts.map +1 -1
- package/dist/apps/Zones.js +37 -5
- package/dist/apps/Zones.js.map +1 -1
- package/dist/apps/data/App.d.ts +3971 -2595
- package/dist/apps/data/App.d.ts.map +1 -1
- package/dist/apps/data/App.js +76 -21
- package/dist/apps/data/App.js.map +1 -1
- package/dist/apps/data/routes/activities.d.ts +364 -34
- package/dist/apps/data/routes/activities.d.ts.map +1 -1
- package/dist/apps/data/routes/activities.js +495 -190
- package/dist/apps/data/routes/activities.js.map +1 -1
- package/dist/apps/data/routes/addresses.d.ts +72 -0
- package/dist/apps/data/routes/addresses.d.ts.map +1 -1
- package/dist/apps/data/routes/blocks.d.ts +37 -37
- package/dist/apps/data/routes/coingecko.d.ts.map +1 -1
- package/dist/apps/data/routes/coingecko.js +47 -21
- package/dist/apps/data/routes/coingecko.js.map +1 -1
- package/dist/apps/data/routes/earn.d.ts +1450 -337
- package/dist/apps/data/routes/earn.d.ts.map +1 -1
- package/dist/apps/data/routes/earn.js +1226 -144
- package/dist/apps/data/routes/earn.js.map +1 -1
- package/dist/apps/data/routes/fee-amm.d.ts +5 -0
- package/dist/apps/data/routes/fee-amm.d.ts.map +1 -1
- package/dist/apps/data/routes/fee-amm.js +31 -19
- package/dist/apps/data/routes/fee-amm.js.map +1 -1
- package/dist/apps/data/routes/indexer.d.ts +125 -0
- package/dist/apps/data/routes/indexer.d.ts.map +1 -1
- package/dist/apps/data/routes/indexer.js +83 -27
- package/dist/apps/data/routes/indexer.js.map +1 -1
- package/dist/apps/data/routes/rpc.d.ts +507 -33
- package/dist/apps/data/routes/rpc.d.ts.map +1 -1
- package/dist/apps/data/routes/rpc.js +266 -156
- package/dist/apps/data/routes/rpc.js.map +1 -1
- package/dist/apps/data/routes/tokenlist.d.ts +47 -15
- package/dist/apps/data/routes/tokenlist.d.ts.map +1 -1
- package/dist/apps/data/routes/tokenlist.js +68 -11
- package/dist/apps/data/routes/tokenlist.js.map +1 -1
- package/dist/apps/data/routes/tokens.d.ts +2 -0
- package/dist/apps/data/routes/tokens.d.ts.map +1 -1
- package/dist/apps/data/routes/tokens.js +26 -14
- package/dist/apps/data/routes/tokens.js.map +1 -1
- package/dist/apps/data/routes/transfers.d.ts +28 -12
- package/dist/apps/data/routes/transfers.d.ts.map +1 -1
- package/dist/apps/data/routes/transfers.js +9 -7
- package/dist/apps/data/routes/transfers.js.map +1 -1
- package/dist/apps/data/routes/valuation.d.ts +30 -30
- package/dist/apps/data/routes/verified-tokens.d.ts +9 -9
- package/dist/apps/data/routes/verified-tokens.d.ts.map +1 -1
- package/dist/apps/data/routes/verified-tokens.js +64 -20
- package/dist/apps/data/routes/verified-tokens.js.map +1 -1
- package/dist/apps/data/routes/webhooks.d.ts +613 -176
- package/dist/apps/data/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/data/routes/webhooks.js +291 -195
- package/dist/apps/data/routes/webhooks.js.map +1 -1
- package/dist/apps/data/routes/zones.d.ts.map +1 -1
- package/dist/apps/data/routes/zones.js +20 -12
- package/dist/apps/data/routes/zones.js.map +1 -1
- package/dist/apps/docs/reference.js +2 -2
- package/dist/apps/docs/reference.js.map +1 -1
- package/dist/apps/index.d.ts +1 -1
- package/dist/apps/index.d.ts.map +1 -1
- package/dist/apps/index.js +1 -1
- package/dist/apps/index.js.map +1 -1
- package/dist/apps/management/App.d.ts +3763 -3385
- package/dist/apps/management/App.d.ts.map +1 -1
- package/dist/apps/management/App.js +5 -14
- package/dist/apps/management/App.js.map +1 -1
- package/dist/apps/management/Billing.d.ts +48 -7
- package/dist/apps/management/Billing.d.ts.map +1 -1
- package/dist/apps/management/Billing.js +204 -25
- package/dist/apps/management/Billing.js.map +1 -1
- package/dist/apps/management/routes/api-keys.d.ts +106 -4
- package/dist/apps/management/routes/api-keys.d.ts.map +1 -1
- package/dist/apps/management/routes/api-keys.js +43 -15
- package/dist/apps/management/routes/api-keys.js.map +1 -1
- package/dist/apps/management/routes/billing.d.ts +290 -4
- package/dist/apps/management/routes/billing.d.ts.map +1 -1
- package/dist/apps/management/routes/billing.js +274 -49
- package/dist/apps/management/routes/billing.js.map +1 -1
- package/dist/apps/management/routes/faucet.d.ts +6 -6
- package/dist/apps/management/routes/faucet.js +1 -1
- package/dist/apps/management/routes/faucet.js.map +1 -1
- package/dist/apps/management/routes/invitations.d.ts +77 -2
- package/dist/apps/management/routes/invitations.d.ts.map +1 -1
- package/dist/apps/management/routes/invitations.js +117 -13
- package/dist/apps/management/routes/invitations.js.map +1 -1
- package/dist/apps/management/routes/invite-links.d.ts +4 -4
- package/dist/apps/management/routes/me.d.ts.map +1 -1
- package/dist/apps/management/routes/me.js +6 -2
- package/dist/apps/management/routes/me.js.map +1 -1
- package/dist/apps/management/routes/members.d.ts +30 -30
- package/dist/apps/management/routes/orgs.d.ts +18 -2
- package/dist/apps/management/routes/orgs.d.ts.map +1 -1
- package/dist/apps/management/routes/orgs.js +52 -12
- package/dist/apps/management/routes/orgs.js.map +1 -1
- package/dist/apps/management/routes/projects.d.ts +4 -4
- package/dist/apps/management/routes/projects.d.ts.map +1 -1
- package/dist/apps/management/routes/projects.js +6 -1
- package/dist/apps/management/routes/projects.js.map +1 -1
- package/dist/apps/management/routes/scopes.d.ts.map +1 -1
- package/dist/apps/management/routes/scopes.js +4 -1
- package/dist/apps/management/routes/scopes.js.map +1 -1
- package/dist/apps/management/routes/usage.d.ts +24 -24
- package/dist/apps/management/routes/usage.js +21 -4
- package/dist/apps/management/routes/usage.js.map +1 -1
- package/dist/apps/management/routes/verified-token-requests.d.ts +2 -2
- package/dist/apps/management/routes/webhooks.d.ts +280 -214
- package/dist/apps/management/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/management/routes/webhooks.js +58 -12
- package/dist/apps/management/routes/webhooks.js.map +1 -1
- package/dist/apps/mcp.d.ts +1 -1
- package/dist/apps/mcp.js +7 -7
- package/dist/apps/mcp.js.map +1 -1
- package/dist/apps/mpp/App.d.ts.map +1 -1
- package/dist/apps/mpp/App.js +35 -7
- package/dist/apps/mpp/App.js.map +1 -1
- package/dist/apps/mpp/internal/Adapter.d.ts +2 -0
- package/dist/apps/mpp/internal/Adapter.d.ts.map +1 -1
- package/dist/apps/mpp/internal/Adapter.js +30 -1
- package/dist/apps/mpp/internal/Adapter.js.map +1 -1
- package/dist/apps/mpp/internal/Policy.d.ts +22 -4
- package/dist/apps/mpp/internal/Policy.d.ts.map +1 -1
- package/dist/apps/mpp/internal/Policy.js +24 -6
- package/dist/apps/mpp/internal/Policy.js.map +1 -1
- package/dist/apps/mpp/internal/Sponsorship.d.ts +3 -0
- package/dist/apps/mpp/internal/Sponsorship.d.ts.map +1 -1
- package/dist/apps/mpp/internal/Sponsorship.js +6 -3
- package/dist/apps/mpp/internal/Sponsorship.js.map +1 -1
- package/dist/apps/relay/App.d.ts +2 -0
- package/dist/apps/relay/App.d.ts.map +1 -1
- package/dist/apps/relay/App.js +134 -75
- package/dist/apps/relay/App.js.map +1 -1
- package/dist/apps/relay/Sponsorships.d.ts +5 -3
- package/dist/apps/relay/Sponsorships.d.ts.map +1 -1
- package/dist/apps/relay/Sponsorships.js +209 -28
- package/dist/apps/relay/Sponsorships.js.map +1 -1
- package/dist/apps/{funding → routes}/Access.d.ts +4 -4
- package/dist/apps/routes/Access.d.ts.map +1 -0
- package/dist/apps/{funding → routes}/Access.js +4 -4
- package/dist/apps/routes/Access.js.map +1 -0
- package/dist/apps/{funding → routes}/App.d.ts +418 -124
- package/dist/apps/{funding → routes}/App.d.ts.map +1 -1
- package/dist/apps/{funding → routes}/App.js +16 -16
- package/dist/apps/routes/App.js.map +1 -0
- package/dist/apps/routes/Inventory.d.ts.map +1 -0
- package/dist/apps/{funding → routes}/Inventory.js +2 -2
- package/dist/apps/routes/Inventory.js.map +1 -0
- package/dist/apps/routes/index.d.ts +2 -0
- package/dist/apps/routes/index.d.ts.map +1 -0
- package/dist/apps/routes/index.js +2 -0
- package/dist/apps/routes/index.js.map +1 -0
- package/dist/apps/{funding → routes}/routes/chains.d.ts +7 -7
- package/dist/apps/routes/routes/chains.d.ts.map +1 -0
- package/dist/apps/{funding → routes}/routes/chains.js +25 -25
- package/dist/apps/routes/routes/chains.js.map +1 -0
- package/dist/apps/{funding → routes}/routes/deposit-addresses.d.ts +107 -43
- package/dist/apps/routes/routes/deposit-addresses.d.ts.map +1 -0
- package/dist/apps/{funding → routes}/routes/deposit-addresses.js +497 -222
- package/dist/apps/routes/routes/deposit-addresses.js.map +1 -0
- package/dist/apps/{funding → routes}/routes/providers.d.ts +8 -8
- package/dist/apps/routes/routes/providers.d.ts.map +1 -0
- package/dist/apps/routes/routes/providers.js +57 -0
- package/dist/apps/routes/routes/providers.js.map +1 -0
- package/dist/apps/{funding → routes}/routes/quotes.d.ts +19 -16
- package/dist/apps/routes/routes/quotes.d.ts.map +1 -0
- package/dist/apps/{funding → routes}/routes/quotes.js +55 -38
- package/dist/apps/routes/routes/quotes.js.map +1 -0
- package/dist/apps/{funding → routes}/routes/transfers.d.ts +379 -74
- package/dist/apps/routes/routes/transfers.d.ts.map +1 -0
- package/dist/apps/routes/routes/transfers.js +1140 -0
- package/dist/apps/routes/routes/transfers.js.map +1 -0
- package/dist/cli/Cli.d.ts +30 -0
- package/dist/cli/Cli.d.ts.map +1 -1
- package/dist/cli/commands/admin.d.ts +36 -0
- package/dist/cli/commands/admin.d.ts.map +1 -1
- package/dist/cli/commands/admin.js +273 -0
- package/dist/cli/commands/admin.js.map +1 -1
- package/dist/cloudflare.d.ts +16 -14
- package/dist/cloudflare.d.ts.map +1 -1
- package/dist/cloudflare.js +26 -21
- package/dist/cloudflare.js.map +1 -1
- package/dist/db/Db.d.ts +63 -21
- package/dist/db/Db.d.ts.map +1 -1
- package/dist/db/Db.js +1030 -15
- package/dist/db/Db.js.map +1 -1
- package/dist/db/Schema.d.ts +780 -133
- package/dist/db/Schema.d.ts.map +1 -1
- package/dist/db/Schema.js +575 -162
- package/dist/db/Schema.js.map +1 -1
- package/dist/db/tables/apiKeyAdmissionBootstraps.d.ts +4 -0
- package/dist/db/tables/apiKeyAdmissionBootstraps.d.ts.map +1 -0
- package/dist/db/tables/apiKeyAdmissionBootstraps.js +2 -0
- package/dist/db/tables/apiKeyAdmissionBootstraps.js.map +1 -0
- package/dist/db/tables/apiKeyAdmissions.d.ts +73 -0
- package/dist/db/tables/apiKeyAdmissions.d.ts.map +1 -0
- package/dist/db/tables/apiKeyAdmissions.js +142 -0
- package/dist/db/tables/apiKeyAdmissions.js.map +1 -0
- package/dist/db/tables/apiKeyOwnerAdmissions.d.ts +4 -0
- package/dist/db/tables/apiKeyOwnerAdmissions.d.ts.map +1 -0
- package/dist/db/tables/apiKeyOwnerAdmissions.js +2 -0
- package/dist/db/tables/apiKeyOwnerAdmissions.js.map +1 -0
- package/dist/db/tables/apiKeyOwnerTombstones.d.ts +20 -0
- package/dist/db/tables/apiKeyOwnerTombstones.d.ts.map +1 -0
- package/dist/db/tables/apiKeyOwnerTombstones.js +57 -0
- package/dist/db/tables/apiKeyOwnerTombstones.js.map +1 -0
- package/dist/db/tables/apiKeyRevocations.d.ts +21 -0
- package/dist/db/tables/apiKeyRevocations.d.ts.map +1 -0
- package/dist/db/tables/apiKeyRevocations.js +98 -0
- package/dist/db/tables/apiKeyRevocations.js.map +1 -0
- package/dist/db/tables/authAccounts.d.ts +47 -0
- package/dist/db/tables/authAccounts.d.ts.map +1 -0
- package/dist/db/tables/authAccounts.js +72 -0
- package/dist/db/tables/authAccounts.js.map +1 -0
- package/dist/db/tables/authSessions.d.ts +12 -0
- package/dist/db/tables/authSessions.d.ts.map +1 -0
- package/dist/db/tables/authSessions.js +2 -0
- package/dist/db/tables/authSessions.js.map +1 -0
- package/dist/db/tables/authVerifications.d.ts +12 -0
- package/dist/db/tables/authVerifications.d.ts.map +1 -0
- package/dist/db/tables/authVerifications.js +2 -0
- package/dist/db/tables/authVerifications.js.map +1 -0
- package/dist/db/tables/invitations.d.ts +17 -1
- package/dist/db/tables/invitations.d.ts.map +1 -1
- package/dist/db/tables/invitations.js +123 -43
- package/dist/db/tables/invitations.js.map +1 -1
- package/dist/db/tables/memberships.d.ts +8 -0
- package/dist/db/tables/memberships.d.ts.map +1 -1
- package/dist/db/tables/memberships.js +51 -2
- package/dist/db/tables/memberships.js.map +1 -1
- package/dist/db/tables/organizations.d.ts +32 -10
- package/dist/db/tables/organizations.d.ts.map +1 -1
- package/dist/db/tables/organizations.js +110 -49
- package/dist/db/tables/organizations.js.map +1 -1
- package/dist/db/tables/projects.d.ts +2 -0
- package/dist/db/tables/projects.d.ts.map +1 -1
- package/dist/db/tables/projects.js +12 -3
- package/dist/db/tables/projects.js.map +1 -1
- package/dist/db/tables/requestUsage.d.ts.map +1 -1
- package/dist/db/tables/requestUsage.js.map +1 -1
- package/dist/db/tables/rewardAccounts.d.ts +86 -0
- package/dist/db/tables/rewardAccounts.d.ts.map +1 -0
- package/dist/db/tables/rewardAccounts.js +88 -0
- package/dist/db/tables/rewardAccounts.js.map +1 -0
- package/dist/db/tables/rewardCampaignDistributors.d.ts +36 -0
- package/dist/db/tables/rewardCampaignDistributors.d.ts.map +1 -0
- package/dist/db/tables/rewardCampaignDistributors.js +30 -0
- package/dist/db/tables/rewardCampaignDistributors.js.map +1 -0
- package/dist/db/tables/rewardCampaigns.d.ts +171 -0
- package/dist/db/tables/rewardCampaigns.d.ts.map +1 -0
- package/dist/db/tables/rewardCampaigns.js +392 -0
- package/dist/db/tables/rewardCampaigns.js.map +1 -0
- package/dist/db/tables/rewardCredits.d.ts +53 -0
- package/dist/db/tables/rewardCredits.d.ts.map +1 -0
- package/dist/db/tables/rewardCredits.js +63 -0
- package/dist/db/tables/rewardCredits.js.map +1 -0
- package/dist/db/tables/rewardEligibilityAssociations.d.ts +61 -0
- package/dist/db/tables/rewardEligibilityAssociations.d.ts.map +1 -0
- package/dist/db/tables/rewardEligibilityAssociations.js +103 -0
- package/dist/db/tables/rewardEligibilityAssociations.js.map +1 -0
- package/dist/db/tables/rewardRuns.d.ts +188 -0
- package/dist/db/tables/rewardRuns.d.ts.map +1 -0
- package/dist/db/tables/rewardRuns.js +278 -0
- package/dist/db/tables/rewardRuns.js.map +1 -0
- package/dist/db/tables/rewardTransactionAttempts.d.ts +100 -0
- package/dist/db/tables/rewardTransactionAttempts.d.ts.map +1 -0
- package/dist/db/tables/rewardTransactionAttempts.js +163 -0
- package/dist/db/tables/rewardTransactionAttempts.js.map +1 -0
- package/dist/db/tables/routesCatalog.d.ts +58 -0
- package/dist/db/tables/routesCatalog.d.ts.map +1 -0
- package/dist/db/tables/{fundingCatalog.js → routesCatalog.js} +19 -19
- package/dist/db/tables/routesCatalog.js.map +1 -0
- package/dist/db/tables/routesDepositAddresses.d.ts +476 -0
- package/dist/db/tables/routesDepositAddresses.d.ts.map +1 -0
- package/dist/db/tables/routesDepositAddresses.js +587 -0
- package/dist/db/tables/routesDepositAddresses.js.map +1 -0
- package/dist/db/tables/{fundingDepositRequestObservations.d.ts → routesDepositRequestObservations.d.ts} +6 -6
- package/dist/db/tables/routesDepositRequestObservations.d.ts.map +1 -0
- package/dist/db/tables/{fundingDepositRequestObservations.js → routesDepositRequestObservations.js} +6 -6
- package/dist/db/tables/routesDepositRequestObservations.js.map +1 -0
- package/dist/db/tables/{fundingDeposits.d.ts → routesDeposits.d.ts} +210 -22
- package/dist/db/tables/routesDeposits.d.ts.map +1 -0
- package/dist/db/tables/routesDeposits.js +576 -0
- package/dist/db/tables/routesDeposits.js.map +1 -0
- package/dist/db/tables/routesIdempotency.d.ts +166 -0
- package/dist/db/tables/routesIdempotency.d.ts.map +1 -0
- package/dist/db/tables/routesIdempotency.js +330 -0
- package/dist/db/tables/routesIdempotency.js.map +1 -0
- package/dist/db/tables/routesSubsidies.d.ts +27 -0
- package/dist/db/tables/routesSubsidies.d.ts.map +1 -0
- package/dist/db/tables/routesSubsidies.js +45 -0
- package/dist/db/tables/routesSubsidies.js.map +1 -0
- package/dist/db/tables/{fundingTransferEvents.d.ts → routesTransferEvents.d.ts} +3 -3
- package/dist/db/tables/routesTransferEvents.d.ts.map +1 -0
- package/dist/db/tables/{fundingTransferEvents.js → routesTransferEvents.js} +3 -3
- package/dist/db/tables/routesTransferEvents.js.map +1 -0
- package/dist/db/tables/routesTransferSubsidies.d.ts +19 -0
- package/dist/db/tables/routesTransferSubsidies.d.ts.map +1 -0
- package/dist/db/tables/routesTransferSubsidies.js +17 -0
- package/dist/db/tables/routesTransferSubsidies.js.map +1 -0
- package/dist/db/tables/routesTransferSubsidyNonces.d.ts +51 -0
- package/dist/db/tables/routesTransferSubsidyNonces.d.ts.map +1 -0
- package/dist/db/tables/routesTransferSubsidyNonces.js +82 -0
- package/dist/db/tables/routesTransferSubsidyNonces.js.map +1 -0
- package/dist/db/tables/routesTransferTransactions.d.ts +77 -0
- package/dist/db/tables/routesTransferTransactions.d.ts.map +1 -0
- package/dist/db/tables/{fundingTransferTransactions.js → routesTransferTransactions.js} +31 -13
- package/dist/db/tables/routesTransferTransactions.js.map +1 -0
- package/dist/db/tables/routesTransfers.d.ts +319 -0
- package/dist/db/tables/routesTransfers.d.ts.map +1 -0
- package/dist/db/tables/routesTransfers.js +372 -0
- package/dist/db/tables/routesTransfers.js.map +1 -0
- package/dist/db/tables/sponsoredTransactions.d.ts +75 -20
- package/dist/db/tables/sponsoredTransactions.d.ts.map +1 -1
- package/dist/db/tables/sponsoredTransactions.js +124 -54
- package/dist/db/tables/sponsoredTransactions.js.map +1 -1
- package/dist/db/tables/sponsorshipAttributions.d.ts +69 -0
- package/dist/db/tables/sponsorshipAttributions.d.ts.map +1 -0
- package/dist/db/tables/sponsorshipAttributions.js +77 -0
- package/dist/db/tables/sponsorshipAttributions.js.map +1 -0
- package/dist/db/tables/sponsorshipReconciliationCursors.d.ts +22 -0
- package/dist/db/tables/sponsorshipReconciliationCursors.d.ts.map +1 -0
- package/dist/db/tables/sponsorshipReconciliationCursors.js +45 -0
- package/dist/db/tables/sponsorshipReconciliationCursors.js.map +1 -0
- package/dist/db/tables/stripeCustomers.d.ts +11 -0
- package/dist/db/tables/stripeCustomers.d.ts.map +1 -1
- package/dist/db/tables/stripeCustomers.js +13 -0
- package/dist/db/tables/stripeCustomers.js.map +1 -1
- package/dist/db/tables/users.d.ts +17 -1
- package/dist/db/tables/users.d.ts.map +1 -1
- package/dist/db/tables/users.js +47 -2
- package/dist/db/tables/users.js.map +1 -1
- package/dist/db/tables/webhookQueueEvents.d.ts.map +1 -1
- package/dist/db/tables/webhookQueueEvents.js +5 -1
- package/dist/db/tables/webhookQueueEvents.js.map +1 -1
- package/dist/db/tables/webhookSubscriptions.d.ts +19 -11
- package/dist/db/tables/webhookSubscriptions.d.ts.map +1 -1
- package/dist/db/tables/webhookSubscriptions.js +45 -13
- package/dist/db/tables/webhookSubscriptions.js.map +1 -1
- package/dist/handlers/internal/executionError.d.ts +2 -2
- package/dist/handlers/internal/executionError.d.ts.map +1 -1
- package/dist/handlers/internal/executionError.js +1 -2
- package/dist/handlers/internal/executionError.js.map +1 -1
- package/dist/handlers/internal/multisig.d.ts +4 -232
- package/dist/handlers/internal/multisig.d.ts.map +1 -1
- package/dist/handlers/internal/multisig.js +11 -537
- package/dist/handlers/internal/multisig.js.map +1 -1
- package/dist/handlers/internal/sponsorship.d.ts +19 -8
- package/dist/handlers/internal/sponsorship.d.ts.map +1 -1
- package/dist/handlers/internal/sponsorship.js +13 -9
- package/dist/handlers/internal/sponsorship.js.map +1 -1
- package/dist/handlers/relay.d.ts +9 -12
- package/dist/handlers/relay.d.ts.map +1 -1
- package/dist/handlers/relay.js +81 -85
- package/dist/handlers/relay.js.map +1 -1
- package/dist/index.d.ts +0 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -17
- package/dist/index.js.map +1 -1
- package/dist/internal/AssetResponse.d.ts +12 -0
- package/dist/internal/AssetResponse.d.ts.map +1 -0
- package/dist/internal/AssetResponse.js +21 -0
- package/dist/internal/AssetResponse.js.map +1 -0
- package/dist/internal/Auth.d.ts +48 -12
- package/dist/internal/Auth.d.ts.map +1 -1
- package/dist/internal/Auth.js +603 -175
- package/dist/internal/Auth.js.map +1 -1
- package/dist/internal/BetterAuth.d.ts +1488 -0
- package/dist/internal/BetterAuth.d.ts.map +1 -0
- package/dist/internal/BetterAuth.js +253 -0
- package/dist/internal/BetterAuth.js.map +1 -0
- package/dist/internal/Cache.d.ts +2 -0
- package/dist/internal/Cache.d.ts.map +1 -1
- package/dist/internal/Cache.js +2 -0
- package/dist/internal/Cache.js.map +1 -1
- package/dist/internal/EarnRates.d.ts +26 -3
- package/dist/internal/EarnRates.d.ts.map +1 -1
- package/dist/internal/EarnRates.js +84 -19
- package/dist/internal/EarnRates.js.map +1 -1
- package/dist/internal/EarnSharePrices.d.ts +120 -0
- package/dist/internal/EarnSharePrices.d.ts.map +1 -0
- package/dist/internal/EarnSharePrices.js +179 -0
- package/dist/internal/EarnSharePrices.js.map +1 -0
- package/dist/internal/EarnVaults.d.ts +4 -0
- package/dist/internal/EarnVaults.d.ts.map +1 -1
- package/dist/internal/EarnVaults.js +27 -10
- package/dist/internal/EarnVaults.js.map +1 -1
- package/dist/internal/Email.d.ts +37 -0
- package/dist/internal/Email.d.ts.map +1 -0
- package/dist/internal/Email.js +16 -0
- package/dist/internal/Email.js.map +1 -0
- package/dist/internal/Log.d.ts +32 -28
- package/dist/internal/Log.d.ts.map +1 -1
- package/dist/internal/Log.js +18 -11
- package/dist/internal/Log.js.map +1 -1
- package/dist/internal/MetricSink.d.ts +3 -0
- package/dist/internal/MetricSink.d.ts.map +1 -1
- package/dist/internal/MetricSink.js +67 -8
- package/dist/internal/MetricSink.js.map +1 -1
- package/dist/internal/Mpp.d.ts.map +1 -1
- package/dist/internal/Mpp.js +20 -25
- package/dist/internal/Mpp.js.map +1 -1
- package/dist/internal/OpenApi.d.ts +26 -3
- package/dist/internal/OpenApi.d.ts.map +1 -1
- package/dist/internal/OpenApi.js +25 -10
- package/dist/internal/OpenApi.js.map +1 -1
- package/dist/internal/Provider.d.ts +1 -1
- package/dist/internal/Provider.d.ts.map +1 -1
- package/dist/internal/RateLimit.d.ts.map +1 -1
- package/dist/internal/RateLimit.js +13 -1
- package/dist/internal/RateLimit.js.map +1 -1
- package/dist/internal/Store.d.ts +16 -0
- package/dist/internal/Store.d.ts.map +1 -1
- package/dist/internal/Store.js +59 -8
- package/dist/internal/Store.js.map +1 -1
- package/dist/internal/Tidx.d.ts +9 -2
- package/dist/internal/Tidx.d.ts.map +1 -1
- package/dist/internal/Tidx.js +78 -11
- package/dist/internal/Tidx.js.map +1 -1
- package/dist/internal/Timing.d.ts +26 -0
- package/dist/internal/Timing.d.ts.map +1 -1
- package/dist/internal/Timing.js +63 -5
- package/dist/internal/Timing.js.map +1 -1
- package/dist/internal/VercelOidc.d.ts +94 -0
- package/dist/internal/VercelOidc.d.ts.map +1 -0
- package/dist/internal/VercelOidc.js +128 -0
- package/dist/internal/VercelOidc.js.map +1 -0
- package/dist/internal/VerifiedTokens.d.ts +2 -8
- package/dist/internal/VerifiedTokens.d.ts.map +1 -1
- package/dist/internal/VerifiedTokens.js +24 -24
- package/dist/internal/VerifiedTokens.js.map +1 -1
- package/dist/internal/Viem.d.ts +30 -2067
- package/dist/internal/Viem.d.ts.map +1 -1
- package/dist/internal/Viem.js +167 -17
- package/dist/internal/Viem.js.map +1 -1
- package/dist/internal/Webhooks.d.ts +12 -4
- package/dist/internal/Webhooks.d.ts.map +1 -1
- package/dist/internal/Webhooks.js +9 -3
- package/dist/internal/Webhooks.js.map +1 -1
- package/dist/internal/ZoneRpc.d.ts +7 -0
- package/dist/internal/ZoneRpc.d.ts.map +1 -0
- package/dist/internal/ZoneRpc.js +49 -0
- package/dist/internal/ZoneRpc.js.map +1 -0
- package/dist/internal/index.d.ts +3 -1
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +3 -1
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/rewards/Audit.d.ts +88 -0
- package/dist/internal/rewards/Audit.d.ts.map +1 -0
- package/dist/internal/rewards/Audit.js +134 -0
- package/dist/internal/rewards/Audit.js.map +1 -0
- package/dist/internal/rewards/Campaigns.d.ts +572 -0
- package/dist/internal/rewards/Campaigns.d.ts.map +1 -0
- package/dist/internal/rewards/Campaigns.js +531 -0
- package/dist/internal/rewards/Campaigns.js.map +1 -0
- package/dist/internal/rewards/Credits.d.ts +76 -0
- package/dist/internal/rewards/Credits.d.ts.map +1 -0
- package/dist/internal/rewards/Credits.js +95 -0
- package/dist/internal/rewards/Credits.js.map +1 -0
- package/dist/internal/rewards/Events.d.ts +100 -0
- package/dist/internal/rewards/Events.d.ts.map +1 -0
- package/dist/internal/rewards/Events.js +340 -0
- package/dist/internal/rewards/Events.js.map +1 -0
- package/dist/internal/rewards/Projection.d.ts +237 -0
- package/dist/internal/rewards/Projection.d.ts.map +1 -0
- package/dist/internal/rewards/Projection.js +616 -0
- package/dist/internal/rewards/Projection.js.map +1 -0
- package/dist/internal/rewards/Rates.d.ts +44 -0
- package/dist/internal/rewards/Rates.d.ts.map +1 -0
- package/dist/internal/rewards/Rates.js +60 -0
- package/dist/internal/rewards/Rates.js.map +1 -0
- package/dist/internal/rewards/Read.d.ts +158 -0
- package/dist/internal/rewards/Read.d.ts.map +1 -0
- package/dist/internal/rewards/Read.js +292 -0
- package/dist/internal/rewards/Read.js.map +1 -0
- package/dist/internal/rewards/Runner.d.ts +164 -0
- package/dist/internal/rewards/Runner.d.ts.map +1 -0
- package/dist/internal/rewards/Runner.js +1778 -0
- package/dist/internal/rewards/Runner.js.map +1 -0
- package/dist/internal/rewards/Signer.d.ts +224 -0
- package/dist/internal/rewards/Signer.d.ts.map +1 -0
- package/dist/internal/rewards/Signer.js +135 -0
- package/dist/internal/rewards/Signer.js.map +1 -0
- package/dist/internal/rewards/index.d.ts +15 -0
- package/dist/internal/rewards/index.d.ts.map +1 -0
- package/dist/internal/rewards/index.js +15 -0
- package/dist/internal/rewards/index.js.map +1 -0
- package/dist/internal/{funding → routes}/Action.d.ts +12 -1
- package/dist/internal/routes/Action.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Action.js +17 -9
- package/dist/internal/routes/Action.js.map +1 -0
- package/dist/internal/{funding → routes}/Catalog.d.ts +20 -20
- package/dist/internal/routes/Catalog.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Catalog.js +29 -29
- package/dist/internal/routes/Catalog.js.map +1 -0
- package/dist/internal/{funding → routes}/Chain.d.ts +10 -10
- package/dist/internal/routes/Chain.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Chain.js +3 -3
- package/dist/internal/routes/Chain.js.map +1 -0
- package/dist/internal/{funding → routes}/Deposit.d.ts +45 -23
- package/dist/internal/routes/Deposit.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Deposit.js +60 -27
- package/dist/internal/routes/Deposit.js.map +1 -0
- package/dist/internal/{funding → routes}/DepositAddress.d.ts +56 -27
- package/dist/internal/routes/DepositAddress.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/DepositAddress.js +95 -33
- package/dist/internal/routes/DepositAddress.js.map +1 -0
- package/dist/internal/{funding → routes}/DepositWebhook.d.ts +4 -4
- package/dist/internal/routes/DepositWebhook.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/DepositWebhook.js +4 -4
- package/dist/internal/routes/DepositWebhook.js.map +1 -0
- package/dist/internal/routes/Economics.d.ts +25 -0
- package/dist/internal/routes/Economics.d.ts.map +1 -0
- package/dist/internal/routes/Economics.js +28 -0
- package/dist/internal/routes/Economics.js.map +1 -0
- package/dist/internal/{funding → routes}/Evidence.d.ts +3 -3
- package/dist/internal/routes/Evidence.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Evidence.js +7 -7
- package/dist/internal/routes/Evidence.js.map +1 -0
- package/dist/internal/routes/Observability.d.ts +154 -0
- package/dist/internal/routes/Observability.d.ts.map +1 -0
- package/dist/internal/routes/Observability.js +389 -0
- package/dist/internal/routes/Observability.js.map +1 -0
- package/dist/internal/{funding → routes}/Provider.d.ts +311 -105
- package/dist/internal/routes/Provider.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Provider.js +229 -98
- package/dist/internal/routes/Provider.js.map +1 -0
- package/dist/internal/{funding → routes}/Reconciliation.d.ts +11 -6
- package/dist/internal/routes/Reconciliation.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Reconciliation.js +408 -158
- package/dist/internal/routes/Reconciliation.js.map +1 -0
- package/dist/internal/routes/Route.d.ts +21 -0
- package/dist/internal/routes/Route.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Route.js +1 -1
- package/dist/internal/routes/Route.js.map +1 -0
- package/dist/internal/{funding → routes}/SourceObservation.d.ts +6 -6
- package/dist/internal/routes/SourceObservation.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/SourceObservation.js +8 -8
- package/dist/internal/routes/SourceObservation.js.map +1 -0
- package/dist/internal/{funding → routes}/Subsidy.d.ts +48 -3
- package/dist/internal/routes/Subsidy.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Subsidy.js +43 -3
- package/dist/internal/routes/Subsidy.js.map +1 -0
- package/dist/internal/{funding → routes}/Token.d.ts +4 -4
- package/dist/internal/routes/Token.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Token.js +3 -3
- package/dist/internal/routes/Token.js.map +1 -0
- package/dist/internal/{funding → routes}/Transfer.d.ts +241 -46
- package/dist/internal/routes/Transfer.d.ts.map +1 -0
- package/dist/internal/routes/Transfer.js +728 -0
- package/dist/internal/routes/Transfer.js.map +1 -0
- package/dist/internal/{funding → routes}/TransferReconciliation.d.ts +13 -10
- package/dist/internal/routes/TransferReconciliation.d.ts.map +1 -0
- package/dist/internal/routes/TransferReconciliation.js +422 -0
- package/dist/internal/routes/TransferReconciliation.js.map +1 -0
- package/dist/internal/routes/TransferSubsidy.d.ts +201 -0
- package/dist/internal/routes/TransferSubsidy.d.ts.map +1 -0
- package/dist/internal/routes/TransferSubsidy.js +256 -0
- package/dist/internal/routes/TransferSubsidy.js.map +1 -0
- package/dist/internal/{funding → routes}/TransferWebhook.d.ts +5 -5
- package/dist/internal/routes/TransferWebhook.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/TransferWebhook.js +3 -3
- package/dist/internal/routes/TransferWebhook.js.map +1 -0
- package/dist/internal/{funding → routes}/index.d.ts +2 -0
- package/dist/internal/routes/index.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/index.js +2 -0
- package/dist/internal/routes/index.js.map +1 -0
- package/dist/internal/{funding → routes}/providers/across.d.ts +4 -4
- package/dist/internal/routes/providers/across.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/providers/across.js +13 -13
- package/dist/internal/routes/providers/across.js.map +1 -0
- package/dist/internal/{funding → routes}/providers/relay.d.ts +21 -12
- package/dist/internal/routes/providers/relay.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/providers/relay.js +194 -110
- package/dist/internal/routes/providers/relay.js.map +1 -0
- package/dist/internal/{funding → routes}/providers/rhino.d.ts +4 -4
- package/dist/internal/routes/providers/rhino.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/providers/rhino.js +10 -10
- package/dist/internal/routes/providers/rhino.js.map +1 -0
- package/dist/internal/{funding → routes}/providers/squid.d.ts +4 -4
- package/dist/internal/routes/providers/squid.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/providers/squid.js +14 -14
- package/dist/internal/routes/providers/squid.js.map +1 -0
- package/dist/internal/{funding → routes}/providers/stargate.d.ts +46 -18
- package/dist/internal/routes/providers/stargate.d.ts.map +1 -0
- package/dist/internal/routes/providers/stargate.js +898 -0
- package/dist/internal/routes/providers/stargate.js.map +1 -0
- package/dist/internal/{funding → routes}/providers/symbiosis.d.ts +4 -4
- package/dist/internal/routes/providers/symbiosis.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/providers/symbiosis.js +30 -20
- package/dist/internal/routes/providers/symbiosis.js.map +1 -0
- package/dist/internal/webhookDestinations/slack.js +12 -12
- package/dist/internal/webhookDestinations/slack.js.map +1 -1
- package/dist/providers/index.d.ts +12 -12
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +12 -12
- package/dist/providers/index.js.map +1 -1
- package/dist/server.d.ts +19 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +19 -0
- package/dist/server.js.map +1 -0
- package/package.json +15 -4
- package/src/ApiKey.ts +1 -1
- package/src/ApiKeys.test.ts +1033 -3
- package/src/ApiKeys.ts +489 -48
- package/src/App.test-d.ts +1 -1
- package/src/App.test.ts +216 -25
- package/src/App.ts +334 -31
- package/src/Assets.test.ts +2 -2
- package/src/Assets.ts +3 -1
- package/src/Auth.test-d.ts +1 -1
- package/src/Client.test-d.ts +539 -110
- package/src/Handler.ts +0 -1
- package/src/OpenApi.contract.test.ts +195 -0
- package/src/Scope.ts +17 -5
- package/src/Webhooks.ts +1 -1
- package/src/admin/App.test.ts +30 -2
- package/src/admin/App.ts +42 -6
- package/src/admin/apps/api-keys.test.ts +267 -5
- package/src/admin/apps/api-keys.ts +100 -50
- package/src/admin/apps/earn-vaults.test.ts +158 -0
- package/src/admin/apps/earn-vaults.ts +679 -6
- package/src/admin/apps/organizations.test.ts +306 -17
- package/src/admin/apps/organizations.ts +299 -24
- package/src/admin/apps/routes-support.test.ts +200 -0
- package/src/admin/apps/routes-support.ts +201 -0
- package/src/admin/apps/routes.test.ts +450 -0
- package/src/admin/apps/routes.ts +896 -0
- package/src/admin/apps/scopes.test.ts +15 -5
- package/src/admin/apps/subsidies.test.ts +306 -0
- package/src/admin/apps/subsidies.ts +457 -0
- package/src/admin/apps/verified-tokens.test.ts +8 -3
- package/src/admin/apps/verified-tokens.ts +3 -3
- package/src/admin/ui/plugin.ts +1 -2
- package/src/admin/ui/src/components/RewardCampaignForm.tsx +1009 -0
- package/src/admin/ui/src/lib/config.ts +11 -2
- package/src/admin/ui/src/lib/earn-vaults.ts +2 -2
- package/src/admin/ui/src/lib/organizations.test.ts +83 -50
- package/src/admin/ui/src/lib/organizations.ts +106 -25
- package/src/admin/ui/src/lib/query-client.ts +1 -1
- package/src/admin/ui/src/lib/reward-campaigns.ts +136 -0
- package/src/admin/ui/src/lib/routes.test.ts +88 -0
- package/src/admin/ui/src/lib/routes.ts +304 -0
- package/src/admin/ui/src/lib/subsidies.ts +75 -0
- package/src/admin/ui/src/routeTree.gen.ts +63 -0
- package/src/admin/ui/src/routes/__root.tsx +12 -1
- package/src/admin/ui/src/routes/api-keys.tsx +196 -84
- package/src/admin/ui/src/routes/earn.vaults_.$vaultId.edit.tsx +105 -70
- package/src/admin/ui/src/routes/organizations_.$orgId.tsx +239 -23
- package/src/admin/ui/src/routes/routes.tsx +1615 -0
- package/src/admin/ui/src/routes/routes_.support.tsx +248 -0
- package/src/admin/ui/src/routes/subsidies.tsx +799 -0
- package/src/admin/ui.generated.ts +144 -69
- package/src/analytics/Analytics.test.ts +108 -18
- package/src/analytics/Analytics.ts +38 -6
- package/src/analytics/tables/requestEvents.test.ts +100 -0
- package/src/analytics/tables/requestEvents.ts +10 -1
- package/src/analytics/tables/routesLifecycleIntervals.ts +140 -0
- package/src/apps/Zones.test.ts +15 -0
- package/src/apps/Zones.ts +52 -5
- package/src/apps/composition.test.ts +68 -60
- package/src/apps/data/App.test.ts +154 -2
- package/src/apps/data/App.ts +88 -28
- package/src/apps/data/routes/activities.test.ts +419 -7
- package/src/apps/data/routes/activities.ts +683 -216
- package/src/apps/data/routes/balances.test.ts +2 -2
- package/src/apps/data/routes/blocks.test.ts +46 -1
- package/src/apps/data/routes/coingecko.test.ts +419 -1
- package/src/apps/data/routes/coingecko.ts +309 -253
- package/src/apps/data/routes/earn.discovery.test.ts +274 -0
- package/src/apps/data/routes/earn.test.ts +1294 -17
- package/src/apps/data/routes/earn.ts +1838 -321
- package/src/apps/data/routes/exchanges.test.ts +12 -15
- package/src/apps/data/routes/fee-amm.test.ts +224 -0
- package/src/apps/data/routes/fee-amm.ts +191 -160
- package/src/apps/data/routes/indexer.test.ts +389 -0
- package/src/apps/data/routes/indexer.ts +165 -69
- package/src/apps/data/routes/receipts.test.ts +1 -1
- package/src/apps/data/routes/rpc.test.ts +352 -8
- package/src/apps/data/routes/rpc.ts +407 -219
- package/src/apps/data/routes/rpc.zone.test.ts +340 -0
- package/src/apps/data/routes/tokenlist.test.ts +285 -0
- package/src/apps/data/routes/tokenlist.ts +173 -88
- package/src/apps/data/routes/tokens.test.ts +93 -3
- package/src/apps/data/routes/tokens.ts +39 -23
- package/src/apps/data/routes/transactions.test.ts +1 -1
- package/src/apps/data/routes/transfers.test.ts +56 -24
- package/src/apps/data/routes/transfers.ts +19 -8
- package/src/apps/data/routes/valuation.test.ts +1 -1
- package/src/apps/data/routes/verified-tokens.test.ts +345 -0
- package/src/apps/data/routes/verified-tokens.ts +99 -29
- package/src/apps/data/routes/webhooks.test.ts +645 -83
- package/src/apps/data/routes/webhooks.ts +1089 -857
- package/src/apps/data/routes/zones.test.ts +148 -71
- package/src/apps/data/routes/zones.ts +71 -55
- package/src/apps/docs/reference.ts +2 -2
- package/src/apps/index.ts +1 -1
- package/src/apps/management/App.ts +9 -51
- package/src/apps/management/Billing.test.ts +375 -14
- package/src/apps/management/Billing.ts +265 -29
- package/src/apps/management/routes/api-keys.test.ts +269 -7
- package/src/apps/management/routes/api-keys.ts +61 -20
- package/src/apps/management/routes/billing.test.ts +477 -15
- package/src/apps/management/routes/billing.ts +377 -50
- package/src/apps/management/routes/faucet.test.ts +1 -1
- package/src/apps/management/routes/faucet.ts +1 -1
- package/src/apps/management/routes/invitations.test.ts +270 -3
- package/src/apps/management/routes/invitations.ts +185 -15
- package/src/apps/management/routes/invoicePreview.test.ts +549 -0
- package/src/apps/management/routes/me.test.ts +246 -5
- package/src/apps/management/routes/me.ts +7 -2
- package/src/apps/management/routes/members.test.ts +108 -0
- package/src/apps/management/routes/orgs.test.ts +191 -3
- package/src/apps/management/routes/orgs.ts +58 -11
- package/src/apps/management/routes/projects.test.ts +33 -3
- package/src/apps/management/routes/projects.ts +6 -1
- package/src/apps/management/routes/scopes.test.ts +30 -2
- package/src/apps/management/routes/scopes.ts +4 -1
- package/src/apps/management/routes/usage.test.ts +32 -0
- package/src/apps/management/routes/usage.ts +22 -4
- package/src/apps/management/routes/webhooks.test.ts +49 -26
- package/src/apps/management/routes/webhooks.ts +78 -22
- package/src/apps/mcp.test.ts +6 -6
- package/src/apps/mcp.ts +7 -7
- package/src/apps/mpp/App.ts +37 -7
- package/src/apps/mpp/Mpp.test.ts +49 -8
- package/src/apps/mpp/Mpp.zone.test.ts +219 -0
- package/src/apps/mpp/internal/Adapter.ts +34 -0
- package/src/apps/mpp/internal/Policy.test.ts +86 -31
- package/src/apps/mpp/internal/Policy.ts +49 -7
- package/src/apps/mpp/internal/Sponsorship.test.ts +207 -0
- package/src/apps/mpp/internal/Sponsorship.ts +9 -3
- package/src/apps/relay/App.test.ts +839 -64
- package/src/apps/relay/App.ts +148 -81
- package/src/apps/relay/App.zone-billing.test.ts +257 -0
- package/src/apps/relay/Sponsorships.test.ts +67 -4
- package/src/apps/relay/Sponsorships.ts +233 -32
- package/src/apps/relay/Sponsorships.zone.test.ts +102 -0
- package/src/apps/{funding → routes}/Access.ts +6 -6
- package/src/apps/routes/App.test.ts +165 -0
- package/src/apps/routes/App.ts +96 -0
- package/src/apps/{funding → routes}/Inventory.ts +2 -2
- package/src/apps/routes/index.ts +1 -0
- package/src/apps/{funding → routes}/routes/chains.test.ts +66 -66
- package/src/apps/{funding → routes}/routes/chains.ts +23 -23
- package/src/apps/{funding → routes}/routes/deposit-addresses.test.ts +1358 -458
- package/src/apps/{funding → routes}/routes/deposit-addresses.ts +566 -246
- package/src/apps/{funding → routes}/routes/providers.test.ts +27 -33
- package/src/apps/{funding → routes}/routes/providers.ts +23 -23
- package/src/apps/{funding → routes}/routes/quotes.test.ts +298 -41
- package/src/apps/{funding → routes}/routes/quotes.ts +57 -40
- package/src/apps/{funding → routes}/routes/transfers.test.ts +1100 -353
- package/src/apps/routes/routes/transfers.ts +1332 -0
- package/src/cli/Cli.test.ts +1 -1
- package/src/cli/commands/admin.test.ts +748 -1
- package/src/cli/commands/admin.ts +278 -0
- package/src/cloudflare.ts +52 -47
- package/src/db/Db.test.ts +245 -2
- package/src/db/Db.ts +1476 -34
- package/src/db/Schema.ts +729 -228
- package/src/db/tables/apiKeyAdmissionBootstraps.ts +4 -0
- package/src/db/tables/apiKeyAdmissions.ts +218 -0
- package/src/db/tables/apiKeyOwnerAdmissions.ts +4 -0
- package/src/db/tables/apiKeyOwnerTombstones.ts +81 -0
- package/src/db/tables/apiKeyRevocations.test.ts +74 -0
- package/src/db/tables/apiKeyRevocations.ts +121 -0
- package/src/db/tables/authAccounts.ts +105 -0
- package/src/db/tables/authSessions.ts +13 -0
- package/src/db/tables/authVerifications.ts +13 -0
- package/src/db/tables/invitations.ts +142 -45
- package/src/db/tables/memberships.ts +79 -3
- package/src/db/tables/organizations.test.ts +690 -13
- package/src/db/tables/organizations.ts +139 -55
- package/src/db/tables/projects.test.ts +16 -0
- package/src/db/tables/projects.ts +13 -3
- package/src/db/tables/requestUsage.ts +4 -1
- package/src/db/tables/rewardAccounts.ts +178 -0
- package/src/db/tables/rewardCampaignDistributors.ts +68 -0
- package/src/db/tables/rewardCampaigns.test.ts +1388 -0
- package/src/db/tables/rewardCampaigns.ts +647 -0
- package/src/db/tables/rewardCredits.ts +110 -0
- package/src/db/tables/rewardEligibilityAssociations.test.ts +271 -0
- package/src/db/tables/rewardEligibilityAssociations.ts +184 -0
- package/src/db/tables/rewardRuns.ts +514 -0
- package/src/db/tables/rewardTransactionAttempts.ts +272 -0
- package/src/db/tables/routesCatalog.test.ts +185 -0
- package/src/db/tables/routesCatalog.ts +163 -0
- package/src/db/tables/routesDepositAddresses.test.ts +1048 -0
- package/src/db/tables/routesDepositAddresses.ts +1008 -0
- package/src/db/tables/{fundingDepositRequestObservations.test.ts → routesDepositRequestObservations.test.ts} +13 -14
- package/src/db/tables/{fundingDepositRequestObservations.ts → routesDepositRequestObservations.ts} +10 -10
- package/src/db/tables/{fundingDeposits.test.ts → routesDeposits.test.ts} +316 -46
- package/src/db/tables/routesDeposits.ts +1062 -0
- package/src/db/tables/routesIdempotency.test.ts +796 -0
- package/src/db/tables/routesIdempotency.ts +496 -0
- package/src/db/tables/routesSubsidies.test.ts +120 -0
- package/src/db/tables/routesSubsidies.ts +71 -0
- package/src/db/tables/{fundingTransferEvents.ts → routesTransferEvents.ts} +4 -4
- package/src/db/tables/routesTransferSubsidies.ts +38 -0
- package/src/db/tables/routesTransferSubsidyNonces.ts +124 -0
- package/src/db/tables/routesTransferTransactions.test.ts +195 -0
- package/src/db/tables/{fundingTransferTransactions.ts → routesTransferTransactions.ts} +63 -18
- package/src/db/tables/routesTransfers.test.ts +338 -0
- package/src/db/tables/routesTransfers.ts +662 -0
- package/src/db/tables/sponsoredTransactions.test.ts +269 -45
- package/src/db/tables/sponsoredTransactions.ts +225 -65
- package/src/db/tables/sponsorshipAttributions.test.ts +160 -0
- package/src/db/tables/sponsorshipAttributions.ts +168 -0
- package/src/db/tables/sponsorshipReconciliationCursors.test.ts +115 -0
- package/src/db/tables/sponsorshipReconciliationCursors.ts +67 -0
- package/src/db/tables/stripeCustomers.test.ts +85 -0
- package/src/db/tables/stripeCustomers.ts +24 -0
- package/src/db/tables/users.test.ts +129 -0
- package/src/db/tables/users.ts +49 -3
- package/src/db/tables/webhookQueueEvents.ts +8 -1
- package/src/db/tables/webhookSubscriptions.ts +95 -20
- package/src/handlers/internal/executionError.ts +3 -4
- package/src/handlers/internal/multisig.ts +13 -816
- package/src/handlers/internal/sponsorship.ts +26 -10
- package/src/handlers/relay.test-d.ts +9 -1
- package/src/handlers/relay.test.ts +823 -3
- package/src/handlers/relay.ts +127 -107
- package/src/index.test-d.ts +7 -0
- package/src/index.ts +0 -17
- package/src/internal/AssetResponse.ts +26 -0
- package/src/internal/Auth.test.ts +1564 -9
- package/src/internal/Auth.ts +833 -239
- package/src/internal/BetterAuth.test.ts +242 -0
- package/src/internal/BetterAuth.ts +349 -0
- package/src/internal/Cache.ts +2 -0
- package/src/internal/EarnRates.test.ts +17 -0
- package/src/internal/EarnRates.ts +124 -31
- package/src/internal/EarnSharePrices.test.ts +182 -0
- package/src/internal/EarnSharePrices.ts +313 -0
- package/src/internal/EarnVaults.test.ts +21 -0
- package/src/internal/EarnVaults.ts +33 -11
- package/src/internal/Email.ts +54 -0
- package/src/internal/Idempotency.test.ts +2 -2
- package/src/internal/Log.test-d.ts +8 -7
- package/src/internal/Log.test.ts +114 -16
- package/src/internal/Log.ts +53 -40
- package/src/internal/MetricSink.test.ts +313 -26
- package/src/internal/MetricSink.ts +73 -8
- package/src/internal/Mpp.test.ts +31 -0
- package/src/internal/Mpp.ts +21 -24
- package/src/internal/OpenApi.ts +45 -12
- package/src/internal/Provider.test.ts +1 -1
- package/src/internal/Provider.ts +1 -1
- package/src/internal/RateLimit.test.ts +21 -3
- package/src/internal/RateLimit.ts +12 -1
- package/src/internal/Store.test-d.ts +1 -1
- package/src/internal/Store.test.ts +151 -8
- package/src/internal/Store.ts +76 -9
- package/src/internal/Tidx.test.ts +59 -8
- package/src/internal/Tidx.ts +86 -14
- package/src/internal/Timing.test.ts +77 -0
- package/src/internal/Timing.ts +83 -6
- package/src/internal/VercelOidc.test.ts +188 -0
- package/src/internal/VercelOidc.ts +193 -0
- package/src/internal/VerifiedTokens.test.ts +60 -6
- package/src/internal/VerifiedTokens.ts +21 -24
- package/src/internal/Viem.batch.test.ts +80 -0
- package/src/internal/Viem.test.ts +201 -2
- package/src/internal/Viem.ts +221 -25
- package/src/internal/Webhooks.test.ts +85 -6
- package/src/internal/Webhooks.ts +22 -4
- package/src/internal/ZoneRpc.ts +50 -0
- package/src/internal/exchange/Provider.test.ts +2 -2
- package/src/internal/index.test.ts +3 -1
- package/src/internal/index.ts +3 -1
- package/src/internal/rewards/Audit.ts +231 -0
- package/src/internal/rewards/Campaigns.test.ts +1234 -0
- package/src/internal/rewards/Campaigns.ts +1205 -0
- package/src/internal/rewards/Credits.ts +165 -0
- package/src/internal/rewards/Events.local.test.ts +113 -0
- package/src/internal/rewards/Events.test.ts +152 -0
- package/src/internal/rewards/Events.ts +468 -0
- package/src/internal/rewards/Projection.test.ts +681 -0
- package/src/internal/rewards/Projection.ts +987 -0
- package/src/internal/rewards/Rates.test.ts +171 -0
- package/src/internal/rewards/Rates.ts +110 -0
- package/src/internal/rewards/Read.test.ts +501 -0
- package/src/internal/rewards/Read.ts +476 -0
- package/src/internal/rewards/Runner.checkpoint.test.ts +80 -0
- package/src/internal/rewards/Runner.states.test.ts +188 -0
- package/src/internal/rewards/Runner.test.ts +90 -0
- package/src/internal/rewards/Runner.ts +2229 -0
- package/src/internal/rewards/Signer.test.ts +79 -0
- package/src/internal/rewards/Signer.ts +180 -0
- package/src/internal/rewards/index.ts +14 -0
- package/src/internal/{funding → routes}/Action.test.ts +63 -14
- package/src/internal/{funding → routes}/Action.ts +35 -8
- package/src/internal/{funding → routes}/Catalog.test.ts +3 -3
- package/src/internal/{funding → routes}/Catalog.ts +39 -39
- package/src/internal/{funding → routes}/Chain.test.ts +1 -1
- package/src/internal/{funding → routes}/Chain.ts +11 -11
- package/src/internal/{funding → routes}/Deposit.test.ts +1 -1
- package/src/internal/{funding → routes}/Deposit.ts +93 -45
- package/src/internal/{funding → routes}/DepositAddress.test.ts +11 -3
- package/src/internal/{funding → routes}/DepositAddress.ts +132 -53
- package/src/internal/{funding → routes}/DepositWebhook.test.ts +61 -18
- package/src/internal/{funding → routes}/DepositWebhook.ts +9 -9
- package/src/internal/routes/Economics.test.ts +42 -0
- package/src/internal/routes/Economics.ts +47 -0
- package/src/internal/{funding → routes}/Evidence.test.ts +6 -6
- package/src/internal/{funding → routes}/Evidence.ts +9 -9
- package/src/internal/routes/Observability.test.ts +636 -0
- package/src/internal/routes/Observability.ts +668 -0
- package/src/internal/{funding → routes}/Provider.test.ts +489 -153
- package/src/internal/{funding → routes}/Provider.ts +489 -186
- package/src/internal/{funding → routes}/Reconciliation.local.test.ts +84 -12
- package/src/internal/{funding → routes}/Reconciliation.test.ts +1213 -279
- package/src/internal/{funding → routes}/Reconciliation.ts +501 -203
- package/src/internal/routes/Reconciliation.unattributed.test.ts +250 -0
- package/src/internal/{funding → routes}/Route.ts +7 -7
- package/src/internal/{funding → routes}/SourceObservation.test.ts +13 -14
- package/src/internal/{funding → routes}/SourceObservation.ts +13 -13
- package/src/internal/{funding → routes}/Subsidy.local.test.ts +7 -7
- package/src/internal/routes/Subsidy.test.ts +169 -0
- package/src/internal/{funding → routes}/Subsidy.ts +86 -6
- package/src/internal/{funding → routes}/Token.test.ts +1 -1
- package/src/internal/{funding → routes}/Token.ts +5 -5
- package/src/internal/routes/Transfer.test.ts +1199 -0
- package/src/internal/routes/Transfer.ts +1206 -0
- package/src/internal/routes/TransferReconciliation.test.ts +731 -0
- package/src/internal/routes/TransferReconciliation.ts +527 -0
- package/src/internal/routes/TransferSubsidy.test.ts +172 -0
- package/src/internal/routes/TransferSubsidy.ts +447 -0
- package/src/internal/{funding → routes}/TransferWebhook.test.ts +13 -13
- package/src/internal/{funding → routes}/TransferWebhook.ts +7 -7
- package/src/internal/{funding → routes}/index.test.ts +5 -3
- package/src/internal/{funding → routes}/index.ts +2 -0
- package/src/internal/{funding → routes}/providers/across.ts +16 -16
- package/src/internal/{funding → routes}/providers/index.test.ts +157 -44
- package/src/internal/{funding → routes}/providers/relay.test.ts +165 -32
- package/src/internal/{funding → routes}/providers/relay.ts +228 -121
- package/src/internal/{funding → routes}/providers/rhino.ts +16 -16
- package/src/internal/{funding → routes}/providers/squid.ts +17 -17
- package/src/internal/routes/providers/stargate.test.ts +728 -0
- package/src/internal/routes/providers/stargate.ts +1276 -0
- package/src/internal/{funding → routes}/providers/symbiosis.ts +64 -24
- package/src/internal/webhookDestinations/slack.ts +10 -10
- package/src/providers/index.ts +13 -13
- package/src/server.ts +18 -0
- package/dist/apps/funding/Access.d.ts.map +0 -1
- package/dist/apps/funding/Access.js.map +0 -1
- package/dist/apps/funding/App.js.map +0 -1
- package/dist/apps/funding/Inventory.d.ts.map +0 -1
- package/dist/apps/funding/Inventory.js.map +0 -1
- package/dist/apps/funding/ProviderAttempts.d.ts +0 -5
- package/dist/apps/funding/ProviderAttempts.d.ts.map +0 -1
- package/dist/apps/funding/ProviderAttempts.js +0 -24
- package/dist/apps/funding/ProviderAttempts.js.map +0 -1
- package/dist/apps/funding/index.d.ts +0 -2
- package/dist/apps/funding/index.d.ts.map +0 -1
- package/dist/apps/funding/index.js +0 -2
- package/dist/apps/funding/index.js.map +0 -1
- package/dist/apps/funding/routes/chains.d.ts.map +0 -1
- package/dist/apps/funding/routes/chains.js.map +0 -1
- package/dist/apps/funding/routes/deposit-addresses.d.ts.map +0 -1
- package/dist/apps/funding/routes/deposit-addresses.js.map +0 -1
- package/dist/apps/funding/routes/providers.d.ts.map +0 -1
- package/dist/apps/funding/routes/providers.js +0 -57
- package/dist/apps/funding/routes/providers.js.map +0 -1
- package/dist/apps/funding/routes/quotes.d.ts.map +0 -1
- package/dist/apps/funding/routes/quotes.js.map +0 -1
- package/dist/apps/funding/routes/transfers.d.ts.map +0 -1
- package/dist/apps/funding/routes/transfers.js +0 -828
- package/dist/apps/funding/routes/transfers.js.map +0 -1
- package/dist/db/tables/fundingCatalog.d.ts +0 -58
- package/dist/db/tables/fundingCatalog.d.ts.map +0 -1
- package/dist/db/tables/fundingCatalog.js.map +0 -1
- package/dist/db/tables/fundingDepositAddresses.d.ts +0 -192
- package/dist/db/tables/fundingDepositAddresses.d.ts.map +0 -1
- package/dist/db/tables/fundingDepositAddresses.js +0 -235
- package/dist/db/tables/fundingDepositAddresses.js.map +0 -1
- package/dist/db/tables/fundingDepositRequestObservations.d.ts.map +0 -1
- package/dist/db/tables/fundingDepositRequestObservations.js.map +0 -1
- package/dist/db/tables/fundingDeposits.d.ts.map +0 -1
- package/dist/db/tables/fundingDeposits.js +0 -295
- package/dist/db/tables/fundingDeposits.js.map +0 -1
- package/dist/db/tables/fundingIdempotency.d.ts +0 -91
- package/dist/db/tables/fundingIdempotency.d.ts.map +0 -1
- package/dist/db/tables/fundingIdempotency.js +0 -103
- package/dist/db/tables/fundingIdempotency.js.map +0 -1
- package/dist/db/tables/fundingTransferEvents.d.ts.map +0 -1
- package/dist/db/tables/fundingTransferEvents.js.map +0 -1
- package/dist/db/tables/fundingTransferTransactions.d.ts +0 -53
- package/dist/db/tables/fundingTransferTransactions.d.ts.map +0 -1
- package/dist/db/tables/fundingTransferTransactions.js.map +0 -1
- package/dist/db/tables/fundingTransfers.d.ts +0 -99
- package/dist/db/tables/fundingTransfers.d.ts.map +0 -1
- package/dist/db/tables/fundingTransfers.js +0 -110
- package/dist/db/tables/fundingTransfers.js.map +0 -1
- package/dist/internal/funding/Action.d.ts.map +0 -1
- package/dist/internal/funding/Action.js.map +0 -1
- package/dist/internal/funding/Catalog.d.ts.map +0 -1
- package/dist/internal/funding/Catalog.js.map +0 -1
- package/dist/internal/funding/Chain.d.ts.map +0 -1
- package/dist/internal/funding/Chain.js.map +0 -1
- package/dist/internal/funding/Deposit.d.ts.map +0 -1
- package/dist/internal/funding/Deposit.js.map +0 -1
- package/dist/internal/funding/DepositAddress.d.ts.map +0 -1
- package/dist/internal/funding/DepositAddress.js.map +0 -1
- package/dist/internal/funding/DepositWebhook.d.ts.map +0 -1
- package/dist/internal/funding/DepositWebhook.js.map +0 -1
- package/dist/internal/funding/Evidence.d.ts.map +0 -1
- package/dist/internal/funding/Evidence.js.map +0 -1
- package/dist/internal/funding/Provider.d.ts.map +0 -1
- package/dist/internal/funding/Provider.js.map +0 -1
- package/dist/internal/funding/Reconciliation.d.ts.map +0 -1
- package/dist/internal/funding/Reconciliation.js.map +0 -1
- package/dist/internal/funding/Route.d.ts +0 -21
- package/dist/internal/funding/Route.d.ts.map +0 -1
- package/dist/internal/funding/Route.js.map +0 -1
- package/dist/internal/funding/SourceObservation.d.ts.map +0 -1
- package/dist/internal/funding/SourceObservation.js.map +0 -1
- package/dist/internal/funding/Subsidy.d.ts.map +0 -1
- package/dist/internal/funding/Subsidy.js.map +0 -1
- package/dist/internal/funding/Token.d.ts.map +0 -1
- package/dist/internal/funding/Token.js.map +0 -1
- package/dist/internal/funding/Transfer.d.ts.map +0 -1
- package/dist/internal/funding/Transfer.js +0 -462
- package/dist/internal/funding/Transfer.js.map +0 -1
- package/dist/internal/funding/TransferReconciliation.d.ts.map +0 -1
- package/dist/internal/funding/TransferReconciliation.js +0 -192
- package/dist/internal/funding/TransferReconciliation.js.map +0 -1
- package/dist/internal/funding/TransferWebhook.d.ts.map +0 -1
- package/dist/internal/funding/TransferWebhook.js.map +0 -1
- package/dist/internal/funding/index.d.ts.map +0 -1
- package/dist/internal/funding/index.js.map +0 -1
- package/dist/internal/funding/providers/across.d.ts.map +0 -1
- package/dist/internal/funding/providers/across.js.map +0 -1
- package/dist/internal/funding/providers/relay.d.ts.map +0 -1
- package/dist/internal/funding/providers/relay.js.map +0 -1
- package/dist/internal/funding/providers/rhino.d.ts.map +0 -1
- package/dist/internal/funding/providers/rhino.js.map +0 -1
- package/dist/internal/funding/providers/squid.d.ts.map +0 -1
- package/dist/internal/funding/providers/squid.js.map +0 -1
- package/dist/internal/funding/providers/stargate.d.ts.map +0 -1
- package/dist/internal/funding/providers/stargate.js +0 -579
- package/dist/internal/funding/providers/stargate.js.map +0 -1
- package/dist/internal/funding/providers/symbiosis.d.ts.map +0 -1
- package/dist/internal/funding/providers/symbiosis.js.map +0 -1
- package/src/apps/funding/App.test.ts +0 -78
- package/src/apps/funding/App.ts +0 -88
- package/src/apps/funding/ProviderAttempts.ts +0 -26
- package/src/apps/funding/index.ts +0 -1
- package/src/apps/funding/routes/transfers.ts +0 -987
- package/src/db/tables/fundingCatalog.test.ts +0 -122
- package/src/db/tables/fundingCatalog.ts +0 -163
- package/src/db/tables/fundingDepositAddresses.test.ts +0 -608
- package/src/db/tables/fundingDepositAddresses.ts +0 -443
- package/src/db/tables/fundingDeposits.ts +0 -572
- package/src/db/tables/fundingIdempotency.test.ts +0 -182
- package/src/db/tables/fundingIdempotency.ts +0 -180
- package/src/db/tables/fundingTransferTransactions.test.ts +0 -112
- package/src/db/tables/fundingTransfers.test.ts +0 -115
- package/src/db/tables/fundingTransfers.ts +0 -189
- package/src/handlers/internal/multisig.test.ts +0 -818
- package/src/internal/funding/Subsidy.test.ts +0 -75
- package/src/internal/funding/Transfer.test.ts +0 -524
- package/src/internal/funding/Transfer.ts +0 -762
- package/src/internal/funding/TransferReconciliation.test.ts +0 -147
- package/src/internal/funding/TransferReconciliation.ts +0 -264
- package/src/internal/funding/providers/stargate.test.ts +0 -328
- package/src/internal/funding/providers/stargate.ts +0 -856
- /package/dist/apps/{funding → routes}/Inventory.d.ts +0 -0
- /package/src/internal/{funding → routes}/Route.test.ts +0 -0
|
@@ -1,43 +1,48 @@
|
|
|
1
1
|
import { type Context, Hono } from 'hono'
|
|
2
|
+
import { bodyLimit } from 'hono/body-limit'
|
|
2
3
|
import { etag } from 'hono/etag'
|
|
3
4
|
import * as z from 'zod/mini'
|
|
4
5
|
|
|
5
6
|
import type * as App from '../../../App.js'
|
|
6
7
|
import * as Db from '../../../db/Db.js'
|
|
7
|
-
import * as
|
|
8
|
-
import * as
|
|
9
|
-
import * as
|
|
8
|
+
import * as RoutesDepositAddresses from '../../../db/tables/routesDepositAddresses.js'
|
|
9
|
+
import * as RoutesDeposits from '../../../db/tables/routesDeposits.js'
|
|
10
|
+
import * as RoutesIdempotency from '../../../db/tables/routesIdempotency.js'
|
|
10
11
|
import * as Auth from '../../../internal/Auth.js'
|
|
11
12
|
import * as Cache from '../../../internal/Cache.js'
|
|
12
13
|
import * as Cursor from '../../../internal/Cursor.js'
|
|
13
|
-
import * as
|
|
14
|
-
import * as
|
|
15
|
-
import * as
|
|
16
|
-
import * as
|
|
17
|
-
import * as
|
|
14
|
+
import * as RoutesCatalog from '../../../internal/routes/Catalog.js'
|
|
15
|
+
import * as RoutesDeposit from '../../../internal/routes/Deposit.js'
|
|
16
|
+
import * as RoutesDepositAddress from '../../../internal/routes/DepositAddress.js'
|
|
17
|
+
import * as RoutesObservability from '../../../internal/routes/Observability.js'
|
|
18
|
+
import * as RoutesProvider from '../../../internal/routes/Provider.js'
|
|
19
|
+
import * as RoutesSubsidy from '../../../internal/routes/Subsidy.js'
|
|
20
|
+
import * as RoutesTransfer from '../../../internal/routes/Transfer.js'
|
|
18
21
|
import * as Idempotency from '../../../internal/Idempotency.js'
|
|
19
22
|
import * as OpenApi from '../../../internal/OpenApi.js'
|
|
20
23
|
import * as Response from '../../../internal/Response.js'
|
|
21
24
|
import * as Schema from '../../../internal/Schema.js'
|
|
22
25
|
import * as Value from '../../../internal/Value.js'
|
|
23
26
|
import * as Access from '../Access.js'
|
|
24
|
-
import * as ProviderAttempts from '../ProviderAttempts.js'
|
|
25
27
|
|
|
26
|
-
/**
|
|
28
|
+
/** Matches manual reconciliation's quota for another provider-backed address operation. */
|
|
29
|
+
const creationRateLimit = { limit: 10, period: 'minute' } as const
|
|
30
|
+
|
|
31
|
+
/** Zod schemas owned by route deposit-address resources. */
|
|
27
32
|
export namespace schema {
|
|
28
|
-
/** One reusable
|
|
29
|
-
export const DepositAddress =
|
|
33
|
+
/** One reusable route deposit address. */
|
|
34
|
+
export const DepositAddress = RoutesDepositAddress.schema.RoutesDepositAddress
|
|
30
35
|
|
|
31
|
-
/** One detected
|
|
32
|
-
export const Deposit =
|
|
36
|
+
/** One detected route deposit. */
|
|
37
|
+
export const Deposit = RoutesDeposit.schema.RoutesDeposit
|
|
33
38
|
|
|
34
|
-
/** Schemas for the
|
|
35
|
-
export namespace
|
|
36
|
-
/**
|
|
39
|
+
/** Schemas for the createRoutesDepositAddress operation. */
|
|
40
|
+
export namespace createRoutesDepositAddress {
|
|
41
|
+
/** Route deposit address creation request body. */
|
|
37
42
|
export const Body = OpenApi.component(
|
|
38
43
|
z
|
|
39
44
|
.strictObject({
|
|
40
|
-
amount:
|
|
45
|
+
amount: RoutesTransfer.schema.CreateRequest.shape.amount,
|
|
41
46
|
destinationToken: z
|
|
42
47
|
.string()
|
|
43
48
|
.check(
|
|
@@ -80,11 +85,11 @@ export namespace schema {
|
|
|
80
85
|
z.meta({ examples: [false] }),
|
|
81
86
|
),
|
|
82
87
|
})
|
|
83
|
-
.check(z.describe('Reusable
|
|
84
|
-
'
|
|
88
|
+
.check(z.describe('Reusable route deposit address creation request.')),
|
|
89
|
+
'CreateRoutesDepositAddressRequest',
|
|
85
90
|
)
|
|
86
91
|
|
|
87
|
-
/** Required headers for
|
|
92
|
+
/** Required headers for route deposit address creation. */
|
|
88
93
|
export const Headers = z.object({
|
|
89
94
|
'idempotency-key': z
|
|
90
95
|
.string()
|
|
@@ -93,7 +98,7 @@ export namespace schema {
|
|
|
93
98
|
z.describe(
|
|
94
99
|
'Opaque retry key scoped to the API key. Matching requests replay successful responses for 24 hours; changed input conflicts, in-flight requests block, and failed attempts release the key.',
|
|
95
100
|
),
|
|
96
|
-
z.meta({ examples: ['
|
|
101
|
+
z.meta({ examples: ['routes_01k1c5j8q8p0be6j5v9m6d1e4r'] }),
|
|
97
102
|
),
|
|
98
103
|
})
|
|
99
104
|
|
|
@@ -101,70 +106,70 @@ export namespace schema {
|
|
|
101
106
|
export const Response = OpenApi.component(
|
|
102
107
|
z
|
|
103
108
|
.union([
|
|
104
|
-
|
|
105
|
-
|
|
109
|
+
RoutesDepositAddress.schema.CreatedRoutesDepositAddress,
|
|
110
|
+
RoutesDepositAddress.schema.RoutesDepositAddress,
|
|
106
111
|
])
|
|
107
112
|
.check(
|
|
108
113
|
z.describe(
|
|
109
|
-
'A reusable
|
|
114
|
+
'A reusable route deposit address, including terms sampled for a newly stored provider address.',
|
|
110
115
|
),
|
|
111
116
|
),
|
|
112
|
-
'
|
|
117
|
+
'CreateRoutesDepositAddressResponse',
|
|
113
118
|
)
|
|
114
119
|
}
|
|
115
120
|
|
|
116
|
-
/** Schemas for the
|
|
117
|
-
export namespace
|
|
118
|
-
/** Path parameters for reading a
|
|
121
|
+
/** Schemas for the getRoutesDepositAddress operation. */
|
|
122
|
+
export namespace getRoutesDepositAddress {
|
|
123
|
+
/** Path parameters for reading a route deposit address. */
|
|
119
124
|
export const Params = z
|
|
120
125
|
.object({
|
|
121
126
|
id: z
|
|
122
127
|
.string()
|
|
123
128
|
.check(
|
|
124
|
-
z.regex(/^
|
|
125
|
-
z.describe('
|
|
126
|
-
z.meta({ examples: ['
|
|
129
|
+
z.regex(/^rda_[A-Za-z0-9_-]+$/),
|
|
130
|
+
z.describe('Route deposit address ID (`rda_…`).'),
|
|
131
|
+
z.meta({ examples: ['rda_001785792000000_2ZPE2gvateYEQ0dQslgvkhjx'] }),
|
|
127
132
|
),
|
|
128
133
|
})
|
|
129
|
-
.check(z.describe('Path parameters for reading a
|
|
134
|
+
.check(z.describe('Path parameters for reading a route deposit address.'))
|
|
130
135
|
|
|
131
|
-
/** One reusable
|
|
136
|
+
/** One reusable route deposit address. */
|
|
132
137
|
export const Response = DepositAddress
|
|
133
138
|
}
|
|
134
139
|
|
|
135
|
-
/** Schemas for the
|
|
136
|
-
export namespace
|
|
137
|
-
/** Query parameters for listing
|
|
140
|
+
/** Schemas for the listRoutesDepositAddresses operation. */
|
|
141
|
+
export namespace listRoutesDepositAddresses {
|
|
142
|
+
/** Query parameters for listing route deposit addresses. */
|
|
138
143
|
export const Query = z
|
|
139
144
|
.object({
|
|
140
145
|
cursor: Schema.Cursor,
|
|
141
146
|
limit: Schema.Limit,
|
|
142
147
|
})
|
|
143
|
-
.check(z.describe('Paging parameters for listing
|
|
148
|
+
.check(z.describe('Paging parameters for listing route deposit addresses.'))
|
|
144
149
|
|
|
145
|
-
/** One page of reusable
|
|
150
|
+
/** One page of reusable route deposit addresses. */
|
|
146
151
|
export const Response = OpenApi.component(
|
|
147
152
|
z
|
|
148
153
|
.object({
|
|
149
154
|
data: z
|
|
150
155
|
.array(DepositAddress)
|
|
151
|
-
.check(z.describe('
|
|
156
|
+
.check(z.describe('Route deposit addresses on this page, newest first.')),
|
|
152
157
|
nextCursor: Schema.NextCursor,
|
|
153
158
|
})
|
|
154
|
-
.check(z.describe('A page of reusable
|
|
155
|
-
'
|
|
159
|
+
.check(z.describe('A page of reusable route deposit addresses.')),
|
|
160
|
+
'RoutesDepositAddressList',
|
|
156
161
|
)
|
|
157
162
|
}
|
|
158
163
|
|
|
159
|
-
/** Schemas for the
|
|
160
|
-
export namespace
|
|
161
|
-
/** Path parameters for reconciling a
|
|
162
|
-
export const Params =
|
|
164
|
+
/** Schemas for the reconcileRoutesDepositAddress operation. */
|
|
165
|
+
export namespace reconcileRoutesDepositAddress {
|
|
166
|
+
/** Path parameters for reconciling a route deposit address. */
|
|
167
|
+
export const Params = getRoutesDepositAddress.Params
|
|
163
168
|
}
|
|
164
169
|
|
|
165
|
-
/** Schemas for the
|
|
166
|
-
export namespace
|
|
167
|
-
/** Query parameters for listing
|
|
170
|
+
/** Schemas for the listRoutesDeposits operation. */
|
|
171
|
+
export namespace listRoutesDeposits {
|
|
172
|
+
/** Query parameters for listing route deposits. */
|
|
168
173
|
export const Query = z
|
|
169
174
|
.object({
|
|
170
175
|
depositAddress: z
|
|
@@ -184,7 +189,7 @@ export namespace schema {
|
|
|
184
189
|
limit: Schema.Limit,
|
|
185
190
|
provider: z
|
|
186
191
|
.optional(z.string().check(z.minLength(1)))
|
|
187
|
-
.check(z.describe('
|
|
192
|
+
.check(z.describe('Route provider id.'), z.meta({ examples: ['relay'] })),
|
|
188
193
|
recipient: z
|
|
189
194
|
.optional(Schema.Address)
|
|
190
195
|
.check(
|
|
@@ -203,7 +208,7 @@ export namespace schema {
|
|
|
203
208
|
z.describe('Source token symbol, contract address, or token key.'),
|
|
204
209
|
z.meta({ examples: ['usdt'] }),
|
|
205
210
|
),
|
|
206
|
-
status: z.optional(
|
|
211
|
+
status: z.optional(RoutesDeposit.schema.Status),
|
|
207
212
|
})
|
|
208
213
|
.check(z.describe('Optional deposit filters and paging parameters.'))
|
|
209
214
|
|
|
@@ -217,27 +222,27 @@ export namespace schema {
|
|
|
217
222
|
.check(z.describe('Extra response metadata requested with `include`.')),
|
|
218
223
|
nextCursor: Schema.NextCursor,
|
|
219
224
|
})
|
|
220
|
-
.check(z.describe('A page of visible
|
|
221
|
-
'
|
|
225
|
+
.check(z.describe('A page of visible route deposits.')),
|
|
226
|
+
'RoutesDepositList',
|
|
222
227
|
)
|
|
223
228
|
}
|
|
224
229
|
|
|
225
|
-
/** Schemas for the
|
|
226
|
-
export namespace
|
|
227
|
-
/** Path parameters for reading a
|
|
230
|
+
/** Schemas for the getRoutesDeposit operation. */
|
|
231
|
+
export namespace getRoutesDeposit {
|
|
232
|
+
/** Path parameters for reading a route deposit. */
|
|
228
233
|
export const Params = z
|
|
229
234
|
.object({
|
|
230
235
|
id: z
|
|
231
236
|
.string()
|
|
232
237
|
.check(
|
|
233
|
-
z.regex(/^
|
|
234
|
-
z.describe('
|
|
235
|
-
z.meta({ examples: ['
|
|
238
|
+
z.regex(/^rdp_[A-Za-z0-9_-]+$/),
|
|
239
|
+
z.describe('Route deposit id (`rdp_…`).'),
|
|
240
|
+
z.meta({ examples: ['rdp_001785792060000_2ZPE2gvateYEQ0dQslgvkhjx'] }),
|
|
236
241
|
),
|
|
237
242
|
})
|
|
238
|
-
.check(z.describe('Path parameters for reading a
|
|
243
|
+
.check(z.describe('Path parameters for reading a route deposit.'))
|
|
239
244
|
|
|
240
|
-
/** One detected
|
|
245
|
+
/** One detected route deposit. */
|
|
241
246
|
export const Response = Deposit
|
|
242
247
|
}
|
|
243
248
|
}
|
|
@@ -278,12 +283,12 @@ const tempoUsdt0Example = {
|
|
|
278
283
|
verified: true,
|
|
279
284
|
} as const
|
|
280
285
|
|
|
281
|
-
const
|
|
286
|
+
const routesDepositAddressExample = {
|
|
282
287
|
address: 'TJRabPrwbZy45sbavfcjinPJC18kjpRTv8',
|
|
283
288
|
createdAt: '2026-08-04T00:00:00.000Z',
|
|
284
289
|
destinationChain: tempoChainExample,
|
|
285
290
|
destinationToken: tempoUsdt0Example,
|
|
286
|
-
id: '
|
|
291
|
+
id: 'rda_001785792000000_2ZPE2gvateYEQ0dQslgvkhjx',
|
|
287
292
|
provider: { id: 'relay', name: 'Relay' },
|
|
288
293
|
recipient: `0x${'11'.repeat(20)}`,
|
|
289
294
|
refundAddress: 'TJRabPrwbZy45sbavfcjinPJC18kjpRTv8',
|
|
@@ -294,8 +299,8 @@ const fundingDepositAddressExample = {
|
|
|
294
299
|
updatedAt: '2026-08-04T00:00:00.000Z',
|
|
295
300
|
} satisfies z.output<typeof schema.DepositAddress>
|
|
296
301
|
|
|
297
|
-
const
|
|
298
|
-
...
|
|
302
|
+
const createdRoutesDepositAddressExample = {
|
|
303
|
+
...routesDepositAddressExample,
|
|
299
304
|
destinationAmount: Value.tokenAmount({ baseUnits: '1000000', currency: 'USD', decimals: 6 }),
|
|
300
305
|
destinationAmountMin: Value.tokenAmount({
|
|
301
306
|
baseUnits: '1000000',
|
|
@@ -305,18 +310,18 @@ const createdFundingDepositAddressExample = {
|
|
|
305
310
|
fees: [],
|
|
306
311
|
quote: { sampledAt: '2026-08-04T00:00:00.000Z' },
|
|
307
312
|
sourceAmount: Value.tokenAmount({ baseUnits: '1000000', currency: 'USD', decimals: 6 }),
|
|
308
|
-
} satisfies z.output<typeof schema.
|
|
313
|
+
} satisfies z.output<typeof schema.createRoutesDepositAddress.Response>
|
|
309
314
|
|
|
310
|
-
const
|
|
315
|
+
const routesDepositExample = {
|
|
311
316
|
createdAt: '2026-08-04T00:01:00.000Z',
|
|
312
|
-
depositAddressId:
|
|
317
|
+
depositAddressId: routesDepositAddressExample.id,
|
|
313
318
|
detectionTrigger: 'webhook',
|
|
314
319
|
destinationChain: tempoChainExample,
|
|
315
320
|
destinationToken: tempoUsdt0Example,
|
|
316
|
-
id: '
|
|
321
|
+
id: 'rdp_001785792060000_2ZPE2gvateYEQ0dQslgvkhjx',
|
|
317
322
|
provider: { id: 'relay', name: 'Relay' },
|
|
318
|
-
recipient:
|
|
319
|
-
refundAddress:
|
|
323
|
+
recipient: routesDepositAddressExample.recipient,
|
|
324
|
+
refundAddress: routesDepositAddressExample.refundAddress,
|
|
320
325
|
sourceChain: tronChainExample,
|
|
321
326
|
sourceToken: tronUsdtExample,
|
|
322
327
|
sourceTransactionHashes: ['9f2c4c80dbb468878baa8c07ff523e0464bf6437f2a486268508485d83f14d12'],
|
|
@@ -324,18 +329,18 @@ const fundingDepositExample = {
|
|
|
324
329
|
updatedAt: '2026-08-04T00:01:00.000Z',
|
|
325
330
|
} satisfies z.output<typeof schema.Deposit>
|
|
326
331
|
|
|
327
|
-
const
|
|
328
|
-
data: [
|
|
332
|
+
const routesDepositsExample = {
|
|
333
|
+
data: [routesDepositExample],
|
|
329
334
|
meta: { totalCount: 1, totalCountCapped: false },
|
|
330
335
|
nextCursor: null,
|
|
331
|
-
} satisfies z.output<typeof schema.
|
|
336
|
+
} satisfies z.output<typeof schema.listRoutesDeposits.Response>
|
|
332
337
|
|
|
333
|
-
const
|
|
334
|
-
data: [
|
|
338
|
+
const routesDepositAddressesExample = {
|
|
339
|
+
data: [routesDepositAddressExample],
|
|
335
340
|
nextCursor: null,
|
|
336
|
-
} satisfies z.output<typeof schema.
|
|
341
|
+
} satisfies z.output<typeof schema.listRoutesDepositAddresses.Response>
|
|
337
342
|
|
|
338
|
-
function resolveDepositFilters(options: resolveDepositFilters.Options):
|
|
343
|
+
function resolveDepositFilters(options: resolveDepositFilters.Options): RoutesDeposits.Filters {
|
|
339
344
|
const { catalog, parameters } = options
|
|
340
345
|
return {
|
|
341
346
|
...(parameters.depositAddress === undefined
|
|
@@ -372,12 +377,12 @@ function resolveDepositFilters(options: resolveDepositFilters.Options): FundingD
|
|
|
372
377
|
|
|
373
378
|
declare namespace resolveDepositFilters {
|
|
374
379
|
type Options = {
|
|
375
|
-
catalog?:
|
|
376
|
-
parameters: z.output<typeof schema.
|
|
380
|
+
catalog?: RoutesCatalog.Snapshot | undefined
|
|
381
|
+
parameters: z.output<typeof schema.listRoutesDeposits.Query>
|
|
377
382
|
}
|
|
378
383
|
}
|
|
379
384
|
|
|
380
|
-
function resolveChainIds(catalog:
|
|
385
|
+
function resolveChainIds(catalog: RoutesCatalog.Snapshot | undefined, input: string): string[] {
|
|
381
386
|
const trimmed = input.trim()
|
|
382
387
|
const chain = catalog?.chainsByKey.get(trimmed.toLowerCase())
|
|
383
388
|
if (chain) return [chain.id]
|
|
@@ -399,13 +404,13 @@ function resolveTokenKeys(options: resolveTokenKeys.Options): string[] {
|
|
|
399
404
|
|
|
400
405
|
declare namespace resolveTokenKeys {
|
|
401
406
|
type Options = {
|
|
402
|
-
catalog?:
|
|
407
|
+
catalog?: RoutesCatalog.Snapshot | undefined
|
|
403
408
|
input: string
|
|
404
409
|
side: 'destination' | 'source'
|
|
405
410
|
}
|
|
406
411
|
}
|
|
407
412
|
|
|
408
|
-
type ResolvedToken =
|
|
413
|
+
type ResolvedToken = RoutesCatalog.Snapshot['routes'][number]['route']['source']
|
|
409
414
|
|
|
410
415
|
function matchesToken(token: ResolvedToken, trimmed: string, normalized: string): boolean {
|
|
411
416
|
return (
|
|
@@ -434,25 +439,25 @@ function tokenKey(token: ResolvedToken): string {
|
|
|
434
439
|
return `${token.chain.id}/${namespace}:${token.address}`
|
|
435
440
|
}
|
|
436
441
|
|
|
437
|
-
const
|
|
442
|
+
const reconcileRoutesDepositAddressResponses = (() => {
|
|
438
443
|
const responses = OpenApi.responses({
|
|
439
444
|
errors: {
|
|
440
445
|
400: { codes: ['param_invalid'] },
|
|
441
446
|
403: {
|
|
442
447
|
codes: ['api_key_forbidden'],
|
|
443
|
-
description: 'The API key does not grant
|
|
448
|
+
description: 'The API key does not grant routes write access.',
|
|
444
449
|
},
|
|
445
450
|
404: {
|
|
446
|
-
codes: ['
|
|
447
|
-
description: 'No visible
|
|
451
|
+
codes: ['routes_deposit_address_not_found'],
|
|
452
|
+
description: 'No visible route deposit address exists for the identifier.',
|
|
448
453
|
},
|
|
449
454
|
409: {
|
|
450
|
-
codes: ['
|
|
451
|
-
description: 'The
|
|
455
|
+
codes: ['routes_deposit_address_not_active'],
|
|
456
|
+
description: 'The route deposit address is not active.',
|
|
452
457
|
},
|
|
453
458
|
501: {
|
|
454
459
|
codes: ['not_implemented'],
|
|
455
|
-
description: 'Manual
|
|
460
|
+
description: 'Manual routes reconciliation is not configured.',
|
|
456
461
|
},
|
|
457
462
|
502: {
|
|
458
463
|
codes: ['upstream_error'],
|
|
@@ -468,7 +473,7 @@ const reconcileFundingDepositAddressResponses = (() => {
|
|
|
468
473
|
void success
|
|
469
474
|
return {
|
|
470
475
|
202: {
|
|
471
|
-
description: 'The
|
|
476
|
+
description: 'The route deposit address was queued for reconciliation.',
|
|
472
477
|
headers: { ...OpenApi.successHeaders },
|
|
473
478
|
},
|
|
474
479
|
...errors,
|
|
@@ -482,63 +487,103 @@ const idempotencyPendingTtlMs = 60_000
|
|
|
482
487
|
|
|
483
488
|
const depositAddressCheckpoint = Schema.describe(
|
|
484
489
|
z.object({
|
|
490
|
+
amount: z.optional(RoutesTransfer.schema.CreateRequest.shape.amount),
|
|
485
491
|
candidate: Schema.describe(
|
|
486
492
|
z.object({
|
|
487
|
-
destinationChain:
|
|
488
|
-
destinationToken:
|
|
489
|
-
sourceChain:
|
|
490
|
-
sourceToken:
|
|
493
|
+
destinationChain: RoutesProvider.schema.ChainRef,
|
|
494
|
+
destinationToken: RoutesProvider.schema.TokenRef,
|
|
495
|
+
sourceChain: RoutesProvider.schema.ChainRef,
|
|
496
|
+
sourceToken: RoutesProvider.schema.TokenRef,
|
|
491
497
|
}),
|
|
492
498
|
'Normalized route retained after provider provisioning.',
|
|
493
499
|
),
|
|
494
|
-
provider:
|
|
500
|
+
provider: RoutesProvider.schema.ProviderRef,
|
|
495
501
|
recipient: z.string().check(z.describe('Normalized Tempo recipient.')),
|
|
496
502
|
refundAddress: z.string().check(z.describe('Normalized source-chain refund account.')),
|
|
497
|
-
result:
|
|
503
|
+
result: RoutesProvider.schema.DepositAddressResult,
|
|
498
504
|
}),
|
|
499
505
|
'Provider result retained until deposit address creation completes.',
|
|
500
506
|
)
|
|
501
507
|
|
|
502
|
-
const
|
|
508
|
+
const routesEtag = etag()
|
|
509
|
+
// Provider callbacks are small JSON documents; bound buffering before signature verification.
|
|
510
|
+
const maxProviderWebhookBodyBytes = 64 * 1_024
|
|
503
511
|
|
|
504
512
|
/** Mounts reusable deposit-address and detected-deposit routes. */
|
|
505
513
|
export function depositAddresses(options: depositAddresses.Options = {}) {
|
|
506
514
|
return new Hono<App.Environment>()
|
|
507
|
-
.post('/webhooks/funding/:providerId', async (c) => {
|
|
508
|
-
const provider = c
|
|
509
|
-
.get('providers')
|
|
510
|
-
.filter(FundingProvider.is)
|
|
511
|
-
.find((candidate) => candidate.id === c.req.param('providerId'))
|
|
512
|
-
if (!provider || !FundingProvider.canReceiveWebhook(provider)) return c.body(null, 404)
|
|
513
|
-
try {
|
|
514
|
-
await provider.webhook.receive({
|
|
515
|
-
body: await c.req.text(),
|
|
516
|
-
headers: c.req.raw.headers,
|
|
517
|
-
})
|
|
518
|
-
return c.body(null, 204)
|
|
519
|
-
} catch (cause) {
|
|
520
|
-
if (cause instanceof FundingProvider.WebhookAuthenticationError) return c.body(null, 401)
|
|
521
|
-
if (cause instanceof FundingProvider.WebhookPayloadError) return c.body(null, 400)
|
|
522
|
-
throw cause
|
|
523
|
-
}
|
|
524
|
-
})
|
|
525
515
|
.post(
|
|
526
|
-
'/
|
|
527
|
-
|
|
528
|
-
|
|
516
|
+
'/webhooks/routes/:providerId',
|
|
517
|
+
async (c, next) => {
|
|
518
|
+
const provider = c
|
|
519
|
+
.get('providers')
|
|
520
|
+
.filter(RoutesProvider.is)
|
|
521
|
+
.find((candidate) => candidate.id === c.req.param('providerId'))
|
|
522
|
+
if (!provider || !RoutesProvider.canReceiveWebhook(provider)) return c.body(null, 404)
|
|
523
|
+
return next()
|
|
524
|
+
},
|
|
525
|
+
bodyLimit({
|
|
526
|
+
maxSize: maxProviderWebhookBodyBytes,
|
|
527
|
+
onError: (c) => c.body(null, 413),
|
|
528
|
+
}),
|
|
529
|
+
async (c) => {
|
|
530
|
+
const provider = c
|
|
531
|
+
.get('providers')
|
|
532
|
+
.filter(RoutesProvider.is)
|
|
533
|
+
.find((candidate) => candidate.id === c.req.param('providerId'))
|
|
534
|
+
if (!provider || !RoutesProvider.canReceiveWebhook(provider)) return c.body(null, 404)
|
|
535
|
+
const body = await c.req.text()
|
|
536
|
+
try {
|
|
537
|
+
await RoutesProvider.observe(
|
|
538
|
+
provider,
|
|
539
|
+
() =>
|
|
540
|
+
provider.webhook.receive({
|
|
541
|
+
body,
|
|
542
|
+
headers: c.req.raw.headers,
|
|
543
|
+
}),
|
|
544
|
+
{
|
|
545
|
+
onAttempt: (result) => c.set('routesProviderAttempts', [result]),
|
|
546
|
+
operation: 'receiveWebhook',
|
|
547
|
+
},
|
|
548
|
+
)
|
|
549
|
+
return c.body(null, 204)
|
|
550
|
+
} catch (cause) {
|
|
551
|
+
if (cause instanceof RoutesProvider.WebhookAuthenticationError) return c.body(null, 401)
|
|
552
|
+
if (cause instanceof RoutesProvider.WebhookPayloadError) return c.body(null, 400)
|
|
553
|
+
throw cause
|
|
554
|
+
}
|
|
555
|
+
},
|
|
556
|
+
)
|
|
557
|
+
.post(
|
|
558
|
+
'/v1/routes/deposit-addresses',
|
|
559
|
+
Auth.policy({
|
|
560
|
+
apiKey: { rateLimit: creationRateLimit, scopes: ['routes:write'] },
|
|
561
|
+
}),
|
|
562
|
+
OpenApi.validate('header', schema.createRoutesDepositAddress.Headers, {
|
|
529
563
|
code: 'idempotency_key_required',
|
|
530
|
-
message: '
|
|
564
|
+
message: 'Route deposit address creation requires an `Idempotency-Key` header.',
|
|
531
565
|
}),
|
|
532
|
-
OpenApi.validate('json', schema.
|
|
566
|
+
OpenApi.validate('json', schema.createRoutesDepositAddress.Body, {
|
|
533
567
|
code: 'body_invalid',
|
|
534
568
|
message: 'Check the request body and try again.',
|
|
535
569
|
}),
|
|
536
570
|
OpenApi.describeRoute({
|
|
537
|
-
description: 'Creates or returns a reusable deposit address for
|
|
538
|
-
operationId: '
|
|
571
|
+
description: 'Creates or returns a reusable deposit address for routes a Tempo account.',
|
|
572
|
+
operationId: 'createRoutesDepositAddress',
|
|
539
573
|
responses: OpenApi.responses({
|
|
540
574
|
errors: {
|
|
541
575
|
400: { codes: ['body_invalid', 'idempotency_key_required'] },
|
|
576
|
+
403: {
|
|
577
|
+
codes: [
|
|
578
|
+
'billing_past_due',
|
|
579
|
+
'billing_required',
|
|
580
|
+
'routes_deposit_address_limit_exceeded',
|
|
581
|
+
'routes_subsidy_not_enabled',
|
|
582
|
+
],
|
|
583
|
+
description:
|
|
584
|
+
'The organization cannot create another address or is not eligible for a Tempo-funded Routes subsidy.',
|
|
585
|
+
name: 'CreateRoutesDepositAddressForbiddenError',
|
|
586
|
+
},
|
|
542
587
|
404: {
|
|
543
588
|
codes: ['deposit_address_not_available'],
|
|
544
589
|
description: 'No provider can provision the requested reusable address route.',
|
|
@@ -553,9 +598,9 @@ export function depositAddresses(options: depositAddresses.Options = {}) {
|
|
|
553
598
|
},
|
|
554
599
|
},
|
|
555
600
|
success: {
|
|
556
|
-
description: 'The created or matching reusable
|
|
557
|
-
example:
|
|
558
|
-
schema: schema.
|
|
601
|
+
description: 'The created or matching reusable route deposit address and quote.',
|
|
602
|
+
example: createdRoutesDepositAddressExample,
|
|
603
|
+
schema: schema.createRoutesDepositAddress.Response,
|
|
559
604
|
},
|
|
560
605
|
}),
|
|
561
606
|
summary: 'Create deposit address',
|
|
@@ -579,16 +624,49 @@ export function depositAddresses(options: depositAddresses.Options = {}) {
|
|
|
579
624
|
const db = Db.get(c.get('db'))
|
|
580
625
|
const identity = {
|
|
581
626
|
apiKeyId: principal.id,
|
|
627
|
+
compatibleRequestHashes: [
|
|
628
|
+
Idempotency.inputHash({
|
|
629
|
+
body,
|
|
630
|
+
endpoint: 'POST /v1/routes/deposit-addresses',
|
|
631
|
+
}),
|
|
632
|
+
],
|
|
582
633
|
keyHash: Idempotency.inputHash(c.req.valid('header')['idempotency-key']),
|
|
583
634
|
requestHash: Idempotency.inputHash({
|
|
584
635
|
body,
|
|
585
|
-
endpoint: 'POST /v1/
|
|
636
|
+
endpoint: 'POST /v1/routes/deposit-addresses',
|
|
637
|
+
owner,
|
|
586
638
|
}),
|
|
587
639
|
}
|
|
588
|
-
const
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
640
|
+
const claimed = await (async () => {
|
|
641
|
+
try {
|
|
642
|
+
return {
|
|
643
|
+
claim: await RoutesDepositAddresses.claimCreation(db, {
|
|
644
|
+
claim: {
|
|
645
|
+
...identity,
|
|
646
|
+
irrevocable: false,
|
|
647
|
+
recoveredIrrevocable: subsidize,
|
|
648
|
+
ttlMs: idempotencyPendingTtlMs,
|
|
649
|
+
},
|
|
650
|
+
orgId: owner.orgId,
|
|
651
|
+
}),
|
|
652
|
+
type: 'success',
|
|
653
|
+
} as const
|
|
654
|
+
} catch (cause) {
|
|
655
|
+
if (
|
|
656
|
+
cause instanceof RoutesDepositAddresses.OwnerNotFoundError ||
|
|
657
|
+
RoutesIdempotency.isOwnerFenceError(cause)
|
|
658
|
+
)
|
|
659
|
+
return { type: 'ownerNotFound' } as const
|
|
660
|
+
throw cause
|
|
661
|
+
}
|
|
662
|
+
})()
|
|
663
|
+
if (claimed.type === 'ownerNotFound')
|
|
664
|
+
return Response.error(c, {
|
|
665
|
+
code: 'api_key_forbidden',
|
|
666
|
+
message: 'API key organization no longer exists.',
|
|
667
|
+
status: 403,
|
|
668
|
+
})
|
|
669
|
+
const claim = claimed.claim
|
|
592
670
|
if (claim.type === 'mismatch')
|
|
593
671
|
return Response.error(c, {
|
|
594
672
|
code: 'idempotency_conflict',
|
|
@@ -598,13 +676,13 @@ export function depositAddresses(options: depositAddresses.Options = {}) {
|
|
|
598
676
|
if (claim.type === 'pending')
|
|
599
677
|
return Response.error(c, {
|
|
600
678
|
code: 'idempotency_in_progress',
|
|
601
|
-
message: 'An equivalent
|
|
679
|
+
message: 'An equivalent route deposit address creation is still running.',
|
|
602
680
|
status: 409,
|
|
603
681
|
})
|
|
604
682
|
if (claim.type === 'replay') {
|
|
605
683
|
const response = JSON.parse(claim.response) as Record<string, unknown>
|
|
606
684
|
return c.json(
|
|
607
|
-
Response.validated(schema.
|
|
685
|
+
Response.validated(schema.createRoutesDepositAddress.Response, {
|
|
608
686
|
...response,
|
|
609
687
|
subsidize: response['subsidize'] ?? false,
|
|
610
688
|
}),
|
|
@@ -614,7 +692,7 @@ export function depositAddresses(options: depositAddresses.Options = {}) {
|
|
|
614
692
|
|
|
615
693
|
const release = async () => {
|
|
616
694
|
try {
|
|
617
|
-
await
|
|
695
|
+
await RoutesIdempotency.release(db, {
|
|
618
696
|
apiKeyId: identity.apiKeyId,
|
|
619
697
|
createdAt: claim.createdAt,
|
|
620
698
|
keyHash: identity.keyHash,
|
|
@@ -625,13 +703,10 @@ export function depositAddresses(options: depositAddresses.Options = {}) {
|
|
|
625
703
|
}
|
|
626
704
|
const complete = async (
|
|
627
705
|
database: Db.Db,
|
|
628
|
-
response: z.output<typeof schema.
|
|
706
|
+
response: z.output<typeof schema.createRoutesDepositAddress.Response>,
|
|
629
707
|
) => {
|
|
630
|
-
const validated = Response.validated(
|
|
631
|
-
|
|
632
|
-
response,
|
|
633
|
-
)
|
|
634
|
-
const completion = await FundingIdempotency.complete(database, {
|
|
708
|
+
const validated = Response.validated(schema.createRoutesDepositAddress.Response, response)
|
|
709
|
+
const completion = await RoutesIdempotency.complete(database, {
|
|
635
710
|
apiKeyId: identity.apiKeyId,
|
|
636
711
|
createdAt: claim.createdAt,
|
|
637
712
|
keyHash: identity.keyHash,
|
|
@@ -639,19 +714,110 @@ export function depositAddresses(options: depositAddresses.Options = {}) {
|
|
|
639
714
|
response: JSON.stringify(validated),
|
|
640
715
|
})
|
|
641
716
|
if (!completion)
|
|
642
|
-
throw new IdempotencyLeaseLostError('
|
|
717
|
+
throw new IdempotencyLeaseLostError('Route deposit address creation lease was lost.')
|
|
643
718
|
return validated
|
|
644
719
|
}
|
|
645
720
|
|
|
646
|
-
const attempts:
|
|
721
|
+
const attempts: RoutesProvider.ProviderAttempt[] = []
|
|
647
722
|
const provisioning = { succeeded: claim.type === 'resume' }
|
|
648
723
|
try {
|
|
724
|
+
if (claim.type === 'claimed' && subsidize) {
|
|
725
|
+
const policy = await RoutesSubsidy.check(db, {
|
|
726
|
+
environment: owner.environment,
|
|
727
|
+
orgId: owner.orgId,
|
|
728
|
+
})
|
|
729
|
+
if (policy.type === 'denied') {
|
|
730
|
+
RoutesObservability.recordSubsidyRejection(c.get('metrics'), {
|
|
731
|
+
reason: policy.reason,
|
|
732
|
+
routesEnvironment: owner.environment,
|
|
733
|
+
})
|
|
734
|
+
await release()
|
|
735
|
+
return Response.error(c, {
|
|
736
|
+
code: policy.reason,
|
|
737
|
+
message: RoutesSubsidy.denialMessages[policy.reason],
|
|
738
|
+
status: 403,
|
|
739
|
+
})
|
|
740
|
+
}
|
|
741
|
+
}
|
|
649
742
|
const selected = await (async () => {
|
|
650
743
|
if (claim.type === 'resume')
|
|
651
|
-
return
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
744
|
+
return {
|
|
745
|
+
checkpoint: depositAddressCheckpoint.parse(JSON.parse(claim.response)),
|
|
746
|
+
checkpointFresh: claim.checkpointFresh,
|
|
747
|
+
...(claim.recoveredClaim === undefined
|
|
748
|
+
? {}
|
|
749
|
+
: { recoveredClaim: claim.recoveredClaim }),
|
|
750
|
+
quoteMatchesRequest: claim.checkpointFresh,
|
|
751
|
+
type: 'resume',
|
|
752
|
+
} as const
|
|
753
|
+
const catalog = await RoutesCatalog.snapshot(c)
|
|
754
|
+
const providers = c.get('providers').filter(RoutesProvider.is)
|
|
755
|
+
const selection = RoutesProvider.selectDepositAddress({
|
|
756
|
+
catalog,
|
|
757
|
+
destinationChainId: c.get('chainId'),
|
|
758
|
+
destinationToken: body.destinationToken,
|
|
759
|
+
providers,
|
|
760
|
+
recipient: body.recipient,
|
|
761
|
+
refundAddress: body.refundAddress,
|
|
762
|
+
sourceChain: body.sourceChain,
|
|
763
|
+
sourceToken: body.sourceToken,
|
|
764
|
+
})
|
|
765
|
+
if (!selection) return undefined
|
|
766
|
+
const match = {
|
|
767
|
+
destinationTokenKey: selection.candidate.destinationToken.tokenKey,
|
|
768
|
+
environment: owner.environment,
|
|
769
|
+
orgId: owner.orgId,
|
|
770
|
+
...(owner.projectId === undefined ? {} : { projectId: owner.projectId }),
|
|
771
|
+
recipient: selection.recipient,
|
|
772
|
+
refundAddress: selection.refundAddress,
|
|
773
|
+
sourceChainId: selection.candidate.sourceChain.id,
|
|
774
|
+
sourceTokenKey: selection.candidate.sourceToken.tokenKey,
|
|
775
|
+
subsidize,
|
|
776
|
+
}
|
|
777
|
+
const capacity = await RoutesDepositAddresses.validateCreationCapacity(db, {
|
|
778
|
+
claim: {
|
|
779
|
+
apiKeyId: identity.apiKeyId,
|
|
780
|
+
createdAt: claim.createdAt,
|
|
781
|
+
keyHash: identity.keyHash,
|
|
782
|
+
},
|
|
783
|
+
match,
|
|
784
|
+
matchHash: Idempotency.inputHash(match),
|
|
785
|
+
maxPerCreator: RoutesDepositAddress.maximumPerCreator,
|
|
786
|
+
orgId: owner.orgId,
|
|
787
|
+
pendingTtlMs: idempotencyPendingTtlMs,
|
|
788
|
+
replayTtlMs: idempotencyReplayTtlMs,
|
|
789
|
+
serializeMatchingResponse: (record) =>
|
|
790
|
+
JSON.stringify(
|
|
791
|
+
Response.validated(
|
|
792
|
+
schema.createRoutesDepositAddress.Response,
|
|
793
|
+
RoutesDepositAddress.toPublic(record),
|
|
794
|
+
),
|
|
795
|
+
),
|
|
796
|
+
})
|
|
797
|
+
if (capacity.type === 'existing')
|
|
798
|
+
return { record: capacity.record, type: 'existing' } as const
|
|
799
|
+
if (capacity.type === 'resume')
|
|
800
|
+
return {
|
|
801
|
+
checkpoint: depositAddressCheckpoint.parse(JSON.parse(capacity.response)),
|
|
802
|
+
checkpointFresh: capacity.checkpointFresh,
|
|
803
|
+
quoteMatchesRequest: false,
|
|
804
|
+
recoveredClaim: capacity.claim,
|
|
805
|
+
type: 'resume',
|
|
806
|
+
} as const
|
|
807
|
+
if (subsidize) {
|
|
808
|
+
const marked = await RoutesIdempotency.markProviderAttempt(db, {
|
|
809
|
+
apiKeyId: identity.apiKeyId,
|
|
810
|
+
createdAt: claim.createdAt,
|
|
811
|
+
keyHash: identity.keyHash,
|
|
812
|
+
ttlMs: idempotencyPendingTtlMs,
|
|
813
|
+
})
|
|
814
|
+
if (!marked)
|
|
815
|
+
throw new IdempotencyLeaseLostError(
|
|
816
|
+
'Route deposit address creation lease was lost.',
|
|
817
|
+
)
|
|
818
|
+
provisioning.succeeded = true
|
|
819
|
+
}
|
|
820
|
+
const provisioned = await RoutesProvider.createDepositAddress({
|
|
655
821
|
amount: body.amount,
|
|
656
822
|
catalog,
|
|
657
823
|
destinationChainId: c.get('chainId'),
|
|
@@ -667,30 +833,103 @@ export function depositAddresses(options: depositAddresses.Options = {}) {
|
|
|
667
833
|
if (!provisioned) return undefined
|
|
668
834
|
provisioning.succeeded = true
|
|
669
835
|
const checkpoint = depositAddressCheckpoint.parse({
|
|
836
|
+
amount: body.amount,
|
|
670
837
|
candidate: provisioned.candidate,
|
|
671
838
|
provider: provisioned.provider,
|
|
672
839
|
recipient: provisioned.recipient,
|
|
673
840
|
refundAddress: provisioned.refundAddress,
|
|
674
841
|
result: provisioned.result,
|
|
675
842
|
})
|
|
676
|
-
|
|
843
|
+
return {
|
|
844
|
+
checkpoint,
|
|
845
|
+
checkpointFresh: true,
|
|
846
|
+
quoteMatchesRequest: true,
|
|
847
|
+
type: 'provisioned',
|
|
848
|
+
} as const
|
|
849
|
+
})()
|
|
850
|
+
if (attempts.length > 0)
|
|
851
|
+
c.set('routesProviderAttempts', attempts.map(RoutesProvider.formatAttempt))
|
|
852
|
+
if (!selected) {
|
|
853
|
+
await release()
|
|
854
|
+
return depositAddressNotAvailable(c)
|
|
855
|
+
}
|
|
856
|
+
if (selected.type === 'existing') {
|
|
857
|
+
const response = Response.validated(
|
|
858
|
+
schema.createRoutesDepositAddress.Response,
|
|
859
|
+
RoutesDepositAddress.toPublic(selected.record),
|
|
860
|
+
)
|
|
861
|
+
if (options.registerDepositAddress)
|
|
862
|
+
await options.registerDepositAddress(
|
|
863
|
+
RoutesDepositAddress.schema.RoutesDepositAddress.parse(response),
|
|
864
|
+
)
|
|
865
|
+
return c.json(response, 200)
|
|
866
|
+
}
|
|
867
|
+
const resumed = await (async () => {
|
|
868
|
+
if (selected.type !== 'resume')
|
|
869
|
+
return { recoveredClaim: undefined, type: 'ready' } as const
|
|
870
|
+
const match = {
|
|
871
|
+
destinationTokenKey: selected.checkpoint.candidate.destinationToken.tokenKey,
|
|
872
|
+
environment: owner.environment,
|
|
873
|
+
orgId: owner.orgId,
|
|
874
|
+
...(owner.projectId === undefined ? {} : { projectId: owner.projectId }),
|
|
875
|
+
recipient: selected.checkpoint.recipient,
|
|
876
|
+
refundAddress: selected.checkpoint.refundAddress,
|
|
877
|
+
sourceChainId: selected.checkpoint.candidate.sourceChain.id,
|
|
878
|
+
sourceTokenKey: selected.checkpoint.candidate.sourceToken.tokenKey,
|
|
879
|
+
subsidize,
|
|
880
|
+
}
|
|
881
|
+
const capacity = await RoutesDepositAddresses.validateCreationCapacity(db, {
|
|
882
|
+
claim: {
|
|
883
|
+
apiKeyId: identity.apiKeyId,
|
|
884
|
+
createdAt: claim.createdAt,
|
|
885
|
+
keyHash: identity.keyHash,
|
|
886
|
+
},
|
|
887
|
+
match,
|
|
888
|
+
matchHash: Idempotency.inputHash(match),
|
|
889
|
+
maxPerCreator: RoutesDepositAddress.maximumPerCreator,
|
|
890
|
+
orgId: owner.orgId,
|
|
891
|
+
pendingTtlMs: idempotencyPendingTtlMs,
|
|
892
|
+
...(selected.recoveredClaim === undefined
|
|
893
|
+
? {}
|
|
894
|
+
: { recoveredClaim: selected.recoveredClaim }),
|
|
895
|
+
replayTtlMs: idempotencyReplayTtlMs,
|
|
896
|
+
serializeMatchingResponse: (record) =>
|
|
897
|
+
JSON.stringify(
|
|
898
|
+
Response.validated(
|
|
899
|
+
schema.createRoutesDepositAddress.Response,
|
|
900
|
+
RoutesDepositAddress.toPublic(record),
|
|
901
|
+
),
|
|
902
|
+
),
|
|
903
|
+
})
|
|
904
|
+
if (capacity.type === 'existing')
|
|
905
|
+
return { record: capacity.record, type: 'existing' } as const
|
|
906
|
+
return {
|
|
907
|
+
recoveredClaim: capacity.type === 'resume' ? capacity.claim : selected.recoveredClaim,
|
|
908
|
+
type: 'ready',
|
|
909
|
+
} as const
|
|
910
|
+
})()
|
|
911
|
+
if (resumed.type === 'existing') {
|
|
912
|
+
const response = Response.validated(
|
|
913
|
+
schema.createRoutesDepositAddress.Response,
|
|
914
|
+
RoutesDepositAddress.toPublic(resumed.record),
|
|
915
|
+
)
|
|
916
|
+
if (options.registerDepositAddress)
|
|
917
|
+
await options.registerDepositAddress(
|
|
918
|
+
RoutesDepositAddress.schema.RoutesDepositAddress.parse(response),
|
|
919
|
+
)
|
|
920
|
+
return c.json(response, 200)
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
if (selected.type === 'provisioned') {
|
|
924
|
+
const stored = await RoutesIdempotency.checkpoint(db, {
|
|
677
925
|
apiKeyId: identity.apiKeyId,
|
|
678
926
|
createdAt: claim.createdAt,
|
|
679
927
|
keyHash: identity.keyHash,
|
|
680
928
|
replayTtlMs: idempotencyReplayTtlMs,
|
|
681
|
-
response: JSON.stringify(checkpoint),
|
|
929
|
+
response: JSON.stringify(selected.checkpoint),
|
|
682
930
|
})
|
|
683
931
|
if (!stored)
|
|
684
|
-
throw new IdempotencyLeaseLostError(
|
|
685
|
-
'Funding deposit address creation lease was lost.',
|
|
686
|
-
)
|
|
687
|
-
return checkpoint
|
|
688
|
-
})()
|
|
689
|
-
if (attempts.length > 0)
|
|
690
|
-
c.set('fundingProviderAttempts', attempts.map(ProviderAttempts.format))
|
|
691
|
-
if (!selected) {
|
|
692
|
-
await release()
|
|
693
|
-
return depositAddressNotAvailable(c)
|
|
932
|
+
throw new IdempotencyLeaseLostError('Route deposit address creation lease was lost.')
|
|
694
933
|
}
|
|
695
934
|
|
|
696
935
|
const {
|
|
@@ -699,10 +938,13 @@ export function depositAddresses(options: depositAddresses.Options = {}) {
|
|
|
699
938
|
recipient,
|
|
700
939
|
refundAddress,
|
|
701
940
|
result,
|
|
702
|
-
} = selected
|
|
941
|
+
} = selected.checkpoint
|
|
703
942
|
const created = await db.transaction(async (tx) => {
|
|
704
|
-
const
|
|
705
|
-
|
|
943
|
+
const persist =
|
|
944
|
+
selected.type === 'resume'
|
|
945
|
+
? RoutesDepositAddress.recoverOrGet
|
|
946
|
+
: RoutesDepositAddress.createOrGet
|
|
947
|
+
const stored = await persist(tx, {
|
|
706
948
|
deliveryStrategy: 'provider',
|
|
707
949
|
environment: owner.environment,
|
|
708
950
|
orgId: owner.orgId,
|
|
@@ -725,9 +967,8 @@ export function depositAddresses(options: depositAddresses.Options = {}) {
|
|
|
725
967
|
subsidize,
|
|
726
968
|
},
|
|
727
969
|
})
|
|
728
|
-
const record =
|
|
729
|
-
|
|
730
|
-
return complete(tx, {
|
|
970
|
+
const record = RoutesDepositAddress.toPublic(stored.record)
|
|
971
|
+
const quoted = {
|
|
731
972
|
...record,
|
|
732
973
|
destinationAmount: Value.tokenAmount({
|
|
733
974
|
baseUnits: result.destinationAmount,
|
|
@@ -761,44 +1002,115 @@ export function depositAddresses(options: depositAddresses.Options = {}) {
|
|
|
761
1002
|
sampledAt: result.sampledAt,
|
|
762
1003
|
},
|
|
763
1004
|
sourceAmount: Value.tokenAmount({
|
|
764
|
-
baseUnits: body.amount,
|
|
1005
|
+
baseUnits: selected.checkpoint.amount ?? body.amount,
|
|
765
1006
|
currency: selectedCandidate.sourceToken.currency,
|
|
766
1007
|
decimals: selectedCandidate.sourceToken.decimals,
|
|
767
1008
|
}),
|
|
768
|
-
}
|
|
1009
|
+
}
|
|
1010
|
+
const response = await complete(
|
|
1011
|
+
tx,
|
|
1012
|
+
stored.type === 'existing' || !selected.quoteMatchesRequest ? record : quoted,
|
|
1013
|
+
)
|
|
1014
|
+
if (resumed.recoveredClaim)
|
|
1015
|
+
await RoutesIdempotency.complete(tx, {
|
|
1016
|
+
...resumed.recoveredClaim,
|
|
1017
|
+
replayTtlMs: idempotencyReplayTtlMs,
|
|
1018
|
+
response: JSON.stringify(
|
|
1019
|
+
stored.type === 'existing' ||
|
|
1020
|
+
!selected.checkpointFresh ||
|
|
1021
|
+
(selected.checkpoint.amount === undefined && !selected.quoteMatchesRequest)
|
|
1022
|
+
? record
|
|
1023
|
+
: quoted,
|
|
1024
|
+
),
|
|
1025
|
+
})
|
|
1026
|
+
return { record: stored.record, response, type: stored.type }
|
|
769
1027
|
})
|
|
1028
|
+
if (created.type === 'created') {
|
|
1029
|
+
if ('sourceAmount' in created.response)
|
|
1030
|
+
RoutesObservability.recordRouteQuote(c.get('metrics'), {
|
|
1031
|
+
destinationAmount: created.response.destinationAmount,
|
|
1032
|
+
destinationChain: created.response.destinationChain,
|
|
1033
|
+
destinationToken: created.response.destinationToken,
|
|
1034
|
+
feePayer: subsidize ? 'tempo' : 'customer',
|
|
1035
|
+
fees: created.response.fees,
|
|
1036
|
+
routesEnvironment: owner.environment,
|
|
1037
|
+
method: 'deposit_address',
|
|
1038
|
+
provider: created.response.provider,
|
|
1039
|
+
sourceAmount: created.response.sourceAmount,
|
|
1040
|
+
sourceChain: created.response.sourceChain,
|
|
1041
|
+
sourceToken: created.response.sourceToken,
|
|
1042
|
+
})
|
|
1043
|
+
RoutesObservability.recordDepositAddress(c.get('metrics'), {
|
|
1044
|
+
record: created.record,
|
|
1045
|
+
})
|
|
1046
|
+
}
|
|
770
1047
|
if (options.registerDepositAddress)
|
|
771
1048
|
await options.registerDepositAddress(
|
|
772
|
-
|
|
1049
|
+
RoutesDepositAddress.schema.RoutesDepositAddress.parse(created.response),
|
|
773
1050
|
)
|
|
774
|
-
return c.json(created, 200)
|
|
1051
|
+
return c.json(created.response, 200)
|
|
775
1052
|
} catch (cause) {
|
|
776
1053
|
if (!provisioning.succeeded) await release()
|
|
777
|
-
if (cause instanceof
|
|
1054
|
+
if (cause instanceof RoutesProvider.InvalidRefundAddressError)
|
|
778
1055
|
return Response.error(c, {
|
|
779
1056
|
code: 'body_invalid',
|
|
780
1057
|
message: 'Invalid `refundAddress`.',
|
|
781
1058
|
status: 400,
|
|
782
1059
|
})
|
|
783
|
-
if (cause instanceof
|
|
1060
|
+
if (cause instanceof RoutesProvider.UnsupportedSourceChainError)
|
|
784
1061
|
return depositAddressNotAvailable(c)
|
|
785
1062
|
if (
|
|
786
|
-
cause instanceof
|
|
787
|
-
cause
|
|
1063
|
+
cause instanceof RoutesDepositAddress.OwnerNotFoundError ||
|
|
1064
|
+
RoutesIdempotency.isOwnerFenceError(cause)
|
|
1065
|
+
)
|
|
1066
|
+
return Response.error(c, {
|
|
1067
|
+
code: 'api_key_forbidden',
|
|
1068
|
+
message: 'API key organization no longer exists.',
|
|
1069
|
+
status: 403,
|
|
1070
|
+
})
|
|
1071
|
+
if (cause instanceof RoutesDepositAddresses.OwnerNotFoundError)
|
|
1072
|
+
return Response.error(c, {
|
|
1073
|
+
code: 'api_key_forbidden',
|
|
1074
|
+
message: 'API key organization no longer exists.',
|
|
1075
|
+
status: 403,
|
|
1076
|
+
})
|
|
1077
|
+
if (
|
|
1078
|
+
cause instanceof RoutesDepositAddresses.CapacityClaimNotFoundError ||
|
|
1079
|
+
cause instanceof RoutesDepositAddresses.MatchInProgressError
|
|
1080
|
+
)
|
|
1081
|
+
return Response.error(c, {
|
|
1082
|
+
code: 'idempotency_in_progress',
|
|
1083
|
+
message: 'An equivalent route deposit address creation is still running.',
|
|
1084
|
+
status: 409,
|
|
1085
|
+
})
|
|
1086
|
+
if (
|
|
1087
|
+
cause instanceof RoutesDepositAddress.ConflictError ||
|
|
1088
|
+
cause instanceof RoutesDepositAddress.LimitExceededError ||
|
|
1089
|
+
cause instanceof RoutesDepositAddresses.LimitExceededError ||
|
|
1090
|
+
cause instanceof RoutesProvider.ProviderQuoteError
|
|
788
1091
|
) {
|
|
789
|
-
if (
|
|
1092
|
+
if (
|
|
1093
|
+
cause instanceof RoutesDepositAddress.LimitExceededError ||
|
|
1094
|
+
cause instanceof RoutesDepositAddresses.LimitExceededError
|
|
1095
|
+
) {
|
|
1096
|
+
RoutesObservability.recordDepositAddressLimitRejection(c.get('metrics'), {
|
|
1097
|
+
routesEnvironment: owner.environment,
|
|
1098
|
+
})
|
|
1099
|
+
return depositAddressLimitExceeded(c)
|
|
1100
|
+
}
|
|
1101
|
+
if (cause instanceof RoutesDepositAddress.ConflictError)
|
|
790
1102
|
return Response.error(c, {
|
|
791
1103
|
code: 'upstream_error',
|
|
792
|
-
message: 'The
|
|
1104
|
+
message: 'The route provider returned a conflicting deposit address.',
|
|
793
1105
|
status: 502,
|
|
794
1106
|
})
|
|
795
|
-
if (cause.
|
|
796
|
-
c.set('
|
|
1107
|
+
if (cause.routesProviderAttempts.length > 0)
|
|
1108
|
+
c.set('routesProviderAttempts', cause.routesProviderAttempts)
|
|
797
1109
|
if (cause.providerFailure) c.set('providerFailure', cause.providerFailure)
|
|
798
1110
|
if (cause.providerFailures) c.set('providerFailures', cause.providerFailures)
|
|
799
1111
|
return Response.error(c, {
|
|
800
1112
|
code: 'upstream_error',
|
|
801
|
-
message: 'The
|
|
1113
|
+
message: 'The route provider could not provision the deposit address.',
|
|
802
1114
|
status: 502,
|
|
803
1115
|
})
|
|
804
1116
|
}
|
|
@@ -807,23 +1119,23 @@ export function depositAddresses(options: depositAddresses.Options = {}) {
|
|
|
807
1119
|
},
|
|
808
1120
|
)
|
|
809
1121
|
.get(
|
|
810
|
-
'/v1/
|
|
811
|
-
Auth.policy({ apiKey: { scopes: ['
|
|
812
|
-
OpenApi.validate('query', schema.
|
|
1122
|
+
'/v1/routes/deposit-addresses',
|
|
1123
|
+
Auth.policy({ apiKey: { scopes: ['routes:read'] } }),
|
|
1124
|
+
OpenApi.validate('query', schema.listRoutesDepositAddresses.Query, {
|
|
813
1125
|
code: 'query_invalid',
|
|
814
1126
|
message: 'Check the query parameters and try again.',
|
|
815
1127
|
}),
|
|
816
1128
|
OpenApi.describeRoute({
|
|
817
|
-
description: 'Lists reusable
|
|
818
|
-
operationId: '
|
|
1129
|
+
description: 'Lists reusable route deposit addresses, newest first.',
|
|
1130
|
+
operationId: 'listRoutesDepositAddresses',
|
|
819
1131
|
responses: OpenApi.responses({
|
|
820
1132
|
errors: {
|
|
821
1133
|
400: { codes: ['query_invalid'] },
|
|
822
1134
|
},
|
|
823
1135
|
success: {
|
|
824
|
-
description: 'A page of reusable
|
|
825
|
-
example:
|
|
826
|
-
schema: schema.
|
|
1136
|
+
description: 'A page of reusable route deposit addresses.',
|
|
1137
|
+
example: routesDepositAddressesExample,
|
|
1138
|
+
schema: schema.listRoutesDepositAddresses.Response,
|
|
827
1139
|
},
|
|
828
1140
|
}),
|
|
829
1141
|
summary: 'List deposit addresses',
|
|
@@ -844,7 +1156,7 @@ export function depositAddresses(options: depositAddresses.Options = {}) {
|
|
|
844
1156
|
const { cursor, limit } = c.req.valid('query')
|
|
845
1157
|
const decoded = cursor ? Cursor.decode(cursor, ['timestamp', 'id']) : undefined
|
|
846
1158
|
try {
|
|
847
|
-
const rows = await
|
|
1159
|
+
const rows = await RoutesDepositAddresses.listByOwner(db, {
|
|
848
1160
|
...(decoded
|
|
849
1161
|
? { cursor: { createdAt: String(decoded[0]), id: String(decoded[1]) } }
|
|
850
1162
|
: {}),
|
|
@@ -856,12 +1168,12 @@ export function depositAddresses(options: depositAddresses.Options = {}) {
|
|
|
856
1168
|
limit,
|
|
857
1169
|
rows,
|
|
858
1170
|
})
|
|
859
|
-
const data = page.rows.map(
|
|
1171
|
+
const data = page.rows.map(RoutesDepositAddress.toPublic)
|
|
860
1172
|
|
|
861
1173
|
c.header('Cache-Control', Cache.policies.noStore)
|
|
862
1174
|
c.header('Vary', 'Accept-Encoding, Authorization, Tempo-API-Key, X-API-Key')
|
|
863
1175
|
return c.json(
|
|
864
|
-
Response.validated(schema.
|
|
1176
|
+
Response.validated(schema.listRoutesDepositAddresses.Response, {
|
|
865
1177
|
data,
|
|
866
1178
|
nextCursor: page.nextCursor,
|
|
867
1179
|
}),
|
|
@@ -873,27 +1185,27 @@ export function depositAddresses(options: depositAddresses.Options = {}) {
|
|
|
873
1185
|
},
|
|
874
1186
|
)
|
|
875
1187
|
.get(
|
|
876
|
-
'/v1/
|
|
877
|
-
Auth.policy({ apiKey: { scopes: ['
|
|
878
|
-
OpenApi.validate('param', schema.
|
|
1188
|
+
'/v1/routes/deposit-addresses/:id{rda_[A-Za-z0-9_-]+}',
|
|
1189
|
+
Auth.policy({ apiKey: { scopes: ['routes:read'] } }),
|
|
1190
|
+
OpenApi.validate('param', schema.getRoutesDepositAddress.Params, {
|
|
879
1191
|
code: 'param_invalid',
|
|
880
1192
|
message: 'Check the path parameters and try again.',
|
|
881
1193
|
}),
|
|
882
1194
|
OpenApi.describeRoute({
|
|
883
|
-
description: 'Returns one reusable
|
|
884
|
-
operationId: '
|
|
1195
|
+
description: 'Returns one reusable route deposit address.',
|
|
1196
|
+
operationId: 'getRoutesDepositAddress',
|
|
885
1197
|
responses: OpenApi.responses({
|
|
886
1198
|
errors: {
|
|
887
1199
|
400: { codes: ['param_invalid'] },
|
|
888
1200
|
404: {
|
|
889
|
-
codes: ['
|
|
890
|
-
description: 'No visible
|
|
1201
|
+
codes: ['routes_deposit_address_not_found'],
|
|
1202
|
+
description: 'No visible route deposit address exists for the identifier.',
|
|
891
1203
|
},
|
|
892
1204
|
},
|
|
893
1205
|
success: {
|
|
894
|
-
description: 'The requested
|
|
895
|
-
example:
|
|
896
|
-
schema: schema.
|
|
1206
|
+
description: 'The requested route deposit address.',
|
|
1207
|
+
example: routesDepositAddressExample,
|
|
1208
|
+
schema: schema.getRoutesDepositAddress.Response,
|
|
897
1209
|
},
|
|
898
1210
|
}),
|
|
899
1211
|
summary: 'Get deposit address',
|
|
@@ -913,11 +1225,11 @@ export function depositAddresses(options: depositAddresses.Options = {}) {
|
|
|
913
1225
|
const db = Db.get(c.get('db'))
|
|
914
1226
|
const { id } = c.req.valid('param')
|
|
915
1227
|
try {
|
|
916
|
-
const record = await
|
|
1228
|
+
const record = await RoutesDepositAddresses.getOwned(db, owner, id)
|
|
917
1229
|
if (!record)
|
|
918
1230
|
return Response.error(c, {
|
|
919
|
-
code: '
|
|
920
|
-
message: '
|
|
1231
|
+
code: 'routes_deposit_address_not_found',
|
|
1232
|
+
message: 'Route deposit address not found',
|
|
921
1233
|
status: 404,
|
|
922
1234
|
})
|
|
923
1235
|
|
|
@@ -925,8 +1237,8 @@ export function depositAddresses(options: depositAddresses.Options = {}) {
|
|
|
925
1237
|
c.header('Vary', 'Accept-Encoding, Authorization, Tempo-API-Key, X-API-Key')
|
|
926
1238
|
return c.json(
|
|
927
1239
|
Response.validated(
|
|
928
|
-
schema.
|
|
929
|
-
|
|
1240
|
+
schema.getRoutesDepositAddress.Response,
|
|
1241
|
+
RoutesDepositAddress.toPublic(record),
|
|
930
1242
|
),
|
|
931
1243
|
200,
|
|
932
1244
|
)
|
|
@@ -936,19 +1248,19 @@ export function depositAddresses(options: depositAddresses.Options = {}) {
|
|
|
936
1248
|
},
|
|
937
1249
|
)
|
|
938
1250
|
.post(
|
|
939
|
-
'/v1/
|
|
1251
|
+
'/v1/routes/deposit-addresses/:id{rda_[A-Za-z0-9_-]+}/reconcile',
|
|
940
1252
|
Auth.policy({
|
|
941
|
-
apiKey: { rateLimit: { limit: 10, period: 'minute' }, scopes: ['
|
|
1253
|
+
apiKey: { rateLimit: { limit: 10, period: 'minute' }, scopes: ['routes:write'] },
|
|
942
1254
|
}),
|
|
943
|
-
OpenApi.validate('param', schema.
|
|
1255
|
+
OpenApi.validate('param', schema.reconcileRoutesDepositAddress.Params, {
|
|
944
1256
|
code: 'param_invalid',
|
|
945
1257
|
message: 'Check the path parameters and try again.',
|
|
946
1258
|
}),
|
|
947
1259
|
OpenApi.describeRoute({
|
|
948
1260
|
description:
|
|
949
|
-
'Queues an immediate provider reconciliation for one reusable
|
|
950
|
-
operationId: '
|
|
951
|
-
responses:
|
|
1261
|
+
'Queues an immediate provider reconciliation for one reusable route deposit address.',
|
|
1262
|
+
operationId: 'reconcileRoutesDepositAddress',
|
|
1263
|
+
responses: reconcileRoutesDepositAddressResponses,
|
|
952
1264
|
summary: 'Reconcile deposit address',
|
|
953
1265
|
tags: ['Deposit Addresses'],
|
|
954
1266
|
}),
|
|
@@ -968,31 +1280,31 @@ export function depositAddresses(options: depositAddresses.Options = {}) {
|
|
|
968
1280
|
const db = Db.get(c.get('db'))
|
|
969
1281
|
const { id } = c.req.valid('param')
|
|
970
1282
|
try {
|
|
971
|
-
const record = await
|
|
1283
|
+
const record = await RoutesDepositAddresses.getOwned(db, owner, id)
|
|
972
1284
|
if (!record)
|
|
973
1285
|
return Response.error(c, {
|
|
974
|
-
code: '
|
|
975
|
-
message: '
|
|
1286
|
+
code: 'routes_deposit_address_not_found',
|
|
1287
|
+
message: 'Route deposit address not found',
|
|
976
1288
|
status: 404,
|
|
977
1289
|
})
|
|
978
1290
|
if (record.status !== 'active')
|
|
979
1291
|
return Response.error(c, {
|
|
980
|
-
code: '
|
|
981
|
-
message: '
|
|
1292
|
+
code: 'routes_deposit_address_not_active',
|
|
1293
|
+
message: 'Route deposit address is not active',
|
|
982
1294
|
status: 409,
|
|
983
1295
|
})
|
|
984
1296
|
const dispatch = options.dispatchDepositReconciliation
|
|
985
1297
|
if (!dispatch)
|
|
986
1298
|
return Response.error(c, {
|
|
987
1299
|
code: 'not_implemented',
|
|
988
|
-
message: 'Manual
|
|
1300
|
+
message: 'Manual routes reconciliation is not configured',
|
|
989
1301
|
status: 501,
|
|
990
1302
|
})
|
|
991
1303
|
|
|
992
1304
|
await dispatch({
|
|
993
1305
|
addressId: record.id,
|
|
994
1306
|
trigger: 'manual',
|
|
995
|
-
type: '
|
|
1307
|
+
type: 'routes:deposit-address:reconcile',
|
|
996
1308
|
})
|
|
997
1309
|
return c.body(null, 202)
|
|
998
1310
|
} catch (cause) {
|
|
@@ -1001,23 +1313,23 @@ export function depositAddresses(options: depositAddresses.Options = {}) {
|
|
|
1001
1313
|
},
|
|
1002
1314
|
)
|
|
1003
1315
|
.get(
|
|
1004
|
-
'/v1/
|
|
1005
|
-
Auth.policy({ apiKey: { scopes: ['
|
|
1006
|
-
OpenApi.validate('query', schema.
|
|
1316
|
+
'/v1/routes/deposits',
|
|
1317
|
+
Auth.policy({ apiKey: { scopes: ['routes:read'] } }),
|
|
1318
|
+
OpenApi.validate('query', schema.listRoutesDeposits.Query, {
|
|
1007
1319
|
code: 'query_invalid',
|
|
1008
1320
|
message: 'Check the query parameters and try again.',
|
|
1009
1321
|
}),
|
|
1010
1322
|
OpenApi.describeRoute({
|
|
1011
1323
|
description: 'Lists visible deposits, optionally filtered, newest first.',
|
|
1012
|
-
operationId: '
|
|
1324
|
+
operationId: 'listRoutesDeposits',
|
|
1013
1325
|
responses: OpenApi.responses({
|
|
1014
1326
|
errors: {
|
|
1015
1327
|
400: { codes: ['query_invalid'] },
|
|
1016
1328
|
},
|
|
1017
1329
|
success: {
|
|
1018
|
-
description: 'A page of visible
|
|
1019
|
-
example:
|
|
1020
|
-
schema: schema.
|
|
1330
|
+
description: 'A page of visible route deposits.',
|
|
1331
|
+
example: routesDepositsExample,
|
|
1332
|
+
schema: schema.listRoutesDeposits.Response,
|
|
1021
1333
|
},
|
|
1022
1334
|
}),
|
|
1023
1335
|
summary: 'List deposits',
|
|
@@ -1043,18 +1355,18 @@ export function depositAddresses(options: depositAddresses.Options = {}) {
|
|
|
1043
1355
|
parameters.destinationToken !== undefined ||
|
|
1044
1356
|
parameters.sourceChain !== undefined ||
|
|
1045
1357
|
parameters.sourceToken !== undefined
|
|
1046
|
-
? await
|
|
1358
|
+
? await RoutesCatalog.snapshot(c)
|
|
1047
1359
|
: undefined
|
|
1048
1360
|
const filters = resolveDepositFilters({ catalog, parameters })
|
|
1049
1361
|
// Counts are best-effort and share every ownership and filter predicate
|
|
1050
1362
|
// with the page query. A failure omits `meta` rather than failing the page.
|
|
1051
1363
|
const countPromise = include.includes('totalCount')
|
|
1052
|
-
?
|
|
1364
|
+
? RoutesDeposits.count(db, {
|
|
1053
1365
|
...filters,
|
|
1054
1366
|
cap: Schema.countCap,
|
|
1055
1367
|
owner,
|
|
1056
1368
|
}).catch(() => {
|
|
1057
|
-
c.set('
|
|
1369
|
+
c.set('routesDepositCountFailed', true)
|
|
1058
1370
|
return undefined
|
|
1059
1371
|
})
|
|
1060
1372
|
: undefined
|
|
@@ -1066,19 +1378,19 @@ export function depositAddresses(options: depositAddresses.Options = {}) {
|
|
|
1066
1378
|
limit: limit + 1,
|
|
1067
1379
|
owner,
|
|
1068
1380
|
}
|
|
1069
|
-
const rows = await
|
|
1381
|
+
const rows = await RoutesDeposits.listByOwner(db, paging)
|
|
1070
1382
|
const page = Cursor.paginate({
|
|
1071
1383
|
key: (record) => [record.createdAt, record.id],
|
|
1072
1384
|
limit,
|
|
1073
1385
|
rows,
|
|
1074
1386
|
})
|
|
1075
|
-
const data = page.rows.map(
|
|
1387
|
+
const data = page.rows.map(RoutesDeposit.toPublic)
|
|
1076
1388
|
const count = await countPromise
|
|
1077
1389
|
|
|
1078
1390
|
c.header('Cache-Control', Cache.policies.noStore)
|
|
1079
1391
|
c.header('Vary', 'Accept-Encoding, Authorization, Tempo-API-Key')
|
|
1080
1392
|
return c.json(
|
|
1081
|
-
Response.validated(schema.
|
|
1393
|
+
Response.validated(schema.listRoutesDeposits.Response, {
|
|
1082
1394
|
data,
|
|
1083
1395
|
...(count === undefined
|
|
1084
1396
|
? {}
|
|
@@ -1098,33 +1410,33 @@ export function depositAddresses(options: depositAddresses.Options = {}) {
|
|
|
1098
1410
|
},
|
|
1099
1411
|
)
|
|
1100
1412
|
.get(
|
|
1101
|
-
'/v1/
|
|
1102
|
-
Auth.policy({ apiKey: { scopes: ['
|
|
1103
|
-
OpenApi.validate('param', schema.
|
|
1413
|
+
'/v1/routes/deposits/:id{rdp_[A-Za-z0-9_-]+}',
|
|
1414
|
+
Auth.policy({ apiKey: { scopes: ['routes:read'] } }),
|
|
1415
|
+
OpenApi.validate('param', schema.getRoutesDeposit.Params, {
|
|
1104
1416
|
code: 'param_invalid',
|
|
1105
1417
|
message: 'Check the path parameters and try again.',
|
|
1106
1418
|
}),
|
|
1107
1419
|
OpenApi.describeRoute({
|
|
1108
1420
|
description: 'Returns one detected deposit and its delivery status.',
|
|
1109
|
-
operationId: '
|
|
1421
|
+
operationId: 'getRoutesDeposit',
|
|
1110
1422
|
responses: OpenApi.responses({
|
|
1111
1423
|
errors: {
|
|
1112
1424
|
400: { codes: ['param_invalid'] },
|
|
1113
1425
|
404: {
|
|
1114
|
-
codes: ['
|
|
1115
|
-
description: 'No visible
|
|
1426
|
+
codes: ['routes_deposit_not_found'],
|
|
1427
|
+
description: 'No visible route deposit exists for the identifier.',
|
|
1116
1428
|
},
|
|
1117
1429
|
},
|
|
1118
1430
|
success: {
|
|
1119
|
-
description: 'The requested
|
|
1120
|
-
example:
|
|
1121
|
-
schema: schema.
|
|
1431
|
+
description: 'The requested route deposit.',
|
|
1432
|
+
example: routesDepositExample,
|
|
1433
|
+
schema: schema.getRoutesDeposit.Response,
|
|
1122
1434
|
},
|
|
1123
1435
|
}),
|
|
1124
1436
|
summary: 'Get deposit',
|
|
1125
1437
|
tags: ['Deposit Addresses'],
|
|
1126
1438
|
}),
|
|
1127
|
-
|
|
1439
|
+
routesEtag,
|
|
1128
1440
|
async (c) => {
|
|
1129
1441
|
if (Auth.narrowAccess) return Auth.accessError(c)
|
|
1130
1442
|
if (OpenApi.narrowValidation)
|
|
@@ -1139,18 +1451,18 @@ export function depositAddresses(options: depositAddresses.Options = {}) {
|
|
|
1139
1451
|
const db = Db.get(c.get('db'))
|
|
1140
1452
|
const { id } = c.req.valid('param')
|
|
1141
1453
|
try {
|
|
1142
|
-
const record = await
|
|
1454
|
+
const record = await RoutesDeposits.getOwned(db, owner, id)
|
|
1143
1455
|
if (!record)
|
|
1144
1456
|
return Response.error(c, {
|
|
1145
|
-
code: '
|
|
1146
|
-
message: '
|
|
1457
|
+
code: 'routes_deposit_not_found',
|
|
1458
|
+
message: 'Route deposit not found',
|
|
1147
1459
|
status: 404,
|
|
1148
1460
|
})
|
|
1149
1461
|
|
|
1150
1462
|
c.header('Cache-Control', Cache.policies.state)
|
|
1151
1463
|
c.header('Vary', 'Accept-Encoding, Authorization, Tempo-API-Key, X-API-Key')
|
|
1152
1464
|
return c.json(
|
|
1153
|
-
Response.validated(schema.
|
|
1465
|
+
Response.validated(schema.getRoutesDeposit.Response, RoutesDeposit.toPublic(record)),
|
|
1154
1466
|
200,
|
|
1155
1467
|
)
|
|
1156
1468
|
} catch (cause) {
|
|
@@ -1165,10 +1477,10 @@ export declare namespace depositAddresses {
|
|
|
1165
1477
|
type Options = {
|
|
1166
1478
|
/** Enqueues one deposit address for asynchronous reconciliation. */
|
|
1167
1479
|
dispatchDepositReconciliation?:
|
|
1168
|
-
| ((message:
|
|
1480
|
+
| ((message: RoutesProvider.Webhook.receive.Dispatchable) => Promise<void>)
|
|
1169
1481
|
| undefined
|
|
1170
1482
|
/** Registers a created address with a source-chain observer. */
|
|
1171
|
-
registerDepositAddress?: ((address:
|
|
1483
|
+
registerDepositAddress?: ((address: RoutesDepositAddress.Public) => Promise<void>) | undefined
|
|
1172
1484
|
}
|
|
1173
1485
|
}
|
|
1174
1486
|
|
|
@@ -1180,6 +1492,14 @@ function depositAddressNotAvailable(c: Context<App.Environment>) {
|
|
|
1180
1492
|
})
|
|
1181
1493
|
}
|
|
1182
1494
|
|
|
1495
|
+
function depositAddressLimitExceeded(c: Context<App.Environment>) {
|
|
1496
|
+
return Response.error(c, {
|
|
1497
|
+
code: 'routes_deposit_address_limit_exceeded',
|
|
1498
|
+
message: `Route deposit address limit reached (${RoutesDepositAddress.maximumPerCreator}).`,
|
|
1499
|
+
status: 403,
|
|
1500
|
+
})
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1183
1503
|
class IdempotencyLeaseLostError extends Error {
|
|
1184
|
-
override name = '
|
|
1504
|
+
override name = 'Routes.IdempotencyLeaseLostError'
|
|
1185
1505
|
}
|