tapimo 0.1.0 → 0.2.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 +28 -15
- package/dist/ApiKey.d.ts +3 -1
- package/dist/ApiKey.d.ts.map +1 -1
- package/dist/ApiKey.js +1 -0
- package/dist/ApiKey.js.map +1 -1
- package/dist/ApiKeys.d.ts +71 -3
- package/dist/ApiKeys.d.ts.map +1 -1
- package/dist/ApiKeys.js +117 -1
- package/dist/ApiKeys.js.map +1 -1
- package/dist/App.d.ts +7139 -4197
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +133 -329
- package/dist/App.js.map +1 -1
- package/dist/Scope.d.ts +11 -4
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +12 -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 +126 -53
- package/dist/admin/App.d.ts.map +1 -1
- package/dist/admin/apps/api-keys.d.ts +104 -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 +4 -1
- package/dist/admin/apps/scopes.d.ts.map +1 -1
- package/dist/admin/apps/verified-tokens.d.ts +115 -115
- 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 +1 -1
- package/dist/apps/data/App.d.ts +19176 -0
- package/dist/apps/data/App.d.ts.map +1 -0
- package/dist/apps/data/App.js +236 -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} +49 -49
- 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} +183 -183
- 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} +460 -460
- 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} +94 -94
- 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/{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} +12 -12
- package/dist/apps/data/routes/receipts.js.map +1 -0
- package/dist/apps/{rpc.d.ts → data/routes/rpc.d.ts} +4 -4
- package/dist/apps/data/routes/rpc.d.ts.map +1 -0
- package/dist/apps/{rpc.js → data/routes/rpc.js} +6 -6
- package/dist/apps/data/routes/rpc.js.map +1 -0
- package/dist/apps/{tokenlist.d.ts → data/routes/tokenlist.d.ts} +4 -4
- 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} +6 -6
- 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} +42 -42
- 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} +62 -62
- package/dist/apps/{webhooks.d.ts.map → data/routes/webhooks.d.ts.map} +1 -1
- package/dist/apps/{webhooks.js → data/routes/webhooks.js} +30 -26
- package/dist/apps/data/routes/webhooks.js.map +1 -0
- package/dist/apps/docs/App.d.ts +27 -0
- package/dist/apps/docs/App.d.ts.map +1 -0
- package/dist/apps/docs/App.js +122 -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/index.d.ts +4 -0
- package/dist/apps/index.d.ts.map +1 -0
- package/dist/apps/index.js +4 -0
- package/dist/apps/index.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 +2985 -0
- package/dist/apps/platform/App.d.ts.map +1 -0
- package/dist/apps/platform/App.js +74 -0
- package/dist/apps/platform/App.js.map +1 -0
- package/dist/apps/platform/index.d.ts +2 -0
- package/dist/apps/platform/index.d.ts.map +1 -0
- package/dist/apps/platform/index.js +2 -0
- package/dist/apps/platform/index.js.map +1 -0
- package/dist/apps/platform/routes/api-keys.d.ts +681 -0
- package/dist/apps/platform/routes/api-keys.d.ts.map +1 -0
- package/dist/apps/platform/routes/api-keys.js +328 -0
- package/dist/apps/platform/routes/api-keys.js.map +1 -0
- package/dist/apps/platform/routes/invitations.d.ts +733 -0
- package/dist/apps/platform/routes/invitations.d.ts.map +1 -0
- package/dist/apps/platform/routes/invitations.js +413 -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 +582 -0
- package/dist/apps/platform/routes/orgs.d.ts.map +1 -0
- package/dist/apps/platform/routes/orgs.js +265 -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/relay/App.d.ts +41 -0
- package/dist/apps/relay/App.d.ts.map +1 -0
- package/dist/apps/relay/App.js +103 -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 +193 -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 +1 -1
- package/dist/cli/Cli.js +1 -1
- package/dist/cli/commands/admin.d.ts +1 -1
- package/dist/cli/commands/admin.js +2 -2
- package/dist/cli/commands/admin.js.map +1 -1
- package/dist/db/Db.d.ts +10 -0
- package/dist/db/Db.d.ts.map +1 -1
- package/dist/db/Db.js +128 -0
- package/dist/db/Db.js.map +1 -1
- package/dist/db/Schema.d.ts +80 -0
- package/dist/db/Schema.d.ts.map +1 -1
- package/dist/db/Schema.js +99 -0
- package/dist/db/Schema.js.map +1 -1
- 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 +44 -0
- package/dist/db/tables/organizations.d.ts.map +1 -1
- package/dist/db/tables/organizations.js +89 -0
- 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/sponsoredTransactions.d.ts +120 -0
- package/dist/db/tables/sponsoredTransactions.d.ts.map +1 -0
- package/dist/db/tables/sponsoredTransactions.js +161 -0
- package/dist/db/tables/sponsoredTransactions.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 +32 -2
- package/dist/handlers/internal/sponsorship.d.ts.map +1 -1
- package/dist/handlers/internal/sponsorship.js +34 -9
- package/dist/handlers/internal/sponsorship.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/internal/Auth.d.ts +208 -6
- package/dist/internal/Auth.d.ts.map +1 -1
- package/dist/internal/Auth.js +500 -21
- package/dist/internal/Auth.js.map +1 -1
- package/dist/internal/Log.d.ts +7 -3
- package/dist/internal/Log.d.ts.map +1 -1
- package/dist/internal/Log.js +4 -0
- package/dist/internal/Log.js.map +1 -1
- package/dist/internal/OpenApi.d.ts +0 -19
- package/dist/internal/OpenApi.d.ts.map +1 -1
- package/dist/internal/OpenApi.js +0 -57
- package/dist/internal/OpenApi.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/package.json +31 -5
- package/src/ApiKey.ts +1 -0
- package/src/ApiKeys.test.ts +104 -1
- package/src/ApiKeys.ts +154 -1
- package/src/App.test.ts +11187 -179
- package/src/App.ts +200 -420
- package/src/Client.test-d.ts +306 -15
- package/src/Scope.ts +13 -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 +5 -1
- package/src/admin/apps/verified-tokens.ts +1 -1
- package/src/admin/ui.generated.ts +1 -1
- package/src/apps/composition.test.ts +66 -0
- package/src/apps/data/App.ts +295 -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/{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} +13 -13
- package/src/apps/{rpc.test.ts → data/routes/rpc.test.ts} +44 -5
- package/src/apps/{rpc.ts → data/routes/rpc.ts} +7 -7
- 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} +6 -6
- package/src/apps/{webhooks.ts → data/routes/webhooks.ts} +39 -35
- package/src/apps/docs/App.ts +136 -0
- package/src/apps/docs/index.ts +1 -0
- package/src/apps/index.ts +3 -0
- package/src/apps/metadata.ts +23 -0
- package/src/apps/platform/App.ts +130 -0
- package/src/apps/platform/index.ts +1 -0
- package/src/apps/platform/routes/api-keys.test.ts +330 -0
- package/src/apps/platform/routes/api-keys.ts +427 -0
- package/src/apps/platform/routes/invitations.test.ts +361 -0
- package/src/apps/platform/routes/invitations.ts +519 -0
- package/src/apps/platform/routes/me.test.ts +121 -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 +343 -0
- package/src/apps/platform/routes/projects.test.ts +181 -0
- package/src/apps/platform/routes/projects.ts +367 -0
- package/src/apps/relay/App.test.ts +484 -0
- package/src/apps/relay/App.ts +128 -0
- package/src/apps/relay/Sponsorships.test.ts +375 -0
- package/src/apps/relay/Sponsorships.ts +305 -0
- package/src/apps/relay/index.ts +2 -0
- package/src/cli/Cli.ts +1 -1
- package/src/cli/commands/admin.ts +2 -2
- package/src/db/Db.ts +159 -0
- package/src/db/Schema.ts +137 -0
- package/src/db/tables/invitations.ts +198 -0
- package/src/db/tables/memberships.ts +208 -0
- package/src/db/tables/organizations.test.ts +37 -1
- package/src/db/tables/organizations.ts +105 -0
- package/src/db/tables/projects.ts +107 -0
- package/src/db/tables/sponsoredTransactions.test.ts +218 -0
- package/src/db/tables/sponsoredTransactions.ts +236 -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 +74 -15
- package/src/handlers/{internal/relay.localnet.test.ts → relay.test.ts} +2 -2
- package/src/handlers/relay.ts +23 -5
- package/src/internal/Auth.test.ts +316 -0
- package/src/internal/Auth.ts +691 -25
- package/src/internal/Cursor.test.ts +3 -2
- package/src/internal/Log.test.ts +1 -1
- package/src/internal/Log.ts +11 -3
- package/src/internal/MetricSink.ts +1 -1
- package/src/internal/OpenApi.ts +0 -59
- 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 +4 -4
- package/src/internal/Webhooks.ts +1 -1
- 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
package/dist/App.js
CHANGED
|
@@ -4,46 +4,36 @@ import { cors as hono_cors } from 'hono/cors';
|
|
|
4
4
|
import { HTTPException } from 'hono/http-exception';
|
|
5
5
|
import { requestId } from 'hono/request-id';
|
|
6
6
|
import { generateSpecs } from 'hono-openapi';
|
|
7
|
-
import { Handler as vocs_Handler } from 'vocs/server';
|
|
8
|
-
import * as z from 'zod/mini';
|
|
9
7
|
import * as ApiKey from './ApiKey.js';
|
|
10
8
|
import * as Assets from './Assets.js';
|
|
11
9
|
import * as Auth from './internal/Auth.js';
|
|
12
10
|
import * as Db from './db/Db.js';
|
|
13
11
|
import * as EdgeCache from './internal/EdgeCache.js';
|
|
14
|
-
import * as Handler from './Handler.js';
|
|
15
12
|
import * as Log from './internal/Log.js';
|
|
16
13
|
import * as MetricSink from './internal/MetricSink.js';
|
|
17
14
|
import * as OpenApi from './internal/OpenApi.js';
|
|
18
15
|
import * as Store from './internal/Store.js';
|
|
19
16
|
import * as Path from './internal/Path.js';
|
|
20
17
|
import * as Response from './internal/Response.js';
|
|
21
|
-
import * as Schema from './internal/Schema.js';
|
|
22
|
-
import * as Tidx from './internal/Tidx.js';
|
|
23
18
|
import * as Timing from './internal/Timing.js';
|
|
24
|
-
import * as VerifiedTokens from './internal/VerifiedTokens.js';
|
|
25
19
|
import * as Viem from './internal/Viem.js';
|
|
26
20
|
import openrpcSpec from './openrpc.json' with { type: 'json' };
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
import { transfers } from './apps/transfers.js';
|
|
39
|
-
import { verifiedTokens } from './apps/verified-tokens.js';
|
|
40
|
-
import { tokenlist } from './apps/tokenlist.js';
|
|
41
|
-
import { schema as webhookSchema, webhooks } from './apps/webhooks.js';
|
|
21
|
+
import * as Metadata from './apps/metadata.js';
|
|
22
|
+
import * as Data from './apps/data/App.js';
|
|
23
|
+
import * as Platform from './apps/platform/App.js';
|
|
24
|
+
export var data = Data.data;
|
|
25
|
+
export var platform = Platform.platform;
|
|
26
|
+
// Type anchor only — never invoked. Expresses the canonical composition so
|
|
27
|
+
// `App` (and thus `Client`) reflect the full route surface; real consumers
|
|
28
|
+
// compose explicitly.
|
|
29
|
+
function compose(options) {
|
|
30
|
+
return create(options).route('/', data()).route('/', platform());
|
|
31
|
+
}
|
|
42
32
|
/** Top-level OpenAPI `info.description`, rendered above the reference. */
|
|
43
33
|
const infoDescription = 'REST API for reading and interacting with Tempo';
|
|
44
34
|
/** Creates the Tempo API Hono app. */
|
|
45
35
|
export function create(options) {
|
|
46
|
-
const {
|
|
36
|
+
const { path = '/' } = options;
|
|
47
37
|
// Capture as the literal generic so `Hono.basePath(...)` preserves the
|
|
48
38
|
// typed prefix. testClient's `Client<T, ...>` inference collapses to a
|
|
49
39
|
// `Record<string, ...>` index signature when the BasePath generic is the
|
|
@@ -58,30 +48,6 @@ export function create(options) {
|
|
|
58
48
|
// Authoritative state lives elsewhere: webhooks + verified tokens in
|
|
59
49
|
// `options.db`, API-key records in `options.kv`.
|
|
60
50
|
const store = options.cache?.store ?? Store.memory();
|
|
61
|
-
// Memoize one viem client per resolved upstream. Clients are stateless HTTP
|
|
62
|
-
// transports, so reusing them avoids per-request construction cost. The cache
|
|
63
|
-
// key is the resolved output (`url` + `basicAuth` + `chainId`), not the
|
|
64
|
-
// principal, so a resolver `rpc` may branch on any principal field while
|
|
65
|
-
// client cardinality stays bounded by the number of distinct upstreams —
|
|
66
|
-
// callers that resolve to the same upstream share a client.
|
|
67
|
-
const clients = new Map();
|
|
68
|
-
const getClient = (chainId = defaultChainId, principal = null) => {
|
|
69
|
-
// Resolve to derive the cache key; `Viem.getClient` re-resolves to build the
|
|
70
|
-
// client on a miss. `resolve` is pure and cheap, so the extra call is free.
|
|
71
|
-
const { url, basicAuth } = Viem.resolve(rpc, { chainId, principal });
|
|
72
|
-
const cacheKey = `${url}|${basicAuth ?? ''}|${chainId}`;
|
|
73
|
-
const existing = clients.get(cacheKey);
|
|
74
|
-
if (existing)
|
|
75
|
-
return existing;
|
|
76
|
-
const client = Viem.getClient({ chainId, principal, rpc });
|
|
77
|
-
clients.set(cacheKey, client);
|
|
78
|
-
return client;
|
|
79
|
-
};
|
|
80
|
-
// Memoize TIDX clients per `chainId` so the base URL resolver runs once per
|
|
81
|
-
// chain instead of on every request. The same factory backs the scheduled
|
|
82
|
-
// webhook poller (`Webhooks.createPoller`), keeping client construction in
|
|
83
|
-
// one place.
|
|
84
|
-
const getTidx = Tidx.createGetClient({ defaultChainId, tidx: options.tidx });
|
|
85
51
|
// Build the app in two phases: register middleware imperatively, then chain
|
|
86
52
|
// route mounts so the merged Hono schema flows through the return type. The
|
|
87
53
|
// chained type is what makes `testClient(create())` produce typed path
|
|
@@ -134,68 +100,21 @@ export function create(options) {
|
|
|
134
100
|
return recordAnalytics?.(entry);
|
|
135
101
|
},
|
|
136
102
|
}));
|
|
137
|
-
// The chain ids this deployment serves: the built-in public chains plus the
|
|
138
|
-
// configured `defaultChainId` and any explicit `supportedChainIds`. Exposed on
|
|
139
|
-
// context so mounted apps with a path `chainId` (e.g. GeckoTerminal) can guard
|
|
140
|
-
// it too.
|
|
141
|
-
const supportedChainIds = new Set([
|
|
142
|
-
...Object.keys(Viem.url).map(Number),
|
|
143
|
-
...Object.keys(Tidx.url).map(Number),
|
|
144
|
-
defaultChainId,
|
|
145
|
-
...(options.supportedChainIds ?? []),
|
|
146
|
-
]);
|
|
147
103
|
// Normalize the `db` option: the plain form is `{ source }` with no cached
|
|
148
104
|
// side; `cached` falls back to `source` so consumers never branch.
|
|
149
105
|
const db = 'source' in options.db ? options.db : { source: options.db };
|
|
106
|
+
// Built-in auth: the session surface (mounted last) plus the enforcement
|
|
107
|
+
// middleware (installed below), wired together in `Auth.install`.
|
|
108
|
+
const auth = Auth.install({ auth: options.auth, db: db.source, kv: options.kv });
|
|
150
109
|
base.use('*', Timing.middleware());
|
|
151
110
|
base.use('*', async (c, next) => {
|
|
152
|
-
// Put app-level dependencies on Hono context so mounted handlers only
|
|
153
|
-
// receive request-local state from `c`.
|
|
154
111
|
c.set('basePath', basePath);
|
|
155
|
-
c.set('chainId', defaultChainId);
|
|
156
112
|
c.set('db', db.source);
|
|
157
113
|
c.set('dbCached', db.cached ?? db.source);
|
|
158
|
-
c.set('getAsset', createGetAsset({ assets, basePath, origin: new URL(c.req.url).origin }));
|
|
159
|
-
c.set('getClient', (chainId) => getClient(chainId, Auth.getPrincipal(c)));
|
|
160
|
-
c.set('getTidx', (chainId) => getTidx(chainId, Auth.getPrincipal(c)));
|
|
161
114
|
c.set('kv', options.kv);
|
|
162
|
-
c.set('rpc', rpc);
|
|
163
115
|
c.set('store', store);
|
|
164
|
-
c.set('supportedChainIds', supportedChainIds);
|
|
165
|
-
c.set('tidx', options.tidx);
|
|
166
|
-
// Feature configs default to enabled empty configs; `false` disables.
|
|
167
|
-
c.set('verifiedTokens', options.verifiedTokens === false ? undefined : (options.verifiedTokens ?? {})); // prettier-ignore
|
|
168
|
-
c.set('webhook', options.webhook === false ? undefined : (options.webhook ?? {}));
|
|
169
116
|
await next();
|
|
170
117
|
});
|
|
171
|
-
// Reject a syntactically valid `chainId` this deployment does not serve before
|
|
172
|
-
// it reaches an upstream — an unknown chain otherwise hits the configured
|
|
173
|
-
// RPC/indexer (a static `tidx.baseUrl` answers for any chain id) and comes
|
|
174
|
-
// back as an opaque `upstream_error`.
|
|
175
|
-
base.use('*', async (c, next) => {
|
|
176
|
-
const raw = c.req.query('chainId') ?? c.req.query('chain_id');
|
|
177
|
-
if (raw === undefined)
|
|
178
|
-
return next();
|
|
179
|
-
// Only reject a well-formed-but-unsupported chain here; malformed values
|
|
180
|
-
// (e.g. `abc`, `0`) fall through to the route's own query validation.
|
|
181
|
-
const parsed = Schema.ChainId.safeParse(raw);
|
|
182
|
-
if (!parsed.success || supportedChainIds.has(parsed.data))
|
|
183
|
-
return next();
|
|
184
|
-
return Response.unsupportedChainId(c, parsed.data, supportedChainIds);
|
|
185
|
-
});
|
|
186
|
-
// Skip the static asset route entirely when no store is configured; token
|
|
187
|
-
// logo URIs simply go unresolved.
|
|
188
|
-
if (assets)
|
|
189
|
-
base.use('/assets/*', async (c, next) => {
|
|
190
|
-
const key = stripAssetPath(c.req.path, basePath).replace(/^\/+/, '');
|
|
191
|
-
const asset = key ? await assets.get(key) : undefined;
|
|
192
|
-
if (!asset)
|
|
193
|
-
return next();
|
|
194
|
-
return c.body(asset.body, 200, {
|
|
195
|
-
'Cache-Control': 'public, max-age=86400',
|
|
196
|
-
'Content-Type': asset.contentType,
|
|
197
|
-
});
|
|
198
|
-
});
|
|
199
118
|
// Safety net: any non-2xx response (auth/validation errors, MPP `402`
|
|
200
119
|
// challenges, rate-limit `429`s, upstream `502`s, etc.) must never be
|
|
201
120
|
// cached. This wraps endpoint middleware and handlers registered below.
|
|
@@ -212,85 +131,71 @@ export function create(options) {
|
|
|
212
131
|
// latency.
|
|
213
132
|
if (options.cache?.edge !== false)
|
|
214
133
|
base.use('*', EdgeCache.middleware({ store }));
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
.
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
.
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
})
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
header('tempo-event-id', 'A unique, stable id for this event (`evt_…`). The same event may be delivered more than once, so use this id to skip duplicates.'),
|
|
281
|
-
header('tempo-event-type', 'What happened: `token:transfer`, `transaction:included`, `log:emitted`, `block:created`, or `ping`.'), // prettier-ignore
|
|
282
|
-
],
|
|
283
|
-
requestBody: {
|
|
284
|
-
content: { 'application/json': { schema: envelope } },
|
|
285
|
-
required: true,
|
|
286
|
-
},
|
|
287
|
-
responses: { '2xx': { description: 'Delivery acknowledged.' } },
|
|
288
|
-
summary: 'Webhook event delivery',
|
|
289
|
-
tags: ['Webhooks'],
|
|
290
|
-
},
|
|
291
|
-
},
|
|
292
|
-
},
|
|
293
|
-
};
|
|
134
|
+
const app = base.get('/health', OpenApi.describeRoute({ hide: true }), (c) => c.json({ status: 'ok' }, 200));
|
|
135
|
+
// Built-in enforcement: default-closed policies over OpenAPI-registered
|
|
136
|
+
// routes. `auth: false` leaves policies unenforced (tests only).
|
|
137
|
+
if (auth.middleware)
|
|
138
|
+
app.use('*', auth.middleware);
|
|
139
|
+
// Collect each mounted group's OpenAPI metadata: Hono's `.route()` drops
|
|
140
|
+
// sub-app metadata, so a group attaches it to its instance (a WeakMap) and we
|
|
141
|
+
// read it back here. Patching the runtime method, not the type, keeps `hc`.
|
|
142
|
+
const metadata = [];
|
|
143
|
+
const route = app.route.bind(app);
|
|
144
|
+
app.route = ((path, sub) => {
|
|
145
|
+
const entry = Metadata.read(sub);
|
|
146
|
+
if (entry)
|
|
147
|
+
metadata.push(entry);
|
|
148
|
+
return route(path, sub);
|
|
149
|
+
});
|
|
150
|
+
// Register the JSON error envelopes eagerly (they don't depend on mounted
|
|
151
|
+
// routes) so error handling is live before the first request and a consumer's
|
|
152
|
+
// `withSentry(app)` sees them already in place.
|
|
153
|
+
app.notFound((c) => Response.error(c, { code: 'not_found', message: 'Route not found', status: 404 }));
|
|
154
|
+
app.onError((cause, c) => {
|
|
155
|
+
if (cause instanceof HTTPException)
|
|
156
|
+
return errorFromException(c, cause);
|
|
157
|
+
// Redact any leaked API-key token from the logged error/stack.
|
|
158
|
+
console.error(ApiKey.redact(cause instanceof Error ? (cause.stack ?? cause.message) : String(cause)));
|
|
159
|
+
return Response.error(c, {
|
|
160
|
+
code: 'internal_error',
|
|
161
|
+
message: 'Internal server error',
|
|
162
|
+
status: 500,
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
// Mount the OpenAPI/OpenRPC documents and docs reference lazily on the first
|
|
166
|
+
// request, so the document sees the full route surface without a `seal()`
|
|
167
|
+
// step. The patched `fetch` runs this before Hono builds its matcher.
|
|
168
|
+
//
|
|
169
|
+
// Spec generation stays lazy: ordinary API traffic only installs the routes,
|
|
170
|
+
// while `/openapi.json` and the Vocs handler start the memoized build.
|
|
171
|
+
let spec;
|
|
172
|
+
const getSpec = () => (spec ??= buildSpec());
|
|
173
|
+
const buildSpec = async () => {
|
|
174
|
+
// Merge each mounted group's contributed OpenAPI metadata (tags, security
|
|
175
|
+
// schemes, webhooks block). Unused tags/schemes don't render, so a subset
|
|
176
|
+
// app's document carries only what its groups contributed.
|
|
177
|
+
// The built-in session surface's metadata appends after every mounted
|
|
178
|
+
// group's, so consumer-mounted groups lead the document order.
|
|
179
|
+
const metadata_all = (() => {
|
|
180
|
+
const entry = auth.app ? Metadata.read(auth.app) : undefined;
|
|
181
|
+
return entry ? [...metadata, entry] : metadata;
|
|
182
|
+
})();
|
|
183
|
+
const contributedSchemes = Object.assign({}, ...metadata_all.map((m) => m.securitySchemes ?? {})); // prettier-ignore
|
|
184
|
+
const tags = metadata_all.flatMap((m) => m.tags ?? []);
|
|
185
|
+
// Tag groups contributed under the same name merge into one sidebar group,
|
|
186
|
+
// deduped and filtered to defined tags (a group may list a tag another
|
|
187
|
+
// surface defines, e.g. `Auth` from the built-in session surface).
|
|
188
|
+
const tagGroups = (() => {
|
|
189
|
+
const defined = new Set(tags.map((tag) => tag.name));
|
|
190
|
+
const groups = new Map();
|
|
191
|
+
for (const { name, tags: members } of metadata_all.flatMap((m) => m['x-tagGroups'] ?? []))
|
|
192
|
+
groups.set(name, { name, tags: [...(groups.get(name)?.tags ?? []), ...members] });
|
|
193
|
+
return [...groups.values()]
|
|
194
|
+
.map((group) => ({
|
|
195
|
+
...group,
|
|
196
|
+
tags: [...new Set(group.tags)].filter((tag) => defined.has(tag)),
|
|
197
|
+
})) // prettier-ignore
|
|
198
|
+
.filter((group) => group.tags.length > 0);
|
|
294
199
|
})();
|
|
295
200
|
const generated = await generateSpecs(app, {
|
|
296
201
|
documentation: {
|
|
@@ -309,6 +214,7 @@ export function create(options) {
|
|
|
309
214
|
scheme: 'bearer',
|
|
310
215
|
type: 'http',
|
|
311
216
|
},
|
|
217
|
+
...contributedSchemes,
|
|
312
218
|
},
|
|
313
219
|
},
|
|
314
220
|
info: {
|
|
@@ -322,70 +228,22 @@ export function create(options) {
|
|
|
322
228
|
{ url: basePath || '/', description: 'Relative to the host serving this document.' },
|
|
323
229
|
]),
|
|
324
230
|
],
|
|
325
|
-
tags
|
|
326
|
-
|
|
327
|
-
name: 'Activities',
|
|
328
|
-
description: 'A readable feed of what an account did onchain.',
|
|
329
|
-
},
|
|
330
|
-
{
|
|
331
|
-
name: 'Balances',
|
|
332
|
-
description: 'How much of each token an account holds.',
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
name: 'Blocks',
|
|
336
|
-
description: 'The ordered batches of transactions making up the chain.',
|
|
337
|
-
},
|
|
338
|
-
{
|
|
339
|
-
name: 'Exchange',
|
|
340
|
-
description: "Tempo's built-in stablecoin exchange: pairs, swaps, orders, prices.",
|
|
341
|
-
},
|
|
342
|
-
{
|
|
343
|
-
name: 'Fee AMM',
|
|
344
|
-
description: 'Pools that convert stablecoins to pay fees.',
|
|
345
|
-
},
|
|
346
|
-
{
|
|
347
|
-
name: 'Tokens',
|
|
348
|
-
description: 'TIP-20 token details, supply, and holders.',
|
|
349
|
-
},
|
|
350
|
-
{
|
|
351
|
-
name: 'Transactions',
|
|
352
|
-
description: 'Transactions submitted to Tempo, and their receipts.',
|
|
353
|
-
},
|
|
354
|
-
{
|
|
355
|
-
name: 'Transfers',
|
|
356
|
-
description: 'Token movements from executing transactions.',
|
|
357
|
-
},
|
|
358
|
-
{
|
|
359
|
-
name: 'Verified Tokens',
|
|
360
|
-
description: 'A curated, trusted list of TIP-20 tokens.',
|
|
361
|
-
},
|
|
362
|
-
...(options.webhook !== false
|
|
363
|
-
? [
|
|
364
|
-
{
|
|
365
|
-
name: 'Webhooks',
|
|
366
|
-
description: 'Get signed callbacks when onchain events happen.',
|
|
367
|
-
},
|
|
368
|
-
]
|
|
369
|
-
: []),
|
|
370
|
-
{
|
|
371
|
-
name: 'Indexer',
|
|
372
|
-
description: "Run read-only SQL queries against Tempo's indexed data.",
|
|
373
|
-
},
|
|
374
|
-
{
|
|
375
|
-
name: 'RPC',
|
|
376
|
-
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.',
|
|
377
|
-
},
|
|
378
|
-
{
|
|
379
|
-
name: 'CoinGecko',
|
|
380
|
-
description: "Exchange data in CoinGecko's GeckoTerminal format.",
|
|
381
|
-
},
|
|
382
|
-
],
|
|
231
|
+
tags,
|
|
232
|
+
...(tagGroups.length ? { 'x-tagGroups': tagGroups } : {}),
|
|
383
233
|
},
|
|
384
234
|
});
|
|
385
|
-
//
|
|
386
|
-
//
|
|
387
|
-
//
|
|
388
|
-
|
|
235
|
+
// Document the outbound `webhooks` block only when the webhook routes are
|
|
236
|
+
// actually mounted; a disabled feature hides its routes, so it must not
|
|
237
|
+
// advertise deliveries.
|
|
238
|
+
const hasWebhookRoutes = Object.keys(generated.paths).some((path) => /\/webhooks(\/|$)/.test(path));
|
|
239
|
+
const webhookBlocks = hasWebhookRoutes ? metadata_all.flatMap((m) => (m.webhooks ? [m.webhooks()] : [])) : []; // prettier-ignore
|
|
240
|
+
const webhooksDoc = webhookBlocks.length
|
|
241
|
+
? { webhooks: Object.assign({}, ...webhookBlocks) }
|
|
242
|
+
: {};
|
|
243
|
+
// Set per-operation `security` and the `402` payment-challenge response
|
|
244
|
+
// from each route's resolved auth policy (the single source of truth), so
|
|
245
|
+
// the anonymous option and `402` appear only where the public/MPP lanes
|
|
246
|
+
// are enabled, not on every operation via the document default.
|
|
389
247
|
applyAccess(generated.paths, Auth.describeAccess(app));
|
|
390
248
|
// Point the `/rpc` operation at the OpenRPC document via `x-openrpc`.
|
|
391
249
|
applyOpenrpcLink(generated.paths, basePath);
|
|
@@ -395,37 +253,32 @@ export function create(options) {
|
|
|
395
253
|
// tag and preserves document path order within a tag, so reordering here
|
|
396
254
|
// drives the sidebar sub-item order.
|
|
397
255
|
return { ...generated, ...webhooksDoc, paths: sortPaths(generated.paths) };
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
app.
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
256
|
+
};
|
|
257
|
+
let finalized = false;
|
|
258
|
+
const finalize = () => {
|
|
259
|
+
if (finalized)
|
|
260
|
+
return;
|
|
261
|
+
finalized = true;
|
|
262
|
+
app.get('/openapi.json', async (c) => c.json(await getSpec()));
|
|
263
|
+
// The OpenRPC document is a committed build artifact (no runtime generator);
|
|
264
|
+
// see scripts/openrpc/build.ts and `pnpm openrpc:build`.
|
|
265
|
+
app.get('/openrpc.json', (c) => c.json(openrpcSpec));
|
|
266
|
+
// Mount each docs group's reference factory (see `docs()` in `tapimo/docs`)
|
|
267
|
+
// last, so its catch-all sits behind every API route and the documents
|
|
268
|
+
// above — regardless of where the group sat in the composition chain.
|
|
269
|
+
for (const entry of metadata)
|
|
270
|
+
if (entry.docs)
|
|
271
|
+
app.route('/', entry.docs({ spec: getSpec }));
|
|
272
|
+
};
|
|
273
|
+
// Patch `fetch` to finalize once before dispatch. `request()` reads
|
|
274
|
+
// `this.fetch` dynamically so it picks up the patch, and the captured
|
|
275
|
+
// `originalFetch` still dispatches as a bare value (used by `App.listener`).
|
|
276
|
+
const originalFetch = app.fetch;
|
|
277
|
+
app.fetch = ((request, ...rest) => {
|
|
278
|
+
finalize();
|
|
279
|
+
return originalFetch(request, ...rest);
|
|
422
280
|
});
|
|
423
|
-
|
|
424
|
-
// the app would intersect the inferred Hono type and breaks `testClient`'s
|
|
425
|
-
// schema inference for downstream consumers. The cache `store` is owned by
|
|
426
|
-
// the caller (pass `options.cache.store`), and a Node listener is produced on
|
|
427
|
-
// demand via `App.listener(app)`.
|
|
428
|
-
return app;
|
|
281
|
+
return route('/', auth.app ?? new Hono());
|
|
429
282
|
}
|
|
430
283
|
/**
|
|
431
284
|
* Wraps a Tempo API app with a `node:http`-compatible request listener.
|
|
@@ -508,10 +361,11 @@ function sortPaths(paths) {
|
|
|
508
361
|
}
|
|
509
362
|
/**
|
|
510
363
|
* Sets per-operation `security` and the `402` payment-challenge response from
|
|
511
|
-
* each route's resolved access lanes (see {@link Auth.describeAccess}).
|
|
512
|
-
*
|
|
513
|
-
*
|
|
514
|
-
*
|
|
364
|
+
* each route's resolved access lanes (see {@link Auth.describeAccess}).
|
|
365
|
+
* Security options compose from the enabled lanes — API keys (header +
|
|
366
|
+
* bearer), sessions (cookie + bearer token), anonymous (`{}`) — and the `402`
|
|
367
|
+
* response is emitted only where the MPP lane is enabled; required API-key
|
|
368
|
+
* scopes are surfaced as the `x-required-scopes` extension.
|
|
515
369
|
*/
|
|
516
370
|
function applyAccess(paths, access) {
|
|
517
371
|
for (const item of Object.values(paths)) {
|
|
@@ -521,7 +375,13 @@ function applyAccess(paths, access) {
|
|
|
521
375
|
const lanes = access[op.operationId];
|
|
522
376
|
if (!lanes)
|
|
523
377
|
continue;
|
|
524
|
-
|
|
378
|
+
const security = [
|
|
379
|
+
...(lanes.apiKey ? [{ apiKey: [] }, { bearerAuth: [] }] : []),
|
|
380
|
+
...(lanes.session ? [{ session: [] }, ...(lanes.apiKey ? [] : [{ bearerAuth: [] }])] : []),
|
|
381
|
+
...(lanes.public ? [{}] : []),
|
|
382
|
+
];
|
|
383
|
+
if (security.length > 0)
|
|
384
|
+
op.security = security;
|
|
525
385
|
if (lanes.scopes.length > 0)
|
|
526
386
|
op['x-required-scopes'] = [...lanes.scopes];
|
|
527
387
|
if (lanes.mpp)
|
|
@@ -538,7 +398,7 @@ function applyAccess(paths, access) {
|
|
|
538
398
|
* method/param/return schemas it accepts.
|
|
539
399
|
*
|
|
540
400
|
* The public `/openapi.json` keeps a URL reference (small, conventional). The
|
|
541
|
-
* docs handler instead
|
|
401
|
+
* docs handler instead inlines the document — see `inlineOpenrpc` in `tapimo/docs`.
|
|
542
402
|
*/
|
|
543
403
|
function applyOpenrpcLink(paths, basePath) {
|
|
544
404
|
// `basePath` is `/` at the root mount and `/api` etc. otherwise; strip any
|
|
@@ -549,30 +409,6 @@ function applyOpenrpcLink(paths, basePath) {
|
|
|
549
409
|
if (isMutableOperation(op) && isRpcOperation(op))
|
|
550
410
|
op['x-openrpc'] = url;
|
|
551
411
|
}
|
|
552
|
-
/**
|
|
553
|
-
* Returns a shallow copy of `spec` with the JSON-RPC passthrough operation's
|
|
554
|
-
* `x-openrpc` replaced by the inline OpenRPC document, for the docs handler.
|
|
555
|
-
*
|
|
556
|
-
* Vocs expands `x-openrpc` at request time. A URL reference (as kept in the
|
|
557
|
-
* public `/openapi.json`) would make the docs worker fetch its own
|
|
558
|
-
* `/openrpc.json` — a self-subrequest that is unreliable on Cloudflare Workers
|
|
559
|
-
* and silently falls back to a single, unexpanded operation. Inlining the
|
|
560
|
-
* committed artifact keeps expansion deterministic across local and deployed
|
|
561
|
-
* environments, without bloating the public spec. Only the affected path/op are
|
|
562
|
-
* cloned; the rest of the (large) document is shared by reference.
|
|
563
|
-
*/
|
|
564
|
-
function inlineOpenrpc(spec) {
|
|
565
|
-
const paths = {};
|
|
566
|
-
for (const [pathname, item] of Object.entries(spec.paths)) {
|
|
567
|
-
let next = item;
|
|
568
|
-
if (isRecord(item))
|
|
569
|
-
for (const [method, op] of Object.entries(item))
|
|
570
|
-
if (isMutableOperation(op) && isRpcOperation(op))
|
|
571
|
-
next = { ...item, [method]: { ...op, 'x-openrpc': openrpcSpec } };
|
|
572
|
-
paths[pathname] = next;
|
|
573
|
-
}
|
|
574
|
-
return { ...spec, paths };
|
|
575
|
-
}
|
|
576
412
|
function isRpcOperation(op) {
|
|
577
413
|
return op.operationId === 'rpcRequest';
|
|
578
414
|
}
|
|
@@ -588,38 +424,6 @@ function isJson(response) {
|
|
|
588
424
|
function isRecord(value) {
|
|
589
425
|
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
590
426
|
}
|
|
591
|
-
function createGetAsset(options) {
|
|
592
|
-
const { assets, basePath, origin } = options;
|
|
593
|
-
// Without an asset store, every lookup misses so callers fall back to their
|
|
594
|
-
// "no static data" behavior (undefined logo URIs).
|
|
595
|
-
if (!assets)
|
|
596
|
-
return () => undefined;
|
|
597
|
-
return async (chainId, path) => {
|
|
598
|
-
// Public URLs include `/assets/:chainId`, but the store is keyed by
|
|
599
|
-
// `:chainId/:path` (e.g. an R2 object key), decoupled from the URL shape.
|
|
600
|
-
// `path` may be absolute (`Path.join` returns a leading slash); strip it so
|
|
601
|
-
// the key is `:chainId/:path`, not `:chainId//:path`.
|
|
602
|
-
const pathname = Path.join(basePath, 'assets', String(chainId), path);
|
|
603
|
-
const key = `${chainId}/${path.replace(/^\/+/, '')}`;
|
|
604
|
-
const asset = await assets.get(key);
|
|
605
|
-
if (!asset)
|
|
606
|
-
return undefined;
|
|
607
|
-
// Return an absolute public URL (scheme + host) against the request origin
|
|
608
|
-
// so logo URLs work for any consumer regardless of the API's domain.
|
|
609
|
-
return {
|
|
610
|
-
response: new globalThis.Response(asset.body, {
|
|
611
|
-
headers: { 'Content-Type': asset.contentType },
|
|
612
|
-
}),
|
|
613
|
-
uri: new URL(pathname, origin).toString(),
|
|
614
|
-
};
|
|
615
|
-
};
|
|
616
|
-
}
|
|
617
|
-
function stripAssetPath(path, basePath) {
|
|
618
|
-
for (const prefix of [`${Path.join(basePath, 'assets')}/`, '/assets/'])
|
|
619
|
-
if (path.startsWith(prefix))
|
|
620
|
-
return `/${path.slice(prefix.length)}`;
|
|
621
|
-
return path;
|
|
622
|
-
}
|
|
623
427
|
function getRequestListener(fetch) {
|
|
624
428
|
let listener;
|
|
625
429
|
return async (incoming_, outgoing_) => {
|