tapimo 0.0.0 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +119 -0
- package/dist/ApiKey.d.ts +65 -0
- package/dist/ApiKey.d.ts.map +1 -0
- package/dist/ApiKey.js +105 -0
- package/dist/ApiKey.js.map +1 -0
- package/dist/ApiKeySource.d.ts +166 -0
- package/dist/ApiKeySource.d.ts.map +1 -0
- package/dist/ApiKeySource.js +234 -0
- package/dist/ApiKeySource.js.map +1 -0
- package/dist/App.d.ts +19317 -0
- package/dist/App.d.ts.map +1 -0
- package/dist/App.js +612 -0
- package/dist/App.js.map +1 -0
- package/dist/Assets.d.ts +44 -0
- package/dist/Assets.d.ts.map +1 -0
- package/dist/Assets.js +23 -0
- package/dist/Assets.js.map +1 -0
- package/dist/Auth.d.ts +2 -0
- package/dist/Auth.d.ts.map +1 -0
- package/dist/Auth.js +2 -0
- package/dist/Auth.js.map +1 -0
- package/dist/Cli.d.ts +21 -0
- package/dist/Cli.d.ts.map +1 -0
- package/dist/Cli.js +13 -0
- package/dist/Cli.js.map +1 -0
- package/dist/Client.d.ts +20 -0
- package/dist/Client.d.ts.map +1 -0
- package/dist/Client.js +24 -0
- package/dist/Client.js.map +1 -0
- package/dist/Metrics.d.ts +70 -0
- package/dist/Metrics.d.ts.map +1 -0
- package/dist/Metrics.js +91 -0
- package/dist/Metrics.js.map +1 -0
- package/dist/Scope.d.ts +35 -0
- package/dist/Scope.d.ts.map +1 -0
- package/dist/Scope.js +38 -0
- package/dist/Scope.js.map +1 -0
- package/dist/Webhooks.d.ts +79 -0
- package/dist/Webhooks.d.ts.map +1 -0
- package/dist/Webhooks.js +107 -0
- package/dist/Webhooks.js.map +1 -0
- package/dist/admin/Access.d.ts +41 -0
- package/dist/admin/Access.d.ts.map +1 -0
- package/dist/admin/Access.js +75 -0
- package/dist/admin/Access.js.map +1 -0
- package/dist/admin/App.d.ts +1221 -0
- package/dist/admin/App.d.ts.map +1 -0
- package/dist/admin/App.js +113 -0
- package/dist/admin/App.js.map +1 -0
- package/dist/admin/apps/api-keys.d.ts +209 -0
- package/dist/admin/apps/api-keys.d.ts.map +1 -0
- package/dist/admin/apps/api-keys.js +129 -0
- package/dist/admin/apps/api-keys.js.map +1 -0
- package/dist/admin/apps/scopes.d.ts +46 -0
- package/dist/admin/apps/scopes.d.ts.map +1 -0
- package/dist/admin/apps/scopes.js +41 -0
- package/dist/admin/apps/scopes.js.map +1 -0
- package/dist/admin/apps/verified-tokens.d.ts +1206 -0
- package/dist/admin/apps/verified-tokens.d.ts.map +1 -0
- package/dist/admin/apps/verified-tokens.js +485 -0
- package/dist/admin/apps/verified-tokens.js.map +1 -0
- package/dist/admin/index.d.ts +3 -0
- package/dist/admin/index.d.ts.map +1 -0
- package/dist/admin/index.js +3 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/admin/ui.generated.d.ts +11 -0
- package/dist/admin/ui.generated.d.ts.map +1 -0
- package/dist/admin/ui.generated.js +43 -0
- package/dist/admin/ui.generated.js.map +1 -0
- package/dist/apps/activities.d.ts +18725 -0
- package/dist/apps/activities.d.ts.map +1 -0
- package/dist/apps/activities.js +3138 -0
- package/dist/apps/activities.js.map +1 -0
- package/dist/apps/addresses.d.ts +3662 -0
- package/dist/apps/addresses.d.ts.map +1 -0
- package/dist/apps/addresses.js +22 -0
- package/dist/apps/addresses.js.map +1 -0
- package/dist/apps/balances.d.ts +342 -0
- package/dist/apps/balances.d.ts.map +1 -0
- package/dist/apps/balances.js +393 -0
- package/dist/apps/balances.js.map +1 -0
- package/dist/apps/blocks.d.ts +931 -0
- package/dist/apps/blocks.d.ts.map +1 -0
- package/dist/apps/blocks.js +689 -0
- package/dist/apps/blocks.js.map +1 -0
- package/dist/apps/coingecko.d.ts +1053 -0
- package/dist/apps/coingecko.d.ts.map +1 -0
- package/dist/apps/coingecko.js +1015 -0
- package/dist/apps/coingecko.js.map +1 -0
- package/dist/apps/exchanges.d.ts +3000 -0
- package/dist/apps/exchanges.d.ts.map +1 -0
- package/dist/apps/exchanges.js +3570 -0
- package/dist/apps/exchanges.js.map +1 -0
- package/dist/apps/fee-amm.d.ts +640 -0
- package/dist/apps/fee-amm.d.ts.map +1 -0
- package/dist/apps/fee-amm.js +815 -0
- package/dist/apps/fee-amm.js.map +1 -0
- package/dist/apps/indexer.d.ts +116 -0
- package/dist/apps/indexer.d.ts.map +1 -0
- package/dist/apps/indexer.js +270 -0
- package/dist/apps/indexer.js.map +1 -0
- package/dist/apps/receipts.d.ts +1438 -0
- package/dist/apps/receipts.d.ts.map +1 -0
- package/dist/apps/receipts.js +874 -0
- package/dist/apps/receipts.js.map +1 -0
- package/dist/apps/rpc.d.ts +173 -0
- package/dist/apps/rpc.d.ts.map +1 -0
- package/dist/apps/rpc.js +191 -0
- package/dist/apps/rpc.js.map +1 -0
- package/dist/apps/tokenlist.d.ts +192 -0
- package/dist/apps/tokenlist.d.ts.map +1 -0
- package/dist/apps/tokenlist.js +153 -0
- package/dist/apps/tokenlist.js.map +1 -0
- package/dist/apps/tokens.d.ts +2246 -0
- package/dist/apps/tokens.d.ts.map +1 -0
- package/dist/apps/tokens.js +1789 -0
- package/dist/apps/tokens.js.map +1 -0
- package/dist/apps/transactions.d.ts +2327 -0
- package/dist/apps/transactions.d.ts.map +1 -0
- package/dist/apps/transactions.js +975 -0
- package/dist/apps/transactions.js.map +1 -0
- package/dist/apps/transfers.d.ts +589 -0
- package/dist/apps/transfers.d.ts.map +1 -0
- package/dist/apps/transfers.js +769 -0
- package/dist/apps/transfers.js.map +1 -0
- package/dist/apps/verified-tokens.d.ts +544 -0
- package/dist/apps/verified-tokens.d.ts.map +1 -0
- package/dist/apps/verified-tokens.js +234 -0
- package/dist/apps/verified-tokens.js.map +1 -0
- package/dist/apps/webhooks.d.ts +7684 -0
- package/dist/apps/webhooks.d.ts.map +1 -0
- package/dist/apps/webhooks.js +2112 -0
- package/dist/apps/webhooks.js.map +1 -0
- package/dist/cloudflare.d.ts +32 -0
- package/dist/cloudflare.d.ts.map +1 -0
- package/dist/cloudflare.js +45 -0
- package/dist/cloudflare.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/Auth.d.ts +298 -0
- package/dist/internal/Auth.d.ts.map +1 -0
- package/dist/internal/Auth.js +618 -0
- package/dist/internal/Auth.js.map +1 -0
- package/dist/internal/Cache.d.ts +74 -0
- package/dist/internal/Cache.d.ts.map +1 -0
- package/dist/internal/Cache.js +215 -0
- package/dist/internal/Cache.js.map +1 -0
- package/dist/internal/Cursor.d.ts +79 -0
- package/dist/internal/Cursor.d.ts.map +1 -0
- package/dist/internal/Cursor.js +116 -0
- package/dist/internal/Cursor.js.map +1 -0
- package/dist/internal/EdgeCache.d.ts +59 -0
- package/dist/internal/EdgeCache.d.ts.map +1 -0
- package/dist/internal/EdgeCache.js +174 -0
- package/dist/internal/EdgeCache.js.map +1 -0
- package/dist/internal/Log.d.ts +104 -0
- package/dist/internal/Log.d.ts.map +1 -0
- package/dist/internal/Log.js +118 -0
- package/dist/internal/Log.js.map +1 -0
- package/dist/internal/MetricSink.d.ts +65 -0
- package/dist/internal/MetricSink.d.ts.map +1 -0
- package/dist/internal/MetricSink.js +146 -0
- package/dist/internal/MetricSink.js.map +1 -0
- package/dist/internal/Mpp.d.ts +71 -0
- package/dist/internal/Mpp.d.ts.map +1 -0
- package/dist/internal/Mpp.js +105 -0
- package/dist/internal/Mpp.js.map +1 -0
- package/dist/internal/OpenApi.d.ts +313 -0
- package/dist/internal/OpenApi.d.ts.map +1 -0
- package/dist/internal/OpenApi.fonts.d.ts +2 -0
- package/dist/internal/OpenApi.fonts.d.ts.map +1 -0
- package/dist/internal/OpenApi.fonts.js +39 -0
- package/dist/internal/OpenApi.fonts.js.map +1 -0
- package/dist/internal/OpenApi.js +335 -0
- package/dist/internal/OpenApi.js.map +1 -0
- package/dist/internal/OpenApi.logo.d.ts +6 -0
- package/dist/internal/OpenApi.logo.d.ts.map +1 -0
- package/dist/internal/OpenApi.logo.js +19 -0
- package/dist/internal/OpenApi.logo.js.map +1 -0
- package/dist/internal/Path.d.ts +5 -0
- package/dist/internal/Path.d.ts.map +1 -0
- package/dist/internal/Path.js +16 -0
- package/dist/internal/Path.js.map +1 -0
- package/dist/internal/RateLimit.d.ts +60 -0
- package/dist/internal/RateLimit.d.ts.map +1 -0
- package/dist/internal/RateLimit.js +48 -0
- package/dist/internal/RateLimit.js.map +1 -0
- package/dist/internal/Response.d.ts +132 -0
- package/dist/internal/Response.d.ts.map +1 -0
- package/dist/internal/Response.js +72 -0
- package/dist/internal/Response.js.map +1 -0
- package/dist/internal/Schema.d.ts +257 -0
- package/dist/internal/Schema.d.ts.map +1 -0
- package/dist/internal/Schema.js +360 -0
- package/dist/internal/Schema.js.map +1 -0
- package/dist/internal/Store.d.ts +204 -0
- package/dist/internal/Store.d.ts.map +1 -0
- package/dist/internal/Store.js +291 -0
- package/dist/internal/Store.js.map +1 -0
- package/dist/internal/Tidx.d.ts +120 -0
- package/dist/internal/Tidx.d.ts.map +1 -0
- package/dist/internal/Tidx.js +156 -0
- package/dist/internal/Tidx.js.map +1 -0
- package/dist/internal/Timing.d.ts +22 -0
- package/dist/internal/Timing.d.ts.map +1 -0
- package/dist/internal/Timing.js +32 -0
- package/dist/internal/Timing.js.map +1 -0
- package/dist/internal/Ttl.d.ts +25 -0
- package/dist/internal/Ttl.d.ts.map +1 -0
- package/dist/internal/Ttl.js +49 -0
- package/dist/internal/Ttl.js.map +1 -0
- package/dist/internal/Value.d.ts +47 -0
- package/dist/internal/Value.d.ts.map +1 -0
- package/dist/internal/Value.js +122 -0
- package/dist/internal/Value.js.map +1 -0
- package/dist/internal/VerifiedTokens.d.ts +228 -0
- package/dist/internal/VerifiedTokens.d.ts.map +1 -0
- package/dist/internal/VerifiedTokens.js +450 -0
- package/dist/internal/VerifiedTokens.js.map +1 -0
- package/dist/internal/Viem.d.ts +2082 -0
- package/dist/internal/Viem.d.ts.map +1 -0
- package/dist/internal/Viem.js +63 -0
- package/dist/internal/Viem.js.map +1 -0
- package/dist/internal/WebhookDestination.d.ts +198 -0
- package/dist/internal/WebhookDestination.d.ts.map +1 -0
- package/dist/internal/WebhookDestination.js +170 -0
- package/dist/internal/WebhookDestination.js.map +1 -0
- package/dist/internal/Webhooks.d.ts +433 -0
- package/dist/internal/Webhooks.d.ts.map +1 -0
- package/dist/internal/Webhooks.js +489 -0
- package/dist/internal/Webhooks.js.map +1 -0
- package/dist/internal/webhookDestinations/betterStack.d.ts +26 -0
- package/dist/internal/webhookDestinations/betterStack.d.ts.map +1 -0
- package/dist/internal/webhookDestinations/betterStack.js +76 -0
- package/dist/internal/webhookDestinations/betterStack.js.map +1 -0
- package/dist/internal/webhookDestinations/slack.d.ts +59 -0
- package/dist/internal/webhookDestinations/slack.d.ts.map +1 -0
- package/dist/internal/webhookDestinations/slack.js +422 -0
- package/dist/internal/webhookDestinations/slack.js.map +1 -0
- package/dist/internal/webhookDestinations/url.d.ts +17 -0
- package/dist/internal/webhookDestinations/url.d.ts.map +1 -0
- package/dist/internal/webhookDestinations/url.js +130 -0
- package/dist/internal/webhookDestinations/url.js.map +1 -0
- package/dist/openrpc.json +5302 -0
- package/package.json +46 -4
- package/seeds/31318/icons/0x20c0000000000000000000000000000000000000.svg +1 -0
- package/seeds/31318/icons/0x20c0000000000000000000000000000000000001.svg +1 -0
- package/seeds/31318/icons/0x20c0000000000000000000000000000000000002.svg +1 -0
- package/seeds/31318/icons/0x20c0000000000000000000000000000000000003.svg +1 -0
- package/seeds/31318/verified-tokens.json +30 -0
- package/seeds/4217/icons/0x20c0000000000000000000000000000000000000.svg +25 -0
- package/seeds/4217/icons/0x20c000000000000000000000048c8f36df1c9a4a.svg +1 -0
- package/seeds/4217/icons/0x20c0000000000000000000000520792dcccccccc.svg +1 -0
- package/seeds/4217/icons/0x20c0000000000000000000000a6da882d075a4c3.svg +4 -0
- package/seeds/4217/icons/0x20c000000000000000000000111111111e910f0f.svg +30 -0
- package/seeds/4217/icons/0x20c00000000000000000000014f22ca97301eb73.svg +1 -0
- package/seeds/4217/icons/0x20c0000000000000000000001621e21f71cf12fb.svg +1 -0
- package/seeds/4217/icons/0x20c0000000000000000000002f52d5cc21a3207b.svg +1 -0
- package/seeds/4217/icons/0x20c0000000000000000000003158081efd85bfc2.svg +11 -0
- package/seeds/4217/icons/0x20c0000000000000000000003554d28269e0f3c2.svg +1 -0
- package/seeds/4217/icons/0x20c000000000000000000000383a23bacb546ab9.svg +1 -0
- package/seeds/4217/icons/0x20c00000000000000000000042109aef2f8b28e1.png +0 -0
- package/seeds/4217/icons/0x20c0000000000000000000005c0bac7cef389a11.svg +1 -0
- package/seeds/4217/icons/0x20c0000000000000000000006fd9a167923ba194.png +0 -0
- package/seeds/4217/icons/0x20c0000000000000000000007f7ba549dd0251b9.svg +1 -0
- package/seeds/4217/icons/0x20c0000000000000000000008191667423f70e67.svg +5 -0
- package/seeds/4217/icons/0x20c0000000000000000000008ee4fcff88888888.svg +1 -0
- package/seeds/4217/icons/0x20c0000000000000000000009a4a4b17e0dc6651.svg +1 -0
- package/seeds/4217/icons/0x20c000000000000000000000ab02d39df30bd17e.svg +1 -0
- package/seeds/4217/icons/0x20c000000000000000000000ae247a1130450f09.svg +1 -0
- package/seeds/4217/icons/0x20c000000000000000000000aeed2ec36a54d0e5.svg +1 -0
- package/seeds/4217/icons/0x20c000000000000000000000b9537d11c60e8b50.svg +1 -0
- package/seeds/4217/icons/0x20c000000000000000000000bd95bfb69fbe6ce3.svg +1 -0
- package/seeds/4217/icons/0x20c000000000000000000000c412ec89d0c08be5.svg +1 -0
- package/seeds/4217/icons/0x20c000000000000000000000f047dd7018e50367.png +0 -0
- package/seeds/4217/verified-tokens.json +177 -0
- package/seeds/42431/icons/0x20c0000000000000000000000000000000000000.svg +25 -0
- package/seeds/42431/icons/0x20c0000000000000000000000000000000000001.svg +1 -0
- package/seeds/42431/icons/0x20c0000000000000000000000000000000000002.svg +1 -0
- package/seeds/42431/icons/0x20c0000000000000000000000000000000000003.svg +1 -0
- package/seeds/42431/icons/0x20c0000000000000000000009e8d7eb59b783726.svg +1 -0
- package/seeds/42431/icons/0x20c000000000000000000000d72572838bbee59c.svg +1 -0
- package/seeds/42431/verified-tokens.json +44 -0
- package/seeds/openrpc/README.md +27 -0
- package/seeds/openrpc/execution-apis.json +8989 -0
- package/src/ApiKey.test.ts +91 -0
- package/src/ApiKey.ts +122 -0
- package/src/ApiKeySource.test-d.ts +11 -0
- package/src/ApiKeySource.test.ts +295 -0
- package/src/ApiKeySource.ts +303 -0
- package/src/App.test-d.ts +38 -0
- package/src/App.test.ts +65927 -0
- package/src/App.ts +855 -0
- package/src/Assets.ts +58 -0
- package/src/Auth.ts +1 -0
- package/src/Cli.test.ts +81 -0
- package/src/Cli.ts +38 -0
- package/src/Client.test-d.ts +1438 -0
- package/src/Client.test.ts +134 -0
- package/src/Client.ts +45 -0
- package/src/Metrics.ts +154 -0
- package/src/Scope.ts +50 -0
- package/src/Webhooks.test.ts +49 -0
- package/src/Webhooks.ts +172 -0
- package/src/admin/Access.test.ts +130 -0
- package/src/admin/Access.ts +87 -0
- package/src/admin/App.test.ts +225 -0
- package/src/admin/App.ts +216 -0
- package/src/admin/apps/api-keys.test.ts +156 -0
- package/src/admin/apps/api-keys.ts +157 -0
- package/src/admin/apps/scopes.test.ts +52 -0
- package/src/admin/apps/scopes.ts +47 -0
- package/src/admin/apps/verified-tokens.test.ts +415 -0
- package/src/admin/apps/verified-tokens.ts +566 -0
- package/src/admin/index.ts +2 -0
- package/src/admin/ui/plugin.ts +135 -0
- package/src/admin/ui/src/components/Checkbox.tsx +22 -0
- package/src/admin/ui/src/components/Dialog.tsx +32 -0
- package/src/admin/ui/src/components/MobileProfile.tsx +31 -0
- package/src/admin/ui/src/components/Page.tsx +53 -0
- package/src/admin/ui/src/components/TempoLogo.tsx +37 -0
- package/src/admin/ui/src/fonts/Pilat-Demi.woff2 +0 -0
- package/src/admin/ui/src/fonts/Pilat-Regular.woff2 +0 -0
- package/src/admin/ui/src/lib/api-keys.ts +63 -0
- package/src/admin/ui/src/lib/client.ts +15 -0
- package/src/admin/ui/src/lib/config.ts +57 -0
- package/src/admin/ui/src/lib/query-client.ts +26 -0
- package/src/admin/ui/src/lib/scopes.ts +25 -0
- package/src/admin/ui/src/lib/verified-tokens.ts +89 -0
- package/src/admin/ui/src/lib/wagmi.ts +18 -0
- package/src/admin/ui/src/routeTree.gen.ts +104 -0
- package/src/admin/ui/src/router.tsx +25 -0
- package/src/admin/ui/src/routes/__root.tsx +219 -0
- package/src/admin/ui/src/routes/api-keys.tsx +329 -0
- package/src/admin/ui/src/routes/index.tsx +7 -0
- package/src/admin/ui/src/routes/verified-tokens.tsx +331 -0
- package/src/admin/ui/src/styles.css +20 -0
- package/src/admin/ui/tsconfig.json +16 -0
- package/src/admin/ui/vite.config.ts +29 -0
- package/src/admin/ui.generated.ts +60 -0
- package/src/apps/activities.test.ts +1020 -0
- package/src/apps/activities.ts +3934 -0
- package/src/apps/addresses.ts +24 -0
- package/src/apps/balances.test.ts +274 -0
- package/src/apps/balances.ts +533 -0
- package/src/apps/blocks.test.ts +385 -0
- package/src/apps/blocks.ts +896 -0
- package/src/apps/coingecko.test.ts +218 -0
- package/src/apps/coingecko.ts +1383 -0
- package/src/apps/exchanges.test.ts +958 -0
- package/src/apps/exchanges.ts +4773 -0
- package/src/apps/fee-amm.test.ts +321 -0
- package/src/apps/fee-amm.ts +1121 -0
- package/src/apps/indexer.test.ts +153 -0
- package/src/apps/indexer.ts +330 -0
- package/src/apps/receipts.test.ts +285 -0
- package/src/apps/receipts.ts +1193 -0
- package/src/apps/rpc.test.ts +302 -0
- package/src/apps/rpc.ts +222 -0
- package/src/apps/tokenlist.test.ts +80 -0
- package/src/apps/tokenlist.ts +207 -0
- package/src/apps/tokens.test.ts +1062 -0
- package/src/apps/tokens.ts +2292 -0
- package/src/apps/transactions.test.ts +408 -0
- package/src/apps/transactions.ts +1363 -0
- package/src/apps/transfers.test.ts +371 -0
- package/src/apps/transfers.ts +1116 -0
- package/src/apps/verified-tokens.test.ts +114 -0
- package/src/apps/verified-tokens.ts +295 -0
- package/src/apps/webhooks.test.ts +1937 -0
- package/src/apps/webhooks.ts +2926 -0
- package/src/cloudflare.ts +55 -0
- package/src/index.ts +15 -0
- package/src/internal/Auth.test.ts +980 -0
- package/src/internal/Auth.ts +1012 -0
- package/src/internal/Cache.test.ts +240 -0
- package/src/internal/Cache.ts +262 -0
- package/src/internal/Cursor.test.ts +100 -0
- package/src/internal/Cursor.ts +149 -0
- package/src/internal/EdgeCache.test.ts +234 -0
- package/src/internal/EdgeCache.ts +224 -0
- package/src/internal/Errors.ts +14 -0
- package/src/internal/Log.test.ts +244 -0
- package/src/internal/Log.ts +216 -0
- package/src/internal/MetricSink.ts +220 -0
- package/src/internal/Mpp.test.ts +64 -0
- package/src/internal/Mpp.ts +141 -0
- package/src/internal/OpenApi.fonts.ts +38 -0
- package/src/internal/OpenApi.logo.ts +18 -0
- package/src/internal/OpenApi.ts +488 -0
- package/src/internal/Path.test.ts +14 -0
- package/src/internal/Path.ts +15 -0
- package/src/internal/RateLimit.test.ts +93 -0
- package/src/internal/RateLimit.ts +93 -0
- package/src/internal/Response.ts +131 -0
- package/src/internal/Schema.test.ts +34 -0
- package/src/internal/Schema.ts +523 -0
- package/src/internal/Store.test.ts +545 -0
- package/src/internal/Store.ts +526 -0
- package/src/internal/Tidx.local.test.ts +33 -0
- package/src/internal/Tidx.test.ts +294 -0
- package/src/internal/Tidx.ts +238 -0
- package/src/internal/Timing.test.ts +22 -0
- package/src/internal/Timing.ts +62 -0
- package/src/internal/Ttl.test.ts +18 -0
- package/src/internal/Ttl.ts +59 -0
- package/src/internal/Value.ts +114 -0
- package/src/internal/VerifiedTokens.test.ts +333 -0
- package/src/internal/VerifiedTokens.ts +645 -0
- package/src/internal/Viem.test.ts +115 -0
- package/src/internal/Viem.ts +165 -0
- package/src/internal/WebhookDestination.test.ts +648 -0
- package/src/internal/WebhookDestination.ts +331 -0
- package/src/internal/Webhooks.test.ts +668 -0
- package/src/internal/Webhooks.ts +940 -0
- package/src/internal/webhookDestinations/betterStack.ts +91 -0
- package/src/internal/webhookDestinations/slack.ts +496 -0
- package/src/internal/webhookDestinations/url.ts +128 -0
- package/src/openrpc.json +5302 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import * as z from 'zod/mini'
|
|
2
|
+
|
|
3
|
+
import * as Store from './Store.js'
|
|
4
|
+
|
|
5
|
+
/** Zod schemas owned by the rate-limit module. */
|
|
6
|
+
export namespace schema {
|
|
7
|
+
/** A rate-limit policy; the source of truth for {@link Limit}. */
|
|
8
|
+
export const Limit = z.object({
|
|
9
|
+
perMinute: z
|
|
10
|
+
.number()
|
|
11
|
+
.check(z.int(), z.nonnegative(), z.describe('Number of requests allowed per minute.')),
|
|
12
|
+
})
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Rate-limit policy. */
|
|
16
|
+
export type Limit = z.output<typeof schema.Limit>
|
|
17
|
+
|
|
18
|
+
/** Result returned by a rate-limit store. */
|
|
19
|
+
export type Result = {
|
|
20
|
+
/** Whether the request is within quota. */
|
|
21
|
+
allowed: boolean
|
|
22
|
+
/** Limit applied to the request. */
|
|
23
|
+
limit: number
|
|
24
|
+
/** Requests remaining in the active window. */
|
|
25
|
+
remaining: number
|
|
26
|
+
/** Reset timestamp in Unix seconds. */
|
|
27
|
+
reset: number
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Rate-limit store. */
|
|
31
|
+
export type RateLimitStore = {
|
|
32
|
+
/** Consumes one request from the active quota window. */
|
|
33
|
+
consume(options: RateLimitStore.ConsumeOptions): Promise<Result>
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export namespace RateLimitStore {
|
|
37
|
+
/** Options for consuming one request from a rate-limit store. */
|
|
38
|
+
export type ConsumeOptions = {
|
|
39
|
+
/** Quota key. */
|
|
40
|
+
key: string
|
|
41
|
+
/** Rate-limit policy. */
|
|
42
|
+
limit: Limit
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Creates a fixed-window rate-limit store over a counter {@link Store.Store}.
|
|
48
|
+
*
|
|
49
|
+
* Each consume is a single `Store.increment`, so a backend with a native
|
|
50
|
+
* counter (e.g. a Durable Object) is one atomic round trip; backends without
|
|
51
|
+
* one fall back to get + put, acceptable for dev/in-process stores only.
|
|
52
|
+
* The storage key is stable per quota key — the
|
|
53
|
+
* window lives in the TTL: the counter expires exactly at the end of the
|
|
54
|
+
* current minute, so the next window's first hit restarts at 1 and idle keys
|
|
55
|
+
* hold no storage. The sub-minute TTL rules out Cloudflare KV as a backend,
|
|
56
|
+
* which is unsuitable for enforced counters anyway.
|
|
57
|
+
*/
|
|
58
|
+
export function memory(options: memory.Options = {}): RateLimitStore {
|
|
59
|
+
const store = options.store ?? Store.memory()
|
|
60
|
+
const now = options.now ?? (() => new Date())
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
async consume(options) {
|
|
64
|
+
const time = now().getTime()
|
|
65
|
+
const bucket = Math.floor(time / 60_000)
|
|
66
|
+
// Every increment within a window recomputes the TTL against the same
|
|
67
|
+
// window end, so the counter's absolute expiry never moves under load.
|
|
68
|
+
const count = await Store.increment(store, `ratelimit:${options.key}`, {
|
|
69
|
+
ttl: (bucket + 1) * 60_000 - time,
|
|
70
|
+
})
|
|
71
|
+
const limit = options.limit.perMinute
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
allowed: count <= limit,
|
|
75
|
+
limit,
|
|
76
|
+
remaining: Math.max(limit - count, 0),
|
|
77
|
+
reset: Math.ceil(((bucket + 1) * 60_000) / 1_000),
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export declare namespace memory {
|
|
84
|
+
/** Options for creating an in-memory fixed-window rate-limit store. */
|
|
85
|
+
type Options = {
|
|
86
|
+
/** Store used to persist counters. */
|
|
87
|
+
store?: Store.Store | undefined
|
|
88
|
+
/** Clock used to calculate fixed windows. */
|
|
89
|
+
now?: (() => Date) | undefined
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export { type RateLimitStore as Store }
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { Context } from 'hono'
|
|
2
|
+
import type * as z from 'zod/mini'
|
|
3
|
+
|
|
4
|
+
/** Creates a JSON error response. */
|
|
5
|
+
export function error<const status extends error.Status, const code extends string>(
|
|
6
|
+
c: Context,
|
|
7
|
+
options: error.Options<status, code>,
|
|
8
|
+
) {
|
|
9
|
+
const { code, details, message, status } = options
|
|
10
|
+
// Error envelopes embed `requestId` and other per-request state, so they
|
|
11
|
+
// must never be cached by clients, proxies, or CDNs.
|
|
12
|
+
c.header('Cache-Control', 'no-store')
|
|
13
|
+
// Record the stable code so the canonical request log line (`Log.middleware`)
|
|
14
|
+
// can include it without re-parsing the response body.
|
|
15
|
+
c.set('errorCode', code)
|
|
16
|
+
const body: error.Body<code> = {
|
|
17
|
+
error: {
|
|
18
|
+
code,
|
|
19
|
+
...(details === undefined ? {} : { details }),
|
|
20
|
+
message,
|
|
21
|
+
},
|
|
22
|
+
requestId: c.get('requestId'),
|
|
23
|
+
}
|
|
24
|
+
return c.json(body, status)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Rejects a well-formed but unsupported chain id with a clear 400, listing the
|
|
29
|
+
* chain ids this deployment serves. Used to short-circuit before an unknown
|
|
30
|
+
* chain reaches an upstream (which would surface as an opaque `upstream_error`).
|
|
31
|
+
*/
|
|
32
|
+
export function unsupportedChainId(c: Context, chainId: number, supported: Iterable<number>) {
|
|
33
|
+
const ids = [...supported].sort((a, b) => a - b).join(', ')
|
|
34
|
+
return error(c, {
|
|
35
|
+
code: 'chain_id_unsupported',
|
|
36
|
+
message: `Unsupported chain id: ${chainId}. Supported chain ids: ${ids}.`,
|
|
37
|
+
status: 400,
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Maps an unexpected upstream failure to a 502 JSON error envelope. Rethrows
|
|
43
|
+
* non-`Error` causes so the global handler can convert them.
|
|
44
|
+
*/
|
|
45
|
+
export function upstream(c: Context, cause: unknown) {
|
|
46
|
+
if (cause instanceof Error)
|
|
47
|
+
return error(c, { code: 'upstream_error', message: cause.message, status: 502 })
|
|
48
|
+
throw cause
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Validates `value` against `schema`. Returns the parsed value on success or
|
|
53
|
+
* throws a generic upstream error so the public response body never leaks Zod
|
|
54
|
+
* internals.
|
|
55
|
+
*/
|
|
56
|
+
export function validated<schema extends z.ZodMiniType>(
|
|
57
|
+
schema: schema,
|
|
58
|
+
value: unknown,
|
|
59
|
+
): z.output<schema> {
|
|
60
|
+
const result = schema.safeParse(value)
|
|
61
|
+
if (result.success) return result.data
|
|
62
|
+
throw new Error('Upstream returned invalid response data')
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Converts standard validation issues into API error details. */
|
|
66
|
+
export function validationDetails(issues: readonly validationDetails.Issue[]): error.Detail[] {
|
|
67
|
+
return issues.map((issue) => {
|
|
68
|
+
const path = issue.path?.map(pathSegment).filter((segment) => segment !== undefined)
|
|
69
|
+
if (!path?.length) return { message: issue.message }
|
|
70
|
+
return { message: issue.message, path }
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export declare namespace error {
|
|
75
|
+
/** Public API error response body. */
|
|
76
|
+
type Body<code extends string = string> = {
|
|
77
|
+
/** Public error envelope. */
|
|
78
|
+
error: {
|
|
79
|
+
/** Stable machine-readable error code. */
|
|
80
|
+
code: code
|
|
81
|
+
/** Detailed validation or upstream error information. */
|
|
82
|
+
details?: readonly Detail[] | undefined
|
|
83
|
+
/** Human-readable error message. */
|
|
84
|
+
message: string
|
|
85
|
+
}
|
|
86
|
+
/** Request id for support/debugging. */
|
|
87
|
+
requestId: string
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** One public API error detail. */
|
|
91
|
+
type Detail = {
|
|
92
|
+
/** Human-readable detail message. */
|
|
93
|
+
message: string
|
|
94
|
+
/** Path to the invalid value. */
|
|
95
|
+
path?: readonly (number | string)[] | undefined
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** HTTP status code accepted by the public error helper. */
|
|
99
|
+
type Status = 400 | 401 | 403 | 404 | 409 | 412 | 413 | 415 | 429 | 500 | 502 | 503
|
|
100
|
+
|
|
101
|
+
/** Options for creating a JSON error response. */
|
|
102
|
+
type Options<status extends Status = Status, code extends string = string> = {
|
|
103
|
+
/** Stable machine-readable error code. */
|
|
104
|
+
code: code
|
|
105
|
+
/** Detailed validation or upstream error information. */
|
|
106
|
+
details?: readonly Detail[] | undefined
|
|
107
|
+
/** Human-readable error message. */
|
|
108
|
+
message: string
|
|
109
|
+
/** HTTP status code. */
|
|
110
|
+
status: status
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export declare namespace validationDetails {
|
|
115
|
+
/** Standard-schema validation issue shape used by Hono validators. */
|
|
116
|
+
type Issue = {
|
|
117
|
+
/** Human-readable validation message. */
|
|
118
|
+
message: string
|
|
119
|
+
/** Path to the invalid value. */
|
|
120
|
+
path?: readonly unknown[] | undefined
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function pathSegment(segment: unknown) {
|
|
125
|
+
if (typeof segment === 'string' || typeof segment === 'number') return segment
|
|
126
|
+
if (!segment || typeof segment !== 'object' || !('key' in segment)) return undefined
|
|
127
|
+
|
|
128
|
+
const { key } = segment
|
|
129
|
+
if (typeof key === 'string' || typeof key === 'number') return key
|
|
130
|
+
return undefined
|
|
131
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as Schema from './Schema.js'
|
|
2
|
+
|
|
3
|
+
describe('ChainId', () => {
|
|
4
|
+
test('resolves aliases to their chain id', () => {
|
|
5
|
+
expect(Schema.ChainId.parse('mainnet')).toMatchInlineSnapshot(`4217`)
|
|
6
|
+
expect(Schema.ChainId.parse('testnet')).toMatchInlineSnapshot(`42431`)
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
test('accepts numeric chain ids as numbers or strings', () => {
|
|
10
|
+
expect(Schema.ChainId.parse(4217)).toMatchInlineSnapshot(`4217`)
|
|
11
|
+
expect(Schema.ChainId.parse('4217')).toMatchInlineSnapshot(`4217`)
|
|
12
|
+
expect(Schema.ChainId.parse('42431')).toMatchInlineSnapshot(`42431`)
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
test('accepts any positive integer chain id (e.g. a localnet)', () => {
|
|
16
|
+
expect(Schema.ChainId.parse('31337')).toMatchInlineSnapshot(`31337`)
|
|
17
|
+
expect(Schema.ChainId.parse(1)).toMatchInlineSnapshot(`1`)
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
test('rejects non-positive, non-integer, and unknown-alias values', () => {
|
|
21
|
+
expect(Schema.ChainId.safeParse('0').success).toMatchInlineSnapshot(`false`)
|
|
22
|
+
expect(Schema.ChainId.safeParse('-1').success).toMatchInlineSnapshot(`false`)
|
|
23
|
+
expect(Schema.ChainId.safeParse('1.5').success).toMatchInlineSnapshot(`false`)
|
|
24
|
+
expect(Schema.ChainId.safeParse('bogus').success).toMatchInlineSnapshot(`false`)
|
|
25
|
+
})
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
describe('ChainIdQuery', () => {
|
|
29
|
+
test('is optional and accepts aliases or numbers', () => {
|
|
30
|
+
expect(Schema.ChainIdQuery.parse(undefined)).toMatchInlineSnapshot(`undefined`)
|
|
31
|
+
expect(Schema.ChainIdQuery.parse('mainnet')).toMatchInlineSnapshot(`4217`)
|
|
32
|
+
expect(Schema.ChainIdQuery.parse('42431')).toMatchInlineSnapshot(`42431`)
|
|
33
|
+
})
|
|
34
|
+
})
|