tapimo 0.13.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -4
- package/dist/ApiKey.js +1 -1
- package/dist/ApiKey.js.map +1 -1
- package/dist/ApiKeys.d.ts +95 -14
- package/dist/ApiKeys.d.ts.map +1 -1
- package/dist/ApiKeys.js +360 -49
- package/dist/ApiKeys.js.map +1 -1
- package/dist/App.d.ts +21383 -18056
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +301 -22
- package/dist/App.js.map +1 -1
- package/dist/Assets.d.ts.map +1 -1
- package/dist/Assets.js +2 -1
- package/dist/Assets.js.map +1 -1
- package/dist/Handler.d.ts +0 -1
- package/dist/Handler.d.ts.map +1 -1
- package/dist/Handler.js +0 -1
- package/dist/Handler.js.map +1 -1
- package/dist/Scope.d.ts +13 -5
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +16 -5
- package/dist/Scope.js.map +1 -1
- package/dist/Webhooks.js +2 -2
- package/dist/Webhooks.js.map +1 -1
- package/dist/admin/App.d.ts +3936 -1337
- package/dist/admin/App.d.ts.map +1 -1
- package/dist/admin/App.js +26 -5
- package/dist/admin/App.js.map +1 -1
- package/dist/admin/apps/api-keys.d.ts +159 -7
- package/dist/admin/apps/api-keys.d.ts.map +1 -1
- package/dist/admin/apps/api-keys.js +95 -43
- package/dist/admin/apps/api-keys.js.map +1 -1
- package/dist/admin/apps/earn-vaults.d.ts +1446 -0
- package/dist/admin/apps/earn-vaults.d.ts.map +1 -1
- package/dist/admin/apps/earn-vaults.js +465 -8
- package/dist/admin/apps/earn-vaults.js.map +1 -1
- package/dist/admin/apps/organizations.d.ts +344 -3
- package/dist/admin/apps/organizations.d.ts.map +1 -1
- package/dist/admin/apps/organizations.js +288 -10
- package/dist/admin/apps/organizations.js.map +1 -1
- package/dist/admin/apps/routes-support.d.ts +95 -0
- package/dist/admin/apps/routes-support.d.ts.map +1 -0
- package/dist/admin/apps/routes-support.js +151 -0
- package/dist/admin/apps/routes-support.js.map +1 -0
- package/dist/admin/apps/routes.d.ts +2764 -0
- package/dist/admin/apps/routes.d.ts.map +1 -0
- package/dist/admin/apps/routes.js +728 -0
- package/dist/admin/apps/routes.js.map +1 -0
- package/dist/admin/apps/subsidies.d.ts +501 -0
- package/dist/admin/apps/subsidies.d.ts.map +1 -0
- package/dist/admin/apps/subsidies.js +384 -0
- package/dist/admin/apps/subsidies.js.map +1 -0
- package/dist/admin/apps/verified-tokens.d.ts +16 -16
- package/dist/admin/apps/verified-tokens.d.ts.map +1 -1
- package/dist/admin/apps/verified-tokens.js +3 -3
- package/dist/admin/apps/verified-tokens.js.map +1 -1
- package/dist/admin/ui.generated.d.ts +1 -1
- package/dist/admin/ui.generated.d.ts.map +1 -1
- package/dist/admin/ui.generated.js +129 -69
- package/dist/admin/ui.generated.js.map +1 -1
- package/dist/analytics/Analytics.d.ts +5 -2
- package/dist/analytics/Analytics.d.ts.map +1 -1
- package/dist/analytics/Analytics.js +31 -1
- package/dist/analytics/Analytics.js.map +1 -1
- package/dist/analytics/tables/requestEvents.d.ts +2 -1
- package/dist/analytics/tables/requestEvents.d.ts.map +1 -1
- package/dist/analytics/tables/requestEvents.js +10 -1
- package/dist/analytics/tables/requestEvents.js.map +1 -1
- package/dist/analytics/tables/routesLifecycleIntervals.d.ts +72 -0
- package/dist/analytics/tables/routesLifecycleIntervals.d.ts.map +1 -0
- package/dist/analytics/tables/routesLifecycleIntervals.js +56 -0
- package/dist/analytics/tables/routesLifecycleIntervals.js.map +1 -0
- package/dist/apps/Zones.d.ts +21 -12526
- package/dist/apps/Zones.d.ts.map +1 -1
- package/dist/apps/Zones.js +40 -8
- package/dist/apps/Zones.js.map +1 -1
- package/dist/apps/data/App.d.ts +4310 -2548
- package/dist/apps/data/App.d.ts.map +1 -1
- package/dist/apps/data/App.js +86 -26
- package/dist/apps/data/App.js.map +1 -1
- package/dist/apps/data/routes/activities.d.ts +364 -34
- package/dist/apps/data/routes/activities.d.ts.map +1 -1
- package/dist/apps/data/routes/activities.js +495 -190
- package/dist/apps/data/routes/activities.js.map +1 -1
- package/dist/apps/data/routes/addresses.d.ts +94 -22
- package/dist/apps/data/routes/addresses.d.ts.map +1 -1
- package/dist/apps/data/routes/blocks.d.ts +37 -37
- package/dist/apps/data/routes/coingecko.d.ts.map +1 -1
- package/dist/apps/data/routes/coingecko.js +47 -21
- package/dist/apps/data/routes/coingecko.js.map +1 -1
- package/dist/apps/data/routes/earn.d.ts +1641 -352
- package/dist/apps/data/routes/earn.d.ts.map +1 -1
- package/dist/apps/data/routes/earn.js +1561 -120
- package/dist/apps/data/routes/earn.js.map +1 -1
- package/dist/apps/data/routes/exchanges.d.ts +15 -0
- package/dist/apps/data/routes/exchanges.d.ts.map +1 -1
- package/dist/apps/data/routes/exchanges.js +180 -114
- package/dist/apps/data/routes/exchanges.js.map +1 -1
- package/dist/apps/data/routes/fee-amm.d.ts +5 -0
- package/dist/apps/data/routes/fee-amm.d.ts.map +1 -1
- package/dist/apps/data/routes/fee-amm.js +49 -38
- package/dist/apps/data/routes/fee-amm.js.map +1 -1
- package/dist/apps/data/routes/indexer.d.ts +125 -0
- package/dist/apps/data/routes/indexer.d.ts.map +1 -1
- package/dist/apps/data/routes/indexer.js +83 -27
- package/dist/apps/data/routes/indexer.js.map +1 -1
- package/dist/apps/data/routes/rpc.d.ts +507 -33
- package/dist/apps/data/routes/rpc.d.ts.map +1 -1
- package/dist/apps/data/routes/rpc.js +266 -156
- package/dist/apps/data/routes/rpc.js.map +1 -1
- package/dist/apps/data/routes/tokenlist.d.ts +47 -15
- package/dist/apps/data/routes/tokenlist.d.ts.map +1 -1
- package/dist/apps/data/routes/tokenlist.js +68 -11
- package/dist/apps/data/routes/tokenlist.js.map +1 -1
- package/dist/apps/data/routes/tokens.d.ts +95 -93
- package/dist/apps/data/routes/tokens.d.ts.map +1 -1
- package/dist/apps/data/routes/tokens.js +26 -14
- package/dist/apps/data/routes/tokens.js.map +1 -1
- package/dist/apps/data/routes/transfers.d.ts +16 -0
- package/dist/apps/data/routes/transfers.d.ts.map +1 -1
- package/dist/apps/data/routes/transfers.js +9 -7
- package/dist/apps/data/routes/transfers.js.map +1 -1
- package/dist/apps/data/routes/verified-tokens.d.ts +4 -4
- package/dist/apps/data/routes/verified-tokens.d.ts.map +1 -1
- package/dist/apps/data/routes/verified-tokens.js +64 -20
- package/dist/apps/data/routes/verified-tokens.js.map +1 -1
- package/dist/apps/data/routes/webhooks.d.ts +1210 -70
- package/dist/apps/data/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/data/routes/webhooks.js +301 -163
- package/dist/apps/data/routes/webhooks.js.map +1 -1
- package/dist/apps/data/routes/zones.d.ts.map +1 -1
- package/dist/apps/data/routes/zones.js +20 -12
- package/dist/apps/data/routes/zones.js.map +1 -1
- package/dist/apps/docs/reference.js +2 -2
- package/dist/apps/docs/reference.js.map +1 -1
- package/dist/apps/index.d.ts +1 -1
- package/dist/apps/index.d.ts.map +1 -1
- package/dist/apps/index.js +1 -1
- package/dist/apps/index.js.map +1 -1
- package/dist/apps/management/App.d.ts +4119 -3297
- package/dist/apps/management/App.d.ts.map +1 -1
- package/dist/apps/management/App.js +5 -14
- package/dist/apps/management/App.js.map +1 -1
- package/dist/apps/management/Billing.d.ts +49 -8
- package/dist/apps/management/Billing.d.ts.map +1 -1
- package/dist/apps/management/Billing.js +221 -26
- package/dist/apps/management/Billing.js.map +1 -1
- package/dist/apps/management/routes/api-keys.d.ts +174 -72
- package/dist/apps/management/routes/api-keys.d.ts.map +1 -1
- package/dist/apps/management/routes/api-keys.js +43 -15
- package/dist/apps/management/routes/api-keys.js.map +1 -1
- package/dist/apps/management/routes/billing.d.ts +364 -78
- package/dist/apps/management/routes/billing.d.ts.map +1 -1
- package/dist/apps/management/routes/billing.js +274 -49
- package/dist/apps/management/routes/billing.js.map +1 -1
- package/dist/apps/management/routes/faucet.d.ts +6 -6
- package/dist/apps/management/routes/faucet.js +1 -1
- package/dist/apps/management/routes/faucet.js.map +1 -1
- package/dist/apps/management/routes/invitations.d.ts +99 -24
- package/dist/apps/management/routes/invitations.d.ts.map +1 -1
- package/dist/apps/management/routes/invitations.js +117 -13
- package/dist/apps/management/routes/invitations.js.map +1 -1
- package/dist/apps/management/routes/invite-links.d.ts +42 -42
- package/dist/apps/management/routes/me.d.ts.map +1 -1
- package/dist/apps/management/routes/me.js +6 -2
- package/dist/apps/management/routes/me.js.map +1 -1
- package/dist/apps/management/routes/members.d.ts +16 -16
- package/dist/apps/management/routes/orgs.d.ts +36 -20
- package/dist/apps/management/routes/orgs.d.ts.map +1 -1
- package/dist/apps/management/routes/orgs.js +52 -12
- package/dist/apps/management/routes/orgs.js.map +1 -1
- package/dist/apps/management/routes/projects.d.ts +40 -40
- package/dist/apps/management/routes/projects.d.ts.map +1 -1
- package/dist/apps/management/routes/projects.js +6 -1
- package/dist/apps/management/routes/projects.js.map +1 -1
- package/dist/apps/management/routes/scopes.d.ts.map +1 -1
- package/dist/apps/management/routes/scopes.js +4 -1
- package/dist/apps/management/routes/scopes.js.map +1 -1
- package/dist/apps/management/routes/usage.d.ts +8 -8
- package/dist/apps/management/routes/usage.js +21 -4
- package/dist/apps/management/routes/usage.js.map +1 -1
- package/dist/apps/management/routes/verified-token-requests.d.ts +16 -16
- package/dist/apps/management/routes/webhooks.d.ts +931 -215
- package/dist/apps/management/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/management/routes/webhooks.js +71 -25
- package/dist/apps/management/routes/webhooks.js.map +1 -1
- package/dist/apps/mcp.d.ts +1 -1
- package/dist/apps/mcp.js +7 -7
- package/dist/apps/mcp.js.map +1 -1
- package/dist/apps/mpp/App.d.ts.map +1 -1
- package/dist/apps/mpp/App.js +35 -7
- package/dist/apps/mpp/App.js.map +1 -1
- package/dist/apps/mpp/internal/Adapter.d.ts +2 -0
- package/dist/apps/mpp/internal/Adapter.d.ts.map +1 -1
- package/dist/apps/mpp/internal/Adapter.js +30 -1
- package/dist/apps/mpp/internal/Adapter.js.map +1 -1
- package/dist/apps/mpp/internal/Policy.d.ts +22 -4
- package/dist/apps/mpp/internal/Policy.d.ts.map +1 -1
- package/dist/apps/mpp/internal/Policy.js +24 -6
- package/dist/apps/mpp/internal/Policy.js.map +1 -1
- package/dist/apps/mpp/internal/Sponsorship.d.ts +3 -0
- package/dist/apps/mpp/internal/Sponsorship.d.ts.map +1 -1
- package/dist/apps/mpp/internal/Sponsorship.js +6 -3
- package/dist/apps/mpp/internal/Sponsorship.js.map +1 -1
- package/dist/apps/relay/App.d.ts +2 -0
- package/dist/apps/relay/App.d.ts.map +1 -1
- package/dist/apps/relay/App.js +177 -26
- package/dist/apps/relay/App.js.map +1 -1
- package/dist/apps/relay/Sponsorships.d.ts +5 -3
- package/dist/apps/relay/Sponsorships.d.ts.map +1 -1
- package/dist/apps/relay/Sponsorships.js +232 -25
- package/dist/apps/relay/Sponsorships.js.map +1 -1
- package/dist/apps/{funding → routes}/Access.d.ts +4 -4
- package/dist/apps/routes/Access.d.ts.map +1 -0
- package/dist/apps/{funding → routes}/Access.js +4 -4
- package/dist/apps/routes/Access.js.map +1 -0
- package/dist/apps/{funding → routes}/App.d.ts +841 -136
- package/dist/apps/{funding → routes}/App.d.ts.map +1 -1
- package/dist/apps/{funding → routes}/App.js +17 -17
- package/dist/apps/routes/App.js.map +1 -0
- package/dist/apps/routes/Inventory.d.ts.map +1 -0
- package/dist/apps/{funding → routes}/Inventory.js +2 -2
- package/dist/apps/routes/Inventory.js.map +1 -0
- package/dist/apps/routes/index.d.ts +2 -0
- package/dist/apps/routes/index.d.ts.map +1 -0
- package/dist/apps/routes/index.js +2 -0
- package/dist/apps/routes/index.js.map +1 -0
- package/dist/apps/{funding → routes}/routes/chains.d.ts +7 -7
- package/dist/apps/routes/routes/chains.d.ts.map +1 -0
- package/dist/apps/{funding → routes}/routes/chains.js +25 -25
- package/dist/apps/routes/routes/chains.js.map +1 -0
- package/dist/apps/{funding → routes}/routes/deposit-addresses.d.ts +123 -59
- package/dist/apps/routes/routes/deposit-addresses.d.ts.map +1 -0
- package/dist/apps/{funding → routes}/routes/deposit-addresses.js +498 -223
- package/dist/apps/routes/routes/deposit-addresses.js.map +1 -0
- package/dist/apps/{funding → routes}/routes/providers.d.ts +8 -8
- package/dist/apps/routes/routes/providers.d.ts.map +1 -0
- package/dist/apps/routes/routes/providers.js +57 -0
- package/dist/apps/routes/routes/providers.js.map +1 -0
- package/dist/apps/{funding → routes}/routes/quotes.d.ts +19 -16
- package/dist/apps/routes/routes/quotes.d.ts.map +1 -0
- package/dist/apps/{funding → routes}/routes/quotes.js +55 -38
- package/dist/apps/routes/routes/quotes.js.map +1 -0
- package/dist/apps/{funding → routes}/routes/transfers.d.ts +957 -71
- package/dist/apps/routes/routes/transfers.d.ts.map +1 -0
- package/dist/apps/routes/routes/transfers.js +1140 -0
- package/dist/apps/routes/routes/transfers.js.map +1 -0
- package/dist/cli/Cli.d.ts +30 -0
- package/dist/cli/Cli.d.ts.map +1 -1
- package/dist/cli/commands/admin.d.ts +36 -0
- package/dist/cli/commands/admin.d.ts.map +1 -1
- package/dist/cli/commands/admin.js +273 -0
- package/dist/cli/commands/admin.js.map +1 -1
- package/dist/cloudflare.d.ts +16 -14
- package/dist/cloudflare.d.ts.map +1 -1
- package/dist/cloudflare.js +26 -21
- package/dist/cloudflare.js.map +1 -1
- package/dist/db/Db.d.ts +63 -21
- package/dist/db/Db.d.ts.map +1 -1
- package/dist/db/Db.js +1052 -15
- package/dist/db/Db.js.map +1 -1
- package/dist/db/Schema.d.ts +785 -133
- package/dist/db/Schema.d.ts.map +1 -1
- package/dist/db/Schema.js +590 -162
- package/dist/db/Schema.js.map +1 -1
- package/dist/db/tables/apiKeyAdmissionBootstraps.d.ts +4 -0
- package/dist/db/tables/apiKeyAdmissionBootstraps.d.ts.map +1 -0
- package/dist/db/tables/apiKeyAdmissionBootstraps.js +2 -0
- package/dist/db/tables/apiKeyAdmissionBootstraps.js.map +1 -0
- package/dist/db/tables/apiKeyAdmissions.d.ts +73 -0
- package/dist/db/tables/apiKeyAdmissions.d.ts.map +1 -0
- package/dist/db/tables/apiKeyAdmissions.js +142 -0
- package/dist/db/tables/apiKeyAdmissions.js.map +1 -0
- package/dist/db/tables/apiKeyOwnerAdmissions.d.ts +4 -0
- package/dist/db/tables/apiKeyOwnerAdmissions.d.ts.map +1 -0
- package/dist/db/tables/apiKeyOwnerAdmissions.js +2 -0
- package/dist/db/tables/apiKeyOwnerAdmissions.js.map +1 -0
- package/dist/db/tables/apiKeyOwnerTombstones.d.ts +20 -0
- package/dist/db/tables/apiKeyOwnerTombstones.d.ts.map +1 -0
- package/dist/db/tables/apiKeyOwnerTombstones.js +57 -0
- package/dist/db/tables/apiKeyOwnerTombstones.js.map +1 -0
- package/dist/db/tables/apiKeyRevocations.d.ts +21 -0
- package/dist/db/tables/apiKeyRevocations.d.ts.map +1 -0
- package/dist/db/tables/apiKeyRevocations.js +98 -0
- package/dist/db/tables/apiKeyRevocations.js.map +1 -0
- package/dist/db/tables/authAccounts.d.ts +47 -0
- package/dist/db/tables/authAccounts.d.ts.map +1 -0
- package/dist/db/tables/authAccounts.js +72 -0
- package/dist/db/tables/authAccounts.js.map +1 -0
- package/dist/db/tables/authSessions.d.ts +12 -0
- package/dist/db/tables/authSessions.d.ts.map +1 -0
- package/dist/db/tables/authSessions.js +2 -0
- package/dist/db/tables/authSessions.js.map +1 -0
- package/dist/db/tables/authVerifications.d.ts +12 -0
- package/dist/db/tables/authVerifications.d.ts.map +1 -0
- package/dist/db/tables/authVerifications.js +2 -0
- package/dist/db/tables/authVerifications.js.map +1 -0
- package/dist/db/tables/invitations.d.ts +17 -1
- package/dist/db/tables/invitations.d.ts.map +1 -1
- package/dist/db/tables/invitations.js +123 -43
- package/dist/db/tables/invitations.js.map +1 -1
- package/dist/db/tables/memberships.d.ts +8 -0
- package/dist/db/tables/memberships.d.ts.map +1 -1
- package/dist/db/tables/memberships.js +51 -2
- package/dist/db/tables/memberships.js.map +1 -1
- package/dist/db/tables/organizations.d.ts +51 -5
- package/dist/db/tables/organizations.d.ts.map +1 -1
- package/dist/db/tables/organizations.js +135 -47
- package/dist/db/tables/organizations.js.map +1 -1
- package/dist/db/tables/projects.d.ts +27 -1
- package/dist/db/tables/projects.d.ts.map +1 -1
- package/dist/db/tables/projects.js +38 -3
- package/dist/db/tables/projects.js.map +1 -1
- package/dist/db/tables/requestUsage.d.ts.map +1 -1
- package/dist/db/tables/requestUsage.js.map +1 -1
- package/dist/db/tables/rewardAccounts.d.ts +86 -0
- package/dist/db/tables/rewardAccounts.d.ts.map +1 -0
- package/dist/db/tables/rewardAccounts.js +88 -0
- package/dist/db/tables/rewardAccounts.js.map +1 -0
- package/dist/db/tables/rewardCampaignDistributors.d.ts +36 -0
- package/dist/db/tables/rewardCampaignDistributors.d.ts.map +1 -0
- package/dist/db/tables/rewardCampaignDistributors.js +30 -0
- package/dist/db/tables/rewardCampaignDistributors.js.map +1 -0
- package/dist/db/tables/rewardCampaigns.d.ts +171 -0
- package/dist/db/tables/rewardCampaigns.d.ts.map +1 -0
- package/dist/db/tables/rewardCampaigns.js +392 -0
- package/dist/db/tables/rewardCampaigns.js.map +1 -0
- package/dist/db/tables/rewardCredits.d.ts +53 -0
- package/dist/db/tables/rewardCredits.d.ts.map +1 -0
- package/dist/db/tables/rewardCredits.js +63 -0
- package/dist/db/tables/rewardCredits.js.map +1 -0
- package/dist/db/tables/rewardEligibilityAssociations.d.ts +61 -0
- package/dist/db/tables/rewardEligibilityAssociations.d.ts.map +1 -0
- package/dist/db/tables/rewardEligibilityAssociations.js +103 -0
- package/dist/db/tables/rewardEligibilityAssociations.js.map +1 -0
- package/dist/db/tables/rewardRuns.d.ts +188 -0
- package/dist/db/tables/rewardRuns.d.ts.map +1 -0
- package/dist/db/tables/rewardRuns.js +278 -0
- package/dist/db/tables/rewardRuns.js.map +1 -0
- package/dist/db/tables/rewardTransactionAttempts.d.ts +100 -0
- package/dist/db/tables/rewardTransactionAttempts.d.ts.map +1 -0
- package/dist/db/tables/rewardTransactionAttempts.js +163 -0
- package/dist/db/tables/rewardTransactionAttempts.js.map +1 -0
- package/dist/db/tables/routesCatalog.d.ts +58 -0
- package/dist/db/tables/routesCatalog.d.ts.map +1 -0
- package/dist/db/tables/{fundingCatalog.js → routesCatalog.js} +19 -19
- package/dist/db/tables/routesCatalog.js.map +1 -0
- package/dist/db/tables/routesDepositAddresses.d.ts +476 -0
- package/dist/db/tables/routesDepositAddresses.d.ts.map +1 -0
- package/dist/db/tables/routesDepositAddresses.js +587 -0
- package/dist/db/tables/routesDepositAddresses.js.map +1 -0
- package/dist/db/tables/{fundingDepositRequestObservations.d.ts → routesDepositRequestObservations.d.ts} +6 -6
- package/dist/db/tables/routesDepositRequestObservations.d.ts.map +1 -0
- package/dist/db/tables/{fundingDepositRequestObservations.js → routesDepositRequestObservations.js} +6 -6
- package/dist/db/tables/routesDepositRequestObservations.js.map +1 -0
- package/dist/db/tables/{fundingDeposits.d.ts → routesDeposits.d.ts} +210 -22
- package/dist/db/tables/routesDeposits.d.ts.map +1 -0
- package/dist/db/tables/routesDeposits.js +576 -0
- package/dist/db/tables/routesDeposits.js.map +1 -0
- package/dist/db/tables/routesIdempotency.d.ts +166 -0
- package/dist/db/tables/routesIdempotency.d.ts.map +1 -0
- package/dist/db/tables/routesIdempotency.js +330 -0
- package/dist/db/tables/routesIdempotency.js.map +1 -0
- package/dist/db/tables/routesSubsidies.d.ts +27 -0
- package/dist/db/tables/routesSubsidies.d.ts.map +1 -0
- package/dist/db/tables/routesSubsidies.js +45 -0
- package/dist/db/tables/routesSubsidies.js.map +1 -0
- package/dist/db/tables/{fundingTransferEvents.d.ts → routesTransferEvents.d.ts} +3 -3
- package/dist/db/tables/routesTransferEvents.d.ts.map +1 -0
- package/dist/db/tables/{fundingTransferEvents.js → routesTransferEvents.js} +3 -3
- package/dist/db/tables/routesTransferEvents.js.map +1 -0
- package/dist/db/tables/routesTransferSubsidies.d.ts +19 -0
- package/dist/db/tables/routesTransferSubsidies.d.ts.map +1 -0
- package/dist/db/tables/routesTransferSubsidies.js +17 -0
- package/dist/db/tables/routesTransferSubsidies.js.map +1 -0
- package/dist/db/tables/routesTransferSubsidyNonces.d.ts +51 -0
- package/dist/db/tables/routesTransferSubsidyNonces.d.ts.map +1 -0
- package/dist/db/tables/routesTransferSubsidyNonces.js +82 -0
- package/dist/db/tables/routesTransferSubsidyNonces.js.map +1 -0
- package/dist/db/tables/routesTransferTransactions.d.ts +77 -0
- package/dist/db/tables/routesTransferTransactions.d.ts.map +1 -0
- package/dist/db/tables/routesTransferTransactions.js +86 -0
- package/dist/db/tables/routesTransferTransactions.js.map +1 -0
- package/dist/db/tables/routesTransfers.d.ts +319 -0
- package/dist/db/tables/routesTransfers.d.ts.map +1 -0
- package/dist/db/tables/routesTransfers.js +372 -0
- package/dist/db/tables/routesTransfers.js.map +1 -0
- package/dist/db/tables/sponsoredTransactions.d.ts +112 -13
- package/dist/db/tables/sponsoredTransactions.d.ts.map +1 -1
- package/dist/db/tables/sponsoredTransactions.js +241 -38
- package/dist/db/tables/sponsoredTransactions.js.map +1 -1
- package/dist/db/tables/sponsorshipAttributions.d.ts +69 -0
- package/dist/db/tables/sponsorshipAttributions.d.ts.map +1 -0
- package/dist/db/tables/sponsorshipAttributions.js +77 -0
- package/dist/db/tables/sponsorshipAttributions.js.map +1 -0
- package/dist/db/tables/sponsorshipReconciliationCursors.d.ts +22 -0
- package/dist/db/tables/sponsorshipReconciliationCursors.d.ts.map +1 -0
- package/dist/db/tables/sponsorshipReconciliationCursors.js +45 -0
- package/dist/db/tables/sponsorshipReconciliationCursors.js.map +1 -0
- package/dist/db/tables/stripeCustomers.d.ts +11 -0
- package/dist/db/tables/stripeCustomers.d.ts.map +1 -1
- package/dist/db/tables/stripeCustomers.js +13 -0
- package/dist/db/tables/stripeCustomers.js.map +1 -1
- package/dist/db/tables/users.d.ts +17 -1
- package/dist/db/tables/users.d.ts.map +1 -1
- package/dist/db/tables/users.js +47 -2
- package/dist/db/tables/users.js.map +1 -1
- package/dist/db/tables/webhookQueueEvents.d.ts.map +1 -1
- package/dist/db/tables/webhookQueueEvents.js +5 -1
- package/dist/db/tables/webhookQueueEvents.js.map +1 -1
- package/dist/db/tables/webhookSubscriptions.d.ts +22 -10
- package/dist/db/tables/webhookSubscriptions.d.ts.map +1 -1
- package/dist/db/tables/webhookSubscriptions.js +50 -15
- package/dist/db/tables/webhookSubscriptions.js.map +1 -1
- package/dist/handlers/internal/executionError.d.ts +2 -2
- package/dist/handlers/internal/executionError.d.ts.map +1 -1
- package/dist/handlers/internal/executionError.js +1 -2
- package/dist/handlers/internal/executionError.js.map +1 -1
- package/dist/handlers/internal/multisig.d.ts +4 -232
- package/dist/handlers/internal/multisig.d.ts.map +1 -1
- package/dist/handlers/internal/multisig.js +11 -537
- package/dist/handlers/internal/multisig.js.map +1 -1
- package/dist/handlers/internal/sponsorship.d.ts +19 -8
- package/dist/handlers/internal/sponsorship.d.ts.map +1 -1
- package/dist/handlers/internal/sponsorship.js +13 -9
- package/dist/handlers/internal/sponsorship.js.map +1 -1
- package/dist/handlers/relay.d.ts +9 -12
- package/dist/handlers/relay.d.ts.map +1 -1
- package/dist/handlers/relay.js +81 -85
- package/dist/handlers/relay.js.map +1 -1
- package/dist/index.d.ts +0 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -17
- package/dist/index.js.map +1 -1
- package/dist/internal/AssetResponse.d.ts +12 -0
- package/dist/internal/AssetResponse.d.ts.map +1 -0
- package/dist/internal/AssetResponse.js +21 -0
- package/dist/internal/AssetResponse.js.map +1 -0
- package/dist/internal/Auth.d.ts +48 -12
- package/dist/internal/Auth.d.ts.map +1 -1
- package/dist/internal/Auth.js +603 -175
- package/dist/internal/Auth.js.map +1 -1
- package/dist/internal/BetterAuth.d.ts +1488 -0
- package/dist/internal/BetterAuth.d.ts.map +1 -0
- package/dist/internal/BetterAuth.js +253 -0
- package/dist/internal/BetterAuth.js.map +1 -0
- package/dist/internal/Cache.d.ts +2 -0
- package/dist/internal/Cache.d.ts.map +1 -1
- package/dist/internal/Cache.js +2 -0
- package/dist/internal/Cache.js.map +1 -1
- package/dist/internal/EarnRates.d.ts +26 -3
- package/dist/internal/EarnRates.d.ts.map +1 -1
- package/dist/internal/EarnRates.js +84 -19
- package/dist/internal/EarnRates.js.map +1 -1
- package/dist/internal/EarnSharePrices.d.ts +120 -0
- package/dist/internal/EarnSharePrices.d.ts.map +1 -0
- package/dist/internal/EarnSharePrices.js +179 -0
- package/dist/internal/EarnSharePrices.js.map +1 -0
- package/dist/internal/EarnVaults.d.ts +4 -0
- package/dist/internal/EarnVaults.d.ts.map +1 -1
- package/dist/internal/EarnVaults.js +31 -14
- package/dist/internal/EarnVaults.js.map +1 -1
- package/dist/internal/Email.d.ts +37 -0
- package/dist/internal/Email.d.ts.map +1 -0
- package/dist/internal/Email.js +16 -0
- package/dist/internal/Email.js.map +1 -0
- package/dist/internal/Log.d.ts +32 -28
- package/dist/internal/Log.d.ts.map +1 -1
- package/dist/internal/Log.js +18 -11
- package/dist/internal/Log.js.map +1 -1
- package/dist/internal/MetricSink.d.ts +3 -0
- package/dist/internal/MetricSink.d.ts.map +1 -1
- package/dist/internal/MetricSink.js +67 -8
- package/dist/internal/MetricSink.js.map +1 -1
- package/dist/internal/Mpp.d.ts.map +1 -1
- package/dist/internal/Mpp.js +20 -25
- package/dist/internal/Mpp.js.map +1 -1
- package/dist/internal/OpenApi.d.ts +26 -3
- package/dist/internal/OpenApi.d.ts.map +1 -1
- package/dist/internal/OpenApi.js +25 -10
- package/dist/internal/OpenApi.js.map +1 -1
- package/dist/internal/Provider.d.ts +1 -1
- package/dist/internal/Provider.d.ts.map +1 -1
- package/dist/internal/RateLimit.d.ts.map +1 -1
- package/dist/internal/RateLimit.js +13 -1
- package/dist/internal/RateLimit.js.map +1 -1
- package/dist/internal/Store.d.ts +16 -0
- package/dist/internal/Store.d.ts.map +1 -1
- package/dist/internal/Store.js +59 -8
- package/dist/internal/Store.js.map +1 -1
- package/dist/internal/Tidx.d.ts +9 -2
- package/dist/internal/Tidx.d.ts.map +1 -1
- package/dist/internal/Tidx.js +78 -11
- package/dist/internal/Tidx.js.map +1 -1
- package/dist/internal/Timing.d.ts +26 -0
- package/dist/internal/Timing.d.ts.map +1 -1
- package/dist/internal/Timing.js +63 -5
- package/dist/internal/Timing.js.map +1 -1
- package/dist/internal/VercelOidc.d.ts +94 -0
- package/dist/internal/VercelOidc.d.ts.map +1 -0
- package/dist/internal/VercelOidc.js +128 -0
- package/dist/internal/VercelOidc.js.map +1 -0
- package/dist/internal/VerifiedTokens.d.ts +2 -8
- package/dist/internal/VerifiedTokens.d.ts.map +1 -1
- package/dist/internal/VerifiedTokens.js +24 -24
- package/dist/internal/VerifiedTokens.js.map +1 -1
- package/dist/internal/Viem.d.ts +46 -2068
- package/dist/internal/Viem.d.ts.map +1 -1
- package/dist/internal/Viem.js +171 -11
- package/dist/internal/Viem.js.map +1 -1
- package/dist/internal/Webhooks.d.ts +12 -4
- package/dist/internal/Webhooks.d.ts.map +1 -1
- package/dist/internal/Webhooks.js +9 -3
- package/dist/internal/Webhooks.js.map +1 -1
- package/dist/internal/ZoneRpc.d.ts +7 -0
- package/dist/internal/ZoneRpc.d.ts.map +1 -0
- package/dist/internal/ZoneRpc.js +49 -0
- package/dist/internal/ZoneRpc.js.map +1 -0
- package/dist/internal/index.d.ts +3 -1
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +3 -1
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/rewards/Audit.d.ts +88 -0
- package/dist/internal/rewards/Audit.d.ts.map +1 -0
- package/dist/internal/rewards/Audit.js +134 -0
- package/dist/internal/rewards/Audit.js.map +1 -0
- package/dist/internal/rewards/Campaigns.d.ts +572 -0
- package/dist/internal/rewards/Campaigns.d.ts.map +1 -0
- package/dist/internal/rewards/Campaigns.js +531 -0
- package/dist/internal/rewards/Campaigns.js.map +1 -0
- package/dist/internal/rewards/Credits.d.ts +76 -0
- package/dist/internal/rewards/Credits.d.ts.map +1 -0
- package/dist/internal/rewards/Credits.js +95 -0
- package/dist/internal/rewards/Credits.js.map +1 -0
- package/dist/internal/rewards/Events.d.ts +100 -0
- package/dist/internal/rewards/Events.d.ts.map +1 -0
- package/dist/internal/rewards/Events.js +340 -0
- package/dist/internal/rewards/Events.js.map +1 -0
- package/dist/internal/rewards/Projection.d.ts +237 -0
- package/dist/internal/rewards/Projection.d.ts.map +1 -0
- package/dist/internal/rewards/Projection.js +616 -0
- package/dist/internal/rewards/Projection.js.map +1 -0
- package/dist/internal/rewards/Rates.d.ts +44 -0
- package/dist/internal/rewards/Rates.d.ts.map +1 -0
- package/dist/internal/rewards/Rates.js +60 -0
- package/dist/internal/rewards/Rates.js.map +1 -0
- package/dist/internal/rewards/Read.d.ts +158 -0
- package/dist/internal/rewards/Read.d.ts.map +1 -0
- package/dist/internal/rewards/Read.js +292 -0
- package/dist/internal/rewards/Read.js.map +1 -0
- package/dist/internal/rewards/Runner.d.ts +164 -0
- package/dist/internal/rewards/Runner.d.ts.map +1 -0
- package/dist/internal/rewards/Runner.js +1778 -0
- package/dist/internal/rewards/Runner.js.map +1 -0
- package/dist/internal/rewards/Signer.d.ts +224 -0
- package/dist/internal/rewards/Signer.d.ts.map +1 -0
- package/dist/internal/rewards/Signer.js +135 -0
- package/dist/internal/rewards/Signer.js.map +1 -0
- package/dist/internal/rewards/index.d.ts +15 -0
- package/dist/internal/rewards/index.d.ts.map +1 -0
- package/dist/internal/rewards/index.js +15 -0
- package/dist/internal/rewards/index.js.map +1 -0
- package/dist/internal/{funding → routes}/Action.d.ts +12 -1
- package/dist/internal/routes/Action.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Action.js +17 -9
- package/dist/internal/routes/Action.js.map +1 -0
- package/dist/internal/{funding → routes}/Catalog.d.ts +20 -20
- package/dist/internal/routes/Catalog.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Catalog.js +29 -29
- package/dist/internal/routes/Catalog.js.map +1 -0
- package/dist/internal/{funding → routes}/Chain.d.ts +10 -10
- package/dist/internal/routes/Chain.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Chain.js +3 -3
- package/dist/internal/routes/Chain.js.map +1 -0
- package/dist/internal/{funding → routes}/Deposit.d.ts +45 -23
- package/dist/internal/routes/Deposit.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Deposit.js +60 -27
- package/dist/internal/routes/Deposit.js.map +1 -0
- package/dist/internal/{funding → routes}/DepositAddress.d.ts +56 -27
- package/dist/internal/routes/DepositAddress.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/DepositAddress.js +95 -33
- package/dist/internal/routes/DepositAddress.js.map +1 -0
- package/dist/internal/{funding → routes}/DepositWebhook.d.ts +4 -4
- package/dist/internal/routes/DepositWebhook.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/DepositWebhook.js +4 -3
- package/dist/internal/routes/DepositWebhook.js.map +1 -0
- package/dist/internal/routes/Economics.d.ts +25 -0
- package/dist/internal/routes/Economics.d.ts.map +1 -0
- package/dist/internal/routes/Economics.js +28 -0
- package/dist/internal/routes/Economics.js.map +1 -0
- package/dist/internal/{funding → routes}/Evidence.d.ts +3 -3
- package/dist/internal/routes/Evidence.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Evidence.js +9 -17
- package/dist/internal/routes/Evidence.js.map +1 -0
- package/dist/internal/routes/Observability.d.ts +154 -0
- package/dist/internal/routes/Observability.d.ts.map +1 -0
- package/dist/internal/routes/Observability.js +389 -0
- package/dist/internal/routes/Observability.js.map +1 -0
- package/dist/internal/{funding → routes}/Provider.d.ts +350 -104
- package/dist/internal/routes/Provider.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Provider.js +233 -97
- package/dist/internal/routes/Provider.js.map +1 -0
- package/dist/internal/{funding → routes}/Reconciliation.d.ts +11 -6
- package/dist/internal/routes/Reconciliation.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Reconciliation.js +408 -158
- package/dist/internal/routes/Reconciliation.js.map +1 -0
- package/dist/internal/routes/Route.d.ts +21 -0
- package/dist/internal/routes/Route.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Route.js +1 -1
- package/dist/internal/routes/Route.js.map +1 -0
- package/dist/internal/{funding → routes}/SourceObservation.d.ts +6 -6
- package/dist/internal/routes/SourceObservation.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/SourceObservation.js +13 -15
- package/dist/internal/routes/SourceObservation.js.map +1 -0
- package/dist/internal/{funding → routes}/Subsidy.d.ts +48 -3
- package/dist/internal/routes/Subsidy.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Subsidy.js +43 -3
- package/dist/internal/routes/Subsidy.js.map +1 -0
- package/dist/internal/{funding → routes}/Token.d.ts +4 -4
- package/dist/internal/routes/Token.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/Token.js +3 -3
- package/dist/internal/routes/Token.js.map +1 -0
- package/dist/internal/{funding → routes}/Transfer.d.ts +324 -34
- package/dist/internal/routes/Transfer.d.ts.map +1 -0
- package/dist/internal/routes/Transfer.js +728 -0
- package/dist/internal/routes/Transfer.js.map +1 -0
- package/dist/internal/routes/TransferReconciliation.d.ts +55 -0
- package/dist/internal/routes/TransferReconciliation.d.ts.map +1 -0
- package/dist/internal/routes/TransferReconciliation.js +422 -0
- package/dist/internal/routes/TransferReconciliation.js.map +1 -0
- package/dist/internal/routes/TransferSubsidy.d.ts +201 -0
- package/dist/internal/routes/TransferSubsidy.d.ts.map +1 -0
- package/dist/internal/routes/TransferSubsidy.js +256 -0
- package/dist/internal/routes/TransferSubsidy.js.map +1 -0
- package/dist/internal/routes/TransferWebhook.d.ts +21 -0
- package/dist/internal/routes/TransferWebhook.d.ts.map +1 -0
- package/dist/internal/routes/TransferWebhook.js +43 -0
- package/dist/internal/routes/TransferWebhook.js.map +1 -0
- package/dist/internal/{funding → routes}/index.d.ts +3 -0
- package/dist/internal/routes/index.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/index.js +3 -0
- package/dist/internal/routes/index.js.map +1 -0
- package/dist/internal/{funding → routes}/providers/across.d.ts +4 -4
- package/dist/internal/routes/providers/across.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/providers/across.js +13 -13
- package/dist/internal/routes/providers/across.js.map +1 -0
- package/dist/internal/{funding → routes}/providers/relay.d.ts +21 -12
- package/dist/internal/routes/providers/relay.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/providers/relay.js +197 -122
- package/dist/internal/routes/providers/relay.js.map +1 -0
- package/dist/internal/{funding → routes}/providers/rhino.d.ts +4 -4
- package/dist/internal/routes/providers/rhino.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/providers/rhino.js +10 -10
- package/dist/internal/routes/providers/rhino.js.map +1 -0
- package/dist/internal/{funding → routes}/providers/squid.d.ts +4 -4
- package/dist/internal/routes/providers/squid.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/providers/squid.js +14 -14
- package/dist/internal/routes/providers/squid.js.map +1 -0
- package/dist/internal/routes/providers/stargate.d.ts +165 -0
- package/dist/internal/routes/providers/stargate.d.ts.map +1 -0
- package/dist/internal/routes/providers/stargate.js +898 -0
- package/dist/internal/routes/providers/stargate.js.map +1 -0
- package/dist/internal/{funding → routes}/providers/symbiosis.d.ts +4 -4
- package/dist/internal/routes/providers/symbiosis.d.ts.map +1 -0
- package/dist/internal/{funding → routes}/providers/symbiosis.js +30 -20
- package/dist/internal/routes/providers/symbiosis.js.map +1 -0
- package/dist/internal/webhookDestinations/slack.d.ts.map +1 -1
- package/dist/internal/webhookDestinations/slack.js +22 -6
- package/dist/internal/webhookDestinations/slack.js.map +1 -1
- package/dist/providers/index.d.ts +12 -12
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +12 -12
- package/dist/providers/index.js.map +1 -1
- package/dist/server.d.ts +19 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +19 -0
- package/dist/server.js.map +1 -0
- package/package.json +15 -4
- package/src/ApiKey.ts +1 -1
- package/src/ApiKeys.test.ts +1033 -3
- package/src/ApiKeys.ts +489 -48
- package/src/App.test-d.ts +1 -1
- package/src/App.test.ts +216 -25
- package/src/App.ts +335 -31
- package/src/Assets.test.ts +2 -2
- package/src/Assets.ts +3 -1
- package/src/Auth.test-d.ts +1 -1
- package/src/Client.test-d.ts +611 -101
- package/src/Handler.ts +0 -1
- package/src/OpenApi.contract.test.ts +195 -0
- package/src/Scope.ts +17 -5
- package/src/Webhooks.ts +2 -2
- package/src/admin/App.test.ts +30 -2
- package/src/admin/App.ts +42 -6
- package/src/admin/apps/api-keys.test.ts +267 -5
- package/src/admin/apps/api-keys.ts +100 -50
- package/src/admin/apps/earn-vaults.test.ts +158 -0
- package/src/admin/apps/earn-vaults.ts +681 -7
- package/src/admin/apps/organizations.test.ts +342 -1
- package/src/admin/apps/organizations.ts +368 -8
- package/src/admin/apps/routes-support.test.ts +200 -0
- package/src/admin/apps/routes-support.ts +201 -0
- package/src/admin/apps/routes.test.ts +450 -0
- package/src/admin/apps/routes.ts +896 -0
- package/src/admin/apps/scopes.test.ts +15 -5
- package/src/admin/apps/subsidies.test.ts +306 -0
- package/src/admin/apps/subsidies.ts +457 -0
- package/src/admin/apps/verified-tokens.test.ts +8 -3
- package/src/admin/apps/verified-tokens.ts +3 -3
- package/src/admin/ui/plugin.ts +1 -2
- package/src/admin/ui/src/components/RewardCampaignForm.tsx +1009 -0
- package/src/admin/ui/src/lib/config.ts +11 -2
- package/src/admin/ui/src/lib/earn-vaults.ts +2 -2
- package/src/admin/ui/src/lib/organizations.test.ts +147 -3
- package/src/admin/ui/src/lib/organizations.ts +136 -0
- package/src/admin/ui/src/lib/query-client.ts +1 -1
- package/src/admin/ui/src/lib/reward-campaigns.ts +136 -0
- package/src/admin/ui/src/lib/routes.test.ts +88 -0
- package/src/admin/ui/src/lib/routes.ts +304 -0
- package/src/admin/ui/src/lib/subsidies.ts +75 -0
- package/src/admin/ui/src/routeTree.gen.ts +63 -0
- package/src/admin/ui/src/routes/__root.tsx +12 -1
- package/src/admin/ui/src/routes/api-keys.tsx +196 -84
- package/src/admin/ui/src/routes/earn.vaults_.$vaultId.edit.tsx +105 -70
- package/src/admin/ui/src/routes/organizations_.$orgId.tsx +334 -2
- package/src/admin/ui/src/routes/routes.tsx +1615 -0
- package/src/admin/ui/src/routes/routes_.support.tsx +248 -0
- package/src/admin/ui/src/routes/subsidies.tsx +799 -0
- package/src/admin/ui.generated.ts +144 -69
- package/src/analytics/Analytics.test.ts +108 -18
- package/src/analytics/Analytics.ts +38 -6
- package/src/analytics/tables/requestEvents.test.ts +100 -0
- package/src/analytics/tables/requestEvents.ts +10 -1
- package/src/analytics/tables/routesLifecycleIntervals.ts +140 -0
- package/src/apps/Zones.test.ts +18 -3
- package/src/apps/Zones.ts +55 -8
- package/src/apps/composition.test.ts +68 -59
- package/src/apps/data/App.test.ts +154 -2
- package/src/apps/data/App.ts +102 -33
- package/src/apps/data/routes/activities.test.ts +419 -7
- package/src/apps/data/routes/activities.ts +683 -216
- package/src/apps/data/routes/balances.test.ts +2 -2
- package/src/apps/data/routes/blocks.test.ts +46 -1
- package/src/apps/data/routes/coingecko.test.ts +419 -1
- package/src/apps/data/routes/coingecko.ts +309 -253
- package/src/apps/data/routes/earn.discovery.test.ts +274 -0
- package/src/apps/data/routes/earn.test.ts +1661 -29
- package/src/apps/data/routes/earn.ts +2314 -328
- package/src/apps/data/routes/exchanges.test.ts +752 -30
- package/src/apps/data/routes/exchanges.ts +954 -753
- package/src/apps/data/routes/fee-amm.test.ts +224 -0
- package/src/apps/data/routes/fee-amm.ts +208 -178
- package/src/apps/data/routes/indexer.test.ts +389 -0
- package/src/apps/data/routes/indexer.ts +165 -69
- package/src/apps/data/routes/receipts.test.ts +1 -1
- package/src/apps/data/routes/rpc.test.ts +352 -8
- package/src/apps/data/routes/rpc.ts +407 -219
- package/src/apps/data/routes/rpc.zone.test.ts +340 -0
- package/src/apps/data/routes/tokenlist.test.ts +285 -0
- package/src/apps/data/routes/tokenlist.ts +173 -88
- package/src/apps/data/routes/tokens.test.ts +93 -3
- package/src/apps/data/routes/tokens.ts +39 -23
- package/src/apps/data/routes/transactions.test.ts +1 -1
- package/src/apps/data/routes/transfers.test.ts +56 -24
- package/src/apps/data/routes/transfers.ts +19 -8
- package/src/apps/data/routes/valuation.test.ts +1 -1
- package/src/apps/data/routes/verified-tokens.test.ts +345 -0
- package/src/apps/data/routes/verified-tokens.ts +99 -29
- package/src/apps/data/routes/webhooks.test.ts +659 -81
- package/src/apps/data/routes/webhooks.ts +1104 -817
- package/src/apps/data/routes/zones.test.ts +148 -71
- package/src/apps/data/routes/zones.ts +71 -55
- package/src/apps/docs/reference.ts +2 -2
- package/src/apps/index.ts +1 -1
- package/src/apps/management/App.ts +9 -51
- package/src/apps/management/Billing.test.ts +375 -14
- package/src/apps/management/Billing.ts +283 -34
- package/src/apps/management/routes/api-keys.test.ts +269 -7
- package/src/apps/management/routes/api-keys.ts +61 -20
- package/src/apps/management/routes/billing.test.ts +477 -15
- package/src/apps/management/routes/billing.ts +377 -50
- package/src/apps/management/routes/faucet.test.ts +1 -1
- package/src/apps/management/routes/faucet.ts +1 -1
- package/src/apps/management/routes/invitations.test.ts +270 -3
- package/src/apps/management/routes/invitations.ts +185 -15
- package/src/apps/management/routes/invoicePreview.test.ts +549 -0
- package/src/apps/management/routes/me.test.ts +246 -5
- package/src/apps/management/routes/me.ts +7 -2
- package/src/apps/management/routes/members.test.ts +108 -0
- package/src/apps/management/routes/orgs.test.ts +191 -3
- package/src/apps/management/routes/orgs.ts +58 -11
- package/src/apps/management/routes/projects.test.ts +33 -3
- package/src/apps/management/routes/projects.ts +6 -1
- package/src/apps/management/routes/scopes.test.ts +30 -2
- package/src/apps/management/routes/scopes.ts +4 -1
- package/src/apps/management/routes/usage.test.ts +32 -0
- package/src/apps/management/routes/usage.ts +22 -4
- package/src/apps/management/routes/webhooks.test.ts +49 -26
- package/src/apps/management/routes/webhooks.ts +93 -38
- package/src/apps/mcp.test.ts +6 -6
- package/src/apps/mcp.ts +7 -7
- package/src/apps/mpp/App.ts +37 -7
- package/src/apps/mpp/Mpp.test.ts +49 -8
- package/src/apps/mpp/Mpp.zone.test.ts +219 -0
- package/src/apps/mpp/internal/Adapter.ts +34 -0
- package/src/apps/mpp/internal/Policy.test.ts +86 -31
- package/src/apps/mpp/internal/Policy.ts +49 -7
- package/src/apps/mpp/internal/Sponsorship.test.ts +207 -0
- package/src/apps/mpp/internal/Sponsorship.ts +9 -3
- package/src/apps/relay/App.test.ts +1024 -38
- package/src/apps/relay/App.ts +228 -32
- package/src/apps/relay/App.zone-billing.test.ts +257 -0
- package/src/apps/relay/Sponsorships.test.ts +67 -4
- package/src/apps/relay/Sponsorships.ts +253 -29
- package/src/apps/relay/Sponsorships.zone.test.ts +102 -0
- package/src/apps/{funding → routes}/Access.ts +6 -6
- package/src/apps/routes/App.test.ts +165 -0
- package/src/apps/routes/App.ts +96 -0
- package/src/apps/{funding → routes}/Inventory.ts +2 -2
- package/src/apps/routes/index.ts +1 -0
- package/src/apps/{funding → routes}/routes/chains.test.ts +66 -66
- package/src/apps/{funding → routes}/routes/chains.ts +23 -23
- package/src/apps/{funding → routes}/routes/deposit-addresses.test.ts +1362 -462
- package/src/apps/{funding → routes}/routes/deposit-addresses.ts +568 -248
- package/src/apps/{funding → routes}/routes/providers.test.ts +27 -33
- package/src/apps/{funding → routes}/routes/providers.ts +23 -23
- package/src/apps/{funding → routes}/routes/quotes.test.ts +298 -41
- package/src/apps/{funding → routes}/routes/quotes.ts +57 -40
- package/src/apps/routes/routes/transfers.test.ts +2876 -0
- package/src/apps/routes/routes/transfers.ts +1332 -0
- package/src/cli/Cli.test.ts +1 -1
- package/src/cli/commands/admin.test.ts +748 -1
- package/src/cli/commands/admin.ts +278 -0
- package/src/cloudflare.ts +52 -47
- package/src/db/Db.test.ts +245 -2
- package/src/db/Db.ts +1511 -34
- package/src/db/Schema.ts +744 -228
- package/src/db/tables/apiKeyAdmissionBootstraps.ts +4 -0
- package/src/db/tables/apiKeyAdmissions.ts +218 -0
- package/src/db/tables/apiKeyOwnerAdmissions.ts +4 -0
- package/src/db/tables/apiKeyOwnerTombstones.ts +81 -0
- package/src/db/tables/apiKeyRevocations.test.ts +74 -0
- package/src/db/tables/apiKeyRevocations.ts +121 -0
- package/src/db/tables/authAccounts.ts +105 -0
- package/src/db/tables/authSessions.ts +13 -0
- package/src/db/tables/authVerifications.ts +13 -0
- package/src/db/tables/invitations.ts +142 -45
- package/src/db/tables/memberships.ts +79 -3
- package/src/db/tables/organizations.test.ts +725 -7
- package/src/db/tables/organizations.ts +182 -49
- package/src/db/tables/projects.test.ts +71 -0
- package/src/db/tables/projects.ts +59 -4
- package/src/db/tables/requestUsage.ts +4 -1
- package/src/db/tables/rewardAccounts.ts +178 -0
- package/src/db/tables/rewardCampaignDistributors.ts +68 -0
- package/src/db/tables/rewardCampaigns.test.ts +1388 -0
- package/src/db/tables/rewardCampaigns.ts +647 -0
- package/src/db/tables/rewardCredits.ts +110 -0
- package/src/db/tables/rewardEligibilityAssociations.test.ts +271 -0
- package/src/db/tables/rewardEligibilityAssociations.ts +184 -0
- package/src/db/tables/rewardRuns.ts +514 -0
- package/src/db/tables/rewardTransactionAttempts.ts +272 -0
- package/src/db/tables/routesCatalog.test.ts +185 -0
- package/src/db/tables/routesCatalog.ts +163 -0
- package/src/db/tables/routesDepositAddresses.test.ts +1048 -0
- package/src/db/tables/routesDepositAddresses.ts +1008 -0
- package/src/db/tables/{fundingDepositRequestObservations.test.ts → routesDepositRequestObservations.test.ts} +13 -14
- package/src/db/tables/{fundingDepositRequestObservations.ts → routesDepositRequestObservations.ts} +10 -10
- package/src/db/tables/{fundingDeposits.test.ts → routesDeposits.test.ts} +316 -46
- package/src/db/tables/routesDeposits.ts +1062 -0
- package/src/db/tables/routesIdempotency.test.ts +796 -0
- package/src/db/tables/routesIdempotency.ts +496 -0
- package/src/db/tables/routesSubsidies.test.ts +120 -0
- package/src/db/tables/routesSubsidies.ts +71 -0
- package/src/db/tables/{fundingTransferEvents.ts → routesTransferEvents.ts} +4 -4
- package/src/db/tables/routesTransferSubsidies.ts +38 -0
- package/src/db/tables/routesTransferSubsidyNonces.ts +124 -0
- package/src/db/tables/routesTransferTransactions.test.ts +195 -0
- package/src/db/tables/routesTransferTransactions.ts +158 -0
- package/src/db/tables/routesTransfers.test.ts +338 -0
- package/src/db/tables/routesTransfers.ts +662 -0
- package/src/db/tables/sponsoredTransactions.test.ts +563 -1
- package/src/db/tables/sponsoredTransactions.ts +386 -42
- package/src/db/tables/sponsorshipAttributions.test.ts +160 -0
- package/src/db/tables/sponsorshipAttributions.ts +168 -0
- package/src/db/tables/sponsorshipReconciliationCursors.test.ts +115 -0
- package/src/db/tables/sponsorshipReconciliationCursors.ts +67 -0
- package/src/db/tables/stripeCustomers.test.ts +85 -0
- package/src/db/tables/stripeCustomers.ts +24 -0
- package/src/db/tables/users.test.ts +129 -0
- package/src/db/tables/users.ts +49 -3
- package/src/db/tables/webhookQueueEvents.ts +8 -1
- package/src/db/tables/webhookSubscriptions.ts +103 -21
- package/src/handlers/internal/executionError.ts +3 -4
- package/src/handlers/internal/multisig.ts +13 -816
- package/src/handlers/internal/sponsorship.ts +26 -10
- package/src/handlers/relay.test-d.ts +9 -1
- package/src/handlers/relay.test.ts +823 -3
- package/src/handlers/relay.ts +127 -107
- package/src/index.test-d.ts +7 -0
- package/src/index.ts +0 -17
- package/src/internal/AssetResponse.ts +26 -0
- package/src/internal/Auth.test.ts +1564 -9
- package/src/internal/Auth.ts +833 -239
- package/src/internal/BetterAuth.test.ts +242 -0
- package/src/internal/BetterAuth.ts +349 -0
- package/src/internal/Cache.ts +2 -0
- package/src/internal/EarnRates.test.ts +17 -0
- package/src/internal/EarnRates.ts +124 -31
- package/src/internal/EarnSharePrices.test.ts +182 -0
- package/src/internal/EarnSharePrices.ts +313 -0
- package/src/internal/EarnVaults.test.ts +21 -0
- package/src/internal/EarnVaults.ts +37 -15
- package/src/internal/Email.ts +54 -0
- package/src/internal/Idempotency.test.ts +2 -2
- package/src/internal/Log.test-d.ts +10 -7
- package/src/internal/Log.test.ts +114 -16
- package/src/internal/Log.ts +55 -40
- package/src/internal/MetricSink.test.ts +313 -26
- package/src/internal/MetricSink.ts +73 -8
- package/src/internal/Mpp.test.ts +31 -0
- package/src/internal/Mpp.ts +21 -24
- package/src/internal/OpenApi.ts +45 -12
- package/src/internal/Provider.test.ts +1 -1
- package/src/internal/Provider.ts +1 -1
- package/src/internal/RateLimit.test.ts +21 -3
- package/src/internal/RateLimit.ts +12 -1
- package/src/internal/Store.test-d.ts +1 -1
- package/src/internal/Store.test.ts +151 -8
- package/src/internal/Store.ts +76 -9
- package/src/internal/Tidx.test.ts +59 -8
- package/src/internal/Tidx.ts +86 -14
- package/src/internal/Timing.test.ts +77 -0
- package/src/internal/Timing.ts +83 -6
- package/src/internal/VercelOidc.test.ts +188 -0
- package/src/internal/VercelOidc.ts +193 -0
- package/src/internal/VerifiedTokens.test.ts +60 -6
- package/src/internal/VerifiedTokens.ts +21 -24
- package/src/internal/Viem.batch.test.ts +80 -0
- package/src/internal/Viem.test.ts +201 -2
- package/src/internal/Viem.ts +249 -17
- package/src/internal/Webhooks.test.ts +125 -1
- package/src/internal/Webhooks.ts +22 -4
- package/src/internal/ZoneRpc.ts +50 -0
- package/src/internal/exchange/Provider.test.ts +2 -2
- package/src/internal/index.test.ts +3 -1
- package/src/internal/index.ts +3 -1
- package/src/internal/rewards/Audit.ts +231 -0
- package/src/internal/rewards/Campaigns.test.ts +1234 -0
- package/src/internal/rewards/Campaigns.ts +1205 -0
- package/src/internal/rewards/Credits.ts +165 -0
- package/src/internal/rewards/Events.local.test.ts +113 -0
- package/src/internal/rewards/Events.test.ts +152 -0
- package/src/internal/rewards/Events.ts +468 -0
- package/src/internal/rewards/Projection.test.ts +681 -0
- package/src/internal/rewards/Projection.ts +987 -0
- package/src/internal/rewards/Rates.test.ts +171 -0
- package/src/internal/rewards/Rates.ts +110 -0
- package/src/internal/rewards/Read.test.ts +501 -0
- package/src/internal/rewards/Read.ts +476 -0
- package/src/internal/rewards/Runner.checkpoint.test.ts +80 -0
- package/src/internal/rewards/Runner.states.test.ts +188 -0
- package/src/internal/rewards/Runner.test.ts +90 -0
- package/src/internal/rewards/Runner.ts +2229 -0
- package/src/internal/rewards/Signer.test.ts +79 -0
- package/src/internal/rewards/Signer.ts +180 -0
- package/src/internal/rewards/index.ts +14 -0
- package/src/internal/{funding → routes}/Action.test.ts +63 -14
- package/src/internal/{funding → routes}/Action.ts +35 -8
- package/src/internal/{funding → routes}/Catalog.test.ts +3 -3
- package/src/internal/{funding → routes}/Catalog.ts +39 -39
- package/src/internal/{funding → routes}/Chain.test.ts +1 -1
- package/src/internal/{funding → routes}/Chain.ts +11 -11
- package/src/internal/{funding → routes}/Deposit.test.ts +1 -1
- package/src/internal/{funding → routes}/Deposit.ts +93 -45
- package/src/internal/{funding → routes}/DepositAddress.test.ts +11 -3
- package/src/internal/{funding → routes}/DepositAddress.ts +132 -53
- package/src/internal/{funding → routes}/DepositWebhook.test.ts +61 -18
- package/src/internal/{funding → routes}/DepositWebhook.ts +9 -8
- package/src/internal/routes/Economics.test.ts +42 -0
- package/src/internal/routes/Economics.ts +47 -0
- package/src/internal/{funding → routes}/Evidence.test.ts +6 -6
- package/src/internal/{funding → routes}/Evidence.ts +11 -22
- package/src/internal/routes/Observability.test.ts +636 -0
- package/src/internal/routes/Observability.ts +668 -0
- package/src/internal/{funding → routes}/Provider.test.ts +489 -153
- package/src/internal/{funding → routes}/Provider.ts +531 -185
- package/src/internal/{funding → routes}/Reconciliation.local.test.ts +84 -12
- package/src/internal/{funding → routes}/Reconciliation.test.ts +1213 -279
- package/src/internal/{funding → routes}/Reconciliation.ts +501 -203
- package/src/internal/routes/Reconciliation.unattributed.test.ts +250 -0
- package/src/internal/{funding → routes}/Route.ts +7 -7
- package/src/internal/{funding → routes}/SourceObservation.test.ts +13 -14
- package/src/internal/{funding → routes}/SourceObservation.ts +18 -22
- package/src/internal/{funding → routes}/Subsidy.local.test.ts +7 -7
- package/src/internal/routes/Subsidy.test.ts +169 -0
- package/src/internal/{funding → routes}/Subsidy.ts +86 -6
- package/src/internal/{funding → routes}/Token.test.ts +1 -1
- package/src/internal/{funding → routes}/Token.ts +5 -5
- package/src/internal/routes/Transfer.test.ts +1199 -0
- package/src/internal/routes/Transfer.ts +1206 -0
- package/src/internal/routes/TransferReconciliation.test.ts +731 -0
- package/src/internal/routes/TransferReconciliation.ts +527 -0
- package/src/internal/routes/TransferSubsidy.test.ts +172 -0
- package/src/internal/routes/TransferSubsidy.ts +447 -0
- package/src/internal/routes/TransferWebhook.test.ts +128 -0
- package/src/internal/routes/TransferWebhook.ts +67 -0
- package/src/internal/{funding → routes}/index.test.ts +6 -3
- package/src/internal/{funding → routes}/index.ts +3 -0
- package/src/internal/{funding → routes}/providers/across.ts +16 -16
- package/src/internal/{funding → routes}/providers/index.test.ts +157 -44
- package/src/internal/{funding → routes}/providers/relay.test.ts +165 -32
- package/src/internal/{funding → routes}/providers/relay.ts +231 -136
- package/src/internal/{funding → routes}/providers/rhino.ts +16 -16
- package/src/internal/{funding → routes}/providers/squid.ts +17 -17
- package/src/internal/routes/providers/stargate.test.ts +728 -0
- package/src/internal/routes/providers/stargate.ts +1276 -0
- package/src/internal/{funding → routes}/providers/symbiosis.ts +64 -24
- package/src/internal/webhookDestinations/slack.ts +20 -5
- package/src/providers/index.ts +13 -13
- package/src/server.ts +18 -0
- package/dist/apps/funding/Access.d.ts.map +0 -1
- package/dist/apps/funding/Access.js.map +0 -1
- package/dist/apps/funding/App.js.map +0 -1
- package/dist/apps/funding/Inventory.d.ts.map +0 -1
- package/dist/apps/funding/Inventory.js.map +0 -1
- package/dist/apps/funding/ProviderAttempts.d.ts +0 -5
- package/dist/apps/funding/ProviderAttempts.d.ts.map +0 -1
- package/dist/apps/funding/ProviderAttempts.js +0 -24
- package/dist/apps/funding/ProviderAttempts.js.map +0 -1
- package/dist/apps/funding/index.d.ts +0 -2
- package/dist/apps/funding/index.d.ts.map +0 -1
- package/dist/apps/funding/index.js +0 -2
- package/dist/apps/funding/index.js.map +0 -1
- package/dist/apps/funding/routes/chains.d.ts.map +0 -1
- package/dist/apps/funding/routes/chains.js.map +0 -1
- package/dist/apps/funding/routes/deposit-addresses.d.ts.map +0 -1
- package/dist/apps/funding/routes/deposit-addresses.js.map +0 -1
- package/dist/apps/funding/routes/providers.d.ts.map +0 -1
- package/dist/apps/funding/routes/providers.js +0 -57
- package/dist/apps/funding/routes/providers.js.map +0 -1
- package/dist/apps/funding/routes/quotes.d.ts.map +0 -1
- package/dist/apps/funding/routes/quotes.js.map +0 -1
- package/dist/apps/funding/routes/transfers.d.ts.map +0 -1
- package/dist/apps/funding/routes/transfers.js +0 -622
- package/dist/apps/funding/routes/transfers.js.map +0 -1
- package/dist/db/tables/fundingCatalog.d.ts +0 -58
- package/dist/db/tables/fundingCatalog.d.ts.map +0 -1
- package/dist/db/tables/fundingCatalog.js.map +0 -1
- package/dist/db/tables/fundingDepositAddresses.d.ts +0 -192
- package/dist/db/tables/fundingDepositAddresses.d.ts.map +0 -1
- package/dist/db/tables/fundingDepositAddresses.js +0 -235
- package/dist/db/tables/fundingDepositAddresses.js.map +0 -1
- package/dist/db/tables/fundingDepositRequestObservations.d.ts.map +0 -1
- package/dist/db/tables/fundingDepositRequestObservations.js.map +0 -1
- package/dist/db/tables/fundingDeposits.d.ts.map +0 -1
- package/dist/db/tables/fundingDeposits.js +0 -295
- package/dist/db/tables/fundingDeposits.js.map +0 -1
- package/dist/db/tables/fundingIdempotency.d.ts +0 -91
- package/dist/db/tables/fundingIdempotency.d.ts.map +0 -1
- package/dist/db/tables/fundingIdempotency.js +0 -103
- package/dist/db/tables/fundingIdempotency.js.map +0 -1
- package/dist/db/tables/fundingTransferEvents.d.ts.map +0 -1
- package/dist/db/tables/fundingTransferEvents.js.map +0 -1
- package/dist/db/tables/fundingTransferTransactions.d.ts +0 -15
- package/dist/db/tables/fundingTransferTransactions.d.ts.map +0 -1
- package/dist/db/tables/fundingTransferTransactions.js +0 -27
- package/dist/db/tables/fundingTransferTransactions.js.map +0 -1
- package/dist/db/tables/fundingTransfers.d.ts +0 -82
- package/dist/db/tables/fundingTransfers.d.ts.map +0 -1
- package/dist/db/tables/fundingTransfers.js +0 -89
- package/dist/db/tables/fundingTransfers.js.map +0 -1
- package/dist/internal/funding/Action.d.ts.map +0 -1
- package/dist/internal/funding/Action.js.map +0 -1
- package/dist/internal/funding/Catalog.d.ts.map +0 -1
- package/dist/internal/funding/Catalog.js.map +0 -1
- package/dist/internal/funding/Chain.d.ts.map +0 -1
- package/dist/internal/funding/Chain.js.map +0 -1
- package/dist/internal/funding/Deposit.d.ts.map +0 -1
- package/dist/internal/funding/Deposit.js.map +0 -1
- package/dist/internal/funding/DepositAddress.d.ts.map +0 -1
- package/dist/internal/funding/DepositAddress.js.map +0 -1
- package/dist/internal/funding/DepositWebhook.d.ts.map +0 -1
- package/dist/internal/funding/DepositWebhook.js.map +0 -1
- package/dist/internal/funding/Evidence.d.ts.map +0 -1
- package/dist/internal/funding/Evidence.js.map +0 -1
- package/dist/internal/funding/Provider.d.ts.map +0 -1
- package/dist/internal/funding/Provider.js.map +0 -1
- package/dist/internal/funding/Reconciliation.d.ts.map +0 -1
- package/dist/internal/funding/Reconciliation.js.map +0 -1
- package/dist/internal/funding/Route.d.ts +0 -21
- package/dist/internal/funding/Route.d.ts.map +0 -1
- package/dist/internal/funding/Route.js.map +0 -1
- package/dist/internal/funding/SourceObservation.d.ts.map +0 -1
- package/dist/internal/funding/SourceObservation.js.map +0 -1
- package/dist/internal/funding/Subsidy.d.ts.map +0 -1
- package/dist/internal/funding/Subsidy.js.map +0 -1
- package/dist/internal/funding/Token.d.ts.map +0 -1
- package/dist/internal/funding/Token.js.map +0 -1
- package/dist/internal/funding/Transfer.d.ts.map +0 -1
- package/dist/internal/funding/Transfer.js +0 -334
- package/dist/internal/funding/Transfer.js.map +0 -1
- package/dist/internal/funding/index.d.ts.map +0 -1
- package/dist/internal/funding/index.js.map +0 -1
- package/dist/internal/funding/providers/across.d.ts.map +0 -1
- package/dist/internal/funding/providers/across.js.map +0 -1
- package/dist/internal/funding/providers/relay.d.ts.map +0 -1
- package/dist/internal/funding/providers/relay.js.map +0 -1
- package/dist/internal/funding/providers/rhino.d.ts.map +0 -1
- package/dist/internal/funding/providers/rhino.js.map +0 -1
- package/dist/internal/funding/providers/squid.d.ts.map +0 -1
- package/dist/internal/funding/providers/squid.js.map +0 -1
- package/dist/internal/funding/providers/stargate.d.ts +0 -38
- package/dist/internal/funding/providers/stargate.d.ts.map +0 -1
- package/dist/internal/funding/providers/stargate.js +0 -277
- package/dist/internal/funding/providers/stargate.js.map +0 -1
- package/dist/internal/funding/providers/symbiosis.d.ts.map +0 -1
- package/dist/internal/funding/providers/symbiosis.js.map +0 -1
- package/src/apps/funding/App.test.ts +0 -78
- package/src/apps/funding/App.ts +0 -78
- package/src/apps/funding/ProviderAttempts.ts +0 -26
- package/src/apps/funding/index.ts +0 -1
- package/src/apps/funding/routes/transfers.test.ts +0 -1638
- package/src/apps/funding/routes/transfers.ts +0 -721
- package/src/db/tables/fundingCatalog.test.ts +0 -122
- package/src/db/tables/fundingCatalog.ts +0 -163
- package/src/db/tables/fundingDepositAddresses.test.ts +0 -608
- package/src/db/tables/fundingDepositAddresses.ts +0 -443
- package/src/db/tables/fundingDeposits.ts +0 -572
- package/src/db/tables/fundingIdempotency.test.ts +0 -182
- package/src/db/tables/fundingIdempotency.ts +0 -180
- package/src/db/tables/fundingTransferTransactions.test.ts +0 -69
- package/src/db/tables/fundingTransferTransactions.ts +0 -37
- package/src/db/tables/fundingTransfers.test.ts +0 -89
- package/src/db/tables/fundingTransfers.ts +0 -153
- package/src/handlers/internal/multisig.test.ts +0 -818
- package/src/internal/funding/Subsidy.test.ts +0 -75
- package/src/internal/funding/Transfer.test.ts +0 -369
- package/src/internal/funding/Transfer.ts +0 -545
- package/src/internal/funding/providers/stargate.test.ts +0 -163
- package/src/internal/funding/providers/stargate.ts +0 -409
- /package/dist/apps/{funding → routes}/Inventory.d.ts +0 -0
- /package/src/internal/{funding → routes}/Route.test.ts +0 -0
|
@@ -1,1638 +0,0 @@
|
|
|
1
|
-
import { Value } from 'ox'
|
|
2
|
-
import { decodeFunctionData, erc20Abi, maxUint256 } from 'viem'
|
|
3
|
-
import { base } from 'viem/chains'
|
|
4
|
-
import { tempoMainnet } from 'viem/tempo/chains'
|
|
5
|
-
|
|
6
|
-
import * as Anvil from '../../../../test/Anvil.js'
|
|
7
|
-
import * as FundingIdempotencyTable from '../../../db/tables/fundingIdempotency.js'
|
|
8
|
-
|
|
9
|
-
import * as Cache from '../../../internal/Cache.js'
|
|
10
|
-
|
|
11
|
-
import * as FundingProvider from '../../../internal/funding/Provider.js'
|
|
12
|
-
|
|
13
|
-
import * as FundingTransfer from '../../../internal/funding/Transfer.js'
|
|
14
|
-
|
|
15
|
-
import * as Idempotency from '../../../internal/Idempotency.js'
|
|
16
|
-
|
|
17
|
-
import * as Relay from '../../../internal/funding/providers/relay.js'
|
|
18
|
-
|
|
19
|
-
import * as Stargate from '../../../internal/funding/providers/stargate.js'
|
|
20
|
-
|
|
21
|
-
import * as TestApp from '../../../../test/App.js'
|
|
22
|
-
|
|
23
|
-
import * as TestFunding from '../../../../test/Funding.js'
|
|
24
|
-
|
|
25
|
-
import * as Funding from './transfers.js'
|
|
26
|
-
|
|
27
|
-
const db = TestApp.database()
|
|
28
|
-
|
|
29
|
-
/** Providers exercised against executable calls on a forked source chain. */
|
|
30
|
-
const executableProviders = [
|
|
31
|
-
{
|
|
32
|
-
create: (_sender: string) =>
|
|
33
|
-
Relay.relay(process.env.RELAY_API_KEY ? { apiKey: process.env.RELAY_API_KEY } : {}),
|
|
34
|
-
destinationToken: 'pathusd',
|
|
35
|
-
id: 'relay',
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
create: (_sender: string) => Stargate.stargate(),
|
|
39
|
-
destinationToken: 'usdce',
|
|
40
|
-
id: 'stargate',
|
|
41
|
-
},
|
|
42
|
-
] as const
|
|
43
|
-
|
|
44
|
-
beforeAll(() => TestFunding.publish(db))
|
|
45
|
-
|
|
46
|
-
function create(options: TestApp.create.Options = {}) {
|
|
47
|
-
return TestApp.create({ ...options, db })
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
type ContractResponse = {
|
|
51
|
-
$ref?: string | undefined
|
|
52
|
-
content?: Record<string, { schema: unknown }> | undefined
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
type JsonSchema = {
|
|
56
|
-
$ref?: string | undefined
|
|
57
|
-
additionalProperties?: boolean | undefined
|
|
58
|
-
examples?: readonly unknown[] | undefined
|
|
59
|
-
properties?: Record<string, JsonSchema> | undefined
|
|
60
|
-
required?: readonly string[] | undefined
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
type ComponentSpec = {
|
|
64
|
-
components: { schemas: Record<string, JsonSchema> }
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function dereference(spec: ComponentSpec, schema: JsonSchema): JsonSchema {
|
|
68
|
-
if (!schema.$ref) return schema
|
|
69
|
-
const name = schema.$ref.split('/').at(-1)!
|
|
70
|
-
return spec.components.schemas[name]!
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
describe('GET /funding/transfers', () => {
|
|
74
|
-
test('requires the funding:read scope', async () => {
|
|
75
|
-
const app = transfersApp()
|
|
76
|
-
expect((await app.request('/v1/funding/transfers')).status).toBe(401)
|
|
77
|
-
const forbidden = await app.request('/v1/funding/transfers', as(TestApp.key))
|
|
78
|
-
expect(forbidden.status).toBe(403)
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
test('pages own transfers newest-first', async () => {
|
|
82
|
-
const app = transfersApp()
|
|
83
|
-
const first = await seedTransfer()
|
|
84
|
-
const second = await seedTransfer()
|
|
85
|
-
const third = await seedTransfer()
|
|
86
|
-
await seedTransfer({ orgId: fundingForeign.orgId })
|
|
87
|
-
|
|
88
|
-
const response = await app.request('/v1/funding/transfers?limit=5', {
|
|
89
|
-
headers: { 'tempo-api-key': fundingReader.token },
|
|
90
|
-
})
|
|
91
|
-
expect(response.status).toBe(200)
|
|
92
|
-
expect(response.headers.get('cache-control')).toBe(Cache.policies.feed)
|
|
93
|
-
const etag = response.headers.get('etag') ?? ''
|
|
94
|
-
expect(etag).not.toBe('')
|
|
95
|
-
expect(response.headers.get('vary')).toBe(
|
|
96
|
-
'Accept-Encoding, Authorization, Tempo-API-Key, X-API-Key',
|
|
97
|
-
)
|
|
98
|
-
const body = await TestApp.json(response, Funding.schema.listFundingTransfers.Response)
|
|
99
|
-
expect(body.data.map((transfer) => transfer.id)).toEqual([third.id, second.id, first.id])
|
|
100
|
-
expect(body.nextCursor).toBeNull()
|
|
101
|
-
expect(body.meta).toBeUndefined()
|
|
102
|
-
|
|
103
|
-
const unchanged = await app.request('/v1/funding/transfers?limit=5', {
|
|
104
|
-
headers: { 'if-none-match': etag, 'tempo-api-key': fundingReader.token },
|
|
105
|
-
})
|
|
106
|
-
expect(unchanged.status).toBe(304)
|
|
107
|
-
expect(unchanged.headers.get('cache-control')).toBe(Cache.policies.feed)
|
|
108
|
-
expect(unchanged.headers.get('vary')).toBe(
|
|
109
|
-
'Accept-Encoding, Authorization, Tempo-API-Key, X-API-Key',
|
|
110
|
-
)
|
|
111
|
-
|
|
112
|
-
const paged = await TestApp.json(
|
|
113
|
-
await app.request(`/v1/funding/transfers?limit=5&cursor=${second.id}`, as(fundingReader)),
|
|
114
|
-
Funding.schema.listFundingTransfers.Response,
|
|
115
|
-
)
|
|
116
|
-
expect(paged.data.map((transfer) => transfer.id)).toEqual([first.id])
|
|
117
|
-
})
|
|
118
|
-
|
|
119
|
-
test('filters by status and embeds the capped count on request', async () => {
|
|
120
|
-
const app = transfersApp()
|
|
121
|
-
const expired = await seedTransfer()
|
|
122
|
-
await FundingTransfer.transition(db, {
|
|
123
|
-
expectedVersion: 1,
|
|
124
|
-
id: expired.id,
|
|
125
|
-
status: 'expired',
|
|
126
|
-
})
|
|
127
|
-
|
|
128
|
-
const response = await app.request(
|
|
129
|
-
'/v1/funding/transfers?status=expired&include=totalCount',
|
|
130
|
-
as(fundingReader),
|
|
131
|
-
)
|
|
132
|
-
const body = await TestApp.json(response, Funding.schema.listFundingTransfers.Response)
|
|
133
|
-
expect(body.data.map((transfer) => transfer.id)).toEqual([expired.id])
|
|
134
|
-
expect(body.data[0]?.status).toBe('expired')
|
|
135
|
-
expect(body.meta).toEqual({ totalCount: 1, totalCountCapped: false })
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
test('narrows project-attributed keys to their project', async () => {
|
|
139
|
-
const app = transfersApp()
|
|
140
|
-
const scoped = await seedTransfer({ projectId: fundingProjectReader.projectId })
|
|
141
|
-
|
|
142
|
-
const body = await TestApp.json(
|
|
143
|
-
await app.request('/v1/funding/transfers?limit=200', as(fundingProjectReader)),
|
|
144
|
-
Funding.schema.listFundingTransfers.Response,
|
|
145
|
-
)
|
|
146
|
-
expect(body.data.map((transfer) => transfer.id)).toEqual([scoped.id])
|
|
147
|
-
|
|
148
|
-
// The organization-attributed key sees the project row too.
|
|
149
|
-
const orgBody = await TestApp.json(
|
|
150
|
-
await app.request('/v1/funding/transfers?limit=200', as(fundingReader)),
|
|
151
|
-
Funding.schema.listFundingTransfers.Response,
|
|
152
|
-
)
|
|
153
|
-
expect(orgBody.data.map((transfer) => transfer.id)).toContain(scoped.id)
|
|
154
|
-
})
|
|
155
|
-
|
|
156
|
-
test('rejects invalid query parameters', async () => {
|
|
157
|
-
const app = transfersApp()
|
|
158
|
-
const response = await app.request('/v1/funding/transfers?status=bogus', as(fundingReader))
|
|
159
|
-
expect(response.status).toBe(400)
|
|
160
|
-
})
|
|
161
|
-
})
|
|
162
|
-
|
|
163
|
-
describe('GET /funding/transfers/:id', () => {
|
|
164
|
-
test('returns the owned transfer directly, without an action', async () => {
|
|
165
|
-
const app = transfersApp()
|
|
166
|
-
const record = await seedTransfer()
|
|
167
|
-
const response = await app.request(`/v1/funding/transfers/${record.id}`, {
|
|
168
|
-
headers: { 'tempo-api-key': fundingReader.token },
|
|
169
|
-
})
|
|
170
|
-
expect(response.status).toBe(200)
|
|
171
|
-
expect({
|
|
172
|
-
cacheControl: response.headers.get('cache-control'),
|
|
173
|
-
etag: response.headers.get('etag'),
|
|
174
|
-
}).toMatchInlineSnapshot(`
|
|
175
|
-
{
|
|
176
|
-
"cacheControl": "no-store",
|
|
177
|
-
"etag": null,
|
|
178
|
-
}
|
|
179
|
-
`)
|
|
180
|
-
expect(response.headers.get('vary')).toBe(
|
|
181
|
-
'Accept-Encoding, Authorization, Tempo-API-Key, X-API-Key',
|
|
182
|
-
)
|
|
183
|
-
const body = await TestApp.json(response, Funding.schema.getFundingTransfer.Response)
|
|
184
|
-
expect(body).toEqual(FundingTransfer.toPublic(record))
|
|
185
|
-
expect('action' in body).toBe(false)
|
|
186
|
-
|
|
187
|
-
const repeated = await app.request(`/v1/funding/transfers/${record.id}`, {
|
|
188
|
-
headers: { 'if-none-match': '"stale"', 'tempo-api-key': fundingReader.token },
|
|
189
|
-
})
|
|
190
|
-
expect({
|
|
191
|
-
cacheControl: repeated.headers.get('cache-control'),
|
|
192
|
-
etag: repeated.headers.get('etag'),
|
|
193
|
-
status: repeated.status,
|
|
194
|
-
}).toMatchInlineSnapshot(`
|
|
195
|
-
{
|
|
196
|
-
"cacheControl": "no-store",
|
|
197
|
-
"etag": null,
|
|
198
|
-
"status": 200,
|
|
199
|
-
}
|
|
200
|
-
`)
|
|
201
|
-
})
|
|
202
|
-
|
|
203
|
-
test('hides foreign and absent transfers behind the same 404', async () => {
|
|
204
|
-
const app = transfersApp()
|
|
205
|
-
const record = await seedTransfer()
|
|
206
|
-
|
|
207
|
-
const foreign = await app.request(`/v1/funding/transfers/${record.id}`, as(fundingForeign))
|
|
208
|
-
expect(foreign.status).toBe(404)
|
|
209
|
-
expect(((await foreign.json()) as { error: { code: string } }).error.code).toBe(
|
|
210
|
-
'funding_transfer_not_found',
|
|
211
|
-
)
|
|
212
|
-
|
|
213
|
-
const project = await app.request(
|
|
214
|
-
`/v1/funding/transfers/${record.id}`,
|
|
215
|
-
as(fundingProjectReader),
|
|
216
|
-
)
|
|
217
|
-
expect(project.status).toBe(404)
|
|
218
|
-
|
|
219
|
-
const absent = await app.request(
|
|
220
|
-
'/v1/funding/transfers/ftr_000000000000000_000000000000000000000000',
|
|
221
|
-
as(fundingReader),
|
|
222
|
-
)
|
|
223
|
-
expect(absent.status).toBe(404)
|
|
224
|
-
})
|
|
225
|
-
})
|
|
226
|
-
|
|
227
|
-
const createBody = {
|
|
228
|
-
amount: '1000000',
|
|
229
|
-
destinationToken: '0x20c0000000000000000000000000000000000000',
|
|
230
|
-
mode: 'exactSource',
|
|
231
|
-
recipient: `0x${'11'.repeat(20)}`,
|
|
232
|
-
sender: `0x${'22'.repeat(20)}`,
|
|
233
|
-
slippageBps: 300,
|
|
234
|
-
sourceChain: 'base',
|
|
235
|
-
sourceToken: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913',
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
const vaultTransferBody = {
|
|
239
|
-
amount: createBody.amount,
|
|
240
|
-
mode: createBody.mode,
|
|
241
|
-
recipient: createBody.recipient,
|
|
242
|
-
sender: createBody.sender,
|
|
243
|
-
slippageBps: createBody.slippageBps,
|
|
244
|
-
sourceChain: createBody.sourceChain,
|
|
245
|
-
sourceToken: createBody.sourceToken,
|
|
246
|
-
vaultAddress: `0x${'f4'.repeat(20)}`,
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
const zoneTransferBody = {
|
|
250
|
-
amount: createBody.amount,
|
|
251
|
-
destinationChain: 'eip155:421700001',
|
|
252
|
-
destinationToken: createBody.destinationToken,
|
|
253
|
-
mode: createBody.mode,
|
|
254
|
-
recipient: createBody.recipient,
|
|
255
|
-
recipientFallback: `0x${'33'.repeat(20)}`,
|
|
256
|
-
sender: createBody.sender,
|
|
257
|
-
slippageBps: createBody.slippageBps,
|
|
258
|
-
sourceChain: createBody.sourceChain,
|
|
259
|
-
sourceToken: createBody.sourceToken,
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
function postTransfer(
|
|
263
|
-
app: ReturnType<typeof create>,
|
|
264
|
-
options: { body?: unknown; idempotencyKey?: string | undefined; key?: { token: string } } = {},
|
|
265
|
-
) {
|
|
266
|
-
return app.request('/v1/funding/transfers', {
|
|
267
|
-
body: JSON.stringify(options.body ?? createBody),
|
|
268
|
-
headers: {
|
|
269
|
-
authorization: `Bearer ${(options.key ?? fundingWriter).token}`,
|
|
270
|
-
'content-type': 'application/json',
|
|
271
|
-
...(options.idempotencyKey === undefined
|
|
272
|
-
? {}
|
|
273
|
-
: { 'idempotency-key': options.idempotencyKey }),
|
|
274
|
-
},
|
|
275
|
-
method: 'POST',
|
|
276
|
-
})
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
describe('POST /funding/transfers', () => {
|
|
280
|
-
function providerResponse(): FundingProvider.prepareTransfer.ReturnType {
|
|
281
|
-
const spender = `0x${'44'.repeat(20)}`
|
|
282
|
-
return {
|
|
283
|
-
action: {
|
|
284
|
-
calls: [
|
|
285
|
-
{
|
|
286
|
-
data: `0x095ea7b3${spender.slice(2).padStart(64, '0')}${(1_000_000).toString(16).padStart(64, '0')}`,
|
|
287
|
-
to: createBody.sourceToken,
|
|
288
|
-
value: '0x0',
|
|
289
|
-
},
|
|
290
|
-
{ data: '0xe8017952', to: spender, value: '0x0' },
|
|
291
|
-
],
|
|
292
|
-
type: 'evm:calls',
|
|
293
|
-
},
|
|
294
|
-
correlation: { requestId: `0x${'ab'.repeat(32)}` },
|
|
295
|
-
fees: [{ amount: '21050', side: 'source' }],
|
|
296
|
-
destinationAmountMin: '980000',
|
|
297
|
-
destinationAmount: '990000',
|
|
298
|
-
quality: {
|
|
299
|
-
estimatedSeconds: 4,
|
|
300
|
-
liquiditySource: 'providerQuote',
|
|
301
|
-
sourceDetail: 'relay:quote-v2',
|
|
302
|
-
tier: 'liquid',
|
|
303
|
-
},
|
|
304
|
-
sampledAt: '2099-01-01T00:00:00.000Z',
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
function provider(
|
|
309
|
-
prepareTransfer: NonNullable<FundingProvider.Provider['prepareTransfer']> = async () =>
|
|
310
|
-
providerResponse(),
|
|
311
|
-
) {
|
|
312
|
-
return FundingProvider.from({
|
|
313
|
-
...Relay.relay(),
|
|
314
|
-
prepareTransfer,
|
|
315
|
-
})
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
let idempotencySequence = 0
|
|
319
|
-
function nextIdempotencyKey() {
|
|
320
|
-
return `funding_test_${idempotencySequence++}`
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
test('requires funding:write and an Idempotency-Key', async () => {
|
|
324
|
-
const app = transfersApp({
|
|
325
|
-
providers: [provider()],
|
|
326
|
-
})
|
|
327
|
-
const forbidden = await postTransfer(app, {
|
|
328
|
-
idempotencyKey: nextIdempotencyKey(),
|
|
329
|
-
key: fundingReader,
|
|
330
|
-
})
|
|
331
|
-
expect(forbidden.status).toBe(403)
|
|
332
|
-
|
|
333
|
-
const missing = await postTransfer(app)
|
|
334
|
-
expect(missing.status).toBe(400)
|
|
335
|
-
expect(((await missing.json()) as { error: { code: string } }).error.code).toBe(
|
|
336
|
-
'idempotency_key_required',
|
|
337
|
-
)
|
|
338
|
-
})
|
|
339
|
-
|
|
340
|
-
test('creates a transfer with the selected executable quote', async () => {
|
|
341
|
-
const inputs: FundingProvider.prepareTransfer.Parameters[] = []
|
|
342
|
-
const app = transfersApp({
|
|
343
|
-
providers: [
|
|
344
|
-
provider(async (input) => {
|
|
345
|
-
inputs.push(input)
|
|
346
|
-
return providerResponse()
|
|
347
|
-
}),
|
|
348
|
-
],
|
|
349
|
-
})
|
|
350
|
-
const response = await postTransfer(app, {
|
|
351
|
-
body: { ...createBody, destinationToken: 'pathusd', sourceToken: 'usdc' },
|
|
352
|
-
idempotencyKey: nextIdempotencyKey(),
|
|
353
|
-
})
|
|
354
|
-
expect(response.status).toBe(200)
|
|
355
|
-
expect(response.headers.get('cache-control')).toBe('no-store')
|
|
356
|
-
const body = await TestApp.json(response, Funding.schema.createFundingTransfer.Response)
|
|
357
|
-
|
|
358
|
-
expect(inputs[0]).toMatchObject({
|
|
359
|
-
method: 'transaction',
|
|
360
|
-
mode: 'exactSource',
|
|
361
|
-
recipient: createBody.recipient,
|
|
362
|
-
sender: createBody.sender,
|
|
363
|
-
slippageBps: 300,
|
|
364
|
-
})
|
|
365
|
-
expect(body).toMatchObject({
|
|
366
|
-
action: { type: 'evm:calls' },
|
|
367
|
-
destinationAmountMin: { baseUnits: '980000' },
|
|
368
|
-
method: 'transaction',
|
|
369
|
-
mode: 'exactSource',
|
|
370
|
-
provider: { id: 'relay' },
|
|
371
|
-
// The provider returned no expiry, so the default validity window applies.
|
|
372
|
-
quote: { expiresAt: '2099-01-01T00:01:00.000Z', sampledAt: '2099-01-01T00:00:00.000Z' },
|
|
373
|
-
sourceAmount: { baseUnits: '1000000' },
|
|
374
|
-
status: 'awaiting-source',
|
|
375
|
-
version: 1,
|
|
376
|
-
})
|
|
377
|
-
expect(body.fees[0]).toMatchObject({ side: 'source', token: { symbol: 'USDC' } })
|
|
378
|
-
|
|
379
|
-
// Reads return the same transfer without the action; the private
|
|
380
|
-
// correlation never leaves the row.
|
|
381
|
-
const read = await app.request(`/v1/funding/transfers/${body.id}`, as(fundingWriter))
|
|
382
|
-
const readBody = await TestApp.json(read, Funding.schema.getFundingTransfer.Response)
|
|
383
|
-
expect('action' in readBody).toBe(false)
|
|
384
|
-
expect(JSON.stringify(readBody)).not.toContain('ab'.repeat(32))
|
|
385
|
-
const row = await db.kysely
|
|
386
|
-
.selectFrom('funding_transfers')
|
|
387
|
-
.select(['providerState'])
|
|
388
|
-
.where('id', '=', body.id)
|
|
389
|
-
.executeTakeFirstOrThrow()
|
|
390
|
-
expect(row.providerState).toEqual({ requestId: `0x${'ab'.repeat(32)}` })
|
|
391
|
-
})
|
|
392
|
-
|
|
393
|
-
test('creates a transfer with the requested provider', async () => {
|
|
394
|
-
const app = transfersApp({ providers: [provider()] })
|
|
395
|
-
const response = await postTransfer(app, {
|
|
396
|
-
body: { ...createBody, provider: 'relay' },
|
|
397
|
-
idempotencyKey: nextIdempotencyKey(),
|
|
398
|
-
})
|
|
399
|
-
|
|
400
|
-
expect(response.status).toBe(200)
|
|
401
|
-
const body = await TestApp.json(response, Funding.schema.createFundingTransfer.Response)
|
|
402
|
-
expect(body.provider.id).toBe('relay')
|
|
403
|
-
})
|
|
404
|
-
|
|
405
|
-
test('rejects an unsupported provider', async () => {
|
|
406
|
-
const app = transfersApp({ providers: [provider()] })
|
|
407
|
-
const response = await postTransfer(app, {
|
|
408
|
-
body: { ...createBody, provider: 'bridge' },
|
|
409
|
-
idempotencyKey: nextIdempotencyKey(),
|
|
410
|
-
})
|
|
411
|
-
|
|
412
|
-
expect(response.status).toBe(400)
|
|
413
|
-
expect(((await response.json()) as { error: { code: string } }).error.code).toBe('body_invalid')
|
|
414
|
-
})
|
|
415
|
-
|
|
416
|
-
test('preserves a provider-specified native fee token', async () => {
|
|
417
|
-
const app = transfersApp({
|
|
418
|
-
providers: [
|
|
419
|
-
provider(async () => ({
|
|
420
|
-
...providerResponse(),
|
|
421
|
-
fees: [
|
|
422
|
-
{
|
|
423
|
-
amount: '1000000000000000',
|
|
424
|
-
side: 'source',
|
|
425
|
-
token: {
|
|
426
|
-
address: '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee',
|
|
427
|
-
currency: 'ETH',
|
|
428
|
-
decimals: 18,
|
|
429
|
-
name: 'Ether',
|
|
430
|
-
standard: 'native',
|
|
431
|
-
symbol: 'ETH',
|
|
432
|
-
tokenKey: 'eip155:8453/slip44:60',
|
|
433
|
-
verified: true,
|
|
434
|
-
},
|
|
435
|
-
},
|
|
436
|
-
],
|
|
437
|
-
})),
|
|
438
|
-
],
|
|
439
|
-
})
|
|
440
|
-
const response = await postTransfer(app, {
|
|
441
|
-
body: { ...createBody, destinationToken: 'pathusd', sourceToken: 'usdc' },
|
|
442
|
-
idempotencyKey: nextIdempotencyKey(),
|
|
443
|
-
})
|
|
444
|
-
expect(response.status).toBe(200)
|
|
445
|
-
const body = await TestApp.json(response, Funding.schema.createFundingTransfer.Response)
|
|
446
|
-
|
|
447
|
-
expect(body.fees).toMatchObject([
|
|
448
|
-
{
|
|
449
|
-
amount: { baseUnits: '1000000000000000', formatted: '0.001' },
|
|
450
|
-
side: 'source',
|
|
451
|
-
token: { standard: 'native', symbol: 'ETH' },
|
|
452
|
-
},
|
|
453
|
-
])
|
|
454
|
-
})
|
|
455
|
-
|
|
456
|
-
test('resolves token identifiers through the composed route', async () => {
|
|
457
|
-
const app = transfersApp({ providers: [provider()] })
|
|
458
|
-
const identifiers = [
|
|
459
|
-
{ destinationToken: 'pathusd', name: 'alias', sourceToken: 'usdc' },
|
|
460
|
-
{
|
|
461
|
-
destinationToken: createBody.destinationToken,
|
|
462
|
-
name: 'address',
|
|
463
|
-
sourceToken: createBody.sourceToken,
|
|
464
|
-
},
|
|
465
|
-
{
|
|
466
|
-
destinationToken: 'eip155:4217/erc20:0x20c0000000000000000000000000000000000000',
|
|
467
|
-
name: 'token key',
|
|
468
|
-
sourceToken: 'eip155:8453/erc20:0x833589fcd6edb6e08f4c7c32d4f71b54bda02913',
|
|
469
|
-
},
|
|
470
|
-
] as const
|
|
471
|
-
const results = []
|
|
472
|
-
for (const identifier of identifiers) {
|
|
473
|
-
const response = await postTransfer(app, {
|
|
474
|
-
body: {
|
|
475
|
-
...createBody,
|
|
476
|
-
destinationToken: identifier.destinationToken,
|
|
477
|
-
sourceToken: identifier.sourceToken,
|
|
478
|
-
},
|
|
479
|
-
idempotencyKey: nextIdempotencyKey(),
|
|
480
|
-
})
|
|
481
|
-
const body = await TestApp.json(response, Funding.schema.createFundingTransfer.Response)
|
|
482
|
-
results.push({
|
|
483
|
-
destinationToken: body.destinationToken.symbol,
|
|
484
|
-
name: identifier.name,
|
|
485
|
-
sourceToken: body.sourceToken.symbol,
|
|
486
|
-
status: response.status,
|
|
487
|
-
})
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
expect(results).toMatchInlineSnapshot(`
|
|
491
|
-
[
|
|
492
|
-
{
|
|
493
|
-
"destinationToken": "pathUSD",
|
|
494
|
-
"name": "alias",
|
|
495
|
-
"sourceToken": "USDC",
|
|
496
|
-
"status": 200,
|
|
497
|
-
},
|
|
498
|
-
{
|
|
499
|
-
"destinationToken": "pathUSD",
|
|
500
|
-
"name": "address",
|
|
501
|
-
"sourceToken": "USDC",
|
|
502
|
-
"status": 200,
|
|
503
|
-
},
|
|
504
|
-
{
|
|
505
|
-
"destinationToken": "pathUSD",
|
|
506
|
-
"name": "token key",
|
|
507
|
-
"sourceToken": "USDC",
|
|
508
|
-
"status": 200,
|
|
509
|
-
},
|
|
510
|
-
]
|
|
511
|
-
`)
|
|
512
|
-
})
|
|
513
|
-
|
|
514
|
-
test('replays the exact response for the same key and body', async () => {
|
|
515
|
-
const app = transfersApp({
|
|
516
|
-
providers: [provider()],
|
|
517
|
-
})
|
|
518
|
-
const idempotencyKey = nextIdempotencyKey()
|
|
519
|
-
const first = await postTransfer(app, { idempotencyKey })
|
|
520
|
-
const second = await postTransfer(app, { idempotencyKey })
|
|
521
|
-
expect(second.status).toBe(200)
|
|
522
|
-
expect(await second.json()).toEqual(await first.json())
|
|
523
|
-
})
|
|
524
|
-
|
|
525
|
-
test('rejects a reused key with different input', async () => {
|
|
526
|
-
const app = transfersApp({
|
|
527
|
-
providers: [provider()],
|
|
528
|
-
})
|
|
529
|
-
const idempotencyKey = nextIdempotencyKey()
|
|
530
|
-
await postTransfer(app, { idempotencyKey })
|
|
531
|
-
const conflict = await postTransfer(app, {
|
|
532
|
-
body: { ...createBody, amount: '2000000' },
|
|
533
|
-
idempotencyKey,
|
|
534
|
-
})
|
|
535
|
-
expect(conflict.status).toBe(409)
|
|
536
|
-
expect(((await conflict.json()) as { error: { code: string } }).error.code).toBe(
|
|
537
|
-
'idempotency_conflict',
|
|
538
|
-
)
|
|
539
|
-
})
|
|
540
|
-
|
|
541
|
-
test('rejects an equivalent request while the first is running', async () => {
|
|
542
|
-
const app = transfersApp({
|
|
543
|
-
providers: [provider()],
|
|
544
|
-
})
|
|
545
|
-
const idempotencyKey = nextIdempotencyKey()
|
|
546
|
-
await FundingIdempotencyTable.claim(db, {
|
|
547
|
-
apiKeyId: fundingWriter.id,
|
|
548
|
-
keyHash: Idempotency.inputHash(idempotencyKey),
|
|
549
|
-
requestHash: Idempotency.inputHash(createBody),
|
|
550
|
-
ttlMs: 60_000,
|
|
551
|
-
})
|
|
552
|
-
const pending = await postTransfer(app, { idempotencyKey })
|
|
553
|
-
expect(pending.status).toBe(409)
|
|
554
|
-
expect(((await pending.json()) as { error: { code: string } }).error.code).toBe(
|
|
555
|
-
'idempotency_in_progress',
|
|
556
|
-
)
|
|
557
|
-
})
|
|
558
|
-
|
|
559
|
-
test('rolls back creation after losing the idempotency lease', async () => {
|
|
560
|
-
const idempotencyKey = nextIdempotencyKey()
|
|
561
|
-
const keyHash = Idempotency.inputHash(idempotencyKey)
|
|
562
|
-
const before = await db.kysely
|
|
563
|
-
.selectFrom('funding_transfers')
|
|
564
|
-
.select(({ fn }) => fn.countAll<number>().as('count'))
|
|
565
|
-
.executeTakeFirstOrThrow()
|
|
566
|
-
const app = transfersApp({
|
|
567
|
-
providers: [
|
|
568
|
-
provider(async () => {
|
|
569
|
-
await db.kysely
|
|
570
|
-
.updateTable('funding_idempotency_requests')
|
|
571
|
-
.set({ expiresAt: new Date(0).toISOString() })
|
|
572
|
-
.where('apiKeyId', '=', fundingWriter.id)
|
|
573
|
-
.where('keyHash', '=', keyHash)
|
|
574
|
-
.execute()
|
|
575
|
-
await FundingIdempotencyTable.claim(db, {
|
|
576
|
-
apiKeyId: fundingWriter.id,
|
|
577
|
-
keyHash,
|
|
578
|
-
requestHash: Idempotency.inputHash(createBody),
|
|
579
|
-
ttlMs: 60_000,
|
|
580
|
-
})
|
|
581
|
-
return providerResponse()
|
|
582
|
-
}),
|
|
583
|
-
],
|
|
584
|
-
})
|
|
585
|
-
|
|
586
|
-
const response = await postTransfer(app, { idempotencyKey })
|
|
587
|
-
expect(response.status).toBe(500)
|
|
588
|
-
const after = await db.kysely
|
|
589
|
-
.selectFrom('funding_transfers')
|
|
590
|
-
.select(({ fn }) => fn.countAll<number>().as('count'))
|
|
591
|
-
.executeTakeFirstOrThrow()
|
|
592
|
-
expect(after.count).toBe(before.count)
|
|
593
|
-
})
|
|
594
|
-
|
|
595
|
-
test('rejects non-account fields and gates disabled corridors and methods', async () => {
|
|
596
|
-
const app = transfersApp({
|
|
597
|
-
providers: [provider()],
|
|
598
|
-
})
|
|
599
|
-
|
|
600
|
-
const ignoredRefund = await postTransfer(app, {
|
|
601
|
-
body: { ...createBody, refundAddress: createBody.sender },
|
|
602
|
-
idempotencyKey: nextIdempotencyKey(),
|
|
603
|
-
})
|
|
604
|
-
expect(ignoredRefund.status).toBe(400)
|
|
605
|
-
expect(((await ignoredRefund.json()) as { error: { code: string } }).error.code).toBe(
|
|
606
|
-
'body_invalid',
|
|
607
|
-
)
|
|
608
|
-
|
|
609
|
-
const unsupportedDestination = await postTransfer(app, {
|
|
610
|
-
body: { ...createBody, destinationVault: `0x${'f4'.repeat(20)}`, type: 'vault' },
|
|
611
|
-
idempotencyKey: nextIdempotencyKey(),
|
|
612
|
-
})
|
|
613
|
-
expect(unsupportedDestination.status).toBe(400)
|
|
614
|
-
expect(((await unsupportedDestination.json()) as { error: { code: string } }).error.code).toBe(
|
|
615
|
-
'body_invalid',
|
|
616
|
-
)
|
|
617
|
-
|
|
618
|
-
const unknownToken = await postTransfer(app, {
|
|
619
|
-
body: { ...createBody, destinationToken: `0x${'99'.repeat(20)}` },
|
|
620
|
-
idempotencyKey: nextIdempotencyKey(),
|
|
621
|
-
})
|
|
622
|
-
expect(unknownToken.status).toBe(404)
|
|
623
|
-
})
|
|
624
|
-
|
|
625
|
-
test('releases the claim after a provider failure', async () => {
|
|
626
|
-
const failing = transfersApp({
|
|
627
|
-
providers: [
|
|
628
|
-
provider(async () => {
|
|
629
|
-
throw new Error('upstream unavailable')
|
|
630
|
-
}),
|
|
631
|
-
],
|
|
632
|
-
})
|
|
633
|
-
const idempotencyKey = nextIdempotencyKey()
|
|
634
|
-
const failed = await postTransfer(failing, { idempotencyKey })
|
|
635
|
-
expect(failed.status).toBe(502)
|
|
636
|
-
expect(((await failed.json()) as { error: { code: string } }).error.code).toBe('upstream_error')
|
|
637
|
-
|
|
638
|
-
// The key was released, so the same request retries successfully.
|
|
639
|
-
const working = transfersApp({
|
|
640
|
-
providers: [provider()],
|
|
641
|
-
})
|
|
642
|
-
expect((await postTransfer(working, { idempotencyKey })).status).toBe(200)
|
|
643
|
-
})
|
|
644
|
-
|
|
645
|
-
test('rejects preparations with unbounded approvals', async () => {
|
|
646
|
-
const app = transfersApp({
|
|
647
|
-
providers: [
|
|
648
|
-
provider(async () => {
|
|
649
|
-
const result = providerResponse()
|
|
650
|
-
const spender = `0x${'44'.repeat(20)}`
|
|
651
|
-
return {
|
|
652
|
-
...result,
|
|
653
|
-
action: {
|
|
654
|
-
calls: [
|
|
655
|
-
{
|
|
656
|
-
data: `0x095ea7b3${spender.slice(2).padStart(64, '0')}${'f'.repeat(64)}`,
|
|
657
|
-
to: createBody.sourceToken,
|
|
658
|
-
value: '0x0',
|
|
659
|
-
},
|
|
660
|
-
],
|
|
661
|
-
type: 'evm:calls',
|
|
662
|
-
},
|
|
663
|
-
}
|
|
664
|
-
}),
|
|
665
|
-
],
|
|
666
|
-
})
|
|
667
|
-
const response = await postTransfer(app, { idempotencyKey: nextIdempotencyKey() })
|
|
668
|
-
expect(response.status).toBe(502)
|
|
669
|
-
})
|
|
670
|
-
})
|
|
671
|
-
|
|
672
|
-
describe.skipIf(!Anvil.available)('POST /funding/transfers (forked localnet)', () => {
|
|
673
|
-
/**
|
|
674
|
-
* Storage slot of Circle FiatToken's `balanceAndBlacklistStates` mapping.
|
|
675
|
-
* `anvil_dealERC20` cannot probe it because balances pack a blacklist bit,
|
|
676
|
-
* so the fork suite writes the slot directly. Every curated USDC is a
|
|
677
|
-
* FiatToken.
|
|
678
|
-
*/
|
|
679
|
-
const fiatTokenBalanceSlot = 9n
|
|
680
|
-
|
|
681
|
-
for (const executable of executableProviders) {
|
|
682
|
-
describe(executable.id, () => {
|
|
683
|
-
const route = TestFunding.snapshot.routes.find(
|
|
684
|
-
(entry) =>
|
|
685
|
-
entry.route.source.chain.id === `eip155:${base.id}` &&
|
|
686
|
-
entry.route.source.symbol === 'USDC' &&
|
|
687
|
-
entry.route.destination.slug === executable.destinationToken,
|
|
688
|
-
)!
|
|
689
|
-
const usdc = route.route.source
|
|
690
|
-
const amount = Value.from('10', usdc.decimals)
|
|
691
|
-
const sender = Anvil.getAccount(0)
|
|
692
|
-
|
|
693
|
-
let anvil: Anvil.start.ReturnType
|
|
694
|
-
|
|
695
|
-
beforeAll(async () => {
|
|
696
|
-
anvil = await Anvil.start({ chain: base, forkUrl: base.rpcUrls.default.http[0]! })
|
|
697
|
-
})
|
|
698
|
-
|
|
699
|
-
afterAll(async () => {
|
|
700
|
-
await anvil?.stop()
|
|
701
|
-
})
|
|
702
|
-
|
|
703
|
-
function createTransfer(idempotencyKey: string) {
|
|
704
|
-
const app = transfersApp({ providers: [executable.create(sender.address)] })
|
|
705
|
-
return postTransfer(app, {
|
|
706
|
-
body: {
|
|
707
|
-
...createBody,
|
|
708
|
-
amount: amount.toString(),
|
|
709
|
-
destinationToken: executable.destinationToken,
|
|
710
|
-
sender: sender.address,
|
|
711
|
-
},
|
|
712
|
-
idempotencyKey,
|
|
713
|
-
})
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
test('executes the prepared calls and returns successful receipts', async () => {
|
|
717
|
-
const { client } = anvil
|
|
718
|
-
await Anvil.setErc20Balance(client, {
|
|
719
|
-
address: sender.address,
|
|
720
|
-
amount,
|
|
721
|
-
slot: fiatTokenBalanceSlot,
|
|
722
|
-
token: usdc.address as `0x${string}`,
|
|
723
|
-
})
|
|
724
|
-
|
|
725
|
-
const response = await createTransfer(`bridge_${executable.id}_${sender.address}`)
|
|
726
|
-
expect(response.status).toBe(200)
|
|
727
|
-
const transfer = await TestApp.json(response, Funding.schema.createFundingTransfer.Response)
|
|
728
|
-
expect(transfer.action.type).toBe('evm:calls')
|
|
729
|
-
if (transfer.action.type !== 'evm:calls') return
|
|
730
|
-
expect(transfer.action.calls.length).toBeGreaterThan(0)
|
|
731
|
-
if (executable.id === 'stargate')
|
|
732
|
-
expect(transfer.fees).toMatchObject([
|
|
733
|
-
{
|
|
734
|
-
amount: { baseUnits: BigInt(transfer.action.calls.at(-1)!.value).toString() },
|
|
735
|
-
side: 'source',
|
|
736
|
-
token: { standard: 'native', symbol: 'ETH' },
|
|
737
|
-
},
|
|
738
|
-
])
|
|
739
|
-
|
|
740
|
-
const receipts = []
|
|
741
|
-
for (const call of transfer.action.calls) {
|
|
742
|
-
receipts.push(
|
|
743
|
-
await client.sendTransactionSync({
|
|
744
|
-
account: sender,
|
|
745
|
-
data: call.data as `0x${string}`,
|
|
746
|
-
to: call.to as `0x${string}`,
|
|
747
|
-
value: BigInt(call.value),
|
|
748
|
-
}),
|
|
749
|
-
)
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
expect(receipts.map((receipt) => receipt.status)).toEqual(
|
|
753
|
-
transfer.action.calls.map(() => 'success'),
|
|
754
|
-
)
|
|
755
|
-
// The deposit is the last call and must emit; an approval alone proves nothing.
|
|
756
|
-
expect(receipts.at(-1)!.logs.length).toBeGreaterThan(0)
|
|
757
|
-
})
|
|
758
|
-
|
|
759
|
-
test('bounds the approval to the quoted source spend', async () => {
|
|
760
|
-
const response = await createTransfer(`bridge_bounds_${executable.id}_${sender.address}`)
|
|
761
|
-
expect(response.status).toBe(200)
|
|
762
|
-
const transfer = await TestApp.json(response, Funding.schema.createFundingTransfer.Response)
|
|
763
|
-
if (transfer.action.type !== 'evm:calls') return
|
|
764
|
-
|
|
765
|
-
const approval = transfer.action.calls.find((call) =>
|
|
766
|
-
call.data.toLowerCase().startsWith('0x095ea7b3'),
|
|
767
|
-
)
|
|
768
|
-
expect(approval).toBeDefined()
|
|
769
|
-
if (!approval) return
|
|
770
|
-
|
|
771
|
-
// Decoded from the live action, so a provider that starts returning
|
|
772
|
-
// an unlimited allowance fails here.
|
|
773
|
-
const decoded = decodeFunctionData({ abi: erc20Abi, data: approval.data as `0x${string}` })
|
|
774
|
-
expect(decoded.functionName).toBe('approve')
|
|
775
|
-
if (decoded.functionName !== 'approve') return
|
|
776
|
-
const [, approved] = decoded.args
|
|
777
|
-
expect(approved).toBeLessThanOrEqual(BigInt(transfer.sourceAmount.baseUnits))
|
|
778
|
-
expect(approved).toBeLessThan(maxUint256)
|
|
779
|
-
})
|
|
780
|
-
})
|
|
781
|
-
}
|
|
782
|
-
})
|
|
783
|
-
|
|
784
|
-
describe('POST /funding/transfers/{destination}', () => {
|
|
785
|
-
test.each([
|
|
786
|
-
{ body: vaultTransferBody, destination: 'vault' },
|
|
787
|
-
{ body: zoneTransferBody, destination: 'zone' },
|
|
788
|
-
] as const)('validates and returns 501 for $destination transfers', async (options) => {
|
|
789
|
-
const app = transfersApp()
|
|
790
|
-
const before = await db.kysely
|
|
791
|
-
.selectFrom('funding_transfers')
|
|
792
|
-
.select(({ fn }) => fn.countAll<number>().as('count'))
|
|
793
|
-
.executeTakeFirstOrThrow()
|
|
794
|
-
const response = await app.request(`/v1/funding/transfers/${options.destination}`, {
|
|
795
|
-
body: JSON.stringify(options.body),
|
|
796
|
-
headers: {
|
|
797
|
-
authorization: `Bearer ${fundingWriter.token}`,
|
|
798
|
-
'content-type': 'application/json',
|
|
799
|
-
'idempotency-key': `funding_${options.destination}_unimplemented`,
|
|
800
|
-
},
|
|
801
|
-
method: 'POST',
|
|
802
|
-
})
|
|
803
|
-
|
|
804
|
-
expect(response.status).toBe(501)
|
|
805
|
-
expect(response.headers.get('cache-control')).toBe('no-store')
|
|
806
|
-
expect(((await response.json()) as { error: { code: string } }).error.code).toBe(
|
|
807
|
-
'not_implemented',
|
|
808
|
-
)
|
|
809
|
-
const after = await db.kysely
|
|
810
|
-
.selectFrom('funding_transfers')
|
|
811
|
-
.select(({ fn }) => fn.countAll<number>().as('count'))
|
|
812
|
-
.executeTakeFirstOrThrow()
|
|
813
|
-
expect(after.count).toBe(before.count)
|
|
814
|
-
})
|
|
815
|
-
|
|
816
|
-
test('requires the header and validates destination fields', async () => {
|
|
817
|
-
const app = transfersApp()
|
|
818
|
-
const missingHeader = await app.request('/v1/funding/transfers/vault', {
|
|
819
|
-
body: JSON.stringify(vaultTransferBody),
|
|
820
|
-
headers: {
|
|
821
|
-
authorization: `Bearer ${fundingWriter.token}`,
|
|
822
|
-
'content-type': 'application/json',
|
|
823
|
-
},
|
|
824
|
-
method: 'POST',
|
|
825
|
-
})
|
|
826
|
-
expect(missingHeader.status).toBe(400)
|
|
827
|
-
expect(((await missingHeader.json()) as { error: { code: string } }).error.code).toBe(
|
|
828
|
-
'idempotency_key_required',
|
|
829
|
-
)
|
|
830
|
-
|
|
831
|
-
const invalidZone = await app.request('/v1/funding/transfers/zone', {
|
|
832
|
-
body: JSON.stringify({ ...zoneTransferBody, destinationChain: '421700001' }),
|
|
833
|
-
headers: {
|
|
834
|
-
authorization: `Bearer ${fundingWriter.token}`,
|
|
835
|
-
'content-type': 'application/json',
|
|
836
|
-
'idempotency-key': 'funding_zone_invalid',
|
|
837
|
-
},
|
|
838
|
-
method: 'POST',
|
|
839
|
-
})
|
|
840
|
-
expect(invalidZone.status).toBe(400)
|
|
841
|
-
expect(((await invalidZone.json()) as { error: { code: string } }).error.code).toBe(
|
|
842
|
-
'body_invalid',
|
|
843
|
-
)
|
|
844
|
-
})
|
|
845
|
-
})
|
|
846
|
-
|
|
847
|
-
describe('funding transfers OpenAPI', () => {
|
|
848
|
-
test('publishes generator-ready transfer contracts', async () => {
|
|
849
|
-
const spec = await (await create({ auth: false }).request('/openapi.json')).json()
|
|
850
|
-
const detailPath = Object.keys(spec.paths).find((path) =>
|
|
851
|
-
path.includes('/v1/funding/transfers/{'),
|
|
852
|
-
)!
|
|
853
|
-
const operations = {
|
|
854
|
-
create: spec.paths['/v1/funding/transfers'].post,
|
|
855
|
-
createVault: spec.paths['/v1/funding/transfers/vault'].post,
|
|
856
|
-
createZone: spec.paths['/v1/funding/transfers/zone'].post,
|
|
857
|
-
get: spec.paths[detailPath].get,
|
|
858
|
-
list: spec.paths['/v1/funding/transfers'].get,
|
|
859
|
-
}
|
|
860
|
-
const summarize = (operation: (typeof operations)[keyof typeof operations]) => ({
|
|
861
|
-
errors: Object.fromEntries(
|
|
862
|
-
(Object.entries(operation.responses) as [string, ContractResponse][])
|
|
863
|
-
.filter(([status]) => Number(status) >= 400)
|
|
864
|
-
.map(([status, response]) => [
|
|
865
|
-
status,
|
|
866
|
-
response.$ref ?? response.content?.['application/json']?.schema,
|
|
867
|
-
]),
|
|
868
|
-
),
|
|
869
|
-
operationId: operation.operationId,
|
|
870
|
-
request: operation.requestBody?.content['application/json'].schema,
|
|
871
|
-
response: operation.responses[200]?.content?.['application/json']?.schema,
|
|
872
|
-
})
|
|
873
|
-
|
|
874
|
-
expect({
|
|
875
|
-
components: [
|
|
876
|
-
'CreateFundingTransferRequest',
|
|
877
|
-
'CreateFundingTransferVaultRequest',
|
|
878
|
-
'CreateFundingTransferZoneRequest',
|
|
879
|
-
'CreatedFundingTransfer',
|
|
880
|
-
'FundingAction',
|
|
881
|
-
'FundingActionCall',
|
|
882
|
-
'FundingEvmCallsAction',
|
|
883
|
-
'FundingTransfer',
|
|
884
|
-
'FundingTransferFee',
|
|
885
|
-
'FundingTransferList',
|
|
886
|
-
'FundingTransferQuote',
|
|
887
|
-
'FundingTransferStatusReason',
|
|
888
|
-
].filter((name) => spec.components.schemas[name]),
|
|
889
|
-
formats: {
|
|
890
|
-
createdAt: spec.components.schemas.FundingTransfer.properties.createdAt.format,
|
|
891
|
-
quoteExpiresAt: spec.components.schemas.FundingTransferQuote.properties.expiresAt.format,
|
|
892
|
-
quoteSampledAt: spec.components.schemas.FundingTransferQuote.properties.sampledAt.format,
|
|
893
|
-
updatedAt: spec.components.schemas.FundingTransfer.properties.updatedAt.format,
|
|
894
|
-
},
|
|
895
|
-
models: {
|
|
896
|
-
action: spec.components.schemas.FundingAction.oneOf,
|
|
897
|
-
createdAction: spec.components.schemas.CreatedFundingTransfer.properties.action,
|
|
898
|
-
evmCall: spec.components.schemas.FundingEvmCallsAction.properties.calls.items,
|
|
899
|
-
feeToken: spec.components.schemas.FundingTransferFee.properties.token,
|
|
900
|
-
list: spec.components.schemas.FundingTransferList.properties.data.items,
|
|
901
|
-
quote: spec.components.schemas.FundingTransfer.properties.quote,
|
|
902
|
-
statusReason: spec.components.schemas.FundingTransfer.properties.statusReason,
|
|
903
|
-
},
|
|
904
|
-
operations: {
|
|
905
|
-
create: summarize(operations.create),
|
|
906
|
-
createVault: summarize(operations.createVault),
|
|
907
|
-
createZone: summarize(operations.createZone),
|
|
908
|
-
get: summarize(operations.get),
|
|
909
|
-
list: summarize(operations.list),
|
|
910
|
-
},
|
|
911
|
-
operationErrorCodes: {
|
|
912
|
-
createInvalid:
|
|
913
|
-
spec.components.schemas.ApiKeyMalformedOrBodyInvalidOrIdempotencyKeyRequiredError
|
|
914
|
-
.properties.error.properties.code.enum,
|
|
915
|
-
idempotencyConflict:
|
|
916
|
-
spec.components.schemas.IdempotencyConflictOrIdempotencyInProgressError.properties.error
|
|
917
|
-
.properties.code.enum,
|
|
918
|
-
notImplemented:
|
|
919
|
-
spec.components.schemas.NotImplemented501Error.properties.error.properties.code.enum,
|
|
920
|
-
parametersInvalid:
|
|
921
|
-
spec.components.schemas.ApiKeyMalformedOrParamInvalidError.properties.error.properties
|
|
922
|
-
.code.enum,
|
|
923
|
-
queryInvalid:
|
|
924
|
-
spec.components.schemas.ApiKeyMalformedOrQueryInvalidError.properties.error.properties
|
|
925
|
-
.code.enum,
|
|
926
|
-
quoteNotAvailable:
|
|
927
|
-
spec.components.schemas.QuoteNotAvailableError.properties.error.properties.code.enum,
|
|
928
|
-
transferNotFound:
|
|
929
|
-
spec.components.schemas.FundingTransferNotFoundError.properties.error.properties.code
|
|
930
|
-
.enum,
|
|
931
|
-
},
|
|
932
|
-
}).toMatchInlineSnapshot(`
|
|
933
|
-
{
|
|
934
|
-
"components": [
|
|
935
|
-
"CreateFundingTransferRequest",
|
|
936
|
-
"CreateFundingTransferVaultRequest",
|
|
937
|
-
"CreateFundingTransferZoneRequest",
|
|
938
|
-
"CreatedFundingTransfer",
|
|
939
|
-
"FundingAction",
|
|
940
|
-
"FundingActionCall",
|
|
941
|
-
"FundingEvmCallsAction",
|
|
942
|
-
"FundingTransfer",
|
|
943
|
-
"FundingTransferFee",
|
|
944
|
-
"FundingTransferList",
|
|
945
|
-
"FundingTransferQuote",
|
|
946
|
-
"FundingTransferStatusReason",
|
|
947
|
-
],
|
|
948
|
-
"formats": {
|
|
949
|
-
"createdAt": "date-time",
|
|
950
|
-
"quoteExpiresAt": "date-time",
|
|
951
|
-
"quoteSampledAt": "date-time",
|
|
952
|
-
"updatedAt": "date-time",
|
|
953
|
-
},
|
|
954
|
-
"models": {
|
|
955
|
-
"action": [
|
|
956
|
-
{
|
|
957
|
-
"$ref": "#/components/schemas/FundingEvmCallsAction",
|
|
958
|
-
},
|
|
959
|
-
],
|
|
960
|
-
"createdAction": {
|
|
961
|
-
"$ref": "#/components/schemas/FundingAction",
|
|
962
|
-
},
|
|
963
|
-
"evmCall": {
|
|
964
|
-
"$ref": "#/components/schemas/FundingActionCall",
|
|
965
|
-
},
|
|
966
|
-
"feeToken": {
|
|
967
|
-
"$ref": "#/components/schemas/FundingToken",
|
|
968
|
-
},
|
|
969
|
-
"list": {
|
|
970
|
-
"$ref": "#/components/schemas/FundingTransfer",
|
|
971
|
-
},
|
|
972
|
-
"quote": {
|
|
973
|
-
"$ref": "#/components/schemas/FundingTransferQuote",
|
|
974
|
-
},
|
|
975
|
-
"statusReason": {
|
|
976
|
-
"$ref": "#/components/schemas/FundingTransferStatusReason",
|
|
977
|
-
},
|
|
978
|
-
},
|
|
979
|
-
"operationErrorCodes": {
|
|
980
|
-
"createInvalid": [
|
|
981
|
-
"api_key_malformed",
|
|
982
|
-
"body_invalid",
|
|
983
|
-
"idempotency_key_required",
|
|
984
|
-
],
|
|
985
|
-
"idempotencyConflict": [
|
|
986
|
-
"idempotency_conflict",
|
|
987
|
-
"idempotency_in_progress",
|
|
988
|
-
],
|
|
989
|
-
"notImplemented": [
|
|
990
|
-
"not_implemented",
|
|
991
|
-
],
|
|
992
|
-
"parametersInvalid": [
|
|
993
|
-
"api_key_malformed",
|
|
994
|
-
"param_invalid",
|
|
995
|
-
],
|
|
996
|
-
"queryInvalid": [
|
|
997
|
-
"api_key_malformed",
|
|
998
|
-
"query_invalid",
|
|
999
|
-
],
|
|
1000
|
-
"quoteNotAvailable": [
|
|
1001
|
-
"quote_not_available",
|
|
1002
|
-
],
|
|
1003
|
-
"transferNotFound": [
|
|
1004
|
-
"funding_transfer_not_found",
|
|
1005
|
-
],
|
|
1006
|
-
},
|
|
1007
|
-
"operations": {
|
|
1008
|
-
"create": {
|
|
1009
|
-
"errors": {
|
|
1010
|
-
"400": {
|
|
1011
|
-
"$ref": "#/components/schemas/ApiKeyMalformedOrBodyInvalidOrIdempotencyKeyRequiredError",
|
|
1012
|
-
},
|
|
1013
|
-
"401": {
|
|
1014
|
-
"$ref": "#/components/schemas/AuthenticationError",
|
|
1015
|
-
},
|
|
1016
|
-
"403": {
|
|
1017
|
-
"$ref": "#/components/schemas/ForbiddenError",
|
|
1018
|
-
},
|
|
1019
|
-
"404": {
|
|
1020
|
-
"$ref": "#/components/schemas/QuoteNotAvailableError",
|
|
1021
|
-
},
|
|
1022
|
-
"409": {
|
|
1023
|
-
"$ref": "#/components/schemas/IdempotencyConflictOrIdempotencyInProgressError",
|
|
1024
|
-
},
|
|
1025
|
-
"429": "#/components/responses/RateLimited",
|
|
1026
|
-
"500": "#/components/responses/InternalError",
|
|
1027
|
-
"502": {
|
|
1028
|
-
"$ref": "#/components/schemas/UpstreamError",
|
|
1029
|
-
},
|
|
1030
|
-
"504": "#/components/responses/RequestTimeout",
|
|
1031
|
-
},
|
|
1032
|
-
"operationId": "createFundingTransfer",
|
|
1033
|
-
"request": {
|
|
1034
|
-
"$ref": "#/components/schemas/CreateFundingTransferRequest",
|
|
1035
|
-
},
|
|
1036
|
-
"response": {
|
|
1037
|
-
"$ref": "#/components/schemas/CreatedFundingTransfer",
|
|
1038
|
-
},
|
|
1039
|
-
},
|
|
1040
|
-
"createVault": {
|
|
1041
|
-
"errors": {
|
|
1042
|
-
"400": {
|
|
1043
|
-
"$ref": "#/components/schemas/ApiKeyMalformedOrBodyInvalidOrIdempotencyKeyRequiredError",
|
|
1044
|
-
},
|
|
1045
|
-
"401": {
|
|
1046
|
-
"$ref": "#/components/schemas/AuthenticationError",
|
|
1047
|
-
},
|
|
1048
|
-
"403": {
|
|
1049
|
-
"$ref": "#/components/schemas/ForbiddenError",
|
|
1050
|
-
},
|
|
1051
|
-
"429": "#/components/responses/RateLimited",
|
|
1052
|
-
"500": "#/components/responses/InternalError",
|
|
1053
|
-
"501": {
|
|
1054
|
-
"$ref": "#/components/schemas/NotImplemented501Error",
|
|
1055
|
-
},
|
|
1056
|
-
"504": "#/components/responses/RequestTimeout",
|
|
1057
|
-
},
|
|
1058
|
-
"operationId": "createFundingTransferVault",
|
|
1059
|
-
"request": {
|
|
1060
|
-
"$ref": "#/components/schemas/CreateFundingTransferVaultRequest",
|
|
1061
|
-
},
|
|
1062
|
-
"response": undefined,
|
|
1063
|
-
},
|
|
1064
|
-
"createZone": {
|
|
1065
|
-
"errors": {
|
|
1066
|
-
"400": {
|
|
1067
|
-
"$ref": "#/components/schemas/ApiKeyMalformedOrBodyInvalidOrIdempotencyKeyRequiredError",
|
|
1068
|
-
},
|
|
1069
|
-
"401": {
|
|
1070
|
-
"$ref": "#/components/schemas/AuthenticationError",
|
|
1071
|
-
},
|
|
1072
|
-
"403": {
|
|
1073
|
-
"$ref": "#/components/schemas/ForbiddenError",
|
|
1074
|
-
},
|
|
1075
|
-
"429": "#/components/responses/RateLimited",
|
|
1076
|
-
"500": "#/components/responses/InternalError",
|
|
1077
|
-
"501": {
|
|
1078
|
-
"$ref": "#/components/schemas/NotImplemented501Error",
|
|
1079
|
-
},
|
|
1080
|
-
"504": "#/components/responses/RequestTimeout",
|
|
1081
|
-
},
|
|
1082
|
-
"operationId": "createFundingTransferZone",
|
|
1083
|
-
"request": {
|
|
1084
|
-
"$ref": "#/components/schemas/CreateFundingTransferZoneRequest",
|
|
1085
|
-
},
|
|
1086
|
-
"response": undefined,
|
|
1087
|
-
},
|
|
1088
|
-
"get": {
|
|
1089
|
-
"errors": {
|
|
1090
|
-
"400": {
|
|
1091
|
-
"$ref": "#/components/schemas/ApiKeyMalformedOrParamInvalidError",
|
|
1092
|
-
},
|
|
1093
|
-
"401": {
|
|
1094
|
-
"$ref": "#/components/schemas/AuthenticationError",
|
|
1095
|
-
},
|
|
1096
|
-
"403": {
|
|
1097
|
-
"$ref": "#/components/schemas/ForbiddenError",
|
|
1098
|
-
},
|
|
1099
|
-
"404": {
|
|
1100
|
-
"$ref": "#/components/schemas/FundingTransferNotFoundError",
|
|
1101
|
-
},
|
|
1102
|
-
"429": "#/components/responses/RateLimited",
|
|
1103
|
-
"500": "#/components/responses/InternalError",
|
|
1104
|
-
"502": {
|
|
1105
|
-
"$ref": "#/components/schemas/UpstreamError",
|
|
1106
|
-
},
|
|
1107
|
-
"504": "#/components/responses/RequestTimeout",
|
|
1108
|
-
},
|
|
1109
|
-
"operationId": "getFundingTransfer",
|
|
1110
|
-
"request": undefined,
|
|
1111
|
-
"response": {
|
|
1112
|
-
"$ref": "#/components/schemas/FundingTransfer",
|
|
1113
|
-
},
|
|
1114
|
-
},
|
|
1115
|
-
"list": {
|
|
1116
|
-
"errors": {
|
|
1117
|
-
"400": {
|
|
1118
|
-
"$ref": "#/components/schemas/ApiKeyMalformedOrQueryInvalidError",
|
|
1119
|
-
},
|
|
1120
|
-
"401": {
|
|
1121
|
-
"$ref": "#/components/schemas/AuthenticationError",
|
|
1122
|
-
},
|
|
1123
|
-
"403": {
|
|
1124
|
-
"$ref": "#/components/schemas/ForbiddenError",
|
|
1125
|
-
},
|
|
1126
|
-
"429": "#/components/responses/RateLimited",
|
|
1127
|
-
"500": "#/components/responses/InternalError",
|
|
1128
|
-
"502": {
|
|
1129
|
-
"$ref": "#/components/schemas/UpstreamError",
|
|
1130
|
-
},
|
|
1131
|
-
"504": "#/components/responses/RequestTimeout",
|
|
1132
|
-
},
|
|
1133
|
-
"operationId": "listFundingTransfers",
|
|
1134
|
-
"request": undefined,
|
|
1135
|
-
"response": {
|
|
1136
|
-
"$ref": "#/components/schemas/FundingTransferList",
|
|
1137
|
-
},
|
|
1138
|
-
},
|
|
1139
|
-
},
|
|
1140
|
-
}
|
|
1141
|
-
`)
|
|
1142
|
-
})
|
|
1143
|
-
|
|
1144
|
-
test('publishes an executable account transfer example', async () => {
|
|
1145
|
-
const app = create({ auth: false })
|
|
1146
|
-
type TransferExample = { destinationToken: { address: string } }
|
|
1147
|
-
type Operation = {
|
|
1148
|
-
requestBody: {
|
|
1149
|
-
content: Record<string, { schema: JsonSchema }>
|
|
1150
|
-
}
|
|
1151
|
-
responses: Record<string, { content: Record<string, { example: TransferExample }> }>
|
|
1152
|
-
}
|
|
1153
|
-
type Spec = ComponentSpec & { paths: Record<string, { post: Operation }> }
|
|
1154
|
-
const spec = (await (await app.request('/openapi.json')).json()) as Spec
|
|
1155
|
-
const operation = spec.paths['/v1/funding/transfers']!.post
|
|
1156
|
-
const request = dereference(spec, operation.requestBody.content['application/json']!.schema)
|
|
1157
|
-
|
|
1158
|
-
expect({
|
|
1159
|
-
request: request.properties!['destinationToken']!.examples,
|
|
1160
|
-
response:
|
|
1161
|
-
operation.responses['200']!.content['application/json']!.example.destinationToken.address,
|
|
1162
|
-
}).toEqual({
|
|
1163
|
-
request: ['pathusd'],
|
|
1164
|
-
response: '0x20c0000000000000000000000000000000000000',
|
|
1165
|
-
})
|
|
1166
|
-
})
|
|
1167
|
-
|
|
1168
|
-
test('publishes human-readable deposit address route examples', async () => {
|
|
1169
|
-
const app = create({ auth: false })
|
|
1170
|
-
type Operation = {
|
|
1171
|
-
requestBody: {
|
|
1172
|
-
content: Record<string, { schema: JsonSchema }>
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
type Spec = ComponentSpec & { paths: Record<string, { post: Operation }> }
|
|
1176
|
-
const spec = (await (await app.request('/openapi.json')).json()) as Spec
|
|
1177
|
-
const properties = dereference(
|
|
1178
|
-
spec,
|
|
1179
|
-
spec.paths['/v1/funding/deposit-addresses']!.post.requestBody.content['application/json']!
|
|
1180
|
-
.schema,
|
|
1181
|
-
).properties!
|
|
1182
|
-
|
|
1183
|
-
expect({
|
|
1184
|
-
destinationToken: properties['destinationToken']!.examples,
|
|
1185
|
-
sourceChain: properties['sourceChain']!.examples,
|
|
1186
|
-
sourceToken: properties['sourceToken']!.examples,
|
|
1187
|
-
}).toMatchInlineSnapshot(`
|
|
1188
|
-
{
|
|
1189
|
-
"destinationToken": [
|
|
1190
|
-
"usdt0",
|
|
1191
|
-
],
|
|
1192
|
-
"sourceChain": [
|
|
1193
|
-
"tron",
|
|
1194
|
-
"tron:0x2b6653dc",
|
|
1195
|
-
],
|
|
1196
|
-
"sourceToken": [
|
|
1197
|
-
"usdt",
|
|
1198
|
-
],
|
|
1199
|
-
}
|
|
1200
|
-
`)
|
|
1201
|
-
})
|
|
1202
|
-
|
|
1203
|
-
test('publishes concise operation documentation', async () => {
|
|
1204
|
-
const app = create({ auth: false })
|
|
1205
|
-
type Operation = { description: string; summary: string; tags: string[] }
|
|
1206
|
-
type Spec = {
|
|
1207
|
-
paths: Record<string, { get?: Operation; post?: Operation }>
|
|
1208
|
-
tags: { description?: string; name: string }[]
|
|
1209
|
-
'x-tagGroups': { name: string; tags: string[] }[]
|
|
1210
|
-
}
|
|
1211
|
-
const spec = (await (await app.request('/openapi.json')).json()) as Spec
|
|
1212
|
-
const detailPath = Object.keys(spec.paths).find((path) =>
|
|
1213
|
-
path.includes('/v1/funding/transfers/{'),
|
|
1214
|
-
)!
|
|
1215
|
-
const depositAddressPath = Object.keys(spec.paths).find(
|
|
1216
|
-
(path) =>
|
|
1217
|
-
path.includes('/v1/funding/deposit-addresses/{') &&
|
|
1218
|
-
!path.endsWith('/deposits') &&
|
|
1219
|
-
!path.endsWith('/reconcile'),
|
|
1220
|
-
)!
|
|
1221
|
-
const depositPath = Object.keys(spec.paths).find((path) =>
|
|
1222
|
-
path.includes('/v1/funding/deposits/{'),
|
|
1223
|
-
)!
|
|
1224
|
-
const reconcilePath = Object.keys(spec.paths).find((path) => path.endsWith('/reconcile'))!
|
|
1225
|
-
const summarize = (operation: Operation) => ({
|
|
1226
|
-
description: operation.description,
|
|
1227
|
-
summary: operation.summary,
|
|
1228
|
-
})
|
|
1229
|
-
const operations = {
|
|
1230
|
-
account: summarize(spec.paths['/v1/funding/transfers']!.post!),
|
|
1231
|
-
chains: summarize(spec.paths['/v1/funding/chains']!.get!),
|
|
1232
|
-
deposit: summarize(spec.paths[depositPath]!.get!),
|
|
1233
|
-
depositAddress: summarize(spec.paths[depositAddressPath]!.get!),
|
|
1234
|
-
depositAddressCreate: summarize(spec.paths['/v1/funding/deposit-addresses']!.post!),
|
|
1235
|
-
depositAddressList: summarize(spec.paths['/v1/funding/deposit-addresses']!.get!),
|
|
1236
|
-
depositAddressReconcile: summarize(spec.paths[reconcilePath]!.post!),
|
|
1237
|
-
deposits: summarize(spec.paths['/v1/funding/deposits']!.get!),
|
|
1238
|
-
detail: summarize(spec.paths[detailPath]!.get!),
|
|
1239
|
-
list: summarize(spec.paths['/v1/funding/transfers']!.get!),
|
|
1240
|
-
providers: summarize(spec.paths['/v1/funding/providers']!.get!),
|
|
1241
|
-
quotes: summarize(spec.paths['/v1/funding/quotes']!.get!),
|
|
1242
|
-
vault: summarize(spec.paths['/v1/funding/transfers/vault']!.post!),
|
|
1243
|
-
zone: summarize(spec.paths['/v1/funding/transfers/zone']!.post!),
|
|
1244
|
-
}
|
|
1245
|
-
const category = spec['x-tagGroups'].find((group) => group.name === 'Funding & Bridge API')
|
|
1246
|
-
const categoryTags = new Set(category?.tags)
|
|
1247
|
-
const sidebar = Object.values(spec.paths).flatMap((path) =>
|
|
1248
|
-
[path.get, path.post].flatMap((operation) =>
|
|
1249
|
-
operation?.tags.some((tag) => categoryTags.has(tag)) ? [operation.summary] : [],
|
|
1250
|
-
),
|
|
1251
|
-
)
|
|
1252
|
-
|
|
1253
|
-
for (const operation of Object.values(operations))
|
|
1254
|
-
expect(operation.description.split(/\s+/).length).toBeLessThan(15)
|
|
1255
|
-
|
|
1256
|
-
expect({
|
|
1257
|
-
category: category?.name,
|
|
1258
|
-
operations,
|
|
1259
|
-
sidebar,
|
|
1260
|
-
}).toMatchInlineSnapshot(`
|
|
1261
|
-
{
|
|
1262
|
-
"category": "Funding & Bridge API",
|
|
1263
|
-
"operations": {
|
|
1264
|
-
"account": {
|
|
1265
|
-
"description": "Creates a transfer to a Tempo account.",
|
|
1266
|
-
"summary": "Create transfer",
|
|
1267
|
-
},
|
|
1268
|
-
"chains": {
|
|
1269
|
-
"description": "Lists supported source chains and tokens.",
|
|
1270
|
-
"summary": "Get chains",
|
|
1271
|
-
},
|
|
1272
|
-
"deposit": {
|
|
1273
|
-
"description": "Returns one detected deposit and its delivery status.",
|
|
1274
|
-
"summary": "Get deposit",
|
|
1275
|
-
},
|
|
1276
|
-
"depositAddress": {
|
|
1277
|
-
"description": "Returns one reusable funding deposit address.",
|
|
1278
|
-
"summary": "Get deposit address",
|
|
1279
|
-
},
|
|
1280
|
-
"depositAddressCreate": {
|
|
1281
|
-
"description": "Creates or returns a reusable deposit address for funding a Tempo account.",
|
|
1282
|
-
"summary": "Create deposit address",
|
|
1283
|
-
},
|
|
1284
|
-
"depositAddressList": {
|
|
1285
|
-
"description": "Lists reusable funding deposit addresses, newest first.",
|
|
1286
|
-
"summary": "List deposit addresses",
|
|
1287
|
-
},
|
|
1288
|
-
"depositAddressReconcile": {
|
|
1289
|
-
"description": "Queues an immediate provider reconciliation for one reusable funding deposit address.",
|
|
1290
|
-
"summary": "Reconcile deposit address",
|
|
1291
|
-
},
|
|
1292
|
-
"deposits": {
|
|
1293
|
-
"description": "Lists visible deposits, optionally filtered, newest first.",
|
|
1294
|
-
"summary": "List deposits",
|
|
1295
|
-
},
|
|
1296
|
-
"detail": {
|
|
1297
|
-
"description": "Returns a transfer by ID.",
|
|
1298
|
-
"summary": "Get transfer",
|
|
1299
|
-
},
|
|
1300
|
-
"list": {
|
|
1301
|
-
"description": "Lists transfers from newest to oldest.",
|
|
1302
|
-
"summary": "List transfers",
|
|
1303
|
-
},
|
|
1304
|
-
"providers": {
|
|
1305
|
-
"description": "Lists available transfer providers.",
|
|
1306
|
-
"summary": "Get providers",
|
|
1307
|
-
},
|
|
1308
|
-
"quotes": {
|
|
1309
|
-
"description": "Returns live quotes for transferring stablecoins to Tempo.",
|
|
1310
|
-
"summary": "Get quotes",
|
|
1311
|
-
},
|
|
1312
|
-
"vault": {
|
|
1313
|
-
"description": "Creates a transfer into a Tempo Earn vault.",
|
|
1314
|
-
"summary": "Create transfer into vault",
|
|
1315
|
-
},
|
|
1316
|
-
"zone": {
|
|
1317
|
-
"description": "Creates a transfer into a Tempo Zone.",
|
|
1318
|
-
"summary": "Create transfer into zone",
|
|
1319
|
-
},
|
|
1320
|
-
},
|
|
1321
|
-
"sidebar": [
|
|
1322
|
-
"Get quotes",
|
|
1323
|
-
"Get chains",
|
|
1324
|
-
"Get providers",
|
|
1325
|
-
"List deposit addresses",
|
|
1326
|
-
"Create deposit address",
|
|
1327
|
-
"List transfers",
|
|
1328
|
-
"Create transfer",
|
|
1329
|
-
"Create transfer into vault",
|
|
1330
|
-
"Create transfer into zone",
|
|
1331
|
-
"Reconcile deposit address",
|
|
1332
|
-
"Get deposit address",
|
|
1333
|
-
"Get transfer",
|
|
1334
|
-
"Get deposit",
|
|
1335
|
-
"List deposits",
|
|
1336
|
-
],
|
|
1337
|
-
}
|
|
1338
|
-
`)
|
|
1339
|
-
})
|
|
1340
|
-
|
|
1341
|
-
test('publishes concrete creation schemas', async () => {
|
|
1342
|
-
const app = create({ auth: false })
|
|
1343
|
-
type Spec = ComponentSpec & {
|
|
1344
|
-
paths: Record<
|
|
1345
|
-
string,
|
|
1346
|
-
{
|
|
1347
|
-
post?: {
|
|
1348
|
-
requestBody: {
|
|
1349
|
-
content: Record<string, { schema: JsonSchema }>
|
|
1350
|
-
}
|
|
1351
|
-
responses: Record<string, unknown>
|
|
1352
|
-
}
|
|
1353
|
-
}
|
|
1354
|
-
>
|
|
1355
|
-
}
|
|
1356
|
-
const spec = (await (await app.request('/openapi.json')).json()) as Spec
|
|
1357
|
-
const creationSchema = (path: string) =>
|
|
1358
|
-
dereference(spec, spec.paths[path]!.post!.requestBody.content['application/json']!.schema)
|
|
1359
|
-
expect(
|
|
1360
|
-
creationSchema('/v1/funding/deposit-addresses').required?.includes('subsidize') ?? false,
|
|
1361
|
-
).toMatchInlineSnapshot(`false`)
|
|
1362
|
-
const summarize = (path: string) => {
|
|
1363
|
-
const schema = creationSchema(path)
|
|
1364
|
-
return {
|
|
1365
|
-
additionalProperties: schema.additionalProperties,
|
|
1366
|
-
properties: Object.keys(schema.properties!),
|
|
1367
|
-
}
|
|
1368
|
-
}
|
|
1369
|
-
|
|
1370
|
-
expect({
|
|
1371
|
-
account: summarize('/v1/funding/transfers'),
|
|
1372
|
-
depositAddress: summarize('/v1/funding/deposit-addresses'),
|
|
1373
|
-
depositAddressResponses: Object.keys(
|
|
1374
|
-
spec.paths['/v1/funding/deposit-addresses']!.post!.responses,
|
|
1375
|
-
),
|
|
1376
|
-
vault: summarize('/v1/funding/transfers/vault'),
|
|
1377
|
-
vaultResponses: Object.keys(spec.paths['/v1/funding/transfers/vault']!.post!.responses),
|
|
1378
|
-
zone: summarize('/v1/funding/transfers/zone'),
|
|
1379
|
-
zoneResponses: Object.keys(spec.paths['/v1/funding/transfers/zone']!.post!.responses),
|
|
1380
|
-
}).toMatchInlineSnapshot(`
|
|
1381
|
-
{
|
|
1382
|
-
"account": {
|
|
1383
|
-
"additionalProperties": false,
|
|
1384
|
-
"properties": [
|
|
1385
|
-
"amount",
|
|
1386
|
-
"destinationToken",
|
|
1387
|
-
"mode",
|
|
1388
|
-
"provider",
|
|
1389
|
-
"recipient",
|
|
1390
|
-
"sender",
|
|
1391
|
-
"slippageBps",
|
|
1392
|
-
"sourceChain",
|
|
1393
|
-
"sourceToken",
|
|
1394
|
-
],
|
|
1395
|
-
},
|
|
1396
|
-
"depositAddress": {
|
|
1397
|
-
"additionalProperties": false,
|
|
1398
|
-
"properties": [
|
|
1399
|
-
"amount",
|
|
1400
|
-
"destinationToken",
|
|
1401
|
-
"recipient",
|
|
1402
|
-
"refundAddress",
|
|
1403
|
-
"sourceChain",
|
|
1404
|
-
"sourceToken",
|
|
1405
|
-
"subsidize",
|
|
1406
|
-
],
|
|
1407
|
-
},
|
|
1408
|
-
"depositAddressResponses": [
|
|
1409
|
-
"200",
|
|
1410
|
-
"400",
|
|
1411
|
-
"401",
|
|
1412
|
-
"403",
|
|
1413
|
-
"404",
|
|
1414
|
-
"409",
|
|
1415
|
-
"429",
|
|
1416
|
-
"500",
|
|
1417
|
-
"502",
|
|
1418
|
-
"504",
|
|
1419
|
-
],
|
|
1420
|
-
"vault": {
|
|
1421
|
-
"additionalProperties": false,
|
|
1422
|
-
"properties": [
|
|
1423
|
-
"amount",
|
|
1424
|
-
"mode",
|
|
1425
|
-
"recipient",
|
|
1426
|
-
"sender",
|
|
1427
|
-
"slippageBps",
|
|
1428
|
-
"sourceChain",
|
|
1429
|
-
"sourceToken",
|
|
1430
|
-
"vaultAddress",
|
|
1431
|
-
],
|
|
1432
|
-
},
|
|
1433
|
-
"vaultResponses": [
|
|
1434
|
-
"400",
|
|
1435
|
-
"401",
|
|
1436
|
-
"403",
|
|
1437
|
-
"429",
|
|
1438
|
-
"500",
|
|
1439
|
-
"501",
|
|
1440
|
-
"504",
|
|
1441
|
-
],
|
|
1442
|
-
"zone": {
|
|
1443
|
-
"additionalProperties": false,
|
|
1444
|
-
"properties": [
|
|
1445
|
-
"amount",
|
|
1446
|
-
"destinationChain",
|
|
1447
|
-
"destinationToken",
|
|
1448
|
-
"mode",
|
|
1449
|
-
"recipient",
|
|
1450
|
-
"recipientFallback",
|
|
1451
|
-
"sender",
|
|
1452
|
-
"slippageBps",
|
|
1453
|
-
"sourceChain",
|
|
1454
|
-
"sourceToken",
|
|
1455
|
-
],
|
|
1456
|
-
},
|
|
1457
|
-
"zoneResponses": [
|
|
1458
|
-
"400",
|
|
1459
|
-
"401",
|
|
1460
|
-
"403",
|
|
1461
|
-
"429",
|
|
1462
|
-
"500",
|
|
1463
|
-
"501",
|
|
1464
|
-
"504",
|
|
1465
|
-
],
|
|
1466
|
-
}
|
|
1467
|
-
`)
|
|
1468
|
-
})
|
|
1469
|
-
|
|
1470
|
-
test('publishes alphabetically ordered example fields and parameter examples', async () => {
|
|
1471
|
-
const app = create({ auth: false })
|
|
1472
|
-
const spec = (await (await app.request('/openapi.json')).json()) as {
|
|
1473
|
-
paths: Record<
|
|
1474
|
-
string,
|
|
1475
|
-
{
|
|
1476
|
-
get: {
|
|
1477
|
-
parameters?: { example?: unknown; name: string; schema?: { examples?: unknown } }[]
|
|
1478
|
-
responses: Record<string, { content: Record<string, { example: { data: {}[] } }> }>
|
|
1479
|
-
}
|
|
1480
|
-
}
|
|
1481
|
-
>
|
|
1482
|
-
}
|
|
1483
|
-
const operation = spec.paths['/v1/funding/transfers']!.get
|
|
1484
|
-
const fields = Object.keys(operation.responses['200']!.content['application/json']!.example.data[0]!) // prettier-ignore
|
|
1485
|
-
expect(fields).toEqual([...fields].sort())
|
|
1486
|
-
for (const route of [
|
|
1487
|
-
operation,
|
|
1488
|
-
spec.paths['/v1/funding/deposit-addresses']!.get,
|
|
1489
|
-
spec.paths['/v1/funding/deposits']!.get,
|
|
1490
|
-
])
|
|
1491
|
-
for (const parameter of route.parameters ?? [])
|
|
1492
|
-
expect(parameter.example ?? parameter.schema?.examples, parameter.name).toBeDefined()
|
|
1493
|
-
})
|
|
1494
|
-
|
|
1495
|
-
test('publishes operation ids and required scopes', async () => {
|
|
1496
|
-
const app = create({ auth: false })
|
|
1497
|
-
const spec = (await (await app.request('/openapi.json')).json()) as {
|
|
1498
|
-
paths: Record<
|
|
1499
|
-
string,
|
|
1500
|
-
{
|
|
1501
|
-
get: { operationId: string; 'x-required-scopes': string[] }
|
|
1502
|
-
post?: {
|
|
1503
|
-
operationId: string
|
|
1504
|
-
parameters: { in: string; name: string; required: boolean }[]
|
|
1505
|
-
'x-required-scopes': string[]
|
|
1506
|
-
}
|
|
1507
|
-
}
|
|
1508
|
-
>
|
|
1509
|
-
}
|
|
1510
|
-
const detailPath = Object.keys(spec.paths).find((path) =>
|
|
1511
|
-
path.includes('/v1/funding/transfers/{'),
|
|
1512
|
-
)
|
|
1513
|
-
const depositAddressPath = Object.keys(spec.paths).find(
|
|
1514
|
-
(path) =>
|
|
1515
|
-
path.includes('/v1/funding/deposit-addresses/{') &&
|
|
1516
|
-
!path.endsWith('/deposits') &&
|
|
1517
|
-
!path.endsWith('/reconcile'),
|
|
1518
|
-
)
|
|
1519
|
-
const depositPath = Object.keys(spec.paths).find((path) =>
|
|
1520
|
-
path.includes('/v1/funding/deposits/{'),
|
|
1521
|
-
)
|
|
1522
|
-
const reconcilePath = Object.keys(spec.paths).find((path) => path.endsWith('/reconcile'))
|
|
1523
|
-
expect({
|
|
1524
|
-
deposit: depositPath && spec.paths[depositPath]?.get.operationId,
|
|
1525
|
-
depositAddress: depositAddressPath && spec.paths[depositAddressPath]?.get.operationId,
|
|
1526
|
-
depositAddressCreate: spec.paths['/v1/funding/deposit-addresses']?.post?.operationId,
|
|
1527
|
-
depositAddressCreateScopes:
|
|
1528
|
-
spec.paths['/v1/funding/deposit-addresses']?.post?.['x-required-scopes'],
|
|
1529
|
-
depositAddressList: spec.paths['/v1/funding/deposit-addresses']?.get.operationId,
|
|
1530
|
-
depositAddressListScopes:
|
|
1531
|
-
spec.paths['/v1/funding/deposit-addresses']?.get['x-required-scopes'],
|
|
1532
|
-
depositAddressReconcile: reconcilePath && spec.paths[reconcilePath]?.post?.operationId,
|
|
1533
|
-
depositAddressReconcileScopes:
|
|
1534
|
-
reconcilePath && spec.paths[reconcilePath]?.post?.['x-required-scopes'],
|
|
1535
|
-
depositAddressScopes:
|
|
1536
|
-
depositAddressPath && spec.paths[depositAddressPath]?.get['x-required-scopes'],
|
|
1537
|
-
depositScopes: depositPath && spec.paths[depositPath]?.get['x-required-scopes'],
|
|
1538
|
-
deposits: spec.paths['/v1/funding/deposits']?.get.operationId,
|
|
1539
|
-
depositsScopes: spec.paths['/v1/funding/deposits']?.get['x-required-scopes'],
|
|
1540
|
-
detail: detailPath && spec.paths[detailPath]?.get.operationId,
|
|
1541
|
-
detailScopes: detailPath && spec.paths[detailPath]?.get['x-required-scopes'],
|
|
1542
|
-
list: spec.paths['/v1/funding/transfers']?.get.operationId,
|
|
1543
|
-
listScopes: spec.paths['/v1/funding/transfers']?.get['x-required-scopes'],
|
|
1544
|
-
requiredCreateHeader: spec.paths['/v1/funding/transfers']?.post?.parameters.find(
|
|
1545
|
-
(parameter) => parameter.name === 'idempotency-key',
|
|
1546
|
-
),
|
|
1547
|
-
vault: spec.paths['/v1/funding/transfers/vault']?.post?.operationId,
|
|
1548
|
-
vaultScopes: spec.paths['/v1/funding/transfers/vault']?.post?.['x-required-scopes'],
|
|
1549
|
-
zone: spec.paths['/v1/funding/transfers/zone']?.post?.operationId,
|
|
1550
|
-
zoneScopes: spec.paths['/v1/funding/transfers/zone']?.post?.['x-required-scopes'],
|
|
1551
|
-
}).toEqual({
|
|
1552
|
-
deposit: 'getFundingDeposit',
|
|
1553
|
-
depositAddress: 'getFundingDepositAddress',
|
|
1554
|
-
depositAddressCreate: 'createFundingDepositAddress',
|
|
1555
|
-
depositAddressCreateScopes: ['funding:write'],
|
|
1556
|
-
depositAddressList: 'listFundingDepositAddresses',
|
|
1557
|
-
depositAddressListScopes: ['funding:read'],
|
|
1558
|
-
depositAddressReconcile: 'reconcileFundingDepositAddress',
|
|
1559
|
-
depositAddressReconcileScopes: ['funding:write'],
|
|
1560
|
-
depositAddressScopes: ['funding:read'],
|
|
1561
|
-
depositScopes: ['funding:read'],
|
|
1562
|
-
deposits: 'listFundingDeposits',
|
|
1563
|
-
depositsScopes: ['funding:read'],
|
|
1564
|
-
detail: 'getFundingTransfer',
|
|
1565
|
-
detailScopes: ['funding:read'],
|
|
1566
|
-
list: 'listFundingTransfers',
|
|
1567
|
-
listScopes: ['funding:read'],
|
|
1568
|
-
requiredCreateHeader: expect.objectContaining({
|
|
1569
|
-
description: expect.stringContaining('24 hours'),
|
|
1570
|
-
in: 'header',
|
|
1571
|
-
name: 'idempotency-key',
|
|
1572
|
-
required: true,
|
|
1573
|
-
schema: expect.any(Object),
|
|
1574
|
-
}),
|
|
1575
|
-
vault: 'createFundingTransferVault',
|
|
1576
|
-
vaultScopes: ['funding:write'],
|
|
1577
|
-
zone: 'createFundingTransferZone',
|
|
1578
|
-
zoneScopes: ['funding:write'],
|
|
1579
|
-
})
|
|
1580
|
-
})
|
|
1581
|
-
})
|
|
1582
|
-
|
|
1583
|
-
const fundingReader = {
|
|
1584
|
-
id: 'key_funding',
|
|
1585
|
-
orgId: 'org_funding',
|
|
1586
|
-
scopes: ['funding:read'],
|
|
1587
|
-
token: 'secret_funding_reader',
|
|
1588
|
-
} satisfies TestApp.kvStore.Key
|
|
1589
|
-
|
|
1590
|
-
const fundingProjectReader = {
|
|
1591
|
-
id: 'key_funding_project',
|
|
1592
|
-
orgId: 'org_funding',
|
|
1593
|
-
projectId: 'prj_funding',
|
|
1594
|
-
scopes: ['funding:read'],
|
|
1595
|
-
token: 'secret_funding_project',
|
|
1596
|
-
} satisfies TestApp.kvStore.Key
|
|
1597
|
-
|
|
1598
|
-
const fundingForeign = {
|
|
1599
|
-
id: 'key_funding_other',
|
|
1600
|
-
orgId: 'org_funding_other',
|
|
1601
|
-
scopes: ['funding:read'],
|
|
1602
|
-
token: 'secret_funding_other',
|
|
1603
|
-
} satisfies TestApp.kvStore.Key
|
|
1604
|
-
|
|
1605
|
-
const fundingWriter = {
|
|
1606
|
-
id: 'key_funding_writer',
|
|
1607
|
-
orgId: 'org_funding',
|
|
1608
|
-
scopes: ['funding:read', 'funding:write'],
|
|
1609
|
-
token: 'secret_funding_writer',
|
|
1610
|
-
} satisfies TestApp.kvStore.Key
|
|
1611
|
-
|
|
1612
|
-
function transfersApp(options: TestApp.create.Options = {}) {
|
|
1613
|
-
return create({
|
|
1614
|
-
...options,
|
|
1615
|
-
auth: {
|
|
1616
|
-
keys: [TestApp.key, fundingReader, fundingProjectReader, fundingForeign, fundingWriter],
|
|
1617
|
-
},
|
|
1618
|
-
defaultChainId: options.defaultChainId ?? tempoMainnet.id,
|
|
1619
|
-
})
|
|
1620
|
-
}
|
|
1621
|
-
|
|
1622
|
-
function as(key: { token: string }) {
|
|
1623
|
-
return { headers: { authorization: `Bearer ${key.token}` } } as const
|
|
1624
|
-
}
|
|
1625
|
-
|
|
1626
|
-
let seedSecond = 0
|
|
1627
|
-
|
|
1628
|
-
function seedTransfer(input: Partial<FundingTransfer.create.Input> = {}) {
|
|
1629
|
-
// Distinct create times keep ids strictly ordered for paging assertions.
|
|
1630
|
-
return FundingTransfer.create(db, {
|
|
1631
|
-
apiKeyId: fundingReader.id,
|
|
1632
|
-
environment: 'production',
|
|
1633
|
-
id: FundingTransfer.generateId(new Date(Date.UTC(2026, 0, 2, 0, 0, seedSecond++))),
|
|
1634
|
-
orgId: fundingReader.orgId,
|
|
1635
|
-
snapshot: TestFunding.transferSnapshot(),
|
|
1636
|
-
...input,
|
|
1637
|
-
})
|
|
1638
|
-
}
|