tapimo 0.14.0 → 0.15.1
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 +12466 -10374
- 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 -546
- 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 +179 -27
- 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 +166 -160
- package/dist/admin/apps/verified-tokens.d.ts.map +1 -1
- package/dist/admin/apps/verified-tokens.js +27 -7
- 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 +201 -149
- 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 +629 -299
- 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 +116 -116
- 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 +113 -108
- package/dist/apps/data/routes/fee-amm.d.ts.map +1 -1
- package/dist/apps/data/routes/fee-amm.js +41 -21
- package/dist/apps/data/routes/fee-amm.js.map +1 -1
- package/dist/apps/data/routes/indexer.d.ts +142 -17
- 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/receipts.d.ts +235 -235
- 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 +309 -165
- 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 +93 -77
- 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 +32 -32
- package/dist/apps/data/routes/verified-tokens.d.ts +88 -88
- 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 +614 -177
- package/dist/apps/data/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/data/routes/webhooks.js +308 -205
- package/dist/apps/data/routes/webhooks.js.map +1 -1
- package/dist/apps/data/routes/zones.d.ts +31 -31
- 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 +3780 -3402
- 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 +317 -215
- 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 +213 -138
- 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 +166 -166
- 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 +103 -87
- 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 +125 -125
- 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 +95 -95
- package/dist/apps/management/routes/verified-token-requests.d.ts.map +1 -1
- package/dist/apps/management/routes/verified-token-requests.js +7 -9
- package/dist/apps/management/routes/verified-token-requests.js.map +1 -1
- package/dist/apps/management/routes/webhooks.d.ts +682 -616
- 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.d.ts.map +1 -1
- package/dist/apps/mcp.js +23 -10
- package/dist/apps/mcp.js.map +1 -1
- package/dist/apps/mpp/App.d.ts +44 -44
- 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 +32 -32
- 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 +106 -103
- 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 +733 -428
- 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 +1035 -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/verifiedTokenRequests.d.ts +21 -4
- package/dist/db/tables/verifiedTokenRequests.d.ts.map +1 -1
- package/dist/db/tables/verifiedTokenRequests.js +65 -44
- package/dist/db/tables/verifiedTokenRequests.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 +64 -12
- package/dist/internal/Auth.d.ts.map +1 -1
- package/dist/internal/Auth.js +631 -180
- 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 +40 -3
- package/src/admin/apps/verified-tokens.ts +33 -7
- 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/lib/verified-tokens.ts +24 -9
- package/src/admin/ui/src/routeTree.gen.ts +63 -0
- package/src/admin/ui/src/routes/__root.tsx +13 -2
- 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.tsx +34 -4
- 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/src/routes/verified-tokens.tsx +64 -20
- package/src/admin/ui.generated.ts +202 -188
- 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 +180 -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 +243 -0
- package/src/apps/data/routes/fee-amm.ts +201 -162
- 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 +384 -8
- package/src/apps/data/routes/rpc.ts +452 -227
- 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.scan.test.ts +29 -0
- package/src/apps/data/routes/webhooks.test.ts +651 -83
- package/src/apps/data/routes/webhooks.ts +1113 -868
- 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/verified-token-requests.test.ts +16 -2
- package/src/apps/management/routes/verified-token-requests.ts +7 -10
- 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 +113 -30
- package/src/apps/mcp.ts +22 -10
- 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 +1485 -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} +388 -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/verifiedTokenRequests.test.ts +39 -20
- package/src/db/tables/verifiedTokenRequests.ts +80 -44
- 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 +1656 -9
- package/src/internal/Auth.ts +880 -244
- 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 +224 -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
|
@@ -0,0 +1,1199 @@
|
|
|
1
|
+
import { encodeFunctionData, erc20Abi, keccak256 } from 'viem'
|
|
2
|
+
|
|
3
|
+
import * as Anvil from '../../../test/Anvil.js'
|
|
4
|
+
import * as TestApp from '../../../test/App.js'
|
|
5
|
+
import * as TestRoutes from '../../../test/Routes.js'
|
|
6
|
+
import * as Organizations from '../../db/tables/organizations.js'
|
|
7
|
+
import * as RoutesTransferSubsidyNonces from '../../db/tables/routesTransferSubsidyNonces.js'
|
|
8
|
+
import * as RoutesTransferTransactions from '../../db/tables/routesTransferTransactions.js'
|
|
9
|
+
import * as RoutesTransfers from '../../db/tables/routesTransfers.js'
|
|
10
|
+
import * as Transfer from './Transfer.js'
|
|
11
|
+
import * as TransferSubsidy from './TransferSubsidy.js'
|
|
12
|
+
|
|
13
|
+
const db = TestApp.database()
|
|
14
|
+
const now = new Date('2026-01-01T00:00:00.000Z')
|
|
15
|
+
|
|
16
|
+
beforeEach(() => vi.useFakeTimers({ now, toFake: ['Date'] }))
|
|
17
|
+
afterEach(() => vi.useRealTimers())
|
|
18
|
+
|
|
19
|
+
function createInput(overrides: Partial<Transfer.create.Input> = {}): Transfer.create.Input {
|
|
20
|
+
return {
|
|
21
|
+
apiKeyId: 'key_test',
|
|
22
|
+
environment: 'production',
|
|
23
|
+
orgId: 'org_test',
|
|
24
|
+
snapshot: TestRoutes.transferSnapshot(),
|
|
25
|
+
...overrides,
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
describe('canTransition', () => {
|
|
30
|
+
test('encodes the public state chart', () => {
|
|
31
|
+
const table = Object.fromEntries(
|
|
32
|
+
Transfer.statuses.map((from) => [
|
|
33
|
+
from,
|
|
34
|
+
Transfer.statuses.filter((to) => Transfer.canTransition(from, to)),
|
|
35
|
+
]),
|
|
36
|
+
)
|
|
37
|
+
expect(table).toMatchInlineSnapshot(`
|
|
38
|
+
{
|
|
39
|
+
"action-required": [
|
|
40
|
+
"processing",
|
|
41
|
+
"refunding",
|
|
42
|
+
"completed",
|
|
43
|
+
"refunded",
|
|
44
|
+
],
|
|
45
|
+
"awaiting-source": [
|
|
46
|
+
"processing",
|
|
47
|
+
"action-required",
|
|
48
|
+
"expired",
|
|
49
|
+
],
|
|
50
|
+
"completed": [],
|
|
51
|
+
"expired": [],
|
|
52
|
+
"processing": [
|
|
53
|
+
"awaiting-source",
|
|
54
|
+
"refunding",
|
|
55
|
+
"completed",
|
|
56
|
+
"action-required",
|
|
57
|
+
],
|
|
58
|
+
"refunded": [],
|
|
59
|
+
"refunding": [
|
|
60
|
+
"refunded",
|
|
61
|
+
"action-required",
|
|
62
|
+
],
|
|
63
|
+
}
|
|
64
|
+
`)
|
|
65
|
+
})
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
describe('isTerminal', () => {
|
|
69
|
+
test('only chain-verified and expiry outcomes are terminal', () => {
|
|
70
|
+
expect(Transfer.statuses.filter(Transfer.isTerminal)).toMatchInlineSnapshot(`
|
|
71
|
+
[
|
|
72
|
+
"completed",
|
|
73
|
+
"refunded",
|
|
74
|
+
"expired",
|
|
75
|
+
]
|
|
76
|
+
`)
|
|
77
|
+
})
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
describe('generateId', () => {
|
|
81
|
+
test('embeds the timestamp so lexical order is chronological', () => {
|
|
82
|
+
const earlier = Transfer.generateId(new Date('2026-01-01T00:00:00.000Z'))
|
|
83
|
+
const later = Transfer.generateId(new Date('2026-01-01T00:00:01.000Z'))
|
|
84
|
+
expect(earlier).toMatch(/^rtr_\d{15}_[0-9A-Za-z]{24}$/)
|
|
85
|
+
expect(earlier < later).toBe(true)
|
|
86
|
+
})
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
describe('create', () => {
|
|
90
|
+
test('creates the row and its version-1 event atomically', async () => {
|
|
91
|
+
const record = await Transfer.create(db, createInput())
|
|
92
|
+
const { id, snapshot: _, ...rest } = record
|
|
93
|
+
expect(id).toMatch(/^rtr_/)
|
|
94
|
+
expect(rest).toMatchInlineSnapshot(`
|
|
95
|
+
{
|
|
96
|
+
"apiKeyId": "key_test",
|
|
97
|
+
"createdAt": "2026-01-01T00:00:00.000Z",
|
|
98
|
+
"environment": "production",
|
|
99
|
+
"method": "transaction",
|
|
100
|
+
"mode": "exactSource",
|
|
101
|
+
"orgId": "org_test",
|
|
102
|
+
"projectId": null,
|
|
103
|
+
"providerDeliveredAt": null,
|
|
104
|
+
"providerId": "relay",
|
|
105
|
+
"providerState": null,
|
|
106
|
+
"quoteExpiresAt": "2026-01-01T00:01:00.000Z",
|
|
107
|
+
"status": "awaiting-source",
|
|
108
|
+
"statusReason": null,
|
|
109
|
+
"statusUpdatedAt": "2026-01-01T00:00:00.000Z",
|
|
110
|
+
"subsidyAccount": null,
|
|
111
|
+
"subsidyAmount": null,
|
|
112
|
+
"subsidyChainId": null,
|
|
113
|
+
"subsidyCommitmentAmount": null,
|
|
114
|
+
"subsidyMeterReportedAt": null,
|
|
115
|
+
"subsidyNativeAmount": null,
|
|
116
|
+
"subsidyTokenAddress": null,
|
|
117
|
+
"subsidyTransactionHash": null,
|
|
118
|
+
"updatedAt": "2026-01-01T00:00:00.000Z",
|
|
119
|
+
"version": 1,
|
|
120
|
+
}
|
|
121
|
+
`)
|
|
122
|
+
|
|
123
|
+
const events = await db.kysely
|
|
124
|
+
.selectFrom('routes_transfer_events')
|
|
125
|
+
.select(['status', 'transferId', 'version'])
|
|
126
|
+
.where('transferId', '=', id)
|
|
127
|
+
.execute()
|
|
128
|
+
expect(events).toEqual([{ status: 'awaiting-source', transferId: id, version: 1 }])
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
test('normalizes quote expiry and strips executable actions before persistence', async () => {
|
|
132
|
+
const snapshot = {
|
|
133
|
+
...TestRoutes.transferSnapshot({
|
|
134
|
+
quote: { expiresAt: '2026-01-01T00:01:00Z', sampledAt: '2026-01-01T00:00:00.000Z' },
|
|
135
|
+
}),
|
|
136
|
+
action: { type: 'evm:calls' },
|
|
137
|
+
}
|
|
138
|
+
const record = await Transfer.create(db, createInput({ snapshot }))
|
|
139
|
+
expect({
|
|
140
|
+
action: 'action' in record.snapshot,
|
|
141
|
+
expiresAt: record.snapshot.quote.expiresAt,
|
|
142
|
+
quoteExpiresAt: record.quoteExpiresAt,
|
|
143
|
+
}).toEqual({
|
|
144
|
+
action: false,
|
|
145
|
+
expiresAt: '2026-01-01T00:01:00.000Z',
|
|
146
|
+
quoteExpiresAt: '2026-01-01T00:01:00.000Z',
|
|
147
|
+
})
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
test('persists one creation commitment and serializes concurrent inventory checks', async () => {
|
|
151
|
+
const account = `0x${'55'.repeat(20)}` as const
|
|
152
|
+
const chainId = 'eip155:8453'
|
|
153
|
+
const commitment = {
|
|
154
|
+
baseUnits: '20000',
|
|
155
|
+
currency: 'USD',
|
|
156
|
+
decimals: 6,
|
|
157
|
+
formatted: '0.02',
|
|
158
|
+
} as const
|
|
159
|
+
const source = TestApp.databaseFactory()
|
|
160
|
+
const database = source()
|
|
161
|
+
await Organizations.create(database, { id: 'org_test', name: 'Test' })
|
|
162
|
+
const reservations: { nativeAmount: bigint; tokenAmount: bigint }[] = []
|
|
163
|
+
const createCommitted = (database: typeof db) =>
|
|
164
|
+
database.transaction((tx) =>
|
|
165
|
+
Transfer.reserveSubsidyCommitmentIn(tx, createInput(), {
|
|
166
|
+
account,
|
|
167
|
+
chainId,
|
|
168
|
+
async check({ reservations: current }) {
|
|
169
|
+
reservations.push(current)
|
|
170
|
+
if (20_000n + current.tokenAmount > 20_000n)
|
|
171
|
+
throw new TransferSubsidy.BalanceUnavailableError()
|
|
172
|
+
return { nativeAmount: '100' }
|
|
173
|
+
},
|
|
174
|
+
subsidyCommitmentAmount: commitment,
|
|
175
|
+
tokenAddress: `0x${'66'.repeat(20)}`,
|
|
176
|
+
}),
|
|
177
|
+
)
|
|
178
|
+
const results = await Promise.allSettled([createCommitted(source()), createCommitted(source())])
|
|
179
|
+
const created = results.find((result) => result.status === 'fulfilled')
|
|
180
|
+
if (!created || created.status !== 'fulfilled') throw new Error('Expected one commitment.')
|
|
181
|
+
const rejected = results.find((result) => result.status === 'rejected')
|
|
182
|
+
const rows = await database.kysely
|
|
183
|
+
.selectFrom('routes_transfers')
|
|
184
|
+
.select([
|
|
185
|
+
'subsidyAccount',
|
|
186
|
+
'subsidyChainId',
|
|
187
|
+
'subsidyCommitmentAmount',
|
|
188
|
+
'subsidyNativeAmount',
|
|
189
|
+
'subsidyTokenAddress',
|
|
190
|
+
])
|
|
191
|
+
.where('id', '=', created.value.record.id)
|
|
192
|
+
.execute()
|
|
193
|
+
expect({
|
|
194
|
+
rejected: rejected?.reason instanceof TransferSubsidy.BalanceUnavailableError,
|
|
195
|
+
reservations,
|
|
196
|
+
rows,
|
|
197
|
+
}).toMatchInlineSnapshot(`
|
|
198
|
+
{
|
|
199
|
+
"rejected": true,
|
|
200
|
+
"reservations": [
|
|
201
|
+
{
|
|
202
|
+
"nativeAmount": 0n,
|
|
203
|
+
"tokenAmount": 0n,
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"nativeAmount": 100n,
|
|
207
|
+
"tokenAmount": 20000n,
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
"rows": [
|
|
211
|
+
{
|
|
212
|
+
"subsidyAccount": "0x5555555555555555555555555555555555555555",
|
|
213
|
+
"subsidyChainId": "eip155:8453",
|
|
214
|
+
"subsidyCommitmentAmount": {
|
|
215
|
+
"baseUnits": "20000",
|
|
216
|
+
"currency": "USD",
|
|
217
|
+
"decimals": 6,
|
|
218
|
+
"formatted": "0.02",
|
|
219
|
+
},
|
|
220
|
+
"subsidyNativeAmount": "100",
|
|
221
|
+
"subsidyTokenAddress": "0x6666666666666666666666666666666666666666",
|
|
222
|
+
},
|
|
223
|
+
],
|
|
224
|
+
}
|
|
225
|
+
`)
|
|
226
|
+
})
|
|
227
|
+
|
|
228
|
+
test('rejects a missing owner after acquiring the organization lock', async () => {
|
|
229
|
+
let checked = false
|
|
230
|
+
await expect(
|
|
231
|
+
db.transaction((tx) =>
|
|
232
|
+
Transfer.reserveSubsidyCommitmentIn(tx, createInput(), {
|
|
233
|
+
account: `0x${'55'.repeat(20)}`,
|
|
234
|
+
chainId: 'eip155:8453',
|
|
235
|
+
async check() {
|
|
236
|
+
checked = true
|
|
237
|
+
return { nativeAmount: '100' }
|
|
238
|
+
},
|
|
239
|
+
subsidyCommitmentAmount: {
|
|
240
|
+
baseUnits: '1',
|
|
241
|
+
currency: 'USD',
|
|
242
|
+
decimals: 6,
|
|
243
|
+
formatted: '0.000001',
|
|
244
|
+
},
|
|
245
|
+
tokenAddress: `0x${'66'.repeat(20)}`,
|
|
246
|
+
}),
|
|
247
|
+
),
|
|
248
|
+
).rejects.toThrow(Transfer.OrganizationNotFoundError)
|
|
249
|
+
expect(checked).toBe(false)
|
|
250
|
+
})
|
|
251
|
+
|
|
252
|
+
test('rejects a quote that expires while inventory is checked', async () => {
|
|
253
|
+
await Organizations.create(db, { id: 'org_test', name: 'Test' })
|
|
254
|
+
const input = createInput()
|
|
255
|
+
const before = await RoutesTransfers.listByOwner(
|
|
256
|
+
db,
|
|
257
|
+
{ environment: 'production', orgId: 'org_test' },
|
|
258
|
+
{ limit: 100 },
|
|
259
|
+
)
|
|
260
|
+
await expect(
|
|
261
|
+
db.transaction((tx) =>
|
|
262
|
+
Transfer.reserveSubsidyCommitmentIn(tx, input, {
|
|
263
|
+
account: `0x${'55'.repeat(20)}`,
|
|
264
|
+
chainId: 'eip155:8453',
|
|
265
|
+
async check() {
|
|
266
|
+
vi.setSystemTime(new Date(input.snapshot.quote.expiresAt))
|
|
267
|
+
return { nativeAmount: '100' }
|
|
268
|
+
},
|
|
269
|
+
subsidyCommitmentAmount: {
|
|
270
|
+
baseUnits: '1',
|
|
271
|
+
currency: 'USD',
|
|
272
|
+
decimals: 6,
|
|
273
|
+
formatted: '0.000001',
|
|
274
|
+
},
|
|
275
|
+
tokenAddress: `0x${'66'.repeat(20)}`,
|
|
276
|
+
}),
|
|
277
|
+
),
|
|
278
|
+
).rejects.toThrow(Transfer.QuoteExpiredError)
|
|
279
|
+
const after = await RoutesTransfers.listByOwner(
|
|
280
|
+
db,
|
|
281
|
+
{ environment: 'production', orgId: 'org_test' },
|
|
282
|
+
{ limit: 100 },
|
|
283
|
+
)
|
|
284
|
+
expect(after.map(({ id }) => id)).toEqual(before.map(({ id }) => id))
|
|
285
|
+
})
|
|
286
|
+
})
|
|
287
|
+
|
|
288
|
+
describe('registerSourceTransactions', () => {
|
|
289
|
+
const transactionHash = `0x${'a2'.repeat(32)}`
|
|
290
|
+
|
|
291
|
+
test('atomically assigns source evidence and starts reconciliation', async () => {
|
|
292
|
+
const record = await Transfer.create(
|
|
293
|
+
db,
|
|
294
|
+
createInput({
|
|
295
|
+
providerState: {
|
|
296
|
+
routeConfiguration: {
|
|
297
|
+
destinationPoolAddress: `0x${'cc'.repeat(20)}`,
|
|
298
|
+
poolAddress: `0x${'dd'.repeat(20)}`,
|
|
299
|
+
sourceEid: 30_184,
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
snapshot: TestRoutes.transferSnapshot({ provider: { id: 'stargate', name: 'Stargate' } }),
|
|
303
|
+
}),
|
|
304
|
+
)
|
|
305
|
+
const destinationAmount = {
|
|
306
|
+
...record.snapshot.destinationAmount!,
|
|
307
|
+
baseUnits: '980000',
|
|
308
|
+
formatted: '0.98',
|
|
309
|
+
}
|
|
310
|
+
vi.setSystemTime(new Date('2026-01-01T00:00:10.000Z'))
|
|
311
|
+
const result = await Transfer.registerSourceTransactions(db, {
|
|
312
|
+
chainId: 'eip155:8453',
|
|
313
|
+
destinationAmount,
|
|
314
|
+
id: record.id,
|
|
315
|
+
providerState: { stargate: { guid: `0x${'bb'.repeat(32)}`, sourceEid: 30_184 } },
|
|
316
|
+
transactionHashes: [`0x${'a6'.repeat(32)}`, `0x${'a1'.repeat(32)}`],
|
|
317
|
+
})
|
|
318
|
+
expect(result.type).toBe('registered')
|
|
319
|
+
if (result.type !== 'registered') return
|
|
320
|
+
expect({
|
|
321
|
+
destinationAmount: result.record.snapshot.destinationAmount,
|
|
322
|
+
providerState: result.record.providerState,
|
|
323
|
+
sourceTransactionHashes: result.record.snapshot.sourceTransactionHashes,
|
|
324
|
+
status: result.record.status,
|
|
325
|
+
version: result.record.version,
|
|
326
|
+
}).toMatchInlineSnapshot(`
|
|
327
|
+
{
|
|
328
|
+
"destinationAmount": {
|
|
329
|
+
"baseUnits": "980000",
|
|
330
|
+
"currency": "USD",
|
|
331
|
+
"decimals": 6,
|
|
332
|
+
"formatted": "0.98",
|
|
333
|
+
},
|
|
334
|
+
"providerState": {
|
|
335
|
+
"routeConfiguration": {
|
|
336
|
+
"destinationPoolAddress": "0xcccccccccccccccccccccccccccccccccccccccc",
|
|
337
|
+
"poolAddress": "0xdddddddddddddddddddddddddddddddddddddddd",
|
|
338
|
+
"sourceEid": 30184,
|
|
339
|
+
},
|
|
340
|
+
"stargate": {
|
|
341
|
+
"guid": "0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
|
342
|
+
"sourceEid": 30184,
|
|
343
|
+
},
|
|
344
|
+
},
|
|
345
|
+
"sourceTransactionHashes": [
|
|
346
|
+
"0xa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6",
|
|
347
|
+
"0xa1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",
|
|
348
|
+
],
|
|
349
|
+
"status": "processing",
|
|
350
|
+
"version": 2,
|
|
351
|
+
}
|
|
352
|
+
`)
|
|
353
|
+
})
|
|
354
|
+
|
|
355
|
+
test('replays the same assignment and rejects reuse by another transfer', async () => {
|
|
356
|
+
const first = await Transfer.create(db, createInput())
|
|
357
|
+
const second = await Transfer.create(db, createInput({ apiKeyId: 'key_rotated' }))
|
|
358
|
+
const options = {
|
|
359
|
+
chainId: 'eip155:8453',
|
|
360
|
+
id: first.id,
|
|
361
|
+
providerState: { stargate: { guid: `0x${'bb'.repeat(32)}`, sourceEid: 30_184 } },
|
|
362
|
+
transactionHashes: [transactionHash] as const,
|
|
363
|
+
}
|
|
364
|
+
await Transfer.registerSourceTransactions(db, options)
|
|
365
|
+
const replayed = await Transfer.registerSourceTransactions(db, options)
|
|
366
|
+
const conflict = await Transfer.registerSourceTransactions(db, { ...options, id: second.id })
|
|
367
|
+
expect({
|
|
368
|
+
conflict: conflict.type,
|
|
369
|
+
replayed: replayed.type,
|
|
370
|
+
replayedVersion: replayed.type === 'replayed' ? replayed.record.version : undefined,
|
|
371
|
+
}).toEqual({ conflict: 'conflict', replayed: 'replayed', replayedVersion: 2 })
|
|
372
|
+
})
|
|
373
|
+
|
|
374
|
+
test.each(['processing', 'completed'] as const)(
|
|
375
|
+
'accepts legitimate source evidence after a foreign transfer is %s',
|
|
376
|
+
async (status) => {
|
|
377
|
+
const database = TestApp.database()
|
|
378
|
+
const snapshot = TestRoutes.transferSnapshot()
|
|
379
|
+
const legitimate = await Transfer.create(database, createInput({ snapshot }))
|
|
380
|
+
const foreign = await Transfer.create(
|
|
381
|
+
database,
|
|
382
|
+
createInput({ apiKeyId: 'key_foreign', orgId: 'org_foreign', snapshot }),
|
|
383
|
+
)
|
|
384
|
+
const evidence = {
|
|
385
|
+
chainId: snapshot.sourceChain.id,
|
|
386
|
+
providerState: {},
|
|
387
|
+
transactionHashes: [`0x${'af'.repeat(32)}`] as const,
|
|
388
|
+
}
|
|
389
|
+
const claimed = await Transfer.registerSourceTransactions(database, {
|
|
390
|
+
...evidence,
|
|
391
|
+
id: foreign.id,
|
|
392
|
+
})
|
|
393
|
+
expect(claimed.type).toBe('registered')
|
|
394
|
+
if (status === 'completed') {
|
|
395
|
+
const completed = await Transfer.complete(database, {
|
|
396
|
+
chainId: snapshot.destinationChain.id,
|
|
397
|
+
destinationAmount: snapshot.destinationAmount!,
|
|
398
|
+
id: foreign.id,
|
|
399
|
+
transactionHashes: [`0x${'df'.repeat(32)}`],
|
|
400
|
+
})
|
|
401
|
+
expect(completed.type).toBe('completed')
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
const registered = await Transfer.registerSourceTransactions(database, {
|
|
405
|
+
...evidence,
|
|
406
|
+
id: legitimate.id,
|
|
407
|
+
})
|
|
408
|
+
expect(registered.type).toBe('registered')
|
|
409
|
+
const replayed = await Transfer.registerSourceTransactions(database, {
|
|
410
|
+
...evidence,
|
|
411
|
+
id: legitimate.id,
|
|
412
|
+
})
|
|
413
|
+
const duplicate = await Transfer.create(database, createInput({ snapshot }))
|
|
414
|
+
const conflict = await Transfer.registerSourceTransactions(database, {
|
|
415
|
+
...evidence,
|
|
416
|
+
id: duplicate.id,
|
|
417
|
+
})
|
|
418
|
+
expect({
|
|
419
|
+
conflict: conflict.type,
|
|
420
|
+
foreignStatus: (await RoutesTransfers.get(database, foreign.id))?.status,
|
|
421
|
+
legitimateStatus: (await RoutesTransfers.get(database, legitimate.id))?.status,
|
|
422
|
+
replayed: replayed.type,
|
|
423
|
+
}).toEqual({
|
|
424
|
+
conflict: 'conflict',
|
|
425
|
+
foreignStatus: status,
|
|
426
|
+
legitimateStatus: 'processing',
|
|
427
|
+
replayed: 'replayed',
|
|
428
|
+
})
|
|
429
|
+
},
|
|
430
|
+
)
|
|
431
|
+
|
|
432
|
+
test.each([{ environment: 'sandbox' as const }, { projectId: 'prj_other' }])(
|
|
433
|
+
'isolates source claims for $environment $projectId',
|
|
434
|
+
async (scope) => {
|
|
435
|
+
const database = TestApp.databaseFactory()
|
|
436
|
+
const first = await Transfer.create(database(), createInput())
|
|
437
|
+
const second = await Transfer.create(database(), createInput(scope))
|
|
438
|
+
const results = await Promise.all(
|
|
439
|
+
[first, second].map(({ id }) =>
|
|
440
|
+
Transfer.registerSourceTransactions(database(), {
|
|
441
|
+
chainId: 'eip155:8453',
|
|
442
|
+
id,
|
|
443
|
+
providerState: {},
|
|
444
|
+
transactionHashes: [`0x${'ac'.repeat(32)}`],
|
|
445
|
+
}),
|
|
446
|
+
),
|
|
447
|
+
)
|
|
448
|
+
expect(results.map(({ type }) => type)).toEqual(['registered', 'registered'])
|
|
449
|
+
const reopened = await Transfer.reopenSourceTransaction(database(), {
|
|
450
|
+
chainId: 'eip155:8453',
|
|
451
|
+
id: first.id,
|
|
452
|
+
providerState: {},
|
|
453
|
+
transactionHash: `0x${'ac'.repeat(32)}`,
|
|
454
|
+
})
|
|
455
|
+
expect(reopened.type).toBe('reopened')
|
|
456
|
+
expect(
|
|
457
|
+
(
|
|
458
|
+
await Transfer.registerSourceTransactions(database(), {
|
|
459
|
+
chainId: 'eip155:8453',
|
|
460
|
+
id: second.id,
|
|
461
|
+
providerState: {},
|
|
462
|
+
transactionHashes: [`0x${'ac'.repeat(32)}`],
|
|
463
|
+
})
|
|
464
|
+
).type,
|
|
465
|
+
).toBe('replayed')
|
|
466
|
+
},
|
|
467
|
+
)
|
|
468
|
+
|
|
469
|
+
test('rejects empty source evidence', async () => {
|
|
470
|
+
const record = await Transfer.create(db, createInput())
|
|
471
|
+
const result = await Transfer.registerSourceTransactions(db, {
|
|
472
|
+
chainId: 'eip155:8453',
|
|
473
|
+
id: record.id,
|
|
474
|
+
providerState: {},
|
|
475
|
+
transactionHashes: [] as never,
|
|
476
|
+
})
|
|
477
|
+
expect(result).toMatchObject({ current: { status: 'awaiting-source' }, type: 'invalid' })
|
|
478
|
+
})
|
|
479
|
+
|
|
480
|
+
test('rejects late source registration before the expiry sweep', async () => {
|
|
481
|
+
const transactionHash = `0x${'a9'.repeat(32)}`
|
|
482
|
+
const record = await Transfer.create(
|
|
483
|
+
db,
|
|
484
|
+
createInput({
|
|
485
|
+
subsidyCommitment: {
|
|
486
|
+
account: `0x${'55'.repeat(20)}`,
|
|
487
|
+
amount: { baseUnits: '1', currency: 'USD', decimals: 6, formatted: '0.000001' },
|
|
488
|
+
chainId: 'eip155:8453',
|
|
489
|
+
nativeAmount: '100',
|
|
490
|
+
tokenAddress: `0x${'66'.repeat(20)}`,
|
|
491
|
+
},
|
|
492
|
+
}),
|
|
493
|
+
)
|
|
494
|
+
vi.setSystemTime(
|
|
495
|
+
new Date(
|
|
496
|
+
new Date(record.quoteExpiresAt).getTime() + RoutesTransfers.subsidyCommitmentRecoveryTtlMs,
|
|
497
|
+
),
|
|
498
|
+
)
|
|
499
|
+
|
|
500
|
+
const result = await Transfer.registerSourceTransactions(db, {
|
|
501
|
+
chainId: 'eip155:8453',
|
|
502
|
+
id: record.id,
|
|
503
|
+
providerState: {},
|
|
504
|
+
transactionHashes: [transactionHash],
|
|
505
|
+
})
|
|
506
|
+
const claimed = await RoutesTransferTransactions.getSource(db, {
|
|
507
|
+
chainId: 'eip155:8453',
|
|
508
|
+
transactionRef: transactionHash,
|
|
509
|
+
transferId: record.id,
|
|
510
|
+
})
|
|
511
|
+
|
|
512
|
+
expect({ claimed, result }).toMatchObject({
|
|
513
|
+
claimed: undefined,
|
|
514
|
+
result: { current: { status: 'awaiting-source' }, type: 'invalid' },
|
|
515
|
+
})
|
|
516
|
+
})
|
|
517
|
+
|
|
518
|
+
test('claims concurrent source evidence in a stable order', async () => {
|
|
519
|
+
const database = TestApp.databaseFactory()
|
|
520
|
+
const first = await Transfer.create(database(), createInput())
|
|
521
|
+
const second = await Transfer.create(database(), createInput())
|
|
522
|
+
const lower = `0x${'a7'.repeat(32)}`
|
|
523
|
+
const upper = `0x${'a8'.repeat(32)}`
|
|
524
|
+
const results = await Promise.all([
|
|
525
|
+
Transfer.registerSourceTransactions(database(), {
|
|
526
|
+
chainId: 'eip155:8453',
|
|
527
|
+
id: first.id,
|
|
528
|
+
providerState: {},
|
|
529
|
+
transactionHashes: [lower, upper],
|
|
530
|
+
}),
|
|
531
|
+
Transfer.registerSourceTransactions(database(), {
|
|
532
|
+
chainId: 'eip155:8453',
|
|
533
|
+
id: second.id,
|
|
534
|
+
providerState: {},
|
|
535
|
+
transactionHashes: [upper, lower],
|
|
536
|
+
}),
|
|
537
|
+
])
|
|
538
|
+
expect(results.map((result) => result.type).toSorted()).toEqual(['conflict', 'registered'])
|
|
539
|
+
})
|
|
540
|
+
})
|
|
541
|
+
|
|
542
|
+
describe('reopenSourceTransaction', () => {
|
|
543
|
+
test('removes invalidated source evidence and accepts a replacement', async () => {
|
|
544
|
+
const record = await Transfer.create(db, createInput())
|
|
545
|
+
const transactionHash = `0x${'a4'.repeat(32)}`
|
|
546
|
+
await Transfer.registerSourceTransactions(db, {
|
|
547
|
+
chainId: 'eip155:8453',
|
|
548
|
+
id: record.id,
|
|
549
|
+
providerState: { stargate: { guid: `0x${'bb'.repeat(32)}`, sourceEid: 30_184 } },
|
|
550
|
+
transactionHashes: [transactionHash],
|
|
551
|
+
})
|
|
552
|
+
|
|
553
|
+
const reopened = await Transfer.reopenSourceTransaction(db, {
|
|
554
|
+
chainId: 'eip155:8453',
|
|
555
|
+
id: record.id,
|
|
556
|
+
providerState: { routeConfiguration: { poolAddress: `0x${'cc'.repeat(20)}` } },
|
|
557
|
+
transactionHash: transactionHash.toUpperCase(),
|
|
558
|
+
})
|
|
559
|
+
expect(reopened.type).toBe('reopened')
|
|
560
|
+
if (reopened.type !== 'reopened') return
|
|
561
|
+
expect({
|
|
562
|
+
providerState: reopened.record.providerState,
|
|
563
|
+
sourceTransactionHashes: reopened.record.snapshot.sourceTransactionHashes,
|
|
564
|
+
status: reopened.record.status,
|
|
565
|
+
version: reopened.record.version,
|
|
566
|
+
}).toEqual({
|
|
567
|
+
providerState: { routeConfiguration: { poolAddress: `0x${'cc'.repeat(20)}` } },
|
|
568
|
+
sourceTransactionHashes: undefined,
|
|
569
|
+
status: 'awaiting-source',
|
|
570
|
+
version: 3,
|
|
571
|
+
})
|
|
572
|
+
|
|
573
|
+
const replacement = await Transfer.registerSourceTransactions(db, {
|
|
574
|
+
chainId: 'eip155:8453',
|
|
575
|
+
id: record.id,
|
|
576
|
+
providerState: { stargate: { guid: `0x${'dd'.repeat(32)}`, sourceEid: 30_184 } },
|
|
577
|
+
transactionHashes: [`0x${'a5'.repeat(32)}`],
|
|
578
|
+
})
|
|
579
|
+
expect(replacement.type).toBe('registered')
|
|
580
|
+
})
|
|
581
|
+
})
|
|
582
|
+
|
|
583
|
+
describe('complete', () => {
|
|
584
|
+
test('records verified destination evidence and completes once', async () => {
|
|
585
|
+
const record = await Transfer.create(db, createInput())
|
|
586
|
+
await Transfer.registerSourceTransactions(db, {
|
|
587
|
+
chainId: 'eip155:8453',
|
|
588
|
+
id: record.id,
|
|
589
|
+
providerState: { stargate: { guid: `0x${'bb'.repeat(32)}`, sourceEid: 30_184 } },
|
|
590
|
+
transactionHashes: [`0x${'a3'.repeat(32)}`],
|
|
591
|
+
})
|
|
592
|
+
const options = {
|
|
593
|
+
chainId: 'eip155:4217',
|
|
594
|
+
destinationAmount: TestRoutes.transferSnapshot().destinationAmount!,
|
|
595
|
+
id: record.id,
|
|
596
|
+
transactionHashes: [`0x${'cc'.repeat(32)}`, `0x${'dd'.repeat(32)}`] as const,
|
|
597
|
+
}
|
|
598
|
+
const completed = await Transfer.complete(db, options)
|
|
599
|
+
const replayed = await Transfer.complete(db, options)
|
|
600
|
+
expect({
|
|
601
|
+
completed: completed.type,
|
|
602
|
+
destinationTransactionHashes:
|
|
603
|
+
completed.type === 'completed'
|
|
604
|
+
? completed.record.snapshot.destinationTransactionHashes
|
|
605
|
+
: undefined,
|
|
606
|
+
replayed: replayed.type,
|
|
607
|
+
status: completed.type === 'completed' ? completed.record.status : undefined,
|
|
608
|
+
version: completed.type === 'completed' ? completed.record.version : undefined,
|
|
609
|
+
}).toMatchInlineSnapshot(`
|
|
610
|
+
{
|
|
611
|
+
"completed": "completed",
|
|
612
|
+
"destinationTransactionHashes": [
|
|
613
|
+
"0xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
|
|
614
|
+
"0xdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd",
|
|
615
|
+
],
|
|
616
|
+
"replayed": "replayed",
|
|
617
|
+
"status": "completed",
|
|
618
|
+
"version": 3,
|
|
619
|
+
}
|
|
620
|
+
`)
|
|
621
|
+
})
|
|
622
|
+
})
|
|
623
|
+
|
|
624
|
+
describe('reserveSubsidy', () => {
|
|
625
|
+
test('shares one signed subsidy across concurrent tenants and bills its owner once', async () => {
|
|
626
|
+
const database = TestApp.databaseFactory()
|
|
627
|
+
const account = Anvil.getAccount(0)
|
|
628
|
+
const base = TestRoutes.transferSnapshot()
|
|
629
|
+
const snapshot = TestRoutes.transferSnapshot({
|
|
630
|
+
destinationChain: base.sourceChain,
|
|
631
|
+
destinationToken: base.sourceToken,
|
|
632
|
+
sourceChain: base.destinationChain,
|
|
633
|
+
sourceToken: base.destinationToken,
|
|
634
|
+
})
|
|
635
|
+
const amount = {
|
|
636
|
+
baseUnits: '3001',
|
|
637
|
+
currency: 'USD',
|
|
638
|
+
decimals: 6,
|
|
639
|
+
formatted: '0.003001',
|
|
640
|
+
} as const
|
|
641
|
+
const subsidyCommitment = {
|
|
642
|
+
account: account.address,
|
|
643
|
+
amount,
|
|
644
|
+
chainId: snapshot.destinationChain.id,
|
|
645
|
+
nativeAmount: '100',
|
|
646
|
+
tokenAddress: snapshot.destinationToken.address,
|
|
647
|
+
}
|
|
648
|
+
const records: RoutesTransfers.Record[] = []
|
|
649
|
+
for (const orgId of ['org_first', 'org_second']) {
|
|
650
|
+
const record = await Transfer.create(
|
|
651
|
+
database(),
|
|
652
|
+
createInput({ orgId, snapshot, subsidyCommitment }),
|
|
653
|
+
)
|
|
654
|
+
records.push(record)
|
|
655
|
+
expect(
|
|
656
|
+
(
|
|
657
|
+
await Transfer.registerSourceTransactions(database(), {
|
|
658
|
+
chainId: snapshot.sourceChain.id,
|
|
659
|
+
id: record.id,
|
|
660
|
+
providerState: {},
|
|
661
|
+
transactionHashes: [`0x${'ee'.repeat(32)}`],
|
|
662
|
+
})
|
|
663
|
+
).type,
|
|
664
|
+
).toBe('registered')
|
|
665
|
+
}
|
|
666
|
+
const prepared: number[] = []
|
|
667
|
+
const reserve = (record: (typeof records)[number]) =>
|
|
668
|
+
Transfer.reserveSubsidy(database(), {
|
|
669
|
+
account: account.address,
|
|
670
|
+
chainId: snapshot.destinationChain.id,
|
|
671
|
+
id: record.id,
|
|
672
|
+
orgId: record.orgId,
|
|
673
|
+
pendingNonce: 7,
|
|
674
|
+
async prepare({ nonce }) {
|
|
675
|
+
prepared.push(nonce)
|
|
676
|
+
const transaction = await account.signTransaction({
|
|
677
|
+
chainId: 8453,
|
|
678
|
+
data: encodeFunctionData({
|
|
679
|
+
abi: erc20Abi,
|
|
680
|
+
args: [snapshot.recipient as `0x${string}`, 3001n],
|
|
681
|
+
functionName: 'transfer',
|
|
682
|
+
}),
|
|
683
|
+
gas: 100_000n,
|
|
684
|
+
maxFeePerGas: 1n,
|
|
685
|
+
maxPriorityFeePerGas: 1n,
|
|
686
|
+
nonce,
|
|
687
|
+
to: snapshot.destinationToken.address as `0x${string}`,
|
|
688
|
+
type: 'eip1559',
|
|
689
|
+
})
|
|
690
|
+
return {
|
|
691
|
+
account: account.address,
|
|
692
|
+
amount: '3001',
|
|
693
|
+
chainId: snapshot.destinationChain.id,
|
|
694
|
+
hash: keccak256(transaction),
|
|
695
|
+
nativeAmount: '100',
|
|
696
|
+
nonce,
|
|
697
|
+
transaction,
|
|
698
|
+
}
|
|
699
|
+
},
|
|
700
|
+
subsidyAmount: amount,
|
|
701
|
+
tokenAddress: snapshot.destinationToken.address,
|
|
702
|
+
})
|
|
703
|
+
const results = await Promise.all(records.map(reserve))
|
|
704
|
+
expect(results.map(({ type }) => type).toSorted()).toEqual(['reserved', 'shared'])
|
|
705
|
+
expect(prepared).toEqual([7])
|
|
706
|
+
const owner = results.find((result) => result.type === 'reserved')!
|
|
707
|
+
const shared = results.find((result) => result.type === 'shared')!
|
|
708
|
+
expect(shared.transaction).toEqual(owner.transaction)
|
|
709
|
+
expect(shared.record).toMatchObject({
|
|
710
|
+
subsidyAmount: null,
|
|
711
|
+
subsidyCommitmentAmount: null,
|
|
712
|
+
subsidyNativeAmount: null,
|
|
713
|
+
subsidyTransactionHash: owner.transaction.hash,
|
|
714
|
+
})
|
|
715
|
+
expect((await reserve(shared.record)).type).toBe('replayed')
|
|
716
|
+
expect(prepared).toEqual([7])
|
|
717
|
+
for (const record of records)
|
|
718
|
+
expect(
|
|
719
|
+
(
|
|
720
|
+
await Transfer.complete(database(), {
|
|
721
|
+
chainId: snapshot.destinationChain.id,
|
|
722
|
+
destinationAmount: snapshot.destinationAmount!,
|
|
723
|
+
id: record.id,
|
|
724
|
+
transactionHashes: [`0x${'dd'.repeat(32)}`, owner.transaction.hash],
|
|
725
|
+
})
|
|
726
|
+
).type,
|
|
727
|
+
).toBe('completed')
|
|
728
|
+
expect((await RoutesTransfers.listUnreportedSubsidies(database())).map(({ id }) => id)).toEqual(
|
|
729
|
+
[owner.record.id],
|
|
730
|
+
)
|
|
731
|
+
await RoutesTransfers.markSubsidyReported(database(), owner.record.id, now.toISOString())
|
|
732
|
+
expect(await RoutesTransfers.listUnreportedSubsidies(database())).toEqual([])
|
|
733
|
+
|
|
734
|
+
const mismatched = await Transfer.create(
|
|
735
|
+
database(),
|
|
736
|
+
createInput({
|
|
737
|
+
orgId: 'org_mismatched',
|
|
738
|
+
snapshot: { ...snapshot, recipient: `0x${'ff'.repeat(20)}` },
|
|
739
|
+
subsidyCommitment,
|
|
740
|
+
}),
|
|
741
|
+
)
|
|
742
|
+
await Transfer.registerSourceTransactions(database(), {
|
|
743
|
+
chainId: snapshot.sourceChain.id,
|
|
744
|
+
id: mismatched.id,
|
|
745
|
+
providerState: {},
|
|
746
|
+
transactionHashes: [`0x${'ee'.repeat(32)}`],
|
|
747
|
+
})
|
|
748
|
+
await expect(reserve(mismatched)).rejects.toBeInstanceOf(Transfer.SubsidyEvidenceError)
|
|
749
|
+
expect(prepared).toEqual([7])
|
|
750
|
+
|
|
751
|
+
await database()
|
|
752
|
+
.kysely.deleteFrom('routes_transfers')
|
|
753
|
+
.where('id', '=', owner.record.id)
|
|
754
|
+
.execute()
|
|
755
|
+
const retained = await Transfer.create(
|
|
756
|
+
database(),
|
|
757
|
+
createInput({ orgId: 'org_retained', snapshot, subsidyCommitment }),
|
|
758
|
+
)
|
|
759
|
+
await Transfer.registerSourceTransactions(database(), {
|
|
760
|
+
chainId: snapshot.sourceChain.id,
|
|
761
|
+
id: retained.id,
|
|
762
|
+
providerState: {},
|
|
763
|
+
transactionHashes: [`0x${'ee'.repeat(32)}`],
|
|
764
|
+
})
|
|
765
|
+
const reused = await reserve(retained)
|
|
766
|
+
expect(reused.type).toBe('shared')
|
|
767
|
+
if (reused.type !== 'shared') throw new Error('Expected the retained subsidy settlement.')
|
|
768
|
+
expect(reused.transaction).toEqual(owner.transaction)
|
|
769
|
+
expect(prepared).toEqual([7])
|
|
770
|
+
})
|
|
771
|
+
|
|
772
|
+
test('serializes signer nonces and replays the persisted transaction', async () => {
|
|
773
|
+
const account = `0x${'11'.repeat(20)}` as const
|
|
774
|
+
const source = TestApp.databaseFactory()
|
|
775
|
+
const database = source()
|
|
776
|
+
const subsidyCommitment = {
|
|
777
|
+
account,
|
|
778
|
+
amount: { baseUnits: '3001', currency: 'USD', decimals: 6, formatted: '0.003001' },
|
|
779
|
+
chainId: 'eip155:8453',
|
|
780
|
+
nativeAmount: '100',
|
|
781
|
+
tokenAddress: `0x${'22'.repeat(20)}`,
|
|
782
|
+
} as const
|
|
783
|
+
const records = [
|
|
784
|
+
await Transfer.create(database, createInput({ subsidyCommitment })),
|
|
785
|
+
await Transfer.create(database, createInput({ subsidyCommitment })),
|
|
786
|
+
]
|
|
787
|
+
for (const [index, record] of records.entries())
|
|
788
|
+
await Transfer.registerSourceTransactions(database, {
|
|
789
|
+
chainId: 'eip155:8453',
|
|
790
|
+
id: record.id,
|
|
791
|
+
providerState: {},
|
|
792
|
+
transactionHashes: [`0x${(index === 0 ? 'aa' : 'bb').repeat(32)}`],
|
|
793
|
+
})
|
|
794
|
+
const inventory: Transfer.reserveSubsidy.PrepareOptions['reservations'][] = []
|
|
795
|
+
const reserve = (database: typeof db, id: string) =>
|
|
796
|
+
Transfer.reserveSubsidy(database, {
|
|
797
|
+
account,
|
|
798
|
+
chainId: 'eip155:8453',
|
|
799
|
+
id,
|
|
800
|
+
orgId: records.find((record) => record.id === id)!.orgId,
|
|
801
|
+
pendingNonce: 7,
|
|
802
|
+
prepare: async ({ nonce, reservations }) => {
|
|
803
|
+
inventory.push(reservations)
|
|
804
|
+
return {
|
|
805
|
+
account,
|
|
806
|
+
amount: '3001',
|
|
807
|
+
chainId: 'eip155:8453',
|
|
808
|
+
hash: `0x${String(nonce).padStart(64, '0')}` as const,
|
|
809
|
+
nativeAmount: '100',
|
|
810
|
+
nonce,
|
|
811
|
+
transaction: `0x${String(nonce).padStart(2, '0')}` as const,
|
|
812
|
+
}
|
|
813
|
+
},
|
|
814
|
+
subsidyAmount: {
|
|
815
|
+
baseUnits: '3001',
|
|
816
|
+
currency: 'USD',
|
|
817
|
+
decimals: 6,
|
|
818
|
+
formatted: '0.003001',
|
|
819
|
+
},
|
|
820
|
+
tokenAddress: `0x${'22'.repeat(20)}`,
|
|
821
|
+
})
|
|
822
|
+
const databases = [source(), source()]
|
|
823
|
+
const reserved = await Promise.all(
|
|
824
|
+
records.map((record, index) => reserve(databases[index]!, record.id)),
|
|
825
|
+
)
|
|
826
|
+
const replayed = await reserve(source(), records[0]!.id)
|
|
827
|
+
const nonces = reserved.map((result) =>
|
|
828
|
+
result.type === 'reserved' || result.type === 'replayed'
|
|
829
|
+
? result.transaction.nonce
|
|
830
|
+
: undefined,
|
|
831
|
+
)
|
|
832
|
+
expect({
|
|
833
|
+
inventory: inventory.slice(0, 2),
|
|
834
|
+
nonces: nonces.toSorted((left, right) => Number(left) - Number(right)),
|
|
835
|
+
replayed: replayed.type,
|
|
836
|
+
replayedSame:
|
|
837
|
+
(replayed.type === 'reserved' || replayed.type === 'replayed') &&
|
|
838
|
+
replayed.transaction.nonce === nonces[0],
|
|
839
|
+
}).toMatchInlineSnapshot(`
|
|
840
|
+
{
|
|
841
|
+
"inventory": [
|
|
842
|
+
{
|
|
843
|
+
"nativeAmount": 100n,
|
|
844
|
+
"tokenAmount": 3001n,
|
|
845
|
+
},
|
|
846
|
+
{
|
|
847
|
+
"nativeAmount": 100n,
|
|
848
|
+
"tokenAmount": 3001n,
|
|
849
|
+
},
|
|
850
|
+
],
|
|
851
|
+
"nonces": [
|
|
852
|
+
7,
|
|
853
|
+
8,
|
|
854
|
+
],
|
|
855
|
+
"replayed": "replayed",
|
|
856
|
+
"replayedSame": true,
|
|
857
|
+
}
|
|
858
|
+
`)
|
|
859
|
+
})
|
|
860
|
+
|
|
861
|
+
test('does not reserve behind a permanently rejected signer nonce', async () => {
|
|
862
|
+
const account = `0x${'33'.repeat(20)}` as const
|
|
863
|
+
const chainId = 'eip155:8453'
|
|
864
|
+
const records = [
|
|
865
|
+
await Transfer.create(
|
|
866
|
+
db,
|
|
867
|
+
createInput({
|
|
868
|
+
subsidyCommitment: {
|
|
869
|
+
account,
|
|
870
|
+
amount: { baseUnits: '3001', currency: 'USD', decimals: 6, formatted: '0.003001' },
|
|
871
|
+
chainId,
|
|
872
|
+
nativeAmount: '0',
|
|
873
|
+
tokenAddress: `0x${'44'.repeat(20)}`,
|
|
874
|
+
},
|
|
875
|
+
}),
|
|
876
|
+
),
|
|
877
|
+
await Transfer.create(
|
|
878
|
+
db,
|
|
879
|
+
createInput({
|
|
880
|
+
subsidyCommitment: {
|
|
881
|
+
account,
|
|
882
|
+
amount: { baseUnits: '3001', currency: 'USD', decimals: 6, formatted: '0.003001' },
|
|
883
|
+
chainId,
|
|
884
|
+
nativeAmount: '0',
|
|
885
|
+
tokenAddress: `0x${'44'.repeat(20)}`,
|
|
886
|
+
},
|
|
887
|
+
}),
|
|
888
|
+
),
|
|
889
|
+
]
|
|
890
|
+
for (const [index, record] of records.entries())
|
|
891
|
+
await Transfer.registerSourceTransactions(db, {
|
|
892
|
+
chainId,
|
|
893
|
+
id: record.id,
|
|
894
|
+
providerState: {},
|
|
895
|
+
transactionHashes: [`0x${(index === 0 ? 'cc' : 'dd').repeat(32)}`],
|
|
896
|
+
})
|
|
897
|
+
const reserve = (id: string, prepare: Transfer.reserveSubsidy.Options['prepare']) =>
|
|
898
|
+
Transfer.reserveSubsidy(db, {
|
|
899
|
+
account,
|
|
900
|
+
chainId,
|
|
901
|
+
id,
|
|
902
|
+
orgId: records.find((record) => record.id === id)!.orgId,
|
|
903
|
+
pendingNonce: 11,
|
|
904
|
+
prepare,
|
|
905
|
+
subsidyAmount: {
|
|
906
|
+
baseUnits: '3001',
|
|
907
|
+
currency: 'USD',
|
|
908
|
+
decimals: 6,
|
|
909
|
+
formatted: '0.003001',
|
|
910
|
+
},
|
|
911
|
+
tokenAddress: `0x${'44'.repeat(20)}`,
|
|
912
|
+
})
|
|
913
|
+
const first = await reserve(records[0]!.id, async ({ nonce }) => ({
|
|
914
|
+
account,
|
|
915
|
+
amount: '3001',
|
|
916
|
+
chainId,
|
|
917
|
+
hash: `0x${String(nonce).padStart(64, '0')}` as const,
|
|
918
|
+
nonce,
|
|
919
|
+
transaction: `0x${String(nonce).padStart(2, '0')}` as const,
|
|
920
|
+
}))
|
|
921
|
+
if (first.type !== 'reserved') throw new Error('Expected the first nonce reservation.')
|
|
922
|
+
await RoutesTransferSubsidyNonces.block(db, {
|
|
923
|
+
account,
|
|
924
|
+
chainId,
|
|
925
|
+
reason: 'broadcast_rejected',
|
|
926
|
+
transferId: records[0]!.id,
|
|
927
|
+
})
|
|
928
|
+
|
|
929
|
+
let prepared = false
|
|
930
|
+
const error = await reserve(records[1]!.id, async () => {
|
|
931
|
+
prepared = true
|
|
932
|
+
throw new Error('Blocked signer lane reached transaction preparation.')
|
|
933
|
+
}).then(
|
|
934
|
+
() => undefined,
|
|
935
|
+
(cause: unknown) => cause,
|
|
936
|
+
)
|
|
937
|
+
const cursor = await db.kysely
|
|
938
|
+
.selectFrom('routes_transfer_subsidy_nonces')
|
|
939
|
+
.selectAll()
|
|
940
|
+
.where('account', '=', account)
|
|
941
|
+
.where('chainId', '=', chainId)
|
|
942
|
+
.executeTakeFirstOrThrow()
|
|
943
|
+
expect({
|
|
944
|
+
blocked: error instanceof Transfer.SubsidySignerBlockedError,
|
|
945
|
+
blockedReason: cursor.blockedReason,
|
|
946
|
+
blockedTransferMatches: cursor.blockedTransferId === records[0]!.id,
|
|
947
|
+
nextNonce: cursor.nextNonce,
|
|
948
|
+
prepared,
|
|
949
|
+
}).toMatchInlineSnapshot(`
|
|
950
|
+
{
|
|
951
|
+
"blocked": true,
|
|
952
|
+
"blockedReason": "broadcast_rejected",
|
|
953
|
+
"blockedTransferMatches": true,
|
|
954
|
+
"nextNonce": "12",
|
|
955
|
+
"prepared": false,
|
|
956
|
+
}
|
|
957
|
+
`)
|
|
958
|
+
})
|
|
959
|
+
})
|
|
960
|
+
|
|
961
|
+
describe('transition', () => {
|
|
962
|
+
test('applies a guarded status change and appends an event', async () => {
|
|
963
|
+
const record = await Transfer.create(db, createInput())
|
|
964
|
+
vi.setSystemTime(new Date('2026-01-01T00:00:10.000Z'))
|
|
965
|
+
const result = await Transfer.transition(db, {
|
|
966
|
+
expectedVersion: 1,
|
|
967
|
+
id: record.id,
|
|
968
|
+
status: 'processing',
|
|
969
|
+
})
|
|
970
|
+
expect(result.type).toBe('applied')
|
|
971
|
+
if (result.type !== 'applied') return
|
|
972
|
+
expect({
|
|
973
|
+
status: result.record.status,
|
|
974
|
+
updatedAt: result.record.updatedAt,
|
|
975
|
+
version: result.record.version,
|
|
976
|
+
}).toEqual({ status: 'processing', updatedAt: '2026-01-01T00:00:10.000Z', version: 2 })
|
|
977
|
+
|
|
978
|
+
const events = await db.kysely
|
|
979
|
+
.selectFrom('routes_transfer_events')
|
|
980
|
+
.select(['status', 'version'])
|
|
981
|
+
.where('transferId', '=', record.id)
|
|
982
|
+
.orderBy('version', 'asc')
|
|
983
|
+
.execute()
|
|
984
|
+
expect(events).toEqual([
|
|
985
|
+
{ status: 'awaiting-source', version: 1 },
|
|
986
|
+
{ status: 'processing', version: 2 },
|
|
987
|
+
])
|
|
988
|
+
})
|
|
989
|
+
|
|
990
|
+
test('competing transitions converge on one version', async () => {
|
|
991
|
+
const record = await Transfer.create(db, createInput())
|
|
992
|
+
const first = await Transfer.transition(db, {
|
|
993
|
+
expectedVersion: 1,
|
|
994
|
+
id: record.id,
|
|
995
|
+
status: 'processing',
|
|
996
|
+
})
|
|
997
|
+
const second = await Transfer.transition(db, {
|
|
998
|
+
expectedVersion: 1,
|
|
999
|
+
id: record.id,
|
|
1000
|
+
status: 'expired',
|
|
1001
|
+
})
|
|
1002
|
+
expect([first.type, second.type]).toEqual(['applied', 'stale'])
|
|
1003
|
+
if (second.type !== 'stale') return
|
|
1004
|
+
expect(second.current.version).toBe(2)
|
|
1005
|
+
})
|
|
1006
|
+
|
|
1007
|
+
test('rejects transitions the lifecycle does not allow', async () => {
|
|
1008
|
+
const record = await Transfer.create(db, createInput())
|
|
1009
|
+
await Transfer.transition(db, { expectedVersion: 1, id: record.id, status: 'expired' })
|
|
1010
|
+
const result = await Transfer.transition(db, {
|
|
1011
|
+
expectedVersion: 2,
|
|
1012
|
+
id: record.id,
|
|
1013
|
+
status: 'processing',
|
|
1014
|
+
})
|
|
1015
|
+
expect(result.type).toBe('invalid')
|
|
1016
|
+
})
|
|
1017
|
+
|
|
1018
|
+
test('carries a customer-safe status reason', async () => {
|
|
1019
|
+
const record = await Transfer.create(db, createInput())
|
|
1020
|
+
await Transfer.transition(db, { expectedVersion: 1, id: record.id, status: 'processing' })
|
|
1021
|
+
const result = await Transfer.transition(db, {
|
|
1022
|
+
expectedVersion: 2,
|
|
1023
|
+
id: record.id,
|
|
1024
|
+
status: 'action-required',
|
|
1025
|
+
statusReason: {
|
|
1026
|
+
code: 'destination_amount_below_minimum',
|
|
1027
|
+
message: 'The verified destination amount did not satisfy the quoted minimum.',
|
|
1028
|
+
},
|
|
1029
|
+
})
|
|
1030
|
+
expect(result.type).toBe('applied')
|
|
1031
|
+
if (result.type !== 'applied') return
|
|
1032
|
+
expect(result.record.statusReason).toMatchInlineSnapshot(`
|
|
1033
|
+
{
|
|
1034
|
+
"code": "destination_amount_below_minimum",
|
|
1035
|
+
"message": "The verified destination amount did not satisfy the quoted minimum.",
|
|
1036
|
+
}
|
|
1037
|
+
`)
|
|
1038
|
+
})
|
|
1039
|
+
|
|
1040
|
+
test('preserves the reason for snapshot updates and clears it on lifecycle changes', async () => {
|
|
1041
|
+
const record = await Transfer.create(db, createInput())
|
|
1042
|
+
await Transfer.transition(db, { expectedVersion: 1, id: record.id, status: 'processing' })
|
|
1043
|
+
await Transfer.transition(db, {
|
|
1044
|
+
expectedVersion: 2,
|
|
1045
|
+
id: record.id,
|
|
1046
|
+
status: 'action-required',
|
|
1047
|
+
statusReason: {
|
|
1048
|
+
code: 'destination_amount_below_minimum',
|
|
1049
|
+
message: 'The verified destination amount did not satisfy the quoted minimum.',
|
|
1050
|
+
},
|
|
1051
|
+
})
|
|
1052
|
+
const snapshot = await Transfer.transition(db, {
|
|
1053
|
+
expectedVersion: 3,
|
|
1054
|
+
id: record.id,
|
|
1055
|
+
snapshot: TestRoutes.transferSnapshot({
|
|
1056
|
+
sourceTransactionHashes: [`0x${'aa'.repeat(32)}`],
|
|
1057
|
+
}),
|
|
1058
|
+
})
|
|
1059
|
+
expect(snapshot.type).toBe('applied')
|
|
1060
|
+
if (snapshot.type !== 'applied') return
|
|
1061
|
+
expect(snapshot.record.statusReason?.code).toBe('destination_amount_below_minimum')
|
|
1062
|
+
|
|
1063
|
+
const processing = await Transfer.transition(db, {
|
|
1064
|
+
expectedVersion: 4,
|
|
1065
|
+
id: record.id,
|
|
1066
|
+
status: 'processing',
|
|
1067
|
+
})
|
|
1068
|
+
expect(processing.type).toBe('applied')
|
|
1069
|
+
if (processing.type !== 'applied') return
|
|
1070
|
+
expect(processing.record.statusReason).toBeNull()
|
|
1071
|
+
})
|
|
1072
|
+
|
|
1073
|
+
test('updates the snapshot without a status change', async () => {
|
|
1074
|
+
const record = await Transfer.create(db, createInput())
|
|
1075
|
+
const result = await Transfer.transition(db, {
|
|
1076
|
+
expectedVersion: 1,
|
|
1077
|
+
id: record.id,
|
|
1078
|
+
snapshot: TestRoutes.transferSnapshot({
|
|
1079
|
+
sourceTransactionHashes: [`0x${'aa'.repeat(32)}`],
|
|
1080
|
+
}),
|
|
1081
|
+
})
|
|
1082
|
+
expect(result.type).toBe('applied')
|
|
1083
|
+
if (result.type !== 'applied') return
|
|
1084
|
+
expect({
|
|
1085
|
+
hashes: result.record.snapshot.sourceTransactionHashes,
|
|
1086
|
+
status: result.record.status,
|
|
1087
|
+
version: result.record.version,
|
|
1088
|
+
}).toEqual({
|
|
1089
|
+
hashes: [`0x${'aa'.repeat(32)}`],
|
|
1090
|
+
status: 'awaiting-source',
|
|
1091
|
+
version: 2,
|
|
1092
|
+
})
|
|
1093
|
+
})
|
|
1094
|
+
|
|
1095
|
+
test('strips executable actions from replacement snapshots', async () => {
|
|
1096
|
+
const record = await Transfer.create(db, createInput())
|
|
1097
|
+
const snapshot = {
|
|
1098
|
+
...TestRoutes.transferSnapshot(),
|
|
1099
|
+
action: { type: 'evm:calls' },
|
|
1100
|
+
}
|
|
1101
|
+
const result = await Transfer.transition(db, {
|
|
1102
|
+
expectedVersion: 1,
|
|
1103
|
+
id: record.id,
|
|
1104
|
+
snapshot,
|
|
1105
|
+
})
|
|
1106
|
+
expect(result.type).toBe('applied')
|
|
1107
|
+
if (result.type !== 'applied') return
|
|
1108
|
+
expect('action' in result.record.snapshot).toBe(false)
|
|
1109
|
+
})
|
|
1110
|
+
|
|
1111
|
+
test('reports a missing transfer', async () => {
|
|
1112
|
+
const result = await Transfer.transition(db, {
|
|
1113
|
+
expectedVersion: 1,
|
|
1114
|
+
id: 'rtr_000000000000000_000000000000000000000000',
|
|
1115
|
+
status: 'processing',
|
|
1116
|
+
})
|
|
1117
|
+
expect(result.type).toBe('not_found')
|
|
1118
|
+
})
|
|
1119
|
+
})
|
|
1120
|
+
|
|
1121
|
+
describe('toPublic', () => {
|
|
1122
|
+
test('serializes the snapshot with lifecycle fields and no ownership columns', async () => {
|
|
1123
|
+
const record = await Transfer.create(db, createInput({ projectId: 'prj_test' }))
|
|
1124
|
+
const { id, ...rest } = Transfer.toPublic(record)
|
|
1125
|
+
expect(id).toMatch(/^rtr_/)
|
|
1126
|
+
expect(rest).toMatchInlineSnapshot(`
|
|
1127
|
+
{
|
|
1128
|
+
"createdAt": "2026-01-01T00:00:00.000Z",
|
|
1129
|
+
"destinationAmount": {
|
|
1130
|
+
"baseUnits": "979295",
|
|
1131
|
+
"currency": "USD",
|
|
1132
|
+
"decimals": 6,
|
|
1133
|
+
"formatted": "0.979295",
|
|
1134
|
+
},
|
|
1135
|
+
"destinationAmountMin": {
|
|
1136
|
+
"baseUnits": "939242",
|
|
1137
|
+
"currency": "USD",
|
|
1138
|
+
"decimals": 6,
|
|
1139
|
+
"formatted": "0.939242",
|
|
1140
|
+
},
|
|
1141
|
+
"destinationChain": {
|
|
1142
|
+
"addressFormat": "hex",
|
|
1143
|
+
"id": "eip155:4217",
|
|
1144
|
+
"kind": "evm",
|
|
1145
|
+
"name": "Tempo",
|
|
1146
|
+
},
|
|
1147
|
+
"destinationToken": {
|
|
1148
|
+
"address": "0x20c000000000000000000000b9537d11c60e8b50",
|
|
1149
|
+
"currency": "USD",
|
|
1150
|
+
"decimals": 6,
|
|
1151
|
+
"name": "Bridged USDC (Stargate)",
|
|
1152
|
+
"standard": "TIP-20",
|
|
1153
|
+
"symbol": "USDC.e",
|
|
1154
|
+
"tokenKey": "eip155:4217/erc20:0x20c000000000000000000000b9537d11c60e8b50",
|
|
1155
|
+
"verified": true,
|
|
1156
|
+
},
|
|
1157
|
+
"fees": [],
|
|
1158
|
+
"method": "transaction",
|
|
1159
|
+
"mode": "exactSource",
|
|
1160
|
+
"provider": {
|
|
1161
|
+
"id": "relay",
|
|
1162
|
+
"name": "Relay",
|
|
1163
|
+
},
|
|
1164
|
+
"quote": {
|
|
1165
|
+
"expiresAt": "2026-01-01T00:01:00.000Z",
|
|
1166
|
+
"sampledAt": "2026-01-01T00:00:00.000Z",
|
|
1167
|
+
},
|
|
1168
|
+
"recipient": "0x1111111111111111111111111111111111111111",
|
|
1169
|
+
"sender": "0x2222222222222222222222222222222222222222",
|
|
1170
|
+
"sourceAmount": {
|
|
1171
|
+
"baseUnits": "1000000",
|
|
1172
|
+
"currency": "USD",
|
|
1173
|
+
"decimals": 6,
|
|
1174
|
+
"formatted": "1",
|
|
1175
|
+
},
|
|
1176
|
+
"sourceChain": {
|
|
1177
|
+
"addressFormat": "hex",
|
|
1178
|
+
"id": "eip155:8453",
|
|
1179
|
+
"kind": "evm",
|
|
1180
|
+
"name": "Base",
|
|
1181
|
+
},
|
|
1182
|
+
"sourceToken": {
|
|
1183
|
+
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
|
|
1184
|
+
"currency": "USD",
|
|
1185
|
+
"decimals": 6,
|
|
1186
|
+
"name": "USD Coin",
|
|
1187
|
+
"standard": "ERC-20",
|
|
1188
|
+
"symbol": "USDC",
|
|
1189
|
+
"tokenKey": "eip155:8453/erc20:0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
|
|
1190
|
+
"verified": true,
|
|
1191
|
+
},
|
|
1192
|
+
"status": "awaiting-source",
|
|
1193
|
+
"subsidize": false,
|
|
1194
|
+
"updatedAt": "2026-01-01T00:00:00.000Z",
|
|
1195
|
+
"version": 1,
|
|
1196
|
+
}
|
|
1197
|
+
`)
|
|
1198
|
+
})
|
|
1199
|
+
})
|