tapimo 0.13.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 +21383 -18056
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +301 -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 +2 -2
- package/dist/Webhooks.js.map +1 -1
- package/dist/admin/App.d.ts +3936 -1337
- 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 +1446 -0
- package/dist/admin/apps/earn-vaults.d.ts.map +1 -1
- package/dist/admin/apps/earn-vaults.js +465 -8
- package/dist/admin/apps/earn-vaults.js.map +1 -1
- package/dist/admin/apps/organizations.d.ts +344 -3
- package/dist/admin/apps/organizations.d.ts.map +1 -1
- package/dist/admin/apps/organizations.js +288 -10
- 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 +16 -16
- 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 +40 -8
- package/dist/apps/Zones.js.map +1 -1
- package/dist/apps/data/App.d.ts +4310 -2548
- package/dist/apps/data/App.d.ts.map +1 -1
- package/dist/apps/data/App.js +86 -26
- 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 +94 -22
- 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 +1641 -352
- package/dist/apps/data/routes/earn.d.ts.map +1 -1
- package/dist/apps/data/routes/earn.js +1561 -120
- package/dist/apps/data/routes/earn.js.map +1 -1
- package/dist/apps/data/routes/exchanges.d.ts +15 -0
- package/dist/apps/data/routes/exchanges.d.ts.map +1 -1
- package/dist/apps/data/routes/exchanges.js +180 -114
- package/dist/apps/data/routes/exchanges.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 +49 -38
- 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 +95 -93
- 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 +16 -0
- 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/verified-tokens.d.ts +4 -4
- 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 +1210 -70
- package/dist/apps/data/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/data/routes/webhooks.js +301 -163
- 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 +4119 -3297
- 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 +49 -8
- package/dist/apps/management/Billing.d.ts.map +1 -1
- package/dist/apps/management/Billing.js +221 -26
- package/dist/apps/management/Billing.js.map +1 -1
- package/dist/apps/management/routes/api-keys.d.ts +174 -72
- 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 +364 -78
- 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 +99 -24
- 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 +42 -42
- 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 +16 -16
- package/dist/apps/management/routes/orgs.d.ts +36 -20
- 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 +40 -40
- 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 +8 -8
- 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 +16 -16
- package/dist/apps/management/routes/webhooks.d.ts +931 -215
- package/dist/apps/management/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/management/routes/webhooks.js +71 -25
- 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 +177 -26
- 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 +232 -25
- 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 +841 -136
- package/dist/apps/{funding → routes}/App.d.ts.map +1 -1
- package/dist/apps/{funding → routes}/App.js +17 -17
- 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 +123 -59
- package/dist/apps/routes/routes/deposit-addresses.d.ts.map +1 -0
- package/dist/apps/{funding → routes}/routes/deposit-addresses.js +498 -223
- 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 +957 -71
- 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 +1052 -15
- package/dist/db/Db.js.map +1 -1
- package/dist/db/Schema.d.ts +785 -133
- package/dist/db/Schema.d.ts.map +1 -1
- package/dist/db/Schema.js +590 -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 +51 -5
- package/dist/db/tables/organizations.d.ts.map +1 -1
- package/dist/db/tables/organizations.js +135 -47
- package/dist/db/tables/organizations.js.map +1 -1
- package/dist/db/tables/projects.d.ts +27 -1
- package/dist/db/tables/projects.d.ts.map +1 -1
- package/dist/db/tables/projects.js +38 -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/routesTransferTransactions.js +86 -0
- 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 +112 -13
- package/dist/db/tables/sponsoredTransactions.d.ts.map +1 -1
- package/dist/db/tables/sponsoredTransactions.js +241 -38
- 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 +22 -10
- package/dist/db/tables/webhookSubscriptions.d.ts.map +1 -1
- package/dist/db/tables/webhookSubscriptions.js +50 -15
- 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 +31 -14
- 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 +46 -2068
- package/dist/internal/Viem.d.ts.map +1 -1
- package/dist/internal/Viem.js +171 -11
- 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 -3
- 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 +9 -17
- 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 +350 -104
- package/dist/internal/routes/Provider.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Provider.js +233 -97
- 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 +13 -15
- 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 +324 -34
- 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/routes/TransferReconciliation.d.ts +55 -0
- 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/routes/TransferWebhook.d.ts +21 -0
- package/dist/internal/routes/TransferWebhook.d.ts.map +1 -0
- package/dist/internal/routes/TransferWebhook.js +43 -0
- package/dist/internal/routes/TransferWebhook.js.map +1 -0
- package/dist/internal/{funding → routes}/index.d.ts +3 -0
- package/dist/internal/routes/index.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/index.js +3 -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 +197 -122
- 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/routes/providers/stargate.d.ts +165 -0
- 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.d.ts.map +1 -1
- package/dist/internal/webhookDestinations/slack.js +22 -6
- 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 +335 -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 +611 -101
- package/src/Handler.ts +0 -1
- package/src/OpenApi.contract.test.ts +195 -0
- package/src/Scope.ts +17 -5
- package/src/Webhooks.ts +2 -2
- 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 +681 -7
- package/src/admin/apps/organizations.test.ts +342 -1
- package/src/admin/apps/organizations.ts +368 -8
- 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 +147 -3
- package/src/admin/ui/src/lib/organizations.ts +136 -0
- 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 +334 -2
- 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 +18 -3
- package/src/apps/Zones.ts +55 -8
- package/src/apps/composition.test.ts +68 -59
- package/src/apps/data/App.test.ts +154 -2
- package/src/apps/data/App.ts +102 -33
- 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 +1661 -29
- package/src/apps/data/routes/earn.ts +2314 -328
- package/src/apps/data/routes/exchanges.test.ts +752 -30
- package/src/apps/data/routes/exchanges.ts +954 -753
- package/src/apps/data/routes/fee-amm.test.ts +224 -0
- package/src/apps/data/routes/fee-amm.ts +208 -178
- 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 +659 -81
- package/src/apps/data/routes/webhooks.ts +1104 -817
- 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 +283 -34
- 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 +93 -38
- 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 +1024 -38
- package/src/apps/relay/App.ts +228 -32
- 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 +253 -29
- 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 +1362 -462
- package/src/apps/{funding → routes}/routes/deposit-addresses.ts +568 -248
- 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/routes/routes/transfers.test.ts +2876 -0
- 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 +1511 -34
- package/src/db/Schema.ts +744 -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 +725 -7
- package/src/db/tables/organizations.ts +182 -49
- package/src/db/tables/projects.test.ts +71 -0
- package/src/db/tables/projects.ts +59 -4
- 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/routesTransferTransactions.ts +158 -0
- package/src/db/tables/routesTransfers.test.ts +338 -0
- package/src/db/tables/routesTransfers.ts +662 -0
- package/src/db/tables/sponsoredTransactions.test.ts +563 -1
- package/src/db/tables/sponsoredTransactions.ts +386 -42
- 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 +103 -21
- 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 +37 -15
- package/src/internal/Email.ts +54 -0
- package/src/internal/Idempotency.test.ts +2 -2
- package/src/internal/Log.test-d.ts +10 -7
- package/src/internal/Log.test.ts +114 -16
- package/src/internal/Log.ts +55 -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 +249 -17
- package/src/internal/Webhooks.test.ts +125 -1
- 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 -8
- 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 +11 -22
- 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 +531 -185
- 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 +18 -22
- 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/routes/TransferWebhook.test.ts +128 -0
- package/src/internal/routes/TransferWebhook.ts +67 -0
- package/src/internal/{funding → routes}/index.test.ts +6 -3
- package/src/internal/{funding → routes}/index.ts +3 -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 +231 -136
- 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 +20 -5
- 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 -622
- 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 -15
- package/dist/db/tables/fundingTransferTransactions.d.ts.map +0 -1
- package/dist/db/tables/fundingTransferTransactions.js +0 -27
- package/dist/db/tables/fundingTransferTransactions.js.map +0 -1
- package/dist/db/tables/fundingTransfers.d.ts +0 -82
- package/dist/db/tables/fundingTransfers.d.ts.map +0 -1
- package/dist/db/tables/fundingTransfers.js +0 -89
- 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 -334
- package/dist/internal/funding/Transfer.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 +0 -38
- package/dist/internal/funding/providers/stargate.d.ts.map +0 -1
- package/dist/internal/funding/providers/stargate.js +0 -277
- 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 -78
- package/src/apps/funding/ProviderAttempts.ts +0 -26
- package/src/apps/funding/index.ts +0 -1
- package/src/apps/funding/routes/transfers.test.ts +0 -1638
- package/src/apps/funding/routes/transfers.ts +0 -721
- 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 -69
- package/src/db/tables/fundingTransferTransactions.ts +0 -37
- package/src/db/tables/fundingTransfers.test.ts +0 -89
- package/src/db/tables/fundingTransfers.ts +0 -153
- 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 -369
- package/src/internal/funding/Transfer.ts +0 -545
- package/src/internal/funding/providers/stargate.test.ts +0 -163
- package/src/internal/funding/providers/stargate.ts +0 -409
- /package/dist/apps/{funding → routes}/Inventory.d.ts +0 -0
- /package/src/internal/{funding → routes}/Route.test.ts +0 -0
|
@@ -1,39 +1,43 @@
|
|
|
1
1
|
import { 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
|
import * as Db from '../../../db/Db.js';
|
|
5
|
-
import * as
|
|
6
|
-
import * as
|
|
7
|
-
import * as
|
|
6
|
+
import * as RoutesDepositAddresses from '../../../db/tables/routesDepositAddresses.js';
|
|
7
|
+
import * as RoutesDeposits from '../../../db/tables/routesDeposits.js';
|
|
8
|
+
import * as RoutesIdempotency from '../../../db/tables/routesIdempotency.js';
|
|
8
9
|
import * as Auth from '../../../internal/Auth.js';
|
|
9
10
|
import * as Cache from '../../../internal/Cache.js';
|
|
10
11
|
import * as Cursor from '../../../internal/Cursor.js';
|
|
11
|
-
import * as
|
|
12
|
-
import * as
|
|
13
|
-
import * as
|
|
14
|
-
import * as
|
|
15
|
-
import * as
|
|
12
|
+
import * as RoutesCatalog from '../../../internal/routes/Catalog.js';
|
|
13
|
+
import * as RoutesDeposit from '../../../internal/routes/Deposit.js';
|
|
14
|
+
import * as RoutesDepositAddress from '../../../internal/routes/DepositAddress.js';
|
|
15
|
+
import * as RoutesObservability from '../../../internal/routes/Observability.js';
|
|
16
|
+
import * as RoutesProvider from '../../../internal/routes/Provider.js';
|
|
17
|
+
import * as RoutesSubsidy from '../../../internal/routes/Subsidy.js';
|
|
18
|
+
import * as RoutesTransfer from '../../../internal/routes/Transfer.js';
|
|
16
19
|
import * as Idempotency from '../../../internal/Idempotency.js';
|
|
17
20
|
import * as OpenApi from '../../../internal/OpenApi.js';
|
|
18
21
|
import * as Response from '../../../internal/Response.js';
|
|
19
22
|
import * as Schema from '../../../internal/Schema.js';
|
|
20
23
|
import * as Value from '../../../internal/Value.js';
|
|
21
24
|
import * as Access from '../Access.js';
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
/** Matches manual reconciliation's quota for another provider-backed address operation. */
|
|
26
|
+
const creationRateLimit = { limit: 10, period: 'minute' };
|
|
27
|
+
/** Zod schemas owned by route deposit-address resources. */
|
|
24
28
|
export var schema;
|
|
25
29
|
(function (schema) {
|
|
26
|
-
/** One reusable
|
|
27
|
-
schema.DepositAddress =
|
|
28
|
-
/** One detected
|
|
29
|
-
schema.Deposit =
|
|
30
|
-
/** Schemas for the
|
|
31
|
-
let
|
|
32
|
-
(function (
|
|
33
|
-
/**
|
|
34
|
-
|
|
30
|
+
/** One reusable route deposit address. */
|
|
31
|
+
schema.DepositAddress = RoutesDepositAddress.schema.RoutesDepositAddress;
|
|
32
|
+
/** One detected route deposit. */
|
|
33
|
+
schema.Deposit = RoutesDeposit.schema.RoutesDeposit;
|
|
34
|
+
/** Schemas for the createRoutesDepositAddress operation. */
|
|
35
|
+
let createRoutesDepositAddress;
|
|
36
|
+
(function (createRoutesDepositAddress) {
|
|
37
|
+
/** Route deposit address creation request body. */
|
|
38
|
+
createRoutesDepositAddress.Body = OpenApi.component(z
|
|
35
39
|
.strictObject({
|
|
36
|
-
amount:
|
|
40
|
+
amount: RoutesTransfer.schema.CreateRequest.shape.amount,
|
|
37
41
|
destinationToken: z
|
|
38
42
|
.string()
|
|
39
43
|
.check(z.minLength(1), z.describe('Tempo destination token symbol, contract address, or token key.'), z.meta({ examples: ['usdt0'] })),
|
|
@@ -53,66 +57,66 @@ export var schema;
|
|
|
53
57
|
.optional(z.boolean())
|
|
54
58
|
.check(z.describe('Guarantees normalized 1:1 delivery through a Tempo-funded subsidy.'), z.meta({ examples: [false] })),
|
|
55
59
|
})
|
|
56
|
-
.check(z.describe('Reusable
|
|
57
|
-
/** Required headers for
|
|
58
|
-
|
|
60
|
+
.check(z.describe('Reusable route deposit address creation request.')), 'CreateRoutesDepositAddressRequest');
|
|
61
|
+
/** Required headers for route deposit address creation. */
|
|
62
|
+
createRoutesDepositAddress.Headers = z.object({
|
|
59
63
|
'idempotency-key': z
|
|
60
64
|
.string()
|
|
61
|
-
.check(z.minLength(1), z.describe('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.'), z.meta({ examples: ['
|
|
65
|
+
.check(z.minLength(1), z.describe('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.'), z.meta({ examples: ['routes_01k1c5j8q8p0be6j5v9m6d1e4r'] })),
|
|
62
66
|
});
|
|
63
67
|
/** The reusable address, with quoted terms only when the provider address was newly stored. */
|
|
64
|
-
|
|
68
|
+
createRoutesDepositAddress.Response = OpenApi.component(z
|
|
65
69
|
.union([
|
|
66
|
-
|
|
67
|
-
|
|
70
|
+
RoutesDepositAddress.schema.CreatedRoutesDepositAddress,
|
|
71
|
+
RoutesDepositAddress.schema.RoutesDepositAddress,
|
|
68
72
|
])
|
|
69
|
-
.check(z.describe('A reusable
|
|
70
|
-
})(
|
|
71
|
-
/** Schemas for the
|
|
72
|
-
let
|
|
73
|
-
(function (
|
|
74
|
-
/** Path parameters for reading a
|
|
75
|
-
|
|
73
|
+
.check(z.describe('A reusable route deposit address, including terms sampled for a newly stored provider address.')), 'CreateRoutesDepositAddressResponse');
|
|
74
|
+
})(createRoutesDepositAddress = schema.createRoutesDepositAddress || (schema.createRoutesDepositAddress = {}));
|
|
75
|
+
/** Schemas for the getRoutesDepositAddress operation. */
|
|
76
|
+
let getRoutesDepositAddress;
|
|
77
|
+
(function (getRoutesDepositAddress) {
|
|
78
|
+
/** Path parameters for reading a route deposit address. */
|
|
79
|
+
getRoutesDepositAddress.Params = z
|
|
76
80
|
.object({
|
|
77
81
|
id: z
|
|
78
82
|
.string()
|
|
79
|
-
.check(z.regex(/^
|
|
83
|
+
.check(z.regex(/^rda_[A-Za-z0-9_-]+$/), z.describe('Route deposit address ID (`rda_…`).'), z.meta({ examples: ['rda_001785792000000_2ZPE2gvateYEQ0dQslgvkhjx'] })),
|
|
80
84
|
})
|
|
81
|
-
.check(z.describe('Path parameters for reading a
|
|
82
|
-
/** One reusable
|
|
83
|
-
|
|
84
|
-
})(
|
|
85
|
-
/** Schemas for the
|
|
86
|
-
let
|
|
87
|
-
(function (
|
|
88
|
-
/** Query parameters for listing
|
|
89
|
-
|
|
85
|
+
.check(z.describe('Path parameters for reading a route deposit address.'));
|
|
86
|
+
/** One reusable route deposit address. */
|
|
87
|
+
getRoutesDepositAddress.Response = schema.DepositAddress;
|
|
88
|
+
})(getRoutesDepositAddress = schema.getRoutesDepositAddress || (schema.getRoutesDepositAddress = {}));
|
|
89
|
+
/** Schemas for the listRoutesDepositAddresses operation. */
|
|
90
|
+
let listRoutesDepositAddresses;
|
|
91
|
+
(function (listRoutesDepositAddresses) {
|
|
92
|
+
/** Query parameters for listing route deposit addresses. */
|
|
93
|
+
listRoutesDepositAddresses.Query = z
|
|
90
94
|
.object({
|
|
91
95
|
cursor: Schema.Cursor,
|
|
92
96
|
limit: Schema.Limit,
|
|
93
97
|
})
|
|
94
|
-
.check(z.describe('Paging parameters for listing
|
|
95
|
-
/** One page of reusable
|
|
96
|
-
|
|
98
|
+
.check(z.describe('Paging parameters for listing route deposit addresses.'));
|
|
99
|
+
/** One page of reusable route deposit addresses. */
|
|
100
|
+
listRoutesDepositAddresses.Response = OpenApi.component(z
|
|
97
101
|
.object({
|
|
98
102
|
data: z
|
|
99
103
|
.array(schema.DepositAddress)
|
|
100
|
-
.check(z.describe('
|
|
104
|
+
.check(z.describe('Route deposit addresses on this page, newest first.')),
|
|
101
105
|
nextCursor: Schema.NextCursor,
|
|
102
106
|
})
|
|
103
|
-
.check(z.describe('A page of reusable
|
|
104
|
-
})(
|
|
105
|
-
/** Schemas for the
|
|
106
|
-
let
|
|
107
|
-
(function (
|
|
108
|
-
/** Path parameters for reconciling a
|
|
109
|
-
|
|
110
|
-
})(
|
|
111
|
-
/** Schemas for the
|
|
112
|
-
let
|
|
113
|
-
(function (
|
|
114
|
-
/** Query parameters for listing
|
|
115
|
-
|
|
107
|
+
.check(z.describe('A page of reusable route deposit addresses.')), 'RoutesDepositAddressList');
|
|
108
|
+
})(listRoutesDepositAddresses = schema.listRoutesDepositAddresses || (schema.listRoutesDepositAddresses = {}));
|
|
109
|
+
/** Schemas for the reconcileRoutesDepositAddress operation. */
|
|
110
|
+
let reconcileRoutesDepositAddress;
|
|
111
|
+
(function (reconcileRoutesDepositAddress) {
|
|
112
|
+
/** Path parameters for reconciling a route deposit address. */
|
|
113
|
+
reconcileRoutesDepositAddress.Params = getRoutesDepositAddress.Params;
|
|
114
|
+
})(reconcileRoutesDepositAddress = schema.reconcileRoutesDepositAddress || (schema.reconcileRoutesDepositAddress = {}));
|
|
115
|
+
/** Schemas for the listRoutesDeposits operation. */
|
|
116
|
+
let listRoutesDeposits;
|
|
117
|
+
(function (listRoutesDeposits) {
|
|
118
|
+
/** Query parameters for listing route deposits. */
|
|
119
|
+
listRoutesDeposits.Query = z
|
|
116
120
|
.object({
|
|
117
121
|
depositAddress: z
|
|
118
122
|
.optional(z.string().check(z.minLength(1)))
|
|
@@ -125,7 +129,7 @@ export var schema;
|
|
|
125
129
|
limit: Schema.Limit,
|
|
126
130
|
provider: z
|
|
127
131
|
.optional(z.string().check(z.minLength(1)))
|
|
128
|
-
.check(z.describe('
|
|
132
|
+
.check(z.describe('Route provider id.'), z.meta({ examples: ['relay'] })),
|
|
129
133
|
recipient: z
|
|
130
134
|
.optional(Schema.Address)
|
|
131
135
|
.check(z.describe('Tempo account that received the deposits.'), z.meta({ examples: [`0x${'11'.repeat(20)}`] })),
|
|
@@ -135,11 +139,11 @@ export var schema;
|
|
|
135
139
|
sourceToken: z
|
|
136
140
|
.optional(z.string().check(z.minLength(1)))
|
|
137
141
|
.check(z.describe('Source token symbol, contract address, or token key.'), z.meta({ examples: ['usdt'] })),
|
|
138
|
-
status: z.optional(
|
|
142
|
+
status: z.optional(RoutesDeposit.schema.Status),
|
|
139
143
|
})
|
|
140
144
|
.check(z.describe('Optional deposit filters and paging parameters.'));
|
|
141
145
|
/** One page of detected deposits. */
|
|
142
|
-
|
|
146
|
+
listRoutesDeposits.Response = OpenApi.component(z
|
|
143
147
|
.object({
|
|
144
148
|
data: z.array(schema.Deposit).check(z.describe('Detected deposits on this page, newest first.')),
|
|
145
149
|
meta: z
|
|
@@ -147,22 +151,22 @@ export var schema;
|
|
|
147
151
|
.check(z.describe('Extra response metadata requested with `include`.')),
|
|
148
152
|
nextCursor: Schema.NextCursor,
|
|
149
153
|
})
|
|
150
|
-
.check(z.describe('A page of visible
|
|
151
|
-
})(
|
|
152
|
-
/** Schemas for the
|
|
153
|
-
let
|
|
154
|
-
(function (
|
|
155
|
-
/** Path parameters for reading a
|
|
156
|
-
|
|
154
|
+
.check(z.describe('A page of visible route deposits.')), 'RoutesDepositList');
|
|
155
|
+
})(listRoutesDeposits = schema.listRoutesDeposits || (schema.listRoutesDeposits = {}));
|
|
156
|
+
/** Schemas for the getRoutesDeposit operation. */
|
|
157
|
+
let getRoutesDeposit;
|
|
158
|
+
(function (getRoutesDeposit) {
|
|
159
|
+
/** Path parameters for reading a route deposit. */
|
|
160
|
+
getRoutesDeposit.Params = z
|
|
157
161
|
.object({
|
|
158
162
|
id: z
|
|
159
163
|
.string()
|
|
160
|
-
.check(z.regex(/^
|
|
164
|
+
.check(z.regex(/^rdp_[A-Za-z0-9_-]+$/), z.describe('Route deposit id (`rdp_…`).'), z.meta({ examples: ['rdp_001785792060000_2ZPE2gvateYEQ0dQslgvkhjx'] })),
|
|
161
165
|
})
|
|
162
|
-
.check(z.describe('Path parameters for reading a
|
|
163
|
-
/** One detected
|
|
164
|
-
|
|
165
|
-
})(
|
|
166
|
+
.check(z.describe('Path parameters for reading a route deposit.'));
|
|
167
|
+
/** One detected route deposit. */
|
|
168
|
+
getRoutesDeposit.Response = schema.Deposit;
|
|
169
|
+
})(getRoutesDeposit = schema.getRoutesDeposit || (schema.getRoutesDeposit = {}));
|
|
166
170
|
})(schema || (schema = {}));
|
|
167
171
|
const tronChainExample = {
|
|
168
172
|
addressFormat: 'base58check',
|
|
@@ -196,12 +200,12 @@ const tempoUsdt0Example = {
|
|
|
196
200
|
tokenKey: 'eip155:4217/erc20:0x20c00000000000000000000014f22ca97301eb73',
|
|
197
201
|
verified: true,
|
|
198
202
|
};
|
|
199
|
-
const
|
|
203
|
+
const routesDepositAddressExample = {
|
|
200
204
|
address: 'TJRabPrwbZy45sbavfcjinPJC18kjpRTv8',
|
|
201
205
|
createdAt: '2026-08-04T00:00:00.000Z',
|
|
202
206
|
destinationChain: tempoChainExample,
|
|
203
207
|
destinationToken: tempoUsdt0Example,
|
|
204
|
-
id: '
|
|
208
|
+
id: 'rda_001785792000000_2ZPE2gvateYEQ0dQslgvkhjx',
|
|
205
209
|
provider: { id: 'relay', name: 'Relay' },
|
|
206
210
|
recipient: `0x${'11'.repeat(20)}`,
|
|
207
211
|
refundAddress: 'TJRabPrwbZy45sbavfcjinPJC18kjpRTv8',
|
|
@@ -211,8 +215,8 @@ const fundingDepositAddressExample = {
|
|
|
211
215
|
subsidize: false,
|
|
212
216
|
updatedAt: '2026-08-04T00:00:00.000Z',
|
|
213
217
|
};
|
|
214
|
-
const
|
|
215
|
-
...
|
|
218
|
+
const createdRoutesDepositAddressExample = {
|
|
219
|
+
...routesDepositAddressExample,
|
|
216
220
|
destinationAmount: Value.tokenAmount({ baseUnits: '1000000', currency: 'USD', decimals: 6 }),
|
|
217
221
|
destinationAmountMin: Value.tokenAmount({
|
|
218
222
|
baseUnits: '1000000',
|
|
@@ -223,29 +227,29 @@ const createdFundingDepositAddressExample = {
|
|
|
223
227
|
quote: { sampledAt: '2026-08-04T00:00:00.000Z' },
|
|
224
228
|
sourceAmount: Value.tokenAmount({ baseUnits: '1000000', currency: 'USD', decimals: 6 }),
|
|
225
229
|
};
|
|
226
|
-
const
|
|
230
|
+
const routesDepositExample = {
|
|
227
231
|
createdAt: '2026-08-04T00:01:00.000Z',
|
|
228
|
-
depositAddressId:
|
|
232
|
+
depositAddressId: routesDepositAddressExample.id,
|
|
229
233
|
detectionTrigger: 'webhook',
|
|
230
234
|
destinationChain: tempoChainExample,
|
|
231
235
|
destinationToken: tempoUsdt0Example,
|
|
232
|
-
id: '
|
|
236
|
+
id: 'rdp_001785792060000_2ZPE2gvateYEQ0dQslgvkhjx',
|
|
233
237
|
provider: { id: 'relay', name: 'Relay' },
|
|
234
|
-
recipient:
|
|
235
|
-
refundAddress:
|
|
238
|
+
recipient: routesDepositAddressExample.recipient,
|
|
239
|
+
refundAddress: routesDepositAddressExample.refundAddress,
|
|
236
240
|
sourceChain: tronChainExample,
|
|
237
241
|
sourceToken: tronUsdtExample,
|
|
238
242
|
sourceTransactionHashes: ['9f2c4c80dbb468878baa8c07ff523e0464bf6437f2a486268508485d83f14d12'],
|
|
239
243
|
status: 'detected',
|
|
240
244
|
updatedAt: '2026-08-04T00:01:00.000Z',
|
|
241
245
|
};
|
|
242
|
-
const
|
|
243
|
-
data: [
|
|
246
|
+
const routesDepositsExample = {
|
|
247
|
+
data: [routesDepositExample],
|
|
244
248
|
meta: { totalCount: 1, totalCountCapped: false },
|
|
245
249
|
nextCursor: null,
|
|
246
250
|
};
|
|
247
|
-
const
|
|
248
|
-
data: [
|
|
251
|
+
const routesDepositAddressesExample = {
|
|
252
|
+
data: [routesDepositAddressExample],
|
|
249
253
|
nextCursor: null,
|
|
250
254
|
};
|
|
251
255
|
function resolveDepositFilters(options) {
|
|
@@ -321,25 +325,25 @@ function tokenKey(token) {
|
|
|
321
325
|
})();
|
|
322
326
|
return `${token.chain.id}/${namespace}:${token.address}`;
|
|
323
327
|
}
|
|
324
|
-
const
|
|
328
|
+
const reconcileRoutesDepositAddressResponses = (() => {
|
|
325
329
|
const responses = OpenApi.responses({
|
|
326
330
|
errors: {
|
|
327
331
|
400: { codes: ['param_invalid'] },
|
|
328
332
|
403: {
|
|
329
333
|
codes: ['api_key_forbidden'],
|
|
330
|
-
description: 'The API key does not grant
|
|
334
|
+
description: 'The API key does not grant routes write access.',
|
|
331
335
|
},
|
|
332
336
|
404: {
|
|
333
|
-
codes: ['
|
|
334
|
-
description: 'No visible
|
|
337
|
+
codes: ['routes_deposit_address_not_found'],
|
|
338
|
+
description: 'No visible route deposit address exists for the identifier.',
|
|
335
339
|
},
|
|
336
340
|
409: {
|
|
337
|
-
codes: ['
|
|
338
|
-
description: 'The
|
|
341
|
+
codes: ['routes_deposit_address_not_active'],
|
|
342
|
+
description: 'The route deposit address is not active.',
|
|
339
343
|
},
|
|
340
344
|
501: {
|
|
341
345
|
codes: ['not_implemented'],
|
|
342
|
-
description: 'Manual
|
|
346
|
+
description: 'Manual routes reconciliation is not configured.',
|
|
343
347
|
},
|
|
344
348
|
502: {
|
|
345
349
|
codes: ['upstream_error'],
|
|
@@ -355,7 +359,7 @@ const reconcileFundingDepositAddressResponses = (() => {
|
|
|
355
359
|
void success;
|
|
356
360
|
return {
|
|
357
361
|
202: {
|
|
358
|
-
description: 'The
|
|
362
|
+
description: 'The route deposit address was queued for reconciliation.',
|
|
359
363
|
headers: { ...OpenApi.successHeaders },
|
|
360
364
|
},
|
|
361
365
|
...errors,
|
|
@@ -366,55 +370,85 @@ const idempotencyReplayTtlMs = 86_400_000;
|
|
|
366
370
|
// Pending claims only cover the bounded provider preparation window.
|
|
367
371
|
const idempotencyPendingTtlMs = 60_000;
|
|
368
372
|
const depositAddressCheckpoint = Schema.describe(z.object({
|
|
373
|
+
amount: z.optional(RoutesTransfer.schema.CreateRequest.shape.amount),
|
|
369
374
|
candidate: Schema.describe(z.object({
|
|
370
|
-
destinationChain:
|
|
371
|
-
destinationToken:
|
|
372
|
-
sourceChain:
|
|
373
|
-
sourceToken:
|
|
375
|
+
destinationChain: RoutesProvider.schema.ChainRef,
|
|
376
|
+
destinationToken: RoutesProvider.schema.TokenRef,
|
|
377
|
+
sourceChain: RoutesProvider.schema.ChainRef,
|
|
378
|
+
sourceToken: RoutesProvider.schema.TokenRef,
|
|
374
379
|
}), 'Normalized route retained after provider provisioning.'),
|
|
375
|
-
provider:
|
|
380
|
+
provider: RoutesProvider.schema.ProviderRef,
|
|
376
381
|
recipient: z.string().check(z.describe('Normalized Tempo recipient.')),
|
|
377
382
|
refundAddress: z.string().check(z.describe('Normalized source-chain refund account.')),
|
|
378
|
-
result:
|
|
383
|
+
result: RoutesProvider.schema.DepositAddressResult,
|
|
379
384
|
}), 'Provider result retained until deposit address creation completes.');
|
|
380
|
-
const
|
|
385
|
+
const routesEtag = etag();
|
|
386
|
+
// Provider callbacks are small JSON documents; bound buffering before signature verification.
|
|
387
|
+
const maxProviderWebhookBodyBytes = 64 * 1_024;
|
|
381
388
|
/** Mounts reusable deposit-address and detected-deposit routes. */
|
|
382
389
|
export function depositAddresses(options = {}) {
|
|
383
390
|
return new Hono()
|
|
384
|
-
.post('/webhooks/
|
|
391
|
+
.post('/webhooks/routes/:providerId', async (c, next) => {
|
|
385
392
|
const provider = c
|
|
386
393
|
.get('providers')
|
|
387
|
-
.filter(
|
|
394
|
+
.filter(RoutesProvider.is)
|
|
388
395
|
.find((candidate) => candidate.id === c.req.param('providerId'));
|
|
389
|
-
if (!provider || !
|
|
396
|
+
if (!provider || !RoutesProvider.canReceiveWebhook(provider))
|
|
390
397
|
return c.body(null, 404);
|
|
398
|
+
return next();
|
|
399
|
+
}, bodyLimit({
|
|
400
|
+
maxSize: maxProviderWebhookBodyBytes,
|
|
401
|
+
onError: (c) => c.body(null, 413),
|
|
402
|
+
}), async (c) => {
|
|
403
|
+
const provider = c
|
|
404
|
+
.get('providers')
|
|
405
|
+
.filter(RoutesProvider.is)
|
|
406
|
+
.find((candidate) => candidate.id === c.req.param('providerId'));
|
|
407
|
+
if (!provider || !RoutesProvider.canReceiveWebhook(provider))
|
|
408
|
+
return c.body(null, 404);
|
|
409
|
+
const body = await c.req.text();
|
|
391
410
|
try {
|
|
392
|
-
await provider.webhook.receive({
|
|
393
|
-
body
|
|
411
|
+
await RoutesProvider.observe(provider, () => provider.webhook.receive({
|
|
412
|
+
body,
|
|
394
413
|
headers: c.req.raw.headers,
|
|
414
|
+
}), {
|
|
415
|
+
onAttempt: (result) => c.set('routesProviderAttempts', [result]),
|
|
416
|
+
operation: 'receiveWebhook',
|
|
395
417
|
});
|
|
396
418
|
return c.body(null, 204);
|
|
397
419
|
}
|
|
398
420
|
catch (cause) {
|
|
399
|
-
if (cause instanceof
|
|
421
|
+
if (cause instanceof RoutesProvider.WebhookAuthenticationError)
|
|
400
422
|
return c.body(null, 401);
|
|
401
|
-
if (cause instanceof
|
|
423
|
+
if (cause instanceof RoutesProvider.WebhookPayloadError)
|
|
402
424
|
return c.body(null, 400);
|
|
403
425
|
throw cause;
|
|
404
426
|
}
|
|
405
427
|
})
|
|
406
|
-
.post('/v1/
|
|
428
|
+
.post('/v1/routes/deposit-addresses', Auth.policy({
|
|
429
|
+
apiKey: { rateLimit: creationRateLimit, scopes: ['routes:write'] },
|
|
430
|
+
}), OpenApi.validate('header', schema.createRoutesDepositAddress.Headers, {
|
|
407
431
|
code: 'idempotency_key_required',
|
|
408
|
-
message: '
|
|
409
|
-
}), OpenApi.validate('json', schema.
|
|
432
|
+
message: 'Route deposit address creation requires an `Idempotency-Key` header.',
|
|
433
|
+
}), OpenApi.validate('json', schema.createRoutesDepositAddress.Body, {
|
|
410
434
|
code: 'body_invalid',
|
|
411
435
|
message: 'Check the request body and try again.',
|
|
412
436
|
}), OpenApi.describeRoute({
|
|
413
|
-
description: 'Creates or returns a reusable deposit address for
|
|
414
|
-
operationId: '
|
|
437
|
+
description: 'Creates or returns a reusable deposit address for routes a Tempo account.',
|
|
438
|
+
operationId: 'createRoutesDepositAddress',
|
|
415
439
|
responses: OpenApi.responses({
|
|
416
440
|
errors: {
|
|
417
441
|
400: { codes: ['body_invalid', 'idempotency_key_required'] },
|
|
442
|
+
403: {
|
|
443
|
+
codes: [
|
|
444
|
+
'billing_past_due',
|
|
445
|
+
'billing_required',
|
|
446
|
+
'routes_deposit_address_limit_exceeded',
|
|
447
|
+
'routes_subsidy_not_enabled',
|
|
448
|
+
],
|
|
449
|
+
description: 'The organization cannot create another address or is not eligible for a Tempo-funded Routes subsidy.',
|
|
450
|
+
name: 'CreateRoutesDepositAddressForbiddenError',
|
|
451
|
+
},
|
|
418
452
|
404: {
|
|
419
453
|
codes: ['deposit_address_not_available'],
|
|
420
454
|
description: 'No provider can provision the requested reusable address route.',
|
|
@@ -429,9 +463,9 @@ export function depositAddresses(options = {}) {
|
|
|
429
463
|
},
|
|
430
464
|
},
|
|
431
465
|
success: {
|
|
432
|
-
description: 'The created or matching reusable
|
|
433
|
-
example:
|
|
434
|
-
schema: schema.
|
|
466
|
+
description: 'The created or matching reusable route deposit address and quote.',
|
|
467
|
+
example: createdRoutesDepositAddressExample,
|
|
468
|
+
schema: schema.createRoutesDepositAddress.Response,
|
|
435
469
|
},
|
|
436
470
|
}),
|
|
437
471
|
summary: 'Create deposit address',
|
|
@@ -454,16 +488,48 @@ export function depositAddresses(options = {}) {
|
|
|
454
488
|
const db = Db.get(c.get('db'));
|
|
455
489
|
const identity = {
|
|
456
490
|
apiKeyId: principal.id,
|
|
491
|
+
compatibleRequestHashes: [
|
|
492
|
+
Idempotency.inputHash({
|
|
493
|
+
body,
|
|
494
|
+
endpoint: 'POST /v1/routes/deposit-addresses',
|
|
495
|
+
}),
|
|
496
|
+
],
|
|
457
497
|
keyHash: Idempotency.inputHash(c.req.valid('header')['idempotency-key']),
|
|
458
498
|
requestHash: Idempotency.inputHash({
|
|
459
499
|
body,
|
|
460
|
-
endpoint: 'POST /v1/
|
|
500
|
+
endpoint: 'POST /v1/routes/deposit-addresses',
|
|
501
|
+
owner,
|
|
461
502
|
}),
|
|
462
503
|
};
|
|
463
|
-
const
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
504
|
+
const claimed = await (async () => {
|
|
505
|
+
try {
|
|
506
|
+
return {
|
|
507
|
+
claim: await RoutesDepositAddresses.claimCreation(db, {
|
|
508
|
+
claim: {
|
|
509
|
+
...identity,
|
|
510
|
+
irrevocable: false,
|
|
511
|
+
recoveredIrrevocable: subsidize,
|
|
512
|
+
ttlMs: idempotencyPendingTtlMs,
|
|
513
|
+
},
|
|
514
|
+
orgId: owner.orgId,
|
|
515
|
+
}),
|
|
516
|
+
type: 'success',
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
catch (cause) {
|
|
520
|
+
if (cause instanceof RoutesDepositAddresses.OwnerNotFoundError ||
|
|
521
|
+
RoutesIdempotency.isOwnerFenceError(cause))
|
|
522
|
+
return { type: 'ownerNotFound' };
|
|
523
|
+
throw cause;
|
|
524
|
+
}
|
|
525
|
+
})();
|
|
526
|
+
if (claimed.type === 'ownerNotFound')
|
|
527
|
+
return Response.error(c, {
|
|
528
|
+
code: 'api_key_forbidden',
|
|
529
|
+
message: 'API key organization no longer exists.',
|
|
530
|
+
status: 403,
|
|
531
|
+
});
|
|
532
|
+
const claim = claimed.claim;
|
|
467
533
|
if (claim.type === 'mismatch')
|
|
468
534
|
return Response.error(c, {
|
|
469
535
|
code: 'idempotency_conflict',
|
|
@@ -473,19 +539,19 @@ export function depositAddresses(options = {}) {
|
|
|
473
539
|
if (claim.type === 'pending')
|
|
474
540
|
return Response.error(c, {
|
|
475
541
|
code: 'idempotency_in_progress',
|
|
476
|
-
message: 'An equivalent
|
|
542
|
+
message: 'An equivalent route deposit address creation is still running.',
|
|
477
543
|
status: 409,
|
|
478
544
|
});
|
|
479
545
|
if (claim.type === 'replay') {
|
|
480
546
|
const response = JSON.parse(claim.response);
|
|
481
|
-
return c.json(Response.validated(schema.
|
|
547
|
+
return c.json(Response.validated(schema.createRoutesDepositAddress.Response, {
|
|
482
548
|
...response,
|
|
483
549
|
subsidize: response['subsidize'] ?? false,
|
|
484
550
|
}), 200);
|
|
485
551
|
}
|
|
486
552
|
const release = async () => {
|
|
487
553
|
try {
|
|
488
|
-
await
|
|
554
|
+
await RoutesIdempotency.release(db, {
|
|
489
555
|
apiKeyId: identity.apiKeyId,
|
|
490
556
|
createdAt: claim.createdAt,
|
|
491
557
|
keyHash: identity.keyHash,
|
|
@@ -496,8 +562,8 @@ export function depositAddresses(options = {}) {
|
|
|
496
562
|
}
|
|
497
563
|
};
|
|
498
564
|
const complete = async (database, response) => {
|
|
499
|
-
const validated = Response.validated(schema.
|
|
500
|
-
const completion = await
|
|
565
|
+
const validated = Response.validated(schema.createRoutesDepositAddress.Response, response);
|
|
566
|
+
const completion = await RoutesIdempotency.complete(database, {
|
|
501
567
|
apiKeyId: identity.apiKeyId,
|
|
502
568
|
createdAt: claim.createdAt,
|
|
503
569
|
keyHash: identity.keyHash,
|
|
@@ -505,18 +571,102 @@ export function depositAddresses(options = {}) {
|
|
|
505
571
|
response: JSON.stringify(validated),
|
|
506
572
|
});
|
|
507
573
|
if (!completion)
|
|
508
|
-
throw new IdempotencyLeaseLostError('
|
|
574
|
+
throw new IdempotencyLeaseLostError('Route deposit address creation lease was lost.');
|
|
509
575
|
return validated;
|
|
510
576
|
};
|
|
511
577
|
const attempts = [];
|
|
512
578
|
const provisioning = { succeeded: claim.type === 'resume' };
|
|
513
579
|
try {
|
|
580
|
+
if (claim.type === 'claimed' && subsidize) {
|
|
581
|
+
const policy = await RoutesSubsidy.check(db, {
|
|
582
|
+
environment: owner.environment,
|
|
583
|
+
orgId: owner.orgId,
|
|
584
|
+
});
|
|
585
|
+
if (policy.type === 'denied') {
|
|
586
|
+
RoutesObservability.recordSubsidyRejection(c.get('metrics'), {
|
|
587
|
+
reason: policy.reason,
|
|
588
|
+
routesEnvironment: owner.environment,
|
|
589
|
+
});
|
|
590
|
+
await release();
|
|
591
|
+
return Response.error(c, {
|
|
592
|
+
code: policy.reason,
|
|
593
|
+
message: RoutesSubsidy.denialMessages[policy.reason],
|
|
594
|
+
status: 403,
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
}
|
|
514
598
|
const selected = await (async () => {
|
|
515
599
|
if (claim.type === 'resume')
|
|
516
|
-
return
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
600
|
+
return {
|
|
601
|
+
checkpoint: depositAddressCheckpoint.parse(JSON.parse(claim.response)),
|
|
602
|
+
checkpointFresh: claim.checkpointFresh,
|
|
603
|
+
...(claim.recoveredClaim === undefined
|
|
604
|
+
? {}
|
|
605
|
+
: { recoveredClaim: claim.recoveredClaim }),
|
|
606
|
+
quoteMatchesRequest: claim.checkpointFresh,
|
|
607
|
+
type: 'resume',
|
|
608
|
+
};
|
|
609
|
+
const catalog = await RoutesCatalog.snapshot(c);
|
|
610
|
+
const providers = c.get('providers').filter(RoutesProvider.is);
|
|
611
|
+
const selection = RoutesProvider.selectDepositAddress({
|
|
612
|
+
catalog,
|
|
613
|
+
destinationChainId: c.get('chainId'),
|
|
614
|
+
destinationToken: body.destinationToken,
|
|
615
|
+
providers,
|
|
616
|
+
recipient: body.recipient,
|
|
617
|
+
refundAddress: body.refundAddress,
|
|
618
|
+
sourceChain: body.sourceChain,
|
|
619
|
+
sourceToken: body.sourceToken,
|
|
620
|
+
});
|
|
621
|
+
if (!selection)
|
|
622
|
+
return undefined;
|
|
623
|
+
const match = {
|
|
624
|
+
destinationTokenKey: selection.candidate.destinationToken.tokenKey,
|
|
625
|
+
environment: owner.environment,
|
|
626
|
+
orgId: owner.orgId,
|
|
627
|
+
...(owner.projectId === undefined ? {} : { projectId: owner.projectId }),
|
|
628
|
+
recipient: selection.recipient,
|
|
629
|
+
refundAddress: selection.refundAddress,
|
|
630
|
+
sourceChainId: selection.candidate.sourceChain.id,
|
|
631
|
+
sourceTokenKey: selection.candidate.sourceToken.tokenKey,
|
|
632
|
+
subsidize,
|
|
633
|
+
};
|
|
634
|
+
const capacity = await RoutesDepositAddresses.validateCreationCapacity(db, {
|
|
635
|
+
claim: {
|
|
636
|
+
apiKeyId: identity.apiKeyId,
|
|
637
|
+
createdAt: claim.createdAt,
|
|
638
|
+
keyHash: identity.keyHash,
|
|
639
|
+
},
|
|
640
|
+
match,
|
|
641
|
+
matchHash: Idempotency.inputHash(match),
|
|
642
|
+
maxPerCreator: RoutesDepositAddress.maximumPerCreator,
|
|
643
|
+
orgId: owner.orgId,
|
|
644
|
+
pendingTtlMs: idempotencyPendingTtlMs,
|
|
645
|
+
replayTtlMs: idempotencyReplayTtlMs,
|
|
646
|
+
serializeMatchingResponse: (record) => JSON.stringify(Response.validated(schema.createRoutesDepositAddress.Response, RoutesDepositAddress.toPublic(record))),
|
|
647
|
+
});
|
|
648
|
+
if (capacity.type === 'existing')
|
|
649
|
+
return { record: capacity.record, type: 'existing' };
|
|
650
|
+
if (capacity.type === 'resume')
|
|
651
|
+
return {
|
|
652
|
+
checkpoint: depositAddressCheckpoint.parse(JSON.parse(capacity.response)),
|
|
653
|
+
checkpointFresh: capacity.checkpointFresh,
|
|
654
|
+
quoteMatchesRequest: false,
|
|
655
|
+
recoveredClaim: capacity.claim,
|
|
656
|
+
type: 'resume',
|
|
657
|
+
};
|
|
658
|
+
if (subsidize) {
|
|
659
|
+
const marked = await RoutesIdempotency.markProviderAttempt(db, {
|
|
660
|
+
apiKeyId: identity.apiKeyId,
|
|
661
|
+
createdAt: claim.createdAt,
|
|
662
|
+
keyHash: identity.keyHash,
|
|
663
|
+
ttlMs: idempotencyPendingTtlMs,
|
|
664
|
+
});
|
|
665
|
+
if (!marked)
|
|
666
|
+
throw new IdempotencyLeaseLostError('Route deposit address creation lease was lost.');
|
|
667
|
+
provisioning.succeeded = true;
|
|
668
|
+
}
|
|
669
|
+
const provisioned = await RoutesProvider.createDepositAddress({
|
|
520
670
|
amount: body.amount,
|
|
521
671
|
catalog,
|
|
522
672
|
destinationChainId: c.get('chainId'),
|
|
@@ -533,33 +683,93 @@ export function depositAddresses(options = {}) {
|
|
|
533
683
|
return undefined;
|
|
534
684
|
provisioning.succeeded = true;
|
|
535
685
|
const checkpoint = depositAddressCheckpoint.parse({
|
|
686
|
+
amount: body.amount,
|
|
536
687
|
candidate: provisioned.candidate,
|
|
537
688
|
provider: provisioned.provider,
|
|
538
689
|
recipient: provisioned.recipient,
|
|
539
690
|
refundAddress: provisioned.refundAddress,
|
|
540
691
|
result: provisioned.result,
|
|
541
692
|
});
|
|
542
|
-
|
|
693
|
+
return {
|
|
694
|
+
checkpoint,
|
|
695
|
+
checkpointFresh: true,
|
|
696
|
+
quoteMatchesRequest: true,
|
|
697
|
+
type: 'provisioned',
|
|
698
|
+
};
|
|
699
|
+
})();
|
|
700
|
+
if (attempts.length > 0)
|
|
701
|
+
c.set('routesProviderAttempts', attempts.map(RoutesProvider.formatAttempt));
|
|
702
|
+
if (!selected) {
|
|
703
|
+
await release();
|
|
704
|
+
return depositAddressNotAvailable(c);
|
|
705
|
+
}
|
|
706
|
+
if (selected.type === 'existing') {
|
|
707
|
+
const response = Response.validated(schema.createRoutesDepositAddress.Response, RoutesDepositAddress.toPublic(selected.record));
|
|
708
|
+
if (options.registerDepositAddress)
|
|
709
|
+
await options.registerDepositAddress(RoutesDepositAddress.schema.RoutesDepositAddress.parse(response));
|
|
710
|
+
return c.json(response, 200);
|
|
711
|
+
}
|
|
712
|
+
const resumed = await (async () => {
|
|
713
|
+
if (selected.type !== 'resume')
|
|
714
|
+
return { recoveredClaim: undefined, type: 'ready' };
|
|
715
|
+
const match = {
|
|
716
|
+
destinationTokenKey: selected.checkpoint.candidate.destinationToken.tokenKey,
|
|
717
|
+
environment: owner.environment,
|
|
718
|
+
orgId: owner.orgId,
|
|
719
|
+
...(owner.projectId === undefined ? {} : { projectId: owner.projectId }),
|
|
720
|
+
recipient: selected.checkpoint.recipient,
|
|
721
|
+
refundAddress: selected.checkpoint.refundAddress,
|
|
722
|
+
sourceChainId: selected.checkpoint.candidate.sourceChain.id,
|
|
723
|
+
sourceTokenKey: selected.checkpoint.candidate.sourceToken.tokenKey,
|
|
724
|
+
subsidize,
|
|
725
|
+
};
|
|
726
|
+
const capacity = await RoutesDepositAddresses.validateCreationCapacity(db, {
|
|
727
|
+
claim: {
|
|
728
|
+
apiKeyId: identity.apiKeyId,
|
|
729
|
+
createdAt: claim.createdAt,
|
|
730
|
+
keyHash: identity.keyHash,
|
|
731
|
+
},
|
|
732
|
+
match,
|
|
733
|
+
matchHash: Idempotency.inputHash(match),
|
|
734
|
+
maxPerCreator: RoutesDepositAddress.maximumPerCreator,
|
|
735
|
+
orgId: owner.orgId,
|
|
736
|
+
pendingTtlMs: idempotencyPendingTtlMs,
|
|
737
|
+
...(selected.recoveredClaim === undefined
|
|
738
|
+
? {}
|
|
739
|
+
: { recoveredClaim: selected.recoveredClaim }),
|
|
740
|
+
replayTtlMs: idempotencyReplayTtlMs,
|
|
741
|
+
serializeMatchingResponse: (record) => JSON.stringify(Response.validated(schema.createRoutesDepositAddress.Response, RoutesDepositAddress.toPublic(record))),
|
|
742
|
+
});
|
|
743
|
+
if (capacity.type === 'existing')
|
|
744
|
+
return { record: capacity.record, type: 'existing' };
|
|
745
|
+
return {
|
|
746
|
+
recoveredClaim: capacity.type === 'resume' ? capacity.claim : selected.recoveredClaim,
|
|
747
|
+
type: 'ready',
|
|
748
|
+
};
|
|
749
|
+
})();
|
|
750
|
+
if (resumed.type === 'existing') {
|
|
751
|
+
const response = Response.validated(schema.createRoutesDepositAddress.Response, RoutesDepositAddress.toPublic(resumed.record));
|
|
752
|
+
if (options.registerDepositAddress)
|
|
753
|
+
await options.registerDepositAddress(RoutesDepositAddress.schema.RoutesDepositAddress.parse(response));
|
|
754
|
+
return c.json(response, 200);
|
|
755
|
+
}
|
|
756
|
+
if (selected.type === 'provisioned') {
|
|
757
|
+
const stored = await RoutesIdempotency.checkpoint(db, {
|
|
543
758
|
apiKeyId: identity.apiKeyId,
|
|
544
759
|
createdAt: claim.createdAt,
|
|
545
760
|
keyHash: identity.keyHash,
|
|
546
761
|
replayTtlMs: idempotencyReplayTtlMs,
|
|
547
|
-
response: JSON.stringify(checkpoint),
|
|
762
|
+
response: JSON.stringify(selected.checkpoint),
|
|
548
763
|
});
|
|
549
764
|
if (!stored)
|
|
550
|
-
throw new IdempotencyLeaseLostError('
|
|
551
|
-
return checkpoint;
|
|
552
|
-
})();
|
|
553
|
-
if (attempts.length > 0)
|
|
554
|
-
c.set('fundingProviderAttempts', attempts.map(ProviderAttempts.format));
|
|
555
|
-
if (!selected) {
|
|
556
|
-
await release();
|
|
557
|
-
return depositAddressNotAvailable(c);
|
|
765
|
+
throw new IdempotencyLeaseLostError('Route deposit address creation lease was lost.');
|
|
558
766
|
}
|
|
559
|
-
const { candidate: selectedCandidate, provider, recipient, refundAddress, result, } = selected;
|
|
767
|
+
const { candidate: selectedCandidate, provider, recipient, refundAddress, result, } = selected.checkpoint;
|
|
560
768
|
const created = await db.transaction(async (tx) => {
|
|
561
|
-
const
|
|
562
|
-
|
|
769
|
+
const persist = selected.type === 'resume'
|
|
770
|
+
? RoutesDepositAddress.recoverOrGet
|
|
771
|
+
: RoutesDepositAddress.createOrGet;
|
|
772
|
+
const stored = await persist(tx, {
|
|
563
773
|
deliveryStrategy: 'provider',
|
|
564
774
|
environment: owner.environment,
|
|
565
775
|
orgId: owner.orgId,
|
|
@@ -581,10 +791,8 @@ export function depositAddresses(options = {}) {
|
|
|
581
791
|
subsidize,
|
|
582
792
|
},
|
|
583
793
|
});
|
|
584
|
-
const record =
|
|
585
|
-
|
|
586
|
-
return complete(tx, record);
|
|
587
|
-
return complete(tx, {
|
|
794
|
+
const record = RoutesDepositAddress.toPublic(stored.record);
|
|
795
|
+
const quoted = {
|
|
588
796
|
...record,
|
|
589
797
|
destinationAmount: Value.tokenAmount({
|
|
590
798
|
baseUnits: result.destinationAmount,
|
|
@@ -617,64 +825,124 @@ export function depositAddresses(options = {}) {
|
|
|
617
825
|
sampledAt: result.sampledAt,
|
|
618
826
|
},
|
|
619
827
|
sourceAmount: Value.tokenAmount({
|
|
620
|
-
baseUnits: body.amount,
|
|
828
|
+
baseUnits: selected.checkpoint.amount ?? body.amount,
|
|
621
829
|
currency: selectedCandidate.sourceToken.currency,
|
|
622
830
|
decimals: selectedCandidate.sourceToken.decimals,
|
|
623
831
|
}),
|
|
624
|
-
}
|
|
832
|
+
};
|
|
833
|
+
const response = await complete(tx, stored.type === 'existing' || !selected.quoteMatchesRequest ? record : quoted);
|
|
834
|
+
if (resumed.recoveredClaim)
|
|
835
|
+
await RoutesIdempotency.complete(tx, {
|
|
836
|
+
...resumed.recoveredClaim,
|
|
837
|
+
replayTtlMs: idempotencyReplayTtlMs,
|
|
838
|
+
response: JSON.stringify(stored.type === 'existing' ||
|
|
839
|
+
!selected.checkpointFresh ||
|
|
840
|
+
(selected.checkpoint.amount === undefined && !selected.quoteMatchesRequest)
|
|
841
|
+
? record
|
|
842
|
+
: quoted),
|
|
843
|
+
});
|
|
844
|
+
return { record: stored.record, response, type: stored.type };
|
|
625
845
|
});
|
|
846
|
+
if (created.type === 'created') {
|
|
847
|
+
if ('sourceAmount' in created.response)
|
|
848
|
+
RoutesObservability.recordRouteQuote(c.get('metrics'), {
|
|
849
|
+
destinationAmount: created.response.destinationAmount,
|
|
850
|
+
destinationChain: created.response.destinationChain,
|
|
851
|
+
destinationToken: created.response.destinationToken,
|
|
852
|
+
feePayer: subsidize ? 'tempo' : 'customer',
|
|
853
|
+
fees: created.response.fees,
|
|
854
|
+
routesEnvironment: owner.environment,
|
|
855
|
+
method: 'deposit_address',
|
|
856
|
+
provider: created.response.provider,
|
|
857
|
+
sourceAmount: created.response.sourceAmount,
|
|
858
|
+
sourceChain: created.response.sourceChain,
|
|
859
|
+
sourceToken: created.response.sourceToken,
|
|
860
|
+
});
|
|
861
|
+
RoutesObservability.recordDepositAddress(c.get('metrics'), {
|
|
862
|
+
record: created.record,
|
|
863
|
+
});
|
|
864
|
+
}
|
|
626
865
|
if (options.registerDepositAddress)
|
|
627
|
-
await options.registerDepositAddress(
|
|
628
|
-
return c.json(created, 200);
|
|
866
|
+
await options.registerDepositAddress(RoutesDepositAddress.schema.RoutesDepositAddress.parse(created.response));
|
|
867
|
+
return c.json(created.response, 200);
|
|
629
868
|
}
|
|
630
869
|
catch (cause) {
|
|
631
870
|
if (!provisioning.succeeded)
|
|
632
871
|
await release();
|
|
633
|
-
if (cause instanceof
|
|
872
|
+
if (cause instanceof RoutesProvider.InvalidRefundAddressError)
|
|
634
873
|
return Response.error(c, {
|
|
635
874
|
code: 'body_invalid',
|
|
636
875
|
message: 'Invalid `refundAddress`.',
|
|
637
876
|
status: 400,
|
|
638
877
|
});
|
|
639
|
-
if (cause instanceof
|
|
878
|
+
if (cause instanceof RoutesProvider.UnsupportedSourceChainError)
|
|
640
879
|
return depositAddressNotAvailable(c);
|
|
641
|
-
if (cause instanceof
|
|
642
|
-
cause
|
|
643
|
-
|
|
880
|
+
if (cause instanceof RoutesDepositAddress.OwnerNotFoundError ||
|
|
881
|
+
RoutesIdempotency.isOwnerFenceError(cause))
|
|
882
|
+
return Response.error(c, {
|
|
883
|
+
code: 'api_key_forbidden',
|
|
884
|
+
message: 'API key organization no longer exists.',
|
|
885
|
+
status: 403,
|
|
886
|
+
});
|
|
887
|
+
if (cause instanceof RoutesDepositAddresses.OwnerNotFoundError)
|
|
888
|
+
return Response.error(c, {
|
|
889
|
+
code: 'api_key_forbidden',
|
|
890
|
+
message: 'API key organization no longer exists.',
|
|
891
|
+
status: 403,
|
|
892
|
+
});
|
|
893
|
+
if (cause instanceof RoutesDepositAddresses.CapacityClaimNotFoundError ||
|
|
894
|
+
cause instanceof RoutesDepositAddresses.MatchInProgressError)
|
|
895
|
+
return Response.error(c, {
|
|
896
|
+
code: 'idempotency_in_progress',
|
|
897
|
+
message: 'An equivalent route deposit address creation is still running.',
|
|
898
|
+
status: 409,
|
|
899
|
+
});
|
|
900
|
+
if (cause instanceof RoutesDepositAddress.ConflictError ||
|
|
901
|
+
cause instanceof RoutesDepositAddress.LimitExceededError ||
|
|
902
|
+
cause instanceof RoutesDepositAddresses.LimitExceededError ||
|
|
903
|
+
cause instanceof RoutesProvider.ProviderQuoteError) {
|
|
904
|
+
if (cause instanceof RoutesDepositAddress.LimitExceededError ||
|
|
905
|
+
cause instanceof RoutesDepositAddresses.LimitExceededError) {
|
|
906
|
+
RoutesObservability.recordDepositAddressLimitRejection(c.get('metrics'), {
|
|
907
|
+
routesEnvironment: owner.environment,
|
|
908
|
+
});
|
|
909
|
+
return depositAddressLimitExceeded(c);
|
|
910
|
+
}
|
|
911
|
+
if (cause instanceof RoutesDepositAddress.ConflictError)
|
|
644
912
|
return Response.error(c, {
|
|
645
913
|
code: 'upstream_error',
|
|
646
|
-
message: 'The
|
|
914
|
+
message: 'The route provider returned a conflicting deposit address.',
|
|
647
915
|
status: 502,
|
|
648
916
|
});
|
|
649
|
-
if (cause.
|
|
650
|
-
c.set('
|
|
917
|
+
if (cause.routesProviderAttempts.length > 0)
|
|
918
|
+
c.set('routesProviderAttempts', cause.routesProviderAttempts);
|
|
651
919
|
if (cause.providerFailure)
|
|
652
920
|
c.set('providerFailure', cause.providerFailure);
|
|
653
921
|
if (cause.providerFailures)
|
|
654
922
|
c.set('providerFailures', cause.providerFailures);
|
|
655
923
|
return Response.error(c, {
|
|
656
924
|
code: 'upstream_error',
|
|
657
|
-
message: 'The
|
|
925
|
+
message: 'The route provider could not provision the deposit address.',
|
|
658
926
|
status: 502,
|
|
659
927
|
});
|
|
660
928
|
}
|
|
661
929
|
throw cause;
|
|
662
930
|
}
|
|
663
931
|
})
|
|
664
|
-
.get('/v1/
|
|
932
|
+
.get('/v1/routes/deposit-addresses', Auth.policy({ apiKey: { scopes: ['routes:read'] } }), OpenApi.validate('query', schema.listRoutesDepositAddresses.Query, {
|
|
665
933
|
code: 'query_invalid',
|
|
666
934
|
message: 'Check the query parameters and try again.',
|
|
667
935
|
}), OpenApi.describeRoute({
|
|
668
|
-
description: 'Lists reusable
|
|
669
|
-
operationId: '
|
|
936
|
+
description: 'Lists reusable route deposit addresses, newest first.',
|
|
937
|
+
operationId: 'listRoutesDepositAddresses',
|
|
670
938
|
responses: OpenApi.responses({
|
|
671
939
|
errors: {
|
|
672
940
|
400: { codes: ['query_invalid'] },
|
|
673
941
|
},
|
|
674
942
|
success: {
|
|
675
|
-
description: 'A page of reusable
|
|
676
|
-
example:
|
|
677
|
-
schema: schema.
|
|
943
|
+
description: 'A page of reusable route deposit addresses.',
|
|
944
|
+
example: routesDepositAddressesExample,
|
|
945
|
+
schema: schema.listRoutesDepositAddresses.Response,
|
|
678
946
|
},
|
|
679
947
|
}),
|
|
680
948
|
summary: 'List deposit addresses',
|
|
@@ -694,7 +962,7 @@ export function depositAddresses(options = {}) {
|
|
|
694
962
|
const { cursor, limit } = c.req.valid('query');
|
|
695
963
|
const decoded = cursor ? Cursor.decode(cursor, ['timestamp', 'id']) : undefined;
|
|
696
964
|
try {
|
|
697
|
-
const rows = await
|
|
965
|
+
const rows = await RoutesDepositAddresses.listByOwner(db, {
|
|
698
966
|
...(decoded
|
|
699
967
|
? { cursor: { createdAt: String(decoded[0]), id: String(decoded[1]) } }
|
|
700
968
|
: {}),
|
|
@@ -706,10 +974,10 @@ export function depositAddresses(options = {}) {
|
|
|
706
974
|
limit,
|
|
707
975
|
rows,
|
|
708
976
|
});
|
|
709
|
-
const data = page.rows.map(
|
|
977
|
+
const data = page.rows.map(RoutesDepositAddress.toPublic);
|
|
710
978
|
c.header('Cache-Control', Cache.policies.noStore);
|
|
711
979
|
c.header('Vary', 'Accept-Encoding, Authorization, Tempo-API-Key, X-API-Key');
|
|
712
|
-
return c.json(Response.validated(schema.
|
|
980
|
+
return c.json(Response.validated(schema.listRoutesDepositAddresses.Response, {
|
|
713
981
|
data,
|
|
714
982
|
nextCursor: page.nextCursor,
|
|
715
983
|
}), 200);
|
|
@@ -718,24 +986,24 @@ export function depositAddresses(options = {}) {
|
|
|
718
986
|
return Response.upstream(c, cause);
|
|
719
987
|
}
|
|
720
988
|
})
|
|
721
|
-
.get('/v1/
|
|
989
|
+
.get('/v1/routes/deposit-addresses/:id{rda_[A-Za-z0-9_-]+}', Auth.policy({ apiKey: { scopes: ['routes:read'] } }), OpenApi.validate('param', schema.getRoutesDepositAddress.Params, {
|
|
722
990
|
code: 'param_invalid',
|
|
723
991
|
message: 'Check the path parameters and try again.',
|
|
724
992
|
}), OpenApi.describeRoute({
|
|
725
|
-
description: 'Returns one reusable
|
|
726
|
-
operationId: '
|
|
993
|
+
description: 'Returns one reusable route deposit address.',
|
|
994
|
+
operationId: 'getRoutesDepositAddress',
|
|
727
995
|
responses: OpenApi.responses({
|
|
728
996
|
errors: {
|
|
729
997
|
400: { codes: ['param_invalid'] },
|
|
730
998
|
404: {
|
|
731
|
-
codes: ['
|
|
732
|
-
description: 'No visible
|
|
999
|
+
codes: ['routes_deposit_address_not_found'],
|
|
1000
|
+
description: 'No visible route deposit address exists for the identifier.',
|
|
733
1001
|
},
|
|
734
1002
|
},
|
|
735
1003
|
success: {
|
|
736
|
-
description: 'The requested
|
|
737
|
-
example:
|
|
738
|
-
schema: schema.
|
|
1004
|
+
description: 'The requested route deposit address.',
|
|
1005
|
+
example: routesDepositAddressExample,
|
|
1006
|
+
schema: schema.getRoutesDepositAddress.Response,
|
|
739
1007
|
},
|
|
740
1008
|
}),
|
|
741
1009
|
summary: 'Get deposit address',
|
|
@@ -754,30 +1022,30 @@ export function depositAddresses(options = {}) {
|
|
|
754
1022
|
const db = Db.get(c.get('db'));
|
|
755
1023
|
const { id } = c.req.valid('param');
|
|
756
1024
|
try {
|
|
757
|
-
const record = await
|
|
1025
|
+
const record = await RoutesDepositAddresses.getOwned(db, owner, id);
|
|
758
1026
|
if (!record)
|
|
759
1027
|
return Response.error(c, {
|
|
760
|
-
code: '
|
|
761
|
-
message: '
|
|
1028
|
+
code: 'routes_deposit_address_not_found',
|
|
1029
|
+
message: 'Route deposit address not found',
|
|
762
1030
|
status: 404,
|
|
763
1031
|
});
|
|
764
1032
|
c.header('Cache-Control', Cache.policies.noStore);
|
|
765
1033
|
c.header('Vary', 'Accept-Encoding, Authorization, Tempo-API-Key, X-API-Key');
|
|
766
|
-
return c.json(Response.validated(schema.
|
|
1034
|
+
return c.json(Response.validated(schema.getRoutesDepositAddress.Response, RoutesDepositAddress.toPublic(record)), 200);
|
|
767
1035
|
}
|
|
768
1036
|
catch (cause) {
|
|
769
1037
|
return Response.upstream(c, cause);
|
|
770
1038
|
}
|
|
771
1039
|
})
|
|
772
|
-
.post('/v1/
|
|
773
|
-
apiKey: { rateLimit: { limit: 10, period: 'minute' }, scopes: ['
|
|
774
|
-
}), OpenApi.validate('param', schema.
|
|
1040
|
+
.post('/v1/routes/deposit-addresses/:id{rda_[A-Za-z0-9_-]+}/reconcile', Auth.policy({
|
|
1041
|
+
apiKey: { rateLimit: { limit: 10, period: 'minute' }, scopes: ['routes:write'] },
|
|
1042
|
+
}), OpenApi.validate('param', schema.reconcileRoutesDepositAddress.Params, {
|
|
775
1043
|
code: 'param_invalid',
|
|
776
1044
|
message: 'Check the path parameters and try again.',
|
|
777
1045
|
}), OpenApi.describeRoute({
|
|
778
|
-
description: 'Queues an immediate provider reconciliation for one reusable
|
|
779
|
-
operationId: '
|
|
780
|
-
responses:
|
|
1046
|
+
description: 'Queues an immediate provider reconciliation for one reusable route deposit address.',
|
|
1047
|
+
operationId: 'reconcileRoutesDepositAddress',
|
|
1048
|
+
responses: reconcileRoutesDepositAddressResponses,
|
|
781
1049
|
summary: 'Reconcile deposit address',
|
|
782
1050
|
tags: ['Deposit Addresses'],
|
|
783
1051
|
}), async (c) => {
|
|
@@ -796,30 +1064,30 @@ export function depositAddresses(options = {}) {
|
|
|
796
1064
|
const db = Db.get(c.get('db'));
|
|
797
1065
|
const { id } = c.req.valid('param');
|
|
798
1066
|
try {
|
|
799
|
-
const record = await
|
|
1067
|
+
const record = await RoutesDepositAddresses.getOwned(db, owner, id);
|
|
800
1068
|
if (!record)
|
|
801
1069
|
return Response.error(c, {
|
|
802
|
-
code: '
|
|
803
|
-
message: '
|
|
1070
|
+
code: 'routes_deposit_address_not_found',
|
|
1071
|
+
message: 'Route deposit address not found',
|
|
804
1072
|
status: 404,
|
|
805
1073
|
});
|
|
806
1074
|
if (record.status !== 'active')
|
|
807
1075
|
return Response.error(c, {
|
|
808
|
-
code: '
|
|
809
|
-
message: '
|
|
1076
|
+
code: 'routes_deposit_address_not_active',
|
|
1077
|
+
message: 'Route deposit address is not active',
|
|
810
1078
|
status: 409,
|
|
811
1079
|
});
|
|
812
|
-
const dispatch = options.
|
|
1080
|
+
const dispatch = options.dispatchDepositReconciliation;
|
|
813
1081
|
if (!dispatch)
|
|
814
1082
|
return Response.error(c, {
|
|
815
1083
|
code: 'not_implemented',
|
|
816
|
-
message: 'Manual
|
|
1084
|
+
message: 'Manual routes reconciliation is not configured',
|
|
817
1085
|
status: 501,
|
|
818
1086
|
});
|
|
819
1087
|
await dispatch({
|
|
820
1088
|
addressId: record.id,
|
|
821
1089
|
trigger: 'manual',
|
|
822
|
-
type: '
|
|
1090
|
+
type: 'routes:deposit-address:reconcile',
|
|
823
1091
|
});
|
|
824
1092
|
return c.body(null, 202);
|
|
825
1093
|
}
|
|
@@ -827,20 +1095,20 @@ export function depositAddresses(options = {}) {
|
|
|
827
1095
|
return Response.upstream(c, cause);
|
|
828
1096
|
}
|
|
829
1097
|
})
|
|
830
|
-
.get('/v1/
|
|
1098
|
+
.get('/v1/routes/deposits', Auth.policy({ apiKey: { scopes: ['routes:read'] } }), OpenApi.validate('query', schema.listRoutesDeposits.Query, {
|
|
831
1099
|
code: 'query_invalid',
|
|
832
1100
|
message: 'Check the query parameters and try again.',
|
|
833
1101
|
}), OpenApi.describeRoute({
|
|
834
1102
|
description: 'Lists visible deposits, optionally filtered, newest first.',
|
|
835
|
-
operationId: '
|
|
1103
|
+
operationId: 'listRoutesDeposits',
|
|
836
1104
|
responses: OpenApi.responses({
|
|
837
1105
|
errors: {
|
|
838
1106
|
400: { codes: ['query_invalid'] },
|
|
839
1107
|
},
|
|
840
1108
|
success: {
|
|
841
|
-
description: 'A page of visible
|
|
842
|
-
example:
|
|
843
|
-
schema: schema.
|
|
1109
|
+
description: 'A page of visible route deposits.',
|
|
1110
|
+
example: routesDepositsExample,
|
|
1111
|
+
schema: schema.listRoutesDeposits.Response,
|
|
844
1112
|
},
|
|
845
1113
|
}),
|
|
846
1114
|
summary: 'List deposits',
|
|
@@ -864,18 +1132,18 @@ export function depositAddresses(options = {}) {
|
|
|
864
1132
|
const catalog = parameters.destinationToken !== undefined ||
|
|
865
1133
|
parameters.sourceChain !== undefined ||
|
|
866
1134
|
parameters.sourceToken !== undefined
|
|
867
|
-
? await
|
|
1135
|
+
? await RoutesCatalog.snapshot(c)
|
|
868
1136
|
: undefined;
|
|
869
1137
|
const filters = resolveDepositFilters({ catalog, parameters });
|
|
870
1138
|
// Counts are best-effort and share every ownership and filter predicate
|
|
871
1139
|
// with the page query. A failure omits `meta` rather than failing the page.
|
|
872
1140
|
const countPromise = include.includes('totalCount')
|
|
873
|
-
?
|
|
1141
|
+
? RoutesDeposits.count(db, {
|
|
874
1142
|
...filters,
|
|
875
1143
|
cap: Schema.countCap,
|
|
876
1144
|
owner,
|
|
877
1145
|
}).catch(() => {
|
|
878
|
-
c.set('
|
|
1146
|
+
c.set('routesDepositCountFailed', true);
|
|
879
1147
|
return undefined;
|
|
880
1148
|
})
|
|
881
1149
|
: undefined;
|
|
@@ -887,17 +1155,17 @@ export function depositAddresses(options = {}) {
|
|
|
887
1155
|
limit: limit + 1,
|
|
888
1156
|
owner,
|
|
889
1157
|
};
|
|
890
|
-
const rows = await
|
|
1158
|
+
const rows = await RoutesDeposits.listByOwner(db, paging);
|
|
891
1159
|
const page = Cursor.paginate({
|
|
892
1160
|
key: (record) => [record.createdAt, record.id],
|
|
893
1161
|
limit,
|
|
894
1162
|
rows,
|
|
895
1163
|
});
|
|
896
|
-
const data = page.rows.map(
|
|
1164
|
+
const data = page.rows.map(RoutesDeposit.toPublic);
|
|
897
1165
|
const count = await countPromise;
|
|
898
1166
|
c.header('Cache-Control', Cache.policies.noStore);
|
|
899
1167
|
c.header('Vary', 'Accept-Encoding, Authorization, Tempo-API-Key');
|
|
900
|
-
return c.json(Response.validated(schema.
|
|
1168
|
+
return c.json(Response.validated(schema.listRoutesDeposits.Response, {
|
|
901
1169
|
data,
|
|
902
1170
|
...(count === undefined
|
|
903
1171
|
? {}
|
|
@@ -914,29 +1182,29 @@ export function depositAddresses(options = {}) {
|
|
|
914
1182
|
return Response.upstream(c, cause);
|
|
915
1183
|
}
|
|
916
1184
|
})
|
|
917
|
-
.get('/v1/
|
|
1185
|
+
.get('/v1/routes/deposits/:id{rdp_[A-Za-z0-9_-]+}', Auth.policy({ apiKey: { scopes: ['routes:read'] } }), OpenApi.validate('param', schema.getRoutesDeposit.Params, {
|
|
918
1186
|
code: 'param_invalid',
|
|
919
1187
|
message: 'Check the path parameters and try again.',
|
|
920
1188
|
}), OpenApi.describeRoute({
|
|
921
1189
|
description: 'Returns one detected deposit and its delivery status.',
|
|
922
|
-
operationId: '
|
|
1190
|
+
operationId: 'getRoutesDeposit',
|
|
923
1191
|
responses: OpenApi.responses({
|
|
924
1192
|
errors: {
|
|
925
1193
|
400: { codes: ['param_invalid'] },
|
|
926
1194
|
404: {
|
|
927
|
-
codes: ['
|
|
928
|
-
description: 'No visible
|
|
1195
|
+
codes: ['routes_deposit_not_found'],
|
|
1196
|
+
description: 'No visible route deposit exists for the identifier.',
|
|
929
1197
|
},
|
|
930
1198
|
},
|
|
931
1199
|
success: {
|
|
932
|
-
description: 'The requested
|
|
933
|
-
example:
|
|
934
|
-
schema: schema.
|
|
1200
|
+
description: 'The requested route deposit.',
|
|
1201
|
+
example: routesDepositExample,
|
|
1202
|
+
schema: schema.getRoutesDeposit.Response,
|
|
935
1203
|
},
|
|
936
1204
|
}),
|
|
937
1205
|
summary: 'Get deposit',
|
|
938
1206
|
tags: ['Deposit Addresses'],
|
|
939
|
-
}),
|
|
1207
|
+
}), routesEtag, async (c) => {
|
|
940
1208
|
if (Auth.narrowAccess)
|
|
941
1209
|
return Auth.accessError(c);
|
|
942
1210
|
if (OpenApi.narrowValidation)
|
|
@@ -950,16 +1218,16 @@ export function depositAddresses(options = {}) {
|
|
|
950
1218
|
const db = Db.get(c.get('db'));
|
|
951
1219
|
const { id } = c.req.valid('param');
|
|
952
1220
|
try {
|
|
953
|
-
const record = await
|
|
1221
|
+
const record = await RoutesDeposits.getOwned(db, owner, id);
|
|
954
1222
|
if (!record)
|
|
955
1223
|
return Response.error(c, {
|
|
956
|
-
code: '
|
|
957
|
-
message: '
|
|
1224
|
+
code: 'routes_deposit_not_found',
|
|
1225
|
+
message: 'Route deposit not found',
|
|
958
1226
|
status: 404,
|
|
959
1227
|
});
|
|
960
1228
|
c.header('Cache-Control', Cache.policies.state);
|
|
961
1229
|
c.header('Vary', 'Accept-Encoding, Authorization, Tempo-API-Key, X-API-Key');
|
|
962
|
-
return c.json(Response.validated(schema.
|
|
1230
|
+
return c.json(Response.validated(schema.getRoutesDeposit.Response, RoutesDeposit.toPublic(record)), 200);
|
|
963
1231
|
}
|
|
964
1232
|
catch (cause) {
|
|
965
1233
|
return Response.upstream(c, cause);
|
|
@@ -973,7 +1241,14 @@ function depositAddressNotAvailable(c) {
|
|
|
973
1241
|
status: 404,
|
|
974
1242
|
});
|
|
975
1243
|
}
|
|
1244
|
+
function depositAddressLimitExceeded(c) {
|
|
1245
|
+
return Response.error(c, {
|
|
1246
|
+
code: 'routes_deposit_address_limit_exceeded',
|
|
1247
|
+
message: `Route deposit address limit reached (${RoutesDepositAddress.maximumPerCreator}).`,
|
|
1248
|
+
status: 403,
|
|
1249
|
+
});
|
|
1250
|
+
}
|
|
976
1251
|
class IdempotencyLeaseLostError extends Error {
|
|
977
|
-
name = '
|
|
1252
|
+
name = 'Routes.IdempotencyLeaseLostError';
|
|
978
1253
|
}
|
|
979
1254
|
//# sourceMappingURL=deposit-addresses.js.map
|