tapimo 0.13.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -4
- package/dist/ApiKey.js +1 -1
- package/dist/ApiKey.js.map +1 -1
- package/dist/ApiKeys.d.ts +95 -14
- package/dist/ApiKeys.d.ts.map +1 -1
- package/dist/ApiKeys.js +360 -49
- package/dist/ApiKeys.js.map +1 -1
- package/dist/App.d.ts +21383 -18056
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +301 -22
- package/dist/App.js.map +1 -1
- package/dist/Assets.d.ts.map +1 -1
- package/dist/Assets.js +2 -1
- package/dist/Assets.js.map +1 -1
- package/dist/Handler.d.ts +0 -1
- package/dist/Handler.d.ts.map +1 -1
- package/dist/Handler.js +0 -1
- package/dist/Handler.js.map +1 -1
- package/dist/Scope.d.ts +13 -5
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +16 -5
- package/dist/Scope.js.map +1 -1
- package/dist/Webhooks.js +2 -2
- package/dist/Webhooks.js.map +1 -1
- package/dist/admin/App.d.ts +3936 -1337
- package/dist/admin/App.d.ts.map +1 -1
- package/dist/admin/App.js +26 -5
- package/dist/admin/App.js.map +1 -1
- package/dist/admin/apps/api-keys.d.ts +159 -7
- package/dist/admin/apps/api-keys.d.ts.map +1 -1
- package/dist/admin/apps/api-keys.js +95 -43
- package/dist/admin/apps/api-keys.js.map +1 -1
- package/dist/admin/apps/earn-vaults.d.ts +1446 -0
- package/dist/admin/apps/earn-vaults.d.ts.map +1 -1
- package/dist/admin/apps/earn-vaults.js +465 -8
- package/dist/admin/apps/earn-vaults.js.map +1 -1
- package/dist/admin/apps/organizations.d.ts +344 -3
- package/dist/admin/apps/organizations.d.ts.map +1 -1
- package/dist/admin/apps/organizations.js +288 -10
- package/dist/admin/apps/organizations.js.map +1 -1
- package/dist/admin/apps/routes-support.d.ts +95 -0
- package/dist/admin/apps/routes-support.d.ts.map +1 -0
- package/dist/admin/apps/routes-support.js +151 -0
- package/dist/admin/apps/routes-support.js.map +1 -0
- package/dist/admin/apps/routes.d.ts +2764 -0
- package/dist/admin/apps/routes.d.ts.map +1 -0
- package/dist/admin/apps/routes.js +728 -0
- package/dist/admin/apps/routes.js.map +1 -0
- package/dist/admin/apps/subsidies.d.ts +501 -0
- package/dist/admin/apps/subsidies.d.ts.map +1 -0
- package/dist/admin/apps/subsidies.js +384 -0
- package/dist/admin/apps/subsidies.js.map +1 -0
- package/dist/admin/apps/verified-tokens.d.ts +16 -16
- package/dist/admin/apps/verified-tokens.d.ts.map +1 -1
- package/dist/admin/apps/verified-tokens.js +3 -3
- package/dist/admin/apps/verified-tokens.js.map +1 -1
- package/dist/admin/ui.generated.d.ts +1 -1
- package/dist/admin/ui.generated.d.ts.map +1 -1
- package/dist/admin/ui.generated.js +129 -69
- package/dist/admin/ui.generated.js.map +1 -1
- package/dist/analytics/Analytics.d.ts +5 -2
- package/dist/analytics/Analytics.d.ts.map +1 -1
- package/dist/analytics/Analytics.js +31 -1
- package/dist/analytics/Analytics.js.map +1 -1
- package/dist/analytics/tables/requestEvents.d.ts +2 -1
- package/dist/analytics/tables/requestEvents.d.ts.map +1 -1
- package/dist/analytics/tables/requestEvents.js +10 -1
- package/dist/analytics/tables/requestEvents.js.map +1 -1
- package/dist/analytics/tables/routesLifecycleIntervals.d.ts +72 -0
- package/dist/analytics/tables/routesLifecycleIntervals.d.ts.map +1 -0
- package/dist/analytics/tables/routesLifecycleIntervals.js +56 -0
- package/dist/analytics/tables/routesLifecycleIntervals.js.map +1 -0
- package/dist/apps/Zones.d.ts +21 -12526
- package/dist/apps/Zones.d.ts.map +1 -1
- package/dist/apps/Zones.js +40 -8
- package/dist/apps/Zones.js.map +1 -1
- package/dist/apps/data/App.d.ts +4310 -2548
- package/dist/apps/data/App.d.ts.map +1 -1
- package/dist/apps/data/App.js +86 -26
- package/dist/apps/data/App.js.map +1 -1
- package/dist/apps/data/routes/activities.d.ts +364 -34
- package/dist/apps/data/routes/activities.d.ts.map +1 -1
- package/dist/apps/data/routes/activities.js +495 -190
- package/dist/apps/data/routes/activities.js.map +1 -1
- package/dist/apps/data/routes/addresses.d.ts +94 -22
- package/dist/apps/data/routes/addresses.d.ts.map +1 -1
- package/dist/apps/data/routes/blocks.d.ts +37 -37
- package/dist/apps/data/routes/coingecko.d.ts.map +1 -1
- package/dist/apps/data/routes/coingecko.js +47 -21
- package/dist/apps/data/routes/coingecko.js.map +1 -1
- package/dist/apps/data/routes/earn.d.ts +1641 -352
- package/dist/apps/data/routes/earn.d.ts.map +1 -1
- package/dist/apps/data/routes/earn.js +1561 -120
- package/dist/apps/data/routes/earn.js.map +1 -1
- package/dist/apps/data/routes/exchanges.d.ts +15 -0
- package/dist/apps/data/routes/exchanges.d.ts.map +1 -1
- package/dist/apps/data/routes/exchanges.js +180 -114
- package/dist/apps/data/routes/exchanges.js.map +1 -1
- package/dist/apps/data/routes/fee-amm.d.ts +5 -0
- package/dist/apps/data/routes/fee-amm.d.ts.map +1 -1
- package/dist/apps/data/routes/fee-amm.js +49 -38
- package/dist/apps/data/routes/fee-amm.js.map +1 -1
- package/dist/apps/data/routes/indexer.d.ts +125 -0
- package/dist/apps/data/routes/indexer.d.ts.map +1 -1
- package/dist/apps/data/routes/indexer.js +83 -27
- package/dist/apps/data/routes/indexer.js.map +1 -1
- package/dist/apps/data/routes/rpc.d.ts +507 -33
- package/dist/apps/data/routes/rpc.d.ts.map +1 -1
- package/dist/apps/data/routes/rpc.js +266 -156
- package/dist/apps/data/routes/rpc.js.map +1 -1
- package/dist/apps/data/routes/tokenlist.d.ts +47 -15
- package/dist/apps/data/routes/tokenlist.d.ts.map +1 -1
- package/dist/apps/data/routes/tokenlist.js +68 -11
- package/dist/apps/data/routes/tokenlist.js.map +1 -1
- package/dist/apps/data/routes/tokens.d.ts +95 -93
- package/dist/apps/data/routes/tokens.d.ts.map +1 -1
- package/dist/apps/data/routes/tokens.js +26 -14
- package/dist/apps/data/routes/tokens.js.map +1 -1
- package/dist/apps/data/routes/transfers.d.ts +16 -0
- package/dist/apps/data/routes/transfers.d.ts.map +1 -1
- package/dist/apps/data/routes/transfers.js +9 -7
- package/dist/apps/data/routes/transfers.js.map +1 -1
- package/dist/apps/data/routes/verified-tokens.d.ts +4 -4
- package/dist/apps/data/routes/verified-tokens.d.ts.map +1 -1
- package/dist/apps/data/routes/verified-tokens.js +64 -20
- package/dist/apps/data/routes/verified-tokens.js.map +1 -1
- package/dist/apps/data/routes/webhooks.d.ts +1210 -70
- package/dist/apps/data/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/data/routes/webhooks.js +301 -163
- package/dist/apps/data/routes/webhooks.js.map +1 -1
- package/dist/apps/data/routes/zones.d.ts.map +1 -1
- package/dist/apps/data/routes/zones.js +20 -12
- package/dist/apps/data/routes/zones.js.map +1 -1
- package/dist/apps/docs/reference.js +2 -2
- package/dist/apps/docs/reference.js.map +1 -1
- package/dist/apps/index.d.ts +1 -1
- package/dist/apps/index.d.ts.map +1 -1
- package/dist/apps/index.js +1 -1
- package/dist/apps/index.js.map +1 -1
- package/dist/apps/management/App.d.ts +4119 -3297
- package/dist/apps/management/App.d.ts.map +1 -1
- package/dist/apps/management/App.js +5 -14
- package/dist/apps/management/App.js.map +1 -1
- package/dist/apps/management/Billing.d.ts +49 -8
- package/dist/apps/management/Billing.d.ts.map +1 -1
- package/dist/apps/management/Billing.js +221 -26
- package/dist/apps/management/Billing.js.map +1 -1
- package/dist/apps/management/routes/api-keys.d.ts +174 -72
- package/dist/apps/management/routes/api-keys.d.ts.map +1 -1
- package/dist/apps/management/routes/api-keys.js +43 -15
- package/dist/apps/management/routes/api-keys.js.map +1 -1
- package/dist/apps/management/routes/billing.d.ts +364 -78
- package/dist/apps/management/routes/billing.d.ts.map +1 -1
- package/dist/apps/management/routes/billing.js +274 -49
- package/dist/apps/management/routes/billing.js.map +1 -1
- package/dist/apps/management/routes/faucet.d.ts +6 -6
- package/dist/apps/management/routes/faucet.js +1 -1
- package/dist/apps/management/routes/faucet.js.map +1 -1
- package/dist/apps/management/routes/invitations.d.ts +99 -24
- package/dist/apps/management/routes/invitations.d.ts.map +1 -1
- package/dist/apps/management/routes/invitations.js +117 -13
- package/dist/apps/management/routes/invitations.js.map +1 -1
- package/dist/apps/management/routes/invite-links.d.ts +42 -42
- package/dist/apps/management/routes/me.d.ts.map +1 -1
- package/dist/apps/management/routes/me.js +6 -2
- package/dist/apps/management/routes/me.js.map +1 -1
- package/dist/apps/management/routes/members.d.ts +16 -16
- package/dist/apps/management/routes/orgs.d.ts +36 -20
- package/dist/apps/management/routes/orgs.d.ts.map +1 -1
- package/dist/apps/management/routes/orgs.js +52 -12
- package/dist/apps/management/routes/orgs.js.map +1 -1
- package/dist/apps/management/routes/projects.d.ts +40 -40
- package/dist/apps/management/routes/projects.d.ts.map +1 -1
- package/dist/apps/management/routes/projects.js +6 -1
- package/dist/apps/management/routes/projects.js.map +1 -1
- package/dist/apps/management/routes/scopes.d.ts.map +1 -1
- package/dist/apps/management/routes/scopes.js +4 -1
- package/dist/apps/management/routes/scopes.js.map +1 -1
- package/dist/apps/management/routes/usage.d.ts +8 -8
- package/dist/apps/management/routes/usage.js +21 -4
- package/dist/apps/management/routes/usage.js.map +1 -1
- package/dist/apps/management/routes/verified-token-requests.d.ts +16 -16
- package/dist/apps/management/routes/webhooks.d.ts +931 -215
- package/dist/apps/management/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/management/routes/webhooks.js +71 -25
- package/dist/apps/management/routes/webhooks.js.map +1 -1
- package/dist/apps/mcp.d.ts +1 -1
- package/dist/apps/mcp.js +7 -7
- package/dist/apps/mcp.js.map +1 -1
- package/dist/apps/mpp/App.d.ts.map +1 -1
- package/dist/apps/mpp/App.js +35 -7
- package/dist/apps/mpp/App.js.map +1 -1
- package/dist/apps/mpp/internal/Adapter.d.ts +2 -0
- package/dist/apps/mpp/internal/Adapter.d.ts.map +1 -1
- package/dist/apps/mpp/internal/Adapter.js +30 -1
- package/dist/apps/mpp/internal/Adapter.js.map +1 -1
- package/dist/apps/mpp/internal/Policy.d.ts +22 -4
- package/dist/apps/mpp/internal/Policy.d.ts.map +1 -1
- package/dist/apps/mpp/internal/Policy.js +24 -6
- package/dist/apps/mpp/internal/Policy.js.map +1 -1
- package/dist/apps/mpp/internal/Sponsorship.d.ts +3 -0
- package/dist/apps/mpp/internal/Sponsorship.d.ts.map +1 -1
- package/dist/apps/mpp/internal/Sponsorship.js +6 -3
- package/dist/apps/mpp/internal/Sponsorship.js.map +1 -1
- package/dist/apps/relay/App.d.ts +2 -0
- package/dist/apps/relay/App.d.ts.map +1 -1
- package/dist/apps/relay/App.js +177 -26
- package/dist/apps/relay/App.js.map +1 -1
- package/dist/apps/relay/Sponsorships.d.ts +5 -3
- package/dist/apps/relay/Sponsorships.d.ts.map +1 -1
- package/dist/apps/relay/Sponsorships.js +232 -25
- package/dist/apps/relay/Sponsorships.js.map +1 -1
- package/dist/apps/{funding → routes}/Access.d.ts +4 -4
- package/dist/apps/routes/Access.d.ts.map +1 -0
- package/dist/apps/{funding → routes}/Access.js +4 -4
- package/dist/apps/routes/Access.js.map +1 -0
- package/dist/apps/{funding → routes}/App.d.ts +841 -136
- package/dist/apps/{funding → routes}/App.d.ts.map +1 -1
- package/dist/apps/{funding → routes}/App.js +17 -17
- package/dist/apps/routes/App.js.map +1 -0
- package/dist/apps/routes/Inventory.d.ts.map +1 -0
- package/dist/apps/{funding → routes}/Inventory.js +2 -2
- package/dist/apps/routes/Inventory.js.map +1 -0
- package/dist/apps/routes/index.d.ts +2 -0
- package/dist/apps/routes/index.d.ts.map +1 -0
- package/dist/apps/routes/index.js +2 -0
- package/dist/apps/routes/index.js.map +1 -0
- package/dist/apps/{funding → routes}/routes/chains.d.ts +7 -7
- package/dist/apps/routes/routes/chains.d.ts.map +1 -0
- package/dist/apps/{funding → routes}/routes/chains.js +25 -25
- package/dist/apps/routes/routes/chains.js.map +1 -0
- package/dist/apps/{funding → routes}/routes/deposit-addresses.d.ts +123 -59
- package/dist/apps/routes/routes/deposit-addresses.d.ts.map +1 -0
- package/dist/apps/{funding → routes}/routes/deposit-addresses.js +498 -223
- package/dist/apps/routes/routes/deposit-addresses.js.map +1 -0
- package/dist/apps/{funding → routes}/routes/providers.d.ts +8 -8
- package/dist/apps/routes/routes/providers.d.ts.map +1 -0
- package/dist/apps/routes/routes/providers.js +57 -0
- package/dist/apps/routes/routes/providers.js.map +1 -0
- package/dist/apps/{funding → routes}/routes/quotes.d.ts +19 -16
- package/dist/apps/routes/routes/quotes.d.ts.map +1 -0
- package/dist/apps/{funding → routes}/routes/quotes.js +55 -38
- package/dist/apps/routes/routes/quotes.js.map +1 -0
- package/dist/apps/{funding → routes}/routes/transfers.d.ts +957 -71
- package/dist/apps/routes/routes/transfers.d.ts.map +1 -0
- package/dist/apps/routes/routes/transfers.js +1140 -0
- package/dist/apps/routes/routes/transfers.js.map +1 -0
- package/dist/cli/Cli.d.ts +30 -0
- package/dist/cli/Cli.d.ts.map +1 -1
- package/dist/cli/commands/admin.d.ts +36 -0
- package/dist/cli/commands/admin.d.ts.map +1 -1
- package/dist/cli/commands/admin.js +273 -0
- package/dist/cli/commands/admin.js.map +1 -1
- package/dist/cloudflare.d.ts +16 -14
- package/dist/cloudflare.d.ts.map +1 -1
- package/dist/cloudflare.js +26 -21
- package/dist/cloudflare.js.map +1 -1
- package/dist/db/Db.d.ts +63 -21
- package/dist/db/Db.d.ts.map +1 -1
- package/dist/db/Db.js +1052 -15
- package/dist/db/Db.js.map +1 -1
- package/dist/db/Schema.d.ts +785 -133
- package/dist/db/Schema.d.ts.map +1 -1
- package/dist/db/Schema.js +590 -162
- package/dist/db/Schema.js.map +1 -1
- package/dist/db/tables/apiKeyAdmissionBootstraps.d.ts +4 -0
- package/dist/db/tables/apiKeyAdmissionBootstraps.d.ts.map +1 -0
- package/dist/db/tables/apiKeyAdmissionBootstraps.js +2 -0
- package/dist/db/tables/apiKeyAdmissionBootstraps.js.map +1 -0
- package/dist/db/tables/apiKeyAdmissions.d.ts +73 -0
- package/dist/db/tables/apiKeyAdmissions.d.ts.map +1 -0
- package/dist/db/tables/apiKeyAdmissions.js +142 -0
- package/dist/db/tables/apiKeyAdmissions.js.map +1 -0
- package/dist/db/tables/apiKeyOwnerAdmissions.d.ts +4 -0
- package/dist/db/tables/apiKeyOwnerAdmissions.d.ts.map +1 -0
- package/dist/db/tables/apiKeyOwnerAdmissions.js +2 -0
- package/dist/db/tables/apiKeyOwnerAdmissions.js.map +1 -0
- package/dist/db/tables/apiKeyOwnerTombstones.d.ts +20 -0
- package/dist/db/tables/apiKeyOwnerTombstones.d.ts.map +1 -0
- package/dist/db/tables/apiKeyOwnerTombstones.js +57 -0
- package/dist/db/tables/apiKeyOwnerTombstones.js.map +1 -0
- package/dist/db/tables/apiKeyRevocations.d.ts +21 -0
- package/dist/db/tables/apiKeyRevocations.d.ts.map +1 -0
- package/dist/db/tables/apiKeyRevocations.js +98 -0
- package/dist/db/tables/apiKeyRevocations.js.map +1 -0
- package/dist/db/tables/authAccounts.d.ts +47 -0
- package/dist/db/tables/authAccounts.d.ts.map +1 -0
- package/dist/db/tables/authAccounts.js +72 -0
- package/dist/db/tables/authAccounts.js.map +1 -0
- package/dist/db/tables/authSessions.d.ts +12 -0
- package/dist/db/tables/authSessions.d.ts.map +1 -0
- package/dist/db/tables/authSessions.js +2 -0
- package/dist/db/tables/authSessions.js.map +1 -0
- package/dist/db/tables/authVerifications.d.ts +12 -0
- package/dist/db/tables/authVerifications.d.ts.map +1 -0
- package/dist/db/tables/authVerifications.js +2 -0
- package/dist/db/tables/authVerifications.js.map +1 -0
- package/dist/db/tables/invitations.d.ts +17 -1
- package/dist/db/tables/invitations.d.ts.map +1 -1
- package/dist/db/tables/invitations.js +123 -43
- package/dist/db/tables/invitations.js.map +1 -1
- package/dist/db/tables/memberships.d.ts +8 -0
- package/dist/db/tables/memberships.d.ts.map +1 -1
- package/dist/db/tables/memberships.js +51 -2
- package/dist/db/tables/memberships.js.map +1 -1
- package/dist/db/tables/organizations.d.ts +51 -5
- package/dist/db/tables/organizations.d.ts.map +1 -1
- package/dist/db/tables/organizations.js +135 -47
- package/dist/db/tables/organizations.js.map +1 -1
- package/dist/db/tables/projects.d.ts +27 -1
- package/dist/db/tables/projects.d.ts.map +1 -1
- package/dist/db/tables/projects.js +38 -3
- package/dist/db/tables/projects.js.map +1 -1
- package/dist/db/tables/requestUsage.d.ts.map +1 -1
- package/dist/db/tables/requestUsage.js.map +1 -1
- package/dist/db/tables/rewardAccounts.d.ts +86 -0
- package/dist/db/tables/rewardAccounts.d.ts.map +1 -0
- package/dist/db/tables/rewardAccounts.js +88 -0
- package/dist/db/tables/rewardAccounts.js.map +1 -0
- package/dist/db/tables/rewardCampaignDistributors.d.ts +36 -0
- package/dist/db/tables/rewardCampaignDistributors.d.ts.map +1 -0
- package/dist/db/tables/rewardCampaignDistributors.js +30 -0
- package/dist/db/tables/rewardCampaignDistributors.js.map +1 -0
- package/dist/db/tables/rewardCampaigns.d.ts +171 -0
- package/dist/db/tables/rewardCampaigns.d.ts.map +1 -0
- package/dist/db/tables/rewardCampaigns.js +392 -0
- package/dist/db/tables/rewardCampaigns.js.map +1 -0
- package/dist/db/tables/rewardCredits.d.ts +53 -0
- package/dist/db/tables/rewardCredits.d.ts.map +1 -0
- package/dist/db/tables/rewardCredits.js +63 -0
- package/dist/db/tables/rewardCredits.js.map +1 -0
- package/dist/db/tables/rewardEligibilityAssociations.d.ts +61 -0
- package/dist/db/tables/rewardEligibilityAssociations.d.ts.map +1 -0
- package/dist/db/tables/rewardEligibilityAssociations.js +103 -0
- package/dist/db/tables/rewardEligibilityAssociations.js.map +1 -0
- package/dist/db/tables/rewardRuns.d.ts +188 -0
- package/dist/db/tables/rewardRuns.d.ts.map +1 -0
- package/dist/db/tables/rewardRuns.js +278 -0
- package/dist/db/tables/rewardRuns.js.map +1 -0
- package/dist/db/tables/rewardTransactionAttempts.d.ts +100 -0
- package/dist/db/tables/rewardTransactionAttempts.d.ts.map +1 -0
- package/dist/db/tables/rewardTransactionAttempts.js +163 -0
- package/dist/db/tables/rewardTransactionAttempts.js.map +1 -0
- package/dist/db/tables/routesCatalog.d.ts +58 -0
- package/dist/db/tables/routesCatalog.d.ts.map +1 -0
- package/dist/db/tables/{fundingCatalog.js → routesCatalog.js} +19 -19
- package/dist/db/tables/routesCatalog.js.map +1 -0
- package/dist/db/tables/routesDepositAddresses.d.ts +476 -0
- package/dist/db/tables/routesDepositAddresses.d.ts.map +1 -0
- package/dist/db/tables/routesDepositAddresses.js +587 -0
- package/dist/db/tables/routesDepositAddresses.js.map +1 -0
- package/dist/db/tables/{fundingDepositRequestObservations.d.ts → routesDepositRequestObservations.d.ts} +6 -6
- package/dist/db/tables/routesDepositRequestObservations.d.ts.map +1 -0
- package/dist/db/tables/{fundingDepositRequestObservations.js → routesDepositRequestObservations.js} +6 -6
- package/dist/db/tables/routesDepositRequestObservations.js.map +1 -0
- package/dist/db/tables/{fundingDeposits.d.ts → routesDeposits.d.ts} +210 -22
- package/dist/db/tables/routesDeposits.d.ts.map +1 -0
- package/dist/db/tables/routesDeposits.js +576 -0
- package/dist/db/tables/routesDeposits.js.map +1 -0
- package/dist/db/tables/routesIdempotency.d.ts +166 -0
- package/dist/db/tables/routesIdempotency.d.ts.map +1 -0
- package/dist/db/tables/routesIdempotency.js +330 -0
- package/dist/db/tables/routesIdempotency.js.map +1 -0
- package/dist/db/tables/routesSubsidies.d.ts +27 -0
- package/dist/db/tables/routesSubsidies.d.ts.map +1 -0
- package/dist/db/tables/routesSubsidies.js +45 -0
- package/dist/db/tables/routesSubsidies.js.map +1 -0
- package/dist/db/tables/{fundingTransferEvents.d.ts → routesTransferEvents.d.ts} +3 -3
- package/dist/db/tables/routesTransferEvents.d.ts.map +1 -0
- package/dist/db/tables/{fundingTransferEvents.js → routesTransferEvents.js} +3 -3
- package/dist/db/tables/routesTransferEvents.js.map +1 -0
- package/dist/db/tables/routesTransferSubsidies.d.ts +19 -0
- package/dist/db/tables/routesTransferSubsidies.d.ts.map +1 -0
- package/dist/db/tables/routesTransferSubsidies.js +17 -0
- package/dist/db/tables/routesTransferSubsidies.js.map +1 -0
- package/dist/db/tables/routesTransferSubsidyNonces.d.ts +51 -0
- package/dist/db/tables/routesTransferSubsidyNonces.d.ts.map +1 -0
- package/dist/db/tables/routesTransferSubsidyNonces.js +82 -0
- package/dist/db/tables/routesTransferSubsidyNonces.js.map +1 -0
- package/dist/db/tables/routesTransferTransactions.d.ts +77 -0
- package/dist/db/tables/routesTransferTransactions.d.ts.map +1 -0
- package/dist/db/tables/routesTransferTransactions.js +86 -0
- package/dist/db/tables/routesTransferTransactions.js.map +1 -0
- package/dist/db/tables/routesTransfers.d.ts +319 -0
- package/dist/db/tables/routesTransfers.d.ts.map +1 -0
- package/dist/db/tables/routesTransfers.js +372 -0
- package/dist/db/tables/routesTransfers.js.map +1 -0
- package/dist/db/tables/sponsoredTransactions.d.ts +112 -13
- package/dist/db/tables/sponsoredTransactions.d.ts.map +1 -1
- package/dist/db/tables/sponsoredTransactions.js +241 -38
- package/dist/db/tables/sponsoredTransactions.js.map +1 -1
- package/dist/db/tables/sponsorshipAttributions.d.ts +69 -0
- package/dist/db/tables/sponsorshipAttributions.d.ts.map +1 -0
- package/dist/db/tables/sponsorshipAttributions.js +77 -0
- package/dist/db/tables/sponsorshipAttributions.js.map +1 -0
- package/dist/db/tables/sponsorshipReconciliationCursors.d.ts +22 -0
- package/dist/db/tables/sponsorshipReconciliationCursors.d.ts.map +1 -0
- package/dist/db/tables/sponsorshipReconciliationCursors.js +45 -0
- package/dist/db/tables/sponsorshipReconciliationCursors.js.map +1 -0
- package/dist/db/tables/stripeCustomers.d.ts +11 -0
- package/dist/db/tables/stripeCustomers.d.ts.map +1 -1
- package/dist/db/tables/stripeCustomers.js +13 -0
- package/dist/db/tables/stripeCustomers.js.map +1 -1
- package/dist/db/tables/users.d.ts +17 -1
- package/dist/db/tables/users.d.ts.map +1 -1
- package/dist/db/tables/users.js +47 -2
- package/dist/db/tables/users.js.map +1 -1
- package/dist/db/tables/webhookQueueEvents.d.ts.map +1 -1
- package/dist/db/tables/webhookQueueEvents.js +5 -1
- package/dist/db/tables/webhookQueueEvents.js.map +1 -1
- package/dist/db/tables/webhookSubscriptions.d.ts +22 -10
- package/dist/db/tables/webhookSubscriptions.d.ts.map +1 -1
- package/dist/db/tables/webhookSubscriptions.js +50 -15
- package/dist/db/tables/webhookSubscriptions.js.map +1 -1
- package/dist/handlers/internal/executionError.d.ts +2 -2
- package/dist/handlers/internal/executionError.d.ts.map +1 -1
- package/dist/handlers/internal/executionError.js +1 -2
- package/dist/handlers/internal/executionError.js.map +1 -1
- package/dist/handlers/internal/multisig.d.ts +4 -232
- package/dist/handlers/internal/multisig.d.ts.map +1 -1
- package/dist/handlers/internal/multisig.js +11 -537
- package/dist/handlers/internal/multisig.js.map +1 -1
- package/dist/handlers/internal/sponsorship.d.ts +19 -8
- package/dist/handlers/internal/sponsorship.d.ts.map +1 -1
- package/dist/handlers/internal/sponsorship.js +13 -9
- package/dist/handlers/internal/sponsorship.js.map +1 -1
- package/dist/handlers/relay.d.ts +9 -12
- package/dist/handlers/relay.d.ts.map +1 -1
- package/dist/handlers/relay.js +81 -85
- package/dist/handlers/relay.js.map +1 -1
- package/dist/index.d.ts +0 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -17
- package/dist/index.js.map +1 -1
- package/dist/internal/AssetResponse.d.ts +12 -0
- package/dist/internal/AssetResponse.d.ts.map +1 -0
- package/dist/internal/AssetResponse.js +21 -0
- package/dist/internal/AssetResponse.js.map +1 -0
- package/dist/internal/Auth.d.ts +48 -12
- package/dist/internal/Auth.d.ts.map +1 -1
- package/dist/internal/Auth.js +603 -175
- package/dist/internal/Auth.js.map +1 -1
- package/dist/internal/BetterAuth.d.ts +1488 -0
- package/dist/internal/BetterAuth.d.ts.map +1 -0
- package/dist/internal/BetterAuth.js +253 -0
- package/dist/internal/BetterAuth.js.map +1 -0
- package/dist/internal/Cache.d.ts +2 -0
- package/dist/internal/Cache.d.ts.map +1 -1
- package/dist/internal/Cache.js +2 -0
- package/dist/internal/Cache.js.map +1 -1
- package/dist/internal/EarnRates.d.ts +26 -3
- package/dist/internal/EarnRates.d.ts.map +1 -1
- package/dist/internal/EarnRates.js +84 -19
- package/dist/internal/EarnRates.js.map +1 -1
- package/dist/internal/EarnSharePrices.d.ts +120 -0
- package/dist/internal/EarnSharePrices.d.ts.map +1 -0
- package/dist/internal/EarnSharePrices.js +179 -0
- package/dist/internal/EarnSharePrices.js.map +1 -0
- package/dist/internal/EarnVaults.d.ts +4 -0
- package/dist/internal/EarnVaults.d.ts.map +1 -1
- package/dist/internal/EarnVaults.js +31 -14
- package/dist/internal/EarnVaults.js.map +1 -1
- package/dist/internal/Email.d.ts +37 -0
- package/dist/internal/Email.d.ts.map +1 -0
- package/dist/internal/Email.js +16 -0
- package/dist/internal/Email.js.map +1 -0
- package/dist/internal/Log.d.ts +32 -28
- package/dist/internal/Log.d.ts.map +1 -1
- package/dist/internal/Log.js +18 -11
- package/dist/internal/Log.js.map +1 -1
- package/dist/internal/MetricSink.d.ts +3 -0
- package/dist/internal/MetricSink.d.ts.map +1 -1
- package/dist/internal/MetricSink.js +67 -8
- package/dist/internal/MetricSink.js.map +1 -1
- package/dist/internal/Mpp.d.ts.map +1 -1
- package/dist/internal/Mpp.js +20 -25
- package/dist/internal/Mpp.js.map +1 -1
- package/dist/internal/OpenApi.d.ts +26 -3
- package/dist/internal/OpenApi.d.ts.map +1 -1
- package/dist/internal/OpenApi.js +25 -10
- package/dist/internal/OpenApi.js.map +1 -1
- package/dist/internal/Provider.d.ts +1 -1
- package/dist/internal/Provider.d.ts.map +1 -1
- package/dist/internal/RateLimit.d.ts.map +1 -1
- package/dist/internal/RateLimit.js +13 -1
- package/dist/internal/RateLimit.js.map +1 -1
- package/dist/internal/Store.d.ts +16 -0
- package/dist/internal/Store.d.ts.map +1 -1
- package/dist/internal/Store.js +59 -8
- package/dist/internal/Store.js.map +1 -1
- package/dist/internal/Tidx.d.ts +9 -2
- package/dist/internal/Tidx.d.ts.map +1 -1
- package/dist/internal/Tidx.js +78 -11
- package/dist/internal/Tidx.js.map +1 -1
- package/dist/internal/Timing.d.ts +26 -0
- package/dist/internal/Timing.d.ts.map +1 -1
- package/dist/internal/Timing.js +63 -5
- package/dist/internal/Timing.js.map +1 -1
- package/dist/internal/VercelOidc.d.ts +94 -0
- package/dist/internal/VercelOidc.d.ts.map +1 -0
- package/dist/internal/VercelOidc.js +128 -0
- package/dist/internal/VercelOidc.js.map +1 -0
- package/dist/internal/VerifiedTokens.d.ts +2 -8
- package/dist/internal/VerifiedTokens.d.ts.map +1 -1
- package/dist/internal/VerifiedTokens.js +24 -24
- package/dist/internal/VerifiedTokens.js.map +1 -1
- package/dist/internal/Viem.d.ts +46 -2068
- package/dist/internal/Viem.d.ts.map +1 -1
- package/dist/internal/Viem.js +171 -11
- package/dist/internal/Viem.js.map +1 -1
- package/dist/internal/Webhooks.d.ts +12 -4
- package/dist/internal/Webhooks.d.ts.map +1 -1
- package/dist/internal/Webhooks.js +9 -3
- package/dist/internal/Webhooks.js.map +1 -1
- package/dist/internal/ZoneRpc.d.ts +7 -0
- package/dist/internal/ZoneRpc.d.ts.map +1 -0
- package/dist/internal/ZoneRpc.js +49 -0
- package/dist/internal/ZoneRpc.js.map +1 -0
- package/dist/internal/index.d.ts +3 -1
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +3 -1
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/rewards/Audit.d.ts +88 -0
- package/dist/internal/rewards/Audit.d.ts.map +1 -0
- package/dist/internal/rewards/Audit.js +134 -0
- package/dist/internal/rewards/Audit.js.map +1 -0
- package/dist/internal/rewards/Campaigns.d.ts +572 -0
- package/dist/internal/rewards/Campaigns.d.ts.map +1 -0
- package/dist/internal/rewards/Campaigns.js +531 -0
- package/dist/internal/rewards/Campaigns.js.map +1 -0
- package/dist/internal/rewards/Credits.d.ts +76 -0
- package/dist/internal/rewards/Credits.d.ts.map +1 -0
- package/dist/internal/rewards/Credits.js +95 -0
- package/dist/internal/rewards/Credits.js.map +1 -0
- package/dist/internal/rewards/Events.d.ts +100 -0
- package/dist/internal/rewards/Events.d.ts.map +1 -0
- package/dist/internal/rewards/Events.js +340 -0
- package/dist/internal/rewards/Events.js.map +1 -0
- package/dist/internal/rewards/Projection.d.ts +237 -0
- package/dist/internal/rewards/Projection.d.ts.map +1 -0
- package/dist/internal/rewards/Projection.js +616 -0
- package/dist/internal/rewards/Projection.js.map +1 -0
- package/dist/internal/rewards/Rates.d.ts +44 -0
- package/dist/internal/rewards/Rates.d.ts.map +1 -0
- package/dist/internal/rewards/Rates.js +60 -0
- package/dist/internal/rewards/Rates.js.map +1 -0
- package/dist/internal/rewards/Read.d.ts +158 -0
- package/dist/internal/rewards/Read.d.ts.map +1 -0
- package/dist/internal/rewards/Read.js +292 -0
- package/dist/internal/rewards/Read.js.map +1 -0
- package/dist/internal/rewards/Runner.d.ts +164 -0
- package/dist/internal/rewards/Runner.d.ts.map +1 -0
- package/dist/internal/rewards/Runner.js +1778 -0
- package/dist/internal/rewards/Runner.js.map +1 -0
- package/dist/internal/rewards/Signer.d.ts +224 -0
- package/dist/internal/rewards/Signer.d.ts.map +1 -0
- package/dist/internal/rewards/Signer.js +135 -0
- package/dist/internal/rewards/Signer.js.map +1 -0
- package/dist/internal/rewards/index.d.ts +15 -0
- package/dist/internal/rewards/index.d.ts.map +1 -0
- package/dist/internal/rewards/index.js +15 -0
- package/dist/internal/rewards/index.js.map +1 -0
- package/dist/internal/{funding → routes}/Action.d.ts +12 -1
- package/dist/internal/routes/Action.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Action.js +17 -9
- package/dist/internal/routes/Action.js.map +1 -0
- package/dist/internal/{funding → routes}/Catalog.d.ts +20 -20
- package/dist/internal/routes/Catalog.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Catalog.js +29 -29
- package/dist/internal/routes/Catalog.js.map +1 -0
- package/dist/internal/{funding → routes}/Chain.d.ts +10 -10
- package/dist/internal/routes/Chain.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Chain.js +3 -3
- package/dist/internal/routes/Chain.js.map +1 -0
- package/dist/internal/{funding → routes}/Deposit.d.ts +45 -23
- package/dist/internal/routes/Deposit.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Deposit.js +60 -27
- package/dist/internal/routes/Deposit.js.map +1 -0
- package/dist/internal/{funding → routes}/DepositAddress.d.ts +56 -27
- package/dist/internal/routes/DepositAddress.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/DepositAddress.js +95 -33
- package/dist/internal/routes/DepositAddress.js.map +1 -0
- package/dist/internal/{funding → routes}/DepositWebhook.d.ts +4 -4
- package/dist/internal/routes/DepositWebhook.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/DepositWebhook.js +4 -3
- package/dist/internal/routes/DepositWebhook.js.map +1 -0
- package/dist/internal/routes/Economics.d.ts +25 -0
- package/dist/internal/routes/Economics.d.ts.map +1 -0
- package/dist/internal/routes/Economics.js +28 -0
- package/dist/internal/routes/Economics.js.map +1 -0
- package/dist/internal/{funding → routes}/Evidence.d.ts +3 -3
- package/dist/internal/routes/Evidence.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Evidence.js +9 -17
- package/dist/internal/routes/Evidence.js.map +1 -0
- package/dist/internal/routes/Observability.d.ts +154 -0
- package/dist/internal/routes/Observability.d.ts.map +1 -0
- package/dist/internal/routes/Observability.js +389 -0
- package/dist/internal/routes/Observability.js.map +1 -0
- package/dist/internal/{funding → routes}/Provider.d.ts +350 -104
- package/dist/internal/routes/Provider.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Provider.js +233 -97
- package/dist/internal/routes/Provider.js.map +1 -0
- package/dist/internal/{funding → routes}/Reconciliation.d.ts +11 -6
- package/dist/internal/routes/Reconciliation.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Reconciliation.js +408 -158
- package/dist/internal/routes/Reconciliation.js.map +1 -0
- package/dist/internal/routes/Route.d.ts +21 -0
- package/dist/internal/routes/Route.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Route.js +1 -1
- package/dist/internal/routes/Route.js.map +1 -0
- package/dist/internal/{funding → routes}/SourceObservation.d.ts +6 -6
- package/dist/internal/routes/SourceObservation.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/SourceObservation.js +13 -15
- package/dist/internal/routes/SourceObservation.js.map +1 -0
- package/dist/internal/{funding → routes}/Subsidy.d.ts +48 -3
- package/dist/internal/routes/Subsidy.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Subsidy.js +43 -3
- package/dist/internal/routes/Subsidy.js.map +1 -0
- package/dist/internal/{funding → routes}/Token.d.ts +4 -4
- package/dist/internal/routes/Token.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Token.js +3 -3
- package/dist/internal/routes/Token.js.map +1 -0
- package/dist/internal/{funding → routes}/Transfer.d.ts +324 -34
- package/dist/internal/routes/Transfer.d.ts.map +1 -0
- package/dist/internal/routes/Transfer.js +728 -0
- package/dist/internal/routes/Transfer.js.map +1 -0
- package/dist/internal/routes/TransferReconciliation.d.ts +55 -0
- package/dist/internal/routes/TransferReconciliation.d.ts.map +1 -0
- package/dist/internal/routes/TransferReconciliation.js +422 -0
- package/dist/internal/routes/TransferReconciliation.js.map +1 -0
- package/dist/internal/routes/TransferSubsidy.d.ts +201 -0
- package/dist/internal/routes/TransferSubsidy.d.ts.map +1 -0
- package/dist/internal/routes/TransferSubsidy.js +256 -0
- package/dist/internal/routes/TransferSubsidy.js.map +1 -0
- package/dist/internal/routes/TransferWebhook.d.ts +21 -0
- package/dist/internal/routes/TransferWebhook.d.ts.map +1 -0
- package/dist/internal/routes/TransferWebhook.js +43 -0
- package/dist/internal/routes/TransferWebhook.js.map +1 -0
- package/dist/internal/{funding → routes}/index.d.ts +3 -0
- package/dist/internal/routes/index.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/index.js +3 -0
- package/dist/internal/routes/index.js.map +1 -0
- package/dist/internal/{funding → routes}/providers/across.d.ts +4 -4
- package/dist/internal/routes/providers/across.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/providers/across.js +13 -13
- package/dist/internal/routes/providers/across.js.map +1 -0
- package/dist/internal/{funding → routes}/providers/relay.d.ts +21 -12
- package/dist/internal/routes/providers/relay.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/providers/relay.js +197 -122
- package/dist/internal/routes/providers/relay.js.map +1 -0
- package/dist/internal/{funding → routes}/providers/rhino.d.ts +4 -4
- package/dist/internal/routes/providers/rhino.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/providers/rhino.js +10 -10
- package/dist/internal/routes/providers/rhino.js.map +1 -0
- package/dist/internal/{funding → routes}/providers/squid.d.ts +4 -4
- package/dist/internal/routes/providers/squid.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/providers/squid.js +14 -14
- package/dist/internal/routes/providers/squid.js.map +1 -0
- package/dist/internal/routes/providers/stargate.d.ts +165 -0
- package/dist/internal/routes/providers/stargate.d.ts.map +1 -0
- package/dist/internal/routes/providers/stargate.js +898 -0
- package/dist/internal/routes/providers/stargate.js.map +1 -0
- package/dist/internal/{funding → routes}/providers/symbiosis.d.ts +4 -4
- package/dist/internal/routes/providers/symbiosis.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/providers/symbiosis.js +30 -20
- package/dist/internal/routes/providers/symbiosis.js.map +1 -0
- package/dist/internal/webhookDestinations/slack.d.ts.map +1 -1
- package/dist/internal/webhookDestinations/slack.js +22 -6
- package/dist/internal/webhookDestinations/slack.js.map +1 -1
- package/dist/providers/index.d.ts +12 -12
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +12 -12
- package/dist/providers/index.js.map +1 -1
- package/dist/server.d.ts +19 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +19 -0
- package/dist/server.js.map +1 -0
- package/package.json +15 -4
- package/src/ApiKey.ts +1 -1
- package/src/ApiKeys.test.ts +1033 -3
- package/src/ApiKeys.ts +489 -48
- package/src/App.test-d.ts +1 -1
- package/src/App.test.ts +216 -25
- package/src/App.ts +335 -31
- package/src/Assets.test.ts +2 -2
- package/src/Assets.ts +3 -1
- package/src/Auth.test-d.ts +1 -1
- package/src/Client.test-d.ts +611 -101
- package/src/Handler.ts +0 -1
- package/src/OpenApi.contract.test.ts +195 -0
- package/src/Scope.ts +17 -5
- package/src/Webhooks.ts +2 -2
- package/src/admin/App.test.ts +30 -2
- package/src/admin/App.ts +42 -6
- package/src/admin/apps/api-keys.test.ts +267 -5
- package/src/admin/apps/api-keys.ts +100 -50
- package/src/admin/apps/earn-vaults.test.ts +158 -0
- package/src/admin/apps/earn-vaults.ts +681 -7
- package/src/admin/apps/organizations.test.ts +342 -1
- package/src/admin/apps/organizations.ts +368 -8
- package/src/admin/apps/routes-support.test.ts +200 -0
- package/src/admin/apps/routes-support.ts +201 -0
- package/src/admin/apps/routes.test.ts +450 -0
- package/src/admin/apps/routes.ts +896 -0
- package/src/admin/apps/scopes.test.ts +15 -5
- package/src/admin/apps/subsidies.test.ts +306 -0
- package/src/admin/apps/subsidies.ts +457 -0
- package/src/admin/apps/verified-tokens.test.ts +8 -3
- package/src/admin/apps/verified-tokens.ts +3 -3
- package/src/admin/ui/plugin.ts +1 -2
- package/src/admin/ui/src/components/RewardCampaignForm.tsx +1009 -0
- package/src/admin/ui/src/lib/config.ts +11 -2
- package/src/admin/ui/src/lib/earn-vaults.ts +2 -2
- package/src/admin/ui/src/lib/organizations.test.ts +147 -3
- package/src/admin/ui/src/lib/organizations.ts +136 -0
- package/src/admin/ui/src/lib/query-client.ts +1 -1
- package/src/admin/ui/src/lib/reward-campaigns.ts +136 -0
- package/src/admin/ui/src/lib/routes.test.ts +88 -0
- package/src/admin/ui/src/lib/routes.ts +304 -0
- package/src/admin/ui/src/lib/subsidies.ts +75 -0
- package/src/admin/ui/src/routeTree.gen.ts +63 -0
- package/src/admin/ui/src/routes/__root.tsx +12 -1
- package/src/admin/ui/src/routes/api-keys.tsx +196 -84
- package/src/admin/ui/src/routes/earn.vaults_.$vaultId.edit.tsx +105 -70
- package/src/admin/ui/src/routes/organizations_.$orgId.tsx +334 -2
- package/src/admin/ui/src/routes/routes.tsx +1615 -0
- package/src/admin/ui/src/routes/routes_.support.tsx +248 -0
- package/src/admin/ui/src/routes/subsidies.tsx +799 -0
- package/src/admin/ui.generated.ts +144 -69
- package/src/analytics/Analytics.test.ts +108 -18
- package/src/analytics/Analytics.ts +38 -6
- package/src/analytics/tables/requestEvents.test.ts +100 -0
- package/src/analytics/tables/requestEvents.ts +10 -1
- package/src/analytics/tables/routesLifecycleIntervals.ts +140 -0
- package/src/apps/Zones.test.ts +18 -3
- package/src/apps/Zones.ts +55 -8
- package/src/apps/composition.test.ts +68 -59
- package/src/apps/data/App.test.ts +154 -2
- package/src/apps/data/App.ts +102 -33
- package/src/apps/data/routes/activities.test.ts +419 -7
- package/src/apps/data/routes/activities.ts +683 -216
- package/src/apps/data/routes/balances.test.ts +2 -2
- package/src/apps/data/routes/blocks.test.ts +46 -1
- package/src/apps/data/routes/coingecko.test.ts +419 -1
- package/src/apps/data/routes/coingecko.ts +309 -253
- package/src/apps/data/routes/earn.discovery.test.ts +274 -0
- package/src/apps/data/routes/earn.test.ts +1661 -29
- package/src/apps/data/routes/earn.ts +2314 -328
- package/src/apps/data/routes/exchanges.test.ts +752 -30
- package/src/apps/data/routes/exchanges.ts +954 -753
- package/src/apps/data/routes/fee-amm.test.ts +224 -0
- package/src/apps/data/routes/fee-amm.ts +208 -178
- package/src/apps/data/routes/indexer.test.ts +389 -0
- package/src/apps/data/routes/indexer.ts +165 -69
- package/src/apps/data/routes/receipts.test.ts +1 -1
- package/src/apps/data/routes/rpc.test.ts +352 -8
- package/src/apps/data/routes/rpc.ts +407 -219
- package/src/apps/data/routes/rpc.zone.test.ts +340 -0
- package/src/apps/data/routes/tokenlist.test.ts +285 -0
- package/src/apps/data/routes/tokenlist.ts +173 -88
- package/src/apps/data/routes/tokens.test.ts +93 -3
- package/src/apps/data/routes/tokens.ts +39 -23
- package/src/apps/data/routes/transactions.test.ts +1 -1
- package/src/apps/data/routes/transfers.test.ts +56 -24
- package/src/apps/data/routes/transfers.ts +19 -8
- package/src/apps/data/routes/valuation.test.ts +1 -1
- package/src/apps/data/routes/verified-tokens.test.ts +345 -0
- package/src/apps/data/routes/verified-tokens.ts +99 -29
- package/src/apps/data/routes/webhooks.test.ts +659 -81
- package/src/apps/data/routes/webhooks.ts +1104 -817
- package/src/apps/data/routes/zones.test.ts +148 -71
- package/src/apps/data/routes/zones.ts +71 -55
- package/src/apps/docs/reference.ts +2 -2
- package/src/apps/index.ts +1 -1
- package/src/apps/management/App.ts +9 -51
- package/src/apps/management/Billing.test.ts +375 -14
- package/src/apps/management/Billing.ts +283 -34
- package/src/apps/management/routes/api-keys.test.ts +269 -7
- package/src/apps/management/routes/api-keys.ts +61 -20
- package/src/apps/management/routes/billing.test.ts +477 -15
- package/src/apps/management/routes/billing.ts +377 -50
- package/src/apps/management/routes/faucet.test.ts +1 -1
- package/src/apps/management/routes/faucet.ts +1 -1
- package/src/apps/management/routes/invitations.test.ts +270 -3
- package/src/apps/management/routes/invitations.ts +185 -15
- package/src/apps/management/routes/invoicePreview.test.ts +549 -0
- package/src/apps/management/routes/me.test.ts +246 -5
- package/src/apps/management/routes/me.ts +7 -2
- package/src/apps/management/routes/members.test.ts +108 -0
- package/src/apps/management/routes/orgs.test.ts +191 -3
- package/src/apps/management/routes/orgs.ts +58 -11
- package/src/apps/management/routes/projects.test.ts +33 -3
- package/src/apps/management/routes/projects.ts +6 -1
- package/src/apps/management/routes/scopes.test.ts +30 -2
- package/src/apps/management/routes/scopes.ts +4 -1
- package/src/apps/management/routes/usage.test.ts +32 -0
- package/src/apps/management/routes/usage.ts +22 -4
- package/src/apps/management/routes/webhooks.test.ts +49 -26
- package/src/apps/management/routes/webhooks.ts +93 -38
- package/src/apps/mcp.test.ts +6 -6
- package/src/apps/mcp.ts +7 -7
- package/src/apps/mpp/App.ts +37 -7
- package/src/apps/mpp/Mpp.test.ts +49 -8
- package/src/apps/mpp/Mpp.zone.test.ts +219 -0
- package/src/apps/mpp/internal/Adapter.ts +34 -0
- package/src/apps/mpp/internal/Policy.test.ts +86 -31
- package/src/apps/mpp/internal/Policy.ts +49 -7
- package/src/apps/mpp/internal/Sponsorship.test.ts +207 -0
- package/src/apps/mpp/internal/Sponsorship.ts +9 -3
- package/src/apps/relay/App.test.ts +1024 -38
- package/src/apps/relay/App.ts +228 -32
- package/src/apps/relay/App.zone-billing.test.ts +257 -0
- package/src/apps/relay/Sponsorships.test.ts +67 -4
- package/src/apps/relay/Sponsorships.ts +253 -29
- package/src/apps/relay/Sponsorships.zone.test.ts +102 -0
- package/src/apps/{funding → routes}/Access.ts +6 -6
- package/src/apps/routes/App.test.ts +165 -0
- package/src/apps/routes/App.ts +96 -0
- package/src/apps/{funding → routes}/Inventory.ts +2 -2
- package/src/apps/routes/index.ts +1 -0
- package/src/apps/{funding → routes}/routes/chains.test.ts +66 -66
- package/src/apps/{funding → routes}/routes/chains.ts +23 -23
- package/src/apps/{funding → routes}/routes/deposit-addresses.test.ts +1362 -462
- package/src/apps/{funding → routes}/routes/deposit-addresses.ts +568 -248
- package/src/apps/{funding → routes}/routes/providers.test.ts +27 -33
- package/src/apps/{funding → routes}/routes/providers.ts +23 -23
- package/src/apps/{funding → routes}/routes/quotes.test.ts +298 -41
- package/src/apps/{funding → routes}/routes/quotes.ts +57 -40
- package/src/apps/routes/routes/transfers.test.ts +2876 -0
- package/src/apps/routes/routes/transfers.ts +1332 -0
- package/src/cli/Cli.test.ts +1 -1
- package/src/cli/commands/admin.test.ts +748 -1
- package/src/cli/commands/admin.ts +278 -0
- package/src/cloudflare.ts +52 -47
- package/src/db/Db.test.ts +245 -2
- package/src/db/Db.ts +1511 -34
- package/src/db/Schema.ts +744 -228
- package/src/db/tables/apiKeyAdmissionBootstraps.ts +4 -0
- package/src/db/tables/apiKeyAdmissions.ts +218 -0
- package/src/db/tables/apiKeyOwnerAdmissions.ts +4 -0
- package/src/db/tables/apiKeyOwnerTombstones.ts +81 -0
- package/src/db/tables/apiKeyRevocations.test.ts +74 -0
- package/src/db/tables/apiKeyRevocations.ts +121 -0
- package/src/db/tables/authAccounts.ts +105 -0
- package/src/db/tables/authSessions.ts +13 -0
- package/src/db/tables/authVerifications.ts +13 -0
- package/src/db/tables/invitations.ts +142 -45
- package/src/db/tables/memberships.ts +79 -3
- package/src/db/tables/organizations.test.ts +725 -7
- package/src/db/tables/organizations.ts +182 -49
- package/src/db/tables/projects.test.ts +71 -0
- package/src/db/tables/projects.ts +59 -4
- package/src/db/tables/requestUsage.ts +4 -1
- package/src/db/tables/rewardAccounts.ts +178 -0
- package/src/db/tables/rewardCampaignDistributors.ts +68 -0
- package/src/db/tables/rewardCampaigns.test.ts +1388 -0
- package/src/db/tables/rewardCampaigns.ts +647 -0
- package/src/db/tables/rewardCredits.ts +110 -0
- package/src/db/tables/rewardEligibilityAssociations.test.ts +271 -0
- package/src/db/tables/rewardEligibilityAssociations.ts +184 -0
- package/src/db/tables/rewardRuns.ts +514 -0
- package/src/db/tables/rewardTransactionAttempts.ts +272 -0
- package/src/db/tables/routesCatalog.test.ts +185 -0
- package/src/db/tables/routesCatalog.ts +163 -0
- package/src/db/tables/routesDepositAddresses.test.ts +1048 -0
- package/src/db/tables/routesDepositAddresses.ts +1008 -0
- package/src/db/tables/{fundingDepositRequestObservations.test.ts → routesDepositRequestObservations.test.ts} +13 -14
- package/src/db/tables/{fundingDepositRequestObservations.ts → routesDepositRequestObservations.ts} +10 -10
- package/src/db/tables/{fundingDeposits.test.ts → routesDeposits.test.ts} +316 -46
- package/src/db/tables/routesDeposits.ts +1062 -0
- package/src/db/tables/routesIdempotency.test.ts +796 -0
- package/src/db/tables/routesIdempotency.ts +496 -0
- package/src/db/tables/routesSubsidies.test.ts +120 -0
- package/src/db/tables/routesSubsidies.ts +71 -0
- package/src/db/tables/{fundingTransferEvents.ts → routesTransferEvents.ts} +4 -4
- package/src/db/tables/routesTransferSubsidies.ts +38 -0
- package/src/db/tables/routesTransferSubsidyNonces.ts +124 -0
- package/src/db/tables/routesTransferTransactions.test.ts +195 -0
- package/src/db/tables/routesTransferTransactions.ts +158 -0
- package/src/db/tables/routesTransfers.test.ts +338 -0
- package/src/db/tables/routesTransfers.ts +662 -0
- package/src/db/tables/sponsoredTransactions.test.ts +563 -1
- package/src/db/tables/sponsoredTransactions.ts +386 -42
- package/src/db/tables/sponsorshipAttributions.test.ts +160 -0
- package/src/db/tables/sponsorshipAttributions.ts +168 -0
- package/src/db/tables/sponsorshipReconciliationCursors.test.ts +115 -0
- package/src/db/tables/sponsorshipReconciliationCursors.ts +67 -0
- package/src/db/tables/stripeCustomers.test.ts +85 -0
- package/src/db/tables/stripeCustomers.ts +24 -0
- package/src/db/tables/users.test.ts +129 -0
- package/src/db/tables/users.ts +49 -3
- package/src/db/tables/webhookQueueEvents.ts +8 -1
- package/src/db/tables/webhookSubscriptions.ts +103 -21
- package/src/handlers/internal/executionError.ts +3 -4
- package/src/handlers/internal/multisig.ts +13 -816
- package/src/handlers/internal/sponsorship.ts +26 -10
- package/src/handlers/relay.test-d.ts +9 -1
- package/src/handlers/relay.test.ts +823 -3
- package/src/handlers/relay.ts +127 -107
- package/src/index.test-d.ts +7 -0
- package/src/index.ts +0 -17
- package/src/internal/AssetResponse.ts +26 -0
- package/src/internal/Auth.test.ts +1564 -9
- package/src/internal/Auth.ts +833 -239
- package/src/internal/BetterAuth.test.ts +242 -0
- package/src/internal/BetterAuth.ts +349 -0
- package/src/internal/Cache.ts +2 -0
- package/src/internal/EarnRates.test.ts +17 -0
- package/src/internal/EarnRates.ts +124 -31
- package/src/internal/EarnSharePrices.test.ts +182 -0
- package/src/internal/EarnSharePrices.ts +313 -0
- package/src/internal/EarnVaults.test.ts +21 -0
- package/src/internal/EarnVaults.ts +37 -15
- package/src/internal/Email.ts +54 -0
- package/src/internal/Idempotency.test.ts +2 -2
- package/src/internal/Log.test-d.ts +10 -7
- package/src/internal/Log.test.ts +114 -16
- package/src/internal/Log.ts +55 -40
- package/src/internal/MetricSink.test.ts +313 -26
- package/src/internal/MetricSink.ts +73 -8
- package/src/internal/Mpp.test.ts +31 -0
- package/src/internal/Mpp.ts +21 -24
- package/src/internal/OpenApi.ts +45 -12
- package/src/internal/Provider.test.ts +1 -1
- package/src/internal/Provider.ts +1 -1
- package/src/internal/RateLimit.test.ts +21 -3
- package/src/internal/RateLimit.ts +12 -1
- package/src/internal/Store.test-d.ts +1 -1
- package/src/internal/Store.test.ts +151 -8
- package/src/internal/Store.ts +76 -9
- package/src/internal/Tidx.test.ts +59 -8
- package/src/internal/Tidx.ts +86 -14
- package/src/internal/Timing.test.ts +77 -0
- package/src/internal/Timing.ts +83 -6
- package/src/internal/VercelOidc.test.ts +188 -0
- package/src/internal/VercelOidc.ts +193 -0
- package/src/internal/VerifiedTokens.test.ts +60 -6
- package/src/internal/VerifiedTokens.ts +21 -24
- package/src/internal/Viem.batch.test.ts +80 -0
- package/src/internal/Viem.test.ts +201 -2
- package/src/internal/Viem.ts +249 -17
- package/src/internal/Webhooks.test.ts +125 -1
- package/src/internal/Webhooks.ts +22 -4
- package/src/internal/ZoneRpc.ts +50 -0
- package/src/internal/exchange/Provider.test.ts +2 -2
- package/src/internal/index.test.ts +3 -1
- package/src/internal/index.ts +3 -1
- package/src/internal/rewards/Audit.ts +231 -0
- package/src/internal/rewards/Campaigns.test.ts +1234 -0
- package/src/internal/rewards/Campaigns.ts +1205 -0
- package/src/internal/rewards/Credits.ts +165 -0
- package/src/internal/rewards/Events.local.test.ts +113 -0
- package/src/internal/rewards/Events.test.ts +152 -0
- package/src/internal/rewards/Events.ts +468 -0
- package/src/internal/rewards/Projection.test.ts +681 -0
- package/src/internal/rewards/Projection.ts +987 -0
- package/src/internal/rewards/Rates.test.ts +171 -0
- package/src/internal/rewards/Rates.ts +110 -0
- package/src/internal/rewards/Read.test.ts +501 -0
- package/src/internal/rewards/Read.ts +476 -0
- package/src/internal/rewards/Runner.checkpoint.test.ts +80 -0
- package/src/internal/rewards/Runner.states.test.ts +188 -0
- package/src/internal/rewards/Runner.test.ts +90 -0
- package/src/internal/rewards/Runner.ts +2229 -0
- package/src/internal/rewards/Signer.test.ts +79 -0
- package/src/internal/rewards/Signer.ts +180 -0
- package/src/internal/rewards/index.ts +14 -0
- package/src/internal/{funding → routes}/Action.test.ts +63 -14
- package/src/internal/{funding → routes}/Action.ts +35 -8
- package/src/internal/{funding → routes}/Catalog.test.ts +3 -3
- package/src/internal/{funding → routes}/Catalog.ts +39 -39
- package/src/internal/{funding → routes}/Chain.test.ts +1 -1
- package/src/internal/{funding → routes}/Chain.ts +11 -11
- package/src/internal/{funding → routes}/Deposit.test.ts +1 -1
- package/src/internal/{funding → routes}/Deposit.ts +93 -45
- package/src/internal/{funding → routes}/DepositAddress.test.ts +11 -3
- package/src/internal/{funding → routes}/DepositAddress.ts +132 -53
- package/src/internal/{funding → routes}/DepositWebhook.test.ts +61 -18
- package/src/internal/{funding → routes}/DepositWebhook.ts +9 -8
- package/src/internal/routes/Economics.test.ts +42 -0
- package/src/internal/routes/Economics.ts +47 -0
- package/src/internal/{funding → routes}/Evidence.test.ts +6 -6
- package/src/internal/{funding → routes}/Evidence.ts +11 -22
- package/src/internal/routes/Observability.test.ts +636 -0
- package/src/internal/routes/Observability.ts +668 -0
- package/src/internal/{funding → routes}/Provider.test.ts +489 -153
- package/src/internal/{funding → routes}/Provider.ts +531 -185
- package/src/internal/{funding → routes}/Reconciliation.local.test.ts +84 -12
- package/src/internal/{funding → routes}/Reconciliation.test.ts +1213 -279
- package/src/internal/{funding → routes}/Reconciliation.ts +501 -203
- package/src/internal/routes/Reconciliation.unattributed.test.ts +250 -0
- package/src/internal/{funding → routes}/Route.ts +7 -7
- package/src/internal/{funding → routes}/SourceObservation.test.ts +13 -14
- package/src/internal/{funding → routes}/SourceObservation.ts +18 -22
- package/src/internal/{funding → routes}/Subsidy.local.test.ts +7 -7
- package/src/internal/routes/Subsidy.test.ts +169 -0
- package/src/internal/{funding → routes}/Subsidy.ts +86 -6
- package/src/internal/{funding → routes}/Token.test.ts +1 -1
- package/src/internal/{funding → routes}/Token.ts +5 -5
- package/src/internal/routes/Transfer.test.ts +1199 -0
- package/src/internal/routes/Transfer.ts +1206 -0
- package/src/internal/routes/TransferReconciliation.test.ts +731 -0
- package/src/internal/routes/TransferReconciliation.ts +527 -0
- package/src/internal/routes/TransferSubsidy.test.ts +172 -0
- package/src/internal/routes/TransferSubsidy.ts +447 -0
- package/src/internal/routes/TransferWebhook.test.ts +128 -0
- package/src/internal/routes/TransferWebhook.ts +67 -0
- package/src/internal/{funding → routes}/index.test.ts +6 -3
- package/src/internal/{funding → routes}/index.ts +3 -0
- package/src/internal/{funding → routes}/providers/across.ts +16 -16
- package/src/internal/{funding → routes}/providers/index.test.ts +157 -44
- package/src/internal/{funding → routes}/providers/relay.test.ts +165 -32
- package/src/internal/{funding → routes}/providers/relay.ts +231 -136
- package/src/internal/{funding → routes}/providers/rhino.ts +16 -16
- package/src/internal/{funding → routes}/providers/squid.ts +17 -17
- package/src/internal/routes/providers/stargate.test.ts +728 -0
- package/src/internal/routes/providers/stargate.ts +1276 -0
- package/src/internal/{funding → routes}/providers/symbiosis.ts +64 -24
- package/src/internal/webhookDestinations/slack.ts +20 -5
- package/src/providers/index.ts +13 -13
- package/src/server.ts +18 -0
- package/dist/apps/funding/Access.d.ts.map +0 -1
- package/dist/apps/funding/Access.js.map +0 -1
- package/dist/apps/funding/App.js.map +0 -1
- package/dist/apps/funding/Inventory.d.ts.map +0 -1
- package/dist/apps/funding/Inventory.js.map +0 -1
- package/dist/apps/funding/ProviderAttempts.d.ts +0 -5
- package/dist/apps/funding/ProviderAttempts.d.ts.map +0 -1
- package/dist/apps/funding/ProviderAttempts.js +0 -24
- package/dist/apps/funding/ProviderAttempts.js.map +0 -1
- package/dist/apps/funding/index.d.ts +0 -2
- package/dist/apps/funding/index.d.ts.map +0 -1
- package/dist/apps/funding/index.js +0 -2
- package/dist/apps/funding/index.js.map +0 -1
- package/dist/apps/funding/routes/chains.d.ts.map +0 -1
- package/dist/apps/funding/routes/chains.js.map +0 -1
- package/dist/apps/funding/routes/deposit-addresses.d.ts.map +0 -1
- package/dist/apps/funding/routes/deposit-addresses.js.map +0 -1
- package/dist/apps/funding/routes/providers.d.ts.map +0 -1
- package/dist/apps/funding/routes/providers.js +0 -57
- package/dist/apps/funding/routes/providers.js.map +0 -1
- package/dist/apps/funding/routes/quotes.d.ts.map +0 -1
- package/dist/apps/funding/routes/quotes.js.map +0 -1
- package/dist/apps/funding/routes/transfers.d.ts.map +0 -1
- package/dist/apps/funding/routes/transfers.js +0 -622
- package/dist/apps/funding/routes/transfers.js.map +0 -1
- package/dist/db/tables/fundingCatalog.d.ts +0 -58
- package/dist/db/tables/fundingCatalog.d.ts.map +0 -1
- package/dist/db/tables/fundingCatalog.js.map +0 -1
- package/dist/db/tables/fundingDepositAddresses.d.ts +0 -192
- package/dist/db/tables/fundingDepositAddresses.d.ts.map +0 -1
- package/dist/db/tables/fundingDepositAddresses.js +0 -235
- package/dist/db/tables/fundingDepositAddresses.js.map +0 -1
- package/dist/db/tables/fundingDepositRequestObservations.d.ts.map +0 -1
- package/dist/db/tables/fundingDepositRequestObservations.js.map +0 -1
- package/dist/db/tables/fundingDeposits.d.ts.map +0 -1
- package/dist/db/tables/fundingDeposits.js +0 -295
- package/dist/db/tables/fundingDeposits.js.map +0 -1
- package/dist/db/tables/fundingIdempotency.d.ts +0 -91
- package/dist/db/tables/fundingIdempotency.d.ts.map +0 -1
- package/dist/db/tables/fundingIdempotency.js +0 -103
- package/dist/db/tables/fundingIdempotency.js.map +0 -1
- package/dist/db/tables/fundingTransferEvents.d.ts.map +0 -1
- package/dist/db/tables/fundingTransferEvents.js.map +0 -1
- package/dist/db/tables/fundingTransferTransactions.d.ts +0 -15
- package/dist/db/tables/fundingTransferTransactions.d.ts.map +0 -1
- package/dist/db/tables/fundingTransferTransactions.js +0 -27
- package/dist/db/tables/fundingTransferTransactions.js.map +0 -1
- package/dist/db/tables/fundingTransfers.d.ts +0 -82
- package/dist/db/tables/fundingTransfers.d.ts.map +0 -1
- package/dist/db/tables/fundingTransfers.js +0 -89
- package/dist/db/tables/fundingTransfers.js.map +0 -1
- package/dist/internal/funding/Action.d.ts.map +0 -1
- package/dist/internal/funding/Action.js.map +0 -1
- package/dist/internal/funding/Catalog.d.ts.map +0 -1
- package/dist/internal/funding/Catalog.js.map +0 -1
- package/dist/internal/funding/Chain.d.ts.map +0 -1
- package/dist/internal/funding/Chain.js.map +0 -1
- package/dist/internal/funding/Deposit.d.ts.map +0 -1
- package/dist/internal/funding/Deposit.js.map +0 -1
- package/dist/internal/funding/DepositAddress.d.ts.map +0 -1
- package/dist/internal/funding/DepositAddress.js.map +0 -1
- package/dist/internal/funding/DepositWebhook.d.ts.map +0 -1
- package/dist/internal/funding/DepositWebhook.js.map +0 -1
- package/dist/internal/funding/Evidence.d.ts.map +0 -1
- package/dist/internal/funding/Evidence.js.map +0 -1
- package/dist/internal/funding/Provider.d.ts.map +0 -1
- package/dist/internal/funding/Provider.js.map +0 -1
- package/dist/internal/funding/Reconciliation.d.ts.map +0 -1
- package/dist/internal/funding/Reconciliation.js.map +0 -1
- package/dist/internal/funding/Route.d.ts +0 -21
- package/dist/internal/funding/Route.d.ts.map +0 -1
- package/dist/internal/funding/Route.js.map +0 -1
- package/dist/internal/funding/SourceObservation.d.ts.map +0 -1
- package/dist/internal/funding/SourceObservation.js.map +0 -1
- package/dist/internal/funding/Subsidy.d.ts.map +0 -1
- package/dist/internal/funding/Subsidy.js.map +0 -1
- package/dist/internal/funding/Token.d.ts.map +0 -1
- package/dist/internal/funding/Token.js.map +0 -1
- package/dist/internal/funding/Transfer.d.ts.map +0 -1
- package/dist/internal/funding/Transfer.js +0 -334
- package/dist/internal/funding/Transfer.js.map +0 -1
- package/dist/internal/funding/index.d.ts.map +0 -1
- package/dist/internal/funding/index.js.map +0 -1
- package/dist/internal/funding/providers/across.d.ts.map +0 -1
- package/dist/internal/funding/providers/across.js.map +0 -1
- package/dist/internal/funding/providers/relay.d.ts.map +0 -1
- package/dist/internal/funding/providers/relay.js.map +0 -1
- package/dist/internal/funding/providers/rhino.d.ts.map +0 -1
- package/dist/internal/funding/providers/rhino.js.map +0 -1
- package/dist/internal/funding/providers/squid.d.ts.map +0 -1
- package/dist/internal/funding/providers/squid.js.map +0 -1
- package/dist/internal/funding/providers/stargate.d.ts +0 -38
- package/dist/internal/funding/providers/stargate.d.ts.map +0 -1
- package/dist/internal/funding/providers/stargate.js +0 -277
- package/dist/internal/funding/providers/stargate.js.map +0 -1
- package/dist/internal/funding/providers/symbiosis.d.ts.map +0 -1
- package/dist/internal/funding/providers/symbiosis.js.map +0 -1
- package/src/apps/funding/App.test.ts +0 -78
- package/src/apps/funding/App.ts +0 -78
- package/src/apps/funding/ProviderAttempts.ts +0 -26
- package/src/apps/funding/index.ts +0 -1
- package/src/apps/funding/routes/transfers.test.ts +0 -1638
- package/src/apps/funding/routes/transfers.ts +0 -721
- package/src/db/tables/fundingCatalog.test.ts +0 -122
- package/src/db/tables/fundingCatalog.ts +0 -163
- package/src/db/tables/fundingDepositAddresses.test.ts +0 -608
- package/src/db/tables/fundingDepositAddresses.ts +0 -443
- package/src/db/tables/fundingDeposits.ts +0 -572
- package/src/db/tables/fundingIdempotency.test.ts +0 -182
- package/src/db/tables/fundingIdempotency.ts +0 -180
- package/src/db/tables/fundingTransferTransactions.test.ts +0 -69
- package/src/db/tables/fundingTransferTransactions.ts +0 -37
- package/src/db/tables/fundingTransfers.test.ts +0 -89
- package/src/db/tables/fundingTransfers.ts +0 -153
- package/src/handlers/internal/multisig.test.ts +0 -818
- package/src/internal/funding/Subsidy.test.ts +0 -75
- package/src/internal/funding/Transfer.test.ts +0 -369
- package/src/internal/funding/Transfer.ts +0 -545
- package/src/internal/funding/providers/stargate.test.ts +0 -163
- package/src/internal/funding/providers/stargate.ts +0 -409
- /package/dist/apps/{funding → routes}/Inventory.d.ts +0 -0
- /package/src/internal/{funding → routes}/Route.test.ts +0 -0
|
@@ -5,17 +5,19 @@ import * as core_Provider from '../Provider.js'
|
|
|
5
5
|
import * as OpenApi from '../OpenApi.js'
|
|
6
6
|
import * as Schema from '../Schema.js'
|
|
7
7
|
import * as Value from '../Value.js'
|
|
8
|
+
import * as Viem from '../Viem.js'
|
|
8
9
|
import * as Action from './Action.js'
|
|
9
10
|
import type * as core_Catalog from './Catalog.js'
|
|
10
11
|
import type * as core_Chain from './Chain.js'
|
|
12
|
+
import * as Economics from './Economics.js'
|
|
11
13
|
import type * as core_Route from './Route.js'
|
|
12
14
|
import type * as core_Token from './Token.js'
|
|
13
15
|
import type * as Transfer from './Transfer.js'
|
|
14
16
|
|
|
15
|
-
/**
|
|
17
|
+
/** Destination token used when the caller omits `destinationToken`. */
|
|
16
18
|
const defaultDestinationToken = 'usdce'
|
|
17
19
|
|
|
18
|
-
/**
|
|
20
|
+
/** Route provider schemas. */
|
|
19
21
|
export namespace schema {
|
|
20
22
|
/** Bounded upstream error code safe for structured logs. */
|
|
21
23
|
export const ErrorCode = z.string().check(z.regex(/^[A-Za-z0-9_.:-]{1,64}$/))
|
|
@@ -36,13 +38,13 @@ export namespace schema {
|
|
|
36
38
|
type: z.optional(z.string()),
|
|
37
39
|
})
|
|
38
40
|
|
|
39
|
-
/** Positive decimal amount accepted by
|
|
41
|
+
/** Positive decimal amount accepted by route quote requests. */
|
|
40
42
|
export const PositiveDecimal = z.string().check(z.regex(/^(?=.*[1-9])\d+(\.\d+)?$/))
|
|
41
43
|
|
|
42
|
-
/** Positive base-unit amount accepted by
|
|
44
|
+
/** Positive base-unit amount accepted by route quote requests. */
|
|
43
45
|
export const PositiveInteger = z.string().check(z.regex(/^(?=.*[1-9])\d+$/))
|
|
44
46
|
|
|
45
|
-
/** Normalized chain reference passed to
|
|
47
|
+
/** Normalized chain reference passed to route providers. */
|
|
46
48
|
export const ChainRef = OpenApi.component(
|
|
47
49
|
Schema.describe(
|
|
48
50
|
z.object({
|
|
@@ -63,12 +65,12 @@ export namespace schema {
|
|
|
63
65
|
.string()
|
|
64
66
|
.check(z.describe('Human-readable chain name.'), z.meta({ examples: ['Base'] })),
|
|
65
67
|
}),
|
|
66
|
-
'A normalized chain reference for
|
|
68
|
+
'A normalized chain reference for route quotes.',
|
|
67
69
|
),
|
|
68
|
-
'
|
|
70
|
+
'RoutesChain',
|
|
69
71
|
)
|
|
70
72
|
|
|
71
|
-
/** Normalized token reference passed to
|
|
73
|
+
/** Normalized token reference passed to route providers. */
|
|
72
74
|
export const TokenRef = OpenApi.component(
|
|
73
75
|
Schema.describe(
|
|
74
76
|
z.object({
|
|
@@ -113,16 +115,16 @@ export namespace schema {
|
|
|
113
115
|
verified: z
|
|
114
116
|
.boolean()
|
|
115
117
|
.check(
|
|
116
|
-
z.describe('Whether Tempo recognizes this token in its
|
|
118
|
+
z.describe('Whether Tempo recognizes this token in its route quote inventory.'),
|
|
117
119
|
z.meta({ examples: [true] }),
|
|
118
120
|
),
|
|
119
121
|
}),
|
|
120
|
-
'A normalized token reference for
|
|
122
|
+
'A normalized token reference for route quotes.',
|
|
121
123
|
),
|
|
122
|
-
'
|
|
124
|
+
'RoutesToken',
|
|
123
125
|
)
|
|
124
126
|
|
|
125
|
-
/** Provider identity embedded in
|
|
127
|
+
/** Provider identity embedded in route resources. */
|
|
126
128
|
export const ProviderRef = OpenApi.component(
|
|
127
129
|
Schema.describe(
|
|
128
130
|
z.object({
|
|
@@ -131,12 +133,31 @@ export namespace schema {
|
|
|
131
133
|
.string()
|
|
132
134
|
.check(z.describe('Human-readable provider name.'), z.meta({ examples: ['Relay'] })),
|
|
133
135
|
}),
|
|
134
|
-
'Provider metadata embedded in a
|
|
136
|
+
'Provider metadata embedded in a route quote.',
|
|
135
137
|
),
|
|
136
|
-
'
|
|
138
|
+
'RoutesProvider',
|
|
137
139
|
)
|
|
138
140
|
|
|
139
|
-
/**
|
|
141
|
+
/** One token amount paid by a subsidy provider. */
|
|
142
|
+
export const Subsidy = OpenApi.component(
|
|
143
|
+
Schema.describe(
|
|
144
|
+
z.object({
|
|
145
|
+
amount: Schema.TokenAmount,
|
|
146
|
+
provider: z
|
|
147
|
+
.string()
|
|
148
|
+
.check(
|
|
149
|
+
z.minLength(1),
|
|
150
|
+
z.describe('Stable id of the subsidy provider.'),
|
|
151
|
+
z.meta({ examples: ['relay'] }),
|
|
152
|
+
),
|
|
153
|
+
token: TokenRef,
|
|
154
|
+
}),
|
|
155
|
+
'One token amount paid on behalf of the deposit recipient.',
|
|
156
|
+
),
|
|
157
|
+
'RoutesSubsidy',
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
/** Source amount unit accepted by a route quote request. */
|
|
140
161
|
export const SourceAmountUnits = z
|
|
141
162
|
._default(z.enum(['baseUnits', 'decimal']), 'baseUnits')
|
|
142
163
|
.check(
|
|
@@ -144,22 +165,30 @@ export namespace schema {
|
|
|
144
165
|
z.meta({ examples: ['baseUnits', 'decimal'] }),
|
|
145
166
|
)
|
|
146
167
|
|
|
147
|
-
/** Normalized caller request passed to
|
|
168
|
+
/** Normalized caller request passed to route providers. */
|
|
148
169
|
export const QuoteRequest = z
|
|
149
170
|
.strictObject({
|
|
171
|
+
destinationChain: z
|
|
172
|
+
.optional(z.string().check(z.minLength(1)))
|
|
173
|
+
.check(
|
|
174
|
+
z.describe('Destination chain CAIP-2 id, slug, or alias. Defaults to Tempo.'),
|
|
175
|
+
z.meta({ examples: ['tempo', 'base', 'ethereum', 'eip155:4217'] }),
|
|
176
|
+
),
|
|
150
177
|
destinationToken: z
|
|
151
178
|
.optional(z.string())
|
|
152
179
|
.check(
|
|
153
|
-
z.describe(
|
|
154
|
-
|
|
180
|
+
z.describe(
|
|
181
|
+
'Destination token symbol, address, or token key. Defaults to USDC.e for Tempo destinations.',
|
|
182
|
+
),
|
|
183
|
+
z.meta({ examples: ['usdc.e', 'usdc'] }),
|
|
155
184
|
),
|
|
156
185
|
provider: z
|
|
157
186
|
.optional(z.string().check(z.minLength(1)))
|
|
158
187
|
.check(
|
|
159
188
|
z.describe(
|
|
160
|
-
'Only request a quote from this provider. Use an id returned by the
|
|
189
|
+
'Only request a quote from this provider. Use an id returned by the route providers endpoint, or omit it to query every available provider.',
|
|
161
190
|
),
|
|
162
|
-
z.meta({ examples: ['relay'] }),
|
|
191
|
+
z.meta({ examples: ['relay', 'stargate'] }),
|
|
163
192
|
),
|
|
164
193
|
sourceAmount: PositiveDecimal.check(
|
|
165
194
|
z.describe('Positive source token amount. Base units by default, so 1 USDC is `1000000`.'),
|
|
@@ -173,19 +202,19 @@ export namespace schema {
|
|
|
173
202
|
z.describe(
|
|
174
203
|
'Source chain alias or stable id, such as `base`, `solana`, or `eip155:8453`.',
|
|
175
204
|
),
|
|
176
|
-
z.meta({ examples: ['base', 'eip155:8453'] }),
|
|
205
|
+
z.meta({ examples: ['base', 'ethereum', 'tempo', 'eip155:8453'] }),
|
|
177
206
|
),
|
|
178
|
-
sourceToken: z
|
|
179
|
-
.
|
|
180
|
-
.
|
|
181
|
-
|
|
182
|
-
z.describe(
|
|
183
|
-
'Source token symbol, contract address, or Tempo token key. Lookup is scoped to `sourceChain`; non-EVM addresses are case-sensitive. An unknown token returns an empty list.',
|
|
184
|
-
),
|
|
185
|
-
z.meta({ examples: ['usdc', '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913'] }),
|
|
207
|
+
sourceToken: z.string().check(
|
|
208
|
+
z.minLength(1),
|
|
209
|
+
z.describe(
|
|
210
|
+
'Source token symbol, contract address, or Tempo token key. Lookup is scoped to `sourceChain`; non-EVM addresses are case-sensitive. An unknown token returns an empty list.',
|
|
186
211
|
),
|
|
212
|
+
z.meta({
|
|
213
|
+
examples: ['usdc', 'usdce', '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913'],
|
|
214
|
+
}),
|
|
215
|
+
),
|
|
187
216
|
})
|
|
188
|
-
.check(z.describe('Query parameters for live
|
|
217
|
+
.check(z.describe('Query parameters for live route quotes.'))
|
|
189
218
|
|
|
190
219
|
/** Provider-specific quote status for the requested amount. */
|
|
191
220
|
export const QuoteStatus = z.enum(['available', 'thin', 'unknown', 'unavailable'])
|
|
@@ -193,7 +222,7 @@ export namespace schema {
|
|
|
193
222
|
/** Machine-readable provider quote quality tier. */
|
|
194
223
|
export const QualityTier = z.enum(['liquid', 'thin', 'unknown', 'unavailable'])
|
|
195
224
|
|
|
196
|
-
/** Quote data returned by a
|
|
225
|
+
/** Quote data returned by a route provider. */
|
|
197
226
|
export const GetQuoteResult = Schema.describe(
|
|
198
227
|
z.object({
|
|
199
228
|
expiresAt: z.optional(z.iso.datetime()),
|
|
@@ -210,10 +239,10 @@ export namespace schema {
|
|
|
210
239
|
sampledAt: z.iso.datetime(),
|
|
211
240
|
status: QuoteStatus,
|
|
212
241
|
}),
|
|
213
|
-
'Quote data returned by a
|
|
242
|
+
'Quote data returned by a route provider.',
|
|
214
243
|
)
|
|
215
244
|
|
|
216
|
-
/** Executable preparation returned by a
|
|
245
|
+
/** Executable preparation returned by a route provider. */
|
|
217
246
|
export const PrepareResult = z.object({
|
|
218
247
|
action: Action.schema.Action,
|
|
219
248
|
correlation: z.optional(
|
|
@@ -232,11 +261,12 @@ export namespace schema {
|
|
|
232
261
|
token: z.optional(TokenRef),
|
|
233
262
|
}),
|
|
234
263
|
),
|
|
264
|
+
providerState: z.optional(z.record(z.string(), z.unknown())),
|
|
235
265
|
quality: GetQuoteResult.shape.quality,
|
|
236
266
|
sampledAt: z.iso.datetime(),
|
|
237
267
|
})
|
|
238
268
|
|
|
239
|
-
/** Reusable deposit address provisioned by a
|
|
269
|
+
/** Reusable deposit address provisioned by a route provider. */
|
|
240
270
|
export const DepositAddressResult = z
|
|
241
271
|
.object({
|
|
242
272
|
address: z
|
|
@@ -269,6 +299,7 @@ export namespace schema {
|
|
|
269
299
|
refundAmountExpected: z.optional(z.string().check(z.regex(/^\d+$/))),
|
|
270
300
|
refundTransactionHashes: z.array(z.string()),
|
|
271
301
|
sourceTransactionHashes: z.array(z.string()),
|
|
302
|
+
subsidy: z.optional(Subsidy),
|
|
272
303
|
status: z.string().check(z.minLength(1)),
|
|
273
304
|
updatedAt: z.iso.datetime(),
|
|
274
305
|
})
|
|
@@ -279,8 +310,8 @@ export namespace schema {
|
|
|
279
310
|
requests: z.array(DepositAddressRequest),
|
|
280
311
|
})
|
|
281
312
|
|
|
282
|
-
/** Quote quality signals exposed to
|
|
283
|
-
export const
|
|
313
|
+
/** Quote quality signals exposed to routes API callers. */
|
|
314
|
+
export const RoutesQuoteQuality = OpenApi.component(
|
|
284
315
|
Schema.describe(
|
|
285
316
|
z.object({
|
|
286
317
|
estimatedSeconds: z
|
|
@@ -289,18 +320,6 @@ export namespace schema {
|
|
|
289
320
|
z.describe('Estimated settlement time in seconds, when known.'),
|
|
290
321
|
z.meta({ examples: [2] }),
|
|
291
322
|
),
|
|
292
|
-
liquiditySource: z
|
|
293
|
-
.string()
|
|
294
|
-
.check(
|
|
295
|
-
z.describe('Provider source for the live quote quality signal.'),
|
|
296
|
-
z.meta({ examples: ['providerQuote'] }),
|
|
297
|
-
),
|
|
298
|
-
sourceDetail: z
|
|
299
|
-
.optional(z.string())
|
|
300
|
-
.check(
|
|
301
|
-
z.describe('Provider-specific source or endpoint detail for the quality signal.'),
|
|
302
|
-
z.meta({ examples: ['providerEndpoint'] }),
|
|
303
|
-
),
|
|
304
323
|
tier: z
|
|
305
324
|
.enum(['liquid', 'thin'])
|
|
306
325
|
.check(
|
|
@@ -308,12 +327,12 @@ export namespace schema {
|
|
|
308
327
|
z.meta({ examples: ['liquid'] }),
|
|
309
328
|
),
|
|
310
329
|
}),
|
|
311
|
-
'Machine-readable
|
|
330
|
+
'Machine-readable quality and settlement-time signals for a successful quote.',
|
|
312
331
|
),
|
|
313
|
-
'
|
|
332
|
+
'RoutesQuoteQuality',
|
|
314
333
|
)
|
|
315
334
|
|
|
316
|
-
/** Provider quote freshness data exposed to
|
|
335
|
+
/** Provider quote freshness data exposed to routes API callers. */
|
|
317
336
|
export const QuoteDetails = OpenApi.component(
|
|
318
337
|
Schema.describe(
|
|
319
338
|
z.object({
|
|
@@ -330,16 +349,18 @@ export namespace schema {
|
|
|
330
349
|
z.meta({ examples: ['2026-01-01T00:00:00Z'] }),
|
|
331
350
|
),
|
|
332
351
|
}),
|
|
333
|
-
'Freshness data for a provider
|
|
352
|
+
'Freshness data for a provider route quote.',
|
|
334
353
|
),
|
|
335
|
-
'
|
|
354
|
+
'RoutesQuoteDetails',
|
|
336
355
|
)
|
|
337
356
|
|
|
338
|
-
/** Successful normalized
|
|
339
|
-
export const
|
|
357
|
+
/** Successful normalized route quote returned to callers. */
|
|
358
|
+
export const RoutesQuote = OpenApi.component(
|
|
340
359
|
Schema.describe(
|
|
341
360
|
z.object({
|
|
342
|
-
destinationAmount: Schema.TokenAmount.check(
|
|
361
|
+
destinationAmount: Schema.TokenAmount.check(
|
|
362
|
+
z.describe('Expected amount received after provider deductions, including pool fees.'),
|
|
363
|
+
),
|
|
343
364
|
destinationAmountMin: z
|
|
344
365
|
.optional(Schema.TokenAmount)
|
|
345
366
|
.check(
|
|
@@ -347,36 +368,34 @@ export namespace schema {
|
|
|
347
368
|
'Provider-derived minimum destination amount. Symbiosis and Squid quotes use a fixed 1% slippage tolerance.',
|
|
348
369
|
),
|
|
349
370
|
),
|
|
350
|
-
destinationChain: ChainRef.check(
|
|
351
|
-
|
|
352
|
-
),
|
|
353
|
-
destinationToken: TokenRef.check(z.describe('Tempo token expected from this quote.')),
|
|
371
|
+
destinationChain: ChainRef.check(z.describe('Chain that receives the routed token.')),
|
|
372
|
+
destinationToken: TokenRef.check(z.describe('Token expected from this quote.')),
|
|
354
373
|
id: z
|
|
355
374
|
.string()
|
|
356
375
|
.check(
|
|
357
|
-
z.describe('Stable deterministic
|
|
376
|
+
z.describe('Stable deterministic route quote id.'),
|
|
358
377
|
z.meta({ examples: ['base-usdc-tempo-usdce-relay'] }),
|
|
359
378
|
),
|
|
360
379
|
provider: ProviderRef,
|
|
361
|
-
quality:
|
|
380
|
+
quality: RoutesQuoteQuality,
|
|
362
381
|
quote: QuoteDetails,
|
|
363
382
|
sourceAmount: Schema.TokenAmount,
|
|
364
383
|
sourceChain: ChainRef.check(z.describe('Chain where the caller currently holds funds.')),
|
|
365
384
|
sourceToken: TokenRef.check(z.describe('Token the caller currently holds.')),
|
|
366
385
|
}),
|
|
367
|
-
'One successful provider-specific
|
|
386
|
+
'One successful provider-specific route quote.',
|
|
368
387
|
),
|
|
369
|
-
'
|
|
388
|
+
'RoutesQuote',
|
|
370
389
|
)
|
|
371
390
|
}
|
|
372
391
|
|
|
373
|
-
/** Chain metadata declared by a
|
|
392
|
+
/** Chain metadata declared by a provider route. */
|
|
374
393
|
export type Chain = core_Chain.Chain
|
|
375
394
|
|
|
376
|
-
/** Token metadata declared by a
|
|
395
|
+
/** Token metadata declared by a provider route. */
|
|
377
396
|
export type Token = core_Token.Resolved
|
|
378
397
|
|
|
379
|
-
/** Provider ids accepted by
|
|
398
|
+
/** Provider ids accepted by route quote requests. */
|
|
380
399
|
export type ProviderId = string
|
|
381
400
|
|
|
382
401
|
/** Provider-specific quote status for the requested amount. */
|
|
@@ -385,48 +404,83 @@ export type QuoteStatus = z.output<typeof schema.QuoteStatus>
|
|
|
385
404
|
/** Machine-readable quote quality tier. */
|
|
386
405
|
export type QualityTier = z.output<typeof schema.QualityTier>
|
|
387
406
|
|
|
388
|
-
/** Normalized chain reference passed to
|
|
407
|
+
/** Normalized chain reference passed to route providers. */
|
|
389
408
|
export type ChainRef = z.output<typeof schema.ChainRef>
|
|
390
409
|
|
|
391
|
-
/** Normalized token amount passed to
|
|
410
|
+
/** Normalized token amount passed to route providers. */
|
|
392
411
|
export type TokenAmount = ReturnType<typeof resolveSourceAmount>
|
|
393
412
|
|
|
394
|
-
/** Normalized token reference passed to
|
|
413
|
+
/** Normalized token reference passed to route providers. */
|
|
395
414
|
export type TokenRef = z.output<typeof schema.TokenRef>
|
|
396
415
|
|
|
397
|
-
/**
|
|
416
|
+
/** One token amount paid by a subsidy provider. */
|
|
417
|
+
export type Subsidy = z.output<typeof schema.Subsidy>
|
|
418
|
+
|
|
419
|
+
/** A normalized internal candidate passed to route quote providers. */
|
|
398
420
|
export type QuoteCandidate = ReturnType<typeof createQuoteCandidate>
|
|
399
421
|
|
|
400
422
|
/** A normalized route candidate passed to deposit-address providers. */
|
|
401
423
|
export type DepositAddressCandidate = ReturnType<typeof createDepositAddressCandidate>
|
|
402
424
|
|
|
403
|
-
/** A successful normalized
|
|
404
|
-
export type
|
|
425
|
+
/** A successful normalized route quote returned to callers. */
|
|
426
|
+
export type RoutesQuote = z.output<typeof schema.RoutesQuote>
|
|
405
427
|
|
|
406
|
-
/** Cache policy for a single
|
|
428
|
+
/** Cache policy for a single route quote request. */
|
|
407
429
|
export type CachePolicy = {
|
|
408
430
|
/** Whether providers should bypass their own quote or inventory caches. */
|
|
409
431
|
bypass: boolean
|
|
410
432
|
}
|
|
411
433
|
|
|
412
|
-
/** Normalized caller request passed to
|
|
434
|
+
/** Normalized caller request passed to route providers. */
|
|
413
435
|
export type QuoteRequest = z.output<typeof schema.QuoteRequest>
|
|
414
436
|
|
|
437
|
+
/** Bounded quote sample retained for request-level reliability telemetry. */
|
|
438
|
+
export type QuoteSample = {
|
|
439
|
+
/** Quote age when the provider request completed. */
|
|
440
|
+
ageMs: number
|
|
441
|
+
/** Destination value loss relative to the requested source amount, in signed basis points. */
|
|
442
|
+
customerValueLossBps?: number | undefined
|
|
443
|
+
/** Destination chain in the quoted corridor. */
|
|
444
|
+
destinationChain: string
|
|
445
|
+
/** Destination token in the quoted corridor. */
|
|
446
|
+
destinationToken: string
|
|
447
|
+
/** Amount the provider timestamp is ahead of the API clock. */
|
|
448
|
+
futureSkewMs: number
|
|
449
|
+
/** Provider that returned the quote. */
|
|
450
|
+
provider: string
|
|
451
|
+
/** Source chain in the quoted corridor. */
|
|
452
|
+
sourceChain: string
|
|
453
|
+
/** Source token in the quoted corridor. */
|
|
454
|
+
sourceToken: string
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/** Request-level result used to measure quote availability and freshness. */
|
|
458
|
+
export type QuoteRequestResult = {
|
|
459
|
+
/** Number of configured route candidates matching the request. */
|
|
460
|
+
candidateCount: number
|
|
461
|
+
/** Bounded request outcome for quote-availability measurement. */
|
|
462
|
+
outcome: 'available' | 'failed' | 'unavailable' | 'unsupported'
|
|
463
|
+
/** Successful provider quote samples returned to the caller. */
|
|
464
|
+
quotes: readonly QuoteSample[]
|
|
465
|
+
}
|
|
466
|
+
|
|
415
467
|
/** Contract of the provider `getQuote` method. */
|
|
416
468
|
export declare namespace getQuote {
|
|
417
|
-
/** Input passed to a
|
|
469
|
+
/** Input passed to a route provider for one curated quote candidate. */
|
|
418
470
|
type Parameters = {
|
|
419
471
|
/** Curated candidate selected for live provider quoting. */
|
|
420
472
|
candidate: QuoteCandidate
|
|
421
473
|
/** Cache policy for provider-side discovery and quote lookups. */
|
|
422
474
|
cache: CachePolicy
|
|
423
|
-
/**
|
|
475
|
+
/** Chain that receives the routed token. */
|
|
424
476
|
destinationChain: ChainRef
|
|
425
|
-
/**
|
|
477
|
+
/** Token expected from this quote. */
|
|
426
478
|
destinationToken: TokenRef
|
|
479
|
+
/** Stable non-secret tenant identity for provider-local fairness. */
|
|
480
|
+
quotaKey?: string | undefined
|
|
427
481
|
/** Normalized caller request that produced this quote candidate. */
|
|
428
482
|
request: QuoteRequest
|
|
429
|
-
/** Canonical
|
|
483
|
+
/** Canonical provider route selected for this quote candidate. */
|
|
430
484
|
route: core_Route.Route
|
|
431
485
|
/** Source amount in base units and display form. */
|
|
432
486
|
sourceAmount: TokenAmount
|
|
@@ -436,7 +490,7 @@ export declare namespace getQuote {
|
|
|
436
490
|
sourceToken: TokenRef
|
|
437
491
|
}
|
|
438
492
|
|
|
439
|
-
/** Quote data returned by a
|
|
493
|
+
/** Quote data returned by a route provider. */
|
|
440
494
|
type ReturnType = z.output<typeof schema.GetQuoteResult>
|
|
441
495
|
}
|
|
442
496
|
|
|
@@ -450,23 +504,23 @@ export declare namespace prepareTransfer {
|
|
|
450
504
|
requestId: string
|
|
451
505
|
}
|
|
452
506
|
|
|
453
|
-
/** Input passed to a
|
|
507
|
+
/** Input passed to a route provider preparing one executable transfer. */
|
|
454
508
|
type Parameters = {
|
|
455
509
|
/** Curated candidate selected for preparation. */
|
|
456
510
|
candidate: QuoteCandidate
|
|
457
|
-
/**
|
|
511
|
+
/** Route method the caller selected. */
|
|
458
512
|
method: Transfer.Method
|
|
459
513
|
/** Amount mode the caller selected. */
|
|
460
514
|
mode: Transfer.Mode
|
|
461
515
|
/** Final beneficiary on the destination chain. */
|
|
462
516
|
recipient: string
|
|
463
|
-
/** Source-chain account that signs the
|
|
517
|
+
/** Source-chain account that signs the route action. */
|
|
464
518
|
sender: string
|
|
465
519
|
/** Caller slippage bound in basis points. */
|
|
466
520
|
slippageBps?: number | undefined
|
|
467
521
|
}
|
|
468
522
|
|
|
469
|
-
/** Executable preparation returned by a
|
|
523
|
+
/** Executable preparation returned by a route provider. */
|
|
470
524
|
type ReturnType = z.output<typeof schema.PrepareResult>
|
|
471
525
|
}
|
|
472
526
|
|
|
@@ -476,15 +530,87 @@ export declare namespace validateTransferAction {
|
|
|
476
530
|
type Parameters = prepareTransfer.Parameters & {
|
|
477
531
|
/** Executable action returned by the provider. */
|
|
478
532
|
action: Action.Action
|
|
533
|
+
/** Minimum destination amount encoded by the provider action. */
|
|
534
|
+
destinationAmountMin: string
|
|
479
535
|
}
|
|
480
536
|
|
|
481
537
|
/** Provider-specific constraints established by validation. */
|
|
482
538
|
type ReturnType = {
|
|
483
539
|
/** Exact native values independently validated against provider calldata. */
|
|
484
540
|
nativeValues?: readonly Action.NativeValue[] | undefined
|
|
541
|
+
/** Exact additional token approvals independently validated against provider calldata. */
|
|
542
|
+
tokenApprovals?: readonly Action.TokenApproval[] | undefined
|
|
485
543
|
}
|
|
486
544
|
}
|
|
487
545
|
|
|
546
|
+
/** Contract for provider-specific destination delivery verification. */
|
|
547
|
+
export declare namespace verifyDestinationDelivery {
|
|
548
|
+
/** Stored transfer terms and provider evidence. */
|
|
549
|
+
type Parameters = {
|
|
550
|
+
/** Configured chain that receives the provider delivery. */
|
|
551
|
+
destinationChain: Chain
|
|
552
|
+
/** Private provider state captured while preparing and registering the transfer. */
|
|
553
|
+
providerState?: Transfer.ProviderState | undefined
|
|
554
|
+
/** Configured chain containing the submitted transaction. */
|
|
555
|
+
sourceChain: Chain
|
|
556
|
+
/** Stored public transfer terms. */
|
|
557
|
+
transfer: Transfer.Snapshot
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/** Destination delivery verification outcome. */
|
|
561
|
+
type ReturnType =
|
|
562
|
+
| { type: 'invalid' }
|
|
563
|
+
| { type: 'pending' }
|
|
564
|
+
| {
|
|
565
|
+
/** Verified destination transaction reference. */
|
|
566
|
+
transactionHash: string
|
|
567
|
+
/** The destination delivery matches the stored transfer terms. */
|
|
568
|
+
type: 'verified'
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
/** Contract for provider-specific source transaction verification. */
|
|
573
|
+
export declare namespace verifySourceTransaction {
|
|
574
|
+
/** Stored transfer terms and submitted source transaction. */
|
|
575
|
+
type Parameters = {
|
|
576
|
+
/** Configured chain that receives the provider delivery. */
|
|
577
|
+
destinationChain: Chain
|
|
578
|
+
/** Private provider state captured while preparing the transfer. */
|
|
579
|
+
providerState?: Transfer.ProviderState | undefined
|
|
580
|
+
/** Current configuration for the stored provider route. */
|
|
581
|
+
routeConfiguration?: core_Catalog.Configuration | undefined
|
|
582
|
+
/** Configured chain containing the submitted transaction. */
|
|
583
|
+
sourceChain: Chain
|
|
584
|
+
/** Submitted transaction reference. */
|
|
585
|
+
transactionHash: string
|
|
586
|
+
/** Stored public transfer terms. */
|
|
587
|
+
transfer: Transfer.Snapshot
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/** Source transaction verification outcome. */
|
|
591
|
+
type ReturnType =
|
|
592
|
+
| { type: 'invalid' }
|
|
593
|
+
| { type: 'pending' }
|
|
594
|
+
| {
|
|
595
|
+
/** Private provider state retained while awaiting replacement evidence. */
|
|
596
|
+
providerState: Transfer.ProviderState
|
|
597
|
+
/** Previously verified source evidence left the canonical chain. */
|
|
598
|
+
type: 'reorged'
|
|
599
|
+
}
|
|
600
|
+
| {
|
|
601
|
+
/** The transaction supports the transfer but does not execute it. */
|
|
602
|
+
type: 'related'
|
|
603
|
+
}
|
|
604
|
+
| {
|
|
605
|
+
/** Exact destination amount observed in the source transaction, when provider fees changed after preparation. */
|
|
606
|
+
destinationAmount?: string | undefined
|
|
607
|
+
/** Private provider evidence retained for reconciliation. */
|
|
608
|
+
providerState?: Transfer.ProviderState | undefined
|
|
609
|
+
/** The transaction matches the stored transfer terms. */
|
|
610
|
+
type: 'verified'
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
|
|
488
614
|
/** Contract of the provider `createDepositAddress` method. */
|
|
489
615
|
export declare namespace createDepositAddress {
|
|
490
616
|
/** Input passed to a provider provisioning one reusable deposit address. */
|
|
@@ -513,8 +639,12 @@ export declare namespace listDepositAddressRequests {
|
|
|
513
639
|
address: string
|
|
514
640
|
/** Opaque provider cursor returned by the previous page. */
|
|
515
641
|
continuation?: string | undefined
|
|
642
|
+
/** Token delivered by the provider, when needed to identify a subsidy payment. */
|
|
643
|
+
destinationToken?: TokenRef | undefined
|
|
516
644
|
/** Existing provider request to refresh directly. */
|
|
517
645
|
requestId?: string | undefined
|
|
646
|
+
/** Token received by the provider, when needed to identify a subsidy payment. */
|
|
647
|
+
sourceToken?: TokenRef | undefined
|
|
518
648
|
}
|
|
519
649
|
|
|
520
650
|
/** One page of normalized provider requests. */
|
|
@@ -577,13 +707,15 @@ export declare namespace observeDepositAddressRequest {
|
|
|
577
707
|
| {
|
|
578
708
|
/** Verified destination transaction references. */
|
|
579
709
|
destinationTransactionHashes: readonly string[]
|
|
710
|
+
/** Token amount paid by the provider for this request. */
|
|
711
|
+
subsidy?: z.output<typeof schema.Subsidy> | undefined
|
|
580
712
|
/** Authenticated provider delivery was observed onchain. */
|
|
581
713
|
type: 'verified'
|
|
582
714
|
}
|
|
583
715
|
)
|
|
584
716
|
}
|
|
585
717
|
|
|
586
|
-
/** Optional webhook capability implemented by a complete
|
|
718
|
+
/** Optional webhook capability implemented by a complete route integration. */
|
|
587
719
|
export type Webhook = {
|
|
588
720
|
/** Authenticates, resolves, and enqueues one provider status event. */
|
|
589
721
|
receive(input: Webhook.receive.Parameters): Promise<Webhook.receive.ReturnType>
|
|
@@ -591,11 +723,11 @@ export type Webhook = {
|
|
|
591
723
|
verify(input: Webhook.verify.Parameters): Webhook.verify.ReturnType
|
|
592
724
|
}
|
|
593
725
|
|
|
594
|
-
/** Contracts for a
|
|
726
|
+
/** Contracts for a route provider webhook capability. */
|
|
595
727
|
export declare namespace Webhook {
|
|
596
728
|
/** Contracts for receiving one authenticated provider webhook. */
|
|
597
729
|
namespace receive {
|
|
598
|
-
/** Raw provider webhook request passed to a
|
|
730
|
+
/** Raw provider webhook request passed to a route integration. */
|
|
599
731
|
type Parameters = {
|
|
600
732
|
/** Exact request body bytes decoded as UTF-8. */
|
|
601
733
|
body: string
|
|
@@ -603,9 +735,9 @@ export declare namespace Webhook {
|
|
|
603
735
|
headers: Headers
|
|
604
736
|
}
|
|
605
737
|
|
|
606
|
-
/** Durable queue message emitted for one authenticated
|
|
738
|
+
/** Durable queue message emitted for one authenticated routes status hint. */
|
|
607
739
|
type Dispatchable = {
|
|
608
|
-
/** Stored
|
|
740
|
+
/** Stored route deposit address id. */
|
|
609
741
|
addressId: string
|
|
610
742
|
/** Bounded follow-up state for work awaiting provider or settlement confirmation. */
|
|
611
743
|
followUp?: FollowUp | undefined
|
|
@@ -616,7 +748,7 @@ export declare namespace Webhook {
|
|
|
616
748
|
/** Mechanism that requested reconciliation. */
|
|
617
749
|
trigger: 'chain' | 'manual' | 'poll' | 'webhook'
|
|
618
750
|
/** Reconciliation queue message discriminator. */
|
|
619
|
-
type: '
|
|
751
|
+
type: 'routes:deposit-address:reconcile'
|
|
620
752
|
/** Authenticated provider webhook timing carried into reconciliation. */
|
|
621
753
|
webhookTiming?: WebhookTiming | undefined
|
|
622
754
|
}
|
|
@@ -649,7 +781,7 @@ export declare namespace Webhook {
|
|
|
649
781
|
trigger?: Dispatchable['trigger'] | undefined
|
|
650
782
|
}
|
|
651
783
|
|
|
652
|
-
/** Safe disposition of one authenticated
|
|
784
|
+
/** Safe disposition of one authenticated route provider webhook. */
|
|
653
785
|
type ReturnType =
|
|
654
786
|
| { addressId: string; type: 'queued' }
|
|
655
787
|
| { type: 'ignored' }
|
|
@@ -658,10 +790,10 @@ export declare namespace Webhook {
|
|
|
658
790
|
|
|
659
791
|
/** Contracts for verifying one provider webhook. */
|
|
660
792
|
namespace verify {
|
|
661
|
-
/** Raw provider webhook request passed to a
|
|
793
|
+
/** Raw provider webhook request passed to a route integration. */
|
|
662
794
|
type Parameters = receive.Parameters
|
|
663
795
|
|
|
664
|
-
/** Authenticated provider hint extracted from a
|
|
796
|
+
/** Authenticated provider hint extracted from a routes webhook. */
|
|
665
797
|
type ReturnType = {
|
|
666
798
|
/** Reusable provider address, when the provider attributed one. */
|
|
667
799
|
address?: string | undefined
|
|
@@ -677,14 +809,14 @@ export declare namespace Webhook {
|
|
|
677
809
|
}
|
|
678
810
|
}
|
|
679
811
|
|
|
680
|
-
/** A
|
|
681
|
-
export type Provider<id extends string = string> = core_Provider.Provider<id, '
|
|
682
|
-
/** Provisions a reusable
|
|
812
|
+
/** A route provider descriptor and live quote implementation. */
|
|
813
|
+
export type Provider<id extends string = string> = core_Provider.Provider<id, 'routes'> & {
|
|
814
|
+
/** Provisions a reusable route deposit address, when supported. */
|
|
683
815
|
createDepositAddress?(
|
|
684
816
|
input: createDepositAddress.Parameters,
|
|
685
817
|
signal: AbortSignal,
|
|
686
818
|
): Promise<createDepositAddress.ReturnType>
|
|
687
|
-
/** Requests a live
|
|
819
|
+
/** Requests a live route quote. */
|
|
688
820
|
getQuote(input: getQuote.Parameters, signal: AbortSignal): Promise<getQuote.ReturnType>
|
|
689
821
|
/** Lists requests discovered for a reusable deposit address, when supported. */
|
|
690
822
|
listDepositAddressRequests?(
|
|
@@ -696,7 +828,7 @@ export type Provider<id extends string = string> = core_Provider.Provider<id, 'f
|
|
|
696
828
|
input: observeDepositAddressRequest.Parameters,
|
|
697
829
|
signal: AbortSignal,
|
|
698
830
|
): Promise<observeDepositAddressRequest.ReturnType>
|
|
699
|
-
/** Prepares an executable
|
|
831
|
+
/** Prepares an executable route transfer, when the provider supports it. */
|
|
700
832
|
prepareTransfer?(
|
|
701
833
|
input: prepareTransfer.Parameters,
|
|
702
834
|
signal: AbortSignal,
|
|
@@ -705,72 +837,107 @@ export type Provider<id extends string = string> = core_Provider.Provider<id, 'f
|
|
|
705
837
|
validateTransferAction?(
|
|
706
838
|
input: validateTransferAction.Parameters,
|
|
707
839
|
): validateTransferAction.ReturnType
|
|
840
|
+
/** Verifies destination delivery for a registered transfer, when supported. */
|
|
841
|
+
verifyDestinationDelivery?(
|
|
842
|
+
input: verifyDestinationDelivery.Parameters,
|
|
843
|
+
signal: AbortSignal,
|
|
844
|
+
): Promise<verifyDestinationDelivery.ReturnType>
|
|
845
|
+
/** Verifies a submitted source transaction, when supported. */
|
|
846
|
+
verifySourceTransaction?(
|
|
847
|
+
input: verifySourceTransaction.Parameters,
|
|
848
|
+
signal: AbortSignal,
|
|
849
|
+
): Promise<verifySourceTransaction.ReturnType>
|
|
708
850
|
/** Receives authenticated provider status events, when configured. */
|
|
709
851
|
webhook?: Webhook | undefined
|
|
710
852
|
}
|
|
711
853
|
|
|
712
|
-
/** Defines a
|
|
854
|
+
/** Defines a route provider from its identity and quote implementation. */
|
|
713
855
|
export function from<const id extends string>(options: from.Options<id>): Provider<id> {
|
|
714
856
|
if (options.id !== normalizeInput(options.id) || options.id.length === 0)
|
|
715
857
|
throw new ProviderConfigurationError('Provider ids must be lowercase and trimmed.')
|
|
716
|
-
return core_Provider.from({ ...options, type: '
|
|
858
|
+
return core_Provider.from({ ...options, type: 'routes' })
|
|
717
859
|
}
|
|
718
860
|
|
|
719
861
|
export declare namespace from {
|
|
720
|
-
/**
|
|
862
|
+
/** Route provider definition. */
|
|
721
863
|
type Options<id extends string> = Omit<Provider<id>, 'type'>
|
|
722
864
|
}
|
|
723
865
|
|
|
724
|
-
/** Narrows a registered provider to a
|
|
866
|
+
/** Narrows a registered provider to a route provider. */
|
|
725
867
|
export function is(provider: core_Provider.Provider): provider is Provider {
|
|
726
868
|
return (
|
|
727
|
-
provider.type === '
|
|
869
|
+
provider.type === 'routes' && 'getQuote' in provider && typeof provider.getQuote === 'function'
|
|
728
870
|
)
|
|
729
871
|
}
|
|
730
872
|
|
|
731
|
-
/** Narrows a
|
|
873
|
+
/** Narrows a route provider to one that prepares executable transfers. */
|
|
732
874
|
export function canPrepareTransfer(provider: Provider): provider is Provider & {
|
|
733
875
|
prepareTransfer: NonNullable<Provider['prepareTransfer']>
|
|
734
876
|
} {
|
|
735
877
|
return typeof provider.prepareTransfer === 'function'
|
|
736
878
|
}
|
|
737
879
|
|
|
738
|
-
/** Narrows a
|
|
880
|
+
/** Narrows a route provider to one that provisions reusable deposit addresses. */
|
|
739
881
|
export function canCreateDepositAddress(provider: Provider): provider is Provider & {
|
|
740
882
|
createDepositAddress: NonNullable<Provider['createDepositAddress']>
|
|
741
883
|
} {
|
|
742
884
|
return typeof provider.createDepositAddress === 'function'
|
|
743
885
|
}
|
|
744
886
|
|
|
745
|
-
/** Narrows a
|
|
887
|
+
/** Narrows a route provider to one that tracks reusable deposit addresses. */
|
|
746
888
|
export function canListDepositAddressRequests(provider: Provider): provider is Provider & {
|
|
747
889
|
listDepositAddressRequests: NonNullable<Provider['listDepositAddressRequests']>
|
|
748
890
|
} {
|
|
749
891
|
return typeof provider.listDepositAddressRequests === 'function'
|
|
750
892
|
}
|
|
751
893
|
|
|
752
|
-
/** Narrows a
|
|
894
|
+
/** Narrows a route provider to one that observes reusable-address delivery onchain. */
|
|
753
895
|
export function canObserveDepositAddressRequest(provider: Provider): provider is Provider & {
|
|
754
896
|
observeDepositAddressRequest: NonNullable<Provider['observeDepositAddressRequest']>
|
|
755
897
|
} {
|
|
756
898
|
return typeof provider.observeDepositAddressRequest === 'function'
|
|
757
899
|
}
|
|
758
900
|
|
|
759
|
-
/** Narrows a
|
|
901
|
+
/** Narrows a route provider to one that reconciles registered transfers. */
|
|
902
|
+
export function canReconcileTransfer(provider: Provider): provider is Provider & {
|
|
903
|
+
verifyDestinationDelivery: NonNullable<Provider['verifyDestinationDelivery']>
|
|
904
|
+
verifySourceTransaction: NonNullable<Provider['verifySourceTransaction']>
|
|
905
|
+
} {
|
|
906
|
+
return (
|
|
907
|
+
typeof provider.verifyDestinationDelivery === 'function' &&
|
|
908
|
+
typeof provider.verifySourceTransaction === 'function'
|
|
909
|
+
)
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
/** Narrows a route provider to one that verifies submitted source transactions. */
|
|
913
|
+
export function canVerifySourceTransaction(provider: Provider): provider is Provider & {
|
|
914
|
+
verifySourceTransaction: NonNullable<Provider['verifySourceTransaction']>
|
|
915
|
+
} {
|
|
916
|
+
return typeof provider.verifySourceTransaction === 'function'
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
/** Narrows a route provider to one with authenticated webhook receipt. */
|
|
760
920
|
export function canReceiveWebhook(provider: Provider): provider is Provider & {
|
|
761
921
|
webhook: Webhook
|
|
762
922
|
} {
|
|
763
923
|
return provider.webhook !== undefined
|
|
764
924
|
}
|
|
765
925
|
|
|
766
|
-
/**
|
|
926
|
+
/** Route provider method recorded by operational telemetry. */
|
|
767
927
|
export type ProviderOperation =
|
|
768
928
|
| 'createDepositAddress'
|
|
769
929
|
| 'getQuote'
|
|
770
930
|
| 'listDepositAddressRequests'
|
|
931
|
+
| 'observeDepositAddressRequest'
|
|
771
932
|
| 'prepareTransfer'
|
|
933
|
+
| 'receiveWebhook'
|
|
934
|
+
| 'verifyDestinationDelivery'
|
|
935
|
+
| 'verifySourceTransaction'
|
|
936
|
+
|
|
937
|
+
/** Route provider identity retained by bounded operation telemetry. */
|
|
938
|
+
export type ProviderIdentity = Pick<Provider, 'id'>
|
|
772
939
|
|
|
773
|
-
/** One
|
|
940
|
+
/** One timed route provider operation. */
|
|
774
941
|
export type ProviderAttempt =
|
|
775
942
|
| {
|
|
776
943
|
/** Wall-clock duration of the provider attempt in milliseconds. */
|
|
@@ -778,9 +945,9 @@ export type ProviderAttempt =
|
|
|
778
945
|
/** Provider method invoked by the attempt. */
|
|
779
946
|
operation: ProviderOperation
|
|
780
947
|
/** Successful or expected-unavailable provider outcome. */
|
|
781
|
-
outcome: 'available' | 'thin' | 'unavailable'
|
|
782
|
-
/** Provider that handled the
|
|
783
|
-
provider:
|
|
948
|
+
outcome: 'available' | 'success' | 'thin' | 'unavailable'
|
|
949
|
+
/** Provider that handled the operation. */
|
|
950
|
+
provider: ProviderIdentity
|
|
784
951
|
}
|
|
785
952
|
| {
|
|
786
953
|
/** Error thrown by the provider boundary. */
|
|
@@ -791,8 +958,8 @@ export type ProviderAttempt =
|
|
|
791
958
|
operation: ProviderOperation
|
|
792
959
|
/** Failed provider outcome. */
|
|
793
960
|
outcome: 'failed'
|
|
794
|
-
/** Provider that handled the
|
|
795
|
-
provider:
|
|
961
|
+
/** Provider that handled the operation. */
|
|
962
|
+
provider: ProviderIdentity
|
|
796
963
|
}
|
|
797
964
|
|
|
798
965
|
/** Bounded result for one provider attempt. */
|
|
@@ -816,7 +983,52 @@ export type ProviderFailure = {
|
|
|
816
983
|
/** Provider method that failed. */
|
|
817
984
|
operation: ProviderOperation
|
|
818
985
|
/** Provider that failed. */
|
|
819
|
-
provider:
|
|
986
|
+
provider: ProviderIdentity
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
/** Observes one provider operation without changing its result. */
|
|
990
|
+
export async function observe<const result>(
|
|
991
|
+
provider: ProviderIdentity,
|
|
992
|
+
fn: () => Promise<result>,
|
|
993
|
+
options: observe.Options,
|
|
994
|
+
): Promise<result> {
|
|
995
|
+
const start = performance.now()
|
|
996
|
+
const report = (attempt: ProviderAttempt) => {
|
|
997
|
+
try {
|
|
998
|
+
options.onAttempt(formatAttempt(attempt))
|
|
999
|
+
} catch {
|
|
1000
|
+
// Observability hooks never alter provider behavior.
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
try {
|
|
1004
|
+
const value = await fn()
|
|
1005
|
+
report({
|
|
1006
|
+
durationMs: performance.now() - start,
|
|
1007
|
+
operation: options.operation,
|
|
1008
|
+
outcome: 'success',
|
|
1009
|
+
provider,
|
|
1010
|
+
})
|
|
1011
|
+
return value
|
|
1012
|
+
} catch (cause) {
|
|
1013
|
+
report({
|
|
1014
|
+
cause,
|
|
1015
|
+
durationMs: performance.now() - start,
|
|
1016
|
+
operation: options.operation,
|
|
1017
|
+
outcome: 'failed',
|
|
1018
|
+
provider,
|
|
1019
|
+
})
|
|
1020
|
+
throw cause
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
export declare namespace observe {
|
|
1025
|
+
/** Provider operation observation configuration. */
|
|
1026
|
+
type Options = {
|
|
1027
|
+
/** Receives the bounded provider operation result. */
|
|
1028
|
+
onAttempt: (result: ProviderAttemptResult) => void
|
|
1029
|
+
/** Stable provider method identifier. */
|
|
1030
|
+
operation: ProviderOperation
|
|
1031
|
+
}
|
|
820
1032
|
}
|
|
821
1033
|
|
|
822
1034
|
// Slow provider responses can still contain valid quotes; keep the boundary
|
|
@@ -847,14 +1059,14 @@ export function getChains(options: getChains.Options) {
|
|
|
847
1059
|
export declare namespace getChains {
|
|
848
1060
|
/** Options for getting provider-supported source chains. */
|
|
849
1061
|
type Options = {
|
|
850
|
-
/** Compiled
|
|
1062
|
+
/** Compiled route catalog containing provider routes. */
|
|
851
1063
|
catalog: core_Catalog.Snapshot
|
|
852
1064
|
/** Providers whose routes contribute source chains and tokens. */
|
|
853
1065
|
providers: readonly Provider[]
|
|
854
1066
|
}
|
|
855
1067
|
}
|
|
856
1068
|
|
|
857
|
-
/** Returns the supplied
|
|
1069
|
+
/** Returns the supplied route quote providers. */
|
|
858
1070
|
export function getProviders(options: getProviders.Options) {
|
|
859
1071
|
return options.providers
|
|
860
1072
|
.filter((provider) => (options.catalog.routesByProvider.get(provider.id)?.length ?? 0) > 0)
|
|
@@ -864,14 +1076,14 @@ export function getProviders(options: getProviders.Options) {
|
|
|
864
1076
|
export declare namespace getProviders {
|
|
865
1077
|
/** Options for getting providers. */
|
|
866
1078
|
type Options = {
|
|
867
|
-
/** Compiled
|
|
1079
|
+
/** Compiled route catalog containing provider routes. */
|
|
868
1080
|
catalog: core_Catalog.Snapshot
|
|
869
|
-
/**
|
|
1081
|
+
/** Route providers included in this deployment. */
|
|
870
1082
|
providers: readonly Provider[]
|
|
871
1083
|
}
|
|
872
1084
|
}
|
|
873
1085
|
|
|
874
|
-
/** Returns successful live
|
|
1086
|
+
/** Returns successful live route quotes from the supplied providers. */
|
|
875
1087
|
export async function getQuotes(options: getQuotes.Options) {
|
|
876
1088
|
const providers = options.providers ?? []
|
|
877
1089
|
const operation = 'getQuote' satisfies ProviderOperation
|
|
@@ -887,7 +1099,9 @@ export async function getQuotes(options: getQuotes.Options) {
|
|
|
887
1099
|
const result = await quoteCandidate(candidate, {
|
|
888
1100
|
cache: options.cache ?? { bypass: false },
|
|
889
1101
|
provider,
|
|
1102
|
+
quotaKey: options.quotaKey ?? 'public:anonymous',
|
|
890
1103
|
request: {
|
|
1104
|
+
destinationChain: options.destinationChain,
|
|
891
1105
|
destinationToken: options.destinationToken,
|
|
892
1106
|
provider: options.provider,
|
|
893
1107
|
sourceAmount: options.sourceAmount,
|
|
@@ -924,7 +1138,7 @@ export async function getQuotes(options: getQuotes.Options) {
|
|
|
924
1138
|
try {
|
|
925
1139
|
options.onAttempt?.(attempt)
|
|
926
1140
|
} catch {
|
|
927
|
-
// Observability hooks never alter
|
|
1141
|
+
// Observability hooks never alter route quote behavior.
|
|
928
1142
|
}
|
|
929
1143
|
}
|
|
930
1144
|
const quotes = results.flatMap((result) =>
|
|
@@ -941,6 +1155,37 @@ export async function getQuotes(options: getQuotes.Options) {
|
|
|
941
1155
|
]
|
|
942
1156
|
: [],
|
|
943
1157
|
)
|
|
1158
|
+
const outcome = (() => {
|
|
1159
|
+
if (quotes.length > 0) return 'available'
|
|
1160
|
+
if (candidates.length === 0) return 'unsupported'
|
|
1161
|
+
if (failures.length > 0) return 'failed'
|
|
1162
|
+
return 'unavailable'
|
|
1163
|
+
})()
|
|
1164
|
+
try {
|
|
1165
|
+
options.onResult?.({
|
|
1166
|
+
candidateCount: candidates.length,
|
|
1167
|
+
outcome,
|
|
1168
|
+
quotes: quotes.map((quote) => {
|
|
1169
|
+
const ageMs = Date.now() - Date.parse(quote.quote.sampledAt)
|
|
1170
|
+
const customerValueLossBps = Economics.differenceBps({
|
|
1171
|
+
reference: quote.sourceAmount,
|
|
1172
|
+
value: quote.destinationAmount,
|
|
1173
|
+
})
|
|
1174
|
+
return {
|
|
1175
|
+
ageMs: Math.max(0, ageMs),
|
|
1176
|
+
...(customerValueLossBps === undefined ? {} : { customerValueLossBps }),
|
|
1177
|
+
destinationChain: quote.destinationChain.id,
|
|
1178
|
+
destinationToken: quote.destinationToken.tokenKey,
|
|
1179
|
+
futureSkewMs: Math.max(0, -ageMs),
|
|
1180
|
+
provider: quote.provider.id,
|
|
1181
|
+
sourceChain: quote.sourceChain.id,
|
|
1182
|
+
sourceToken: quote.sourceToken.tokenKey,
|
|
1183
|
+
}
|
|
1184
|
+
}),
|
|
1185
|
+
})
|
|
1186
|
+
} catch {
|
|
1187
|
+
// Reliability telemetry never alters route quote behavior.
|
|
1188
|
+
}
|
|
944
1189
|
if (quotes.length === 0 && failures.length > 0) throw new ProviderQuoteError(failures, values)
|
|
945
1190
|
return quotes
|
|
946
1191
|
}
|
|
@@ -954,7 +1199,8 @@ export function getQuoteCandidates(options: getQuoteCandidates.Options) {
|
|
|
954
1199
|
if (!amount.success) throw new InvalidAmountError()
|
|
955
1200
|
const sourceChain = resolveSourceChain(options.sourceChain, catalog)
|
|
956
1201
|
const sourceToken = resolveSourceToken(sourceChain, options.sourceToken, catalog)
|
|
957
|
-
const
|
|
1202
|
+
const destinationChain = resolveDestinationChain(options.destinationChain ?? 'tempo', catalog)
|
|
1203
|
+
const destination = resolveDestinationToken(destinationChain, options.destinationToken, catalog)
|
|
958
1204
|
const provider = options.provider ? resolveProvider(options.provider, providers) : undefined
|
|
959
1205
|
|
|
960
1206
|
if (providers.length === 0) return []
|
|
@@ -985,22 +1231,26 @@ export function getQuoteCandidates(options: getQuoteCandidates.Options) {
|
|
|
985
1231
|
}
|
|
986
1232
|
|
|
987
1233
|
export declare namespace getQuoteCandidates {
|
|
988
|
-
/** Options for selecting
|
|
1234
|
+
/** Options for selecting route quote candidates. */
|
|
989
1235
|
type Options = QuoteRequest & {
|
|
990
|
-
/** Compiled
|
|
1236
|
+
/** Compiled route catalog containing provider routes. */
|
|
991
1237
|
catalog: core_Catalog.Snapshot
|
|
992
|
-
/**
|
|
1238
|
+
/** Route providers considered by the request. */
|
|
993
1239
|
providers: readonly Provider[]
|
|
994
1240
|
}
|
|
995
1241
|
}
|
|
996
1242
|
|
|
997
1243
|
export declare namespace getQuotes {
|
|
998
|
-
/** Options for requesting live
|
|
1244
|
+
/** Options for requesting live route quotes. */
|
|
999
1245
|
type Options = getQuoteCandidates.Options & {
|
|
1000
1246
|
/** Cache policy for provider-side discovery and quote lookups. */
|
|
1001
1247
|
cache?: CachePolicy | undefined
|
|
1002
1248
|
/** Receives one bounded observation for every provider attempt. */
|
|
1003
1249
|
onAttempt?: ((attempt: ProviderAttempt) => void) | undefined
|
|
1250
|
+
/** Receives the bounded request-level quote result. */
|
|
1251
|
+
onResult?: ((result: QuoteRequestResult) => void) | undefined
|
|
1252
|
+
/** Stable non-secret tenant identity for provider-local fairness. */
|
|
1253
|
+
quotaKey?: string | undefined
|
|
1004
1254
|
/** Per-provider quote timeout in milliseconds. */
|
|
1005
1255
|
providerTimeoutMs?: number | undefined
|
|
1006
1256
|
}
|
|
@@ -1020,18 +1270,8 @@ export async function createDepositAddress(
|
|
|
1020
1270
|
): Promise<createDepositAddress.Selection | undefined> {
|
|
1021
1271
|
const operation = 'createDepositAddress' satisfies ProviderOperation
|
|
1022
1272
|
if (!schema.PositiveInteger.safeParse(options.amount).success) throw new InvalidAmountError()
|
|
1023
|
-
const
|
|
1024
|
-
a.provider.id.localeCompare(b.provider.id),
|
|
1025
|
-
)
|
|
1026
|
-
const selected = candidates[0]
|
|
1273
|
+
const selected = selectDepositAddress(options)
|
|
1027
1274
|
if (!selected) return undefined
|
|
1028
|
-
const recipient = normalizeAccountAddress(options.recipient, selected.candidate.destinationChain)
|
|
1029
|
-
const refundAddress = normalizeAccountAddress(
|
|
1030
|
-
options.refundAddress,
|
|
1031
|
-
selected.candidate.sourceChain,
|
|
1032
|
-
)
|
|
1033
|
-
if (!recipient) throw new ProviderPayloadError()
|
|
1034
|
-
if (!refundAddress) throw new InvalidRefundAddressError()
|
|
1035
1275
|
|
|
1036
1276
|
const start = performance.now()
|
|
1037
1277
|
try {
|
|
@@ -1042,8 +1282,8 @@ export async function createDepositAddress(
|
|
|
1042
1282
|
{
|
|
1043
1283
|
amount: options.amount,
|
|
1044
1284
|
candidate: selected.candidate,
|
|
1045
|
-
recipient,
|
|
1046
|
-
refundAddress,
|
|
1285
|
+
recipient: selected.recipient,
|
|
1286
|
+
refundAddress: selected.refundAddress,
|
|
1047
1287
|
subsidize: options.subsidize,
|
|
1048
1288
|
},
|
|
1049
1289
|
signal,
|
|
@@ -1070,7 +1310,7 @@ export async function createDepositAddress(
|
|
|
1070
1310
|
} catch {
|
|
1071
1311
|
// Observability hooks never alter provisioning behavior.
|
|
1072
1312
|
}
|
|
1073
|
-
return { ...selected,
|
|
1313
|
+
return { ...selected, result }
|
|
1074
1314
|
} catch (cause) {
|
|
1075
1315
|
const attempt: ProviderAttempt =
|
|
1076
1316
|
cause instanceof ProviderUnavailableError
|
|
@@ -1097,6 +1337,47 @@ export async function createDepositAddress(
|
|
|
1097
1337
|
}
|
|
1098
1338
|
}
|
|
1099
1339
|
|
|
1340
|
+
/** Selects and normalizes the deterministic reusable-address route without provisioning it. */
|
|
1341
|
+
export function selectDepositAddress(
|
|
1342
|
+
options: selectDepositAddress.Options,
|
|
1343
|
+
): selectDepositAddress.Result | undefined {
|
|
1344
|
+
const candidates = getDepositAddressCandidates(options).sort((a, b) =>
|
|
1345
|
+
a.provider.id.localeCompare(b.provider.id),
|
|
1346
|
+
)
|
|
1347
|
+
const selected = candidates[0]
|
|
1348
|
+
if (!selected) return undefined
|
|
1349
|
+
const recipient = normalizeAccountAddress(options.recipient, selected.candidate.destinationChain)
|
|
1350
|
+
const refundAddress = normalizeAccountAddress(
|
|
1351
|
+
options.refundAddress,
|
|
1352
|
+
selected.candidate.sourceChain,
|
|
1353
|
+
)
|
|
1354
|
+
if (!recipient) throw new ProviderPayloadError()
|
|
1355
|
+
if (!refundAddress) throw new InvalidRefundAddressError()
|
|
1356
|
+
return { ...selected, recipient, refundAddress }
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
export declare namespace selectDepositAddress {
|
|
1360
|
+
/** Route and accounts used to select one reusable-address provider. */
|
|
1361
|
+
type Options = getDepositAddressCandidates.Options & {
|
|
1362
|
+
/** Final beneficiary on Tempo. */
|
|
1363
|
+
recipient: string
|
|
1364
|
+
/** Source-chain account that receives refunds. */
|
|
1365
|
+
refundAddress: string
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
/** Deterministic provider route with normalized accounts. */
|
|
1369
|
+
type Result = {
|
|
1370
|
+
/** Curated reusable-address route selected for provisioning. */
|
|
1371
|
+
candidate: DepositAddressCandidate
|
|
1372
|
+
/** Provider selected for the reusable address. */
|
|
1373
|
+
provider: ReturnType<typeof getDepositAddressCandidates>[number]['provider']
|
|
1374
|
+
/** Normalized final beneficiary on Tempo. */
|
|
1375
|
+
recipient: string
|
|
1376
|
+
/** Normalized source-chain refund account. */
|
|
1377
|
+
refundAddress: string
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1100
1381
|
export declare namespace createDepositAddress {
|
|
1101
1382
|
/** Options for provisioning one reusable deposit address. */
|
|
1102
1383
|
type Options = getDepositAddressCandidates.Options & {
|
|
@@ -1141,6 +1422,11 @@ export async function prepareTransfer(
|
|
|
1141
1422
|
const operation = 'prepareTransfer' satisfies ProviderOperation
|
|
1142
1423
|
const candidates = getPrepareCandidates(options)
|
|
1143
1424
|
if (candidates.length === 0) return undefined
|
|
1425
|
+
const first = candidates[0]!
|
|
1426
|
+
const recipient = normalizeAccountAddress(options.recipient, first.candidate.destinationChain)
|
|
1427
|
+
if (!recipient) throw new InvalidRecipientAddressError()
|
|
1428
|
+
const sender = normalizeAccountAddress(options.sender, first.candidate.sourceChain)
|
|
1429
|
+
if (!sender) throw new InvalidSenderAddressError()
|
|
1144
1430
|
|
|
1145
1431
|
const attempts: ProviderAttempt[] = []
|
|
1146
1432
|
const results = await Promise.allSettled(
|
|
@@ -1151,8 +1437,8 @@ export async function prepareTransfer(
|
|
|
1151
1437
|
candidate,
|
|
1152
1438
|
method: options.method,
|
|
1153
1439
|
mode: options.mode,
|
|
1154
|
-
recipient
|
|
1155
|
-
sender
|
|
1440
|
+
recipient,
|
|
1441
|
+
sender,
|
|
1156
1442
|
slippageBps: options.slippageBps,
|
|
1157
1443
|
}
|
|
1158
1444
|
const parsed = schema.PrepareResult.safeParse(
|
|
@@ -1183,12 +1469,14 @@ export async function prepareTransfer(
|
|
|
1183
1469
|
const constraints = provider.validateTransferAction?.({
|
|
1184
1470
|
...parameters,
|
|
1185
1471
|
action: result.action,
|
|
1472
|
+
destinationAmountMin: result.destinationAmountMin,
|
|
1186
1473
|
})
|
|
1187
1474
|
Action.validateEvmCalls({
|
|
1188
1475
|
action: result.action,
|
|
1189
1476
|
nativeValues: constraints?.nativeValues,
|
|
1190
1477
|
sourceAmount: candidate.sourceAmount.amount,
|
|
1191
1478
|
sourceTokenAddress: candidate.sourceToken.address,
|
|
1479
|
+
tokenApprovals: constraints?.tokenApprovals,
|
|
1192
1480
|
})
|
|
1193
1481
|
} catch (cause) {
|
|
1194
1482
|
if (cause instanceof Action.InvalidActionError) throw new ProviderPayloadError()
|
|
@@ -1254,7 +1542,19 @@ export async function prepareTransfer(
|
|
|
1254
1542
|
if (delta !== 0n) return delta > 0n ? 1 : -1
|
|
1255
1543
|
return a.provider.id < b.provider.id ? -1 : 1
|
|
1256
1544
|
})
|
|
1257
|
-
|
|
1545
|
+
const selected = prepared[0]!
|
|
1546
|
+
const bestDestinationAmount = prepared.reduce(
|
|
1547
|
+
(best, entry) =>
|
|
1548
|
+
BigInt(entry.result.destinationAmount) > BigInt(best) ? entry.result.destinationAmount : best,
|
|
1549
|
+
selected.result.destinationAmount,
|
|
1550
|
+
)
|
|
1551
|
+
return {
|
|
1552
|
+
...selected,
|
|
1553
|
+
bestDestinationAmount,
|
|
1554
|
+
preparedCount: prepared.length,
|
|
1555
|
+
recipient,
|
|
1556
|
+
sender,
|
|
1557
|
+
}
|
|
1258
1558
|
}
|
|
1259
1559
|
|
|
1260
1560
|
export declare namespace prepareTransfer {
|
|
@@ -1266,7 +1566,7 @@ export declare namespace prepareTransfer {
|
|
|
1266
1566
|
providerTimeoutMs?: number | undefined
|
|
1267
1567
|
/** Final beneficiary on the destination chain. */
|
|
1268
1568
|
recipient: string
|
|
1269
|
-
/** Source-chain account that signs the
|
|
1569
|
+
/** Source-chain account that signs the route action. */
|
|
1270
1570
|
sender: string
|
|
1271
1571
|
/** Caller slippage bound in basis points. */
|
|
1272
1572
|
slippageBps?: number | undefined
|
|
@@ -1274,12 +1574,20 @@ export declare namespace prepareTransfer {
|
|
|
1274
1574
|
|
|
1275
1575
|
/** The selected preparation with a guaranteed expiry. */
|
|
1276
1576
|
type Selection = {
|
|
1577
|
+
/** Highest expected destination amount returned by a successful candidate. */
|
|
1578
|
+
bestDestinationAmount: string
|
|
1277
1579
|
/** Curated candidate the preparation was produced for. */
|
|
1278
1580
|
candidate: QuoteCandidate
|
|
1581
|
+
/** Number of successful preparations considered for automatic selection. */
|
|
1582
|
+
preparedCount: number
|
|
1279
1583
|
/** Provider that produced the selected preparation. */
|
|
1280
1584
|
provider: Provider
|
|
1585
|
+
/** Normalized final beneficiary on the destination chain. */
|
|
1586
|
+
recipient: string
|
|
1281
1587
|
/** The preparation, with a default expiry applied when the provider gave none. */
|
|
1282
1588
|
result: prepareTransfer.ReturnType & { expiresAt: string }
|
|
1589
|
+
/** Normalized source-chain account that signs the route action. */
|
|
1590
|
+
sender: string
|
|
1283
1591
|
}
|
|
1284
1592
|
}
|
|
1285
1593
|
|
|
@@ -1315,13 +1623,13 @@ export function getDepositAddressCandidates(options: getDepositAddressCandidates
|
|
|
1315
1623
|
export declare namespace getDepositAddressCandidates {
|
|
1316
1624
|
/** Options for selecting reusable deposit-address routes. */
|
|
1317
1625
|
type Options = {
|
|
1318
|
-
/** Compiled
|
|
1626
|
+
/** Compiled route catalog containing provider routes and capabilities. */
|
|
1319
1627
|
catalog: core_Catalog.Snapshot
|
|
1320
1628
|
/** Tempo destination chain selected by app composition. */
|
|
1321
1629
|
destinationChainId: number
|
|
1322
1630
|
/** Tempo destination token symbol, contract address, or token key. */
|
|
1323
1631
|
destinationToken: string
|
|
1324
|
-
/**
|
|
1632
|
+
/** Route providers considered by the request. */
|
|
1325
1633
|
providers: readonly Provider[]
|
|
1326
1634
|
/** Source chain CAIP-2 id, slug, or alias. */
|
|
1327
1635
|
sourceChain: string
|
|
@@ -1339,14 +1647,14 @@ export function getPrepareCandidates(options: getPrepareCandidates.Options) {
|
|
|
1339
1647
|
const amount = schema.PositiveInteger.safeParse(options.sourceAmount)
|
|
1340
1648
|
if (!amount.success) throw new InvalidAmountError()
|
|
1341
1649
|
const sourceChain = resolveSourceChain(options.sourceChain, options.catalog)
|
|
1342
|
-
const
|
|
1650
|
+
const destinationChain = resolveDestinationChain(options.destinationChain, options.catalog)
|
|
1343
1651
|
const selectedProvider = options.provider
|
|
1344
1652
|
? resolveProvider(options.provider, options.providers)
|
|
1345
1653
|
: undefined
|
|
1346
1654
|
|
|
1347
1655
|
return options.catalog.routes.flatMap((entry) => {
|
|
1348
1656
|
if (entry.route.source.chain.id !== sourceChain.id) return []
|
|
1349
|
-
if (entry.route.destination.chain.id !==
|
|
1657
|
+
if (entry.route.destination.chain.id !== destinationChain.id) return []
|
|
1350
1658
|
if (!matchesToken(entry.route.source, options.sourceToken)) return []
|
|
1351
1659
|
if (!matchesToken(entry.route.destination, options.destinationToken)) return []
|
|
1352
1660
|
if (!entry.capabilities?.transfer?.modes.includes(options.mode)) return []
|
|
@@ -1376,19 +1684,19 @@ export function getPrepareCandidates(options: getPrepareCandidates.Options) {
|
|
|
1376
1684
|
export declare namespace getPrepareCandidates {
|
|
1377
1685
|
/** Options for selecting preparation candidates. */
|
|
1378
1686
|
type Options = {
|
|
1379
|
-
/** Compiled
|
|
1687
|
+
/** Compiled route catalog containing provider routes and capabilities. */
|
|
1380
1688
|
catalog: core_Catalog.Snapshot
|
|
1381
|
-
/**
|
|
1382
|
-
|
|
1383
|
-
/**
|
|
1689
|
+
/** Destination chain CAIP-2 id, slug, or alias. */
|
|
1690
|
+
destinationChain: string
|
|
1691
|
+
/** Destination token symbol, contract address, or token key. */
|
|
1384
1692
|
destinationToken: string
|
|
1385
|
-
/**
|
|
1693
|
+
/** Route method passed to provider preparation. */
|
|
1386
1694
|
method: Transfer.Method
|
|
1387
1695
|
/** Amount mode the caller selected. */
|
|
1388
1696
|
mode: Transfer.Mode
|
|
1389
|
-
/**
|
|
1697
|
+
/** Route provider ID selected by the caller. */
|
|
1390
1698
|
provider?: string | undefined
|
|
1391
|
-
/**
|
|
1699
|
+
/** Route providers considered by the request. */
|
|
1392
1700
|
providers: readonly Provider[]
|
|
1393
1701
|
/** Source amount in base units. */
|
|
1394
1702
|
sourceAmount: string
|
|
@@ -1399,15 +1707,17 @@ export declare namespace getPrepareCandidates {
|
|
|
1399
1707
|
}
|
|
1400
1708
|
}
|
|
1401
1709
|
|
|
1402
|
-
/** Source amount unit accepted by the
|
|
1710
|
+
/** Source amount unit accepted by the route quote request. */
|
|
1403
1711
|
export type SourceAmountUnits = z.output<typeof schema.SourceAmountUnits>
|
|
1404
1712
|
|
|
1405
|
-
/** Fetch implementation accepted by
|
|
1713
|
+
/** Fetch implementation accepted by route provider factories. */
|
|
1406
1714
|
export type Fetch = typeof globalThis.fetch
|
|
1407
1715
|
|
|
1408
1716
|
/** Returns bounded provider failure details suitable for structured request logs. */
|
|
1409
1717
|
export function failure(options: ProviderFailure): failure.Result {
|
|
1410
1718
|
const { cause, operation, provider } = options
|
|
1719
|
+
const rpc = Viem.requestFailure(cause)
|
|
1720
|
+
if (rpc) return { ...rpc, id: provider.id, operation }
|
|
1411
1721
|
if (
|
|
1412
1722
|
cause instanceof ProviderTimeoutError ||
|
|
1413
1723
|
(cause instanceof DOMException && cause.name === 'AbortError')
|
|
@@ -1423,7 +1733,11 @@ export function failure(options: ProviderFailure): failure.Result {
|
|
|
1423
1733
|
status: cause.status,
|
|
1424
1734
|
}
|
|
1425
1735
|
}
|
|
1426
|
-
if (
|
|
1736
|
+
if (
|
|
1737
|
+
cause instanceof ProviderPayloadError ||
|
|
1738
|
+
cause instanceof WebhookAuthenticationError ||
|
|
1739
|
+
cause instanceof WebhookPayloadError
|
|
1740
|
+
)
|
|
1427
1741
|
return { failure: 'payload', id: provider.id, operation }
|
|
1428
1742
|
if (cause instanceof ProviderRateLimitError)
|
|
1429
1743
|
return { failure: 'rate_limit', id: provider.id, operation }
|
|
@@ -1434,12 +1748,16 @@ export function failure(options: ProviderFailure): failure.Result {
|
|
|
1434
1748
|
export declare namespace failure {
|
|
1435
1749
|
/** Bounded provider failure fields. */
|
|
1436
1750
|
type Result = {
|
|
1751
|
+
/** EIP-155 chain whose RPC request failed. */
|
|
1752
|
+
chainId?: number | undefined
|
|
1437
1753
|
/** Stable provider error code, when one is safe to retain. */
|
|
1438
1754
|
code?: string | undefined
|
|
1439
1755
|
/** Failure boundary that rejected the provider request. */
|
|
1440
|
-
failure: 'http' | 'network' | 'payload' | 'rate_limit' | 'timeout' | 'unknown'
|
|
1756
|
+
failure: 'http' | 'network' | 'payload' | 'query' | 'rate_limit' | 'timeout' | 'unknown'
|
|
1441
1757
|
/** Provider identifier. */
|
|
1442
1758
|
id: string
|
|
1759
|
+
/** Upstream error message, when one was returned. */
|
|
1760
|
+
message?: string | undefined
|
|
1443
1761
|
/** Provider operation identifier. */
|
|
1444
1762
|
operation: ProviderOperation
|
|
1445
1763
|
/** Upstream HTTP status, when a response was received. */
|
|
@@ -1537,6 +1855,7 @@ async function quoteCandidate(
|
|
|
1537
1855
|
options: {
|
|
1538
1856
|
cache: CachePolicy
|
|
1539
1857
|
provider: Provider
|
|
1858
|
+
quotaKey: string
|
|
1540
1859
|
request: QuoteRequest
|
|
1541
1860
|
timeoutMs: number
|
|
1542
1861
|
},
|
|
@@ -1550,6 +1869,7 @@ async function quoteCandidate(
|
|
|
1550
1869
|
cache: options.cache,
|
|
1551
1870
|
destinationChain: candidate.destinationChain,
|
|
1552
1871
|
destinationToken: candidate.destinationToken,
|
|
1872
|
+
quotaKey: options.quotaKey,
|
|
1553
1873
|
request: options.request,
|
|
1554
1874
|
route: candidate.route,
|
|
1555
1875
|
sourceAmount: candidate.sourceAmount,
|
|
@@ -1688,8 +2008,8 @@ type SuccessfulQuoteResult = getQuote.ReturnType & {
|
|
|
1688
2008
|
status: 'available' | 'thin'
|
|
1689
2009
|
}
|
|
1690
2010
|
|
|
1691
|
-
function createQuote(candidate: QuoteCandidate, quote: SuccessfulQuoteResult):
|
|
1692
|
-
return schema.
|
|
2011
|
+
function createQuote(candidate: QuoteCandidate, quote: SuccessfulQuoteResult): RoutesQuote {
|
|
2012
|
+
return schema.RoutesQuote.parse({
|
|
1693
2013
|
destinationAmount: Value.tokenAmount({
|
|
1694
2014
|
baseUnits: quote.destinationAmount,
|
|
1695
2015
|
currency: candidate.destinationToken.currency,
|
|
@@ -1712,10 +2032,6 @@ function createQuote(candidate: QuoteCandidate, quote: SuccessfulQuoteResult): F
|
|
|
1712
2032
|
...(quote.quality?.estimatedSeconds !== undefined
|
|
1713
2033
|
? { estimatedSeconds: quote.quality.estimatedSeconds }
|
|
1714
2034
|
: {}),
|
|
1715
|
-
liquiditySource: quote.quality?.liquiditySource ?? 'providerQuote',
|
|
1716
|
-
...(quote.quality?.sourceDetail !== undefined
|
|
1717
|
-
? { sourceDetail: quote.quality.sourceDetail }
|
|
1718
|
-
: {}),
|
|
1719
2035
|
tier: quote.status === 'thin' ? ('thin' as const) : ('liquid' as const),
|
|
1720
2036
|
},
|
|
1721
2037
|
quote: {
|
|
@@ -1766,7 +2082,8 @@ function errorCode(input: unknown) {
|
|
|
1766
2082
|
return parsed.success ? parsed.data : undefined
|
|
1767
2083
|
}
|
|
1768
2084
|
|
|
1769
|
-
|
|
2085
|
+
/** Formats one provider attempt for logs and aggregate metrics. */
|
|
2086
|
+
export function formatAttempt(attempt: ProviderAttempt): ProviderAttemptResult {
|
|
1770
2087
|
return {
|
|
1771
2088
|
durationMs: attempt.durationMs,
|
|
1772
2089
|
...(attempt.outcome === 'failed'
|
|
@@ -1784,9 +2101,23 @@ function attemptResult(attempt: ProviderAttempt): ProviderAttemptResult {
|
|
|
1784
2101
|
}
|
|
1785
2102
|
}
|
|
1786
2103
|
|
|
1787
|
-
function
|
|
2104
|
+
function resolveDestinationChain(input: string, catalog: core_Catalog.Snapshot) {
|
|
2105
|
+
const normalized = normalizeInput(input)
|
|
2106
|
+
const chain = catalog.chainsByKey.get(normalized)
|
|
2107
|
+
if (!chain || !catalog.routes.some((entry) => entry.route.destination.chain.id === chain.id))
|
|
2108
|
+
throw new UnsupportedDestinationChainError()
|
|
2109
|
+
return chain
|
|
2110
|
+
}
|
|
2111
|
+
|
|
2112
|
+
function resolveDestinationToken(
|
|
2113
|
+
chain: Chain,
|
|
2114
|
+
input: string | undefined,
|
|
2115
|
+
catalog: core_Catalog.Snapshot,
|
|
2116
|
+
) {
|
|
1788
2117
|
const destinations = uniqueBy(
|
|
1789
|
-
catalog.routes
|
|
2118
|
+
catalog.routes
|
|
2119
|
+
.filter((entry) => entry.route.destination.chain.id === chain.id)
|
|
2120
|
+
.map((entry) => entry.route.destination),
|
|
1790
2121
|
(token) => `${token.chain.id}:${token.address}`,
|
|
1791
2122
|
)
|
|
1792
2123
|
if (input === undefined) {
|
|
@@ -1890,59 +2221,74 @@ function normalizeAccountAddress(value: string, chain: ChainRef): string | undef
|
|
|
1890
2221
|
}
|
|
1891
2222
|
}
|
|
1892
2223
|
|
|
2224
|
+
/** Error thrown when the caller supplies an unsupported destination chain. */
|
|
2225
|
+
export class UnsupportedDestinationChainError extends Error {
|
|
2226
|
+
override name = 'RoutesProvider.UnsupportedDestinationChainError'
|
|
2227
|
+
}
|
|
2228
|
+
|
|
1893
2229
|
/** Error thrown when the caller supplies an unsupported destination token. */
|
|
1894
2230
|
export class UnsupportedDestinationTokenError extends Error {
|
|
1895
|
-
override name = '
|
|
2231
|
+
override name = 'RoutesProvider.UnsupportedDestinationTokenError'
|
|
1896
2232
|
}
|
|
1897
2233
|
|
|
1898
2234
|
/** Error thrown when a provider webhook cannot be authenticated. */
|
|
1899
2235
|
export class WebhookAuthenticationError extends Error {
|
|
1900
|
-
override name = '
|
|
2236
|
+
override name = 'RoutesProvider.WebhookAuthenticationError'
|
|
1901
2237
|
}
|
|
1902
2238
|
|
|
1903
2239
|
/** Error thrown when an authenticated provider webhook has an invalid body. */
|
|
1904
2240
|
export class WebhookPayloadError extends Error {
|
|
1905
|
-
override name = '
|
|
2241
|
+
override name = 'RoutesProvider.WebhookPayloadError'
|
|
1906
2242
|
}
|
|
1907
2243
|
|
|
1908
2244
|
/** Error thrown when the caller supplies an invalid source amount. */
|
|
1909
2245
|
export class InvalidAmountError extends Error {
|
|
1910
|
-
override name = '
|
|
2246
|
+
override name = 'RoutesProvider.InvalidAmountError'
|
|
1911
2247
|
}
|
|
1912
2248
|
|
|
1913
2249
|
/** Error thrown when the caller supplies an invalid source-chain refund address. */
|
|
1914
2250
|
export class InvalidRefundAddressError extends Error {
|
|
1915
|
-
override name = '
|
|
2251
|
+
override name = 'RoutesProvider.InvalidRefundAddressError'
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2254
|
+
/** Error thrown when the caller supplies an invalid destination-chain recipient. */
|
|
2255
|
+
export class InvalidRecipientAddressError extends Error {
|
|
2256
|
+
override name = 'RoutesProvider.InvalidRecipientAddressError'
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2259
|
+
/** Error thrown when the caller supplies an invalid source-chain sender. */
|
|
2260
|
+
export class InvalidSenderAddressError extends Error {
|
|
2261
|
+
override name = 'RoutesProvider.InvalidSenderAddressError'
|
|
1916
2262
|
}
|
|
1917
2263
|
|
|
1918
2264
|
/** Error thrown when provider deployment configuration is invalid. */
|
|
1919
2265
|
export class ProviderConfigurationError extends Error {
|
|
1920
|
-
override name = '
|
|
2266
|
+
override name = 'RoutesProvider.ProviderConfigurationError'
|
|
1921
2267
|
}
|
|
1922
2268
|
|
|
1923
2269
|
/** Error thrown when a provider response does not match the requested quote. */
|
|
1924
2270
|
export class ProviderPayloadError extends Error {
|
|
1925
|
-
override name = '
|
|
2271
|
+
override name = 'RoutesProvider.ProviderPayloadError'
|
|
1926
2272
|
}
|
|
1927
2273
|
|
|
1928
2274
|
/** Error thrown when a provider confirms that no executable route is available. */
|
|
1929
2275
|
export class ProviderUnavailableError extends Error {
|
|
1930
|
-
override name = '
|
|
2276
|
+
override name = 'RoutesProvider.ProviderUnavailableError'
|
|
1931
2277
|
}
|
|
1932
2278
|
|
|
1933
2279
|
/** Error thrown internally when a provider exceeds its quote timeout. */
|
|
1934
2280
|
export class ProviderTimeoutError extends Error {
|
|
1935
|
-
override name = '
|
|
2281
|
+
override name = 'RoutesProvider.ProviderTimeoutError'
|
|
1936
2282
|
}
|
|
1937
2283
|
|
|
1938
2284
|
/** Error thrown when an internal provider quota rejects a quote request. */
|
|
1939
2285
|
export class ProviderRateLimitError extends Error {
|
|
1940
|
-
override name = '
|
|
2286
|
+
override name = 'RoutesProvider.ProviderRateLimitError'
|
|
1941
2287
|
}
|
|
1942
2288
|
|
|
1943
2289
|
/** Error thrown when a provider returns an unsuccessful HTTP response. */
|
|
1944
2290
|
export class ProviderResponseError extends Error {
|
|
1945
|
-
override name = '
|
|
2291
|
+
override name = 'RoutesProvider.ProviderResponseError'
|
|
1946
2292
|
|
|
1947
2293
|
constructor(
|
|
1948
2294
|
/** Provider response status. */
|
|
@@ -1956,13 +2302,13 @@ export class ProviderResponseError extends Error {
|
|
|
1956
2302
|
|
|
1957
2303
|
/** Error thrown when every matching provider fails to produce a quote. */
|
|
1958
2304
|
export class ProviderQuoteError extends Error {
|
|
1959
|
-
override name = '
|
|
2305
|
+
override name = 'RoutesProvider.ProviderQuoteError'
|
|
1960
2306
|
|
|
1961
2307
|
/** Provider failures that prevented a successful quote. */
|
|
1962
2308
|
failures: readonly ProviderFailure[]
|
|
1963
2309
|
|
|
1964
2310
|
/** Bounded provider attempts retained for request logs. */
|
|
1965
|
-
|
|
2311
|
+
routesProviderAttempts: readonly ProviderAttemptResult[]
|
|
1966
2312
|
|
|
1967
2313
|
/** First bounded provider failure retained for request logs. */
|
|
1968
2314
|
providerFailure?: failure.Result | undefined
|
|
@@ -1973,7 +2319,7 @@ export class ProviderQuoteError extends Error {
|
|
|
1973
2319
|
constructor(failures: readonly ProviderFailure[], attempts: readonly ProviderAttempt[] = []) {
|
|
1974
2320
|
super()
|
|
1975
2321
|
this.failures = failures
|
|
1976
|
-
this.
|
|
2322
|
+
this.routesProviderAttempts = attempts.map(formatAttempt)
|
|
1977
2323
|
const values = failures.map(failure)
|
|
1978
2324
|
const first = values[0]
|
|
1979
2325
|
if (first) this.providerFailure = first
|
|
@@ -1983,10 +2329,10 @@ export class ProviderQuoteError extends Error {
|
|
|
1983
2329
|
|
|
1984
2330
|
/** Error thrown when the caller filters to an unknown provider. */
|
|
1985
2331
|
export class UnsupportedProviderError extends Error {
|
|
1986
|
-
override name = '
|
|
2332
|
+
override name = 'RoutesProvider.UnsupportedProviderError'
|
|
1987
2333
|
}
|
|
1988
2334
|
|
|
1989
2335
|
/** Error thrown when the caller supplies an unsupported source chain. */
|
|
1990
2336
|
export class UnsupportedSourceChainError extends Error {
|
|
1991
|
-
override name = '
|
|
2337
|
+
override name = 'RoutesProvider.UnsupportedSourceChainError'
|
|
1992
2338
|
}
|