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
|
@@ -0,0 +1,898 @@
|
|
|
1
|
+
import { AbiEvent, AbiFunction, Address, Hash, Hex } from 'ox';
|
|
2
|
+
import { BlockNotFoundError, parseEventLogs, publicActions, TransactionReceiptNotFoundError, } from 'viem';
|
|
3
|
+
import { Addresses } from 'viem/tempo';
|
|
4
|
+
import * as z from 'zod/mini';
|
|
5
|
+
import * as Schema from '../../Schema.js';
|
|
6
|
+
import * as Viem from '../../Viem.js';
|
|
7
|
+
import * as Action from '../Action.js';
|
|
8
|
+
import * as Chain from '../Chain.js';
|
|
9
|
+
import * as RoutesProvider from '../Provider.js';
|
|
10
|
+
const approve = AbiFunction.from('function approve(address spender, uint256 amount)');
|
|
11
|
+
const approvalEvent = AbiEvent.from('event Approval(address indexed owner, address indexed spender, uint256 value)');
|
|
12
|
+
const defaultFetch = (input, init) => globalThis.fetch(input, init);
|
|
13
|
+
const assets = {
|
|
14
|
+
'eip155:1': '0xA0b86991c6218b36c1d19d4a2e9eb0cE3606eB48',
|
|
15
|
+
'eip155:4217': '0x20C000000000000000000000b9537d11c60E8b50',
|
|
16
|
+
'eip155:8453': '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
|
|
17
|
+
};
|
|
18
|
+
const defaultDestinationPool = '0x8c76e2f6c5ceda9aa7772e7eff30280226c44392';
|
|
19
|
+
const deployments = {
|
|
20
|
+
'eip155:1': {
|
|
21
|
+
eid: 30_101,
|
|
22
|
+
endpoint: '0x1a44076050125825900e736c501f859c50fE728c',
|
|
23
|
+
},
|
|
24
|
+
'eip155:4217': {
|
|
25
|
+
eid: 30_410,
|
|
26
|
+
endpoint: '0x20Bb7C2E2f4e5ca2B4c57060d1aE2615245dCc9C',
|
|
27
|
+
},
|
|
28
|
+
'eip155:8453': {
|
|
29
|
+
eid: 30_184,
|
|
30
|
+
endpoint: '0x1a44076050125825900e736c501f859c50fE728c',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
const oftReceived = AbiEvent.from('event OFTReceived(bytes32 indexed guid, uint32 srcEid, address indexed toAddress, uint256 amountReceivedLD)');
|
|
34
|
+
const oftSent = AbiEvent.from('event OFTSent(bytes32 indexed guid, uint32 dstEid, address indexed fromAddress, uint256 amountSentLD, uint256 amountReceivedLD)');
|
|
35
|
+
const packetSent = AbiEvent.from('event PacketSent(bytes encodedPayload, bytes options, address sendLibrary)');
|
|
36
|
+
const quoteOft = AbiFunction.from('function quoteOFT((uint32 dstEid, bytes32 to, uint256 amountLD, uint256 minAmountLD, bytes extraOptions, bytes composeMsg, bytes oftCmd) sendParam) view returns ((uint256 minAmountLD, uint256 maxAmountLD) limit, (int256 feeAmountLD, string description)[] oftFeeDetails, (uint256 amountSentLD, uint256 amountReceivedLD) receipt)');
|
|
37
|
+
const quoteSend = AbiFunction.from('function quoteSend((uint32 dstEid, bytes32 to, uint256 amountLD, uint256 minAmountLD, bytes extraOptions, bytes composeMsg, bytes oftCmd) sendParam, bool payInLzToken) view returns ((uint256 nativeFee, uint256 lzTokenFee) fee)');
|
|
38
|
+
const send = AbiFunction.from('function send((uint32 dstEid, bytes32 to, uint256 amountLD, uint256 minAmountLD, bytes extraOptions, bytes composeMsg, bytes oftCmd) sendParam, (uint256 nativeFee, uint256 lzTokenFee) fee, address refundAddress) payable returns ((bytes32 guid, uint64 nonce, (uint256 nativeFee, uint256 lzTokenFee) fee) msgReceipt, (uint256 amountSentLD, uint256 amountReceivedLD) oftReceipt)');
|
|
39
|
+
const endpointNativeToken = AbiFunction.from('function nativeToken() view returns (address)');
|
|
40
|
+
const wrap = AbiFunction.from('function wrap(address token, address to, uint256 amount)');
|
|
41
|
+
const quoteTtlMs = 60_000;
|
|
42
|
+
const maximumLogBlockRange = 10000n;
|
|
43
|
+
const transferEvent = AbiEvent.from('event Transfer(address indexed from, address indexed to, uint256 value)');
|
|
44
|
+
const zeroAddress = '0x0000000000000000000000000000000000000000';
|
|
45
|
+
/** Stargate provider schemas. */
|
|
46
|
+
export var schema;
|
|
47
|
+
(function (schema) {
|
|
48
|
+
/** Configuration captured from one selected Stargate route. */
|
|
49
|
+
schema.Configuration = z
|
|
50
|
+
.strictObject({
|
|
51
|
+
destinationPoolAddress: z.optional(z
|
|
52
|
+
.string()
|
|
53
|
+
.check(z.regex(/^0x[0-9a-fA-F]{40}$/), z.describe('Stargate pool contract on the destination chain.'))),
|
|
54
|
+
poolAddress: z
|
|
55
|
+
.string()
|
|
56
|
+
.check(z.regex(/^0x[0-9a-fA-F]{40}$/), z.describe('Stargate pool contract on the source chain.')),
|
|
57
|
+
sourceEid: z.optional(z
|
|
58
|
+
.number()
|
|
59
|
+
.check(z.int(), z.positive(), z.describe('LayerZero endpoint ID for the source chain.'))),
|
|
60
|
+
})
|
|
61
|
+
.check(z.describe('Stargate configuration for one provider route.'));
|
|
62
|
+
})(schema || (schema = {}));
|
|
63
|
+
const transferProviderState = z.object({
|
|
64
|
+
destinationBlockNumber: z.string().check(z.regex(/^\d+$/)),
|
|
65
|
+
routeConfiguration: schema.Configuration,
|
|
66
|
+
stargate: z.object({
|
|
67
|
+
guid: Schema.Hash,
|
|
68
|
+
sourceBlock: z.optional(z.object({
|
|
69
|
+
hash: Schema.Hash,
|
|
70
|
+
number: z.string().check(z.regex(/^\d+$/)),
|
|
71
|
+
})),
|
|
72
|
+
sourceEid: z.number().check(z.int(), z.positive()),
|
|
73
|
+
}),
|
|
74
|
+
});
|
|
75
|
+
/** Creates a direct Stargate V2 OFT route provider. */
|
|
76
|
+
export function stargate(options = {}) {
|
|
77
|
+
const fetch = options.fetch ?? defaultFetch;
|
|
78
|
+
const now = options.now ?? (() => new Date());
|
|
79
|
+
const resolveRpcUrls = options.resolveRpcUrls ?? ((chain) => chain.rpcUrls);
|
|
80
|
+
return RoutesProvider.from({
|
|
81
|
+
id: 'stargate',
|
|
82
|
+
name: 'Stargate',
|
|
83
|
+
async getQuote({ candidate, route }, signal) {
|
|
84
|
+
const deployment = resolveDeployment({
|
|
85
|
+
configuration: candidate.configuration,
|
|
86
|
+
destinationChainId: route.destination.chain.id,
|
|
87
|
+
destinationTokenAddress: route.destination.address,
|
|
88
|
+
sourceChainId: route.source.chain.id,
|
|
89
|
+
sourceTokenAddress: route.source.address,
|
|
90
|
+
});
|
|
91
|
+
const sampledAt = now();
|
|
92
|
+
if (!deployment)
|
|
93
|
+
return unavailable({ message: 'ROUTE_NOT_CONFIGURED', now: sampledAt });
|
|
94
|
+
const sendParam = createSendParam({
|
|
95
|
+
amount: candidate.sourceAmount.amount,
|
|
96
|
+
destinationEid: deployment.destinationEid,
|
|
97
|
+
minimumAmount: '0',
|
|
98
|
+
recipient: quoteRecipient(),
|
|
99
|
+
recipientChainId: route.destination.chain.id,
|
|
100
|
+
});
|
|
101
|
+
const [limit, feeDetails, receipt] = await rpcClient({
|
|
102
|
+
chainId: Number(Chain.eip155Id(route.source.chain)),
|
|
103
|
+
fetch,
|
|
104
|
+
signal,
|
|
105
|
+
urls: resolveRpcUrls(route.source.chain),
|
|
106
|
+
}).readContract({
|
|
107
|
+
abi: [quoteOft],
|
|
108
|
+
address: deployment.pool,
|
|
109
|
+
args: [sendParam],
|
|
110
|
+
functionName: 'quoteOFT',
|
|
111
|
+
});
|
|
112
|
+
if (!isValidQuote({ amount: candidate.sourceAmount.amount, feeDetails, limit, receipt }))
|
|
113
|
+
return unavailable({ message: 'NO_EXACT_ROUTE', now: sampledAt });
|
|
114
|
+
return {
|
|
115
|
+
destinationAmountMin: receipt.amountReceivedLD.toString(),
|
|
116
|
+
destinationAmount: receipt.amountReceivedLD.toString(),
|
|
117
|
+
quality: quality(),
|
|
118
|
+
sampledAt: sampledAt.toISOString(),
|
|
119
|
+
status: 'available',
|
|
120
|
+
};
|
|
121
|
+
},
|
|
122
|
+
async prepareTransfer({ candidate, method, mode, recipient, sender, slippageBps }, signal) {
|
|
123
|
+
if (method !== 'transaction' ||
|
|
124
|
+
mode !== 'exactSource' ||
|
|
125
|
+
!validRecipient(candidate.destinationChain.id, recipient) ||
|
|
126
|
+
!Address.validate(sender, { strict: false }))
|
|
127
|
+
throw new RoutesProvider.ProviderConfigurationError();
|
|
128
|
+
const deployment = resolveDeployment({
|
|
129
|
+
configuration: candidate.configuration,
|
|
130
|
+
destinationChainId: candidate.destinationChain.id,
|
|
131
|
+
destinationTokenAddress: candidate.destinationToken.address,
|
|
132
|
+
sourceChainId: candidate.sourceChain.id,
|
|
133
|
+
sourceTokenAddress: candidate.sourceToken.address,
|
|
134
|
+
});
|
|
135
|
+
if (!deployment)
|
|
136
|
+
throw new RoutesProvider.ProviderUnavailableError();
|
|
137
|
+
const rpc = rpcClient({
|
|
138
|
+
chainId: Number(Chain.eip155Id(candidate.route.source.chain)),
|
|
139
|
+
fetch,
|
|
140
|
+
signal,
|
|
141
|
+
urls: resolveRpcUrls(candidate.route.source.chain),
|
|
142
|
+
});
|
|
143
|
+
const quoteParam = createSendParam({
|
|
144
|
+
amount: candidate.sourceAmount.amount,
|
|
145
|
+
destinationEid: deployment.destinationEid,
|
|
146
|
+
minimumAmount: '0',
|
|
147
|
+
recipient,
|
|
148
|
+
recipientChainId: candidate.destinationChain.id,
|
|
149
|
+
});
|
|
150
|
+
const [[limit, feeDetails, receipt], destinationBlock] = await Promise.all([
|
|
151
|
+
rpc.readContract({
|
|
152
|
+
abi: [quoteOft],
|
|
153
|
+
address: deployment.pool,
|
|
154
|
+
args: [quoteParam],
|
|
155
|
+
functionName: 'quoteOFT',
|
|
156
|
+
}),
|
|
157
|
+
rpcClient({
|
|
158
|
+
chainId: Number(Chain.eip155Id(candidate.route.destination.chain)),
|
|
159
|
+
fetch,
|
|
160
|
+
signal,
|
|
161
|
+
urls: resolveRpcUrls(candidate.route.destination.chain),
|
|
162
|
+
}).getBlock({ blockTag: 'finalized', includeTransactions: false }),
|
|
163
|
+
]);
|
|
164
|
+
if (!isValidQuote({ amount: candidate.sourceAmount.amount, feeDetails, limit, receipt }))
|
|
165
|
+
throw new RoutesProvider.ProviderUnavailableError();
|
|
166
|
+
const quotedMinimum = (receipt.amountReceivedLD * BigInt(10_000 - (slippageBps ?? 0))) / 10000n;
|
|
167
|
+
// Route amount schemas require a positive minimum, including at 100% slippage.
|
|
168
|
+
const destinationAmountMin = quotedMinimum > 0n ? quotedMinimum : 1n;
|
|
169
|
+
const sendParam = createSendParam({
|
|
170
|
+
amount: candidate.sourceAmount.amount,
|
|
171
|
+
destinationEid: deployment.destinationEid,
|
|
172
|
+
minimumAmount: destinationAmountMin.toString(),
|
|
173
|
+
recipient,
|
|
174
|
+
recipientChainId: candidate.destinationChain.id,
|
|
175
|
+
});
|
|
176
|
+
const [endpointFeeToken, messagingFee] = await Promise.all([
|
|
177
|
+
rpc.readContract({
|
|
178
|
+
abi: [endpointNativeToken],
|
|
179
|
+
address: deployment.sourceEndpoint,
|
|
180
|
+
functionName: 'nativeToken',
|
|
181
|
+
}),
|
|
182
|
+
rpc.readContract({
|
|
183
|
+
abi: [quoteSend],
|
|
184
|
+
account: sender,
|
|
185
|
+
address: deployment.pool,
|
|
186
|
+
args: [sendParam, false],
|
|
187
|
+
functionName: 'quoteSend',
|
|
188
|
+
}),
|
|
189
|
+
]);
|
|
190
|
+
if (messagingFee.lzTokenFee !== 0n)
|
|
191
|
+
throw new RoutesProvider.ProviderPayloadError();
|
|
192
|
+
if ((deployment.alternateFee &&
|
|
193
|
+
!Address.isEqual(endpointFeeToken, deployment.alternateFee.token)) ||
|
|
194
|
+
(!deployment.alternateFee && !Address.isEqual(endpointFeeToken, zeroAddress)))
|
|
195
|
+
throw new RoutesProvider.ProviderUnavailableError();
|
|
196
|
+
const action = {
|
|
197
|
+
calls: [
|
|
198
|
+
{
|
|
199
|
+
data: AbiFunction.encodeData(approve, [
|
|
200
|
+
deployment.pool,
|
|
201
|
+
BigInt(candidate.sourceAmount.amount),
|
|
202
|
+
]),
|
|
203
|
+
to: deployment.sourceToken,
|
|
204
|
+
value: '0x0',
|
|
205
|
+
},
|
|
206
|
+
// EndpointV2Alt charges an ERC-20 balance, so mint its fee token before the pool pulls it.
|
|
207
|
+
...(deployment.alternateFee && messagingFee.nativeFee > 0n
|
|
208
|
+
? [
|
|
209
|
+
{
|
|
210
|
+
data: AbiFunction.encodeData(approve, [
|
|
211
|
+
deployment.alternateFee.token,
|
|
212
|
+
messagingFee.nativeFee,
|
|
213
|
+
]),
|
|
214
|
+
to: deployment.alternateFee.paymentToken,
|
|
215
|
+
value: '0x0',
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
data: AbiFunction.encodeData(wrap, [
|
|
219
|
+
deployment.alternateFee.paymentToken,
|
|
220
|
+
sender,
|
|
221
|
+
messagingFee.nativeFee,
|
|
222
|
+
]),
|
|
223
|
+
to: deployment.alternateFee.token,
|
|
224
|
+
value: '0x0',
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
data: AbiFunction.encodeData(approve, [deployment.pool, messagingFee.nativeFee]),
|
|
228
|
+
to: deployment.alternateFee.token,
|
|
229
|
+
value: '0x0',
|
|
230
|
+
},
|
|
231
|
+
]
|
|
232
|
+
: []),
|
|
233
|
+
{
|
|
234
|
+
data: AbiFunction.encodeData(send, [sendParam, messagingFee, sender]),
|
|
235
|
+
to: deployment.pool,
|
|
236
|
+
value: deployment.alternateFee ? '0x0' : Hex.fromNumber(messagingFee.nativeFee),
|
|
237
|
+
},
|
|
238
|
+
],
|
|
239
|
+
type: 'evm:calls',
|
|
240
|
+
};
|
|
241
|
+
validateAction({
|
|
242
|
+
action,
|
|
243
|
+
configuration: candidate.configuration,
|
|
244
|
+
destinationAmountMin: destinationAmountMin.toString(),
|
|
245
|
+
destinationChainId: candidate.destinationChain.id,
|
|
246
|
+
destinationTokenAddress: candidate.destinationToken.address,
|
|
247
|
+
recipient,
|
|
248
|
+
sender,
|
|
249
|
+
sourceAmount: candidate.sourceAmount.amount,
|
|
250
|
+
sourceChainId: candidate.sourceChain.id,
|
|
251
|
+
sourceTokenAddress: candidate.sourceToken.address,
|
|
252
|
+
});
|
|
253
|
+
const sampledAt = now();
|
|
254
|
+
return {
|
|
255
|
+
action,
|
|
256
|
+
destinationAmountMin: destinationAmountMin.toString(),
|
|
257
|
+
destinationAmount: receipt.amountReceivedLD.toString(),
|
|
258
|
+
expiresAt: new Date(sampledAt.getTime() + quoteTtlMs).toISOString(),
|
|
259
|
+
fees: messagingFee.nativeFee === 0n
|
|
260
|
+
? []
|
|
261
|
+
: [
|
|
262
|
+
{
|
|
263
|
+
amount: messagingFee.nativeFee.toString(),
|
|
264
|
+
side: 'source',
|
|
265
|
+
token: feeToken(candidate.sourceChain.id),
|
|
266
|
+
},
|
|
267
|
+
],
|
|
268
|
+
providerState: {
|
|
269
|
+
destinationBlockNumber: destinationBlock.number.toString(),
|
|
270
|
+
routeConfiguration: candidate.configuration,
|
|
271
|
+
},
|
|
272
|
+
quality: quality(),
|
|
273
|
+
sampledAt: sampledAt.toISOString(),
|
|
274
|
+
};
|
|
275
|
+
},
|
|
276
|
+
validateTransferAction({ action, candidate, destinationAmountMin, recipient, sender }) {
|
|
277
|
+
return validateAction({
|
|
278
|
+
action,
|
|
279
|
+
configuration: candidate.configuration,
|
|
280
|
+
destinationAmountMin,
|
|
281
|
+
destinationChainId: candidate.destinationChain.id,
|
|
282
|
+
destinationTokenAddress: candidate.destinationToken.address,
|
|
283
|
+
recipient,
|
|
284
|
+
sender,
|
|
285
|
+
sourceAmount: candidate.sourceAmount.amount,
|
|
286
|
+
sourceChainId: candidate.sourceChain.id,
|
|
287
|
+
sourceTokenAddress: candidate.sourceToken.address,
|
|
288
|
+
});
|
|
289
|
+
},
|
|
290
|
+
async verifyDestinationDelivery({ destinationChain, providerState, sourceChain, transfer }, signal) {
|
|
291
|
+
const state = transferProviderState.safeParse(providerState);
|
|
292
|
+
if (!state.success || !transfer.destinationAmount)
|
|
293
|
+
return { type: 'invalid' };
|
|
294
|
+
return verifyDestinationDelivery({
|
|
295
|
+
configuration: state.data.routeConfiguration,
|
|
296
|
+
destinationAmount: transfer.destinationAmount.baseUnits,
|
|
297
|
+
destinationBlockNumber: state.data.destinationBlockNumber,
|
|
298
|
+
destinationChain,
|
|
299
|
+
destinationTokenAddress: transfer.destinationToken.address,
|
|
300
|
+
fetch,
|
|
301
|
+
guid: state.data.stargate.guid,
|
|
302
|
+
recipient: transfer.recipient,
|
|
303
|
+
rpcUrls: resolveRpcUrls(destinationChain),
|
|
304
|
+
signal,
|
|
305
|
+
sourceChainId: sourceChain.id,
|
|
306
|
+
sourceTokenAddress: transfer.sourceToken.address,
|
|
307
|
+
});
|
|
308
|
+
},
|
|
309
|
+
async verifySourceTransaction({ destinationChain, providerState, routeConfiguration, sourceChain, transactionHash, transfer, }, signal) {
|
|
310
|
+
if (transfer.method !== 'transaction' ||
|
|
311
|
+
transfer.mode !== 'exactSource' ||
|
|
312
|
+
(!transfer.destinationAmountMin && !transfer.destinationAmount) ||
|
|
313
|
+
!transfer.sender)
|
|
314
|
+
return { type: 'invalid' };
|
|
315
|
+
const parsedState = providerState?.['stargate'] === undefined
|
|
316
|
+
? undefined
|
|
317
|
+
: transferProviderState.safeParse(providerState);
|
|
318
|
+
if (parsedState && !parsedState.success)
|
|
319
|
+
return { type: 'invalid' };
|
|
320
|
+
const state = parsedState?.data;
|
|
321
|
+
const configuration = state?.routeConfiguration ?? providerState?.['routeConfiguration'] ?? routeConfiguration;
|
|
322
|
+
const evidence = await verifySourceTransaction({
|
|
323
|
+
alternateFeeAmount: quotedAlternateFeeAmount({
|
|
324
|
+
sourceChainId: sourceChain.id,
|
|
325
|
+
transfer,
|
|
326
|
+
}),
|
|
327
|
+
configuration,
|
|
328
|
+
destinationAmountMin: (transfer.destinationAmountMin ?? transfer.destinationAmount)
|
|
329
|
+
.baseUnits,
|
|
330
|
+
destinationChain,
|
|
331
|
+
destinationTokenAddress: transfer.destinationToken.address,
|
|
332
|
+
fetch,
|
|
333
|
+
recipient: transfer.recipient,
|
|
334
|
+
rpcUrls: resolveRpcUrls(sourceChain),
|
|
335
|
+
sender: transfer.sender,
|
|
336
|
+
signal,
|
|
337
|
+
sourceAmount: transfer.sourceAmount.baseUnits,
|
|
338
|
+
sourceBlock: state?.stargate.sourceBlock
|
|
339
|
+
? {
|
|
340
|
+
hash: state.stargate.sourceBlock.hash,
|
|
341
|
+
number: BigInt(state.stargate.sourceBlock.number),
|
|
342
|
+
}
|
|
343
|
+
: undefined,
|
|
344
|
+
sourceChain,
|
|
345
|
+
sourceTokenAddress: transfer.sourceToken.address,
|
|
346
|
+
transactionHash,
|
|
347
|
+
validAfter: transfer.quote.sampledAt,
|
|
348
|
+
});
|
|
349
|
+
if (evidence.type === 'invalid' || evidence.type === 'related')
|
|
350
|
+
return evidence;
|
|
351
|
+
if (evidence.type === 'reorged') {
|
|
352
|
+
if (!state)
|
|
353
|
+
return { type: 'pending' };
|
|
354
|
+
const { stargate: _stargate, ...providerState } = state;
|
|
355
|
+
return { providerState, type: 'reorged' };
|
|
356
|
+
}
|
|
357
|
+
if (evidence.type !== 'verified')
|
|
358
|
+
return evidence;
|
|
359
|
+
if (state &&
|
|
360
|
+
(!Hex.isEqual(evidence.guid, state.stargate.guid) ||
|
|
361
|
+
evidence.sourceEid !== state.stargate.sourceEid ||
|
|
362
|
+
evidence.destinationAmount !== transfer.destinationAmount?.baseUnits))
|
|
363
|
+
return { type: 'invalid' };
|
|
364
|
+
const destinationBlockNumber = state?.destinationBlockNumber ??
|
|
365
|
+
(typeof providerState?.['destinationBlockNumber'] === 'string' &&
|
|
366
|
+
/^\d+$/.test(providerState['destinationBlockNumber'])
|
|
367
|
+
? providerState['destinationBlockNumber']
|
|
368
|
+
: await blockNumberBefore({
|
|
369
|
+
chain: destinationChain,
|
|
370
|
+
fetch,
|
|
371
|
+
rpcUrls: resolveRpcUrls(destinationChain),
|
|
372
|
+
signal,
|
|
373
|
+
timestamp: transfer.quote.sampledAt,
|
|
374
|
+
}));
|
|
375
|
+
return {
|
|
376
|
+
destinationAmount: evidence.destinationAmount,
|
|
377
|
+
providerState: {
|
|
378
|
+
...providerState,
|
|
379
|
+
destinationBlockNumber,
|
|
380
|
+
routeConfiguration: configuration,
|
|
381
|
+
stargate: {
|
|
382
|
+
guid: evidence.guid,
|
|
383
|
+
sourceBlock: {
|
|
384
|
+
hash: evidence.sourceBlock.hash,
|
|
385
|
+
number: evidence.sourceBlock.number.toString(),
|
|
386
|
+
},
|
|
387
|
+
sourceEid: evidence.sourceEid,
|
|
388
|
+
},
|
|
389
|
+
},
|
|
390
|
+
type: 'verified',
|
|
391
|
+
};
|
|
392
|
+
},
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
/** Validates one direct Stargate action and returns its exact execution allowances. */
|
|
396
|
+
export function validateAction(options) {
|
|
397
|
+
try {
|
|
398
|
+
const action = Action.schema.EvmCalls.parse(options.action);
|
|
399
|
+
const deployment = resolveDeployment({
|
|
400
|
+
configuration: options.configuration,
|
|
401
|
+
destinationChainId: options.destinationChainId,
|
|
402
|
+
destinationTokenAddress: options.destinationTokenAddress,
|
|
403
|
+
sourceChainId: options.sourceChainId,
|
|
404
|
+
sourceTokenAddress: options.sourceTokenAddress,
|
|
405
|
+
});
|
|
406
|
+
if (!deployment || ![2, 5].includes(action.calls.length))
|
|
407
|
+
throw new RoutesProvider.ProviderPayloadError();
|
|
408
|
+
const approval = action.calls[0];
|
|
409
|
+
const execution = action.calls.at(-1);
|
|
410
|
+
validateApproval({
|
|
411
|
+
amount: BigInt(options.sourceAmount),
|
|
412
|
+
call: approval,
|
|
413
|
+
spender: deployment.pool,
|
|
414
|
+
token: deployment.sourceToken,
|
|
415
|
+
});
|
|
416
|
+
const messagingFee = validateSend({
|
|
417
|
+
data: execution.data,
|
|
418
|
+
destinationAmountMin: options.destinationAmountMin,
|
|
419
|
+
destinationEid: deployment.destinationEid,
|
|
420
|
+
nativeFee: deployment.alternateFee ? undefined : BigInt(execution.value),
|
|
421
|
+
pool: deployment.pool,
|
|
422
|
+
recipient: options.recipient,
|
|
423
|
+
recipientChainId: options.destinationChainId,
|
|
424
|
+
sender: options.sender,
|
|
425
|
+
sourceAmount: options.sourceAmount,
|
|
426
|
+
to: execution.to,
|
|
427
|
+
});
|
|
428
|
+
if (!deployment.alternateFee) {
|
|
429
|
+
if (action.calls.length !== 2)
|
|
430
|
+
throw new RoutesProvider.ProviderPayloadError();
|
|
431
|
+
return { nativeValues: [{ to: execution.to, value: execution.value }] };
|
|
432
|
+
}
|
|
433
|
+
if (BigInt(execution.value) !== 0n)
|
|
434
|
+
throw new RoutesProvider.ProviderPayloadError();
|
|
435
|
+
if (messagingFee.nativeFee === 0n) {
|
|
436
|
+
if (action.calls.length !== 2)
|
|
437
|
+
throw new RoutesProvider.ProviderPayloadError();
|
|
438
|
+
return {};
|
|
439
|
+
}
|
|
440
|
+
if (action.calls.length !== 5)
|
|
441
|
+
throw new RoutesProvider.ProviderPayloadError();
|
|
442
|
+
const [paymentApproval, wrapping, feeApproval] = action.calls.slice(1, 4);
|
|
443
|
+
validateApproval({
|
|
444
|
+
amount: messagingFee.nativeFee,
|
|
445
|
+
call: paymentApproval,
|
|
446
|
+
spender: deployment.alternateFee.token,
|
|
447
|
+
token: deployment.alternateFee.paymentToken,
|
|
448
|
+
});
|
|
449
|
+
const [paymentToken, receiver, amount] = AbiFunction.decodeData(wrap, wrapping.data);
|
|
450
|
+
if (!Address.isEqual(wrapping.to, deployment.alternateFee.token) ||
|
|
451
|
+
BigInt(wrapping.value) !== 0n ||
|
|
452
|
+
!Address.isEqual(paymentToken, deployment.alternateFee.paymentToken) ||
|
|
453
|
+
!Address.isEqual(receiver, options.sender) ||
|
|
454
|
+
amount !== messagingFee.nativeFee)
|
|
455
|
+
throw new RoutesProvider.ProviderPayloadError();
|
|
456
|
+
validateApproval({
|
|
457
|
+
amount: messagingFee.nativeFee,
|
|
458
|
+
call: feeApproval,
|
|
459
|
+
spender: deployment.pool,
|
|
460
|
+
token: deployment.alternateFee.token,
|
|
461
|
+
});
|
|
462
|
+
return {
|
|
463
|
+
tokenApprovals: [
|
|
464
|
+
{
|
|
465
|
+
amount: messagingFee.nativeFee.toString(),
|
|
466
|
+
spender: deployment.alternateFee.token,
|
|
467
|
+
token: deployment.alternateFee.paymentToken,
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
amount: messagingFee.nativeFee.toString(),
|
|
471
|
+
spender: deployment.pool,
|
|
472
|
+
token: deployment.alternateFee.token,
|
|
473
|
+
},
|
|
474
|
+
],
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
catch (cause) {
|
|
478
|
+
if (cause instanceof RoutesProvider.ProviderPayloadError)
|
|
479
|
+
throw cause;
|
|
480
|
+
throw new RoutesProvider.ProviderPayloadError();
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
/** Verifies a submitted Stargate source transaction against stored transfer terms. */
|
|
484
|
+
export async function verifySourceTransaction(options) {
|
|
485
|
+
const deployment = resolveDeployment({
|
|
486
|
+
configuration: options.configuration,
|
|
487
|
+
destinationChainId: options.destinationChain.id,
|
|
488
|
+
destinationTokenAddress: options.destinationTokenAddress,
|
|
489
|
+
sourceChainId: options.sourceChain.id,
|
|
490
|
+
sourceTokenAddress: options.sourceTokenAddress,
|
|
491
|
+
});
|
|
492
|
+
if (!deployment ||
|
|
493
|
+
options.sourceChain.kind !== 'evm' ||
|
|
494
|
+
!Hash.validate(options.transactionHash) ||
|
|
495
|
+
!validRecipient(options.destinationChain.id, options.recipient) ||
|
|
496
|
+
!Address.validate(options.sender, { strict: false }))
|
|
497
|
+
return { type: 'invalid' };
|
|
498
|
+
const rpc = rpcClient({
|
|
499
|
+
chainId: Number(Chain.eip155Id(options.sourceChain)),
|
|
500
|
+
fetch: options.fetch ?? defaultFetch,
|
|
501
|
+
signal: options.signal,
|
|
502
|
+
urls: options.rpcUrls ?? options.sourceChain.rpcUrls,
|
|
503
|
+
});
|
|
504
|
+
const hash = options.transactionHash;
|
|
505
|
+
const [chainId, receipt] = await Promise.all([
|
|
506
|
+
rpc.getChainId(),
|
|
507
|
+
rpc.getTransactionReceipt({ hash }).catch((cause) => {
|
|
508
|
+
if (cause instanceof TransactionReceiptNotFoundError)
|
|
509
|
+
return undefined;
|
|
510
|
+
throw cause;
|
|
511
|
+
}),
|
|
512
|
+
]);
|
|
513
|
+
if (chainId !== Number(Chain.eip155Id(options.sourceChain)))
|
|
514
|
+
return { type: 'invalid' };
|
|
515
|
+
const block = !receipt || receipt.blockNumber === null
|
|
516
|
+
? undefined
|
|
517
|
+
: await rpc
|
|
518
|
+
.getBlock({ blockNumber: receipt.blockNumber, includeTransactions: false })
|
|
519
|
+
.catch((cause) => {
|
|
520
|
+
if (cause instanceof BlockNotFoundError)
|
|
521
|
+
return undefined;
|
|
522
|
+
throw cause;
|
|
523
|
+
});
|
|
524
|
+
if (!receipt ||
|
|
525
|
+
receipt.blockNumber === null ||
|
|
526
|
+
!block ||
|
|
527
|
+
!Hex.isEqual(block.hash, receipt.blockHash)) {
|
|
528
|
+
if (!options.sourceBlock)
|
|
529
|
+
return { type: 'pending' };
|
|
530
|
+
const finalized = await rpc.getBlock({ blockTag: 'finalized', includeTransactions: false });
|
|
531
|
+
if (finalized.number < options.sourceBlock.number)
|
|
532
|
+
return { type: 'pending' };
|
|
533
|
+
const canonical = await rpc
|
|
534
|
+
.getBlock({ blockNumber: options.sourceBlock.number, includeTransactions: false })
|
|
535
|
+
.catch((cause) => {
|
|
536
|
+
if (cause instanceof BlockNotFoundError)
|
|
537
|
+
return undefined;
|
|
538
|
+
throw cause;
|
|
539
|
+
});
|
|
540
|
+
if (!canonical || Hex.isEqual(canonical.hash, options.sourceBlock.hash))
|
|
541
|
+
return { type: 'pending' };
|
|
542
|
+
return { type: 'reorged' };
|
|
543
|
+
}
|
|
544
|
+
if (receipt.status !== 'success')
|
|
545
|
+
return { type: 'invalid' };
|
|
546
|
+
const validAfter = Math.floor(Date.parse(options.validAfter) / 1_000);
|
|
547
|
+
if (!Number.isSafeInteger(validAfter) || block.timestamp < BigInt(validAfter))
|
|
548
|
+
return { type: 'invalid' };
|
|
549
|
+
const amount = BigInt(options.sourceAmount);
|
|
550
|
+
const destinationAmountMin = BigInt(options.destinationAmountMin);
|
|
551
|
+
const sourceEvents = parseEventLogs({ abi: [oftSent], logs: receipt.logs, strict: true }).filter(({ address, args }) => Address.isEqual(address, deployment.pool) &&
|
|
552
|
+
args.dstEid === deployment.destinationEid &&
|
|
553
|
+
Address.isEqual(args.fromAddress, options.sender) &&
|
|
554
|
+
args.amountSentLD === amount &&
|
|
555
|
+
args.amountReceivedLD >= destinationAmountMin);
|
|
556
|
+
const transfers = parseEventLogs({
|
|
557
|
+
abi: [transferEvent],
|
|
558
|
+
logs: receipt.logs,
|
|
559
|
+
strict: true,
|
|
560
|
+
}).filter(({ address, args }) => Address.isEqual(address, deployment.sourceToken) &&
|
|
561
|
+
Address.isEqual(args.from, options.sender) &&
|
|
562
|
+
Address.isEqual(args.to, deployment.pool) &&
|
|
563
|
+
args.value === amount);
|
|
564
|
+
if (sourceEvents.length !== 1 || transfers.length !== 1) {
|
|
565
|
+
const approvals = parseEventLogs({
|
|
566
|
+
abi: [approvalEvent],
|
|
567
|
+
logs: receipt.logs,
|
|
568
|
+
strict: true,
|
|
569
|
+
});
|
|
570
|
+
const sourceApprovals = approvals.filter(({ address, args }) => Address.isEqual(address, deployment.sourceToken) &&
|
|
571
|
+
Address.isEqual(args.owner, options.sender) &&
|
|
572
|
+
Address.isEqual(args.spender, deployment.pool) &&
|
|
573
|
+
args.value === amount);
|
|
574
|
+
if (sourceApprovals.length === 1)
|
|
575
|
+
return { type: 'related' };
|
|
576
|
+
if (!deployment.alternateFee || options.alternateFeeAmount === undefined)
|
|
577
|
+
return { type: 'invalid' };
|
|
578
|
+
const alternateFee = deployment.alternateFee;
|
|
579
|
+
const alternateFeeAmount = BigInt(options.alternateFeeAmount);
|
|
580
|
+
const paymentApprovals = approvals.filter(({ address, args }) => Address.isEqual(address, alternateFee.paymentToken) &&
|
|
581
|
+
Address.isEqual(args.owner, options.sender) &&
|
|
582
|
+
Address.isEqual(args.spender, alternateFee.token) &&
|
|
583
|
+
args.value === alternateFeeAmount);
|
|
584
|
+
if (paymentApprovals.length === 1)
|
|
585
|
+
return { type: 'related' };
|
|
586
|
+
const feeApprovals = approvals.filter(({ address, args }) => Address.isEqual(address, alternateFee.token) &&
|
|
587
|
+
Address.isEqual(args.owner, options.sender) &&
|
|
588
|
+
Address.isEqual(args.spender, deployment.pool) &&
|
|
589
|
+
args.value === alternateFeeAmount);
|
|
590
|
+
if (feeApprovals.length === 1)
|
|
591
|
+
return { type: 'related' };
|
|
592
|
+
const relatedTransfers = parseEventLogs({
|
|
593
|
+
abi: [transferEvent],
|
|
594
|
+
logs: receipt.logs,
|
|
595
|
+
strict: true,
|
|
596
|
+
});
|
|
597
|
+
const paymentTransfers = relatedTransfers.filter(({ address, args }) => Address.isEqual(address, alternateFee.paymentToken) &&
|
|
598
|
+
Address.isEqual(args.from, options.sender) &&
|
|
599
|
+
Address.isEqual(args.to, alternateFee.token) &&
|
|
600
|
+
args.value === alternateFeeAmount);
|
|
601
|
+
const wrappedTransfers = relatedTransfers.filter(({ address, args }) => Address.isEqual(address, alternateFee.token) &&
|
|
602
|
+
Address.isEqual(args.from, zeroAddress) &&
|
|
603
|
+
Address.isEqual(args.to, options.sender) &&
|
|
604
|
+
args.value === alternateFeeAmount);
|
|
605
|
+
return paymentTransfers.length === 1 && wrappedTransfers.length === 1
|
|
606
|
+
? { type: 'related' }
|
|
607
|
+
: { type: 'invalid' };
|
|
608
|
+
}
|
|
609
|
+
const sourceEvent = sourceEvents[0];
|
|
610
|
+
const destinationAmount = sourceEvent.args.amountReceivedLD;
|
|
611
|
+
const guid = sourceEvent.args.guid;
|
|
612
|
+
// PacketV1's 113-byte header is followed by Stargate's type, asset id, recipient, and amount.
|
|
613
|
+
const packets = parseEventLogs({ abi: [packetSent], logs: receipt.logs, strict: true }).filter(({ address, args }) => {
|
|
614
|
+
const packet = args.encodedPayload;
|
|
615
|
+
return (Address.isEqual(address, deployment.sourceEndpoint) &&
|
|
616
|
+
Hex.size(packet) === 156 &&
|
|
617
|
+
Hex.toNumber(Hex.slice(packet, 0, 1)) === 1 &&
|
|
618
|
+
Hex.toNumber(Hex.slice(packet, 9, 13)) === deployment.sourceEid &&
|
|
619
|
+
Hex.toNumber(Hex.slice(packet, 45, 49)) === deployment.destinationEid &&
|
|
620
|
+
Hex.isEqual(Hex.slice(packet, 81, 113), guid) &&
|
|
621
|
+
Hex.toNumber(Hex.slice(packet, 113, 114)) === 1 &&
|
|
622
|
+
Hex.isEqual(Hex.slice(packet, 116, 148), recipientBytes32(options.destinationChain.id, options.recipient)) &&
|
|
623
|
+
Hex.toBigInt(Hex.slice(packet, 148, 156)) === destinationAmount);
|
|
624
|
+
});
|
|
625
|
+
if (packets.length !== 1)
|
|
626
|
+
return { type: 'invalid' };
|
|
627
|
+
return {
|
|
628
|
+
destinationAmount: destinationAmount.toString(),
|
|
629
|
+
guid,
|
|
630
|
+
sourceBlock: { hash: block.hash, number: block.number },
|
|
631
|
+
sourceEid: deployment.sourceEid,
|
|
632
|
+
type: 'verified',
|
|
633
|
+
};
|
|
634
|
+
}
|
|
635
|
+
function quotedAlternateFeeAmount(options) {
|
|
636
|
+
if (options.sourceChainId !== 'eip155:4217')
|
|
637
|
+
return undefined;
|
|
638
|
+
const fees = options.transfer.fees.filter((fee) => fee.side === 'source' &&
|
|
639
|
+
fee.type === 'provider' &&
|
|
640
|
+
Address.validate(fee.token.address, { strict: false }) &&
|
|
641
|
+
Address.isEqual(fee.token.address, Addresses.pathUsd));
|
|
642
|
+
return fees.length === 1 ? fees[0].amount.baseUnits : undefined;
|
|
643
|
+
}
|
|
644
|
+
/** Finds and verifies the included Stargate delivery directly on the destination chain. */
|
|
645
|
+
export async function verifyDestinationDelivery(options) {
|
|
646
|
+
const deployment = resolveDeployment({
|
|
647
|
+
configuration: options.configuration,
|
|
648
|
+
destinationChainId: options.destinationChain.id,
|
|
649
|
+
destinationTokenAddress: options.destinationTokenAddress,
|
|
650
|
+
sourceChainId: options.sourceChainId,
|
|
651
|
+
sourceTokenAddress: options.sourceTokenAddress,
|
|
652
|
+
});
|
|
653
|
+
if (!deployment ||
|
|
654
|
+
!deployment.destinationPool ||
|
|
655
|
+
options.destinationChain.kind !== 'evm' ||
|
|
656
|
+
!/^\d+$/.test(options.destinationBlockNumber) ||
|
|
657
|
+
!Hash.validate(options.guid) ||
|
|
658
|
+
!Address.validate(options.recipient, { strict: false }))
|
|
659
|
+
return { type: 'invalid' };
|
|
660
|
+
const destinationPool = deployment.destinationPool;
|
|
661
|
+
const rpc = rpcClient({
|
|
662
|
+
chainId: Number(Chain.eip155Id(options.destinationChain)),
|
|
663
|
+
fetch: options.fetch ?? defaultFetch,
|
|
664
|
+
signal: options.signal,
|
|
665
|
+
urls: options.rpcUrls ?? options.destinationChain.rpcUrls,
|
|
666
|
+
});
|
|
667
|
+
// Tempo completion favors latency over reorg protection; other destinations retain finality.
|
|
668
|
+
const blockTag = options.destinationChain.id === 'eip155:4217' ? 'latest' : 'finalized';
|
|
669
|
+
const [chainId, head] = await Promise.all([
|
|
670
|
+
rpc.getChainId(),
|
|
671
|
+
rpc.getBlock({ blockTag, includeTransactions: false }),
|
|
672
|
+
]);
|
|
673
|
+
if (chainId !== Number(Chain.eip155Id(options.destinationChain)))
|
|
674
|
+
return { type: 'invalid' };
|
|
675
|
+
const amount = BigInt(options.destinationAmount);
|
|
676
|
+
const discovered = await (async () => {
|
|
677
|
+
for (let fromBlock = BigInt(options.destinationBlockNumber); fromBlock <= head.number; fromBlock += maximumLogBlockRange) {
|
|
678
|
+
const toBlock = fromBlock + maximumLogBlockRange - 1n;
|
|
679
|
+
const logs = await rpc.getLogs({
|
|
680
|
+
address: destinationPool,
|
|
681
|
+
args: { guid: options.guid, toAddress: options.recipient },
|
|
682
|
+
event: oftReceived,
|
|
683
|
+
fromBlock,
|
|
684
|
+
strict: true,
|
|
685
|
+
toBlock: toBlock > head.number ? head.number : toBlock,
|
|
686
|
+
});
|
|
687
|
+
const matches = logs.filter(({ args, transactionHash }) => transactionHash &&
|
|
688
|
+
args.srcEid === deployment.sourceEid &&
|
|
689
|
+
args.amountReceivedLD === amount);
|
|
690
|
+
if (logs.length !== matches.length || matches.length > 1)
|
|
691
|
+
return { type: 'invalid' };
|
|
692
|
+
if (matches[0]?.transactionHash)
|
|
693
|
+
return { transactionHash: matches[0].transactionHash, type: 'found' };
|
|
694
|
+
}
|
|
695
|
+
return { type: 'pending' };
|
|
696
|
+
})();
|
|
697
|
+
if (discovered.type !== 'found')
|
|
698
|
+
return discovered;
|
|
699
|
+
const { transactionHash } = discovered;
|
|
700
|
+
const receipt = await rpc.getTransactionReceipt({ hash: transactionHash }).catch((cause) => {
|
|
701
|
+
if (cause instanceof TransactionReceiptNotFoundError)
|
|
702
|
+
return undefined;
|
|
703
|
+
throw cause;
|
|
704
|
+
});
|
|
705
|
+
if (!receipt || receipt.blockNumber === null)
|
|
706
|
+
return { type: 'pending' };
|
|
707
|
+
if (receipt.status !== 'success' || receipt.blockNumber > head.number)
|
|
708
|
+
return { type: 'invalid' };
|
|
709
|
+
const transfers = parseEventLogs({
|
|
710
|
+
abi: [transferEvent],
|
|
711
|
+
logs: receipt.logs,
|
|
712
|
+
strict: true,
|
|
713
|
+
}).filter(({ address, args }) => Address.isEqual(address, options.destinationTokenAddress) &&
|
|
714
|
+
Address.isEqual(args.from, options.destinationChain.id === 'eip155:4217' ? zeroAddress : destinationPool) &&
|
|
715
|
+
Address.isEqual(args.to, options.recipient) &&
|
|
716
|
+
args.value === amount);
|
|
717
|
+
if (transfers.length !== 1)
|
|
718
|
+
return { type: 'invalid' };
|
|
719
|
+
return { transactionHash, type: 'verified' };
|
|
720
|
+
}
|
|
721
|
+
function rpcClient(options) {
|
|
722
|
+
if (options.urls.length === 0)
|
|
723
|
+
throw new RoutesProvider.ProviderConfigurationError();
|
|
724
|
+
return Viem.createEvmClient(options).extend(publicActions);
|
|
725
|
+
}
|
|
726
|
+
async function blockNumberBefore(options) {
|
|
727
|
+
if (options.chain.kind !== 'evm')
|
|
728
|
+
throw new RoutesProvider.ProviderConfigurationError();
|
|
729
|
+
const timestamp = Date.parse(options.timestamp);
|
|
730
|
+
if (!Number.isFinite(timestamp))
|
|
731
|
+
throw new RoutesProvider.ProviderPayloadError();
|
|
732
|
+
const rpc = rpcClient({
|
|
733
|
+
chainId: Number(Chain.eip155Id(options.chain)),
|
|
734
|
+
fetch: options.fetch,
|
|
735
|
+
signal: options.signal,
|
|
736
|
+
urls: options.rpcUrls ?? options.chain.rpcUrls,
|
|
737
|
+
});
|
|
738
|
+
const [chainId, finalized] = await Promise.all([
|
|
739
|
+
rpc.getChainId(),
|
|
740
|
+
rpc.getBlock({ blockTag: 'finalized', includeTransactions: false }),
|
|
741
|
+
]);
|
|
742
|
+
if (chainId !== Number(Chain.eip155Id(options.chain)))
|
|
743
|
+
throw new RoutesProvider.ProviderConfigurationError();
|
|
744
|
+
const target = BigInt(Math.floor(timestamp / 1_000) - 1);
|
|
745
|
+
let lower = 0n;
|
|
746
|
+
let upper = finalized.number;
|
|
747
|
+
while (lower < upper) {
|
|
748
|
+
const middle = (lower + upper + 1n) / 2n;
|
|
749
|
+
const block = await rpc.getBlock({ blockNumber: middle, includeTransactions: false });
|
|
750
|
+
if (block.timestamp <= target)
|
|
751
|
+
lower = middle;
|
|
752
|
+
else
|
|
753
|
+
upper = middle - 1n;
|
|
754
|
+
}
|
|
755
|
+
return lower.toString();
|
|
756
|
+
}
|
|
757
|
+
function createSendParam(options) {
|
|
758
|
+
const amount = BigInt(options.amount);
|
|
759
|
+
return {
|
|
760
|
+
amountLD: amount,
|
|
761
|
+
composeMsg: '0x',
|
|
762
|
+
dstEid: options.destinationEid,
|
|
763
|
+
extraOptions: '0x',
|
|
764
|
+
minAmountLD: BigInt(options.minimumAmount),
|
|
765
|
+
oftCmd: '0x',
|
|
766
|
+
to: recipientBytes32(options.recipientChainId, options.recipient),
|
|
767
|
+
};
|
|
768
|
+
}
|
|
769
|
+
function isValidQuote(options) {
|
|
770
|
+
const amount = BigInt(options.amount);
|
|
771
|
+
const fees = options.feeDetails.reduce((total, fee) => total + fee.feeAmountLD, 0n);
|
|
772
|
+
return (amount >= options.limit.minAmountLD &&
|
|
773
|
+
amount <= options.limit.maxAmountLD &&
|
|
774
|
+
options.receipt.amountSentLD === amount &&
|
|
775
|
+
options.receipt.amountReceivedLD > 0n &&
|
|
776
|
+
options.receipt.amountReceivedLD === amount + fees);
|
|
777
|
+
}
|
|
778
|
+
function feeToken(sourceChainId) {
|
|
779
|
+
if (sourceChainId === 'eip155:4217')
|
|
780
|
+
return {
|
|
781
|
+
address: Addresses.pathUsd,
|
|
782
|
+
currency: 'USD',
|
|
783
|
+
decimals: 6,
|
|
784
|
+
name: 'pathUSD',
|
|
785
|
+
standard: 'TIP-20',
|
|
786
|
+
symbol: 'pathUSD',
|
|
787
|
+
tokenKey: `${sourceChainId}/erc20:${Addresses.pathUsd.toLowerCase()}`,
|
|
788
|
+
verified: true,
|
|
789
|
+
};
|
|
790
|
+
return {
|
|
791
|
+
address: '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee',
|
|
792
|
+
currency: 'ETH',
|
|
793
|
+
decimals: 18,
|
|
794
|
+
name: 'Ether',
|
|
795
|
+
standard: 'native',
|
|
796
|
+
symbol: 'ETH',
|
|
797
|
+
tokenKey: `${sourceChainId}/slip44:60`,
|
|
798
|
+
verified: true,
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
function quality() {
|
|
802
|
+
return {
|
|
803
|
+
liquiditySource: 'onchain',
|
|
804
|
+
sourceDetail: 'stargate:oft-v2:taxi',
|
|
805
|
+
tier: 'liquid',
|
|
806
|
+
};
|
|
807
|
+
}
|
|
808
|
+
function quoteRecipient() {
|
|
809
|
+
return zeroAddress;
|
|
810
|
+
}
|
|
811
|
+
function recipientBytes32(chainId, recipient) {
|
|
812
|
+
if (chainId.startsWith('eip155:') && Address.validate(recipient, { strict: false }))
|
|
813
|
+
return Hex.padLeft(recipient, 32);
|
|
814
|
+
throw new RoutesProvider.ProviderConfigurationError();
|
|
815
|
+
}
|
|
816
|
+
function validRecipient(chainId, recipient) {
|
|
817
|
+
try {
|
|
818
|
+
recipientBytes32(chainId, recipient);
|
|
819
|
+
return true;
|
|
820
|
+
}
|
|
821
|
+
catch {
|
|
822
|
+
return false;
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
function validateApproval(options) {
|
|
826
|
+
if (!Address.isEqual(options.call.to, options.token) ||
|
|
827
|
+
BigInt(options.call.value) !== 0n)
|
|
828
|
+
throw new RoutesProvider.ProviderPayloadError();
|
|
829
|
+
const [spender, amount] = AbiFunction.decodeData(approve, options.call.data);
|
|
830
|
+
if (!Address.isEqual(spender, options.spender) || amount !== options.amount)
|
|
831
|
+
throw new RoutesProvider.ProviderPayloadError();
|
|
832
|
+
}
|
|
833
|
+
function validateSend(options) {
|
|
834
|
+
const [sendParam, messagingFee, refundAddress] = AbiFunction.decodeData(send, options.data);
|
|
835
|
+
const amount = BigInt(options.sourceAmount);
|
|
836
|
+
if (!Address.isEqual(options.to, options.pool) ||
|
|
837
|
+
sendParam.amountLD !== amount ||
|
|
838
|
+
sendParam.composeMsg !== '0x' ||
|
|
839
|
+
sendParam.dstEid !== options.destinationEid ||
|
|
840
|
+
sendParam.extraOptions !== '0x' ||
|
|
841
|
+
sendParam.minAmountLD !== BigInt(options.destinationAmountMin) ||
|
|
842
|
+
sendParam.oftCmd !== '0x' ||
|
|
843
|
+
!Hex.isEqual(sendParam.to, recipientBytes32(options.recipientChainId, options.recipient)) ||
|
|
844
|
+
messagingFee.lzTokenFee !== 0n ||
|
|
845
|
+
(options.nativeFee !== undefined && messagingFee.nativeFee !== options.nativeFee) ||
|
|
846
|
+
!Address.isEqual(refundAddress, options.sender))
|
|
847
|
+
throw new RoutesProvider.ProviderPayloadError();
|
|
848
|
+
return messagingFee;
|
|
849
|
+
}
|
|
850
|
+
function resolveDeployment(options) {
|
|
851
|
+
const parsed = schema.Configuration.safeParse(options.configuration);
|
|
852
|
+
const source = deployments[options.sourceChainId];
|
|
853
|
+
const destination = deployments[options.destinationChainId];
|
|
854
|
+
const sourceEid = parsed.success && (parsed.data.sourceEid ?? source?.eid);
|
|
855
|
+
if (!parsed.success ||
|
|
856
|
+
!destination ||
|
|
857
|
+
!source ||
|
|
858
|
+
!sourceEid ||
|
|
859
|
+
!options.sourceChainId.startsWith('eip155:') ||
|
|
860
|
+
!('endpoint' in source) ||
|
|
861
|
+
!matchesAsset(options.destinationChainId, options.destinationTokenAddress) ||
|
|
862
|
+
!matchesAsset(options.sourceChainId, options.sourceTokenAddress) ||
|
|
863
|
+
options.sourceChainId === options.destinationChainId)
|
|
864
|
+
return undefined;
|
|
865
|
+
const destinationPoolAddress = parsed.data.destinationPoolAddress ??
|
|
866
|
+
(options.destinationChainId === 'eip155:4217' ? defaultDestinationPool : undefined);
|
|
867
|
+
return {
|
|
868
|
+
...(options.sourceChainId === 'eip155:4217'
|
|
869
|
+
? {
|
|
870
|
+
alternateFee: {
|
|
871
|
+
paymentToken: Address.checksum(Addresses.pathUsd),
|
|
872
|
+
token: '0x0cEb237E109eE22374a567c6b09F373C73FA4cBb',
|
|
873
|
+
},
|
|
874
|
+
}
|
|
875
|
+
: {}),
|
|
876
|
+
destinationEid: destination.eid,
|
|
877
|
+
destinationPool: destinationPoolAddress ? Address.checksum(destinationPoolAddress) : undefined,
|
|
878
|
+
pool: Address.checksum(parsed.data.poolAddress),
|
|
879
|
+
sourceEid,
|
|
880
|
+
sourceEndpoint: Address.checksum(source.endpoint),
|
|
881
|
+
sourceToken: Address.checksum(options.sourceTokenAddress),
|
|
882
|
+
};
|
|
883
|
+
}
|
|
884
|
+
function matchesAsset(chainId, address) {
|
|
885
|
+
const asset = assets[chainId];
|
|
886
|
+
return (asset !== undefined &&
|
|
887
|
+
Address.validate(address, { strict: false }) &&
|
|
888
|
+
Address.isEqual(address, asset));
|
|
889
|
+
}
|
|
890
|
+
function unavailable(options) {
|
|
891
|
+
return RoutesProvider.unavailableResult({
|
|
892
|
+
detail: 'stargate:oft-v2',
|
|
893
|
+
message: options.message,
|
|
894
|
+
now: options.now,
|
|
895
|
+
source: 'onchain',
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
//# sourceMappingURL=stargate.js.map
|