tapimo 0.7.1 → 0.7.2
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/dist/ApiKeys.d.ts +24 -7
- package/dist/ApiKeys.d.ts.map +1 -1
- package/dist/ApiKeys.js +17 -5
- package/dist/ApiKeys.js.map +1 -1
- package/dist/App.d.ts +12104 -7861
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +191 -128
- package/dist/App.js.map +1 -1
- package/dist/Assets.d.ts +10 -0
- package/dist/Assets.d.ts.map +1 -1
- package/dist/Assets.js +17 -4
- package/dist/Assets.js.map +1 -1
- package/dist/Scope.d.ts +19 -8
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +25 -9
- package/dist/Scope.js.map +1 -1
- package/dist/Webhooks.d.ts +1 -1
- package/dist/admin/App.d.ts +601 -20
- package/dist/admin/App.d.ts.map +1 -1
- package/dist/admin/App.js +12 -2
- package/dist/admin/App.js.map +1 -1
- package/dist/admin/apps/api-keys.d.ts +94 -11
- package/dist/admin/apps/api-keys.d.ts.map +1 -1
- package/dist/admin/apps/api-keys.js +141 -32
- package/dist/admin/apps/api-keys.js.map +1 -1
- package/dist/admin/apps/earn-vaults.d.ts +1069 -0
- package/dist/admin/apps/earn-vaults.d.ts.map +1 -0
- package/dist/admin/apps/earn-vaults.js +409 -0
- package/dist/admin/apps/earn-vaults.js.map +1 -0
- package/dist/admin/apps/verified-tokens.d.ts +166 -166
- 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 +99 -43
- package/dist/admin/ui.generated.js.map +1 -1
- package/dist/analytics/Analytics.d.ts +2 -0
- package/dist/analytics/Analytics.d.ts.map +1 -1
- package/dist/analytics/Analytics.js +18 -2
- package/dist/analytics/Analytics.js.map +1 -1
- package/dist/analytics/tables/requestEvents.d.ts +22 -1
- package/dist/analytics/tables/requestEvents.d.ts.map +1 -1
- package/dist/analytics/tables/requestEvents.js +59 -39
- package/dist/analytics/tables/requestEvents.js.map +1 -1
- package/dist/apps/Zones.d.ts +8335 -0
- package/dist/apps/Zones.d.ts.map +1 -0
- package/dist/apps/Zones.js +38 -0
- package/dist/apps/Zones.js.map +1 -0
- package/dist/apps/data/App.d.ts +12125 -7913
- package/dist/apps/data/App.d.ts.map +1 -1
- package/dist/apps/data/App.js +91 -19
- package/dist/apps/data/App.js.map +1 -1
- package/dist/apps/data/FxOracle.d.ts +1 -1
- package/dist/apps/data/FxOracle.d.ts.map +1 -1
- package/dist/apps/data/index.d.ts +0 -1
- package/dist/apps/data/index.d.ts.map +1 -1
- package/dist/apps/data/index.js +0 -1
- package/dist/apps/data/index.js.map +1 -1
- package/dist/apps/data/routes/activities.d.ts +32 -32
- package/dist/apps/data/routes/activities.d.ts.map +1 -1
- package/dist/apps/data/routes/activities.js +130 -65
- package/dist/apps/data/routes/activities.js.map +1 -1
- package/dist/apps/data/routes/addresses.d.ts +312 -312
- package/dist/apps/data/routes/balances.d.ts +18 -18
- package/dist/apps/data/routes/balances.js +5 -5
- package/dist/apps/data/routes/balances.js.map +1 -1
- package/dist/apps/data/routes/coingecko.d.ts +176 -176
- package/dist/apps/data/routes/coingecko.d.ts.map +1 -1
- package/dist/apps/data/routes/coingecko.js +62 -35
- package/dist/apps/data/routes/coingecko.js.map +1 -1
- package/dist/apps/data/routes/earn.d.ts +2144 -0
- package/dist/apps/data/routes/earn.d.ts.map +1 -0
- package/dist/apps/data/routes/earn.js +947 -0
- package/dist/apps/data/routes/earn.js.map +1 -0
- package/dist/apps/data/routes/exchanges.d.ts +1625 -718
- package/dist/apps/data/routes/exchanges.d.ts.map +1 -1
- package/dist/apps/data/routes/exchanges.js +656 -193
- package/dist/apps/data/routes/exchanges.js.map +1 -1
- package/dist/apps/data/routes/fee-amm.d.ts +108 -108
- package/dist/apps/data/routes/fee-amm.d.ts.map +1 -1
- package/dist/apps/data/routes/fee-amm.js +59 -8
- package/dist/apps/data/routes/fee-amm.js.map +1 -1
- package/dist/apps/data/routes/funding.d.ts +4092 -387
- package/dist/apps/data/routes/funding.d.ts.map +1 -1
- package/dist/apps/data/routes/funding.js +1403 -256
- package/dist/apps/data/routes/funding.js.map +1 -1
- package/dist/apps/data/routes/indexer.d.ts +30 -30
- package/dist/apps/data/routes/indexer.d.ts.map +1 -1
- package/dist/apps/data/routes/indexer.js +19 -2
- package/dist/apps/data/routes/indexer.js.map +1 -1
- package/dist/apps/data/routes/receipts.d.ts +263 -263
- package/dist/apps/data/routes/receipts.d.ts.map +1 -1
- package/dist/apps/data/routes/receipts.js +11 -11
- package/dist/apps/data/routes/receipts.js.map +1 -1
- package/dist/apps/data/routes/rpc.d.ts +5 -5
- package/dist/apps/data/routes/rpc.d.ts.map +1 -1
- package/dist/apps/data/routes/rpc.js +211 -22
- package/dist/apps/data/routes/rpc.js.map +1 -1
- package/dist/apps/data/routes/tokenlist.d.ts +36 -36
- package/dist/apps/data/routes/tokenlist.d.ts.map +1 -1
- package/dist/apps/data/routes/tokenlist.js +39 -8
- package/dist/apps/data/routes/tokenlist.js.map +1 -1
- package/dist/apps/data/routes/tokens.d.ts +114 -86
- package/dist/apps/data/routes/tokens.d.ts.map +1 -1
- package/dist/apps/data/routes/tokens.js +194 -91
- package/dist/apps/data/routes/tokens.js.map +1 -1
- package/dist/apps/data/routes/transactions.d.ts +53 -53
- package/dist/apps/data/routes/transactions.d.ts.map +1 -1
- package/dist/apps/data/routes/transactions.js +78 -39
- package/dist/apps/data/routes/transactions.js.map +1 -1
- package/dist/apps/data/routes/transfers.d.ts +76 -27
- package/dist/apps/data/routes/transfers.d.ts.map +1 -1
- package/dist/apps/data/routes/transfers.js +165 -67
- package/dist/apps/data/routes/transfers.js.map +1 -1
- package/dist/apps/data/routes/valuation.d.ts +42 -42
- package/dist/apps/data/routes/valuation.js +2 -2
- package/dist/apps/data/routes/valuation.js.map +1 -1
- package/dist/apps/data/routes/webhooks.d.ts +369 -367
- package/dist/apps/data/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/data/routes/webhooks.js +161 -59
- package/dist/apps/data/routes/webhooks.js.map +1 -1
- package/dist/apps/data/routes/zones.d.ts +281 -0
- package/dist/apps/data/routes/zones.d.ts.map +1 -0
- package/dist/apps/data/routes/zones.js +252 -0
- package/dist/apps/data/routes/zones.js.map +1 -0
- package/dist/apps/docs/reference.js +6 -5
- package/dist/apps/docs/reference.js.map +1 -1
- package/dist/apps/index.d.ts +2 -1
- package/dist/apps/index.d.ts.map +1 -1
- package/dist/apps/index.js +2 -1
- package/dist/apps/index.js.map +1 -1
- package/dist/apps/management/App.d.ts +670 -670
- package/dist/apps/management/Billing.d.ts +8 -0
- package/dist/apps/management/Billing.d.ts.map +1 -1
- package/dist/apps/management/Billing.js +12 -0
- package/dist/apps/management/Billing.js.map +1 -1
- package/dist/apps/management/Error.d.ts +12 -0
- package/dist/apps/management/Error.d.ts.map +1 -0
- package/dist/apps/management/Error.js +10 -0
- package/dist/apps/management/Error.js.map +1 -0
- package/dist/apps/management/routes/api-keys.d.ts +5 -5
- package/dist/apps/management/routes/api-keys.d.ts.map +1 -1
- package/dist/apps/management/routes/api-keys.js +2 -8
- package/dist/apps/management/routes/api-keys.js.map +1 -1
- package/dist/apps/management/routes/billing.d.ts +119 -119
- package/dist/apps/management/routes/faucet.d.ts +2 -2
- package/dist/apps/management/routes/invitations.d.ts +62 -62
- package/dist/apps/management/routes/invitations.d.ts.map +1 -1
- package/dist/apps/management/routes/invitations.js +4 -10
- package/dist/apps/management/routes/invitations.js.map +1 -1
- package/dist/apps/management/routes/invite-links.d.ts +30 -30
- package/dist/apps/management/routes/me.d.ts +6 -6
- package/dist/apps/management/routes/members.d.ts +2 -2
- package/dist/apps/management/routes/orgs.d.ts +48 -48
- package/dist/apps/management/routes/orgs.d.ts.map +1 -1
- package/dist/apps/management/routes/orgs.js +2 -8
- package/dist/apps/management/routes/orgs.js.map +1 -1
- package/dist/apps/management/routes/projects.d.ts +9 -9
- package/dist/apps/management/routes/scopes.js +2 -2
- package/dist/apps/management/routes/scopes.js.map +1 -1
- package/dist/apps/management/routes/verified-token-requests.d.ts +36 -36
- package/dist/apps/management/routes/webhooks.d.ts +50 -50
- package/dist/apps/management/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/management/routes/webhooks.js +15 -3
- package/dist/apps/management/routes/webhooks.js.map +1 -1
- package/dist/apps/mpp/App.d.ts +55 -56
- package/dist/apps/mpp/App.d.ts.map +1 -1
- package/dist/apps/mpp/App.js +192 -27
- package/dist/apps/mpp/App.js.map +1 -1
- package/dist/apps/mpp/Mpp.d.ts +0 -20
- package/dist/apps/mpp/Mpp.d.ts.map +1 -1
- package/dist/apps/mpp/Mpp.js +0 -24
- package/dist/apps/mpp/Mpp.js.map +1 -1
- package/dist/apps/mpp/internal/Adapter.d.ts +40 -0
- package/dist/apps/mpp/internal/Adapter.d.ts.map +1 -0
- package/dist/apps/mpp/internal/Adapter.js +66 -0
- package/dist/apps/mpp/internal/Adapter.js.map +1 -0
- package/dist/apps/mpp/internal/Error.d.ts +4 -0
- package/dist/apps/mpp/internal/Error.d.ts.map +1 -0
- package/dist/apps/mpp/internal/Error.js +41 -0
- package/dist/apps/mpp/internal/Error.js.map +1 -0
- package/dist/apps/mpp/internal/Idempotency.d.ts +33 -0
- package/dist/apps/mpp/internal/Idempotency.d.ts.map +1 -0
- package/dist/apps/mpp/internal/Idempotency.js +28 -0
- package/dist/apps/mpp/internal/Idempotency.js.map +1 -0
- package/dist/apps/mpp/internal/Policy.d.ts +46 -0
- package/dist/apps/mpp/internal/Policy.d.ts.map +1 -0
- package/dist/apps/mpp/internal/Policy.js +57 -0
- package/dist/apps/mpp/internal/Policy.js.map +1 -0
- package/dist/apps/mpp/internal/ScreenManager.d.ts +27 -0
- package/dist/apps/mpp/internal/ScreenManager.d.ts.map +1 -0
- package/dist/apps/mpp/internal/ScreenManager.js +18 -0
- package/dist/apps/mpp/internal/ScreenManager.js.map +1 -0
- package/dist/apps/mpp/internal/Screening.d.ts +35 -0
- package/dist/apps/mpp/internal/Screening.d.ts.map +1 -0
- package/dist/apps/mpp/internal/Screening.js +20 -0
- package/dist/apps/mpp/internal/Screening.js.map +1 -0
- package/dist/apps/mpp/internal/Sponsorship.d.ts +36 -0
- package/dist/apps/mpp/internal/Sponsorship.d.ts.map +1 -0
- package/dist/apps/mpp/internal/Sponsorship.js +103 -0
- package/dist/apps/mpp/internal/Sponsorship.js.map +1 -0
- package/dist/apps/mpp/internal/Utils.d.ts +7 -0
- package/dist/apps/mpp/internal/Utils.d.ts.map +1 -0
- package/dist/apps/mpp/internal/Utils.js +24 -0
- package/dist/apps/mpp/internal/Utils.js.map +1 -0
- package/dist/apps/relay/App.js +183 -23
- package/dist/apps/relay/App.js.map +1 -1
- package/dist/apps/relay/Sponsorships.d.ts +4 -0
- package/dist/apps/relay/Sponsorships.d.ts.map +1 -1
- package/dist/apps/relay/Sponsorships.js +15 -6
- package/dist/apps/relay/Sponsorships.js.map +1 -1
- package/dist/db/Db.d.ts +20 -0
- package/dist/db/Db.d.ts.map +1 -1
- package/dist/db/Db.js +342 -0
- package/dist/db/Db.js.map +1 -1
- package/dist/db/Schema.d.ts +921 -1
- package/dist/db/Schema.d.ts.map +1 -1
- package/dist/db/Schema.js +269 -1
- package/dist/db/Schema.js.map +1 -1
- package/dist/db/tables/earnVaults.d.ts +68 -0
- package/dist/db/tables/earnVaults.d.ts.map +1 -0
- package/dist/db/tables/earnVaults.js +72 -0
- package/dist/db/tables/earnVaults.js.map +1 -0
- package/dist/db/tables/fundingCatalog.d.ts +56 -0
- package/dist/db/tables/fundingCatalog.d.ts.map +1 -0
- package/dist/db/tables/fundingCatalog.js +85 -0
- package/dist/db/tables/fundingCatalog.js.map +1 -0
- package/dist/db/tables/fundingDepositAddresses.d.ts +159 -0
- package/dist/db/tables/fundingDepositAddresses.d.ts.map +1 -0
- package/dist/db/tables/fundingDepositAddresses.js +206 -0
- package/dist/db/tables/fundingDepositAddresses.js.map +1 -0
- package/dist/db/tables/fundingDeposits.d.ts +115 -0
- package/dist/db/tables/fundingDeposits.d.ts.map +1 -0
- package/dist/db/tables/fundingDeposits.js +100 -0
- package/dist/db/tables/fundingDeposits.js.map +1 -0
- package/dist/db/tables/fundingIdempotency.d.ts +91 -0
- package/dist/db/tables/fundingIdempotency.d.ts.map +1 -0
- package/dist/db/tables/fundingIdempotency.js +103 -0
- package/dist/db/tables/fundingIdempotency.js.map +1 -0
- package/dist/db/tables/fundingTransferEvents.d.ts +12 -0
- package/dist/db/tables/fundingTransferEvents.d.ts.map +1 -0
- package/dist/db/tables/fundingTransferEvents.js +18 -0
- package/dist/db/tables/fundingTransferEvents.js.map +1 -0
- package/dist/db/tables/fundingTransferTransactions.d.ts +15 -0
- package/dist/db/tables/fundingTransferTransactions.d.ts.map +1 -0
- package/dist/db/tables/fundingTransferTransactions.js +27 -0
- package/dist/db/tables/fundingTransferTransactions.js.map +1 -0
- package/dist/db/tables/fundingTransfers.d.ts +82 -0
- package/dist/db/tables/fundingTransfers.d.ts.map +1 -0
- package/dist/db/tables/fundingTransfers.js +89 -0
- package/dist/db/tables/fundingTransfers.js.map +1 -0
- package/dist/db/tables/organizations.d.ts +8 -0
- package/dist/db/tables/organizations.d.ts.map +1 -1
- package/dist/db/tables/organizations.js +16 -0
- package/dist/db/tables/organizations.js.map +1 -1
- package/dist/db/tables/projects.d.ts +8 -0
- package/dist/db/tables/projects.d.ts.map +1 -1
- package/dist/db/tables/projects.js +16 -0
- package/dist/db/tables/projects.js.map +1 -1
- package/dist/db/tables/requestUsage.d.ts +13 -0
- package/dist/db/tables/requestUsage.d.ts.map +1 -1
- package/dist/db/tables/requestUsage.js +16 -0
- package/dist/db/tables/requestUsage.js.map +1 -1
- package/dist/db/tables/sponsoredTransactions.d.ts +2 -2
- package/dist/db/tables/sponsoredTransactions.d.ts.map +1 -1
- package/dist/db/tables/sponsoredTransactions.js +1 -1
- package/dist/db/tables/sponsoredTransactions.js.map +1 -1
- package/dist/db/tables/users.d.ts +8 -0
- package/dist/db/tables/users.d.ts.map +1 -1
- package/dist/db/tables/users.js +16 -0
- package/dist/db/tables/users.js.map +1 -1
- package/dist/db/tables/verifiedTokens.d.ts +14 -7
- package/dist/db/tables/verifiedTokens.d.ts.map +1 -1
- package/dist/db/tables/verifiedTokens.js +9 -7
- package/dist/db/tables/verifiedTokens.js.map +1 -1
- package/dist/db/tables/webhookSubscriptions.d.ts +31 -1
- package/dist/db/tables/webhookSubscriptions.d.ts.map +1 -1
- package/dist/db/tables/webhookSubscriptions.js +24 -3
- package/dist/db/tables/webhookSubscriptions.js.map +1 -1
- package/dist/handlers/relay.js +108 -108
- package/dist/handlers/relay.js.map +1 -1
- package/dist/internal/Auth.d.ts +26 -0
- package/dist/internal/Auth.d.ts.map +1 -1
- package/dist/internal/Auth.js +35 -2
- package/dist/internal/Auth.js.map +1 -1
- package/dist/internal/Cache.d.ts.map +1 -1
- package/dist/internal/Cache.js +16 -10
- package/dist/internal/Cache.js.map +1 -1
- package/dist/internal/Cursor.js +1 -1
- package/dist/internal/Cursor.js.map +1 -1
- package/dist/internal/EarnRates.d.ts +89 -0
- package/dist/internal/EarnRates.d.ts.map +1 -0
- package/dist/internal/EarnRates.js +266 -0
- package/dist/internal/EarnRates.js.map +1 -0
- package/dist/internal/EarnVaults.d.ts +171 -0
- package/dist/internal/EarnVaults.d.ts.map +1 -0
- package/dist/internal/EarnVaults.js +547 -0
- package/dist/internal/EarnVaults.js.map +1 -0
- package/dist/internal/EdgeCache.d.ts +8 -1
- package/dist/internal/EdgeCache.d.ts.map +1 -1
- package/dist/internal/EdgeCache.js +33 -7
- package/dist/internal/EdgeCache.js.map +1 -1
- package/dist/internal/Id.d.ts +11 -0
- package/dist/internal/Id.d.ts.map +1 -1
- package/dist/internal/Id.js +13 -0
- package/dist/internal/Id.js.map +1 -1
- package/dist/internal/Idempotency.d.ts +83 -0
- package/dist/internal/Idempotency.d.ts.map +1 -0
- package/dist/internal/Idempotency.js +113 -0
- package/dist/internal/Idempotency.js.map +1 -0
- package/dist/internal/Log.d.ts +64 -9
- package/dist/internal/Log.d.ts.map +1 -1
- package/dist/internal/Log.js +29 -7
- package/dist/internal/Log.js.map +1 -1
- package/dist/internal/MetricSink.d.ts.map +1 -1
- package/dist/internal/MetricSink.js +47 -1
- package/dist/internal/MetricSink.js.map +1 -1
- package/dist/internal/OpenApi.d.ts +1 -1
- package/dist/internal/OpenApi.d.ts.map +1 -1
- package/dist/internal/OpenApi.js +3 -0
- package/dist/internal/OpenApi.js.map +1 -1
- package/dist/internal/Provider.d.ts +14 -0
- package/dist/internal/Provider.d.ts.map +1 -0
- package/dist/internal/Provider.js +5 -0
- package/dist/internal/Provider.js.map +1 -0
- package/dist/internal/Schema.d.ts +6 -1
- package/dist/internal/Schema.d.ts.map +1 -1
- package/dist/internal/Schema.js +20 -11
- package/dist/internal/Schema.js.map +1 -1
- package/dist/internal/Store.d.ts +6 -0
- package/dist/internal/Store.d.ts.map +1 -1
- package/dist/internal/Store.js +35 -0
- package/dist/internal/Store.js.map +1 -1
- package/dist/internal/Tidx.d.ts +43 -24
- package/dist/internal/Tidx.d.ts.map +1 -1
- package/dist/internal/Tidx.js +79 -11
- package/dist/internal/Tidx.js.map +1 -1
- package/dist/internal/Viem.d.ts +82 -65
- package/dist/internal/Viem.d.ts.map +1 -1
- package/dist/internal/Viem.js +83 -12
- package/dist/internal/Viem.js.map +1 -1
- package/dist/internal/WebhookDestination.d.ts.map +1 -1
- package/dist/internal/WebhookDestination.js +34 -28
- package/dist/internal/WebhookDestination.js.map +1 -1
- package/dist/internal/Webhooks.d.ts +9 -0
- package/dist/internal/Webhooks.d.ts.map +1 -1
- package/dist/internal/Webhooks.js +15 -10
- package/dist/internal/Webhooks.js.map +1 -1
- package/dist/internal/exchange/Provider.d.ts +219 -0
- package/dist/internal/exchange/Provider.d.ts.map +1 -0
- package/dist/internal/exchange/Provider.js +117 -0
- package/dist/internal/exchange/Provider.js.map +1 -0
- package/dist/internal/exchange/index.d.ts +2 -0
- package/dist/internal/exchange/index.d.ts.map +1 -0
- package/dist/internal/exchange/index.js +2 -0
- package/dist/internal/exchange/index.js.map +1 -0
- package/dist/internal/exchange/providers/uniswap.d.ts +57 -0
- package/dist/internal/exchange/providers/uniswap.d.ts.map +1 -0
- package/dist/internal/exchange/providers/uniswap.js +553 -0
- package/dist/internal/exchange/providers/uniswap.js.map +1 -0
- package/dist/internal/funding/Action.d.ts +55 -0
- package/dist/internal/funding/Action.d.ts.map +1 -0
- package/dist/internal/funding/Action.js +74 -0
- package/dist/internal/funding/Action.js.map +1 -0
- package/dist/internal/funding/Catalog.d.ts +107 -0
- package/dist/internal/funding/Catalog.d.ts.map +1 -0
- package/dist/internal/funding/Catalog.js +270 -0
- package/dist/internal/funding/Catalog.js.map +1 -0
- package/dist/internal/funding/Chain.d.ts +76 -0
- package/dist/internal/funding/Chain.d.ts.map +1 -0
- package/dist/internal/funding/Chain.js +38 -0
- package/dist/internal/funding/Chain.js.map +1 -0
- package/dist/internal/funding/Deposit.d.ts +366 -0
- package/dist/internal/funding/Deposit.d.ts.map +1 -0
- package/dist/internal/funding/Deposit.js +286 -0
- package/dist/internal/funding/Deposit.js.map +1 -0
- package/dist/internal/funding/DepositAddress.d.ts +345 -0
- package/dist/internal/funding/DepositAddress.d.ts.map +1 -0
- package/dist/internal/funding/DepositAddress.js +189 -0
- package/dist/internal/funding/DepositAddress.js.map +1 -0
- package/dist/internal/funding/Evidence.d.ts +52 -0
- package/dist/internal/funding/Evidence.d.ts.map +1 -0
- package/dist/internal/funding/Evidence.js +314 -0
- package/dist/internal/funding/Evidence.js.map +1 -0
- package/dist/internal/funding/Provider.d.ts +1186 -0
- package/dist/internal/funding/Provider.d.ts.map +1 -0
- package/dist/internal/funding/Provider.js +1081 -0
- package/dist/internal/funding/Provider.js.map +1 -0
- package/dist/internal/funding/Reconciliation.d.ts +113 -0
- package/dist/internal/funding/Reconciliation.d.ts.map +1 -0
- package/dist/internal/funding/Reconciliation.js +676 -0
- package/dist/internal/funding/Reconciliation.js.map +1 -0
- package/dist/internal/funding/Route.d.ts +21 -0
- package/dist/internal/funding/Route.d.ts.map +1 -0
- package/dist/internal/funding/Route.js +5 -0
- package/dist/internal/funding/Route.js.map +1 -0
- package/dist/internal/funding/Subsidy.d.ts +113 -0
- package/dist/internal/funding/Subsidy.d.ts.map +1 -0
- package/dist/internal/funding/Subsidy.js +138 -0
- package/dist/internal/funding/Subsidy.js.map +1 -0
- package/dist/internal/funding/Token.d.ts +41 -0
- package/dist/internal/funding/Token.d.ts.map +1 -0
- package/dist/internal/funding/Token.js +22 -0
- package/dist/internal/funding/Token.js.map +1 -0
- package/dist/internal/funding/Transfer.d.ts +643 -0
- package/dist/internal/funding/Transfer.d.ts.map +1 -0
- package/dist/internal/funding/Transfer.js +332 -0
- package/dist/internal/funding/Transfer.js.map +1 -0
- package/dist/internal/funding/index.d.ts +13 -0
- package/dist/internal/funding/index.d.ts.map +1 -0
- package/dist/internal/funding/index.js +13 -0
- package/dist/internal/funding/index.js.map +1 -0
- package/dist/internal/funding/providers/across.d.ts +21 -0
- package/dist/internal/funding/providers/across.d.ts.map +1 -0
- package/dist/internal/funding/providers/across.js +117 -0
- package/dist/internal/funding/providers/across.js.map +1 -0
- package/dist/internal/funding/providers/relay.d.ts +46 -0
- package/dist/internal/funding/providers/relay.d.ts.map +1 -0
- package/dist/internal/funding/providers/relay.js +464 -0
- package/dist/internal/funding/providers/relay.js.map +1 -0
- package/dist/internal/funding/providers/rhino.d.ts +15 -0
- package/dist/internal/funding/providers/rhino.d.ts.map +1 -0
- package/dist/internal/funding/providers/rhino.js +116 -0
- package/dist/internal/funding/providers/rhino.js.map +1 -0
- package/dist/internal/funding/providers/squid.d.ts +19 -0
- package/dist/internal/funding/providers/squid.d.ts.map +1 -0
- package/dist/internal/funding/providers/squid.js +120 -0
- package/dist/internal/funding/providers/squid.js.map +1 -0
- package/dist/internal/funding/providers/symbiosis.d.ts +20 -0
- package/dist/internal/funding/providers/symbiosis.d.ts.map +1 -0
- package/dist/internal/funding/providers/symbiosis.js +176 -0
- package/dist/internal/funding/providers/symbiosis.js.map +1 -0
- package/dist/internal/index.d.ts +5 -1
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +5 -1
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/webhookDestinations/url.js +61 -57
- package/dist/internal/webhookDestinations/url.js.map +1 -1
- package/dist/providers/index.d.ts +43 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +19 -0
- package/dist/providers/index.js.map +1 -0
- package/package.json +9 -4
- package/src/ApiKeys.test.ts +11 -7
- package/src/ApiKeys.ts +37 -9
- package/src/App.test.ts +85 -10
- package/src/App.ts +224 -137
- package/src/Assets.ts +29 -4
- package/src/Client.test-d.ts +650 -30
- package/src/Scope.test.ts +19 -0
- package/src/Scope.ts +28 -11
- package/src/Webhooks.test.ts +25 -0
- package/src/Webhooks.ts +1 -1
- package/src/admin/App.test.ts +9 -2
- package/src/admin/App.ts +32 -9
- package/src/admin/apps/api-keys.test.ts +167 -23
- package/src/admin/apps/api-keys.ts +166 -28
- package/src/admin/apps/earn-vaults.test.ts +338 -0
- package/src/admin/apps/earn-vaults.ts +572 -0
- package/src/admin/apps/scopes.test.ts +16 -1
- package/src/admin/ui/plugin.ts +2 -2
- package/src/admin/ui/src/components/EarnVaultForm.tsx +137 -0
- package/src/admin/ui/src/components/MobileProfile.tsx +2 -2
- package/src/admin/ui/src/components/Page.tsx +1 -1
- package/src/admin/ui/src/components/ThemeToggle.tsx +1 -1
- package/src/admin/ui/src/lib/api-keys.ts +37 -7
- package/src/admin/ui/src/lib/client.ts +1 -1
- package/src/admin/ui/src/lib/config.ts +1 -1
- package/src/admin/ui/src/lib/early-access.ts +8 -9
- package/src/admin/ui/src/lib/earn-vaults.ts +207 -0
- package/src/admin/ui/src/lib/format.ts +13 -0
- package/src/admin/ui/src/lib/organizations.test.ts +14 -4
- package/src/admin/ui/src/lib/organizations.ts +7 -1
- package/src/admin/ui/src/lib/response.ts +22 -0
- package/src/admin/ui/src/lib/scopes.test.ts +19 -11
- package/src/admin/ui/src/lib/scopes.ts +28 -7
- package/src/admin/ui/src/lib/verified-tokens.ts +10 -9
- package/src/admin/ui/src/routeTree.gen.ts +70 -7
- package/src/admin/ui/src/router.tsx +2 -2
- package/src/admin/ui/src/routes/__root.tsx +9 -8
- package/src/admin/ui/src/routes/api-keys.tsx +475 -64
- package/src/admin/ui/src/routes/early-access.tsx +5 -12
- package/src/admin/ui/src/routes/earn.vaults.tsx +348 -0
- package/src/admin/ui/src/routes/earn.vaults_.$vaultId.edit.tsx +154 -0
- package/src/admin/ui/src/routes/earn.vaults_.new.tsx +190 -0
- package/src/admin/ui/src/routes/organizations.tsx +4 -7
- package/src/admin/ui/src/routes/organizations_.$orgId.tsx +56 -54
- package/src/admin/ui/src/routes/verified-tokens.tsx +4 -4
- package/src/admin/ui/vite.config.ts +4 -1
- package/src/admin/ui.generated.ts +113 -43
- package/src/analytics/Analytics.test.ts +69 -10
- package/src/analytics/Analytics.ts +20 -1
- package/src/analytics/tables/requestEvents.ts +79 -37
- package/src/apps/Zones.test.ts +33 -0
- package/src/apps/Zones.ts +40 -0
- package/src/apps/composition.test.ts +84 -1
- package/src/apps/data/App.test.ts +28 -11
- package/src/apps/data/App.ts +96 -33
- package/src/apps/data/FxOracle.ts +1 -1
- package/src/apps/data/index.ts +0 -1
- package/src/apps/data/routes/activities.test.ts +82 -6
- package/src/apps/data/routes/activities.ts +131 -71
- package/src/apps/data/routes/balances.test.ts +50 -37
- package/src/apps/data/routes/balances.ts +5 -5
- package/src/apps/data/routes/blocks.test.ts +2 -0
- package/src/apps/data/routes/coingecko.test.ts +22 -0
- package/src/apps/data/routes/coingecko.ts +84 -48
- package/src/apps/data/routes/earn.test.ts +1108 -0
- package/src/apps/data/routes/earn.ts +1391 -0
- package/src/apps/data/routes/exchanges.test.ts +82 -33
- package/src/apps/data/routes/exchanges.ts +842 -227
- package/src/apps/data/routes/fee-amm.test.ts +4 -6
- package/src/apps/data/routes/fee-amm.ts +69 -12
- package/src/apps/data/routes/funding.test.ts +2712 -221
- package/src/apps/data/routes/funding.ts +1604 -387
- package/src/apps/data/routes/indexer.test.ts +43 -34
- package/src/apps/data/routes/indexer.ts +19 -2
- package/src/apps/data/routes/receipts.test.ts +5 -3
- package/src/apps/data/routes/receipts.ts +13 -11
- package/src/apps/data/routes/rpc.test.ts +446 -28
- package/src/apps/data/routes/rpc.ts +243 -25
- package/src/apps/data/routes/tokenlist.ts +72 -19
- package/src/apps/data/routes/tokens.ts +258 -86
- package/src/apps/data/routes/transactions.test.ts +2 -0
- package/src/apps/data/routes/transactions.ts +77 -42
- package/src/apps/data/routes/transfers.test.ts +166 -4
- package/src/apps/data/routes/transfers.ts +216 -78
- package/src/apps/data/routes/valuation.test.ts +62 -9
- package/src/apps/data/routes/valuation.ts +2 -2
- package/src/apps/data/routes/webhooks.test.ts +386 -43
- package/src/apps/data/routes/webhooks.ts +172 -71
- package/src/apps/data/routes/zones.test.ts +473 -0
- package/src/apps/data/routes/zones.ts +338 -0
- package/src/apps/docs/reference.ts +8 -6
- package/src/apps/index.ts +2 -1
- package/src/apps/management/Billing.test.ts +29 -0
- package/src/apps/management/Billing.ts +23 -0
- package/src/apps/management/Error.ts +12 -0
- package/src/apps/management/routes/api-keys.test.ts +5 -3
- package/src/apps/management/routes/api-keys.ts +2 -9
- package/src/apps/management/routes/invitations.ts +4 -11
- package/src/apps/management/routes/orgs.ts +2 -9
- package/src/apps/management/routes/scopes.test.ts +7 -2
- package/src/apps/management/routes/scopes.ts +2 -2
- package/src/apps/management/routes/webhooks.test.ts +6 -1
- package/src/apps/management/routes/webhooks.ts +15 -3
- package/src/apps/mpp/App.ts +276 -29
- package/src/apps/mpp/Mpp.test.ts +631 -26
- package/src/apps/mpp/Mpp.ts +0 -42
- package/src/apps/mpp/internal/Adapter.ts +108 -3
- package/src/apps/mpp/internal/Error.test.ts +33 -0
- package/src/apps/mpp/internal/Error.ts +44 -6
- package/src/apps/mpp/internal/Idempotency.test.ts +213 -0
- package/src/apps/mpp/internal/Idempotency.ts +59 -5
- package/src/apps/mpp/internal/Policy.test.ts +122 -0
- package/src/apps/mpp/internal/Policy.ts +98 -0
- package/src/apps/mpp/internal/ScreenManager.test.ts +68 -0
- package/src/apps/mpp/internal/ScreenManager.ts +41 -0
- package/src/apps/mpp/internal/Screening.ts +40 -3
- package/src/apps/mpp/internal/Sponsorship.ts +144 -0
- package/src/apps/mpp/internal/Utils.ts +30 -0
- package/src/apps/relay/App.test.ts +493 -62
- package/src/apps/relay/App.ts +233 -23
- package/src/apps/relay/Sponsorships.test.ts +49 -0
- package/src/apps/relay/Sponsorships.ts +18 -6
- package/src/db/Db.ts +439 -0
- package/src/db/Schema.ts +325 -2
- package/src/db/tables/earnVaults.test.ts +185 -0
- package/src/db/tables/earnVaults.ts +151 -0
- package/src/db/tables/fundingCatalog.test.ts +108 -0
- package/src/db/tables/fundingCatalog.ts +157 -0
- package/src/db/tables/fundingDepositAddresses.test.ts +580 -0
- package/src/db/tables/fundingDepositAddresses.ts +376 -0
- package/src/db/tables/fundingDeposits.test.ts +261 -0
- package/src/db/tables/fundingDeposits.ts +229 -0
- package/src/db/tables/fundingIdempotency.test.ts +182 -0
- package/src/db/tables/fundingIdempotency.ts +180 -0
- package/src/db/tables/fundingTransferEvents.ts +28 -0
- package/src/db/tables/fundingTransferTransactions.test.ts +69 -0
- package/src/db/tables/fundingTransferTransactions.ts +37 -0
- package/src/db/tables/fundingTransfers.test.ts +89 -0
- package/src/db/tables/fundingTransfers.ts +153 -0
- package/src/db/tables/organizations.ts +16 -0
- package/src/db/tables/projects.ts +16 -0
- package/src/db/tables/requestUsage.ts +23 -0
- package/src/db/tables/sponsoredTransactions.test.ts +11 -0
- package/src/db/tables/sponsoredTransactions.ts +3 -3
- package/src/db/tables/users.ts +16 -0
- package/src/db/tables/verifiedTokens.ts +19 -14
- package/src/db/tables/webhookSubscriptions.ts +58 -3
- package/src/handlers/relay.test.ts +2 -0
- package/src/handlers/relay.ts +95 -99
- package/src/internal/Auth.test.ts +48 -0
- package/src/internal/Auth.ts +61 -2
- package/src/internal/Cache.ts +13 -9
- package/src/internal/Cursor.test.ts +2 -2
- package/src/internal/Cursor.ts +1 -1
- package/src/internal/EarnRates.test.ts +125 -0
- package/src/internal/EarnRates.ts +409 -0
- package/src/internal/EarnVaults.test.ts +195 -0
- package/src/internal/EarnVaults.ts +876 -0
- package/src/internal/EdgeCache.test.ts +19 -0
- package/src/internal/EdgeCache.ts +35 -5
- package/src/internal/Id.ts +14 -0
- package/src/internal/Idempotency.test.ts +109 -0
- package/src/internal/Idempotency.ts +237 -0
- package/src/internal/Log.test-d.ts +41 -8
- package/src/internal/Log.test.ts +189 -8
- package/src/internal/Log.ts +124 -17
- package/src/internal/MetricSink.test.ts +244 -4
- package/src/internal/MetricSink.ts +51 -1
- package/src/internal/OpenApi.ts +3 -0
- package/src/internal/Provider.test.ts +17 -0
- package/src/internal/Provider.ts +17 -0
- package/src/internal/Schema.ts +27 -17
- package/src/internal/Store.test.ts +25 -0
- package/src/internal/Store.ts +46 -0
- package/src/internal/Tidx.local.test.ts +78 -3
- package/src/internal/Tidx.test.ts +212 -18
- package/src/internal/Tidx.ts +112 -32
- package/src/internal/VerifiedTokens.test.ts +15 -0
- package/src/internal/Viem.test.ts +170 -17
- package/src/internal/Viem.ts +111 -28
- package/src/internal/WebhookDestination.ts +25 -23
- package/src/internal/Webhooks.test.ts +59 -0
- package/src/internal/Webhooks.ts +34 -10
- package/src/internal/exchange/Provider.test.ts +216 -0
- package/src/internal/exchange/Provider.ts +326 -0
- package/src/internal/exchange/index.test.ts +6 -0
- package/src/internal/exchange/index.ts +1 -0
- package/src/internal/exchange/providers/uniswap.test.ts +122 -0
- package/src/internal/exchange/providers/uniswap.ts +682 -0
- package/src/internal/funding/Action.test.ts +138 -0
- package/src/internal/funding/Action.ts +117 -0
- package/src/internal/funding/Catalog.test.ts +311 -0
- package/src/internal/funding/Catalog.ts +347 -0
- package/src/internal/funding/Chain.test.ts +79 -0
- package/src/internal/funding/Chain.ts +120 -0
- package/src/internal/funding/Deposit.test.ts +26 -0
- package/src/internal/funding/Deposit.ts +453 -0
- package/src/internal/funding/DepositAddress.test.ts +18 -0
- package/src/internal/funding/DepositAddress.ts +312 -0
- package/src/internal/funding/Evidence.test.ts +297 -0
- package/src/internal/funding/Evidence.ts +430 -0
- package/src/internal/funding/Provider.test.ts +1328 -0
- package/src/internal/funding/Provider.ts +1796 -0
- package/src/internal/funding/Reconciliation.local.test.ts +504 -0
- package/src/internal/funding/Reconciliation.test.ts +2020 -0
- package/src/internal/funding/Reconciliation.ts +930 -0
- package/src/internal/funding/Route.test.ts +66 -0
- package/src/internal/funding/Route.ts +29 -0
- package/src/internal/funding/Subsidy.local.test.ts +152 -0
- package/src/internal/funding/Subsidy.test.ts +75 -0
- package/src/internal/funding/Subsidy.ts +260 -0
- package/src/internal/funding/Token.test.ts +47 -0
- package/src/internal/funding/Token.ts +59 -0
- package/src/internal/funding/Transfer.test.ts +369 -0
- package/src/internal/funding/Transfer.ts +522 -0
- package/src/internal/funding/index.test.ts +20 -0
- package/src/internal/funding/index.ts +12 -0
- package/src/internal/funding/providers/across.ts +149 -0
- package/src/{apps/data/FundingQuoteProviders.test.ts → internal/funding/providers/index.test.ts} +178 -157
- package/src/internal/funding/providers/relay.test.ts +474 -0
- package/src/internal/funding/providers/relay.ts +559 -0
- package/src/internal/funding/providers/rhino.ts +139 -0
- package/src/internal/funding/providers/squid.ts +151 -0
- package/src/internal/funding/providers/symbiosis.ts +221 -0
- package/src/internal/index.test.ts +5 -1
- package/src/internal/index.ts +5 -1
- package/src/internal/webhookDestinations/url.ts +49 -45
- package/src/providers/index.test.ts +14 -0
- package/src/providers/index.ts +54 -0
- package/dist/apps/data/FundingQuoteProviders.d.ts +0 -174
- package/dist/apps/data/FundingQuoteProviders.d.ts.map +0 -1
- package/dist/apps/data/FundingQuoteProviders.js +0 -775
- package/dist/apps/data/FundingQuoteProviders.js.map +0 -1
- package/dist/internal/FundingQuotes.d.ts +0 -864
- package/dist/internal/FundingQuotes.d.ts.map +0 -1
- package/dist/internal/FundingQuotes.js +0 -672
- package/dist/internal/FundingQuotes.js.map +0 -1
- package/src/apps/data/FundingQuoteProviders.ts +0 -1043
- package/src/internal/FundingQuotes.test.ts +0 -456
- package/src/internal/FundingQuotes.ts +0 -944
|
@@ -1,944 +0,0 @@
|
|
|
1
|
-
import * as Value from './Value.js'
|
|
2
|
-
|
|
3
|
-
/** Tempo mainnet as a CAIP-2 chain reference. */
|
|
4
|
-
const destinationChain = {
|
|
5
|
-
addressFormat: 'evm',
|
|
6
|
-
id: 'eip155:4217',
|
|
7
|
-
kind: 'evm',
|
|
8
|
-
name: 'Tempo',
|
|
9
|
-
} as const
|
|
10
|
-
|
|
11
|
-
/** Tempo token used when the caller omits `destinationToken`. */
|
|
12
|
-
const defaultDestinationToken = 'usdce'
|
|
13
|
-
|
|
14
|
-
/** Source chains considered by funding quote providers. */
|
|
15
|
-
const sourceChains = [
|
|
16
|
-
{
|
|
17
|
-
addressFormat: 'evm',
|
|
18
|
-
aliases: ['ethereum', 'eth', 'eip155:1'],
|
|
19
|
-
id: 'eip155:1',
|
|
20
|
-
kind: 'evm',
|
|
21
|
-
name: 'Ethereum',
|
|
22
|
-
providerIds: {
|
|
23
|
-
across: '1',
|
|
24
|
-
relay: '1',
|
|
25
|
-
symbiosis: '1',
|
|
26
|
-
},
|
|
27
|
-
slug: 'ethereum',
|
|
28
|
-
tokens: [
|
|
29
|
-
{
|
|
30
|
-
address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
31
|
-
coingeckoId: 'usd-coin',
|
|
32
|
-
currency: 'USD',
|
|
33
|
-
decimals: 6,
|
|
34
|
-
name: 'USD Coin',
|
|
35
|
-
standard: 'ERC-20',
|
|
36
|
-
symbol: 'USDC',
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
address: '0xdac17f958d2ee523a2206206994597c13d831ec7',
|
|
40
|
-
coingeckoId: 'tether',
|
|
41
|
-
currency: 'USD',
|
|
42
|
-
decimals: 6,
|
|
43
|
-
name: 'Tether USD',
|
|
44
|
-
standard: 'ERC-20',
|
|
45
|
-
symbol: 'USDT',
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
address: '0x6c3ea9036406852006290770bedfcaba0e23a0e8',
|
|
49
|
-
coingeckoId: 'paypal-usd',
|
|
50
|
-
currency: 'USD',
|
|
51
|
-
decimals: 6,
|
|
52
|
-
name: 'PayPal USD',
|
|
53
|
-
standard: 'ERC-20',
|
|
54
|
-
symbol: 'PYUSD',
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
address: '0x1abaea1f7c830bd89acc67ec4af516284b1bc33c',
|
|
58
|
-
coingeckoId: 'euro-coin',
|
|
59
|
-
currency: 'EUR',
|
|
60
|
-
decimals: 6,
|
|
61
|
-
name: 'Euro Coin',
|
|
62
|
-
standard: 'ERC-20',
|
|
63
|
-
symbol: 'EURC',
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
address: '0x6b175474e89094c44da98b954eedeac495271d0f',
|
|
67
|
-
coingeckoId: 'dai',
|
|
68
|
-
currency: 'USD',
|
|
69
|
-
decimals: 18,
|
|
70
|
-
name: 'Dai Stablecoin',
|
|
71
|
-
standard: 'ERC-20',
|
|
72
|
-
symbol: 'DAI',
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
addressFormat: 'evm',
|
|
78
|
-
aliases: ['base', 'eip155:8453'],
|
|
79
|
-
id: 'eip155:8453',
|
|
80
|
-
kind: 'evm',
|
|
81
|
-
name: 'Base',
|
|
82
|
-
providerIds: {
|
|
83
|
-
across: '8453',
|
|
84
|
-
relay: '8453',
|
|
85
|
-
rhino: 'BASE',
|
|
86
|
-
symbiosis: '8453',
|
|
87
|
-
},
|
|
88
|
-
slug: 'base',
|
|
89
|
-
tokens: [
|
|
90
|
-
{
|
|
91
|
-
address: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913',
|
|
92
|
-
coingeckoId: 'usd-coin',
|
|
93
|
-
currency: 'USD',
|
|
94
|
-
decimals: 6,
|
|
95
|
-
name: 'USD Coin',
|
|
96
|
-
standard: 'ERC-20',
|
|
97
|
-
symbol: 'USDC',
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
address: '0xfde4c96c8593536e31f229ea8f37b2ada2699bb2',
|
|
101
|
-
coingeckoId: 'tether',
|
|
102
|
-
currency: 'USD',
|
|
103
|
-
decimals: 6,
|
|
104
|
-
name: 'Tether USD',
|
|
105
|
-
standard: 'ERC-20',
|
|
106
|
-
symbol: 'USDT',
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
address: '0x60a3e35cc302bfa44cb288bc5a4f316fdb1adb42',
|
|
110
|
-
coingeckoId: 'euro-coin',
|
|
111
|
-
currency: 'EUR',
|
|
112
|
-
decimals: 6,
|
|
113
|
-
name: 'Euro Coin',
|
|
114
|
-
standard: 'ERC-20',
|
|
115
|
-
symbol: 'EURC',
|
|
116
|
-
},
|
|
117
|
-
],
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
addressFormat: 'evm',
|
|
121
|
-
aliases: ['bnb', 'bsc', 'eip155:56'],
|
|
122
|
-
id: 'eip155:56',
|
|
123
|
-
kind: 'evm',
|
|
124
|
-
name: 'BNB Smart Chain',
|
|
125
|
-
providerIds: {
|
|
126
|
-
across: '56',
|
|
127
|
-
relay: '56',
|
|
128
|
-
symbiosis: '56',
|
|
129
|
-
},
|
|
130
|
-
slug: 'bnb',
|
|
131
|
-
tokens: [
|
|
132
|
-
{
|
|
133
|
-
address: '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d',
|
|
134
|
-
coingeckoId: 'usd-coin',
|
|
135
|
-
currency: 'USD',
|
|
136
|
-
decimals: 18,
|
|
137
|
-
name: 'Binance-Peg USD Coin',
|
|
138
|
-
standard: 'BEP-20',
|
|
139
|
-
symbol: 'USDC',
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
address: '0x55d398326f99059ff775485246999027b3197955',
|
|
143
|
-
coingeckoId: 'tether',
|
|
144
|
-
currency: 'USD',
|
|
145
|
-
decimals: 18,
|
|
146
|
-
name: 'Tether USD',
|
|
147
|
-
standard: 'BEP-20',
|
|
148
|
-
symbol: 'USDT',
|
|
149
|
-
},
|
|
150
|
-
],
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
addressFormat: 'base58',
|
|
154
|
-
aliases: ['solana', 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp'],
|
|
155
|
-
id: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',
|
|
156
|
-
kind: 'solana',
|
|
157
|
-
name: 'Solana',
|
|
158
|
-
providerIds: {
|
|
159
|
-
rhino: 'SOLANA',
|
|
160
|
-
},
|
|
161
|
-
slug: 'solana',
|
|
162
|
-
tokens: [
|
|
163
|
-
{
|
|
164
|
-
address: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
|
|
165
|
-
coingeckoId: 'usd-coin',
|
|
166
|
-
currency: 'USD',
|
|
167
|
-
decimals: 6,
|
|
168
|
-
name: 'USD Coin',
|
|
169
|
-
standard: 'SPL',
|
|
170
|
-
symbol: 'USDC',
|
|
171
|
-
},
|
|
172
|
-
],
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
addressFormat: 'base58check',
|
|
176
|
-
aliases: ['tron', 'tron:0x2b6653dc'],
|
|
177
|
-
id: 'tron:0x2b6653dc',
|
|
178
|
-
kind: 'tron',
|
|
179
|
-
name: 'Tron',
|
|
180
|
-
providerIds: {
|
|
181
|
-
rhino: 'TRON',
|
|
182
|
-
symbiosis: '728126428',
|
|
183
|
-
},
|
|
184
|
-
slug: 'tron',
|
|
185
|
-
tokens: [
|
|
186
|
-
{
|
|
187
|
-
address: 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',
|
|
188
|
-
coingeckoId: 'tether',
|
|
189
|
-
currency: 'USD',
|
|
190
|
-
decimals: 6,
|
|
191
|
-
name: 'Tether USD',
|
|
192
|
-
standard: 'TRC-20',
|
|
193
|
-
symbol: 'USDT',
|
|
194
|
-
},
|
|
195
|
-
],
|
|
196
|
-
},
|
|
197
|
-
] as const
|
|
198
|
-
|
|
199
|
-
/** Tempo destination tokens supported by funding quote providers. */
|
|
200
|
-
const destinationTokens = [
|
|
201
|
-
{
|
|
202
|
-
address: '0x20c0000000000000000000000000000000000000',
|
|
203
|
-
currency: 'USD',
|
|
204
|
-
decimals: 6,
|
|
205
|
-
name: 'pathUSD',
|
|
206
|
-
slug: 'pathusd',
|
|
207
|
-
standard: 'TIP-20',
|
|
208
|
-
symbol: 'pathUSD',
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
address: '0x20c000000000000000000000b9537d11c60e8b50',
|
|
212
|
-
currency: 'USD',
|
|
213
|
-
decimals: 6,
|
|
214
|
-
name: 'Bridged USDC (Stargate)',
|
|
215
|
-
slug: 'usdce',
|
|
216
|
-
standard: 'TIP-20',
|
|
217
|
-
symbol: 'USDC.e',
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
address: '0x20c0000000000000000000001621e21f71cf12fb',
|
|
221
|
-
currency: 'EUR',
|
|
222
|
-
decimals: 6,
|
|
223
|
-
name: 'Bridged EURC',
|
|
224
|
-
slug: 'eurce',
|
|
225
|
-
standard: 'TIP-20',
|
|
226
|
-
symbol: 'EURC.e',
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
address: '0x20c00000000000000000000014f22ca97301eb73',
|
|
230
|
-
currency: 'USD',
|
|
231
|
-
decimals: 6,
|
|
232
|
-
name: 'USDT0',
|
|
233
|
-
slug: 'usdt0',
|
|
234
|
-
standard: 'TIP-20',
|
|
235
|
-
symbol: 'USDT0',
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
address: '0x20c0000000000000000000003554d28269e0f3c2',
|
|
239
|
-
currency: 'USD',
|
|
240
|
-
decimals: 6,
|
|
241
|
-
name: 'frxUSD',
|
|
242
|
-
slug: 'frxusd',
|
|
243
|
-
standard: 'TIP-20',
|
|
244
|
-
symbol: 'frxUSD',
|
|
245
|
-
},
|
|
246
|
-
] as const
|
|
247
|
-
|
|
248
|
-
/** Providers supported by live funding quotes. */
|
|
249
|
-
const providers = [
|
|
250
|
-
{
|
|
251
|
-
id: 'across',
|
|
252
|
-
kind: 'intentBridge',
|
|
253
|
-
name: 'Across',
|
|
254
|
-
requiresApiKey: true,
|
|
255
|
-
status: 'unconfigured',
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
id: 'relay',
|
|
259
|
-
kind: 'solverNetwork',
|
|
260
|
-
name: 'Relay',
|
|
261
|
-
requiresApiKey: false,
|
|
262
|
-
status: 'unconfigured',
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
id: 'rhino',
|
|
266
|
-
kind: 'bridge',
|
|
267
|
-
name: 'Rhino',
|
|
268
|
-
requiresApiKey: false,
|
|
269
|
-
status: 'unconfigured',
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
id: 'squid',
|
|
273
|
-
kind: 'solverNetwork',
|
|
274
|
-
name: 'Squid',
|
|
275
|
-
requiresApiKey: true,
|
|
276
|
-
status: 'unconfigured',
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
id: 'symbiosis',
|
|
280
|
-
kind: 'crossChainDex',
|
|
281
|
-
name: 'Symbiosis',
|
|
282
|
-
requiresApiKey: false,
|
|
283
|
-
status: 'unconfigured',
|
|
284
|
-
},
|
|
285
|
-
] as const
|
|
286
|
-
|
|
287
|
-
type TokenInput = (typeof sourceChains)[number]['tokens'][number]
|
|
288
|
-
type DestinationTokenInput = (typeof destinationTokens)[number]
|
|
289
|
-
type ProviderInput = (typeof providers)[number]
|
|
290
|
-
type SourceChainInput = (typeof sourceChains)[number]
|
|
291
|
-
|
|
292
|
-
/** Provider ids accepted by funding quote requests. */
|
|
293
|
-
export type ProviderId = ProviderInput['id']
|
|
294
|
-
|
|
295
|
-
/** Provider-specific quote status for the requested amount. */
|
|
296
|
-
export type QuoteStatus = 'available' | 'thin' | 'unknown' | 'unavailable'
|
|
297
|
-
|
|
298
|
-
/** Machine-readable quote quality tier. */
|
|
299
|
-
export type QualityTier = 'liquid' | 'thin' | 'unknown' | 'unavailable'
|
|
300
|
-
|
|
301
|
-
/** Normalized chain reference passed to provider adapters. */
|
|
302
|
-
export type ChainRef = ReturnType<typeof formatChain> | typeof destinationChain
|
|
303
|
-
|
|
304
|
-
/** Normalized token amount passed to provider adapters. */
|
|
305
|
-
export type TokenAmount = ReturnType<typeof resolveSourceAmount>
|
|
306
|
-
|
|
307
|
-
/** Normalized token reference passed to provider adapters. */
|
|
308
|
-
export type TokenRef =
|
|
309
|
-
| ReturnType<typeof formatDestinationToken>
|
|
310
|
-
| ReturnType<typeof formatSourceToken>
|
|
311
|
-
|
|
312
|
-
/** A normalized internal candidate passed to funding quote providers. */
|
|
313
|
-
export type QuoteCandidate = ReturnType<typeof formatQuoteCandidate>
|
|
314
|
-
|
|
315
|
-
/** A successful normalized funding quote returned to callers. */
|
|
316
|
-
export type FundingQuote = ReturnType<typeof formatFundingQuote>
|
|
317
|
-
|
|
318
|
-
/** Cache policy for a single funding quote request. */
|
|
319
|
-
export type CachePolicy = {
|
|
320
|
-
/** Whether provider adapters should bypass their own quote or inventory caches. */
|
|
321
|
-
bypass: boolean
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
/** Normalized caller request passed to provider adapters. */
|
|
325
|
-
export type QuoteRequest = {
|
|
326
|
-
/** Optional Tempo destination token symbol, address, or token key. */
|
|
327
|
-
destinationToken?: string | undefined
|
|
328
|
-
/** Optional provider id filter. */
|
|
329
|
-
provider?: string | undefined
|
|
330
|
-
/** Source amount as supplied by the caller. */
|
|
331
|
-
sourceAmount: string
|
|
332
|
-
/** Unit used by {@link sourceAmount}. */
|
|
333
|
-
sourceAmountUnits: SourceAmountUnits
|
|
334
|
-
/** Chain alias or CAIP-2 source chain id. */
|
|
335
|
-
sourceChain: string
|
|
336
|
-
/** Source token symbol, contract address, mint, or Tempo token key. */
|
|
337
|
-
sourceToken: string
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
/** Input passed to a provider adapter for one curated quote candidate. */
|
|
341
|
-
export type QuoteProbeInput = {
|
|
342
|
-
/** Cache policy for provider-side discovery and quote lookups. */
|
|
343
|
-
cache: CachePolicy
|
|
344
|
-
/** Destination chain, always Tempo mainnet in V1. */
|
|
345
|
-
destinationChain: ChainRef
|
|
346
|
-
/** Tempo token expected from this quote. */
|
|
347
|
-
destinationToken: TokenRef
|
|
348
|
-
/** Normalized caller request that produced this quote candidate. */
|
|
349
|
-
request: QuoteRequest
|
|
350
|
-
/** Curated candidate selected for live provider quoting. */
|
|
351
|
-
candidate: QuoteCandidate
|
|
352
|
-
/** Source amount in base units and display form. */
|
|
353
|
-
sourceAmount: TokenAmount
|
|
354
|
-
/** Chain where the caller currently holds funds. */
|
|
355
|
-
sourceChain: ChainRef
|
|
356
|
-
/** Token the caller currently holds. */
|
|
357
|
-
sourceToken: TokenRef
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
/** Quote probe data returned by a provider adapter. */
|
|
361
|
-
export type QuoteProbeResult = {
|
|
362
|
-
/** Timestamp after which the provider quote is no longer valid. */
|
|
363
|
-
expiresAt?: string | undefined
|
|
364
|
-
/** Slippage-adjusted minimum destination amount in base units. */
|
|
365
|
-
minimumOutputAmount?: string | undefined
|
|
366
|
-
/** Expected destination amount in base units. */
|
|
367
|
-
outputAmount?: string | undefined
|
|
368
|
-
/** Timestamp for the live quote probe. */
|
|
369
|
-
sampledAt: string
|
|
370
|
-
/** Provider-specific quote status for the requested amount. */
|
|
371
|
-
status: QuoteStatus
|
|
372
|
-
/** Provider-backed quote quality metadata. */
|
|
373
|
-
quality?: {
|
|
374
|
-
/** Estimated settlement time in seconds, when known. */
|
|
375
|
-
estimatedSeconds?: number | undefined
|
|
376
|
-
/** Where the live liquidity or support signal came from. */
|
|
377
|
-
liquiditySource: string
|
|
378
|
-
/** Provider-specific quote source or endpoint detail. */
|
|
379
|
-
sourceDetail?: string | undefined
|
|
380
|
-
/** Machine-readable quote quality tier. */
|
|
381
|
-
tier?: QualityTier | undefined
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
/** Adapter used to request a live provider quote. */
|
|
386
|
-
export type ProviderAdapter = {
|
|
387
|
-
/** Probes provider-backed quote information for one static candidate. */
|
|
388
|
-
probeQuote(input: QuoteProbeInput, signal: AbortSignal): Promise<QuoteProbeResult>
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
/** Provider adapter registry, keyed by provider id. */
|
|
392
|
-
export type ProviderAdapters = Partial<Record<ProviderId, ProviderAdapter>>
|
|
393
|
-
|
|
394
|
-
/** One configured provider attempt made while resolving a funding quote request. */
|
|
395
|
-
export type ProviderAttempt =
|
|
396
|
-
| {
|
|
397
|
-
/** Wall-clock duration of the provider attempt in milliseconds. */
|
|
398
|
-
durationMs: number
|
|
399
|
-
/** Successful or expected-unavailable provider outcome. */
|
|
400
|
-
outcome: 'available' | 'thin' | 'unavailable'
|
|
401
|
-
/** Provider that handled the quote candidate. */
|
|
402
|
-
provider: ProviderId
|
|
403
|
-
}
|
|
404
|
-
| {
|
|
405
|
-
/** Error thrown by the provider boundary. */
|
|
406
|
-
cause: unknown
|
|
407
|
-
/** Wall-clock duration of the provider attempt in milliseconds. */
|
|
408
|
-
durationMs: number
|
|
409
|
-
/** Failed provider outcome. */
|
|
410
|
-
outcome: 'failed'
|
|
411
|
-
/** Provider that handled the quote candidate. */
|
|
412
|
-
provider: ProviderId
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
/** A provider adapter failure retained for bounded request diagnostics. */
|
|
416
|
-
export type ProviderFailure = {
|
|
417
|
-
/** Error thrown by the provider boundary. */
|
|
418
|
-
cause: unknown
|
|
419
|
-
/** Provider that failed. */
|
|
420
|
-
provider: ProviderId
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
/** Curated provider support rows used to select live quote probes. */
|
|
424
|
-
const inventory: readonly InventoryEntry[] = [
|
|
425
|
-
{ destinationToken: 'usdce', provider: 'across', sourceChains: ['ethereum', 'base', 'bnb'], sourceTokens: ['USDC'] }, // prettier-ignore
|
|
426
|
-
{ destinationToken: 'usdce', provider: 'relay', sourceChains: ['ethereum', 'base', 'bnb'], sourceTokens: ['USDC', 'USDT'] }, // prettier-ignore
|
|
427
|
-
{ destinationToken: 'usdce', provider: 'rhino', sourceChains: ['base', 'solana'], sourceTokens: ['USDC'] }, // prettier-ignore
|
|
428
|
-
{ destinationToken: 'usdce', provider: 'squid', sourceChains: ['ethereum', 'base', 'bnb'], sourceTokens: ['USDC'] }, // prettier-ignore
|
|
429
|
-
{ destinationToken: 'usdce', provider: 'symbiosis', sourceChains: ['ethereum', 'base', 'bnb'], sourceTokens: ['USDC'] }, // prettier-ignore
|
|
430
|
-
{ destinationToken: 'usdt0', provider: 'rhino', sourceChains: ['tron'], sourceTokens: ['USDT'] }, // prettier-ignore
|
|
431
|
-
{ destinationToken: 'usdt0', provider: 'squid', sourceChains: ['ethereum', 'base', 'bnb'], sourceTokens: ['USDT'] }, // prettier-ignore
|
|
432
|
-
{ destinationToken: 'usdt0', provider: 'symbiosis', sourceChains: ['ethereum', 'base', 'bnb', 'tron'], sourceTokens: ['USDT'] }, // prettier-ignore
|
|
433
|
-
]
|
|
434
|
-
|
|
435
|
-
type InventoryEntry = {
|
|
436
|
-
destinationToken: string
|
|
437
|
-
provider: ProviderInput['id']
|
|
438
|
-
sourceChains: readonly string[]
|
|
439
|
-
sourceTokens: readonly string[]
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
const defaultAdapterTimeoutMs = 2_000
|
|
443
|
-
|
|
444
|
-
/** Lists normalized chains and source tokens supported by quote providers. */
|
|
445
|
-
export function listChains() {
|
|
446
|
-
return sourceChains.flatMap((chain) => {
|
|
447
|
-
const symbols = new Set(
|
|
448
|
-
inventory
|
|
449
|
-
.filter((entry) => entry.sourceChains.includes(chain.slug))
|
|
450
|
-
.flatMap((entry) => entry.sourceTokens),
|
|
451
|
-
)
|
|
452
|
-
if (symbols.size === 0) return []
|
|
453
|
-
return [
|
|
454
|
-
{
|
|
455
|
-
...formatChain(chain),
|
|
456
|
-
tokens: chain.tokens
|
|
457
|
-
.filter((token) => symbols.has(token.symbol))
|
|
458
|
-
.map((token) => formatSourceToken(chain, token)),
|
|
459
|
-
},
|
|
460
|
-
]
|
|
461
|
-
})
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
/** Lists funding quote providers and their deployment status. */
|
|
465
|
-
export function listProviders(options: listProviders.Options = {}) {
|
|
466
|
-
return providers.map((provider) => ({
|
|
467
|
-
...formatProvider(provider),
|
|
468
|
-
status: options.adapters?.[provider.id] ? ('configured' as const) : provider.status,
|
|
469
|
-
}))
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
export declare namespace listProviders {
|
|
473
|
-
/** Options for listing providers. */
|
|
474
|
-
type Options = {
|
|
475
|
-
/** Provider adapters configured for this deployment. */
|
|
476
|
-
adapters?: ProviderAdapters | undefined
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
/** Returns successful live funding quotes from configured providers. */
|
|
481
|
-
export async function listQuotes(options: listQuotes.Options) {
|
|
482
|
-
const adapters = options.adapters ?? {}
|
|
483
|
-
const candidates = listQuoteCandidates(options).flatMap((candidate) => {
|
|
484
|
-
const adapter = adapters[candidate.provider.id as ProviderId]
|
|
485
|
-
return adapter ? [{ adapter, candidate }] : []
|
|
486
|
-
})
|
|
487
|
-
const attempts = new Map<number, ProviderAttempt>()
|
|
488
|
-
const results = await Promise.allSettled(
|
|
489
|
-
candidates.map(async ({ adapter, candidate }, index) => {
|
|
490
|
-
const start = performance.now()
|
|
491
|
-
try {
|
|
492
|
-
const result = await quoteCandidate(candidate, {
|
|
493
|
-
adapter,
|
|
494
|
-
cache: options.cache ?? { bypass: false },
|
|
495
|
-
request: {
|
|
496
|
-
destinationToken: options.destinationToken,
|
|
497
|
-
provider: options.provider,
|
|
498
|
-
sourceAmount: options.sourceAmount,
|
|
499
|
-
sourceAmountUnits: options.sourceAmountUnits,
|
|
500
|
-
sourceChain: options.sourceChain,
|
|
501
|
-
sourceToken: options.sourceToken,
|
|
502
|
-
},
|
|
503
|
-
timeoutMs: options.adapterTimeoutMs ?? defaultAdapterTimeoutMs,
|
|
504
|
-
})
|
|
505
|
-
attempts.set(index, {
|
|
506
|
-
durationMs: performance.now() - start,
|
|
507
|
-
outcome: result.outcome,
|
|
508
|
-
provider: candidate.provider.id,
|
|
509
|
-
})
|
|
510
|
-
return 'quote' in result ? result.quote : undefined
|
|
511
|
-
} catch (cause) {
|
|
512
|
-
attempts.set(index, {
|
|
513
|
-
cause,
|
|
514
|
-
durationMs: performance.now() - start,
|
|
515
|
-
outcome: 'failed',
|
|
516
|
-
provider: candidate.provider.id,
|
|
517
|
-
})
|
|
518
|
-
throw cause
|
|
519
|
-
}
|
|
520
|
-
}),
|
|
521
|
-
)
|
|
522
|
-
for (const index of candidates.keys()) {
|
|
523
|
-
const attempt = attempts.get(index)
|
|
524
|
-
if (!attempt) continue
|
|
525
|
-
try {
|
|
526
|
-
options.onAttempt?.(attempt)
|
|
527
|
-
} catch {
|
|
528
|
-
// Observability hooks never alter funding quote behavior.
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
const quotes = results.flatMap((result) =>
|
|
532
|
-
result.status === 'fulfilled' && result.value ? [result.value] : [],
|
|
533
|
-
)
|
|
534
|
-
const failures = results.flatMap((result, index) =>
|
|
535
|
-
result.status === 'rejected'
|
|
536
|
-
? [{ cause: result.reason, provider: candidates[index]!.candidate.provider.id }]
|
|
537
|
-
: [],
|
|
538
|
-
)
|
|
539
|
-
if (quotes.length === 0 && failures.length > 0) throw new ProviderQuoteError(failures)
|
|
540
|
-
return quotes
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
/** Lists internal quote candidates for a normalized caller request. */
|
|
544
|
-
export function listQuoteCandidates(options: listQuoteCandidates.Options) {
|
|
545
|
-
const sourceChain = resolveSourceChain(options.sourceChain)
|
|
546
|
-
const sourceToken = resolveSourceToken(sourceChain, options.sourceToken)
|
|
547
|
-
const destinationToken = resolveDestinationToken(options.destinationToken)
|
|
548
|
-
const provider = options.provider ? resolveProvider(options.provider) : undefined
|
|
549
|
-
|
|
550
|
-
if (!sourceToken) {
|
|
551
|
-
validateSourceAmountSyntax(options.sourceAmount, options.sourceAmountUnits)
|
|
552
|
-
return []
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
const sourceAmount = resolveSourceAmount({
|
|
556
|
-
amount: options.sourceAmount,
|
|
557
|
-
token: sourceToken,
|
|
558
|
-
units: options.sourceAmountUnits,
|
|
559
|
-
})
|
|
560
|
-
|
|
561
|
-
return inventory
|
|
562
|
-
.filter((entry) => entry.sourceChains.includes(sourceChain.slug))
|
|
563
|
-
.filter((entry) => entry.sourceTokens.includes(sourceToken.symbol))
|
|
564
|
-
.filter((entry) => entry.destinationToken === destinationToken.slug)
|
|
565
|
-
.filter((entry) => provider === undefined || entry.provider === provider.id)
|
|
566
|
-
.map((entry) =>
|
|
567
|
-
formatQuoteCandidate({
|
|
568
|
-
destinationToken,
|
|
569
|
-
provider: providers.find((candidate) => candidate.id === entry.provider)!,
|
|
570
|
-
sourceAmount,
|
|
571
|
-
sourceChain,
|
|
572
|
-
sourceToken,
|
|
573
|
-
}),
|
|
574
|
-
)
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
export declare namespace listQuoteCandidates {
|
|
578
|
-
/** Options for selecting funding quote candidates. */
|
|
579
|
-
type Options = {
|
|
580
|
-
/** Optional Tempo destination token symbol, address, or token key. */
|
|
581
|
-
destinationToken?: string | undefined
|
|
582
|
-
/** Optional provider id filter. */
|
|
583
|
-
provider?: string | undefined
|
|
584
|
-
/** Source amount as supplied by the caller. */
|
|
585
|
-
sourceAmount: string
|
|
586
|
-
/** Unit used by {@link sourceAmount}. */
|
|
587
|
-
sourceAmountUnits: SourceAmountUnits
|
|
588
|
-
/** Chain alias or CAIP-2 source chain id. */
|
|
589
|
-
sourceChain: string
|
|
590
|
-
/** Source token symbol, contract address, mint, or Tempo token key. */
|
|
591
|
-
sourceToken: string
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
export declare namespace listQuotes {
|
|
596
|
-
/** Options for requesting live funding quotes. */
|
|
597
|
-
type Options = listQuoteCandidates.Options & {
|
|
598
|
-
/** Provider adapters used to request live quotes. */
|
|
599
|
-
adapters?: ProviderAdapters | undefined
|
|
600
|
-
/** Per-provider quote timeout in milliseconds. */
|
|
601
|
-
adapterTimeoutMs?: number | undefined
|
|
602
|
-
/** Cache policy for provider-side discovery and quote lookups. */
|
|
603
|
-
cache?: CachePolicy | undefined
|
|
604
|
-
/** Receives one bounded observation for every configured provider attempt. */
|
|
605
|
-
onAttempt?: ((attempt: ProviderAttempt) => void) | undefined
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
/** Source amount unit accepted by the funding quote request. */
|
|
610
|
-
export type SourceAmountUnits = 'baseUnits' | 'decimal'
|
|
611
|
-
|
|
612
|
-
function tokenKey(chain: { id: string; kind: string }, token: TokenInput | DestinationTokenInput) {
|
|
613
|
-
const namespace = (() => {
|
|
614
|
-
if (chain.kind === 'solana') return 'token'
|
|
615
|
-
if (chain.kind === 'tron') return 'trc20'
|
|
616
|
-
return 'erc20'
|
|
617
|
-
})()
|
|
618
|
-
return `${chain.id}/${namespace}:${token.address}`
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
function decimalFromBaseUnits(baseUnits: string, decimals: number) {
|
|
622
|
-
const padded = baseUnits.padStart(decimals + 1, '0')
|
|
623
|
-
const whole = decimals === 0 ? padded : padded.slice(0, -decimals)
|
|
624
|
-
const fraction = decimals === 0 ? '' : padded.slice(-decimals).replace(/0+$/, '')
|
|
625
|
-
return fraction ? `${whole}.${fraction}` : whole
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
async function quoteCandidate(
|
|
629
|
-
candidate: QuoteCandidate,
|
|
630
|
-
options: {
|
|
631
|
-
adapter: ProviderAdapter
|
|
632
|
-
cache: CachePolicy
|
|
633
|
-
request: QuoteRequest
|
|
634
|
-
timeoutMs: number
|
|
635
|
-
},
|
|
636
|
-
) {
|
|
637
|
-
const quote = await runWithTimeout(
|
|
638
|
-
(signal) =>
|
|
639
|
-
options.adapter.probeQuote(
|
|
640
|
-
{
|
|
641
|
-
cache: options.cache,
|
|
642
|
-
destinationChain: candidate.destinationChain,
|
|
643
|
-
destinationToken: candidate.destinationToken,
|
|
644
|
-
request: options.request,
|
|
645
|
-
candidate,
|
|
646
|
-
sourceAmount: candidate.sourceAmount,
|
|
647
|
-
sourceChain: candidate.sourceChain,
|
|
648
|
-
sourceToken: candidate.sourceToken,
|
|
649
|
-
},
|
|
650
|
-
signal,
|
|
651
|
-
),
|
|
652
|
-
options.timeoutMs,
|
|
653
|
-
)
|
|
654
|
-
if (quote.status === 'unavailable') return { outcome: quote.status }
|
|
655
|
-
if (
|
|
656
|
-
(quote.status !== 'available' && quote.status !== 'thin') ||
|
|
657
|
-
quote.outputAmount === undefined ||
|
|
658
|
-
quote.outputAmount === null
|
|
659
|
-
)
|
|
660
|
-
throw new InvalidProviderQuoteError()
|
|
661
|
-
return {
|
|
662
|
-
outcome: quote.status,
|
|
663
|
-
quote: formatFundingQuote(candidate, {
|
|
664
|
-
...quote,
|
|
665
|
-
outputAmount: quote.outputAmount,
|
|
666
|
-
status: quote.status,
|
|
667
|
-
}),
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
function formatChain(chain: SourceChainInput) {
|
|
672
|
-
const { addressFormat, id, kind, name, providerIds } = chain
|
|
673
|
-
return { addressFormat, id, kind, name, providerIds }
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
function formatDestinationToken(token: DestinationTokenInput) {
|
|
677
|
-
return {
|
|
678
|
-
address: token.address,
|
|
679
|
-
currency: token.currency,
|
|
680
|
-
decimals: token.decimals,
|
|
681
|
-
metadata: {},
|
|
682
|
-
name: token.name,
|
|
683
|
-
standard: token.standard,
|
|
684
|
-
symbol: token.symbol,
|
|
685
|
-
tokenKey: tokenKey(destinationChain, token),
|
|
686
|
-
verified: true,
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
function formatProvider(provider: ProviderInput) {
|
|
691
|
-
const { id, kind, name, requiresApiKey, status } = provider
|
|
692
|
-
return { id, kind, name, requiresApiKey, status }
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
function formatProviderRef(provider: ProviderInput) {
|
|
696
|
-
const { id, kind, name, requiresApiKey } = provider
|
|
697
|
-
return { id, kind, name, requiresApiKey }
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
function formatQuoteCandidate(options: {
|
|
701
|
-
destinationToken: DestinationTokenInput
|
|
702
|
-
provider: ProviderInput
|
|
703
|
-
sourceAmount: ReturnType<typeof resolveSourceAmount>
|
|
704
|
-
sourceChain: SourceChainInput
|
|
705
|
-
sourceToken: TokenInput
|
|
706
|
-
}) {
|
|
707
|
-
return {
|
|
708
|
-
destinationChain,
|
|
709
|
-
destinationToken: formatDestinationToken(options.destinationToken),
|
|
710
|
-
id: [
|
|
711
|
-
options.sourceChain.slug,
|
|
712
|
-
options.sourceToken.symbol.toLowerCase(),
|
|
713
|
-
'tempo',
|
|
714
|
-
options.destinationToken.slug,
|
|
715
|
-
options.provider.id,
|
|
716
|
-
].join('-'),
|
|
717
|
-
provider: formatProviderRef(options.provider),
|
|
718
|
-
sourceAmount: options.sourceAmount,
|
|
719
|
-
sourceChain: formatChain(options.sourceChain),
|
|
720
|
-
sourceToken: formatSourceToken(options.sourceChain, options.sourceToken),
|
|
721
|
-
} as const
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
function formatSourceToken(chain: SourceChainInput, token: TokenInput) {
|
|
725
|
-
return {
|
|
726
|
-
address: token.address,
|
|
727
|
-
currency: token.currency,
|
|
728
|
-
decimals: token.decimals,
|
|
729
|
-
metadata: { coingeckoId: token.coingeckoId },
|
|
730
|
-
name: token.name,
|
|
731
|
-
standard: token.standard,
|
|
732
|
-
symbol: token.symbol,
|
|
733
|
-
tokenKey: tokenKey(chain, token),
|
|
734
|
-
verified: true,
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
function normalizeInput(value: string) {
|
|
739
|
-
return value.trim().toLowerCase()
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
function parseBaseUnits(value: string) {
|
|
743
|
-
if (!/^\d+$/.test(value) || BigInt(value) <= 0n) throw new InvalidAmountError()
|
|
744
|
-
return BigInt(value).toString()
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
function parseDecimalUnits(value: string, decimals: number) {
|
|
748
|
-
if (!/^\d+(\.\d+)?$/.test(value)) throw new InvalidAmountError()
|
|
749
|
-
const [whole, fraction = ''] = value.split('.')
|
|
750
|
-
if (fraction.length > decimals) throw new InvalidAmountError()
|
|
751
|
-
const baseUnits = BigInt(`${whole}${fraction.padEnd(decimals, '0')}`)
|
|
752
|
-
if (baseUnits <= 0n) throw new InvalidAmountError()
|
|
753
|
-
return baseUnits.toString()
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
type SuccessfulQuoteProbe = QuoteProbeResult & {
|
|
757
|
-
outputAmount: string
|
|
758
|
-
status: 'available' | 'thin'
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
function formatFundingQuote(candidate: QuoteCandidate, quote: SuccessfulQuoteProbe) {
|
|
762
|
-
return {
|
|
763
|
-
destinationAmount: Value.tokenAmount({
|
|
764
|
-
baseUnits: quote.outputAmount,
|
|
765
|
-
currency: candidate.destinationToken.currency,
|
|
766
|
-
decimals: candidate.destinationToken.decimals,
|
|
767
|
-
}),
|
|
768
|
-
...(quote.minimumOutputAmount !== undefined
|
|
769
|
-
? {
|
|
770
|
-
destinationAmountMin: Value.tokenAmount({
|
|
771
|
-
baseUnits: quote.minimumOutputAmount,
|
|
772
|
-
currency: candidate.destinationToken.currency,
|
|
773
|
-
decimals: candidate.destinationToken.decimals,
|
|
774
|
-
}),
|
|
775
|
-
}
|
|
776
|
-
: {}),
|
|
777
|
-
destinationChain: candidate.destinationChain,
|
|
778
|
-
destinationToken: candidate.destinationToken,
|
|
779
|
-
id: candidate.id,
|
|
780
|
-
provider: candidate.provider,
|
|
781
|
-
quality: {
|
|
782
|
-
...(quote.quality?.estimatedSeconds !== undefined
|
|
783
|
-
? { estimatedSeconds: quote.quality.estimatedSeconds }
|
|
784
|
-
: {}),
|
|
785
|
-
liquiditySource: quote.quality?.liquiditySource ?? 'providerQuote',
|
|
786
|
-
...(quote.quality?.sourceDetail !== undefined
|
|
787
|
-
? { sourceDetail: quote.quality.sourceDetail }
|
|
788
|
-
: {}),
|
|
789
|
-
tier: quote.status === 'thin' ? ('thin' as const) : ('liquid' as const),
|
|
790
|
-
},
|
|
791
|
-
quote: {
|
|
792
|
-
...(quote.expiresAt !== undefined ? { expiresAt: quote.expiresAt } : {}),
|
|
793
|
-
sampledAt: quote.sampledAt,
|
|
794
|
-
},
|
|
795
|
-
sourceAmount: Value.tokenAmount({
|
|
796
|
-
baseUnits: candidate.sourceAmount.amount,
|
|
797
|
-
currency: candidate.sourceToken.currency,
|
|
798
|
-
decimals: candidate.sourceToken.decimals,
|
|
799
|
-
}),
|
|
800
|
-
sourceChain: candidate.sourceChain,
|
|
801
|
-
sourceToken: candidate.sourceToken,
|
|
802
|
-
} as const
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
function runWithTimeout<result>(fn: (signal: AbortSignal) => Promise<result>, timeoutMs: number) {
|
|
806
|
-
const controller = new AbortController()
|
|
807
|
-
const timeout = setTimeout(() => controller.abort(), timeoutMs)
|
|
808
|
-
return Promise.race([
|
|
809
|
-
fn(controller.signal),
|
|
810
|
-
new Promise<never>((_, reject) => {
|
|
811
|
-
if (controller.signal.aborted) {
|
|
812
|
-
reject(new ProviderAdapterTimeoutError())
|
|
813
|
-
return
|
|
814
|
-
}
|
|
815
|
-
controller.signal.addEventListener('abort', () => reject(new ProviderAdapterTimeoutError()), {
|
|
816
|
-
once: true,
|
|
817
|
-
})
|
|
818
|
-
}),
|
|
819
|
-
]).finally(() => clearTimeout(timeout))
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
function resolveDestinationToken(input: string | undefined) {
|
|
823
|
-
if (input === undefined) return destinationTokens.find((token) => token.slug === defaultDestinationToken)! // prettier-ignore
|
|
824
|
-
const normalized = normalizeInput(input)
|
|
825
|
-
const token = destinationTokens.find(
|
|
826
|
-
(candidate) =>
|
|
827
|
-
candidate.slug === normalized ||
|
|
828
|
-
candidate.symbol.toLowerCase() === normalized ||
|
|
829
|
-
candidate.address === normalized ||
|
|
830
|
-
tokenKey(destinationChain, candidate).toLowerCase() === normalized,
|
|
831
|
-
)
|
|
832
|
-
if (!token) throw new UnsupportedDestinationTokenError()
|
|
833
|
-
return token
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
function resolveProvider(input: string) {
|
|
837
|
-
const provider = providers.find((candidate) => candidate.id === normalizeInput(input))
|
|
838
|
-
if (!provider) throw new UnsupportedProviderError()
|
|
839
|
-
return provider
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
function resolveSourceAmount(options: resolveSourceAmount.Options) {
|
|
843
|
-
const amount =
|
|
844
|
-
options.units === 'baseUnits'
|
|
845
|
-
? parseBaseUnits(options.amount)
|
|
846
|
-
: parseDecimalUnits(options.amount, options.token.decimals)
|
|
847
|
-
return {
|
|
848
|
-
amount,
|
|
849
|
-
formatted: decimalFromBaseUnits(amount, options.token.decimals),
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
declare namespace resolveSourceAmount {
|
|
854
|
-
type Options = {
|
|
855
|
-
amount: string
|
|
856
|
-
token: TokenInput
|
|
857
|
-
units: SourceAmountUnits
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
function resolveSourceToken(chain: SourceChainInput, input: string) {
|
|
862
|
-
const trimmed = input.trim()
|
|
863
|
-
const normalized = trimmed.toLowerCase()
|
|
864
|
-
return chain.tokens.find(
|
|
865
|
-
(token) =>
|
|
866
|
-
token.symbol.toLowerCase() === normalized ||
|
|
867
|
-
matchesTokenIdentifier(chain, token.address, trimmed, normalized) ||
|
|
868
|
-
matchesTokenIdentifier(chain, tokenKey(chain, token), trimmed, normalized),
|
|
869
|
-
)
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
function matchesTokenIdentifier(
|
|
873
|
-
chain: SourceChainInput,
|
|
874
|
-
candidate: string,
|
|
875
|
-
trimmed: string,
|
|
876
|
-
normalized: string,
|
|
877
|
-
) {
|
|
878
|
-
return chain.kind === 'evm' ? candidate.toLowerCase() === normalized : candidate === trimmed
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
function resolveSourceChain(input: string) {
|
|
882
|
-
const trimmed = input.trim()
|
|
883
|
-
const normalized = normalizeInput(input)
|
|
884
|
-
const chain = sourceChains.find(
|
|
885
|
-
(candidate) =>
|
|
886
|
-
candidate.id === trimmed ||
|
|
887
|
-
candidate.slug === normalized ||
|
|
888
|
-
(candidate.kind === 'evm' && (candidate.aliases as readonly string[]).includes(normalized)),
|
|
889
|
-
)
|
|
890
|
-
if (!chain) throw new UnsupportedSourceChainError()
|
|
891
|
-
return chain
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
function validateSourceAmountSyntax(value: string, units: SourceAmountUnits) {
|
|
895
|
-
if (units === 'baseUnits') {
|
|
896
|
-
parseBaseUnits(value)
|
|
897
|
-
return
|
|
898
|
-
}
|
|
899
|
-
if (!/^\d+(\.\d+)?$/.test(value)) throw new InvalidAmountError()
|
|
900
|
-
const [whole, fraction = ''] = value.split('.')
|
|
901
|
-
if (BigInt(`${whole}${fraction}`) <= 0n) throw new InvalidAmountError()
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
/** Error thrown when the caller supplies an unsupported destination token. */
|
|
905
|
-
export class UnsupportedDestinationTokenError extends Error {
|
|
906
|
-
override name = 'FundingQuotes.UnsupportedDestinationTokenError'
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
/** Error thrown when the caller supplies an invalid source amount. */
|
|
910
|
-
export class InvalidAmountError extends Error {
|
|
911
|
-
override name = 'FundingQuotes.InvalidAmountError'
|
|
912
|
-
}
|
|
913
|
-
|
|
914
|
-
/** Error thrown internally when a provider adapter exceeds its quote timeout. */
|
|
915
|
-
export class ProviderAdapterTimeoutError extends Error {
|
|
916
|
-
override name = 'FundingQuotes.ProviderAdapterTimeoutError'
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
/** Error thrown when every matching provider fails to produce a quote. */
|
|
920
|
-
export class ProviderQuoteError extends Error {
|
|
921
|
-
override name = 'FundingQuotes.ProviderQuoteError'
|
|
922
|
-
|
|
923
|
-
/** Provider failures that prevented a successful quote. */
|
|
924
|
-
failures: readonly ProviderFailure[]
|
|
925
|
-
|
|
926
|
-
constructor(failures: readonly ProviderFailure[]) {
|
|
927
|
-
super()
|
|
928
|
-
this.failures = failures
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
|
|
932
|
-
/** Error thrown when the caller filters to an unknown provider. */
|
|
933
|
-
export class UnsupportedProviderError extends Error {
|
|
934
|
-
override name = 'FundingQuotes.UnsupportedProviderError'
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
/** Error thrown when the caller supplies an unsupported source chain. */
|
|
938
|
-
export class UnsupportedSourceChainError extends Error {
|
|
939
|
-
override name = 'FundingQuotes.UnsupportedSourceChainError'
|
|
940
|
-
}
|
|
941
|
-
|
|
942
|
-
class InvalidProviderQuoteError extends Error {
|
|
943
|
-
override name = 'FundingQuotes.InvalidProviderQuoteError'
|
|
944
|
-
}
|