tapimo 0.1.0 → 0.3.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 +57 -16
- package/dist/ApiKey.d.ts +4 -1
- package/dist/ApiKey.d.ts.map +1 -1
- package/dist/ApiKey.js +6 -2
- package/dist/ApiKey.js.map +1 -1
- package/dist/ApiKeys.d.ts +98 -3
- package/dist/ApiKeys.d.ts.map +1 -1
- package/dist/ApiKeys.js +150 -1
- package/dist/ApiKeys.js.map +1 -1
- package/dist/App.d.ts +7917 -2315
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +141 -329
- package/dist/App.js.map +1 -1
- package/dist/Scope.d.ts +20 -4
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +23 -4
- package/dist/Scope.js.map +1 -1
- package/dist/Webhooks.d.ts +2 -2
- package/dist/Webhooks.d.ts.map +1 -1
- package/dist/Webhooks.js +2 -2
- package/dist/Webhooks.js.map +1 -1
- package/dist/admin/App.d.ts +203 -120
- package/dist/admin/App.d.ts.map +1 -1
- package/dist/admin/apps/api-keys.d.ts +111 -6
- package/dist/admin/apps/api-keys.d.ts.map +1 -1
- package/dist/admin/apps/api-keys.js +67 -0
- package/dist/admin/apps/api-keys.js.map +1 -1
- package/dist/admin/apps/scopes.d.ts +12 -1
- package/dist/admin/apps/scopes.d.ts.map +1 -1
- package/dist/admin/apps/scopes.js +3 -0
- package/dist/admin/apps/scopes.js.map +1 -1
- package/dist/admin/apps/verified-tokens.d.ts +116 -116
- package/dist/admin/apps/verified-tokens.js +1 -1
- package/dist/admin/apps/verified-tokens.js.map +1 -1
- package/dist/admin/ui.generated.d.ts +1 -1
- package/dist/admin/ui.generated.js +13 -13
- package/dist/admin/ui.generated.js.map +1 -1
- package/dist/analytics/Analytics.d.ts +151 -0
- package/dist/analytics/Analytics.d.ts.map +1 -0
- package/dist/analytics/Analytics.js +212 -0
- package/dist/analytics/Analytics.js.map +1 -0
- package/dist/analytics/tables/requestEvents.d.ts +215 -0
- package/dist/analytics/tables/requestEvents.d.ts.map +1 -0
- package/dist/analytics/tables/requestEvents.js +264 -0
- package/dist/analytics/tables/requestEvents.js.map +1 -0
- package/dist/apps/data/App.d.ts +19576 -0
- package/dist/apps/data/App.d.ts.map +1 -0
- package/dist/apps/data/App.js +272 -0
- package/dist/apps/data/App.js.map +1 -0
- package/dist/apps/data/index.d.ts +3 -0
- package/dist/apps/data/index.d.ts.map +1 -0
- package/dist/apps/data/index.js +3 -0
- package/dist/apps/data/index.js.map +1 -0
- package/dist/apps/{activities.d.ts → data/routes/activities.d.ts} +32 -32
- package/dist/apps/{activities.d.ts.map → data/routes/activities.d.ts.map} +1 -1
- package/dist/apps/{activities.js → data/routes/activities.js} +13 -13
- package/dist/apps/data/routes/activities.js.map +1 -0
- package/dist/apps/{addresses.d.ts → data/routes/addresses.d.ts} +22 -22
- package/dist/apps/{addresses.d.ts.map → data/routes/addresses.d.ts.map} +1 -1
- package/dist/apps/{addresses.js → data/routes/addresses.js} +5 -5
- package/dist/apps/data/routes/addresses.js.map +1 -0
- package/dist/apps/{balances.d.ts → data/routes/balances.d.ts} +4 -4
- package/dist/apps/data/routes/balances.d.ts.map +1 -0
- package/dist/apps/{balances.js → data/routes/balances.js} +42 -11
- package/dist/apps/data/routes/balances.js.map +1 -0
- package/dist/apps/{blocks.d.ts → data/routes/blocks.d.ts} +47 -47
- package/dist/apps/data/routes/blocks.d.ts.map +1 -0
- package/dist/apps/{blocks.js → data/routes/blocks.js} +13 -13
- package/dist/apps/data/routes/blocks.js.map +1 -0
- package/dist/apps/{coingecko.d.ts → data/routes/coingecko.d.ts} +8 -8
- package/dist/apps/data/routes/coingecko.d.ts.map +1 -0
- package/dist/apps/{coingecko.js → data/routes/coingecko.js} +13 -13
- package/dist/apps/data/routes/coingecko.js.map +1 -0
- package/dist/apps/{exchanges.d.ts → data/routes/exchanges.d.ts} +108 -108
- package/dist/apps/data/routes/exchanges.d.ts.map +1 -0
- package/dist/apps/{exchanges.js → data/routes/exchanges.js} +19 -19
- package/dist/apps/data/routes/exchanges.js.map +1 -0
- package/dist/apps/{fee-amm.d.ts → data/routes/fee-amm.d.ts} +39 -39
- package/dist/apps/data/routes/fee-amm.d.ts.map +1 -0
- package/dist/apps/{fee-amm.js → data/routes/fee-amm.js} +17 -17
- package/dist/apps/data/routes/fee-amm.js.map +1 -0
- package/dist/apps/data/routes/funding.d.ts +765 -0
- package/dist/apps/data/routes/funding.d.ts.map +1 -0
- package/dist/apps/data/routes/funding.js +383 -0
- package/dist/apps/data/routes/funding.js.map +1 -0
- package/dist/apps/{indexer.d.ts → data/routes/indexer.d.ts} +4 -4
- package/dist/apps/data/routes/indexer.d.ts.map +1 -0
- package/dist/apps/{indexer.js → data/routes/indexer.js} +13 -9
- package/dist/apps/data/routes/indexer.js.map +1 -0
- package/dist/apps/{receipts.d.ts → data/routes/receipts.d.ts} +49 -49
- package/dist/apps/data/routes/receipts.d.ts.map +1 -0
- package/dist/apps/{receipts.js → data/routes/receipts.js} +14 -20
- package/dist/apps/data/routes/receipts.js.map +1 -0
- package/dist/apps/{rpc.d.ts → data/routes/rpc.d.ts} +33 -40
- package/dist/apps/data/routes/rpc.d.ts.map +1 -0
- package/dist/apps/{rpc.js → data/routes/rpc.js} +35 -7
- package/dist/apps/data/routes/rpc.js.map +1 -0
- package/dist/apps/{tokenlist.d.ts → data/routes/tokenlist.d.ts} +40 -40
- package/dist/apps/data/routes/tokenlist.d.ts.map +1 -0
- package/dist/apps/{tokenlist.js → data/routes/tokenlist.js} +8 -8
- package/dist/apps/data/routes/tokenlist.js.map +1 -0
- package/dist/apps/{tokens.d.ts → data/routes/tokens.d.ts} +468 -468
- package/dist/apps/data/routes/tokens.d.ts.map +1 -0
- package/dist/apps/{tokens.js → data/routes/tokens.js} +19 -19
- package/dist/apps/data/routes/tokens.js.map +1 -0
- package/dist/apps/{transactions.d.ts → data/routes/transactions.d.ts} +304 -304
- package/dist/apps/data/routes/transactions.d.ts.map +1 -0
- package/dist/apps/{transactions.js → data/routes/transactions.js} +13 -13
- package/dist/apps/data/routes/transactions.js.map +1 -0
- package/dist/apps/{transfers.d.ts → data/routes/transfers.d.ts} +62 -62
- package/dist/apps/data/routes/transfers.d.ts.map +1 -0
- package/dist/apps/{transfers.js → data/routes/transfers.js} +13 -13
- package/dist/apps/data/routes/transfers.js.map +1 -0
- package/dist/apps/{verified-tokens.d.ts → data/routes/verified-tokens.d.ts} +6 -6
- package/dist/apps/data/routes/verified-tokens.d.ts.map +1 -0
- package/dist/apps/{verified-tokens.js → data/routes/verified-tokens.js} +9 -9
- package/dist/apps/data/routes/verified-tokens.js.map +1 -0
- package/dist/apps/{webhooks.d.ts → data/routes/webhooks.d.ts} +17 -17
- package/dist/apps/{webhooks.d.ts.map → data/routes/webhooks.d.ts.map} +1 -1
- package/dist/apps/{webhooks.js → data/routes/webhooks.js} +38 -34
- package/dist/apps/data/routes/webhooks.js.map +1 -0
- package/dist/apps/docs/App.d.ts +29 -0
- package/dist/apps/docs/App.d.ts.map +1 -0
- package/dist/apps/docs/App.js +54 -0
- package/dist/apps/docs/App.js.map +1 -0
- package/dist/{internal/OpenApi.fonts.d.ts → apps/docs/fonts.d.ts} +1 -1
- package/dist/apps/docs/fonts.d.ts.map +1 -0
- package/dist/{internal/OpenApi.fonts.js → apps/docs/fonts.js} +1 -1
- package/dist/apps/docs/fonts.js.map +1 -0
- package/dist/apps/docs/index.d.ts +2 -0
- package/dist/apps/docs/index.d.ts.map +1 -0
- package/dist/apps/docs/index.js +2 -0
- package/dist/apps/docs/index.js.map +1 -0
- package/dist/{internal/OpenApi.logo.d.ts → apps/docs/logo.d.ts} +1 -1
- package/dist/apps/docs/logo.d.ts.map +1 -0
- package/dist/{internal/OpenApi.logo.js → apps/docs/logo.js} +1 -1
- package/dist/apps/docs/logo.js.map +1 -0
- package/dist/apps/docs/reference.d.ts +21 -0
- package/dist/apps/docs/reference.d.ts.map +1 -0
- package/dist/apps/docs/reference.js +112 -0
- package/dist/apps/docs/reference.js.map +1 -0
- package/dist/apps/index.d.ts +5 -0
- package/dist/apps/index.d.ts.map +1 -0
- package/dist/apps/index.js +5 -0
- package/dist/apps/index.js.map +1 -0
- package/dist/apps/mcp.d.ts +76 -0
- package/dist/apps/mcp.d.ts.map +1 -0
- package/dist/apps/mcp.js +188 -0
- package/dist/apps/mcp.js.map +1 -0
- package/dist/apps/metadata.d.ts +7 -0
- package/dist/apps/metadata.d.ts.map +1 -0
- package/dist/apps/metadata.js +15 -0
- package/dist/apps/metadata.js.map +1 -0
- package/dist/apps/platform/App.d.ts +5262 -0
- package/dist/apps/platform/App.d.ts.map +1 -0
- package/dist/apps/platform/App.js +84 -0
- package/dist/apps/platform/App.js.map +1 -0
- package/dist/apps/platform/Billing.d.ts +279 -0
- package/dist/apps/platform/Billing.d.ts.map +1 -0
- package/dist/apps/platform/Billing.js +477 -0
- package/dist/apps/platform/Billing.js.map +1 -0
- package/dist/apps/platform/index.d.ts +3 -0
- package/dist/apps/platform/index.d.ts.map +1 -0
- package/dist/apps/platform/index.js +3 -0
- package/dist/apps/platform/index.js.map +1 -0
- package/dist/apps/platform/routes/api-keys.d.ts +973 -0
- package/dist/apps/platform/routes/api-keys.d.ts.map +1 -0
- package/dist/apps/platform/routes/api-keys.js +430 -0
- package/dist/apps/platform/routes/api-keys.js.map +1 -0
- package/dist/apps/platform/routes/billing.d.ts +1520 -0
- package/dist/apps/platform/routes/billing.d.ts.map +1 -0
- package/dist/apps/platform/routes/billing.js +795 -0
- package/dist/apps/platform/routes/billing.js.map +1 -0
- package/dist/apps/platform/routes/invitations.d.ts +851 -0
- package/dist/apps/platform/routes/invitations.d.ts.map +1 -0
- package/dist/apps/platform/routes/invitations.js +471 -0
- package/dist/apps/platform/routes/invitations.js.map +1 -0
- package/dist/apps/platform/routes/me.d.ts +95 -0
- package/dist/apps/platform/routes/me.d.ts.map +1 -0
- package/dist/apps/platform/routes/me.js +81 -0
- package/dist/apps/platform/routes/me.js.map +1 -0
- package/dist/apps/platform/routes/members.d.ts +554 -0
- package/dist/apps/platform/routes/members.d.ts.map +1 -0
- package/dist/apps/platform/routes/members.js +251 -0
- package/dist/apps/platform/routes/members.js.map +1 -0
- package/dist/apps/platform/routes/orgs.d.ts +596 -0
- package/dist/apps/platform/routes/orgs.d.ts.map +1 -0
- package/dist/apps/platform/routes/orgs.js +276 -0
- package/dist/apps/platform/routes/orgs.js.map +1 -0
- package/dist/apps/platform/routes/projects.d.ts +740 -0
- package/dist/apps/platform/routes/projects.d.ts.map +1 -0
- package/dist/apps/platform/routes/projects.js +286 -0
- package/dist/apps/platform/routes/projects.js.map +1 -0
- package/dist/apps/platform/routes/scopes.d.ts +107 -0
- package/dist/apps/platform/routes/scopes.d.ts.map +1 -0
- package/dist/apps/platform/routes/scopes.js +66 -0
- package/dist/apps/platform/routes/scopes.js.map +1 -0
- package/dist/apps/platform/routes/usage.d.ts +588 -0
- package/dist/apps/platform/routes/usage.d.ts.map +1 -0
- package/dist/apps/platform/routes/usage.js +391 -0
- package/dist/apps/platform/routes/usage.js.map +1 -0
- package/dist/apps/relay/App.d.ts +44 -0
- package/dist/apps/relay/App.d.ts.map +1 -0
- package/dist/apps/relay/App.js +211 -0
- package/dist/apps/relay/App.js.map +1 -0
- package/dist/apps/relay/Sponsorships.d.ts +107 -0
- package/dist/apps/relay/Sponsorships.d.ts.map +1 -0
- package/dist/apps/relay/Sponsorships.js +194 -0
- package/dist/apps/relay/Sponsorships.js.map +1 -0
- package/dist/apps/relay/index.d.ts +3 -0
- package/dist/apps/relay/index.d.ts.map +1 -0
- package/dist/apps/relay/index.js +3 -0
- package/dist/apps/relay/index.js.map +1 -0
- package/dist/cli/Cli.d.ts +9 -2
- package/dist/cli/Cli.d.ts.map +1 -1
- package/dist/cli/Cli.js +12 -4
- package/dist/cli/Cli.js.map +1 -1
- package/dist/cli/commands/admin.d.ts +5 -1
- package/dist/cli/commands/admin.d.ts.map +1 -1
- package/dist/cli/commands/admin.js +82 -3
- package/dist/cli/commands/admin.js.map +1 -1
- package/dist/db/Db.d.ts +17 -0
- package/dist/db/Db.d.ts.map +1 -1
- package/dist/db/Db.js +254 -0
- package/dist/db/Db.js.map +1 -1
- package/dist/db/Schema.d.ts +159 -0
- package/dist/db/Schema.d.ts.map +1 -1
- package/dist/db/Schema.js +187 -2
- package/dist/db/Schema.js.map +1 -1
- package/dist/db/tables/billingSettings.d.ts +55 -0
- package/dist/db/tables/billingSettings.d.ts.map +1 -0
- package/dist/db/tables/billingSettings.js +70 -0
- package/dist/db/tables/billingSettings.js.map +1 -0
- package/dist/db/tables/invitations.d.ts +84 -0
- package/dist/db/tables/invitations.d.ts.map +1 -0
- package/dist/db/tables/invitations.js +165 -0
- package/dist/db/tables/invitations.js.map +1 -0
- package/dist/db/tables/memberships.d.ts +108 -0
- package/dist/db/tables/memberships.d.ts.map +1 -0
- package/dist/db/tables/memberships.js +153 -0
- package/dist/db/tables/memberships.js.map +1 -0
- package/dist/db/tables/organizations.d.ts +48 -0
- package/dist/db/tables/organizations.d.ts.map +1 -1
- package/dist/db/tables/organizations.js +97 -2
- package/dist/db/tables/organizations.js.map +1 -1
- package/dist/db/tables/projects.d.ts +65 -0
- package/dist/db/tables/projects.d.ts.map +1 -0
- package/dist/db/tables/projects.js +75 -0
- package/dist/db/tables/projects.js.map +1 -0
- package/dist/db/tables/requestUsage.d.ts +121 -0
- package/dist/db/tables/requestUsage.d.ts.map +1 -0
- package/dist/db/tables/requestUsage.js +150 -0
- package/dist/db/tables/requestUsage.js.map +1 -0
- package/dist/db/tables/sponsoredTransactions.d.ts +239 -0
- package/dist/db/tables/sponsoredTransactions.d.ts.map +1 -0
- package/dist/db/tables/sponsoredTransactions.js +314 -0
- package/dist/db/tables/sponsoredTransactions.js.map +1 -0
- package/dist/db/tables/stripeCustomers.d.ts +81 -0
- package/dist/db/tables/stripeCustomers.d.ts.map +1 -0
- package/dist/db/tables/stripeCustomers.js +120 -0
- package/dist/db/tables/stripeCustomers.js.map +1 -0
- package/dist/db/tables/users.d.ts +48 -0
- package/dist/db/tables/users.d.ts.map +1 -0
- package/dist/db/tables/users.js +65 -0
- package/dist/db/tables/users.js.map +1 -0
- package/dist/handlers/internal/executionError.d.ts.map +1 -1
- package/dist/handlers/internal/executionError.js +2 -0
- package/dist/handlers/internal/executionError.js.map +1 -1
- package/dist/handlers/internal/multisig.d.ts +2 -6
- package/dist/handlers/internal/multisig.d.ts.map +1 -1
- package/dist/handlers/internal/multisig.js +11 -36
- package/dist/handlers/internal/multisig.js.map +1 -1
- package/dist/handlers/internal/sponsorship.d.ts +35 -2
- package/dist/handlers/internal/sponsorship.d.ts.map +1 -1
- package/dist/handlers/internal/sponsorship.js +53 -14
- package/dist/handlers/internal/sponsorship.js.map +1 -1
- package/dist/handlers/internal/utils.d.ts +10 -3
- package/dist/handlers/internal/utils.d.ts.map +1 -1
- package/dist/handlers/internal/utils.js +14 -6
- package/dist/handlers/internal/utils.js.map +1 -1
- package/dist/handlers/relay.d.ts +6 -2
- package/dist/handlers/relay.d.ts.map +1 -1
- package/dist/handlers/relay.js +16 -2
- package/dist/handlers/relay.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/Auth.d.ts +222 -6
- package/dist/internal/Auth.d.ts.map +1 -1
- package/dist/internal/Auth.js +625 -74
- package/dist/internal/Auth.js.map +1 -1
- package/dist/internal/Cache.d.ts.map +1 -1
- package/dist/internal/Cache.js +4 -1
- package/dist/internal/Cache.js.map +1 -1
- package/dist/internal/EdgeCache.d.ts +10 -0
- package/dist/internal/EdgeCache.d.ts.map +1 -1
- package/dist/internal/EdgeCache.js +39 -8
- package/dist/internal/EdgeCache.js.map +1 -1
- package/dist/internal/Fees.d.ts +27 -0
- package/dist/internal/Fees.d.ts.map +1 -0
- package/dist/internal/Fees.js +48 -0
- package/dist/internal/Fees.js.map +1 -0
- package/dist/internal/FundingRoutes.d.ts +183 -0
- package/dist/internal/FundingRoutes.d.ts.map +1 -0
- package/dist/internal/FundingRoutes.js +490 -0
- package/dist/internal/FundingRoutes.js.map +1 -0
- package/dist/internal/Id.d.ts +15 -0
- package/dist/internal/Id.d.ts.map +1 -0
- package/dist/internal/Id.js +22 -0
- package/dist/internal/Id.js.map +1 -0
- package/dist/internal/Log.d.ts +9 -3
- package/dist/internal/Log.d.ts.map +1 -1
- package/dist/internal/Log.js +7 -0
- package/dist/internal/Log.js.map +1 -1
- package/dist/internal/OpenApi.d.ts +10 -20
- package/dist/internal/OpenApi.d.ts.map +1 -1
- package/dist/internal/OpenApi.js +8 -58
- package/dist/internal/OpenApi.js.map +1 -1
- package/dist/internal/RateLimit.d.ts +25 -0
- package/dist/internal/RateLimit.d.ts.map +1 -1
- package/dist/internal/RateLimit.js +51 -0
- package/dist/internal/RateLimit.js.map +1 -1
- package/dist/internal/Response.d.ts +1 -1
- package/dist/internal/Response.d.ts.map +1 -1
- package/dist/internal/Schema.d.ts +8 -0
- package/dist/internal/Schema.d.ts.map +1 -1
- package/dist/internal/Schema.js +7 -0
- package/dist/internal/Schema.js.map +1 -1
- package/dist/internal/Store.d.ts +7 -1
- package/dist/internal/Store.d.ts.map +1 -1
- package/dist/internal/Store.js +16 -2
- package/dist/internal/Store.js.map +1 -1
- package/dist/internal/Viem.d.ts +84 -0
- package/dist/internal/Viem.d.ts.map +1 -1
- package/dist/internal/Webhooks.d.ts +1 -1
- package/dist/internal/Webhooks.d.ts.map +1 -1
- package/dist/internal/Webhooks.js +3 -3
- package/dist/internal/Webhooks.js.map +1 -1
- package/package.json +33 -6
- package/src/ApiKey.ts +10 -2
- package/src/ApiKeys.test.ts +155 -1
- package/src/ApiKeys.ts +203 -1
- package/src/App.test.ts +64 -75741
- package/src/App.ts +218 -420
- package/src/Client.test-d.ts +657 -15
- package/src/Scope.ts +26 -4
- package/src/Webhooks.ts +2 -2
- package/src/admin/apps/api-keys.test.ts +51 -0
- package/src/admin/apps/api-keys.ts +84 -0
- package/src/admin/apps/scopes.test.ts +11 -1
- package/src/admin/apps/scopes.ts +3 -0
- package/src/admin/apps/verified-tokens.ts +1 -1
- package/src/admin/ui/src/components/Page.tsx +2 -3
- package/src/admin/ui/src/routes/__root.tsx +2 -2
- package/src/admin/ui/src/routes/api-keys.tsx +2 -2
- package/src/admin/ui.generated.ts +13 -13
- package/src/analytics/Analytics.test.ts +527 -0
- package/src/analytics/Analytics.ts +318 -0
- package/src/analytics/tables/requestEvents.ts +523 -0
- package/src/apps/composition.test.ts +66 -0
- package/src/apps/data/App.test.ts +72 -0
- package/src/apps/data/App.ts +330 -0
- package/src/apps/data/index.ts +2 -0
- package/src/apps/{activities.test.ts → data/routes/activities.test.ts} +3 -3
- package/src/apps/{activities.ts → data/routes/activities.ts} +15 -15
- package/src/apps/{addresses.ts → data/routes/addresses.ts} +6 -6
- package/src/apps/{balances.test.ts → data/routes/balances.test.ts} +2 -2
- package/src/apps/{balances.ts → data/routes/balances.ts} +46 -12
- package/src/apps/{blocks.test.ts → data/routes/blocks.test.ts} +3 -3
- package/src/apps/{blocks.ts → data/routes/blocks.ts} +14 -14
- package/src/apps/{coingecko.test.ts → data/routes/coingecko.test.ts} +2 -2
- package/src/apps/{coingecko.ts → data/routes/coingecko.ts} +14 -14
- package/src/apps/{exchanges.test.ts → data/routes/exchanges.test.ts} +1 -1
- package/src/apps/{exchanges.ts → data/routes/exchanges.ts} +20 -20
- package/src/apps/{fee-amm.test.ts → data/routes/fee-amm.test.ts} +3 -3
- package/src/apps/{fee-amm.ts → data/routes/fee-amm.ts} +18 -18
- package/src/apps/data/routes/funding.test.ts +214 -0
- package/src/apps/data/routes/funding.ts +584 -0
- package/src/apps/{indexer.test.ts → data/routes/indexer.test.ts} +26 -5
- package/src/apps/{indexer.ts → data/routes/indexer.ts} +13 -10
- package/src/apps/{receipts.test.ts → data/routes/receipts.test.ts} +3 -3
- package/src/apps/{receipts.ts → data/routes/receipts.ts} +15 -22
- package/src/apps/{rpc.test.ts → data/routes/rpc.test.ts} +122 -7
- package/src/apps/{rpc.ts → data/routes/rpc.ts} +38 -8
- package/src/apps/{tokenlist.test.ts → data/routes/tokenlist.test.ts} +3 -3
- package/src/apps/{tokenlist.ts → data/routes/tokenlist.ts} +9 -9
- package/src/apps/{tokens.test.ts → data/routes/tokens.test.ts} +2 -2
- package/src/apps/{tokens.ts → data/routes/tokens.ts} +20 -20
- package/src/apps/{transactions.test.ts → data/routes/transactions.test.ts} +3 -3
- package/src/apps/{transactions.ts → data/routes/transactions.ts} +15 -15
- package/src/apps/{transfers.test.ts → data/routes/transfers.test.ts} +2 -2
- package/src/apps/{transfers.ts → data/routes/transfers.ts} +15 -15
- package/src/apps/{verified-tokens.test.ts → data/routes/verified-tokens.test.ts} +3 -3
- package/src/apps/{verified-tokens.ts → data/routes/verified-tokens.ts} +10 -10
- package/src/apps/{webhooks.test.ts → data/routes/webhooks.test.ts} +7 -7
- package/src/apps/{webhooks.ts → data/routes/webhooks.ts} +50 -43
- package/src/apps/docs/App.ts +65 -0
- package/src/apps/docs/index.ts +1 -0
- package/src/apps/docs/reference.ts +132 -0
- package/src/apps/index.ts +4 -0
- package/src/apps/mcp.test.ts +206 -0
- package/src/apps/mcp.ts +250 -0
- package/src/apps/metadata.ts +23 -0
- package/src/apps/platform/App.ts +169 -0
- package/src/apps/platform/Billing.test.ts +530 -0
- package/src/apps/platform/Billing.ts +682 -0
- package/src/apps/platform/index.ts +2 -0
- package/src/apps/platform/routes/api-keys.test.ts +493 -0
- package/src/apps/platform/routes/api-keys.ts +543 -0
- package/src/apps/platform/routes/billing.test.ts +1100 -0
- package/src/apps/platform/routes/billing.ts +966 -0
- package/src/apps/platform/routes/invitations.test.ts +409 -0
- package/src/apps/platform/routes/invitations.ts +587 -0
- package/src/apps/platform/routes/me.test.ts +351 -0
- package/src/apps/platform/routes/me.ts +106 -0
- package/src/apps/platform/routes/members.test.ts +195 -0
- package/src/apps/platform/routes/members.ts +313 -0
- package/src/apps/platform/routes/orgs.test.ts +313 -0
- package/src/apps/platform/routes/orgs.ts +365 -0
- package/src/apps/platform/routes/projects.test.ts +181 -0
- package/src/apps/platform/routes/projects.ts +367 -0
- package/src/apps/platform/routes/scopes.test.ts +29 -0
- package/src/apps/platform/routes/scopes.ts +85 -0
- package/src/apps/platform/routes/usage.test.ts +422 -0
- package/src/apps/platform/routes/usage.ts +527 -0
- package/src/apps/relay/App.test.ts +933 -0
- package/src/apps/relay/App.ts +236 -0
- package/src/apps/relay/Sponsorships.test.ts +375 -0
- package/src/apps/relay/Sponsorships.ts +306 -0
- package/src/apps/relay/index.ts +2 -0
- package/src/cli/Cli.test.ts +25 -2
- package/src/cli/Cli.ts +18 -3
- package/src/cli/commands/admin.test.ts +83 -0
- package/src/cli/commands/admin.ts +91 -3
- package/src/db/Db.ts +296 -0
- package/src/db/Schema.ts +241 -2
- package/src/db/tables/billingSettings.test.ts +87 -0
- package/src/db/tables/billingSettings.ts +108 -0
- package/src/db/tables/invitations.ts +198 -0
- package/src/db/tables/memberships.ts +208 -0
- package/src/db/tables/organizations.test.ts +38 -2
- package/src/db/tables/organizations.ts +117 -2
- package/src/db/tables/projects.ts +107 -0
- package/src/db/tables/requestUsage.ts +231 -0
- package/src/db/tables/sponsoredTransactions.test.ts +325 -0
- package/src/db/tables/sponsoredTransactions.ts +464 -0
- package/src/db/tables/stripeCustomers.test.ts +109 -0
- package/src/db/tables/stripeCustomers.ts +162 -0
- package/src/db/tables/users.ts +85 -0
- package/src/handlers/internal/executionError.ts +2 -0
- package/src/handlers/internal/multisig.test.ts +84 -10
- package/src/handlers/internal/multisig.ts +15 -50
- package/src/handlers/internal/sponsorship.ts +106 -20
- package/src/handlers/internal/utils.ts +19 -7
- package/src/handlers/{internal/relay.localnet.test.ts → relay.test.ts} +2 -2
- package/src/handlers/relay.ts +23 -5
- package/src/index.ts +1 -0
- package/src/internal/Auth.test.ts +491 -25
- package/src/internal/Auth.ts +839 -84
- package/src/internal/Cache.ts +5 -1
- package/src/internal/Cursor.test.ts +3 -2
- package/src/internal/EdgeCache.test.ts +27 -4
- package/src/internal/EdgeCache.ts +47 -9
- package/src/internal/Fees.test.ts +32 -0
- package/src/internal/Fees.ts +51 -0
- package/src/internal/FundingRoutes.ts +583 -0
- package/src/internal/Id.test.ts +17 -0
- package/src/internal/Id.ts +24 -0
- package/src/internal/Log.test.ts +2 -1
- package/src/internal/Log.ts +16 -3
- package/src/internal/MetricSink.ts +1 -1
- package/src/internal/OpenApi.ts +12 -60
- package/src/internal/RateLimit.test.ts +84 -0
- package/src/internal/RateLimit.ts +70 -0
- package/src/internal/Response.ts +1 -1
- package/src/internal/Schema.ts +8 -0
- package/src/internal/Store.test.ts +52 -0
- package/src/internal/Store.ts +24 -5
- package/src/internal/Tidx.local.test.ts +1 -1
- package/src/internal/VerifiedTokens.test.ts +1 -1
- package/src/internal/WebhookDestination.test.ts +1 -1
- package/src/internal/Webhooks.test.ts +7 -7
- package/src/internal/Webhooks.ts +4 -4
- package/dist/apps/activities.js.map +0 -1
- package/dist/apps/addresses.js.map +0 -1
- package/dist/apps/balances.d.ts.map +0 -1
- package/dist/apps/balances.js.map +0 -1
- package/dist/apps/blocks.d.ts.map +0 -1
- package/dist/apps/blocks.js.map +0 -1
- package/dist/apps/coingecko.d.ts.map +0 -1
- package/dist/apps/coingecko.js.map +0 -1
- package/dist/apps/exchanges.d.ts.map +0 -1
- package/dist/apps/exchanges.js.map +0 -1
- package/dist/apps/fee-amm.d.ts.map +0 -1
- package/dist/apps/fee-amm.js.map +0 -1
- package/dist/apps/indexer.d.ts.map +0 -1
- package/dist/apps/indexer.js.map +0 -1
- package/dist/apps/receipts.d.ts.map +0 -1
- package/dist/apps/receipts.js.map +0 -1
- package/dist/apps/rpc.d.ts.map +0 -1
- package/dist/apps/rpc.js.map +0 -1
- package/dist/apps/tokenlist.d.ts.map +0 -1
- package/dist/apps/tokenlist.js.map +0 -1
- package/dist/apps/tokens.d.ts.map +0 -1
- package/dist/apps/tokens.js.map +0 -1
- package/dist/apps/transactions.d.ts.map +0 -1
- package/dist/apps/transactions.js.map +0 -1
- package/dist/apps/transfers.d.ts.map +0 -1
- package/dist/apps/transfers.js.map +0 -1
- package/dist/apps/verified-tokens.d.ts.map +0 -1
- package/dist/apps/verified-tokens.js.map +0 -1
- package/dist/apps/webhooks.js.map +0 -1
- package/dist/internal/OpenApi.fonts.d.ts.map +0 -1
- package/dist/internal/OpenApi.fonts.js.map +0 -1
- package/dist/internal/OpenApi.logo.d.ts.map +0 -1
- package/dist/internal/OpenApi.logo.js.map +0 -1
- package/src/handlers/internal/multisig.localnet.test.ts +0 -146
- /package/src/{internal/OpenApi.fonts.ts → apps/docs/fonts.ts} +0 -0
- /package/src/{internal/OpenApi.logo.ts → apps/docs/logo.ts} +0 -0
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { Hono } from 'hono'
|
|
2
|
+
import * as z from 'zod/mini'
|
|
3
|
+
|
|
4
|
+
import type * as Assets from '../../Assets.js'
|
|
5
|
+
import type * as App from '../../App.js'
|
|
6
|
+
import * as Metadata from '../metadata.js'
|
|
7
|
+
import * as Auth from '../../internal/Auth.js'
|
|
8
|
+
import * as Path from '../../internal/Path.js'
|
|
9
|
+
import * as Response from '../../internal/Response.js'
|
|
10
|
+
import * as Schema from '../../internal/Schema.js'
|
|
11
|
+
import * as Tidx from '../../internal/Tidx.js'
|
|
12
|
+
import * as Viem from '../../internal/Viem.js'
|
|
13
|
+
|
|
14
|
+
import { transactions as transactionActivities } from './routes/activities.js'
|
|
15
|
+
import { addresses } from './routes/addresses.js'
|
|
16
|
+
import { blocks, blocksByTimestampCompat } from './routes/blocks.js'
|
|
17
|
+
import { coingecko } from './routes/coingecko.js'
|
|
18
|
+
import { exchanges } from './routes/exchanges.js'
|
|
19
|
+
import { feeAmm } from './routes/fee-amm.js'
|
|
20
|
+
import { funding } from './routes/funding.js'
|
|
21
|
+
import { indexer } from './routes/indexer.js'
|
|
22
|
+
import { receipts } from './routes/receipts.js'
|
|
23
|
+
import { rpc } from './routes/rpc.js'
|
|
24
|
+
import { tokenlist } from './routes/tokenlist.js'
|
|
25
|
+
import { tokens } from './routes/tokens.js'
|
|
26
|
+
import { transactions } from './routes/transactions.js'
|
|
27
|
+
import { transfers } from './routes/transfers.js'
|
|
28
|
+
import { verifiedTokens } from './routes/verified-tokens.js'
|
|
29
|
+
import { schema as webhookSchema, webhooks } from './routes/webhooks.js'
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The chain-data route group: read endpoints over blocks, transactions, tokens,
|
|
33
|
+
* the exchange/fee-AMM, and the RPC/indexer passthroughs. It owns all chain
|
|
34
|
+
* configuration and publishes the chain clients on request context.
|
|
35
|
+
*
|
|
36
|
+
* ```ts
|
|
37
|
+
* App.create(options).route('/', data())
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export function data(options: data.Options = {}) {
|
|
41
|
+
const { assets, defaultChainId = Viem.defaultChainId, rpc: rpc_option, tidx } = options
|
|
42
|
+
|
|
43
|
+
// The chain ids this deployment serves (built-in public chains plus
|
|
44
|
+
// `defaultChainId` and any explicit `supportedChainIds`). Published on context
|
|
45
|
+
// so handlers with a path `chainId` can guard it too.
|
|
46
|
+
const supportedChainIds = new Set<number>([
|
|
47
|
+
...Object.keys(Viem.url).map(Number),
|
|
48
|
+
...Object.keys(Tidx.url).map(Number),
|
|
49
|
+
defaultChainId,
|
|
50
|
+
...(options.supportedChainIds ?? []),
|
|
51
|
+
])
|
|
52
|
+
|
|
53
|
+
// Memoize one viem client per resolved upstream (stateless HTTP transports).
|
|
54
|
+
// Keying on the resolved output (`url`+`basicAuth`+`chainId`), not the
|
|
55
|
+
// principal, bounds cardinality by the number of distinct upstreams.
|
|
56
|
+
const clients = new Map<string, ReturnType<typeof Viem.getClient>>()
|
|
57
|
+
const getClient = (chainId = defaultChainId, principal: Auth.Principal | null = null) => {
|
|
58
|
+
const { url, basicAuth } = Viem.resolve(rpc_option, { chainId, principal })
|
|
59
|
+
const cacheKey = `${url}|${basicAuth ?? ''}|${chainId}`
|
|
60
|
+
const existing = clients.get(cacheKey)
|
|
61
|
+
if (existing) return existing
|
|
62
|
+
const client = Viem.getClient({ chainId, principal, rpc: rpc_option })
|
|
63
|
+
clients.set(cacheKey, client)
|
|
64
|
+
return client
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Memoize TIDX clients per `chainId` so the base URL resolver runs once per
|
|
68
|
+
// chain instead of on every request.
|
|
69
|
+
const getTidx = Tidx.createGetClient({ defaultChainId, tidx })
|
|
70
|
+
|
|
71
|
+
const app = new Hono<App.Environment>()
|
|
72
|
+
// Publish the chain-data context vars for this group's handlers. Runs after
|
|
73
|
+
// `App.create`'s middleware, so `getClient`/`getTidx` can key on the
|
|
74
|
+
// resolved principal and `getAsset` can read `basePath` off context.
|
|
75
|
+
.use('*', async (c, next) => {
|
|
76
|
+
c.set('chainId', defaultChainId)
|
|
77
|
+
c.set('getAsset', createGetAsset({ assets, basePath: c.get('basePath'), origin: new URL(c.req.url).origin })) // prettier-ignore
|
|
78
|
+
c.set('getClient', (chainId) => getClient(chainId, Auth.getPrincipal(c)))
|
|
79
|
+
c.set('getTidx', (chainId) => getTidx(chainId, Auth.getPrincipal(c)))
|
|
80
|
+
c.set('rpc', rpc_option)
|
|
81
|
+
c.set('supportedChainIds', supportedChainIds)
|
|
82
|
+
c.set('tidx', tidx)
|
|
83
|
+
c.set('verifiedTokens', options.verifiedTokens === false ? undefined : (options.verifiedTokens ?? {})) // prettier-ignore
|
|
84
|
+
c.set('webhook', options.webhook === false ? undefined : (options.webhook ?? {}))
|
|
85
|
+
await next()
|
|
86
|
+
})
|
|
87
|
+
// Reject a well-formed but unsupported `chainId` before it reaches an
|
|
88
|
+
// upstream, which would otherwise return an opaque `upstream_error`.
|
|
89
|
+
.use('*', async (c, next) => {
|
|
90
|
+
const raw = c.req.query('chainId') ?? c.req.query('chain_id')
|
|
91
|
+
if (raw === undefined) return next()
|
|
92
|
+
// Only reject a well-formed-but-unsupported chain here; malformed values
|
|
93
|
+
// (e.g. `abc`, `0`) fall through to the route's own query validation.
|
|
94
|
+
const parsed = Schema.ChainId.safeParse(raw)
|
|
95
|
+
if (!parsed.success || supportedChainIds.has(parsed.data)) return next()
|
|
96
|
+
return Response.unsupportedChainId(c, parsed.data, supportedChainIds)
|
|
97
|
+
})
|
|
98
|
+
// Sandbox keys are testnet-only. A chain-scoped data route defaults to
|
|
99
|
+
// mainnet, so a sandbox key that omits `chainId` (or targets mainnet) is
|
|
100
|
+
// refused with a clear message telling the caller to pass a testnet
|
|
101
|
+
// `chainId`. The relay resolves its chain from the request body, not the
|
|
102
|
+
// query, so it is skipped and enforces the rule in its sponsor validation.
|
|
103
|
+
.use('*', async (c, next) => {
|
|
104
|
+
const relay = Path.join(c.get('basePath') ?? '', 'rpc/relay')
|
|
105
|
+
if (c.req.path === relay || c.req.path.startsWith(`${relay}/`)) return next()
|
|
106
|
+
|
|
107
|
+
const principal = Auth.getPrincipal(c)
|
|
108
|
+
if (principal?.type !== 'api_key' || principal.environment !== 'sandbox') return next()
|
|
109
|
+
|
|
110
|
+
const raw = c.req.query('chainId') ?? c.req.query('chain_id')
|
|
111
|
+
// Absent falls back to the group default (mainnet); a malformed value
|
|
112
|
+
// stays with the route's own validator rather than the sandbox message.
|
|
113
|
+
const chainId = (() => {
|
|
114
|
+
if (raw === undefined) return defaultChainId
|
|
115
|
+
const parsed = Schema.ChainId.safeParse(raw)
|
|
116
|
+
return parsed.success ? parsed.data : undefined
|
|
117
|
+
})()
|
|
118
|
+
if (chainId === undefined || !Viem.isMainnet(chainId)) return next()
|
|
119
|
+
|
|
120
|
+
return Response.error(c, {
|
|
121
|
+
code: 'api_key_forbidden',
|
|
122
|
+
message: 'Sandbox API keys only support testnet. Pass a testnet `chainId`.',
|
|
123
|
+
status: 403,
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
// Serve static API assets (e.g. verified-token icons) from the configured
|
|
127
|
+
// store; a no-op fall-through when no store is configured (logo URIs simply
|
|
128
|
+
// go unresolved).
|
|
129
|
+
.use('/assets/*', async (c, next) => {
|
|
130
|
+
if (!assets) return next()
|
|
131
|
+
const key = stripAssetPath(c.req.path, c.get('basePath')).replace(/^\/+/, '')
|
|
132
|
+
const asset = key ? await assets.get(key) : undefined
|
|
133
|
+
if (!asset) return next()
|
|
134
|
+
return c.body(asset.body, 200, {
|
|
135
|
+
'Cache-Control': 'public, max-age=86400',
|
|
136
|
+
'Content-Type': asset.contentType,
|
|
137
|
+
})
|
|
138
|
+
})
|
|
139
|
+
.route('/', addresses())
|
|
140
|
+
.route('/', blocks())
|
|
141
|
+
.route('/', exchanges())
|
|
142
|
+
.route('/', feeAmm())
|
|
143
|
+
.route('/', funding())
|
|
144
|
+
.route('/', indexer())
|
|
145
|
+
.route('/', receipts())
|
|
146
|
+
.route('/', tokenlist())
|
|
147
|
+
.route('/', tokens())
|
|
148
|
+
.route('/', transactions())
|
|
149
|
+
.route('/', transactionActivities())
|
|
150
|
+
.route('/', transfers())
|
|
151
|
+
.route('/', verifiedTokens())
|
|
152
|
+
.route('/', webhooks({ enabled: options.webhook !== false }))
|
|
153
|
+
.route('/', rpc())
|
|
154
|
+
.route('/', coingecko())
|
|
155
|
+
.route('/', blocksByTimestampCompat())
|
|
156
|
+
return Metadata.attach(app, openapi)
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export declare namespace data {
|
|
160
|
+
/** Options for the data route group. */
|
|
161
|
+
type Options = {
|
|
162
|
+
/** Static API asset store for the current runtime (e.g. `Assets.cloudflareR2(...)`). Omit to skip static assets — token logo URIs go unresolved. */
|
|
163
|
+
assets?: Assets.Assets | undefined
|
|
164
|
+
/** Default Tempo chain id for requests that omit `chainId`. */
|
|
165
|
+
defaultChainId?: Viem.ChainId | undefined
|
|
166
|
+
/** Tempo RPC options: a static config, or a per-request resolver that routes by request principal to a separate (e.g. public, no-auth) RPC. */
|
|
167
|
+
rpc?: Viem.getClient.Rpc | undefined
|
|
168
|
+
/** Extra chain ids this deployment serves, beyond the built-in public chains and `defaultChainId`. A `chainId` outside this set is rejected with a 400. */
|
|
169
|
+
supportedChainIds?: readonly number[] | undefined
|
|
170
|
+
/** TIDX query client options. */
|
|
171
|
+
tidx?: Tidx.getClient.Tidx | undefined
|
|
172
|
+
/** Verified-token feature configuration. Enabled by default (token rows live in `db`; empty until published); pass `false` to always serve an empty verified list. */
|
|
173
|
+
verifiedTokens?: VerifiedTokens | false | undefined
|
|
174
|
+
/** Webhook feature configuration. Enabled by default (rows live in `db`); pass `false` to disable, leaving `/webhooks` mounted but returning `404` and hidden from the OpenAPI document. */
|
|
175
|
+
webhook?: Webhook | false | undefined
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** Verified-token feature configuration. */
|
|
179
|
+
type VerifiedTokens = {
|
|
180
|
+
/**
|
|
181
|
+
* Per-isolate soft-refresh window (ms). Lookups serve from the in-memory
|
|
182
|
+
* snapshot within it; after it, the next lookup re-checks the head version
|
|
183
|
+
* and recompiles only on change. Defaults to 10_000.
|
|
184
|
+
*/
|
|
185
|
+
refreshMs?: number | undefined
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** Webhook feature configuration. */
|
|
189
|
+
type Webhook = {
|
|
190
|
+
/**
|
|
191
|
+
* Maximum active subscriptions per owner; creation is rejected with
|
|
192
|
+
* `403 limit_exceeded` once reached. Defaults to 100, bounding the spam/SSRF
|
|
193
|
+
* and delivery-cost surface per owner.
|
|
194
|
+
*/
|
|
195
|
+
maxPerOwner?: number | undefined
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* The OpenAPI metadata this group owns: its operation tags and the outbound
|
|
201
|
+
* `webhooks` block. Tagged onto the {@link data} instance so `App.create`
|
|
202
|
+
* collects it; the webhooks block emits only when webhook routes are mounted.
|
|
203
|
+
*/
|
|
204
|
+
const openapi = {
|
|
205
|
+
tags: [
|
|
206
|
+
{ name: 'Activities', description: 'A readable feed of what an account did onchain.' },
|
|
207
|
+
{ name: 'Balances', description: 'How much of each token an account holds.' },
|
|
208
|
+
{ name: 'Blocks', description: 'The ordered batches of transactions making up the chain.' },
|
|
209
|
+
{ name: 'Exchange', description: "Tempo's built-in stablecoin exchange: pairs, swaps, orders, prices." }, // prettier-ignore
|
|
210
|
+
{ name: 'Fee AMM', description: 'Pools that convert stablecoins to pay fees.' },
|
|
211
|
+
{ name: 'Funding', description: 'Routes and inventory for moving stablecoins into Tempo.' },
|
|
212
|
+
{ name: 'Providers', description: 'Provider metadata, capabilities, and integration status.' },
|
|
213
|
+
{ name: 'Tokens', description: 'TIP-20 token details, supply, and holders.' },
|
|
214
|
+
{ name: 'Transactions', description: 'Transactions submitted to Tempo, and their receipts.' },
|
|
215
|
+
{ name: 'Transfers', description: 'Token movements from executing transactions.' },
|
|
216
|
+
{ name: 'Verified Tokens', description: 'A curated, trusted list of TIP-20 tokens.' },
|
|
217
|
+
{ name: 'Webhooks', description: 'Get signed callbacks when onchain events happen.' },
|
|
218
|
+
{ name: 'Indexer', description: "Run read-only SQL queries against Tempo's indexed data." },
|
|
219
|
+
{ name: 'RPC', description: 'Direct access to the chain over Ethereum JSON-RPC. Not part of the stable API contract; best-effort support only. No compatibility, latency, availability, or data-freshness guarantees. Breaking changes may happen with limited notice.' }, // prettier-ignore
|
|
220
|
+
{ name: 'CoinGecko', description: "Exchange data in CoinGecko's GeckoTerminal format." },
|
|
221
|
+
],
|
|
222
|
+
'x-tagGroups': [
|
|
223
|
+
{
|
|
224
|
+
name: 'Data API',
|
|
225
|
+
tags: [
|
|
226
|
+
'Activities',
|
|
227
|
+
'Balances',
|
|
228
|
+
'Blocks',
|
|
229
|
+
'Exchange',
|
|
230
|
+
'Fee AMM',
|
|
231
|
+
'Funding',
|
|
232
|
+
'Providers',
|
|
233
|
+
'Tokens',
|
|
234
|
+
'Transactions',
|
|
235
|
+
'Transfers',
|
|
236
|
+
'Verified Tokens',
|
|
237
|
+
'Webhooks',
|
|
238
|
+
'Indexer',
|
|
239
|
+
'RPC',
|
|
240
|
+
'MCP',
|
|
241
|
+
'CoinGecko',
|
|
242
|
+
],
|
|
243
|
+
},
|
|
244
|
+
],
|
|
245
|
+
webhooks: webhooksBlock,
|
|
246
|
+
} satisfies App.create.Metadata
|
|
247
|
+
|
|
248
|
+
// Builds the outbound-delivery `webhooks` block. `io: 'output'` documents the
|
|
249
|
+
// serialized shape; `unrepresentable: 'any'` emits `{}` for payload transforms
|
|
250
|
+
// (e.g. lazy fee-token metadata) that have no JSON-Schema form.
|
|
251
|
+
function webhooksBlock() {
|
|
252
|
+
const envelope = z.toJSONSchema(webhookSchema.Envelope, {
|
|
253
|
+
io: 'output',
|
|
254
|
+
target: 'draft-2020-12',
|
|
255
|
+
unrepresentable: 'any',
|
|
256
|
+
})
|
|
257
|
+
delete envelope.$schema
|
|
258
|
+
const header = (name: string, description: string) => ({
|
|
259
|
+
description,
|
|
260
|
+
in: 'header' as const,
|
|
261
|
+
name,
|
|
262
|
+
required: true,
|
|
263
|
+
schema: { type: 'string' as const },
|
|
264
|
+
})
|
|
265
|
+
return {
|
|
266
|
+
event: {
|
|
267
|
+
post: {
|
|
268
|
+
description:
|
|
269
|
+
'When an event you subscribed to happens, Tempo sends this signed message to your webhook URL as an HTTP POST (the same shape is used by `POST /webhooks/:id/ping` so you can test your endpoint). Always verify the `tempo-signature` header before trusting the body, then reply with any 2xx status to confirm you received it. If your endpoint returns a non-2xx status, times out, or redirects, Tempo retries with increasing delays; an endpoint that keeps failing is eventually disabled.',
|
|
270
|
+
parameters: [
|
|
271
|
+
header(
|
|
272
|
+
'tempo-signature',
|
|
273
|
+
'Signature proving the message really came from Tempo. An HMAC-SHA256 of the body using your webhook secret, formatted `t=<unix>,v1=<hex>`. Verify this before trusting the payload.',
|
|
274
|
+
),
|
|
275
|
+
header(
|
|
276
|
+
'tempo-event-id',
|
|
277
|
+
'A unique, stable id for this event (`evt_…`). The same event may be delivered more than once, so use this id to skip duplicates.',
|
|
278
|
+
),
|
|
279
|
+
header('tempo-event-type', 'What happened: `token:transfer`, `transaction:included`, `log:emitted`, `block:created`, or `ping`.'), // prettier-ignore
|
|
280
|
+
],
|
|
281
|
+
requestBody: {
|
|
282
|
+
content: { 'application/json': { schema: envelope } },
|
|
283
|
+
required: true,
|
|
284
|
+
},
|
|
285
|
+
responses: { '2xx': { description: 'Delivery acknowledged.' } },
|
|
286
|
+
summary: 'Webhook event delivery',
|
|
287
|
+
tags: ['Webhooks'],
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// Builds the per-request static-asset resolver. The store is keyed by
|
|
294
|
+
// `:chainId/:path` (decoupled from the public `/assets/:chainId` URL) and
|
|
295
|
+
// returns absolute URLs against the request origin. Without a store, every
|
|
296
|
+
// lookup misses and callers fall back to undefined logo URIs.
|
|
297
|
+
function createGetAsset(options: createGetAsset.Options): App.GetAsset {
|
|
298
|
+
const { assets, basePath, origin } = options
|
|
299
|
+
if (!assets) return () => undefined
|
|
300
|
+
return async (chainId, path) => {
|
|
301
|
+
const pathname = Path.join(basePath, 'assets', String(chainId), path)
|
|
302
|
+
// `path` may be absolute (`Path.join` returns a leading slash); strip it so
|
|
303
|
+
// the key is `:chainId/:path`, not `:chainId//:path`.
|
|
304
|
+
const key = `${chainId}/${path.replace(/^\/+/, '')}`
|
|
305
|
+
const asset = await assets.get(key)
|
|
306
|
+
if (!asset) return undefined
|
|
307
|
+
return {
|
|
308
|
+
response: new globalThis.Response(asset.body, {
|
|
309
|
+
headers: { 'Content-Type': asset.contentType },
|
|
310
|
+
}),
|
|
311
|
+
uri: new URL(pathname, origin).toString(),
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
declare namespace createGetAsset {
|
|
317
|
+
type Options = {
|
|
318
|
+
assets?: Assets.Assets | undefined
|
|
319
|
+
basePath: string
|
|
320
|
+
origin: string
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// Strips the (possibly base-path-prefixed) `/assets/` segment so the remainder
|
|
325
|
+
// is the store key path.
|
|
326
|
+
function stripAssetPath(path: string, basePath: string) {
|
|
327
|
+
for (const prefix of [`${Path.join(basePath, 'assets')}/`, '/assets/'])
|
|
328
|
+
if (path.startsWith(prefix)) return `/${path.slice(prefix.length)}`
|
|
329
|
+
return path
|
|
330
|
+
}
|
|
@@ -2,9 +2,9 @@ import { Address, Hex } from 'ox'
|
|
|
2
2
|
import { encodeAbiParameters, encodeEventTopics } from 'viem'
|
|
3
3
|
import { Abis } from 'viem/tempo'
|
|
4
4
|
|
|
5
|
-
import * as TestApp from '
|
|
6
|
-
import * as Runtime from '
|
|
7
|
-
import * as Store from '
|
|
5
|
+
import * as TestApp from '../../../../test/App.js'
|
|
6
|
+
import * as Runtime from '../../../../test/runtime.js'
|
|
7
|
+
import * as Store from '../../../internal/Store.js'
|
|
8
8
|
import * as Activities from './activities.js'
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -4,19 +4,19 @@ import { type Log, parseEventLogs, zeroAddress } from 'viem'
|
|
|
4
4
|
import { Abis, Addresses } from 'viem/tempo'
|
|
5
5
|
import * as z from 'zod/mini'
|
|
6
6
|
|
|
7
|
-
import type * as App from '
|
|
8
|
-
import * as Auth from '
|
|
9
|
-
import * as Cache from '
|
|
10
|
-
import * as Cursor from '
|
|
11
|
-
import * as Mpp from '
|
|
12
|
-
import * as OpenApi from '
|
|
13
|
-
import * as Response from '
|
|
14
|
-
import * as Schema from '
|
|
15
|
-
import * as Store from '
|
|
16
|
-
import type * as Tidx from '
|
|
17
|
-
import * as Timing from '
|
|
18
|
-
import * as Ttl from '
|
|
19
|
-
import * as Value from '
|
|
7
|
+
import type * as App from '../../../App.js'
|
|
8
|
+
import * as Auth from '../../../internal/Auth.js'
|
|
9
|
+
import * as Cache from '../../../internal/Cache.js'
|
|
10
|
+
import * as Cursor from '../../../internal/Cursor.js'
|
|
11
|
+
import * as Mpp from '../../../internal/Mpp.js'
|
|
12
|
+
import * as OpenApi from '../../../internal/OpenApi.js'
|
|
13
|
+
import * as Response from '../../../internal/Response.js'
|
|
14
|
+
import * as Schema from '../../../internal/Schema.js'
|
|
15
|
+
import * as Store from '../../../internal/Store.js'
|
|
16
|
+
import type * as Tidx from '../../../internal/Tidx.js'
|
|
17
|
+
import * as Timing from '../../../internal/Timing.js'
|
|
18
|
+
import * as Ttl from '../../../internal/Ttl.js'
|
|
19
|
+
import * as Value from '../../../internal/Value.js'
|
|
20
20
|
import * as Tokens from './tokens.js'
|
|
21
21
|
import * as Transfers from './transfers.js'
|
|
22
22
|
|
|
@@ -1667,7 +1667,7 @@ type TxGroup = {
|
|
|
1667
1667
|
*/
|
|
1668
1668
|
export function addresses() {
|
|
1669
1669
|
return new Hono<App.Environment>().get(
|
|
1670
|
-
'/:address/activities',
|
|
1670
|
+
'/v1/addresses/:address/activities',
|
|
1671
1671
|
Auth.policy({ apiKey: { scopes: ['data:read'] }, mpp: true, public: true }),
|
|
1672
1672
|
OpenApi.validate('param', schema.getAddressActivities.Params, {
|
|
1673
1673
|
code: 'address_invalid',
|
|
@@ -1775,7 +1775,7 @@ export function addresses() {
|
|
|
1775
1775
|
*/
|
|
1776
1776
|
export function transactions() {
|
|
1777
1777
|
return new Hono<App.Environment>().get(
|
|
1778
|
-
'/:transactionHash/activities',
|
|
1778
|
+
'/v1/transactions/:transactionHash/activities',
|
|
1779
1779
|
Auth.policy({ apiKey: { scopes: ['data:read'] }, mpp: true, public: true }),
|
|
1780
1780
|
OpenApi.validate('param', schema.getTransactionActivities.Params, {
|
|
1781
1781
|
code: 'transaction_invalid',
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { Hono } from 'hono'
|
|
2
2
|
|
|
3
|
-
import type * as App from '
|
|
3
|
+
import type * as App from '../../../App.js'
|
|
4
4
|
import * as Activities from './activities.js'
|
|
5
5
|
import * as Balances from './balances.js'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Composes the `/addresses/:address/*` route surface from the
|
|
9
|
-
* sub-routers exported by each resource module. The handlers
|
|
10
|
-
* with the resource they describe (activities,
|
|
11
|
-
*
|
|
12
|
-
* stay nested under the parent resource.
|
|
8
|
+
* Composes the `/v1/addresses/:address/*` route surface from the
|
|
9
|
+
* address-scoped sub-routers exported by each resource module. The handlers,
|
|
10
|
+
* schemas, and paths live with the resource they describe (activities,
|
|
11
|
+
* balances); this composer only aggregates them so docs grouping stays by tag
|
|
12
|
+
* while URLs stay nested under the parent resource.
|
|
13
13
|
*
|
|
14
14
|
* Only subject-relative resources live here — rows that cannot be interpreted
|
|
15
15
|
* without the path address (activity classification, held-token balances).
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Schema } from 'tapimo'
|
|
2
2
|
import { Value as core_Value } from 'ox'
|
|
3
3
|
|
|
4
|
-
import * as TestApp from '
|
|
5
|
-
import * as Runtime from '
|
|
4
|
+
import * as TestApp from '../../../../test/App.js'
|
|
5
|
+
import * as Runtime from '../../../../test/runtime.js'
|
|
6
6
|
import * as Balances from './balances.js'
|
|
7
7
|
import * as Tokens from './tokens.js'
|
|
8
8
|
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { Hono, type Context } from 'hono'
|
|
2
2
|
import { Hex, Value as core_Value } from 'ox'
|
|
3
|
+
import { Actions } from 'viem/tempo'
|
|
3
4
|
import * as z from 'zod/mini'
|
|
4
5
|
|
|
5
|
-
import type * as App from '
|
|
6
|
-
import * as Auth from '
|
|
7
|
-
import * as Cache from '
|
|
8
|
-
import * as Cursor from '
|
|
9
|
-
import * as OpenApi from '
|
|
10
|
-
import * as Response from '
|
|
11
|
-
import * as Schema from '
|
|
12
|
-
import * as Timing from '
|
|
13
|
-
import * as Value from '
|
|
14
|
-
import * as VerifiedTokens from '
|
|
6
|
+
import type * as App from '../../../App.js'
|
|
7
|
+
import * as Auth from '../../../internal/Auth.js'
|
|
8
|
+
import * as Cache from '../../../internal/Cache.js'
|
|
9
|
+
import * as Cursor from '../../../internal/Cursor.js'
|
|
10
|
+
import * as OpenApi from '../../../internal/OpenApi.js'
|
|
11
|
+
import * as Response from '../../../internal/Response.js'
|
|
12
|
+
import * as Schema from '../../../internal/Schema.js'
|
|
13
|
+
import * as Timing from '../../../internal/Timing.js'
|
|
14
|
+
import * as Value from '../../../internal/Value.js'
|
|
15
|
+
import * as VerifiedTokens from '../../../internal/VerifiedTokens.js'
|
|
15
16
|
import * as FeeAmm from './fee-amm.js'
|
|
16
17
|
import * as Tokens from './tokens.js'
|
|
17
18
|
|
|
@@ -150,7 +151,7 @@ export namespace schema {
|
|
|
150
151
|
*/
|
|
151
152
|
export function addresses() {
|
|
152
153
|
return new Hono<App.Environment>().get(
|
|
153
|
-
'/:address/balances',
|
|
154
|
+
'/v1/addresses/:address/balances',
|
|
154
155
|
Auth.policy({ apiKey: { scopes: ['data:read'] }, mpp: true, public: true }),
|
|
155
156
|
OpenApi.validate('param', schema.getAddressBalances.Params, {
|
|
156
157
|
code: 'address_invalid',
|
|
@@ -353,6 +354,39 @@ async function getAddressBalances(
|
|
|
353
354
|
|
|
354
355
|
if (holdings.data.length === 0) return { data: [], nextCursor: holdings.nextCursor }
|
|
355
356
|
|
|
357
|
+
const client = c.get('getClient')(chainId)
|
|
358
|
+
// TODO: remove once https://github.com/tempoxyz/tidx/commit/2f37b44172d381fd00234ef23f79ed1e1d69c470 deployed.
|
|
359
|
+
const corrected = await Timing.time(c, 'balances_rpc', async () => {
|
|
360
|
+
const results = await client
|
|
361
|
+
.multicall({
|
|
362
|
+
allowFailure: true,
|
|
363
|
+
contracts: holdings.data.map((holding) =>
|
|
364
|
+
Actions.token.getBalance.call(client, { account: address, token: holding.address }),
|
|
365
|
+
),
|
|
366
|
+
})
|
|
367
|
+
.catch(() => undefined)
|
|
368
|
+
|
|
369
|
+
const rows: { address: Hex.Hex; amount: string }[] = []
|
|
370
|
+
for (const [index, holding] of holdings.data.entries()) {
|
|
371
|
+
const result = results?.[index]
|
|
372
|
+
if (!result || result.status !== 'success' || typeof result.result !== 'bigint') {
|
|
373
|
+
rows.push(holding)
|
|
374
|
+
continue
|
|
375
|
+
}
|
|
376
|
+
if (result.result === 0n) continue
|
|
377
|
+
rows.push({ address: holding.address, amount: result.result.toString() })
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
rows.sort((a, b) => {
|
|
381
|
+
const delta = BigInt(b.amount) - BigInt(a.amount)
|
|
382
|
+
if (delta !== 0n) return delta > 0n ? 1 : -1
|
|
383
|
+
return a.address < b.address ? -1 : a.address > b.address ? 1 : 0
|
|
384
|
+
})
|
|
385
|
+
return rows
|
|
386
|
+
})
|
|
387
|
+
|
|
388
|
+
if (corrected.length === 0) return { data: [], nextCursor: holdings.nextCursor }
|
|
389
|
+
|
|
356
390
|
// Resolve token metadata for each balance. The endpoint's contract is a
|
|
357
391
|
// balance with its `token` reference inlined per row (and `formatted` needs
|
|
358
392
|
// the token `decimals`), so a row whose metadata cannot be resolved is
|
|
@@ -365,7 +399,7 @@ async function getAddressBalances(
|
|
|
365
399
|
// so it is never fetched here.
|
|
366
400
|
const resolved = await Timing.time(c, 'tokens', () =>
|
|
367
401
|
Promise.all(
|
|
368
|
-
|
|
402
|
+
corrected.map((holding) =>
|
|
369
403
|
Tokens.resolveToken(c, {
|
|
370
404
|
address: holding.address,
|
|
371
405
|
chainId,
|
|
@@ -2,9 +2,9 @@ import { Schema } from 'tapimo'
|
|
|
2
2
|
import { Hex } from 'ox'
|
|
3
3
|
import { zeroHash } from 'viem'
|
|
4
4
|
|
|
5
|
-
import * as TestApp from '
|
|
6
|
-
import * as Runtime from '
|
|
7
|
-
import * as Viem from '
|
|
5
|
+
import * as TestApp from '../../../../test/App.js'
|
|
6
|
+
import * as Runtime from '../../../../test/runtime.js'
|
|
7
|
+
import * as Viem from '../../../../test/Viem.js'
|
|
8
8
|
import * as Blocks from './blocks.js'
|
|
9
9
|
import * as Transactions from './transactions.js'
|
|
10
10
|
|
|
@@ -2,17 +2,17 @@ import { Hono, type Context, type MiddlewareHandler } from 'hono'
|
|
|
2
2
|
import { Hex } from 'ox'
|
|
3
3
|
import * as z from 'zod/mini'
|
|
4
4
|
|
|
5
|
-
import type * as App from '
|
|
6
|
-
import * as Auth from '
|
|
7
|
-
import * as Cache from '
|
|
8
|
-
import * as Cursor from '
|
|
9
|
-
import * as OpenApi from '
|
|
10
|
-
import * as Response from '
|
|
11
|
-
import * as Schema from '
|
|
12
|
-
import * as Store from '
|
|
13
|
-
import * as Timing from '
|
|
14
|
-
import * as Ttl from '
|
|
15
|
-
import * as Value from '
|
|
5
|
+
import type * as App from '../../../App.js'
|
|
6
|
+
import * as Auth from '../../../internal/Auth.js'
|
|
7
|
+
import * as Cache from '../../../internal/Cache.js'
|
|
8
|
+
import * as Cursor from '../../../internal/Cursor.js'
|
|
9
|
+
import * as OpenApi from '../../../internal/OpenApi.js'
|
|
10
|
+
import * as Response from '../../../internal/Response.js'
|
|
11
|
+
import * as Schema from '../../../internal/Schema.js'
|
|
12
|
+
import * as Store from '../../../internal/Store.js'
|
|
13
|
+
import * as Timing from '../../../internal/Timing.js'
|
|
14
|
+
import * as Ttl from '../../../internal/Ttl.js'
|
|
15
|
+
import * as Value from '../../../internal/Value.js'
|
|
16
16
|
|
|
17
17
|
/** Example block number surfaced in OpenAPI docs. */
|
|
18
18
|
const exampleBlockNumber = '1000000'
|
|
@@ -382,7 +382,7 @@ export function blocks() {
|
|
|
382
382
|
|
|
383
383
|
return new Hono<App.Environment>()
|
|
384
384
|
.get(
|
|
385
|
-
'/',
|
|
385
|
+
'/v1/blocks',
|
|
386
386
|
Auth.policy({ apiKey: { scopes: ['data:read'] }, mpp: true, public: true }),
|
|
387
387
|
OpenApi.validate('query', schema.getBlocks.Query, {
|
|
388
388
|
code: 'query_invalid',
|
|
@@ -425,7 +425,7 @@ export function blocks() {
|
|
|
425
425
|
},
|
|
426
426
|
)
|
|
427
427
|
.get(
|
|
428
|
-
'/:block',
|
|
428
|
+
'/v1/blocks/:block',
|
|
429
429
|
Auth.policy({ apiKey: { scopes: ['data:read'] }, mpp: true, public: true }),
|
|
430
430
|
OpenApi.validate('param', schema.getBlock.Params, {
|
|
431
431
|
code: 'block_invalid',
|
|
@@ -590,7 +590,7 @@ export function blocks() {
|
|
|
590
590
|
*/
|
|
591
591
|
export function blocksByTimestampCompat() {
|
|
592
592
|
return new Hono<App.Environment>().get(
|
|
593
|
-
'/:chainId/blocks/by-timestamp',
|
|
593
|
+
'/chains/:chainId/blocks/by-timestamp',
|
|
594
594
|
Auth.policy({ apiKey: { scopes: ['data:read'] }, mpp: true, public: true }),
|
|
595
595
|
OpenApi.validate('param', schema.getBlockByTimestamp.Params, {
|
|
596
596
|
code: 'chain_id_invalid',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Address, Hash } from 'ox'
|
|
2
2
|
|
|
3
|
-
import * as TestApp from '
|
|
4
|
-
import * as Runtime from '
|
|
3
|
+
import * as TestApp from '../../../../test/App.js'
|
|
4
|
+
import * as Runtime from '../../../../test/runtime.js'
|
|
5
5
|
import * as Coingecko from './coingecko.js'
|
|
6
6
|
|
|
7
7
|
// The adapter addresses the chain positionally, mirroring the legacy `/gecko`
|