tapimo 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -4
- package/dist/ApiKey.js +1 -1
- package/dist/ApiKey.js.map +1 -1
- package/dist/ApiKeys.d.ts +95 -14
- package/dist/ApiKeys.d.ts.map +1 -1
- package/dist/ApiKeys.js +360 -49
- package/dist/ApiKeys.js.map +1 -1
- package/dist/App.d.ts +12457 -10365
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +300 -22
- package/dist/App.js.map +1 -1
- package/dist/Assets.d.ts.map +1 -1
- package/dist/Assets.js +2 -1
- package/dist/Assets.js.map +1 -1
- package/dist/Handler.d.ts +0 -1
- package/dist/Handler.d.ts.map +1 -1
- package/dist/Handler.js +0 -1
- package/dist/Handler.js.map +1 -1
- package/dist/Scope.d.ts +13 -5
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +16 -5
- package/dist/Scope.js.map +1 -1
- package/dist/Webhooks.js +1 -1
- package/dist/Webhooks.js.map +1 -1
- package/dist/admin/App.d.ts +3057 -549
- package/dist/admin/App.d.ts.map +1 -1
- package/dist/admin/App.js +26 -5
- package/dist/admin/App.js.map +1 -1
- package/dist/admin/apps/api-keys.d.ts +159 -7
- package/dist/admin/apps/api-keys.d.ts.map +1 -1
- package/dist/admin/apps/api-keys.js +95 -43
- package/dist/admin/apps/api-keys.js.map +1 -1
- package/dist/admin/apps/earn-vaults.d.ts +1398 -0
- package/dist/admin/apps/earn-vaults.d.ts.map +1 -1
- package/dist/admin/apps/earn-vaults.js +463 -7
- package/dist/admin/apps/earn-vaults.js.map +1 -1
- package/dist/admin/apps/organizations.d.ts +267 -15
- package/dist/admin/apps/organizations.d.ts.map +1 -1
- package/dist/admin/apps/organizations.js +241 -25
- package/dist/admin/apps/organizations.js.map +1 -1
- package/dist/admin/apps/routes-support.d.ts +95 -0
- package/dist/admin/apps/routes-support.d.ts.map +1 -0
- package/dist/admin/apps/routes-support.js +151 -0
- package/dist/admin/apps/routes-support.js.map +1 -0
- package/dist/admin/apps/routes.d.ts +2764 -0
- package/dist/admin/apps/routes.d.ts.map +1 -0
- package/dist/admin/apps/routes.js +728 -0
- package/dist/admin/apps/routes.js.map +1 -0
- package/dist/admin/apps/subsidies.d.ts +501 -0
- package/dist/admin/apps/subsidies.d.ts.map +1 -0
- package/dist/admin/apps/subsidies.js +384 -0
- package/dist/admin/apps/subsidies.js.map +1 -0
- package/dist/admin/apps/verified-tokens.d.ts +88 -88
- package/dist/admin/apps/verified-tokens.d.ts.map +1 -1
- package/dist/admin/apps/verified-tokens.js +3 -3
- package/dist/admin/apps/verified-tokens.js.map +1 -1
- package/dist/admin/ui.generated.d.ts +1 -1
- package/dist/admin/ui.generated.d.ts.map +1 -1
- package/dist/admin/ui.generated.js +129 -69
- package/dist/admin/ui.generated.js.map +1 -1
- package/dist/analytics/Analytics.d.ts +5 -2
- package/dist/analytics/Analytics.d.ts.map +1 -1
- package/dist/analytics/Analytics.js +31 -1
- package/dist/analytics/Analytics.js.map +1 -1
- package/dist/analytics/tables/requestEvents.d.ts +2 -1
- package/dist/analytics/tables/requestEvents.d.ts.map +1 -1
- package/dist/analytics/tables/requestEvents.js +10 -1
- package/dist/analytics/tables/requestEvents.js.map +1 -1
- package/dist/analytics/tables/routesLifecycleIntervals.d.ts +72 -0
- package/dist/analytics/tables/routesLifecycleIntervals.d.ts.map +1 -0
- package/dist/analytics/tables/routesLifecycleIntervals.js +56 -0
- package/dist/analytics/tables/routesLifecycleIntervals.js.map +1 -0
- package/dist/apps/Zones.d.ts +21 -12526
- package/dist/apps/Zones.d.ts.map +1 -1
- package/dist/apps/Zones.js +37 -5
- package/dist/apps/Zones.js.map +1 -1
- package/dist/apps/data/App.d.ts +3971 -2595
- package/dist/apps/data/App.d.ts.map +1 -1
- package/dist/apps/data/App.js +76 -21
- package/dist/apps/data/App.js.map +1 -1
- package/dist/apps/data/routes/activities.d.ts +364 -34
- package/dist/apps/data/routes/activities.d.ts.map +1 -1
- package/dist/apps/data/routes/activities.js +495 -190
- package/dist/apps/data/routes/activities.js.map +1 -1
- package/dist/apps/data/routes/addresses.d.ts +72 -0
- package/dist/apps/data/routes/addresses.d.ts.map +1 -1
- package/dist/apps/data/routes/blocks.d.ts +37 -37
- package/dist/apps/data/routes/coingecko.d.ts.map +1 -1
- package/dist/apps/data/routes/coingecko.js +47 -21
- package/dist/apps/data/routes/coingecko.js.map +1 -1
- package/dist/apps/data/routes/earn.d.ts +1450 -337
- package/dist/apps/data/routes/earn.d.ts.map +1 -1
- package/dist/apps/data/routes/earn.js +1226 -144
- package/dist/apps/data/routes/earn.js.map +1 -1
- package/dist/apps/data/routes/fee-amm.d.ts +5 -0
- package/dist/apps/data/routes/fee-amm.d.ts.map +1 -1
- package/dist/apps/data/routes/fee-amm.js +31 -19
- package/dist/apps/data/routes/fee-amm.js.map +1 -1
- package/dist/apps/data/routes/indexer.d.ts +125 -0
- package/dist/apps/data/routes/indexer.d.ts.map +1 -1
- package/dist/apps/data/routes/indexer.js +83 -27
- package/dist/apps/data/routes/indexer.js.map +1 -1
- package/dist/apps/data/routes/rpc.d.ts +507 -33
- package/dist/apps/data/routes/rpc.d.ts.map +1 -1
- package/dist/apps/data/routes/rpc.js +266 -156
- package/dist/apps/data/routes/rpc.js.map +1 -1
- package/dist/apps/data/routes/tokenlist.d.ts +47 -15
- package/dist/apps/data/routes/tokenlist.d.ts.map +1 -1
- package/dist/apps/data/routes/tokenlist.js +68 -11
- package/dist/apps/data/routes/tokenlist.js.map +1 -1
- package/dist/apps/data/routes/tokens.d.ts +2 -0
- package/dist/apps/data/routes/tokens.d.ts.map +1 -1
- package/dist/apps/data/routes/tokens.js +26 -14
- package/dist/apps/data/routes/tokens.js.map +1 -1
- package/dist/apps/data/routes/transfers.d.ts +28 -12
- package/dist/apps/data/routes/transfers.d.ts.map +1 -1
- package/dist/apps/data/routes/transfers.js +9 -7
- package/dist/apps/data/routes/transfers.js.map +1 -1
- package/dist/apps/data/routes/valuation.d.ts +30 -30
- package/dist/apps/data/routes/verified-tokens.d.ts +9 -9
- package/dist/apps/data/routes/verified-tokens.d.ts.map +1 -1
- package/dist/apps/data/routes/verified-tokens.js +64 -20
- package/dist/apps/data/routes/verified-tokens.js.map +1 -1
- package/dist/apps/data/routes/webhooks.d.ts +613 -176
- package/dist/apps/data/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/data/routes/webhooks.js +291 -195
- package/dist/apps/data/routes/webhooks.js.map +1 -1
- package/dist/apps/data/routes/zones.d.ts.map +1 -1
- package/dist/apps/data/routes/zones.js +20 -12
- package/dist/apps/data/routes/zones.js.map +1 -1
- package/dist/apps/docs/reference.js +2 -2
- package/dist/apps/docs/reference.js.map +1 -1
- package/dist/apps/index.d.ts +1 -1
- package/dist/apps/index.d.ts.map +1 -1
- package/dist/apps/index.js +1 -1
- package/dist/apps/index.js.map +1 -1
- package/dist/apps/management/App.d.ts +3763 -3385
- package/dist/apps/management/App.d.ts.map +1 -1
- package/dist/apps/management/App.js +5 -14
- package/dist/apps/management/App.js.map +1 -1
- package/dist/apps/management/Billing.d.ts +48 -7
- package/dist/apps/management/Billing.d.ts.map +1 -1
- package/dist/apps/management/Billing.js +204 -25
- package/dist/apps/management/Billing.js.map +1 -1
- package/dist/apps/management/routes/api-keys.d.ts +106 -4
- package/dist/apps/management/routes/api-keys.d.ts.map +1 -1
- package/dist/apps/management/routes/api-keys.js +43 -15
- package/dist/apps/management/routes/api-keys.js.map +1 -1
- package/dist/apps/management/routes/billing.d.ts +290 -4
- package/dist/apps/management/routes/billing.d.ts.map +1 -1
- package/dist/apps/management/routes/billing.js +274 -49
- package/dist/apps/management/routes/billing.js.map +1 -1
- package/dist/apps/management/routes/faucet.d.ts +6 -6
- package/dist/apps/management/routes/faucet.js +1 -1
- package/dist/apps/management/routes/faucet.js.map +1 -1
- package/dist/apps/management/routes/invitations.d.ts +77 -2
- package/dist/apps/management/routes/invitations.d.ts.map +1 -1
- package/dist/apps/management/routes/invitations.js +117 -13
- package/dist/apps/management/routes/invitations.js.map +1 -1
- package/dist/apps/management/routes/invite-links.d.ts +4 -4
- package/dist/apps/management/routes/me.d.ts.map +1 -1
- package/dist/apps/management/routes/me.js +6 -2
- package/dist/apps/management/routes/me.js.map +1 -1
- package/dist/apps/management/routes/members.d.ts +30 -30
- package/dist/apps/management/routes/orgs.d.ts +18 -2
- package/dist/apps/management/routes/orgs.d.ts.map +1 -1
- package/dist/apps/management/routes/orgs.js +52 -12
- package/dist/apps/management/routes/orgs.js.map +1 -1
- package/dist/apps/management/routes/projects.d.ts +4 -4
- package/dist/apps/management/routes/projects.d.ts.map +1 -1
- package/dist/apps/management/routes/projects.js +6 -1
- package/dist/apps/management/routes/projects.js.map +1 -1
- package/dist/apps/management/routes/scopes.d.ts.map +1 -1
- package/dist/apps/management/routes/scopes.js +4 -1
- package/dist/apps/management/routes/scopes.js.map +1 -1
- package/dist/apps/management/routes/usage.d.ts +24 -24
- package/dist/apps/management/routes/usage.js +21 -4
- package/dist/apps/management/routes/usage.js.map +1 -1
- package/dist/apps/management/routes/verified-token-requests.d.ts +2 -2
- package/dist/apps/management/routes/webhooks.d.ts +280 -214
- package/dist/apps/management/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/management/routes/webhooks.js +58 -12
- package/dist/apps/management/routes/webhooks.js.map +1 -1
- package/dist/apps/mcp.d.ts +1 -1
- package/dist/apps/mcp.js +7 -7
- package/dist/apps/mcp.js.map +1 -1
- package/dist/apps/mpp/App.d.ts.map +1 -1
- package/dist/apps/mpp/App.js +35 -7
- package/dist/apps/mpp/App.js.map +1 -1
- package/dist/apps/mpp/internal/Adapter.d.ts +2 -0
- package/dist/apps/mpp/internal/Adapter.d.ts.map +1 -1
- package/dist/apps/mpp/internal/Adapter.js +30 -1
- package/dist/apps/mpp/internal/Adapter.js.map +1 -1
- package/dist/apps/mpp/internal/Policy.d.ts +22 -4
- package/dist/apps/mpp/internal/Policy.d.ts.map +1 -1
- package/dist/apps/mpp/internal/Policy.js +24 -6
- package/dist/apps/mpp/internal/Policy.js.map +1 -1
- package/dist/apps/mpp/internal/Sponsorship.d.ts +3 -0
- package/dist/apps/mpp/internal/Sponsorship.d.ts.map +1 -1
- package/dist/apps/mpp/internal/Sponsorship.js +6 -3
- package/dist/apps/mpp/internal/Sponsorship.js.map +1 -1
- package/dist/apps/relay/App.d.ts +2 -0
- package/dist/apps/relay/App.d.ts.map +1 -1
- package/dist/apps/relay/App.js +134 -75
- package/dist/apps/relay/App.js.map +1 -1
- package/dist/apps/relay/Sponsorships.d.ts +5 -3
- package/dist/apps/relay/Sponsorships.d.ts.map +1 -1
- package/dist/apps/relay/Sponsorships.js +209 -28
- package/dist/apps/relay/Sponsorships.js.map +1 -1
- package/dist/apps/{funding → routes}/Access.d.ts +4 -4
- package/dist/apps/routes/Access.d.ts.map +1 -0
- package/dist/apps/{funding → routes}/Access.js +4 -4
- package/dist/apps/routes/Access.js.map +1 -0
- package/dist/apps/{funding → routes}/App.d.ts +418 -124
- package/dist/apps/{funding → routes}/App.d.ts.map +1 -1
- package/dist/apps/{funding → routes}/App.js +16 -16
- package/dist/apps/routes/App.js.map +1 -0
- package/dist/apps/routes/Inventory.d.ts.map +1 -0
- package/dist/apps/{funding → routes}/Inventory.js +2 -2
- package/dist/apps/routes/Inventory.js.map +1 -0
- package/dist/apps/routes/index.d.ts +2 -0
- package/dist/apps/routes/index.d.ts.map +1 -0
- package/dist/apps/routes/index.js +2 -0
- package/dist/apps/routes/index.js.map +1 -0
- package/dist/apps/{funding → routes}/routes/chains.d.ts +7 -7
- package/dist/apps/routes/routes/chains.d.ts.map +1 -0
- package/dist/apps/{funding → routes}/routes/chains.js +25 -25
- package/dist/apps/routes/routes/chains.js.map +1 -0
- package/dist/apps/{funding → routes}/routes/deposit-addresses.d.ts +107 -43
- package/dist/apps/routes/routes/deposit-addresses.d.ts.map +1 -0
- package/dist/apps/{funding → routes}/routes/deposit-addresses.js +497 -222
- package/dist/apps/routes/routes/deposit-addresses.js.map +1 -0
- package/dist/apps/{funding → routes}/routes/providers.d.ts +8 -8
- package/dist/apps/routes/routes/providers.d.ts.map +1 -0
- package/dist/apps/routes/routes/providers.js +57 -0
- package/dist/apps/routes/routes/providers.js.map +1 -0
- package/dist/apps/{funding → routes}/routes/quotes.d.ts +19 -16
- package/dist/apps/routes/routes/quotes.d.ts.map +1 -0
- package/dist/apps/{funding → routes}/routes/quotes.js +55 -38
- package/dist/apps/routes/routes/quotes.js.map +1 -0
- package/dist/apps/{funding → routes}/routes/transfers.d.ts +379 -74
- package/dist/apps/routes/routes/transfers.d.ts.map +1 -0
- package/dist/apps/routes/routes/transfers.js +1140 -0
- package/dist/apps/routes/routes/transfers.js.map +1 -0
- package/dist/cli/Cli.d.ts +30 -0
- package/dist/cli/Cli.d.ts.map +1 -1
- package/dist/cli/commands/admin.d.ts +36 -0
- package/dist/cli/commands/admin.d.ts.map +1 -1
- package/dist/cli/commands/admin.js +273 -0
- package/dist/cli/commands/admin.js.map +1 -1
- package/dist/cloudflare.d.ts +16 -14
- package/dist/cloudflare.d.ts.map +1 -1
- package/dist/cloudflare.js +26 -21
- package/dist/cloudflare.js.map +1 -1
- package/dist/db/Db.d.ts +63 -21
- package/dist/db/Db.d.ts.map +1 -1
- package/dist/db/Db.js +1030 -15
- package/dist/db/Db.js.map +1 -1
- package/dist/db/Schema.d.ts +780 -133
- package/dist/db/Schema.d.ts.map +1 -1
- package/dist/db/Schema.js +575 -162
- package/dist/db/Schema.js.map +1 -1
- package/dist/db/tables/apiKeyAdmissionBootstraps.d.ts +4 -0
- package/dist/db/tables/apiKeyAdmissionBootstraps.d.ts.map +1 -0
- package/dist/db/tables/apiKeyAdmissionBootstraps.js +2 -0
- package/dist/db/tables/apiKeyAdmissionBootstraps.js.map +1 -0
- package/dist/db/tables/apiKeyAdmissions.d.ts +73 -0
- package/dist/db/tables/apiKeyAdmissions.d.ts.map +1 -0
- package/dist/db/tables/apiKeyAdmissions.js +142 -0
- package/dist/db/tables/apiKeyAdmissions.js.map +1 -0
- package/dist/db/tables/apiKeyOwnerAdmissions.d.ts +4 -0
- package/dist/db/tables/apiKeyOwnerAdmissions.d.ts.map +1 -0
- package/dist/db/tables/apiKeyOwnerAdmissions.js +2 -0
- package/dist/db/tables/apiKeyOwnerAdmissions.js.map +1 -0
- package/dist/db/tables/apiKeyOwnerTombstones.d.ts +20 -0
- package/dist/db/tables/apiKeyOwnerTombstones.d.ts.map +1 -0
- package/dist/db/tables/apiKeyOwnerTombstones.js +57 -0
- package/dist/db/tables/apiKeyOwnerTombstones.js.map +1 -0
- package/dist/db/tables/apiKeyRevocations.d.ts +21 -0
- package/dist/db/tables/apiKeyRevocations.d.ts.map +1 -0
- package/dist/db/tables/apiKeyRevocations.js +98 -0
- package/dist/db/tables/apiKeyRevocations.js.map +1 -0
- package/dist/db/tables/authAccounts.d.ts +47 -0
- package/dist/db/tables/authAccounts.d.ts.map +1 -0
- package/dist/db/tables/authAccounts.js +72 -0
- package/dist/db/tables/authAccounts.js.map +1 -0
- package/dist/db/tables/authSessions.d.ts +12 -0
- package/dist/db/tables/authSessions.d.ts.map +1 -0
- package/dist/db/tables/authSessions.js +2 -0
- package/dist/db/tables/authSessions.js.map +1 -0
- package/dist/db/tables/authVerifications.d.ts +12 -0
- package/dist/db/tables/authVerifications.d.ts.map +1 -0
- package/dist/db/tables/authVerifications.js +2 -0
- package/dist/db/tables/authVerifications.js.map +1 -0
- package/dist/db/tables/invitations.d.ts +17 -1
- package/dist/db/tables/invitations.d.ts.map +1 -1
- package/dist/db/tables/invitations.js +123 -43
- package/dist/db/tables/invitations.js.map +1 -1
- package/dist/db/tables/memberships.d.ts +8 -0
- package/dist/db/tables/memberships.d.ts.map +1 -1
- package/dist/db/tables/memberships.js +51 -2
- package/dist/db/tables/memberships.js.map +1 -1
- package/dist/db/tables/organizations.d.ts +32 -10
- package/dist/db/tables/organizations.d.ts.map +1 -1
- package/dist/db/tables/organizations.js +110 -49
- package/dist/db/tables/organizations.js.map +1 -1
- package/dist/db/tables/projects.d.ts +2 -0
- package/dist/db/tables/projects.d.ts.map +1 -1
- package/dist/db/tables/projects.js +12 -3
- package/dist/db/tables/projects.js.map +1 -1
- package/dist/db/tables/requestUsage.d.ts.map +1 -1
- package/dist/db/tables/requestUsage.js.map +1 -1
- package/dist/db/tables/rewardAccounts.d.ts +86 -0
- package/dist/db/tables/rewardAccounts.d.ts.map +1 -0
- package/dist/db/tables/rewardAccounts.js +88 -0
- package/dist/db/tables/rewardAccounts.js.map +1 -0
- package/dist/db/tables/rewardCampaignDistributors.d.ts +36 -0
- package/dist/db/tables/rewardCampaignDistributors.d.ts.map +1 -0
- package/dist/db/tables/rewardCampaignDistributors.js +30 -0
- package/dist/db/tables/rewardCampaignDistributors.js.map +1 -0
- package/dist/db/tables/rewardCampaigns.d.ts +171 -0
- package/dist/db/tables/rewardCampaigns.d.ts.map +1 -0
- package/dist/db/tables/rewardCampaigns.js +392 -0
- package/dist/db/tables/rewardCampaigns.js.map +1 -0
- package/dist/db/tables/rewardCredits.d.ts +53 -0
- package/dist/db/tables/rewardCredits.d.ts.map +1 -0
- package/dist/db/tables/rewardCredits.js +63 -0
- package/dist/db/tables/rewardCredits.js.map +1 -0
- package/dist/db/tables/rewardEligibilityAssociations.d.ts +61 -0
- package/dist/db/tables/rewardEligibilityAssociations.d.ts.map +1 -0
- package/dist/db/tables/rewardEligibilityAssociations.js +103 -0
- package/dist/db/tables/rewardEligibilityAssociations.js.map +1 -0
- package/dist/db/tables/rewardRuns.d.ts +188 -0
- package/dist/db/tables/rewardRuns.d.ts.map +1 -0
- package/dist/db/tables/rewardRuns.js +278 -0
- package/dist/db/tables/rewardRuns.js.map +1 -0
- package/dist/db/tables/rewardTransactionAttempts.d.ts +100 -0
- package/dist/db/tables/rewardTransactionAttempts.d.ts.map +1 -0
- package/dist/db/tables/rewardTransactionAttempts.js +163 -0
- package/dist/db/tables/rewardTransactionAttempts.js.map +1 -0
- package/dist/db/tables/routesCatalog.d.ts +58 -0
- package/dist/db/tables/routesCatalog.d.ts.map +1 -0
- package/dist/db/tables/{fundingCatalog.js → routesCatalog.js} +19 -19
- package/dist/db/tables/routesCatalog.js.map +1 -0
- package/dist/db/tables/routesDepositAddresses.d.ts +476 -0
- package/dist/db/tables/routesDepositAddresses.d.ts.map +1 -0
- package/dist/db/tables/routesDepositAddresses.js +587 -0
- package/dist/db/tables/routesDepositAddresses.js.map +1 -0
- package/dist/db/tables/{fundingDepositRequestObservations.d.ts → routesDepositRequestObservations.d.ts} +6 -6
- package/dist/db/tables/routesDepositRequestObservations.d.ts.map +1 -0
- package/dist/db/tables/{fundingDepositRequestObservations.js → routesDepositRequestObservations.js} +6 -6
- package/dist/db/tables/routesDepositRequestObservations.js.map +1 -0
- package/dist/db/tables/{fundingDeposits.d.ts → routesDeposits.d.ts} +210 -22
- package/dist/db/tables/routesDeposits.d.ts.map +1 -0
- package/dist/db/tables/routesDeposits.js +576 -0
- package/dist/db/tables/routesDeposits.js.map +1 -0
- package/dist/db/tables/routesIdempotency.d.ts +166 -0
- package/dist/db/tables/routesIdempotency.d.ts.map +1 -0
- package/dist/db/tables/routesIdempotency.js +330 -0
- package/dist/db/tables/routesIdempotency.js.map +1 -0
- package/dist/db/tables/routesSubsidies.d.ts +27 -0
- package/dist/db/tables/routesSubsidies.d.ts.map +1 -0
- package/dist/db/tables/routesSubsidies.js +45 -0
- package/dist/db/tables/routesSubsidies.js.map +1 -0
- package/dist/db/tables/{fundingTransferEvents.d.ts → routesTransferEvents.d.ts} +3 -3
- package/dist/db/tables/routesTransferEvents.d.ts.map +1 -0
- package/dist/db/tables/{fundingTransferEvents.js → routesTransferEvents.js} +3 -3
- package/dist/db/tables/routesTransferEvents.js.map +1 -0
- package/dist/db/tables/routesTransferSubsidies.d.ts +19 -0
- package/dist/db/tables/routesTransferSubsidies.d.ts.map +1 -0
- package/dist/db/tables/routesTransferSubsidies.js +17 -0
- package/dist/db/tables/routesTransferSubsidies.js.map +1 -0
- package/dist/db/tables/routesTransferSubsidyNonces.d.ts +51 -0
- package/dist/db/tables/routesTransferSubsidyNonces.d.ts.map +1 -0
- package/dist/db/tables/routesTransferSubsidyNonces.js +82 -0
- package/dist/db/tables/routesTransferSubsidyNonces.js.map +1 -0
- package/dist/db/tables/routesTransferTransactions.d.ts +77 -0
- package/dist/db/tables/routesTransferTransactions.d.ts.map +1 -0
- package/dist/db/tables/{fundingTransferTransactions.js → routesTransferTransactions.js} +31 -13
- package/dist/db/tables/routesTransferTransactions.js.map +1 -0
- package/dist/db/tables/routesTransfers.d.ts +319 -0
- package/dist/db/tables/routesTransfers.d.ts.map +1 -0
- package/dist/db/tables/routesTransfers.js +372 -0
- package/dist/db/tables/routesTransfers.js.map +1 -0
- package/dist/db/tables/sponsoredTransactions.d.ts +75 -20
- package/dist/db/tables/sponsoredTransactions.d.ts.map +1 -1
- package/dist/db/tables/sponsoredTransactions.js +124 -54
- package/dist/db/tables/sponsoredTransactions.js.map +1 -1
- package/dist/db/tables/sponsorshipAttributions.d.ts +69 -0
- package/dist/db/tables/sponsorshipAttributions.d.ts.map +1 -0
- package/dist/db/tables/sponsorshipAttributions.js +77 -0
- package/dist/db/tables/sponsorshipAttributions.js.map +1 -0
- package/dist/db/tables/sponsorshipReconciliationCursors.d.ts +22 -0
- package/dist/db/tables/sponsorshipReconciliationCursors.d.ts.map +1 -0
- package/dist/db/tables/sponsorshipReconciliationCursors.js +45 -0
- package/dist/db/tables/sponsorshipReconciliationCursors.js.map +1 -0
- package/dist/db/tables/stripeCustomers.d.ts +11 -0
- package/dist/db/tables/stripeCustomers.d.ts.map +1 -1
- package/dist/db/tables/stripeCustomers.js +13 -0
- package/dist/db/tables/stripeCustomers.js.map +1 -1
- package/dist/db/tables/users.d.ts +17 -1
- package/dist/db/tables/users.d.ts.map +1 -1
- package/dist/db/tables/users.js +47 -2
- package/dist/db/tables/users.js.map +1 -1
- package/dist/db/tables/webhookQueueEvents.d.ts.map +1 -1
- package/dist/db/tables/webhookQueueEvents.js +5 -1
- package/dist/db/tables/webhookQueueEvents.js.map +1 -1
- package/dist/db/tables/webhookSubscriptions.d.ts +19 -11
- package/dist/db/tables/webhookSubscriptions.d.ts.map +1 -1
- package/dist/db/tables/webhookSubscriptions.js +45 -13
- package/dist/db/tables/webhookSubscriptions.js.map +1 -1
- package/dist/handlers/internal/executionError.d.ts +2 -2
- package/dist/handlers/internal/executionError.d.ts.map +1 -1
- package/dist/handlers/internal/executionError.js +1 -2
- package/dist/handlers/internal/executionError.js.map +1 -1
- package/dist/handlers/internal/multisig.d.ts +4 -232
- package/dist/handlers/internal/multisig.d.ts.map +1 -1
- package/dist/handlers/internal/multisig.js +11 -537
- package/dist/handlers/internal/multisig.js.map +1 -1
- package/dist/handlers/internal/sponsorship.d.ts +19 -8
- package/dist/handlers/internal/sponsorship.d.ts.map +1 -1
- package/dist/handlers/internal/sponsorship.js +13 -9
- package/dist/handlers/internal/sponsorship.js.map +1 -1
- package/dist/handlers/relay.d.ts +9 -12
- package/dist/handlers/relay.d.ts.map +1 -1
- package/dist/handlers/relay.js +81 -85
- package/dist/handlers/relay.js.map +1 -1
- package/dist/index.d.ts +0 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -17
- package/dist/index.js.map +1 -1
- package/dist/internal/AssetResponse.d.ts +12 -0
- package/dist/internal/AssetResponse.d.ts.map +1 -0
- package/dist/internal/AssetResponse.js +21 -0
- package/dist/internal/AssetResponse.js.map +1 -0
- package/dist/internal/Auth.d.ts +48 -12
- package/dist/internal/Auth.d.ts.map +1 -1
- package/dist/internal/Auth.js +603 -175
- package/dist/internal/Auth.js.map +1 -1
- package/dist/internal/BetterAuth.d.ts +1488 -0
- package/dist/internal/BetterAuth.d.ts.map +1 -0
- package/dist/internal/BetterAuth.js +253 -0
- package/dist/internal/BetterAuth.js.map +1 -0
- package/dist/internal/Cache.d.ts +2 -0
- package/dist/internal/Cache.d.ts.map +1 -1
- package/dist/internal/Cache.js +2 -0
- package/dist/internal/Cache.js.map +1 -1
- package/dist/internal/EarnRates.d.ts +26 -3
- package/dist/internal/EarnRates.d.ts.map +1 -1
- package/dist/internal/EarnRates.js +84 -19
- package/dist/internal/EarnRates.js.map +1 -1
- package/dist/internal/EarnSharePrices.d.ts +120 -0
- package/dist/internal/EarnSharePrices.d.ts.map +1 -0
- package/dist/internal/EarnSharePrices.js +179 -0
- package/dist/internal/EarnSharePrices.js.map +1 -0
- package/dist/internal/EarnVaults.d.ts +4 -0
- package/dist/internal/EarnVaults.d.ts.map +1 -1
- package/dist/internal/EarnVaults.js +27 -10
- package/dist/internal/EarnVaults.js.map +1 -1
- package/dist/internal/Email.d.ts +37 -0
- package/dist/internal/Email.d.ts.map +1 -0
- package/dist/internal/Email.js +16 -0
- package/dist/internal/Email.js.map +1 -0
- package/dist/internal/Log.d.ts +32 -28
- package/dist/internal/Log.d.ts.map +1 -1
- package/dist/internal/Log.js +18 -11
- package/dist/internal/Log.js.map +1 -1
- package/dist/internal/MetricSink.d.ts +3 -0
- package/dist/internal/MetricSink.d.ts.map +1 -1
- package/dist/internal/MetricSink.js +67 -8
- package/dist/internal/MetricSink.js.map +1 -1
- package/dist/internal/Mpp.d.ts.map +1 -1
- package/dist/internal/Mpp.js +20 -25
- package/dist/internal/Mpp.js.map +1 -1
- package/dist/internal/OpenApi.d.ts +26 -3
- package/dist/internal/OpenApi.d.ts.map +1 -1
- package/dist/internal/OpenApi.js +25 -10
- package/dist/internal/OpenApi.js.map +1 -1
- package/dist/internal/Provider.d.ts +1 -1
- package/dist/internal/Provider.d.ts.map +1 -1
- package/dist/internal/RateLimit.d.ts.map +1 -1
- package/dist/internal/RateLimit.js +13 -1
- package/dist/internal/RateLimit.js.map +1 -1
- package/dist/internal/Store.d.ts +16 -0
- package/dist/internal/Store.d.ts.map +1 -1
- package/dist/internal/Store.js +59 -8
- package/dist/internal/Store.js.map +1 -1
- package/dist/internal/Tidx.d.ts +9 -2
- package/dist/internal/Tidx.d.ts.map +1 -1
- package/dist/internal/Tidx.js +78 -11
- package/dist/internal/Tidx.js.map +1 -1
- package/dist/internal/Timing.d.ts +26 -0
- package/dist/internal/Timing.d.ts.map +1 -1
- package/dist/internal/Timing.js +63 -5
- package/dist/internal/Timing.js.map +1 -1
- package/dist/internal/VercelOidc.d.ts +94 -0
- package/dist/internal/VercelOidc.d.ts.map +1 -0
- package/dist/internal/VercelOidc.js +128 -0
- package/dist/internal/VercelOidc.js.map +1 -0
- package/dist/internal/VerifiedTokens.d.ts +2 -8
- package/dist/internal/VerifiedTokens.d.ts.map +1 -1
- package/dist/internal/VerifiedTokens.js +24 -24
- package/dist/internal/VerifiedTokens.js.map +1 -1
- package/dist/internal/Viem.d.ts +30 -2067
- package/dist/internal/Viem.d.ts.map +1 -1
- package/dist/internal/Viem.js +167 -17
- package/dist/internal/Viem.js.map +1 -1
- package/dist/internal/Webhooks.d.ts +12 -4
- package/dist/internal/Webhooks.d.ts.map +1 -1
- package/dist/internal/Webhooks.js +9 -3
- package/dist/internal/Webhooks.js.map +1 -1
- package/dist/internal/ZoneRpc.d.ts +7 -0
- package/dist/internal/ZoneRpc.d.ts.map +1 -0
- package/dist/internal/ZoneRpc.js +49 -0
- package/dist/internal/ZoneRpc.js.map +1 -0
- package/dist/internal/index.d.ts +3 -1
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +3 -1
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/rewards/Audit.d.ts +88 -0
- package/dist/internal/rewards/Audit.d.ts.map +1 -0
- package/dist/internal/rewards/Audit.js +134 -0
- package/dist/internal/rewards/Audit.js.map +1 -0
- package/dist/internal/rewards/Campaigns.d.ts +572 -0
- package/dist/internal/rewards/Campaigns.d.ts.map +1 -0
- package/dist/internal/rewards/Campaigns.js +531 -0
- package/dist/internal/rewards/Campaigns.js.map +1 -0
- package/dist/internal/rewards/Credits.d.ts +76 -0
- package/dist/internal/rewards/Credits.d.ts.map +1 -0
- package/dist/internal/rewards/Credits.js +95 -0
- package/dist/internal/rewards/Credits.js.map +1 -0
- package/dist/internal/rewards/Events.d.ts +100 -0
- package/dist/internal/rewards/Events.d.ts.map +1 -0
- package/dist/internal/rewards/Events.js +340 -0
- package/dist/internal/rewards/Events.js.map +1 -0
- package/dist/internal/rewards/Projection.d.ts +237 -0
- package/dist/internal/rewards/Projection.d.ts.map +1 -0
- package/dist/internal/rewards/Projection.js +616 -0
- package/dist/internal/rewards/Projection.js.map +1 -0
- package/dist/internal/rewards/Rates.d.ts +44 -0
- package/dist/internal/rewards/Rates.d.ts.map +1 -0
- package/dist/internal/rewards/Rates.js +60 -0
- package/dist/internal/rewards/Rates.js.map +1 -0
- package/dist/internal/rewards/Read.d.ts +158 -0
- package/dist/internal/rewards/Read.d.ts.map +1 -0
- package/dist/internal/rewards/Read.js +292 -0
- package/dist/internal/rewards/Read.js.map +1 -0
- package/dist/internal/rewards/Runner.d.ts +164 -0
- package/dist/internal/rewards/Runner.d.ts.map +1 -0
- package/dist/internal/rewards/Runner.js +1778 -0
- package/dist/internal/rewards/Runner.js.map +1 -0
- package/dist/internal/rewards/Signer.d.ts +224 -0
- package/dist/internal/rewards/Signer.d.ts.map +1 -0
- package/dist/internal/rewards/Signer.js +135 -0
- package/dist/internal/rewards/Signer.js.map +1 -0
- package/dist/internal/rewards/index.d.ts +15 -0
- package/dist/internal/rewards/index.d.ts.map +1 -0
- package/dist/internal/rewards/index.js +15 -0
- package/dist/internal/rewards/index.js.map +1 -0
- package/dist/internal/{funding → routes}/Action.d.ts +12 -1
- package/dist/internal/routes/Action.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Action.js +17 -9
- package/dist/internal/routes/Action.js.map +1 -0
- package/dist/internal/{funding → routes}/Catalog.d.ts +20 -20
- package/dist/internal/routes/Catalog.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Catalog.js +29 -29
- package/dist/internal/routes/Catalog.js.map +1 -0
- package/dist/internal/{funding → routes}/Chain.d.ts +10 -10
- package/dist/internal/routes/Chain.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Chain.js +3 -3
- package/dist/internal/routes/Chain.js.map +1 -0
- package/dist/internal/{funding → routes}/Deposit.d.ts +45 -23
- package/dist/internal/routes/Deposit.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Deposit.js +60 -27
- package/dist/internal/routes/Deposit.js.map +1 -0
- package/dist/internal/{funding → routes}/DepositAddress.d.ts +56 -27
- package/dist/internal/routes/DepositAddress.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/DepositAddress.js +95 -33
- package/dist/internal/routes/DepositAddress.js.map +1 -0
- package/dist/internal/{funding → routes}/DepositWebhook.d.ts +4 -4
- package/dist/internal/routes/DepositWebhook.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/DepositWebhook.js +4 -4
- package/dist/internal/routes/DepositWebhook.js.map +1 -0
- package/dist/internal/routes/Economics.d.ts +25 -0
- package/dist/internal/routes/Economics.d.ts.map +1 -0
- package/dist/internal/routes/Economics.js +28 -0
- package/dist/internal/routes/Economics.js.map +1 -0
- package/dist/internal/{funding → routes}/Evidence.d.ts +3 -3
- package/dist/internal/routes/Evidence.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Evidence.js +7 -7
- package/dist/internal/routes/Evidence.js.map +1 -0
- package/dist/internal/routes/Observability.d.ts +154 -0
- package/dist/internal/routes/Observability.d.ts.map +1 -0
- package/dist/internal/routes/Observability.js +389 -0
- package/dist/internal/routes/Observability.js.map +1 -0
- package/dist/internal/{funding → routes}/Provider.d.ts +311 -105
- package/dist/internal/routes/Provider.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Provider.js +229 -98
- package/dist/internal/routes/Provider.js.map +1 -0
- package/dist/internal/{funding → routes}/Reconciliation.d.ts +11 -6
- package/dist/internal/routes/Reconciliation.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Reconciliation.js +408 -158
- package/dist/internal/routes/Reconciliation.js.map +1 -0
- package/dist/internal/routes/Route.d.ts +21 -0
- package/dist/internal/routes/Route.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Route.js +1 -1
- package/dist/internal/routes/Route.js.map +1 -0
- package/dist/internal/{funding → routes}/SourceObservation.d.ts +6 -6
- package/dist/internal/routes/SourceObservation.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/SourceObservation.js +8 -8
- package/dist/internal/routes/SourceObservation.js.map +1 -0
- package/dist/internal/{funding → routes}/Subsidy.d.ts +48 -3
- package/dist/internal/routes/Subsidy.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Subsidy.js +43 -3
- package/dist/internal/routes/Subsidy.js.map +1 -0
- package/dist/internal/{funding → routes}/Token.d.ts +4 -4
- package/dist/internal/routes/Token.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Token.js +3 -3
- package/dist/internal/routes/Token.js.map +1 -0
- package/dist/internal/{funding → routes}/Transfer.d.ts +241 -46
- package/dist/internal/routes/Transfer.d.ts.map +1 -0
- package/dist/internal/routes/Transfer.js +728 -0
- package/dist/internal/routes/Transfer.js.map +1 -0
- package/dist/internal/{funding → routes}/TransferReconciliation.d.ts +13 -10
- package/dist/internal/routes/TransferReconciliation.d.ts.map +1 -0
- package/dist/internal/routes/TransferReconciliation.js +422 -0
- package/dist/internal/routes/TransferReconciliation.js.map +1 -0
- package/dist/internal/routes/TransferSubsidy.d.ts +201 -0
- package/dist/internal/routes/TransferSubsidy.d.ts.map +1 -0
- package/dist/internal/routes/TransferSubsidy.js +256 -0
- package/dist/internal/routes/TransferSubsidy.js.map +1 -0
- package/dist/internal/{funding → routes}/TransferWebhook.d.ts +5 -5
- package/dist/internal/routes/TransferWebhook.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/TransferWebhook.js +3 -3
- package/dist/internal/routes/TransferWebhook.js.map +1 -0
- package/dist/internal/{funding → routes}/index.d.ts +2 -0
- package/dist/internal/routes/index.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/index.js +2 -0
- package/dist/internal/routes/index.js.map +1 -0
- package/dist/internal/{funding → routes}/providers/across.d.ts +4 -4
- package/dist/internal/routes/providers/across.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/providers/across.js +13 -13
- package/dist/internal/routes/providers/across.js.map +1 -0
- package/dist/internal/{funding → routes}/providers/relay.d.ts +21 -12
- package/dist/internal/routes/providers/relay.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/providers/relay.js +194 -110
- package/dist/internal/routes/providers/relay.js.map +1 -0
- package/dist/internal/{funding → routes}/providers/rhino.d.ts +4 -4
- package/dist/internal/routes/providers/rhino.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/providers/rhino.js +10 -10
- package/dist/internal/routes/providers/rhino.js.map +1 -0
- package/dist/internal/{funding → routes}/providers/squid.d.ts +4 -4
- package/dist/internal/routes/providers/squid.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/providers/squid.js +14 -14
- package/dist/internal/routes/providers/squid.js.map +1 -0
- package/dist/internal/{funding → routes}/providers/stargate.d.ts +46 -18
- package/dist/internal/routes/providers/stargate.d.ts.map +1 -0
- package/dist/internal/routes/providers/stargate.js +898 -0
- package/dist/internal/routes/providers/stargate.js.map +1 -0
- package/dist/internal/{funding → routes}/providers/symbiosis.d.ts +4 -4
- package/dist/internal/routes/providers/symbiosis.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/providers/symbiosis.js +30 -20
- package/dist/internal/routes/providers/symbiosis.js.map +1 -0
- package/dist/internal/webhookDestinations/slack.js +12 -12
- package/dist/internal/webhookDestinations/slack.js.map +1 -1
- package/dist/providers/index.d.ts +12 -12
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +12 -12
- package/dist/providers/index.js.map +1 -1
- package/dist/server.d.ts +19 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +19 -0
- package/dist/server.js.map +1 -0
- package/package.json +15 -4
- package/src/ApiKey.ts +1 -1
- package/src/ApiKeys.test.ts +1033 -3
- package/src/ApiKeys.ts +489 -48
- package/src/App.test-d.ts +1 -1
- package/src/App.test.ts +216 -25
- package/src/App.ts +334 -31
- package/src/Assets.test.ts +2 -2
- package/src/Assets.ts +3 -1
- package/src/Auth.test-d.ts +1 -1
- package/src/Client.test-d.ts +539 -110
- package/src/Handler.ts +0 -1
- package/src/OpenApi.contract.test.ts +195 -0
- package/src/Scope.ts +17 -5
- package/src/Webhooks.ts +1 -1
- package/src/admin/App.test.ts +30 -2
- package/src/admin/App.ts +42 -6
- package/src/admin/apps/api-keys.test.ts +267 -5
- package/src/admin/apps/api-keys.ts +100 -50
- package/src/admin/apps/earn-vaults.test.ts +158 -0
- package/src/admin/apps/earn-vaults.ts +679 -6
- package/src/admin/apps/organizations.test.ts +306 -17
- package/src/admin/apps/organizations.ts +299 -24
- package/src/admin/apps/routes-support.test.ts +200 -0
- package/src/admin/apps/routes-support.ts +201 -0
- package/src/admin/apps/routes.test.ts +450 -0
- package/src/admin/apps/routes.ts +896 -0
- package/src/admin/apps/scopes.test.ts +15 -5
- package/src/admin/apps/subsidies.test.ts +306 -0
- package/src/admin/apps/subsidies.ts +457 -0
- package/src/admin/apps/verified-tokens.test.ts +8 -3
- package/src/admin/apps/verified-tokens.ts +3 -3
- package/src/admin/ui/plugin.ts +1 -2
- package/src/admin/ui/src/components/RewardCampaignForm.tsx +1009 -0
- package/src/admin/ui/src/lib/config.ts +11 -2
- package/src/admin/ui/src/lib/earn-vaults.ts +2 -2
- package/src/admin/ui/src/lib/organizations.test.ts +83 -50
- package/src/admin/ui/src/lib/organizations.ts +106 -25
- package/src/admin/ui/src/lib/query-client.ts +1 -1
- package/src/admin/ui/src/lib/reward-campaigns.ts +136 -0
- package/src/admin/ui/src/lib/routes.test.ts +88 -0
- package/src/admin/ui/src/lib/routes.ts +304 -0
- package/src/admin/ui/src/lib/subsidies.ts +75 -0
- package/src/admin/ui/src/routeTree.gen.ts +63 -0
- package/src/admin/ui/src/routes/__root.tsx +12 -1
- package/src/admin/ui/src/routes/api-keys.tsx +196 -84
- package/src/admin/ui/src/routes/earn.vaults_.$vaultId.edit.tsx +105 -70
- package/src/admin/ui/src/routes/organizations_.$orgId.tsx +239 -23
- package/src/admin/ui/src/routes/routes.tsx +1615 -0
- package/src/admin/ui/src/routes/routes_.support.tsx +248 -0
- package/src/admin/ui/src/routes/subsidies.tsx +799 -0
- package/src/admin/ui.generated.ts +144 -69
- package/src/analytics/Analytics.test.ts +108 -18
- package/src/analytics/Analytics.ts +38 -6
- package/src/analytics/tables/requestEvents.test.ts +100 -0
- package/src/analytics/tables/requestEvents.ts +10 -1
- package/src/analytics/tables/routesLifecycleIntervals.ts +140 -0
- package/src/apps/Zones.test.ts +15 -0
- package/src/apps/Zones.ts +52 -5
- package/src/apps/composition.test.ts +68 -60
- package/src/apps/data/App.test.ts +154 -2
- package/src/apps/data/App.ts +88 -28
- package/src/apps/data/routes/activities.test.ts +419 -7
- package/src/apps/data/routes/activities.ts +683 -216
- package/src/apps/data/routes/balances.test.ts +2 -2
- package/src/apps/data/routes/blocks.test.ts +46 -1
- package/src/apps/data/routes/coingecko.test.ts +419 -1
- package/src/apps/data/routes/coingecko.ts +309 -253
- package/src/apps/data/routes/earn.discovery.test.ts +274 -0
- package/src/apps/data/routes/earn.test.ts +1294 -17
- package/src/apps/data/routes/earn.ts +1838 -321
- package/src/apps/data/routes/exchanges.test.ts +12 -15
- package/src/apps/data/routes/fee-amm.test.ts +224 -0
- package/src/apps/data/routes/fee-amm.ts +191 -160
- package/src/apps/data/routes/indexer.test.ts +389 -0
- package/src/apps/data/routes/indexer.ts +165 -69
- package/src/apps/data/routes/receipts.test.ts +1 -1
- package/src/apps/data/routes/rpc.test.ts +352 -8
- package/src/apps/data/routes/rpc.ts +407 -219
- package/src/apps/data/routes/rpc.zone.test.ts +340 -0
- package/src/apps/data/routes/tokenlist.test.ts +285 -0
- package/src/apps/data/routes/tokenlist.ts +173 -88
- package/src/apps/data/routes/tokens.test.ts +93 -3
- package/src/apps/data/routes/tokens.ts +39 -23
- package/src/apps/data/routes/transactions.test.ts +1 -1
- package/src/apps/data/routes/transfers.test.ts +56 -24
- package/src/apps/data/routes/transfers.ts +19 -8
- package/src/apps/data/routes/valuation.test.ts +1 -1
- package/src/apps/data/routes/verified-tokens.test.ts +345 -0
- package/src/apps/data/routes/verified-tokens.ts +99 -29
- package/src/apps/data/routes/webhooks.test.ts +645 -83
- package/src/apps/data/routes/webhooks.ts +1089 -857
- package/src/apps/data/routes/zones.test.ts +148 -71
- package/src/apps/data/routes/zones.ts +71 -55
- package/src/apps/docs/reference.ts +2 -2
- package/src/apps/index.ts +1 -1
- package/src/apps/management/App.ts +9 -51
- package/src/apps/management/Billing.test.ts +375 -14
- package/src/apps/management/Billing.ts +265 -29
- package/src/apps/management/routes/api-keys.test.ts +269 -7
- package/src/apps/management/routes/api-keys.ts +61 -20
- package/src/apps/management/routes/billing.test.ts +477 -15
- package/src/apps/management/routes/billing.ts +377 -50
- package/src/apps/management/routes/faucet.test.ts +1 -1
- package/src/apps/management/routes/faucet.ts +1 -1
- package/src/apps/management/routes/invitations.test.ts +270 -3
- package/src/apps/management/routes/invitations.ts +185 -15
- package/src/apps/management/routes/invoicePreview.test.ts +549 -0
- package/src/apps/management/routes/me.test.ts +246 -5
- package/src/apps/management/routes/me.ts +7 -2
- package/src/apps/management/routes/members.test.ts +108 -0
- package/src/apps/management/routes/orgs.test.ts +191 -3
- package/src/apps/management/routes/orgs.ts +58 -11
- package/src/apps/management/routes/projects.test.ts +33 -3
- package/src/apps/management/routes/projects.ts +6 -1
- package/src/apps/management/routes/scopes.test.ts +30 -2
- package/src/apps/management/routes/scopes.ts +4 -1
- package/src/apps/management/routes/usage.test.ts +32 -0
- package/src/apps/management/routes/usage.ts +22 -4
- package/src/apps/management/routes/webhooks.test.ts +49 -26
- package/src/apps/management/routes/webhooks.ts +78 -22
- package/src/apps/mcp.test.ts +6 -6
- package/src/apps/mcp.ts +7 -7
- package/src/apps/mpp/App.ts +37 -7
- package/src/apps/mpp/Mpp.test.ts +49 -8
- package/src/apps/mpp/Mpp.zone.test.ts +219 -0
- package/src/apps/mpp/internal/Adapter.ts +34 -0
- package/src/apps/mpp/internal/Policy.test.ts +86 -31
- package/src/apps/mpp/internal/Policy.ts +49 -7
- package/src/apps/mpp/internal/Sponsorship.test.ts +207 -0
- package/src/apps/mpp/internal/Sponsorship.ts +9 -3
- package/src/apps/relay/App.test.ts +839 -64
- package/src/apps/relay/App.ts +148 -81
- package/src/apps/relay/App.zone-billing.test.ts +257 -0
- package/src/apps/relay/Sponsorships.test.ts +67 -4
- package/src/apps/relay/Sponsorships.ts +233 -32
- package/src/apps/relay/Sponsorships.zone.test.ts +102 -0
- package/src/apps/{funding → routes}/Access.ts +6 -6
- package/src/apps/routes/App.test.ts +165 -0
- package/src/apps/routes/App.ts +96 -0
- package/src/apps/{funding → routes}/Inventory.ts +2 -2
- package/src/apps/routes/index.ts +1 -0
- package/src/apps/{funding → routes}/routes/chains.test.ts +66 -66
- package/src/apps/{funding → routes}/routes/chains.ts +23 -23
- package/src/apps/{funding → routes}/routes/deposit-addresses.test.ts +1358 -458
- package/src/apps/{funding → routes}/routes/deposit-addresses.ts +566 -246
- package/src/apps/{funding → routes}/routes/providers.test.ts +27 -33
- package/src/apps/{funding → routes}/routes/providers.ts +23 -23
- package/src/apps/{funding → routes}/routes/quotes.test.ts +298 -41
- package/src/apps/{funding → routes}/routes/quotes.ts +57 -40
- package/src/apps/{funding → routes}/routes/transfers.test.ts +1100 -353
- package/src/apps/routes/routes/transfers.ts +1332 -0
- package/src/cli/Cli.test.ts +1 -1
- package/src/cli/commands/admin.test.ts +748 -1
- package/src/cli/commands/admin.ts +278 -0
- package/src/cloudflare.ts +52 -47
- package/src/db/Db.test.ts +245 -2
- package/src/db/Db.ts +1476 -34
- package/src/db/Schema.ts +729 -228
- package/src/db/tables/apiKeyAdmissionBootstraps.ts +4 -0
- package/src/db/tables/apiKeyAdmissions.ts +218 -0
- package/src/db/tables/apiKeyOwnerAdmissions.ts +4 -0
- package/src/db/tables/apiKeyOwnerTombstones.ts +81 -0
- package/src/db/tables/apiKeyRevocations.test.ts +74 -0
- package/src/db/tables/apiKeyRevocations.ts +121 -0
- package/src/db/tables/authAccounts.ts +105 -0
- package/src/db/tables/authSessions.ts +13 -0
- package/src/db/tables/authVerifications.ts +13 -0
- package/src/db/tables/invitations.ts +142 -45
- package/src/db/tables/memberships.ts +79 -3
- package/src/db/tables/organizations.test.ts +690 -13
- package/src/db/tables/organizations.ts +139 -55
- package/src/db/tables/projects.test.ts +16 -0
- package/src/db/tables/projects.ts +13 -3
- package/src/db/tables/requestUsage.ts +4 -1
- package/src/db/tables/rewardAccounts.ts +178 -0
- package/src/db/tables/rewardCampaignDistributors.ts +68 -0
- package/src/db/tables/rewardCampaigns.test.ts +1388 -0
- package/src/db/tables/rewardCampaigns.ts +647 -0
- package/src/db/tables/rewardCredits.ts +110 -0
- package/src/db/tables/rewardEligibilityAssociations.test.ts +271 -0
- package/src/db/tables/rewardEligibilityAssociations.ts +184 -0
- package/src/db/tables/rewardRuns.ts +514 -0
- package/src/db/tables/rewardTransactionAttempts.ts +272 -0
- package/src/db/tables/routesCatalog.test.ts +185 -0
- package/src/db/tables/routesCatalog.ts +163 -0
- package/src/db/tables/routesDepositAddresses.test.ts +1048 -0
- package/src/db/tables/routesDepositAddresses.ts +1008 -0
- package/src/db/tables/{fundingDepositRequestObservations.test.ts → routesDepositRequestObservations.test.ts} +13 -14
- package/src/db/tables/{fundingDepositRequestObservations.ts → routesDepositRequestObservations.ts} +10 -10
- package/src/db/tables/{fundingDeposits.test.ts → routesDeposits.test.ts} +316 -46
- package/src/db/tables/routesDeposits.ts +1062 -0
- package/src/db/tables/routesIdempotency.test.ts +796 -0
- package/src/db/tables/routesIdempotency.ts +496 -0
- package/src/db/tables/routesSubsidies.test.ts +120 -0
- package/src/db/tables/routesSubsidies.ts +71 -0
- package/src/db/tables/{fundingTransferEvents.ts → routesTransferEvents.ts} +4 -4
- package/src/db/tables/routesTransferSubsidies.ts +38 -0
- package/src/db/tables/routesTransferSubsidyNonces.ts +124 -0
- package/src/db/tables/routesTransferTransactions.test.ts +195 -0
- package/src/db/tables/{fundingTransferTransactions.ts → routesTransferTransactions.ts} +63 -18
- package/src/db/tables/routesTransfers.test.ts +338 -0
- package/src/db/tables/routesTransfers.ts +662 -0
- package/src/db/tables/sponsoredTransactions.test.ts +269 -45
- package/src/db/tables/sponsoredTransactions.ts +225 -65
- package/src/db/tables/sponsorshipAttributions.test.ts +160 -0
- package/src/db/tables/sponsorshipAttributions.ts +168 -0
- package/src/db/tables/sponsorshipReconciliationCursors.test.ts +115 -0
- package/src/db/tables/sponsorshipReconciliationCursors.ts +67 -0
- package/src/db/tables/stripeCustomers.test.ts +85 -0
- package/src/db/tables/stripeCustomers.ts +24 -0
- package/src/db/tables/users.test.ts +129 -0
- package/src/db/tables/users.ts +49 -3
- package/src/db/tables/webhookQueueEvents.ts +8 -1
- package/src/db/tables/webhookSubscriptions.ts +95 -20
- package/src/handlers/internal/executionError.ts +3 -4
- package/src/handlers/internal/multisig.ts +13 -816
- package/src/handlers/internal/sponsorship.ts +26 -10
- package/src/handlers/relay.test-d.ts +9 -1
- package/src/handlers/relay.test.ts +823 -3
- package/src/handlers/relay.ts +127 -107
- package/src/index.test-d.ts +7 -0
- package/src/index.ts +0 -17
- package/src/internal/AssetResponse.ts +26 -0
- package/src/internal/Auth.test.ts +1564 -9
- package/src/internal/Auth.ts +833 -239
- package/src/internal/BetterAuth.test.ts +242 -0
- package/src/internal/BetterAuth.ts +349 -0
- package/src/internal/Cache.ts +2 -0
- package/src/internal/EarnRates.test.ts +17 -0
- package/src/internal/EarnRates.ts +124 -31
- package/src/internal/EarnSharePrices.test.ts +182 -0
- package/src/internal/EarnSharePrices.ts +313 -0
- package/src/internal/EarnVaults.test.ts +21 -0
- package/src/internal/EarnVaults.ts +33 -11
- package/src/internal/Email.ts +54 -0
- package/src/internal/Idempotency.test.ts +2 -2
- package/src/internal/Log.test-d.ts +8 -7
- package/src/internal/Log.test.ts +114 -16
- package/src/internal/Log.ts +53 -40
- package/src/internal/MetricSink.test.ts +313 -26
- package/src/internal/MetricSink.ts +73 -8
- package/src/internal/Mpp.test.ts +31 -0
- package/src/internal/Mpp.ts +21 -24
- package/src/internal/OpenApi.ts +45 -12
- package/src/internal/Provider.test.ts +1 -1
- package/src/internal/Provider.ts +1 -1
- package/src/internal/RateLimit.test.ts +21 -3
- package/src/internal/RateLimit.ts +12 -1
- package/src/internal/Store.test-d.ts +1 -1
- package/src/internal/Store.test.ts +151 -8
- package/src/internal/Store.ts +76 -9
- package/src/internal/Tidx.test.ts +59 -8
- package/src/internal/Tidx.ts +86 -14
- package/src/internal/Timing.test.ts +77 -0
- package/src/internal/Timing.ts +83 -6
- package/src/internal/VercelOidc.test.ts +188 -0
- package/src/internal/VercelOidc.ts +193 -0
- package/src/internal/VerifiedTokens.test.ts +60 -6
- package/src/internal/VerifiedTokens.ts +21 -24
- package/src/internal/Viem.batch.test.ts +80 -0
- package/src/internal/Viem.test.ts +201 -2
- package/src/internal/Viem.ts +221 -25
- package/src/internal/Webhooks.test.ts +85 -6
- package/src/internal/Webhooks.ts +22 -4
- package/src/internal/ZoneRpc.ts +50 -0
- package/src/internal/exchange/Provider.test.ts +2 -2
- package/src/internal/index.test.ts +3 -1
- package/src/internal/index.ts +3 -1
- package/src/internal/rewards/Audit.ts +231 -0
- package/src/internal/rewards/Campaigns.test.ts +1234 -0
- package/src/internal/rewards/Campaigns.ts +1205 -0
- package/src/internal/rewards/Credits.ts +165 -0
- package/src/internal/rewards/Events.local.test.ts +113 -0
- package/src/internal/rewards/Events.test.ts +152 -0
- package/src/internal/rewards/Events.ts +468 -0
- package/src/internal/rewards/Projection.test.ts +681 -0
- package/src/internal/rewards/Projection.ts +987 -0
- package/src/internal/rewards/Rates.test.ts +171 -0
- package/src/internal/rewards/Rates.ts +110 -0
- package/src/internal/rewards/Read.test.ts +501 -0
- package/src/internal/rewards/Read.ts +476 -0
- package/src/internal/rewards/Runner.checkpoint.test.ts +80 -0
- package/src/internal/rewards/Runner.states.test.ts +188 -0
- package/src/internal/rewards/Runner.test.ts +90 -0
- package/src/internal/rewards/Runner.ts +2229 -0
- package/src/internal/rewards/Signer.test.ts +79 -0
- package/src/internal/rewards/Signer.ts +180 -0
- package/src/internal/rewards/index.ts +14 -0
- package/src/internal/{funding → routes}/Action.test.ts +63 -14
- package/src/internal/{funding → routes}/Action.ts +35 -8
- package/src/internal/{funding → routes}/Catalog.test.ts +3 -3
- package/src/internal/{funding → routes}/Catalog.ts +39 -39
- package/src/internal/{funding → routes}/Chain.test.ts +1 -1
- package/src/internal/{funding → routes}/Chain.ts +11 -11
- package/src/internal/{funding → routes}/Deposit.test.ts +1 -1
- package/src/internal/{funding → routes}/Deposit.ts +93 -45
- package/src/internal/{funding → routes}/DepositAddress.test.ts +11 -3
- package/src/internal/{funding → routes}/DepositAddress.ts +132 -53
- package/src/internal/{funding → routes}/DepositWebhook.test.ts +61 -18
- package/src/internal/{funding → routes}/DepositWebhook.ts +9 -9
- package/src/internal/routes/Economics.test.ts +42 -0
- package/src/internal/routes/Economics.ts +47 -0
- package/src/internal/{funding → routes}/Evidence.test.ts +6 -6
- package/src/internal/{funding → routes}/Evidence.ts +9 -9
- package/src/internal/routes/Observability.test.ts +636 -0
- package/src/internal/routes/Observability.ts +668 -0
- package/src/internal/{funding → routes}/Provider.test.ts +489 -153
- package/src/internal/{funding → routes}/Provider.ts +489 -186
- package/src/internal/{funding → routes}/Reconciliation.local.test.ts +84 -12
- package/src/internal/{funding → routes}/Reconciliation.test.ts +1213 -279
- package/src/internal/{funding → routes}/Reconciliation.ts +501 -203
- package/src/internal/routes/Reconciliation.unattributed.test.ts +250 -0
- package/src/internal/{funding → routes}/Route.ts +7 -7
- package/src/internal/{funding → routes}/SourceObservation.test.ts +13 -14
- package/src/internal/{funding → routes}/SourceObservation.ts +13 -13
- package/src/internal/{funding → routes}/Subsidy.local.test.ts +7 -7
- package/src/internal/routes/Subsidy.test.ts +169 -0
- package/src/internal/{funding → routes}/Subsidy.ts +86 -6
- package/src/internal/{funding → routes}/Token.test.ts +1 -1
- package/src/internal/{funding → routes}/Token.ts +5 -5
- package/src/internal/routes/Transfer.test.ts +1199 -0
- package/src/internal/routes/Transfer.ts +1206 -0
- package/src/internal/routes/TransferReconciliation.test.ts +731 -0
- package/src/internal/routes/TransferReconciliation.ts +527 -0
- package/src/internal/routes/TransferSubsidy.test.ts +172 -0
- package/src/internal/routes/TransferSubsidy.ts +447 -0
- package/src/internal/{funding → routes}/TransferWebhook.test.ts +13 -13
- package/src/internal/{funding → routes}/TransferWebhook.ts +7 -7
- package/src/internal/{funding → routes}/index.test.ts +5 -3
- package/src/internal/{funding → routes}/index.ts +2 -0
- package/src/internal/{funding → routes}/providers/across.ts +16 -16
- package/src/internal/{funding → routes}/providers/index.test.ts +157 -44
- package/src/internal/{funding → routes}/providers/relay.test.ts +165 -32
- package/src/internal/{funding → routes}/providers/relay.ts +228 -121
- package/src/internal/{funding → routes}/providers/rhino.ts +16 -16
- package/src/internal/{funding → routes}/providers/squid.ts +17 -17
- package/src/internal/routes/providers/stargate.test.ts +728 -0
- package/src/internal/routes/providers/stargate.ts +1276 -0
- package/src/internal/{funding → routes}/providers/symbiosis.ts +64 -24
- package/src/internal/webhookDestinations/slack.ts +10 -10
- package/src/providers/index.ts +13 -13
- package/src/server.ts +18 -0
- package/dist/apps/funding/Access.d.ts.map +0 -1
- package/dist/apps/funding/Access.js.map +0 -1
- package/dist/apps/funding/App.js.map +0 -1
- package/dist/apps/funding/Inventory.d.ts.map +0 -1
- package/dist/apps/funding/Inventory.js.map +0 -1
- package/dist/apps/funding/ProviderAttempts.d.ts +0 -5
- package/dist/apps/funding/ProviderAttempts.d.ts.map +0 -1
- package/dist/apps/funding/ProviderAttempts.js +0 -24
- package/dist/apps/funding/ProviderAttempts.js.map +0 -1
- package/dist/apps/funding/index.d.ts +0 -2
- package/dist/apps/funding/index.d.ts.map +0 -1
- package/dist/apps/funding/index.js +0 -2
- package/dist/apps/funding/index.js.map +0 -1
- package/dist/apps/funding/routes/chains.d.ts.map +0 -1
- package/dist/apps/funding/routes/chains.js.map +0 -1
- package/dist/apps/funding/routes/deposit-addresses.d.ts.map +0 -1
- package/dist/apps/funding/routes/deposit-addresses.js.map +0 -1
- package/dist/apps/funding/routes/providers.d.ts.map +0 -1
- package/dist/apps/funding/routes/providers.js +0 -57
- package/dist/apps/funding/routes/providers.js.map +0 -1
- package/dist/apps/funding/routes/quotes.d.ts.map +0 -1
- package/dist/apps/funding/routes/quotes.js.map +0 -1
- package/dist/apps/funding/routes/transfers.d.ts.map +0 -1
- package/dist/apps/funding/routes/transfers.js +0 -828
- package/dist/apps/funding/routes/transfers.js.map +0 -1
- package/dist/db/tables/fundingCatalog.d.ts +0 -58
- package/dist/db/tables/fundingCatalog.d.ts.map +0 -1
- package/dist/db/tables/fundingCatalog.js.map +0 -1
- package/dist/db/tables/fundingDepositAddresses.d.ts +0 -192
- package/dist/db/tables/fundingDepositAddresses.d.ts.map +0 -1
- package/dist/db/tables/fundingDepositAddresses.js +0 -235
- package/dist/db/tables/fundingDepositAddresses.js.map +0 -1
- package/dist/db/tables/fundingDepositRequestObservations.d.ts.map +0 -1
- package/dist/db/tables/fundingDepositRequestObservations.js.map +0 -1
- package/dist/db/tables/fundingDeposits.d.ts.map +0 -1
- package/dist/db/tables/fundingDeposits.js +0 -295
- package/dist/db/tables/fundingDeposits.js.map +0 -1
- package/dist/db/tables/fundingIdempotency.d.ts +0 -91
- package/dist/db/tables/fundingIdempotency.d.ts.map +0 -1
- package/dist/db/tables/fundingIdempotency.js +0 -103
- package/dist/db/tables/fundingIdempotency.js.map +0 -1
- package/dist/db/tables/fundingTransferEvents.d.ts.map +0 -1
- package/dist/db/tables/fundingTransferEvents.js.map +0 -1
- package/dist/db/tables/fundingTransferTransactions.d.ts +0 -53
- package/dist/db/tables/fundingTransferTransactions.d.ts.map +0 -1
- package/dist/db/tables/fundingTransferTransactions.js.map +0 -1
- package/dist/db/tables/fundingTransfers.d.ts +0 -99
- package/dist/db/tables/fundingTransfers.d.ts.map +0 -1
- package/dist/db/tables/fundingTransfers.js +0 -110
- package/dist/db/tables/fundingTransfers.js.map +0 -1
- package/dist/internal/funding/Action.d.ts.map +0 -1
- package/dist/internal/funding/Action.js.map +0 -1
- package/dist/internal/funding/Catalog.d.ts.map +0 -1
- package/dist/internal/funding/Catalog.js.map +0 -1
- package/dist/internal/funding/Chain.d.ts.map +0 -1
- package/dist/internal/funding/Chain.js.map +0 -1
- package/dist/internal/funding/Deposit.d.ts.map +0 -1
- package/dist/internal/funding/Deposit.js.map +0 -1
- package/dist/internal/funding/DepositAddress.d.ts.map +0 -1
- package/dist/internal/funding/DepositAddress.js.map +0 -1
- package/dist/internal/funding/DepositWebhook.d.ts.map +0 -1
- package/dist/internal/funding/DepositWebhook.js.map +0 -1
- package/dist/internal/funding/Evidence.d.ts.map +0 -1
- package/dist/internal/funding/Evidence.js.map +0 -1
- package/dist/internal/funding/Provider.d.ts.map +0 -1
- package/dist/internal/funding/Provider.js.map +0 -1
- package/dist/internal/funding/Reconciliation.d.ts.map +0 -1
- package/dist/internal/funding/Reconciliation.js.map +0 -1
- package/dist/internal/funding/Route.d.ts +0 -21
- package/dist/internal/funding/Route.d.ts.map +0 -1
- package/dist/internal/funding/Route.js.map +0 -1
- package/dist/internal/funding/SourceObservation.d.ts.map +0 -1
- package/dist/internal/funding/SourceObservation.js.map +0 -1
- package/dist/internal/funding/Subsidy.d.ts.map +0 -1
- package/dist/internal/funding/Subsidy.js.map +0 -1
- package/dist/internal/funding/Token.d.ts.map +0 -1
- package/dist/internal/funding/Token.js.map +0 -1
- package/dist/internal/funding/Transfer.d.ts.map +0 -1
- package/dist/internal/funding/Transfer.js +0 -462
- package/dist/internal/funding/Transfer.js.map +0 -1
- package/dist/internal/funding/TransferReconciliation.d.ts.map +0 -1
- package/dist/internal/funding/TransferReconciliation.js +0 -192
- package/dist/internal/funding/TransferReconciliation.js.map +0 -1
- package/dist/internal/funding/TransferWebhook.d.ts.map +0 -1
- package/dist/internal/funding/TransferWebhook.js.map +0 -1
- package/dist/internal/funding/index.d.ts.map +0 -1
- package/dist/internal/funding/index.js.map +0 -1
- package/dist/internal/funding/providers/across.d.ts.map +0 -1
- package/dist/internal/funding/providers/across.js.map +0 -1
- package/dist/internal/funding/providers/relay.d.ts.map +0 -1
- package/dist/internal/funding/providers/relay.js.map +0 -1
- package/dist/internal/funding/providers/rhino.d.ts.map +0 -1
- package/dist/internal/funding/providers/rhino.js.map +0 -1
- package/dist/internal/funding/providers/squid.d.ts.map +0 -1
- package/dist/internal/funding/providers/squid.js.map +0 -1
- package/dist/internal/funding/providers/stargate.d.ts.map +0 -1
- package/dist/internal/funding/providers/stargate.js +0 -579
- package/dist/internal/funding/providers/stargate.js.map +0 -1
- package/dist/internal/funding/providers/symbiosis.d.ts.map +0 -1
- package/dist/internal/funding/providers/symbiosis.js.map +0 -1
- package/src/apps/funding/App.test.ts +0 -78
- package/src/apps/funding/App.ts +0 -88
- package/src/apps/funding/ProviderAttempts.ts +0 -26
- package/src/apps/funding/index.ts +0 -1
- package/src/apps/funding/routes/transfers.ts +0 -987
- package/src/db/tables/fundingCatalog.test.ts +0 -122
- package/src/db/tables/fundingCatalog.ts +0 -163
- package/src/db/tables/fundingDepositAddresses.test.ts +0 -608
- package/src/db/tables/fundingDepositAddresses.ts +0 -443
- package/src/db/tables/fundingDeposits.ts +0 -572
- package/src/db/tables/fundingIdempotency.test.ts +0 -182
- package/src/db/tables/fundingIdempotency.ts +0 -180
- package/src/db/tables/fundingTransferTransactions.test.ts +0 -112
- package/src/db/tables/fundingTransfers.test.ts +0 -115
- package/src/db/tables/fundingTransfers.ts +0 -189
- package/src/handlers/internal/multisig.test.ts +0 -818
- package/src/internal/funding/Subsidy.test.ts +0 -75
- package/src/internal/funding/Transfer.test.ts +0 -524
- package/src/internal/funding/Transfer.ts +0 -762
- package/src/internal/funding/TransferReconciliation.test.ts +0 -147
- package/src/internal/funding/TransferReconciliation.ts +0 -264
- package/src/internal/funding/providers/stargate.test.ts +0 -328
- package/src/internal/funding/providers/stargate.ts +0 -856
- /package/dist/apps/{funding → routes}/Inventory.d.ts +0 -0
- /package/src/internal/{funding → routes}/Route.test.ts +0 -0
|
@@ -1,31 +1,37 @@
|
|
|
1
1
|
import { Hex } from 'ox';
|
|
2
|
+
import * as z from 'zod/mini';
|
|
2
3
|
import * as Db from '../../db/Db.js';
|
|
3
|
-
import * as
|
|
4
|
-
import * as
|
|
5
|
-
import * as
|
|
4
|
+
import * as RoutesDepositAddresses from '../../db/tables/routesDepositAddresses.js';
|
|
5
|
+
import * as RoutesDepositRequestObservations from '../../db/tables/routesDepositRequestObservations.js';
|
|
6
|
+
import * as RoutesDeposits from '../../db/tables/routesDeposits.js';
|
|
7
|
+
import * as MetricSink from '../MetricSink.js';
|
|
6
8
|
import * as Value from '../Value.js';
|
|
7
9
|
import * as Deposit from './Deposit.js';
|
|
8
10
|
import * as DepositWebhook from './DepositWebhook.js';
|
|
11
|
+
import * as Observability from './Observability.js';
|
|
9
12
|
import * as Provider from './Provider.js';
|
|
10
13
|
import * as Subsidy from './Subsidy.js';
|
|
11
14
|
const defaultBatchSize = 25;
|
|
12
15
|
const defaultLeaseMs = 2 * 60_000;
|
|
13
16
|
const defaultPollIntervalMs = 60_000;
|
|
14
|
-
const
|
|
15
|
-
const
|
|
17
|
+
const chainCatchUpFollowUpDelaySeconds = 1;
|
|
18
|
+
const chainCatchUpMaximumFollowUpAttempts = 30;
|
|
16
19
|
const followUpDelaySeconds = { delivery: 1, provider: 5, settlement: 2 };
|
|
17
20
|
const maximumPages = 100;
|
|
18
21
|
const maximumFollowUpAttempts = 6;
|
|
22
|
+
const providerMaximumFollowUpAttempts = 24;
|
|
19
23
|
const providerFailureStatuses = ['failure'];
|
|
20
24
|
const providerRefundStatuses = ['refund', 'refunded'];
|
|
25
|
+
const unattributedBatchSize = 25;
|
|
21
26
|
/** Creates a reusable-address reconciliation tracker. */
|
|
22
27
|
export function createTracker(options) {
|
|
23
28
|
const now = options.now ?? (() => new Date());
|
|
24
29
|
const batchSize = options.batchSize ?? defaultBatchSize;
|
|
25
30
|
const leaseMs = options.leaseMs ?? defaultLeaseMs;
|
|
26
31
|
const pollIntervalMs = options.pollIntervalMs ?? defaultPollIntervalMs;
|
|
32
|
+
const recordProviderOperation = MetricSink.routesProviderOperations(options.metrics);
|
|
27
33
|
const record = (outcome, providerId, trigger) => {
|
|
28
|
-
options.metrics?.count('
|
|
34
|
+
options.metrics?.count('routes_deposit_reconciliation_count', 1, {
|
|
29
35
|
outcome,
|
|
30
36
|
provider: providerId,
|
|
31
37
|
trigger,
|
|
@@ -60,11 +66,22 @@ export function createTracker(options) {
|
|
|
60
66
|
await heartbeat.ready();
|
|
61
67
|
const requests = await listRequests(provider, {
|
|
62
68
|
address: claimed,
|
|
69
|
+
onAttempt: recordProviderOperation,
|
|
63
70
|
requestId: message.requestId,
|
|
64
71
|
signal: options.signal,
|
|
72
|
+
}).catch(async () => {
|
|
73
|
+
// The durable poll owns provider retries; queue redelivery must not advance its backoff again.
|
|
74
|
+
const leaseFailure = await heartbeat.stop();
|
|
75
|
+
if (leaseFailure !== undefined)
|
|
76
|
+
throw leaseFailure;
|
|
77
|
+
await fail(database, claimed, now(), pollIntervalMs);
|
|
78
|
+
record('provider_unavailable', claimed.providerId, trigger);
|
|
79
|
+
return undefined;
|
|
65
80
|
});
|
|
81
|
+
if (!requests)
|
|
82
|
+
return { type: 'provider_unavailable' };
|
|
66
83
|
if (trigger === 'poll')
|
|
67
|
-
await
|
|
84
|
+
await RoutesDepositRequestObservations.observePoll(database, {
|
|
68
85
|
depositAddressId: claimed.id,
|
|
69
86
|
observedAt: now().toISOString(),
|
|
70
87
|
providerRequestIds: requests.requests.map((request) => request.id),
|
|
@@ -90,6 +107,7 @@ export function createTracker(options) {
|
|
|
90
107
|
...requests.pendingRequestIds,
|
|
91
108
|
...(message.requestId ? [message.requestId] : []),
|
|
92
109
|
]);
|
|
110
|
+
const sourceRoutesIntervals = [];
|
|
93
111
|
let followUpKind;
|
|
94
112
|
for (const request of requests.requests) {
|
|
95
113
|
const result = await reconcileRequest(database, {
|
|
@@ -97,6 +115,13 @@ export function createTracker(options) {
|
|
|
97
115
|
metrics: options.metrics,
|
|
98
116
|
onDeposit,
|
|
99
117
|
provider,
|
|
118
|
+
...(options.recordLifecycleInterval
|
|
119
|
+
? {
|
|
120
|
+
recordLifecycleInterval: async (interval) => {
|
|
121
|
+
sourceRoutesIntervals.push(interval);
|
|
122
|
+
},
|
|
123
|
+
}
|
|
124
|
+
: {}),
|
|
100
125
|
request,
|
|
101
126
|
signal: options.signal,
|
|
102
127
|
subsidies: options.subsidies,
|
|
@@ -113,8 +138,14 @@ export function createTracker(options) {
|
|
|
113
138
|
followUpKind = result.followUp ?? followUpKind ?? 'provider';
|
|
114
139
|
}
|
|
115
140
|
}
|
|
141
|
+
const sourceRoutes = sourceRoutesIntervals.toSorted((left, right) => left.endedAt.localeCompare(right.endedAt))[0];
|
|
142
|
+
if (sourceRoutes)
|
|
143
|
+
await options.recordLifecycleInterval?.(sourceRoutes);
|
|
144
|
+
const page = await checkpointUnattributed(database, { address: claimed, now: startedAt });
|
|
145
|
+
heartbeat.assert();
|
|
116
146
|
const unattributed = await reconcileUnattributed(database, {
|
|
117
147
|
address: claimed,
|
|
148
|
+
deposits: page.deposits,
|
|
118
149
|
metrics: options.metrics,
|
|
119
150
|
onDeposit,
|
|
120
151
|
provider,
|
|
@@ -126,38 +157,40 @@ export function createTracker(options) {
|
|
|
126
157
|
updated += unattributed.updatedIds.size;
|
|
127
158
|
if (!unattributed.terminal)
|
|
128
159
|
followUpKind = unattributed.followUp ?? followUpKind ?? 'provider';
|
|
129
|
-
const awaitsProvider = await
|
|
160
|
+
const awaitsProvider = await RoutesDeposits.hasUnattributed(database, claimed.id);
|
|
130
161
|
if (message.requestId && message.webhookTiming && !webhookUpdateObserved)
|
|
131
162
|
pendingRequestIds.add(message.requestId);
|
|
132
163
|
if (created > 0)
|
|
133
|
-
options.metrics?.count('
|
|
164
|
+
options.metrics?.count('routes_deposit_detection_count', created, {
|
|
134
165
|
provider: claimed.providerId,
|
|
135
166
|
trigger,
|
|
136
167
|
});
|
|
137
168
|
if (options.dispatchDepositUpdates && depositWebhookReferences.size > 0) {
|
|
138
169
|
const references = [...depositWebhookReferences.values()];
|
|
139
|
-
await options.dispatchDepositUpdates(references).then((count) => options.metrics?.count('
|
|
170
|
+
await options.dispatchDepositUpdates(references).then((count) => options.metrics?.count('routes_deposit_webhook_enqueue_count', count, {
|
|
140
171
|
outcome: 'succeeded',
|
|
141
172
|
provider: claimed.providerId,
|
|
142
173
|
}), (cause) => {
|
|
143
|
-
options.metrics?.count('
|
|
174
|
+
options.metrics?.count('routes_deposit_webhook_enqueue_count', references.length, {
|
|
144
175
|
outcome: 'failed',
|
|
145
176
|
provider: claimed.providerId,
|
|
146
177
|
});
|
|
147
178
|
throw cause;
|
|
148
179
|
});
|
|
149
180
|
}
|
|
181
|
+
if (unattributed.errors.length > 0)
|
|
182
|
+
throw new AggregateError(unattributed.errors, 'Unattributed deposit reconciliation failed.');
|
|
150
183
|
const leaseFailure = await heartbeat.stop();
|
|
151
184
|
if (leaseFailure !== undefined)
|
|
152
185
|
throw leaseFailure;
|
|
153
186
|
const completedAt = now();
|
|
154
|
-
const stored = await
|
|
187
|
+
const stored = await RoutesDepositAddresses.completePoll(database, {
|
|
155
188
|
id: claimed.id,
|
|
156
189
|
lastPolledAt: completedAt.toISOString(),
|
|
157
190
|
nextPollAt: new Date(completedAt.getTime() + pollIntervalMs).toISOString(),
|
|
158
191
|
pollLeaseVersion: claimed.pollLeaseVersion,
|
|
159
192
|
providerRequestIds: claimed.providerRequestIds,
|
|
160
|
-
providerState: reconciliationState(
|
|
193
|
+
providerState: reconciliationState(page.address.providerState, {
|
|
161
194
|
pendingRequestIds: [...pendingRequestIds],
|
|
162
195
|
requests,
|
|
163
196
|
...(message.webhookTiming && message.requestId && webhookUpdateObserved
|
|
@@ -182,7 +215,7 @@ export function createTracker(options) {
|
|
|
182
215
|
followUp: followUp.state,
|
|
183
216
|
...(message.requestId ? { requestId: message.requestId } : {}),
|
|
184
217
|
trigger,
|
|
185
|
-
type: '
|
|
218
|
+
type: 'routes:deposit-address:reconcile',
|
|
186
219
|
...(message.webhookTiming && !webhookUpdateObserved
|
|
187
220
|
? { webhookTiming: message.webhookTiming }
|
|
188
221
|
: {}),
|
|
@@ -200,7 +233,7 @@ export function createTracker(options) {
|
|
|
200
233
|
timing: message.webhookTiming,
|
|
201
234
|
});
|
|
202
235
|
record('completed', claimed.providerId, trigger);
|
|
203
|
-
options.metrics?.histogram('
|
|
236
|
+
options.metrics?.histogram('routes_deposit_reconciliation_duration_ms', completedAt.getTime() - startedAt.getTime(), { provider: claimed.providerId, trigger });
|
|
204
237
|
return { created, type: 'completed', updated };
|
|
205
238
|
}
|
|
206
239
|
catch (cause) {
|
|
@@ -222,7 +255,7 @@ export function createTracker(options) {
|
|
|
222
255
|
for (const provider of options.providers) {
|
|
223
256
|
if (!Provider.canListDepositAddressRequests(provider))
|
|
224
257
|
continue;
|
|
225
|
-
const records = await
|
|
258
|
+
const records = await RoutesDepositAddresses.claimDue(database, {
|
|
226
259
|
leaseUntil,
|
|
227
260
|
limit: Math.max(0, batchSize - claimed),
|
|
228
261
|
now: startedAt.toISOString(),
|
|
@@ -230,13 +263,13 @@ export function createTracker(options) {
|
|
|
230
263
|
});
|
|
231
264
|
for (const address of records) {
|
|
232
265
|
claimed += 1;
|
|
233
|
-
options.metrics?.histogram('
|
|
266
|
+
options.metrics?.histogram('routes_deposit_poll_lag_ms', Math.max(0, startedAt.getTime() - new Date(address.nextPollAt).getTime()), { provider: provider.id });
|
|
234
267
|
try {
|
|
235
268
|
await options.dispatch({
|
|
236
269
|
addressId: address.id,
|
|
237
270
|
pollLeaseVersion: address.pollLeaseVersion,
|
|
238
271
|
trigger: 'poll',
|
|
239
|
-
type: '
|
|
272
|
+
type: 'routes:deposit-address:reconcile',
|
|
240
273
|
});
|
|
241
274
|
record('enqueued', provider.id, 'poll');
|
|
242
275
|
}
|
|
@@ -256,12 +289,12 @@ export function createTracker(options) {
|
|
|
256
289
|
}
|
|
257
290
|
async function claim(db, message, options) {
|
|
258
291
|
if (message.pollLeaseVersion === undefined)
|
|
259
|
-
return
|
|
292
|
+
return RoutesDepositAddresses.claim(db, {
|
|
260
293
|
id: message.addressId,
|
|
261
294
|
leaseUntil: options.leaseUntil,
|
|
262
295
|
now: options.now,
|
|
263
296
|
});
|
|
264
|
-
const current = await
|
|
297
|
+
const current = await RoutesDepositAddresses.get(db, message.addressId);
|
|
265
298
|
if (!current?.pollLeaseUntil ||
|
|
266
299
|
current.pollLeaseUntil <= options.now ||
|
|
267
300
|
current.pollLeaseVersion !== message.pollLeaseVersion)
|
|
@@ -270,7 +303,7 @@ async function claim(db, message, options) {
|
|
|
270
303
|
}
|
|
271
304
|
async function fail(db, address, now, pollIntervalMs) {
|
|
272
305
|
const delay = Math.min(pollIntervalMs * 2 ** address.pollFailureCount, 15 * 60_000);
|
|
273
|
-
return
|
|
306
|
+
return RoutesDepositAddresses.failPoll(db, {
|
|
274
307
|
id: address.id,
|
|
275
308
|
nextPollAt: new Date(now.getTime() + delay).toISOString(),
|
|
276
309
|
pollLeaseVersion: address.pollLeaseVersion,
|
|
@@ -282,7 +315,7 @@ function maintainLease(db, address, options) {
|
|
|
282
315
|
const extend = async () => {
|
|
283
316
|
if (stopped || failure !== undefined)
|
|
284
317
|
return;
|
|
285
|
-
const renewed = await
|
|
318
|
+
const renewed = await RoutesDepositAddresses.renewPoll(db, {
|
|
286
319
|
id: address.id,
|
|
287
320
|
leaseUntil: new Date(options.now().getTime() + options.leaseMs).toISOString(),
|
|
288
321
|
pollLeaseVersion: address.pollLeaseVersion,
|
|
@@ -324,7 +357,12 @@ async function listRequests(provider, options) {
|
|
|
324
357
|
const requests = [];
|
|
325
358
|
let continuation;
|
|
326
359
|
for (let page = 0; page < maximumPages; page++) {
|
|
327
|
-
const result = await
|
|
360
|
+
const result = await Provider.observe(provider, () => provider.listDepositAddressRequests({
|
|
361
|
+
address: options.address.address,
|
|
362
|
+
...(continuation ? { continuation } : {}),
|
|
363
|
+
destinationToken: options.address.snapshot.destinationToken,
|
|
364
|
+
sourceToken: options.address.snapshot.sourceToken,
|
|
365
|
+
}, options.signal ?? new AbortController().signal), { onAttempt: options.onAttempt, operation: 'listDepositAddressRequests' });
|
|
328
366
|
requests.push(...result.requests.filter((request) => !highWater.updatedAt ||
|
|
329
367
|
request.updatedAt > highWater.updatedAt ||
|
|
330
368
|
(request.updatedAt === highWater.updatedAt &&
|
|
@@ -343,7 +381,12 @@ async function listRequests(provider, options) {
|
|
|
343
381
|
])) {
|
|
344
382
|
if (observed.has(requestId))
|
|
345
383
|
continue;
|
|
346
|
-
const result = await
|
|
384
|
+
const result = await Provider.observe(provider, () => provider.listDepositAddressRequests({
|
|
385
|
+
address: options.address.address,
|
|
386
|
+
destinationToken: options.address.snapshot.destinationToken,
|
|
387
|
+
requestId,
|
|
388
|
+
sourceToken: options.address.snapshot.sourceToken,
|
|
389
|
+
}, options.signal ?? new AbortController().signal), { onAttempt: options.onAttempt, operation: 'listDepositAddressRequests' });
|
|
347
390
|
requests.push(...result.requests);
|
|
348
391
|
}
|
|
349
392
|
const addressRequests = requests.filter((request) => !highWater.pendingRequestIds.includes(request.id));
|
|
@@ -416,8 +459,9 @@ async function observeProviderDelivery(options) {
|
|
|
416
459
|
!options.provider ||
|
|
417
460
|
!Provider.canObserveDepositAddressRequest(options.provider))
|
|
418
461
|
return undefined;
|
|
419
|
-
const
|
|
420
|
-
|
|
462
|
+
const provider = options.provider;
|
|
463
|
+
const recordProviderOperation = MetricSink.routesProviderOperations(options.metrics);
|
|
464
|
+
const result = await Provider.observe(provider, () => provider.observeDepositAddressRequest({
|
|
421
465
|
address: options.address.address,
|
|
422
466
|
destinationChain: options.address.snapshot.destinationChain,
|
|
423
467
|
destinationToken: options.address.providerOutputToken,
|
|
@@ -428,23 +472,52 @@ async function observeProviderDelivery(options) {
|
|
|
428
472
|
source: entry.source,
|
|
429
473
|
sourceChain: options.address.snapshot.sourceChain,
|
|
430
474
|
sourceToken: options.address.snapshot.sourceToken,
|
|
431
|
-
}, options.signal ?? new AbortController().signal)
|
|
432
|
-
.catch((cause) => {
|
|
475
|
+
}, options.signal ?? new AbortController().signal), { onAttempt: recordProviderOperation, operation: 'observeDepositAddressRequest' }).catch((cause) => {
|
|
433
476
|
if (options.signal?.aborted)
|
|
434
477
|
throw cause;
|
|
435
478
|
return undefined;
|
|
436
479
|
});
|
|
437
|
-
options.metrics?.count('
|
|
480
|
+
options.metrics?.count('routes_deposit_delivery_observation_count', 1, {
|
|
438
481
|
outcome: result?.type ?? 'failed',
|
|
439
482
|
provider: options.address.providerId,
|
|
440
483
|
});
|
|
441
484
|
return result;
|
|
442
485
|
}
|
|
486
|
+
async function checkpointUnattributed(db, options) {
|
|
487
|
+
const parsed = z.safeParse(z.object({
|
|
488
|
+
before: z.iso.datetime(),
|
|
489
|
+
cursor: z.object({ createdAt: z.iso.datetime(), id: z.string() }),
|
|
490
|
+
}), options.address.providerState?.['unattributed']);
|
|
491
|
+
const before = parsed.success ? parsed.data.before : options.now.toISOString();
|
|
492
|
+
const deposits = await RoutesDeposits.listUnattributed(db, {
|
|
493
|
+
before,
|
|
494
|
+
cursor: parsed.success ? parsed.data.cursor : undefined,
|
|
495
|
+
depositAddressId: options.address.id,
|
|
496
|
+
limit: unattributedBatchSize,
|
|
497
|
+
});
|
|
498
|
+
if (!parsed.success && deposits.length < unattributedBatchSize)
|
|
499
|
+
return { address: options.address, deposits };
|
|
500
|
+
const last = deposits.at(-1);
|
|
501
|
+
// Checkpoint attempts before RPC work so failures cannot pin a page. A fixed boundary lets old rows recur despite new arrivals.
|
|
502
|
+
const address = await RoutesDepositAddresses.checkpointPoll(db, {
|
|
503
|
+
id: options.address.id,
|
|
504
|
+
pollLeaseVersion: options.address.pollLeaseVersion,
|
|
505
|
+
providerState: {
|
|
506
|
+
...options.address.providerState,
|
|
507
|
+
unattributed: deposits.length === unattributedBatchSize && last
|
|
508
|
+
? { before, cursor: { createdAt: last.createdAt, id: last.id } }
|
|
509
|
+
: undefined,
|
|
510
|
+
},
|
|
511
|
+
});
|
|
512
|
+
if (!address)
|
|
513
|
+
throw new StaleLeaseError();
|
|
514
|
+
return { address, deposits };
|
|
515
|
+
}
|
|
443
516
|
async function reconcileUnattributed(db, options) {
|
|
444
|
-
const deposits =
|
|
517
|
+
const { deposits } = options;
|
|
445
518
|
if (deposits.length === 0)
|
|
446
|
-
return { terminal: true, updatedIds: new Set() };
|
|
447
|
-
const
|
|
519
|
+
return { errors: [], terminal: true, updatedIds: new Set() };
|
|
520
|
+
const sources = await Promise.allSettled(unique(deposits.map((deposit) => deposit.sourceTransactionHash)).map(async (transactionHash) => [
|
|
448
521
|
transactionHash,
|
|
449
522
|
await options.verifyTransfers({
|
|
450
523
|
chain: options.address.snapshot.sourceChain,
|
|
@@ -452,7 +525,14 @@ async function reconcileUnattributed(db, options) {
|
|
|
452
525
|
token: options.address.snapshot.sourceToken,
|
|
453
526
|
transactionHash,
|
|
454
527
|
}),
|
|
455
|
-
]))
|
|
528
|
+
]));
|
|
529
|
+
const errors = [];
|
|
530
|
+
const transfersByTransaction = new Map();
|
|
531
|
+
for (const result of sources)
|
|
532
|
+
if (result.status === 'fulfilled')
|
|
533
|
+
transfersByTransaction.set(...result.value);
|
|
534
|
+
else
|
|
535
|
+
errors.push(result.reason);
|
|
456
536
|
let followUp;
|
|
457
537
|
let terminal = true;
|
|
458
538
|
const updatedIds = new Set();
|
|
@@ -474,7 +554,14 @@ async function reconcileUnattributed(db, options) {
|
|
|
474
554
|
sourceAmount: BigInt(source.amount),
|
|
475
555
|
},
|
|
476
556
|
],
|
|
557
|
+
}).catch((cause) => {
|
|
558
|
+
errors.push(cause);
|
|
559
|
+
return undefined;
|
|
477
560
|
});
|
|
561
|
+
if (!delivery) {
|
|
562
|
+
terminal = false;
|
|
563
|
+
continue;
|
|
564
|
+
}
|
|
478
565
|
if (delivery.followUp === 'delivery' || !followUp)
|
|
479
566
|
followUp = delivery.followUp;
|
|
480
567
|
if (!delivery.terminal)
|
|
@@ -484,6 +571,7 @@ async function reconcileUnattributed(db, options) {
|
|
|
484
571
|
}
|
|
485
572
|
return {
|
|
486
573
|
...(followUp ? { followUp } : {}),
|
|
574
|
+
errors,
|
|
487
575
|
terminal,
|
|
488
576
|
updatedIds,
|
|
489
577
|
};
|
|
@@ -491,12 +579,12 @@ async function reconcileUnattributed(db, options) {
|
|
|
491
579
|
/** Reconciles one provider request against verified chain evidence. */
|
|
492
580
|
export async function reconcileRequest(db, options) {
|
|
493
581
|
const trigger = options.trigger ?? 'poll';
|
|
494
|
-
const observation = await
|
|
582
|
+
const observation = await RoutesDepositRequestObservations.get(db, {
|
|
495
583
|
depositAddressId: options.address.id,
|
|
496
584
|
providerRequestId: options.request.id,
|
|
497
585
|
});
|
|
498
586
|
if (observation)
|
|
499
|
-
await
|
|
587
|
+
await RoutesDeposits.recordRequestObservation(db, {
|
|
500
588
|
depositAddressId: observation.depositAddressId,
|
|
501
589
|
...(observation.pollObservedAt ? { pollObservedAt: observation.pollObservedAt } : {}),
|
|
502
590
|
providerRequestId: observation.providerRequestId,
|
|
@@ -508,16 +596,17 @@ export async function reconcileRequest(db, options) {
|
|
|
508
596
|
const observed = [];
|
|
509
597
|
// Persist provider observations first so transient chain failures do not hide acknowledged deposits.
|
|
510
598
|
for (const transactionHash of unique(options.request.sourceTransactionHashes)) {
|
|
511
|
-
const
|
|
599
|
+
const createdBefore = created;
|
|
600
|
+
const deposits = await RoutesDeposits.withSourceTransaction(db, {
|
|
512
601
|
depositAddressId: options.address.id,
|
|
513
602
|
fn: async (tx) => {
|
|
514
|
-
let records = await
|
|
603
|
+
let records = await RoutesDeposits.listByProviderObservation(tx, {
|
|
515
604
|
depositAddressId: options.address.id,
|
|
516
605
|
providerRequestId: options.request.id,
|
|
517
606
|
sourceTransactionHash: transactionHash,
|
|
518
607
|
});
|
|
519
608
|
if (records.length === 0)
|
|
520
|
-
records = await
|
|
609
|
+
records = await RoutesDeposits.listBySourceTransaction(tx, {
|
|
521
610
|
depositAddressId: options.address.id,
|
|
522
611
|
sourceTransactionHash: transactionHash,
|
|
523
612
|
});
|
|
@@ -550,6 +639,8 @@ export async function reconcileRequest(db, options) {
|
|
|
550
639
|
},
|
|
551
640
|
sourceTransactionHash: transactionHash,
|
|
552
641
|
});
|
|
642
|
+
if (created > createdBefore)
|
|
643
|
+
Observability.recordDeposit(options.metrics, { record: deposits[0] });
|
|
553
644
|
observed.push({ deposits, transactionHash, transfers: [] });
|
|
554
645
|
}
|
|
555
646
|
const sources = await Promise.all(observed.map(async (source) => ({
|
|
@@ -609,6 +700,7 @@ export async function reconcileRequest(db, options) {
|
|
|
609
700
|
? { webhookReceivedAt: observation.webhookReceivedAt }
|
|
610
701
|
: {}),
|
|
611
702
|
});
|
|
703
|
+
Observability.recordDeposit(options.metrics, { record: deposit });
|
|
612
704
|
source.deposits.push(deposit);
|
|
613
705
|
created += 1;
|
|
614
706
|
}
|
|
@@ -616,20 +708,25 @@ export async function reconcileRequest(db, options) {
|
|
|
616
708
|
deposit.providerRequestId === null ||
|
|
617
709
|
!deposit.providerRequestIds.includes(options.request.id)) {
|
|
618
710
|
const result = await transitionDeposit(db, {
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
...
|
|
627
|
-
|
|
628
|
-
|
|
711
|
+
current: deposit,
|
|
712
|
+
metrics: options.metrics,
|
|
713
|
+
onDeposit: options.onDeposit,
|
|
714
|
+
transition: {
|
|
715
|
+
expectedVersion: deposit.version,
|
|
716
|
+
id: deposit.id,
|
|
717
|
+
providerRequestId: options.request.id,
|
|
718
|
+
providerRequestIds: unique([...deposit.providerRequestIds, options.request.id]),
|
|
719
|
+
providerTransferIndex,
|
|
720
|
+
snapshot: {
|
|
721
|
+
...deposit.snapshot,
|
|
722
|
+
...(options.address.snapshot.subsidize ? { destinationAmountRequired } : {}),
|
|
723
|
+
...(transfer.sender ? { sender: transfer.sender } : {}),
|
|
724
|
+
sourceAmount,
|
|
725
|
+
},
|
|
726
|
+
sourceTransferIndex: transfer.transferIndex,
|
|
727
|
+
status: deposit.status === 'detected' ? 'bridging' : deposit.status,
|
|
629
728
|
},
|
|
630
|
-
|
|
631
|
-
status: deposit.status === 'detected' ? 'bridging' : deposit.status,
|
|
632
|
-
}, options.onDeposit);
|
|
729
|
+
});
|
|
633
730
|
if (result.type === 'applied') {
|
|
634
731
|
deposit = result.record;
|
|
635
732
|
updatedIds.add(deposit.id);
|
|
@@ -643,6 +740,14 @@ export async function reconcileRequest(db, options) {
|
|
|
643
740
|
if (!sourceEvidenceComplete) {
|
|
644
741
|
return { created, terminal: false, updated: updatedIds.size };
|
|
645
742
|
}
|
|
743
|
+
if (options.recordLifecycleInterval) {
|
|
744
|
+
const first = await RoutesDeposits.getFirstByAddress(db, options.address.id);
|
|
745
|
+
if (first &&
|
|
746
|
+
first.providerRequestId === options.request.id &&
|
|
747
|
+
updatedIds.has(first.id) &&
|
|
748
|
+
verified.some(({ deposit }) => deposit.id === first.id))
|
|
749
|
+
await options.recordLifecycleInterval(Observability.depositAddressSourceRoutesInterval(options));
|
|
750
|
+
}
|
|
646
751
|
const recovery = await reconcileProviderRecovery(db, { ...options, verified });
|
|
647
752
|
if (recovery) {
|
|
648
753
|
for (const id of recovery.updatedIds)
|
|
@@ -664,10 +769,19 @@ export async function reconcileRequest(db, options) {
|
|
|
664
769
|
updated: updatedIds.size,
|
|
665
770
|
};
|
|
666
771
|
}
|
|
667
|
-
async function transitionDeposit(db, options
|
|
668
|
-
const committed = await DepositWebhook.transition(db,
|
|
669
|
-
|
|
670
|
-
|
|
772
|
+
async function transitionDeposit(db, options) {
|
|
773
|
+
const committed = await DepositWebhook.transition(db, {
|
|
774
|
+
...options.transition,
|
|
775
|
+
...(options.providerEvidenceComplete ? { providerDeliveredAt: new Date().toISOString() } : {}),
|
|
776
|
+
});
|
|
777
|
+
if (committed.result.type === 'applied') {
|
|
778
|
+
Observability.recordDeposit(options.metrics, {
|
|
779
|
+
previous: options.current,
|
|
780
|
+
...(options.providerEvidenceComplete ? { providerEvidenceComplete: true } : {}),
|
|
781
|
+
record: committed.result.record,
|
|
782
|
+
});
|
|
783
|
+
options.onDeposit?.(committed.result.record, committed.references);
|
|
784
|
+
}
|
|
671
785
|
return committed.result;
|
|
672
786
|
}
|
|
673
787
|
async function reconcileProviderRecovery(db, options) {
|
|
@@ -725,14 +839,19 @@ async function reconcileProviderRecovery(db, options) {
|
|
|
725
839
|
let deposit = entry.deposit;
|
|
726
840
|
if (deposit.status !== 'refunding') {
|
|
727
841
|
const result = await transitionDeposit(db, {
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
842
|
+
current: deposit,
|
|
843
|
+
metrics: options.metrics,
|
|
844
|
+
onDeposit: options.onDeposit,
|
|
845
|
+
transition: {
|
|
846
|
+
expectedVersion: deposit.version,
|
|
847
|
+
id: deposit.id,
|
|
848
|
+
providerTransactionHashes: unique([
|
|
849
|
+
...deposit.providerTransactionHashes,
|
|
850
|
+
...providerRefundTransactionHashes,
|
|
851
|
+
]),
|
|
852
|
+
status: 'refunding',
|
|
853
|
+
},
|
|
854
|
+
});
|
|
736
855
|
if (result.type === 'applied') {
|
|
737
856
|
deposit = result.record;
|
|
738
857
|
updatedIds.add(deposit.id);
|
|
@@ -749,19 +868,24 @@ async function reconcileProviderRecovery(db, options) {
|
|
|
749
868
|
continue;
|
|
750
869
|
}
|
|
751
870
|
const result = await transitionDeposit(db, {
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
871
|
+
current: deposit,
|
|
872
|
+
metrics: options.metrics,
|
|
873
|
+
onDeposit: options.onDeposit,
|
|
874
|
+
transition: {
|
|
875
|
+
expectedVersion: deposit.version,
|
|
876
|
+
id: deposit.id,
|
|
877
|
+
snapshot: {
|
|
878
|
+
...deposit.snapshot,
|
|
879
|
+
refundAmount: Value.tokenAmount({
|
|
880
|
+
baseUnits: amount,
|
|
881
|
+
currency: options.address.snapshot.sourceToken.currency,
|
|
882
|
+
decimals: options.address.snapshot.sourceToken.decimals,
|
|
883
|
+
}),
|
|
884
|
+
refundTransactionHashes,
|
|
885
|
+
},
|
|
886
|
+
status: 'refunded',
|
|
762
887
|
},
|
|
763
|
-
|
|
764
|
-
}, options.onDeposit);
|
|
888
|
+
});
|
|
765
889
|
if (result.type === 'applied')
|
|
766
890
|
updatedIds.add(deposit.id);
|
|
767
891
|
else if (result.type !== 'stale' || !Deposit.isTerminal(result.current.status))
|
|
@@ -775,7 +899,7 @@ async function reconcileProviderRecovery(db, options) {
|
|
|
775
899
|
return 'provider_failed';
|
|
776
900
|
return 'pending';
|
|
777
901
|
})();
|
|
778
|
-
options.metrics?.count('
|
|
902
|
+
options.metrics?.count('routes_deposit_refund_count', 1, {
|
|
779
903
|
outcome,
|
|
780
904
|
provider: options.address.providerId,
|
|
781
905
|
});
|
|
@@ -789,7 +913,12 @@ async function reconcileDelivery(db, options) {
|
|
|
789
913
|
let followUp;
|
|
790
914
|
let terminal = true;
|
|
791
915
|
const updatedIds = new Set();
|
|
792
|
-
|
|
916
|
+
const allTerminal = options.verified.every((entry) => Deposit.isTerminal(entry.deposit.status));
|
|
917
|
+
// Providers can publish sponsorship after destination finality, so terminal rows
|
|
918
|
+
// remain eligible for a bounded metadata follow-up.
|
|
919
|
+
if (allTerminal &&
|
|
920
|
+
(!options.address.snapshot.subsidize ||
|
|
921
|
+
options.verified.some((entry) => entry.deposit.providerSubsidy)))
|
|
793
922
|
return { terminal, updatedIds };
|
|
794
923
|
const deliveryObservation = await observeProviderDelivery(options);
|
|
795
924
|
if (deliveryObservation?.type === 'pending')
|
|
@@ -813,6 +942,35 @@ async function reconcileDelivery(db, options) {
|
|
|
813
942
|
destinationEvidence.every((transfers) => transfers.length > 0);
|
|
814
943
|
const providerOutput = destinationTransfers.reduce((total, transfer) => total + BigInt(transfer.amount), 0n);
|
|
815
944
|
const totalRequired = options.verified.reduce((total, entry) => total + entry.required, 0n);
|
|
945
|
+
const providerSubsidy = options.request?.subsidy ??
|
|
946
|
+
(providerEvidenceComplete && deliveryObservation?.type === 'verified'
|
|
947
|
+
? deliveryObservation.subsidy
|
|
948
|
+
: undefined);
|
|
949
|
+
// Providers report one subsidy per request, so attribute it to the first verified transfer.
|
|
950
|
+
const providerSubsidyDepositId = providerSubsidy ? options.verified[0]?.deposit.id : undefined;
|
|
951
|
+
if (allTerminal) {
|
|
952
|
+
if (!providerEvidenceComplete || !providerSubsidy)
|
|
953
|
+
return { ...(followUp ? { followUp } : {}), terminal: false, updatedIds };
|
|
954
|
+
const deposit = options.verified.find((entry) => entry.deposit.id === providerSubsidyDepositId)?.deposit;
|
|
955
|
+
if (!deposit || deposit.providerSubsidy)
|
|
956
|
+
return { terminal, updatedIds };
|
|
957
|
+
const result = await transitionDeposit(db, {
|
|
958
|
+
current: deposit,
|
|
959
|
+
metrics: options.metrics,
|
|
960
|
+
onDeposit: options.onDeposit,
|
|
961
|
+
transition: {
|
|
962
|
+
expectedVersion: deposit.version,
|
|
963
|
+
id: deposit.id,
|
|
964
|
+
providerSubsidy,
|
|
965
|
+
},
|
|
966
|
+
});
|
|
967
|
+
if (result.type === 'applied')
|
|
968
|
+
updatedIds.add(deposit.id);
|
|
969
|
+
return {
|
|
970
|
+
terminal: result.type !== 'stale' || Boolean(result.current.providerSubsidy),
|
|
971
|
+
updatedIds,
|
|
972
|
+
};
|
|
973
|
+
}
|
|
816
974
|
let allocated = 0n;
|
|
817
975
|
let cumulativeRequired = 0n;
|
|
818
976
|
for (const entry of options.verified) {
|
|
@@ -824,92 +982,144 @@ async function reconcileDelivery(db, options) {
|
|
|
824
982
|
const { deposit } = entry;
|
|
825
983
|
if (Deposit.isTerminal(deposit.status))
|
|
826
984
|
continue;
|
|
827
|
-
const
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
985
|
+
const prepare = async (database) => {
|
|
986
|
+
const settlement = await reconcileSubsidy(database, {
|
|
987
|
+
address: options.address,
|
|
988
|
+
delivered,
|
|
989
|
+
deposit,
|
|
990
|
+
providerEvidenceComplete,
|
|
991
|
+
required,
|
|
992
|
+
sourceAmount,
|
|
993
|
+
subsidies: options.subsidies,
|
|
994
|
+
verifyTransfers: options.verifyTransfers,
|
|
995
|
+
});
|
|
996
|
+
const destinationAmount = Value.tokenAmount({
|
|
997
|
+
baseUnits: delivered + settlement.delivered,
|
|
998
|
+
currency: options.address.snapshot.destinationToken.currency,
|
|
999
|
+
decimals: options.address.snapshot.destinationToken.decimals,
|
|
1000
|
+
});
|
|
1001
|
+
const destinationAmountRequired = (() => {
|
|
1002
|
+
if (options.address.snapshot.subsidize)
|
|
1003
|
+
return Value.tokenAmount({
|
|
1004
|
+
baseUnits: required,
|
|
1005
|
+
currency: options.address.snapshot.destinationToken.currency,
|
|
1006
|
+
decimals: options.address.snapshot.destinationToken.decimals,
|
|
1007
|
+
});
|
|
1008
|
+
if (settlement.status === 'completed')
|
|
1009
|
+
return destinationAmount;
|
|
1010
|
+
return undefined;
|
|
1011
|
+
})();
|
|
1012
|
+
return {
|
|
1013
|
+
settlement,
|
|
1014
|
+
transition: {
|
|
1015
|
+
expectedVersion: deposit.version,
|
|
1016
|
+
id: deposit.id,
|
|
1017
|
+
...(delivered > 0n
|
|
1018
|
+
? {
|
|
1019
|
+
providerOutputAmount: Value.tokenAmount({
|
|
1020
|
+
baseUnits: delivered,
|
|
1021
|
+
currency: options.address.providerOutputToken.currency,
|
|
1022
|
+
decimals: options.address.providerOutputToken.decimals,
|
|
1023
|
+
}),
|
|
1024
|
+
}
|
|
1025
|
+
: {}),
|
|
1026
|
+
...(providerEvidenceComplete ? { providerDeliveredAt: new Date().toISOString() } : {}),
|
|
1027
|
+
...(providerSubsidy && deposit.id === providerSubsidyDepositId
|
|
1028
|
+
? { providerSubsidy }
|
|
1029
|
+
: {}),
|
|
1030
|
+
providerRequestIds: options.request
|
|
1031
|
+
? unique([...deposit.providerRequestIds, options.request.id])
|
|
1032
|
+
: deposit.providerRequestIds,
|
|
1033
|
+
...(deliveryObservation?.providerState
|
|
1034
|
+
? {
|
|
1035
|
+
providerState: {
|
|
1036
|
+
...deposit.providerState,
|
|
1037
|
+
...deliveryObservation.providerState,
|
|
1038
|
+
},
|
|
1039
|
+
}
|
|
1040
|
+
: {}),
|
|
1041
|
+
providerTransactionHashes: unique([
|
|
1042
|
+
...deposit.providerTransactionHashes,
|
|
1043
|
+
...providerTransactionHashes,
|
|
1044
|
+
...(deliveryObservation?.providerTransactionHashes ?? []),
|
|
1045
|
+
]),
|
|
1046
|
+
...(settlement.settlementTransaction
|
|
1047
|
+
? { settlementTransaction: settlement.settlementTransaction }
|
|
1048
|
+
: {}),
|
|
1049
|
+
...(settlement.settlementTransactionHash
|
|
1050
|
+
? { settlementTransactionHash: settlement.settlementTransactionHash }
|
|
1051
|
+
: {}),
|
|
1052
|
+
snapshot: {
|
|
1053
|
+
...deposit.snapshot,
|
|
1054
|
+
...(delivered + settlement.delivered > 0n ? { destinationAmount } : {}),
|
|
1055
|
+
...(destinationAmountRequired ? { destinationAmountRequired } : {}),
|
|
1056
|
+
destinationTransactionHashes: unique([
|
|
1057
|
+
...(deposit.snapshot.destinationTransactionHashes ?? []),
|
|
1058
|
+
...destinationTransfers.map((evidence) => evidence.transactionHash),
|
|
1059
|
+
...settlement.destinationTransactionHashes,
|
|
1060
|
+
]),
|
|
1061
|
+
},
|
|
1062
|
+
status: settlement.status,
|
|
1063
|
+
...(settlement.statusReason ? { statusReason: settlement.statusReason } : {}),
|
|
1064
|
+
...(settlement.subsidyAmount ? { subsidyAmount: settlement.subsidyAmount } : {}),
|
|
1065
|
+
...(settlement.tempoGasPaid ? { tempoGasPaid: settlement.tempoGasPaid } : {}),
|
|
1066
|
+
},
|
|
1067
|
+
};
|
|
1068
|
+
};
|
|
1069
|
+
const { committed, settlement } = await (async () => {
|
|
1070
|
+
if (!options.address.snapshot.subsidize) {
|
|
1071
|
+
const prepared = await prepare(db);
|
|
1072
|
+
return {
|
|
1073
|
+
committed: await DepositWebhook.transition(db, prepared.transition),
|
|
1074
|
+
settlement: prepared.settlement,
|
|
1075
|
+
};
|
|
1076
|
+
}
|
|
1077
|
+
return RoutesDeposits.withSubsidySettlement(db, {
|
|
1078
|
+
fn: async (tx) => {
|
|
1079
|
+
const prepared = await prepare(tx);
|
|
1080
|
+
const result = await Deposit.transition(tx, prepared.transition);
|
|
1081
|
+
const staged = result.type === 'applied'
|
|
1082
|
+
? await DepositWebhook.stage(tx, { records: [result.record] })
|
|
1083
|
+
: undefined;
|
|
1084
|
+
return {
|
|
1085
|
+
committed: { references: staged?.references ?? [], result },
|
|
1086
|
+
settlement: prepared.settlement,
|
|
1087
|
+
};
|
|
1088
|
+
},
|
|
1089
|
+
orgId: options.address.orgId,
|
|
1090
|
+
});
|
|
1091
|
+
})();
|
|
837
1092
|
if (settlement.outcome)
|
|
838
|
-
options.metrics?.count('
|
|
1093
|
+
options.metrics?.count('routes_deposit_subsidy_count', 1, {
|
|
839
1094
|
outcome: settlement.outcome,
|
|
840
1095
|
provider: options.address.providerId,
|
|
841
1096
|
});
|
|
842
|
-
|
|
1097
|
+
const policyPending = settlement.outcome === 'routes_subsidy_limit_exceeded' ||
|
|
1098
|
+
(settlement.outcome !== undefined && settlement.outcome in Subsidy.denialMessages);
|
|
1099
|
+
if (settlement.status === 'bridging' || settlement.status === 'settling' || policyPending)
|
|
843
1100
|
terminal = false;
|
|
844
1101
|
if (settlement.status === 'settling')
|
|
845
1102
|
followUp = 'settlement';
|
|
846
|
-
const
|
|
847
|
-
baseUnits: delivered + settlement.delivered,
|
|
848
|
-
currency: options.address.snapshot.destinationToken.currency,
|
|
849
|
-
decimals: options.address.snapshot.destinationToken.decimals,
|
|
850
|
-
});
|
|
851
|
-
const result = await transitionDeposit(db, {
|
|
852
|
-
expectedVersion: deposit.version,
|
|
853
|
-
id: deposit.id,
|
|
854
|
-
...(delivered > 0n
|
|
855
|
-
? {
|
|
856
|
-
providerOutputAmount: Value.tokenAmount({
|
|
857
|
-
baseUnits: delivered,
|
|
858
|
-
currency: options.address.providerOutputToken.currency,
|
|
859
|
-
decimals: options.address.providerOutputToken.decimals,
|
|
860
|
-
}),
|
|
861
|
-
}
|
|
862
|
-
: {}),
|
|
863
|
-
providerRequestIds: options.request
|
|
864
|
-
? unique([...deposit.providerRequestIds, options.request.id])
|
|
865
|
-
: deposit.providerRequestIds,
|
|
866
|
-
...(deliveryObservation?.providerState
|
|
867
|
-
? {
|
|
868
|
-
providerState: {
|
|
869
|
-
...deposit.providerState,
|
|
870
|
-
...deliveryObservation.providerState,
|
|
871
|
-
},
|
|
872
|
-
}
|
|
873
|
-
: {}),
|
|
874
|
-
providerTransactionHashes: unique([
|
|
875
|
-
...deposit.providerTransactionHashes,
|
|
876
|
-
...providerTransactionHashes,
|
|
877
|
-
...(deliveryObservation?.providerTransactionHashes ?? []),
|
|
878
|
-
]),
|
|
879
|
-
...(settlement.settlementTransaction
|
|
880
|
-
? { settlementTransaction: settlement.settlementTransaction }
|
|
881
|
-
: {}),
|
|
882
|
-
...(settlement.settlementTransactionHash
|
|
883
|
-
? { settlementTransactionHash: settlement.settlementTransactionHash }
|
|
884
|
-
: {}),
|
|
885
|
-
snapshot: {
|
|
886
|
-
...deposit.snapshot,
|
|
887
|
-
...(delivered + settlement.delivered > 0n ? { destinationAmount } : {}),
|
|
888
|
-
...(settlement.status === 'completed' && !options.address.snapshot.subsidize
|
|
889
|
-
? { destinationAmountRequired: destinationAmount }
|
|
890
|
-
: {}),
|
|
891
|
-
destinationTransactionHashes: unique([
|
|
892
|
-
...(deposit.snapshot.destinationTransactionHashes ?? []),
|
|
893
|
-
...destinationTransfers.map((evidence) => evidence.transactionHash),
|
|
894
|
-
...settlement.destinationTransactionHashes,
|
|
895
|
-
]),
|
|
896
|
-
},
|
|
897
|
-
status: settlement.status,
|
|
898
|
-
...(settlement.statusReason ? { statusReason: settlement.statusReason } : {}),
|
|
899
|
-
...(settlement.subsidyAmount ? { subsidyAmount: settlement.subsidyAmount } : {}),
|
|
900
|
-
...(settlement.tempoGasPaid ? { tempoGasPaid: settlement.tempoGasPaid } : {}),
|
|
901
|
-
}, options.onDeposit);
|
|
1103
|
+
const { result } = committed;
|
|
902
1104
|
if (result.type === 'applied') {
|
|
1105
|
+
Observability.recordDeposit(options.metrics, {
|
|
1106
|
+
previous: deposit,
|
|
1107
|
+
...(providerEvidenceComplete ? { providerEvidenceComplete: true } : {}),
|
|
1108
|
+
record: result.record,
|
|
1109
|
+
});
|
|
1110
|
+
options.onDeposit?.(result.record, committed.references);
|
|
903
1111
|
updatedIds.add(deposit.id);
|
|
1112
|
+
}
|
|
1113
|
+
if (result.type === 'applied' || result.type === 'unchanged') {
|
|
904
1114
|
if (settlement.broadcast && options.subsidies) {
|
|
905
1115
|
await options.subsidies.broadcast(settlement.broadcast).catch((cause) => {
|
|
906
|
-
options.metrics?.count('
|
|
1116
|
+
options.metrics?.count('routes_deposit_subsidy_count', 1, {
|
|
907
1117
|
outcome: 'broadcast_failed',
|
|
908
1118
|
provider: options.address.providerId,
|
|
909
1119
|
});
|
|
910
1120
|
throw cause;
|
|
911
1121
|
});
|
|
912
|
-
options.metrics?.count('
|
|
1122
|
+
options.metrics?.count('routes_deposit_subsidy_count', 1, {
|
|
913
1123
|
outcome: 'broadcast',
|
|
914
1124
|
provider: options.address.providerId,
|
|
915
1125
|
});
|
|
@@ -918,7 +1128,7 @@ async function reconcileDelivery(db, options) {
|
|
|
918
1128
|
}
|
|
919
1129
|
return { ...(followUp ? { followUp } : {}), terminal, updatedIds };
|
|
920
1130
|
}
|
|
921
|
-
async function reconcileSubsidy(options) {
|
|
1131
|
+
async function reconcileSubsidy(db, options) {
|
|
922
1132
|
const empty = { delivered: 0n, destinationTransactionHashes: [] };
|
|
923
1133
|
if (options.required === 0n)
|
|
924
1134
|
return {
|
|
@@ -959,7 +1169,11 @@ async function reconcileSubsidy(options) {
|
|
|
959
1169
|
code: 'subsidy_failed',
|
|
960
1170
|
message: 'Tempo could not deliver the required subsidy.',
|
|
961
1171
|
},
|
|
962
|
-
subsidyAmount
|
|
1172
|
+
subsidyAmount: Value.tokenAmount({
|
|
1173
|
+
baseUnits: 0n,
|
|
1174
|
+
currency: options.address.snapshot.destinationToken.currency,
|
|
1175
|
+
decimals: options.address.snapshot.destinationToken.decimals,
|
|
1176
|
+
}),
|
|
963
1177
|
tempoGasPaid: status.tempoGasPaid,
|
|
964
1178
|
};
|
|
965
1179
|
if (status.type === 'pending')
|
|
@@ -985,7 +1199,11 @@ async function reconcileSubsidy(options) {
|
|
|
985
1199
|
destinationTransactionHashes: transfers.map((transfer) => transfer.transactionHash),
|
|
986
1200
|
outcome: options.delivered + delivered >= options.required ? 'completed' : 'underfilled',
|
|
987
1201
|
status: options.delivered + delivered >= options.required ? 'completed' : 'settling',
|
|
988
|
-
subsidyAmount
|
|
1202
|
+
subsidyAmount: Value.tokenAmount({
|
|
1203
|
+
baseUnits: delivered,
|
|
1204
|
+
currency: options.address.snapshot.destinationToken.currency,
|
|
1205
|
+
decimals: options.address.snapshot.destinationToken.decimals,
|
|
1206
|
+
}),
|
|
989
1207
|
tempoGasPaid: status.tempoGasPaid,
|
|
990
1208
|
};
|
|
991
1209
|
}
|
|
@@ -1007,6 +1225,33 @@ async function reconcileSubsidy(options) {
|
|
|
1007
1225
|
}
|
|
1008
1226
|
if (!options.providerEvidenceComplete)
|
|
1009
1227
|
return { ...empty, status: 'bridging' };
|
|
1228
|
+
const policy = await Subsidy.check(db, {
|
|
1229
|
+
environment: options.address.environment,
|
|
1230
|
+
orgId: options.address.orgId,
|
|
1231
|
+
});
|
|
1232
|
+
if (policy.type === 'denied')
|
|
1233
|
+
return {
|
|
1234
|
+
...empty,
|
|
1235
|
+
outcome: policy.reason,
|
|
1236
|
+
status: 'action-required',
|
|
1237
|
+
statusReason: {
|
|
1238
|
+
code: policy.reason,
|
|
1239
|
+
message: Subsidy.denialMessages[policy.reason],
|
|
1240
|
+
},
|
|
1241
|
+
};
|
|
1242
|
+
if (!Subsidy.supportsGap(policy, {
|
|
1243
|
+
amount: deficit,
|
|
1244
|
+
destinationToken: options.address.snapshot.destinationToken,
|
|
1245
|
+
}))
|
|
1246
|
+
return {
|
|
1247
|
+
...empty,
|
|
1248
|
+
outcome: 'routes_subsidy_limit_exceeded',
|
|
1249
|
+
status: 'action-required',
|
|
1250
|
+
statusReason: {
|
|
1251
|
+
code: 'routes_subsidy_limit_exceeded',
|
|
1252
|
+
message: 'The required subsidy exceeds the per-transaction limit.',
|
|
1253
|
+
},
|
|
1254
|
+
};
|
|
1010
1255
|
if (!options.subsidies)
|
|
1011
1256
|
return {
|
|
1012
1257
|
...empty,
|
|
@@ -1086,14 +1331,19 @@ function unique(values) {
|
|
|
1086
1331
|
}
|
|
1087
1332
|
function nextFollowUp(message, kind) {
|
|
1088
1333
|
const attempt = message.followUp?.kind === kind ? message.followUp.attempt + 1 : 0;
|
|
1089
|
-
|
|
1090
|
-
const
|
|
1091
|
-
|
|
1092
|
-
|
|
1334
|
+
// Provider fee metadata can arrive after delivery, so its slower retry window outlives chain catch-up.
|
|
1335
|
+
const chainCatchUp = kind === 'delivery' && message.trigger === 'chain';
|
|
1336
|
+
const maximumAttempts = (() => {
|
|
1337
|
+
if (chainCatchUp)
|
|
1338
|
+
return chainCatchUpMaximumFollowUpAttempts;
|
|
1339
|
+
if (kind === 'provider')
|
|
1340
|
+
return providerMaximumFollowUpAttempts;
|
|
1341
|
+
return maximumFollowUpAttempts;
|
|
1342
|
+
})();
|
|
1093
1343
|
if (attempt >= maximumAttempts)
|
|
1094
1344
|
return undefined;
|
|
1095
1345
|
return {
|
|
1096
|
-
delaySeconds:
|
|
1346
|
+
delaySeconds: chainCatchUp ? chainCatchUpFollowUpDelaySeconds : followUpDelaySeconds[kind],
|
|
1097
1347
|
state: { attempt, kind },
|
|
1098
1348
|
};
|
|
1099
1349
|
}
|
|
@@ -1113,7 +1363,7 @@ function recordWebhookLatency(metrics, options) {
|
|
|
1113
1363
|
{ from: providerUpdatedAt, segment: 'provider_to_reconciled', to: completedAt },
|
|
1114
1364
|
];
|
|
1115
1365
|
for (const segment of segments)
|
|
1116
|
-
metrics.histogram('
|
|
1366
|
+
metrics.histogram('routes_deposit_webhook_latency_ms', Math.max(0, segment.to - segment.from), {
|
|
1117
1367
|
provider: options.providerId,
|
|
1118
1368
|
segment: segment.segment,
|
|
1119
1369
|
status: options.timing.providerStatus,
|
|
@@ -1121,10 +1371,10 @@ function recordWebhookLatency(metrics, options) {
|
|
|
1121
1371
|
}
|
|
1122
1372
|
/** Provider pagination exceeded the bounded reconciliation limit. */
|
|
1123
1373
|
export class PaginationLimitError extends Error {
|
|
1124
|
-
name = '
|
|
1374
|
+
name = 'Routes.Reconciliation.PaginationLimitError';
|
|
1125
1375
|
}
|
|
1126
1376
|
/** The reconciliation lease was claimed by another worker. */
|
|
1127
1377
|
export class StaleLeaseError extends Error {
|
|
1128
|
-
name = '
|
|
1378
|
+
name = 'Routes.Reconciliation.StaleLeaseError';
|
|
1129
1379
|
}
|
|
1130
1380
|
//# sourceMappingURL=Reconciliation.js.map
|