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,1438 @@
|
|
|
1
|
+
import { Client } from 'cadent'
|
|
2
|
+
import type * as z from 'zod/mini'
|
|
3
|
+
|
|
4
|
+
import * as Activities from './apps/activities.js'
|
|
5
|
+
import * as Balances from './apps/balances.js'
|
|
6
|
+
import * as Blocks from './apps/blocks.js'
|
|
7
|
+
import * as Exchanges from './apps/exchanges.js'
|
|
8
|
+
import * as FeeAmm from './apps/fee-amm.js'
|
|
9
|
+
import * as Indexer from './apps/indexer.js'
|
|
10
|
+
import * as Receipts from './apps/receipts.js'
|
|
11
|
+
import * as Rpc from './apps/rpc.js'
|
|
12
|
+
import * as Tokens from './apps/tokens.js'
|
|
13
|
+
import * as Transactions from './apps/transactions.js'
|
|
14
|
+
import * as Transfers from './apps/transfers.js'
|
|
15
|
+
import * as VerifiedTokens from './apps/verified-tokens.js'
|
|
16
|
+
import * as Webhooks from './apps/webhooks.js'
|
|
17
|
+
|
|
18
|
+
type Access400<code extends string> = code | 'api_key_malformed'
|
|
19
|
+
type PaidAccessStatus = PublicAccessStatus | 402
|
|
20
|
+
type PublicAccessStatus = 400 | 401 | 403 | 429
|
|
21
|
+
|
|
22
|
+
test('returns typed client', async () => {
|
|
23
|
+
const client = Client.create()
|
|
24
|
+
expectTypeOf(client).toEqualTypeOf<Client.Client>()
|
|
25
|
+
expectTypeOf(Client.defaultUrl).toEqualTypeOf<string>()
|
|
26
|
+
|
|
27
|
+
await client.v1.blocks[':block'].$get({ param: { block: 'latest' } })
|
|
28
|
+
// @ts-expect-error unknown routes are not part of the typed API surface
|
|
29
|
+
void client.v1.bogus
|
|
30
|
+
|
|
31
|
+
Client.create({
|
|
32
|
+
apiKey: 'foo-bar-baz',
|
|
33
|
+
headers: async () => ({ 'tempo-api-key': 'key_test' }),
|
|
34
|
+
url: Client.defaultUrl,
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
const typed: Client.Client = client
|
|
38
|
+
void typed
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
describe('narrows responses by status', () => {
|
|
42
|
+
test('GET /v1/blocks', async () => {
|
|
43
|
+
const client = Client.create()
|
|
44
|
+
const res = await client.v1.blocks.$get()
|
|
45
|
+
|
|
46
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
47
|
+
|
|
48
|
+
switch (res.status) {
|
|
49
|
+
case 200: {
|
|
50
|
+
const json = await res.json()
|
|
51
|
+
expectTypeOf(json.data[0]!.number).toEqualTypeOf<
|
|
52
|
+
z.output<typeof Blocks.schema.getBlocks.Response>['data'][number]['number']
|
|
53
|
+
>()
|
|
54
|
+
void json
|
|
55
|
+
return
|
|
56
|
+
}
|
|
57
|
+
case 400: {
|
|
58
|
+
const json = await res.json()
|
|
59
|
+
expectTypeOf(json.error.code).toEqualTypeOf<Access400<'query_invalid'>>()
|
|
60
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
61
|
+
void json
|
|
62
|
+
return
|
|
63
|
+
}
|
|
64
|
+
case 401: {
|
|
65
|
+
const json = await res.json()
|
|
66
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'api_key_invalid' | 'api_key_missing'>()
|
|
67
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
68
|
+
void json
|
|
69
|
+
return
|
|
70
|
+
}
|
|
71
|
+
case 402: {
|
|
72
|
+
const text = await res.text()
|
|
73
|
+
expectTypeOf(text).toEqualTypeOf<string>()
|
|
74
|
+
return
|
|
75
|
+
}
|
|
76
|
+
case 403: {
|
|
77
|
+
const json = await res.json()
|
|
78
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'api_key_forbidden'>()
|
|
79
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
80
|
+
void json
|
|
81
|
+
return
|
|
82
|
+
}
|
|
83
|
+
case 429: {
|
|
84
|
+
const json = await res.json()
|
|
85
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'payment_required' | 'rate_limit_exceeded'>()
|
|
86
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
87
|
+
void json
|
|
88
|
+
return
|
|
89
|
+
}
|
|
90
|
+
case 502: {
|
|
91
|
+
const json = await res.json()
|
|
92
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
93
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
94
|
+
void json
|
|
95
|
+
return
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
test('GET /v1/blocks/:block', async () => {
|
|
101
|
+
const client = Client.create()
|
|
102
|
+
const res = await client.v1.blocks[':block'].$get({ param: { block: '1' } })
|
|
103
|
+
|
|
104
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 404 | 502 | PaidAccessStatus>()
|
|
105
|
+
|
|
106
|
+
switch (res.status) {
|
|
107
|
+
case 200: {
|
|
108
|
+
const json = await res.json()
|
|
109
|
+
expectTypeOf(json.hash).toEqualTypeOf<z.output<typeof Blocks.schema.Block>['hash']>()
|
|
110
|
+
expectTypeOf(json.number).toEqualTypeOf<z.output<typeof Blocks.schema.Block>['number']>()
|
|
111
|
+
void json
|
|
112
|
+
return
|
|
113
|
+
}
|
|
114
|
+
case 400: {
|
|
115
|
+
const json = await res.json()
|
|
116
|
+
expectTypeOf(json.error.code).toEqualTypeOf<Access400<'block_invalid' | 'query_invalid'>>()
|
|
117
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
118
|
+
void json
|
|
119
|
+
return
|
|
120
|
+
}
|
|
121
|
+
case 404: {
|
|
122
|
+
const json = await res.json()
|
|
123
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'block_not_found'>()
|
|
124
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
125
|
+
void json
|
|
126
|
+
return
|
|
127
|
+
}
|
|
128
|
+
case 502: {
|
|
129
|
+
const json = await res.json()
|
|
130
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
131
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
132
|
+
void json
|
|
133
|
+
return
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
test('GET /v1/transactions', async () => {
|
|
139
|
+
const client = Client.create()
|
|
140
|
+
const res = await client.v1.transactions.$get()
|
|
141
|
+
|
|
142
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
143
|
+
|
|
144
|
+
switch (res.status) {
|
|
145
|
+
case 200: {
|
|
146
|
+
const json = await res.json()
|
|
147
|
+
expectTypeOf(json.data[0]!.hash).toEqualTypeOf<
|
|
148
|
+
z.output<typeof Transactions.schema.Transaction>['hash']
|
|
149
|
+
>()
|
|
150
|
+
expectTypeOf(json.data[0]!.meta.receipt?.status).toEqualTypeOf<
|
|
151
|
+
z.output<typeof Receipts.schema.Receipt>['status'] | undefined
|
|
152
|
+
>()
|
|
153
|
+
expectTypeOf(json.data[0]!.meta.receipt?.gasUsed).toEqualTypeOf<
|
|
154
|
+
z.output<typeof Receipts.schema.Receipt>['gasUsed'] | undefined
|
|
155
|
+
>()
|
|
156
|
+
void json
|
|
157
|
+
return
|
|
158
|
+
}
|
|
159
|
+
case 400: {
|
|
160
|
+
const json = await res.json()
|
|
161
|
+
expectTypeOf(json.error.code).toEqualTypeOf<Access400<'query_invalid'>>()
|
|
162
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
163
|
+
void json
|
|
164
|
+
return
|
|
165
|
+
}
|
|
166
|
+
case 502: {
|
|
167
|
+
const json = await res.json()
|
|
168
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
169
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
170
|
+
void json
|
|
171
|
+
return
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
test('GET /v1/transactions/:transactionHash', async () => {
|
|
177
|
+
const client = Client.create()
|
|
178
|
+
const res = await client.v1.transactions[':transactionHash'].$get({
|
|
179
|
+
param: {
|
|
180
|
+
transactionHash: '0x515801d7f9a5ac705e793e85904c9c69b3f1694b465cc8fb6ba3f0298dc82665',
|
|
181
|
+
},
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 404 | 502 | PaidAccessStatus>()
|
|
185
|
+
|
|
186
|
+
switch (res.status) {
|
|
187
|
+
case 200: {
|
|
188
|
+
const json = await res.json()
|
|
189
|
+
expectTypeOf(json.hash).toEqualTypeOf<
|
|
190
|
+
z.output<typeof Transactions.schema.Transaction>['hash']
|
|
191
|
+
>()
|
|
192
|
+
expectTypeOf(json.meta.receipt?.status).toEqualTypeOf<
|
|
193
|
+
z.output<typeof Receipts.schema.Receipt>['status'] | undefined
|
|
194
|
+
>()
|
|
195
|
+
expectTypeOf(json.sender).toEqualTypeOf<
|
|
196
|
+
z.output<typeof Transactions.schema.Transaction>['sender']
|
|
197
|
+
>()
|
|
198
|
+
void json
|
|
199
|
+
return
|
|
200
|
+
}
|
|
201
|
+
case 400: {
|
|
202
|
+
const json = await res.json()
|
|
203
|
+
expectTypeOf(json.error.code).toEqualTypeOf<
|
|
204
|
+
Access400<'query_invalid' | 'transaction_invalid'>
|
|
205
|
+
>()
|
|
206
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
207
|
+
void json
|
|
208
|
+
return
|
|
209
|
+
}
|
|
210
|
+
case 404: {
|
|
211
|
+
const json = await res.json()
|
|
212
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'transaction_not_found'>()
|
|
213
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
214
|
+
void json
|
|
215
|
+
return
|
|
216
|
+
}
|
|
217
|
+
case 502: {
|
|
218
|
+
const json = await res.json()
|
|
219
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
220
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
221
|
+
void json
|
|
222
|
+
return
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
test('GET /v1/transactions/receipts', async () => {
|
|
228
|
+
const client = Client.create()
|
|
229
|
+
const res = await client.v1.transactions.receipts.$get()
|
|
230
|
+
|
|
231
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
232
|
+
|
|
233
|
+
switch (res.status) {
|
|
234
|
+
case 200: {
|
|
235
|
+
const json = await res.json()
|
|
236
|
+
expectTypeOf(json.data[0]!.transactionHash).toEqualTypeOf<
|
|
237
|
+
z.output<typeof Receipts.schema.Receipt>['transactionHash']
|
|
238
|
+
>()
|
|
239
|
+
void json
|
|
240
|
+
return
|
|
241
|
+
}
|
|
242
|
+
case 400: {
|
|
243
|
+
const json = await res.json()
|
|
244
|
+
expectTypeOf(json.error.code).toEqualTypeOf<Access400<'query_invalid'>>()
|
|
245
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
246
|
+
void json
|
|
247
|
+
return
|
|
248
|
+
}
|
|
249
|
+
case 502: {
|
|
250
|
+
const json = await res.json()
|
|
251
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
252
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
253
|
+
void json
|
|
254
|
+
return
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
})
|
|
258
|
+
|
|
259
|
+
test('GET /v1/transactions/:transactionHash/receipt', async () => {
|
|
260
|
+
const client = Client.create()
|
|
261
|
+
const res = await client.v1.transactions[':transactionHash'].receipt.$get({
|
|
262
|
+
param: {
|
|
263
|
+
transactionHash: '0x515801d7f9a5ac705e793e85904c9c69b3f1694b465cc8fb6ba3f0298dc82665',
|
|
264
|
+
},
|
|
265
|
+
})
|
|
266
|
+
|
|
267
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 404 | 502 | PaidAccessStatus>()
|
|
268
|
+
|
|
269
|
+
switch (res.status) {
|
|
270
|
+
case 200: {
|
|
271
|
+
const json = await res.json()
|
|
272
|
+
expectTypeOf(json.transactionHash).toEqualTypeOf<
|
|
273
|
+
z.output<typeof Receipts.schema.Receipt>['transactionHash']
|
|
274
|
+
>()
|
|
275
|
+
expectTypeOf(json.sender).toEqualTypeOf<
|
|
276
|
+
z.output<typeof Receipts.schema.Receipt>['sender']
|
|
277
|
+
>()
|
|
278
|
+
void json
|
|
279
|
+
return
|
|
280
|
+
}
|
|
281
|
+
case 400: {
|
|
282
|
+
const json = await res.json()
|
|
283
|
+
expectTypeOf(json.error.code).toEqualTypeOf<
|
|
284
|
+
Access400<'query_invalid' | 'transaction_invalid'>
|
|
285
|
+
>()
|
|
286
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
287
|
+
void json
|
|
288
|
+
return
|
|
289
|
+
}
|
|
290
|
+
case 404: {
|
|
291
|
+
const json = await res.json()
|
|
292
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'receipt_not_found'>()
|
|
293
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
294
|
+
void json
|
|
295
|
+
return
|
|
296
|
+
}
|
|
297
|
+
case 502: {
|
|
298
|
+
const json = await res.json()
|
|
299
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
300
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
301
|
+
void json
|
|
302
|
+
return
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
})
|
|
306
|
+
|
|
307
|
+
test('GET /v1/transactions/:transactionHash/activities', async () => {
|
|
308
|
+
const client = Client.create()
|
|
309
|
+
const res = await client.v1.transactions[':transactionHash'].activities.$get({
|
|
310
|
+
param: {
|
|
311
|
+
transactionHash: '0x4845ae2098724ab26a5d89370dce5124d044be6a5acc164afc348662de67d474',
|
|
312
|
+
},
|
|
313
|
+
})
|
|
314
|
+
|
|
315
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 404 | 502 | PaidAccessStatus>()
|
|
316
|
+
|
|
317
|
+
switch (res.status) {
|
|
318
|
+
case 200: {
|
|
319
|
+
const json = await res.json()
|
|
320
|
+
expectTypeOf(json.data[0]!.type).toEqualTypeOf<
|
|
321
|
+
z.output<
|
|
322
|
+
typeof Activities.schema.getTransactionActivities.Response
|
|
323
|
+
>['data'][number]['type']
|
|
324
|
+
>()
|
|
325
|
+
void json
|
|
326
|
+
return
|
|
327
|
+
}
|
|
328
|
+
case 400: {
|
|
329
|
+
const json = await res.json()
|
|
330
|
+
expectTypeOf(json.error.code).toEqualTypeOf<
|
|
331
|
+
Access400<'query_invalid' | 'transaction_invalid'>
|
|
332
|
+
>()
|
|
333
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
334
|
+
void json
|
|
335
|
+
return
|
|
336
|
+
}
|
|
337
|
+
case 404: {
|
|
338
|
+
const json = await res.json()
|
|
339
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'transaction_not_found'>()
|
|
340
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
341
|
+
void json
|
|
342
|
+
return
|
|
343
|
+
}
|
|
344
|
+
case 502: {
|
|
345
|
+
const json = await res.json()
|
|
346
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
347
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
348
|
+
void json
|
|
349
|
+
return
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
})
|
|
353
|
+
|
|
354
|
+
test('GET /v1/tokens', async () => {
|
|
355
|
+
const client = Client.create()
|
|
356
|
+
const res = await client.v1.tokens.$get()
|
|
357
|
+
|
|
358
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
359
|
+
|
|
360
|
+
switch (res.status) {
|
|
361
|
+
case 200: {
|
|
362
|
+
const json = await res.json()
|
|
363
|
+
expectTypeOf(json.data[0]!.address).toEqualTypeOf<
|
|
364
|
+
z.output<typeof Tokens.schema.getTokens.Response>['data'][number]['address']
|
|
365
|
+
>()
|
|
366
|
+
void json
|
|
367
|
+
return
|
|
368
|
+
}
|
|
369
|
+
case 400: {
|
|
370
|
+
const json = await res.json()
|
|
371
|
+
expectTypeOf(json.error.code).toEqualTypeOf<Access400<'query_invalid'>>()
|
|
372
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
373
|
+
void json
|
|
374
|
+
return
|
|
375
|
+
}
|
|
376
|
+
case 502: {
|
|
377
|
+
const json = await res.json()
|
|
378
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
379
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
380
|
+
void json
|
|
381
|
+
return
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
})
|
|
385
|
+
|
|
386
|
+
test('GET /v1/tokens/:token', async () => {
|
|
387
|
+
const client = Client.create()
|
|
388
|
+
const res = await client.v1.tokens[':token'].$get({
|
|
389
|
+
param: { token: '0x20c0000000000000000000000000000000000000' },
|
|
390
|
+
})
|
|
391
|
+
|
|
392
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 404 | 502 | PaidAccessStatus>()
|
|
393
|
+
|
|
394
|
+
switch (res.status) {
|
|
395
|
+
case 200: {
|
|
396
|
+
const json = await res.json()
|
|
397
|
+
expectTypeOf(json.address).toEqualTypeOf<
|
|
398
|
+
z.output<typeof Tokens.schema.getToken.Response>['address']
|
|
399
|
+
>()
|
|
400
|
+
expectTypeOf(json.symbol).toEqualTypeOf<
|
|
401
|
+
z.output<typeof Tokens.schema.getToken.Response>['symbol']
|
|
402
|
+
>()
|
|
403
|
+
void json
|
|
404
|
+
return
|
|
405
|
+
}
|
|
406
|
+
case 400: {
|
|
407
|
+
const json = await res.json()
|
|
408
|
+
expectTypeOf(json.error.code).toEqualTypeOf<Access400<'query_invalid' | 'token_invalid'>>()
|
|
409
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
410
|
+
void json
|
|
411
|
+
return
|
|
412
|
+
}
|
|
413
|
+
case 404: {
|
|
414
|
+
const json = await res.json()
|
|
415
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'token_not_found'>()
|
|
416
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
417
|
+
void json
|
|
418
|
+
return
|
|
419
|
+
}
|
|
420
|
+
case 502: {
|
|
421
|
+
const json = await res.json()
|
|
422
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
423
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
424
|
+
void json
|
|
425
|
+
return
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
})
|
|
429
|
+
|
|
430
|
+
test('GET /v1/tokens/:symbol', async () => {
|
|
431
|
+
const client = Client.create()
|
|
432
|
+
const res = await client.v1.tokens[':symbol{[A-Za-z][A-Za-z0-9._]{0,63}}'].$get({
|
|
433
|
+
param: { symbol: 'USDC.e' },
|
|
434
|
+
})
|
|
435
|
+
|
|
436
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 404 | 502 | PaidAccessStatus>()
|
|
437
|
+
|
|
438
|
+
switch (res.status) {
|
|
439
|
+
case 200: {
|
|
440
|
+
const json = await res.json()
|
|
441
|
+
expectTypeOf(json.address).toEqualTypeOf<
|
|
442
|
+
z.output<typeof Tokens.schema.getToken.Response>['address']
|
|
443
|
+
>()
|
|
444
|
+
expectTypeOf(json.symbol).toEqualTypeOf<
|
|
445
|
+
z.output<typeof Tokens.schema.getToken.Response>['symbol']
|
|
446
|
+
>()
|
|
447
|
+
void json
|
|
448
|
+
return
|
|
449
|
+
}
|
|
450
|
+
case 400: {
|
|
451
|
+
const json = await res.json()
|
|
452
|
+
expectTypeOf(json.error.code).toEqualTypeOf<Access400<'query_invalid' | 'symbol_invalid'>>()
|
|
453
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
454
|
+
void json
|
|
455
|
+
return
|
|
456
|
+
}
|
|
457
|
+
case 404: {
|
|
458
|
+
const json = await res.json()
|
|
459
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'token_not_found'>()
|
|
460
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
461
|
+
void json
|
|
462
|
+
return
|
|
463
|
+
}
|
|
464
|
+
case 502: {
|
|
465
|
+
const json = await res.json()
|
|
466
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
467
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
468
|
+
void json
|
|
469
|
+
return
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
})
|
|
473
|
+
|
|
474
|
+
test('GET /v1/tokens/:token/holders', async () => {
|
|
475
|
+
const client = Client.create()
|
|
476
|
+
const res = await client.v1.tokens[':token'].holders.$get({
|
|
477
|
+
param: { token: '0x20c0000000000000000000000000000000000000' },
|
|
478
|
+
})
|
|
479
|
+
|
|
480
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
481
|
+
|
|
482
|
+
switch (res.status) {
|
|
483
|
+
case 200: {
|
|
484
|
+
const json = await res.json()
|
|
485
|
+
expectTypeOf(json.data[0]!.address).toEqualTypeOf<
|
|
486
|
+
z.output<typeof Tokens.schema.getTokenHolders.Response>['data'][number]['address']
|
|
487
|
+
>()
|
|
488
|
+
// `meta` (opt-in `include=token`/`include=totalCount`) is optional.
|
|
489
|
+
expectTypeOf(json.meta).toEqualTypeOf<
|
|
490
|
+
z.output<typeof Tokens.schema.getTokenHolders.Response>['meta']
|
|
491
|
+
>()
|
|
492
|
+
void json
|
|
493
|
+
return
|
|
494
|
+
}
|
|
495
|
+
case 400: {
|
|
496
|
+
const json = await res.json()
|
|
497
|
+
expectTypeOf(json.error.code).toEqualTypeOf<Access400<'query_invalid' | 'token_invalid'>>()
|
|
498
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
499
|
+
void json
|
|
500
|
+
return
|
|
501
|
+
}
|
|
502
|
+
case 502: {
|
|
503
|
+
const json = await res.json()
|
|
504
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
505
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
506
|
+
void json
|
|
507
|
+
return
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
})
|
|
511
|
+
|
|
512
|
+
test('GET /v1/tokens/:token/transactions', async () => {
|
|
513
|
+
const client = Client.create()
|
|
514
|
+
const res = await client.v1.tokens[':token'].transactions.$get({
|
|
515
|
+
param: { token: '0x20c0000000000000000000000000000000000000' },
|
|
516
|
+
})
|
|
517
|
+
|
|
518
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
519
|
+
|
|
520
|
+
switch (res.status) {
|
|
521
|
+
case 200: {
|
|
522
|
+
const json = await res.json()
|
|
523
|
+
expectTypeOf(json.data[0]!.hash).toEqualTypeOf<
|
|
524
|
+
z.output<typeof Transactions.schema.Transaction>['hash']
|
|
525
|
+
>()
|
|
526
|
+
void json
|
|
527
|
+
return
|
|
528
|
+
}
|
|
529
|
+
case 400: {
|
|
530
|
+
const json = await res.json()
|
|
531
|
+
expectTypeOf(json.error.code).toEqualTypeOf<Access400<'query_invalid' | 'token_invalid'>>()
|
|
532
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
533
|
+
void json
|
|
534
|
+
return
|
|
535
|
+
}
|
|
536
|
+
case 502: {
|
|
537
|
+
const json = await res.json()
|
|
538
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
539
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
540
|
+
void json
|
|
541
|
+
return
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
})
|
|
545
|
+
|
|
546
|
+
test('GET /v1/addresses/:address/balances', async () => {
|
|
547
|
+
const client = Client.create()
|
|
548
|
+
const res = await client.v1.addresses[':address'].balances.$get({
|
|
549
|
+
param: { address: '0x0000000000000000000000000000000000000000' },
|
|
550
|
+
})
|
|
551
|
+
|
|
552
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
553
|
+
|
|
554
|
+
switch (res.status) {
|
|
555
|
+
case 200: {
|
|
556
|
+
const json = await res.json()
|
|
557
|
+
expectTypeOf(json.data[0]!.amount).toEqualTypeOf<
|
|
558
|
+
z.output<typeof Balances.schema.getAddressBalances.Response>['data'][number]['amount']
|
|
559
|
+
>()
|
|
560
|
+
expectTypeOf(json.data[0]!.formatted).toEqualTypeOf<string>()
|
|
561
|
+
// `feeEligible` is best-effort, so it is an optional boolean.
|
|
562
|
+
expectTypeOf(json.data[0]!.feeEligible).toEqualTypeOf<boolean | undefined>()
|
|
563
|
+
expectTypeOf(json.data[0]!.token).toEqualTypeOf<
|
|
564
|
+
z.output<typeof Balances.schema.getAddressBalances.Response>['data'][number]['token']
|
|
565
|
+
>()
|
|
566
|
+
// `meta` (opt-in `include=totalCount` capped count) is optional.
|
|
567
|
+
expectTypeOf(json.meta).toEqualTypeOf<
|
|
568
|
+
z.output<typeof Balances.schema.getAddressBalances.Response>['meta']
|
|
569
|
+
>()
|
|
570
|
+
void json
|
|
571
|
+
return
|
|
572
|
+
}
|
|
573
|
+
case 400: {
|
|
574
|
+
const json = await res.json()
|
|
575
|
+
expectTypeOf(json.error.code).toEqualTypeOf<
|
|
576
|
+
Access400<'address_invalid' | 'query_invalid'>
|
|
577
|
+
>()
|
|
578
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
579
|
+
void json
|
|
580
|
+
return
|
|
581
|
+
}
|
|
582
|
+
case 502: {
|
|
583
|
+
const json = await res.json()
|
|
584
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
585
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
586
|
+
void json
|
|
587
|
+
return
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
})
|
|
591
|
+
|
|
592
|
+
test('GET /v1/transfers', async () => {
|
|
593
|
+
const client = Client.create()
|
|
594
|
+
const res = await client.v1.transfers.$get()
|
|
595
|
+
|
|
596
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
597
|
+
|
|
598
|
+
switch (res.status) {
|
|
599
|
+
case 200: {
|
|
600
|
+
const json = await res.json()
|
|
601
|
+
expectTypeOf(json.data[0]!.transactionHash).toEqualTypeOf<
|
|
602
|
+
z.output<typeof Transfers.schema.getTransfers.Response>['data'][number]['transactionHash']
|
|
603
|
+
>()
|
|
604
|
+
expectTypeOf(json.data[0]!.memo).toEqualTypeOf<
|
|
605
|
+
z.output<typeof Transfers.schema.getTransfers.Transfer>['memo']
|
|
606
|
+
>()
|
|
607
|
+
expectTypeOf(json.data[0]!.attribution).toEqualTypeOf<
|
|
608
|
+
z.output<typeof Transfers.schema.getTransfers.Transfer>['attribution']
|
|
609
|
+
>()
|
|
610
|
+
// `meta` (the opt-in `include=totalCount` capped count) is optional.
|
|
611
|
+
expectTypeOf(json.meta).toEqualTypeOf<
|
|
612
|
+
z.output<typeof Transfers.schema.getTransfers.Response>['meta']
|
|
613
|
+
>()
|
|
614
|
+
void json
|
|
615
|
+
return
|
|
616
|
+
}
|
|
617
|
+
case 400: {
|
|
618
|
+
const json = await res.json()
|
|
619
|
+
expectTypeOf(json.error.code).toEqualTypeOf<Access400<'query_invalid'>>()
|
|
620
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
621
|
+
void json
|
|
622
|
+
return
|
|
623
|
+
}
|
|
624
|
+
case 502: {
|
|
625
|
+
const json = await res.json()
|
|
626
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
627
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
628
|
+
void json
|
|
629
|
+
return
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
})
|
|
633
|
+
|
|
634
|
+
test('GET /v1/exchange/swaps', async () => {
|
|
635
|
+
const client = Client.create()
|
|
636
|
+
const res = await client.v1.exchange.swaps.$get()
|
|
637
|
+
|
|
638
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
639
|
+
|
|
640
|
+
switch (res.status) {
|
|
641
|
+
case 200: {
|
|
642
|
+
const json = await res.json()
|
|
643
|
+
expectTypeOf(json.data[0]!.transactionHash).toEqualTypeOf<
|
|
644
|
+
z.output<typeof Exchanges.schema.getSwaps.Response>['data'][number]['transactionHash']
|
|
645
|
+
>()
|
|
646
|
+
void json
|
|
647
|
+
return
|
|
648
|
+
}
|
|
649
|
+
case 400: {
|
|
650
|
+
const json = await res.json()
|
|
651
|
+
expectTypeOf(json.error.code).toEqualTypeOf<Access400<'query_invalid'>>()
|
|
652
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
653
|
+
void json
|
|
654
|
+
return
|
|
655
|
+
}
|
|
656
|
+
case 502: {
|
|
657
|
+
const json = await res.json()
|
|
658
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
659
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
660
|
+
void json
|
|
661
|
+
return
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
})
|
|
665
|
+
|
|
666
|
+
test('GET /v1/exchange/pairs', async () => {
|
|
667
|
+
const client = Client.create()
|
|
668
|
+
const res = await client.v1.exchange.pairs.$get()
|
|
669
|
+
|
|
670
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
671
|
+
|
|
672
|
+
switch (res.status) {
|
|
673
|
+
case 200: {
|
|
674
|
+
const json = await res.json()
|
|
675
|
+
expectTypeOf(json.data[0]!.key).toEqualTypeOf<
|
|
676
|
+
z.output<typeof Exchanges.schema.getPairs.Response>['data'][number]['key']
|
|
677
|
+
>()
|
|
678
|
+
void json
|
|
679
|
+
return
|
|
680
|
+
}
|
|
681
|
+
case 400: {
|
|
682
|
+
const json = await res.json()
|
|
683
|
+
expectTypeOf(json.error.code).toEqualTypeOf<Access400<'query_invalid'>>()
|
|
684
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
685
|
+
void json
|
|
686
|
+
return
|
|
687
|
+
}
|
|
688
|
+
case 502: {
|
|
689
|
+
const json = await res.json()
|
|
690
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
691
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
692
|
+
void json
|
|
693
|
+
return
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
})
|
|
697
|
+
|
|
698
|
+
test('GET /v1/exchange/orders', async () => {
|
|
699
|
+
const client = Client.create()
|
|
700
|
+
const res = await client.v1.exchange.orders.$get()
|
|
701
|
+
|
|
702
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 404 | 502 | PaidAccessStatus>()
|
|
703
|
+
|
|
704
|
+
switch (res.status) {
|
|
705
|
+
case 200: {
|
|
706
|
+
const json = await res.json()
|
|
707
|
+
expectTypeOf(json.data[0]!.orderId).toEqualTypeOf<
|
|
708
|
+
z.output<typeof Exchanges.schema.getOrders.Response>['data'][number]['orderId']
|
|
709
|
+
>()
|
|
710
|
+
void json
|
|
711
|
+
return
|
|
712
|
+
}
|
|
713
|
+
case 400: {
|
|
714
|
+
const json = await res.json()
|
|
715
|
+
expectTypeOf(json.error.code).toEqualTypeOf<Access400<'query_invalid'>>()
|
|
716
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
717
|
+
void json
|
|
718
|
+
return
|
|
719
|
+
}
|
|
720
|
+
case 404: {
|
|
721
|
+
const json = await res.json()
|
|
722
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'pair_not_found'>()
|
|
723
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
724
|
+
void json
|
|
725
|
+
return
|
|
726
|
+
}
|
|
727
|
+
case 502: {
|
|
728
|
+
const json = await res.json()
|
|
729
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
730
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
731
|
+
void json
|
|
732
|
+
return
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
})
|
|
736
|
+
|
|
737
|
+
test('GET /v1/exchange/orders/:orderId', async () => {
|
|
738
|
+
const client = Client.create()
|
|
739
|
+
const res = await client.v1.exchange.orders[':orderId'].$get({
|
|
740
|
+
param: { orderId: '1' },
|
|
741
|
+
})
|
|
742
|
+
|
|
743
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 404 | 502 | PaidAccessStatus>()
|
|
744
|
+
|
|
745
|
+
switch (res.status) {
|
|
746
|
+
case 200: {
|
|
747
|
+
const json = await res.json()
|
|
748
|
+
expectTypeOf(json.orderId).toEqualTypeOf<
|
|
749
|
+
z.output<typeof Exchanges.schema.getOrder.Response>['orderId']
|
|
750
|
+
>()
|
|
751
|
+
expectTypeOf(json.remaining).toEqualTypeOf<
|
|
752
|
+
z.output<typeof Exchanges.schema.getOrder.Response>['remaining']
|
|
753
|
+
>()
|
|
754
|
+
void json
|
|
755
|
+
return
|
|
756
|
+
}
|
|
757
|
+
case 400: {
|
|
758
|
+
const json = await res.json()
|
|
759
|
+
expectTypeOf(json.error.code).toEqualTypeOf<Access400<'order_invalid' | 'query_invalid'>>()
|
|
760
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
761
|
+
void json
|
|
762
|
+
return
|
|
763
|
+
}
|
|
764
|
+
case 404: {
|
|
765
|
+
const json = await res.json()
|
|
766
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'order_not_found'>()
|
|
767
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
768
|
+
void json
|
|
769
|
+
return
|
|
770
|
+
}
|
|
771
|
+
case 502: {
|
|
772
|
+
const json = await res.json()
|
|
773
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
774
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
775
|
+
void json
|
|
776
|
+
return
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
})
|
|
780
|
+
|
|
781
|
+
test('GET /v1/exchange/orders/:orderId/fills', async () => {
|
|
782
|
+
const client = Client.create()
|
|
783
|
+
const res = await client.v1.exchange.orders[':orderId'].fills.$get({
|
|
784
|
+
param: { orderId: '1' },
|
|
785
|
+
})
|
|
786
|
+
|
|
787
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
788
|
+
|
|
789
|
+
switch (res.status) {
|
|
790
|
+
case 200: {
|
|
791
|
+
const json = await res.json()
|
|
792
|
+
expectTypeOf(json.data[0]!.transactionHash).toEqualTypeOf<
|
|
793
|
+
z.output<
|
|
794
|
+
typeof Exchanges.schema.getOrderFills.Response
|
|
795
|
+
>['data'][number]['transactionHash']
|
|
796
|
+
>()
|
|
797
|
+
// `meta` (opt-in `include=totalCount` capped count) is optional.
|
|
798
|
+
expectTypeOf(json.meta).toEqualTypeOf<
|
|
799
|
+
z.output<typeof Exchanges.schema.getOrderFills.Response>['meta']
|
|
800
|
+
>()
|
|
801
|
+
void json
|
|
802
|
+
return
|
|
803
|
+
}
|
|
804
|
+
case 400: {
|
|
805
|
+
const json = await res.json()
|
|
806
|
+
expectTypeOf(json.error.code).toEqualTypeOf<Access400<'order_invalid' | 'query_invalid'>>()
|
|
807
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
808
|
+
void json
|
|
809
|
+
return
|
|
810
|
+
}
|
|
811
|
+
case 502: {
|
|
812
|
+
const json = await res.json()
|
|
813
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
814
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
815
|
+
void json
|
|
816
|
+
return
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
})
|
|
820
|
+
|
|
821
|
+
test('GET /v1/exchange/pairs/:base', async () => {
|
|
822
|
+
const client = Client.create()
|
|
823
|
+
const res = await client.v1.exchange.pairs[':base'].$get({
|
|
824
|
+
param: { base: '0x20c0000000000000000000000000000000000000' },
|
|
825
|
+
})
|
|
826
|
+
|
|
827
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 404 | 502 | PaidAccessStatus>()
|
|
828
|
+
|
|
829
|
+
switch (res.status) {
|
|
830
|
+
case 200: {
|
|
831
|
+
const json = await res.json()
|
|
832
|
+
expectTypeOf(json.key).toEqualTypeOf<
|
|
833
|
+
z.output<typeof Exchanges.schema.getPair.Response>['key']
|
|
834
|
+
>()
|
|
835
|
+
expectTypeOf(json.base.address).toEqualTypeOf<
|
|
836
|
+
z.output<typeof Exchanges.schema.getPair.Response>['base']['address']
|
|
837
|
+
>()
|
|
838
|
+
void json
|
|
839
|
+
return
|
|
840
|
+
}
|
|
841
|
+
case 400: {
|
|
842
|
+
const json = await res.json()
|
|
843
|
+
expectTypeOf(json.error.code).toEqualTypeOf<Access400<'pair_invalid' | 'query_invalid'>>()
|
|
844
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
845
|
+
void json
|
|
846
|
+
return
|
|
847
|
+
}
|
|
848
|
+
case 404: {
|
|
849
|
+
const json = await res.json()
|
|
850
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'pair_not_found'>()
|
|
851
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
852
|
+
void json
|
|
853
|
+
return
|
|
854
|
+
}
|
|
855
|
+
case 502: {
|
|
856
|
+
const json = await res.json()
|
|
857
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
858
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
859
|
+
void json
|
|
860
|
+
return
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
})
|
|
864
|
+
|
|
865
|
+
test('GET /v1/exchange/pairs/:base/ohlc', async () => {
|
|
866
|
+
const client = Client.create()
|
|
867
|
+
const res = await client.v1.exchange.pairs[':base'].ohlc.$get({
|
|
868
|
+
param: { base: '0x20c0000000000000000000000000000000000000' },
|
|
869
|
+
})
|
|
870
|
+
|
|
871
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 404 | 502 | PaidAccessStatus>()
|
|
872
|
+
|
|
873
|
+
switch (res.status) {
|
|
874
|
+
case 200: {
|
|
875
|
+
const json = await res.json()
|
|
876
|
+
expectTypeOf(json.interval).toEqualTypeOf<
|
|
877
|
+
z.output<typeof Exchanges.schema.getPairOhlc.Response>['interval']
|
|
878
|
+
>()
|
|
879
|
+
expectTypeOf(json.data[0]!.open).toEqualTypeOf<
|
|
880
|
+
z.output<typeof Exchanges.schema.getPairOhlc.Response>['data'][number]['open']
|
|
881
|
+
>()
|
|
882
|
+
void json
|
|
883
|
+
return
|
|
884
|
+
}
|
|
885
|
+
case 400: {
|
|
886
|
+
const json = await res.json()
|
|
887
|
+
expectTypeOf(json.error.code).toEqualTypeOf<Access400<'pair_invalid' | 'query_invalid'>>()
|
|
888
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
889
|
+
void json
|
|
890
|
+
return
|
|
891
|
+
}
|
|
892
|
+
case 404: {
|
|
893
|
+
const json = await res.json()
|
|
894
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'pair_not_found'>()
|
|
895
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
896
|
+
void json
|
|
897
|
+
return
|
|
898
|
+
}
|
|
899
|
+
case 502: {
|
|
900
|
+
const json = await res.json()
|
|
901
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
902
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
903
|
+
void json
|
|
904
|
+
return
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
})
|
|
908
|
+
|
|
909
|
+
test('GET /v1/exchange/pairs/:base/depth', async () => {
|
|
910
|
+
const client = Client.create()
|
|
911
|
+
const res = await client.v1.exchange.pairs[':base'].depth.$get({
|
|
912
|
+
param: { base: '0x20c0000000000000000000000000000000000000' },
|
|
913
|
+
})
|
|
914
|
+
|
|
915
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 404 | 502 | PaidAccessStatus>()
|
|
916
|
+
|
|
917
|
+
switch (res.status) {
|
|
918
|
+
case 200: {
|
|
919
|
+
const json = await res.json()
|
|
920
|
+
expectTypeOf(json.asks[0]!.price).toEqualTypeOf<
|
|
921
|
+
z.output<typeof Exchanges.schema.getPairDepth.Response>['asks'][number]['price']
|
|
922
|
+
>()
|
|
923
|
+
expectTypeOf(json.base.address).toEqualTypeOf<
|
|
924
|
+
z.output<typeof Exchanges.schema.getPairDepth.Response>['base']['address']
|
|
925
|
+
>()
|
|
926
|
+
void json
|
|
927
|
+
return
|
|
928
|
+
}
|
|
929
|
+
case 400: {
|
|
930
|
+
const json = await res.json()
|
|
931
|
+
expectTypeOf(json.error.code).toEqualTypeOf<Access400<'pair_invalid' | 'query_invalid'>>()
|
|
932
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
933
|
+
void json
|
|
934
|
+
return
|
|
935
|
+
}
|
|
936
|
+
case 404: {
|
|
937
|
+
const json = await res.json()
|
|
938
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'pair_not_found'>()
|
|
939
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
940
|
+
void json
|
|
941
|
+
return
|
|
942
|
+
}
|
|
943
|
+
case 502: {
|
|
944
|
+
const json = await res.json()
|
|
945
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
946
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
947
|
+
void json
|
|
948
|
+
return
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
})
|
|
952
|
+
|
|
953
|
+
test('GET /v1/fee-amm/pools', async () => {
|
|
954
|
+
const client = Client.create()
|
|
955
|
+
const res = await client.v1['fee-amm'].pools.$get()
|
|
956
|
+
|
|
957
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
958
|
+
|
|
959
|
+
switch (res.status) {
|
|
960
|
+
case 200: {
|
|
961
|
+
const json = await res.json()
|
|
962
|
+
expectTypeOf(json.data[0]!.poolId).toEqualTypeOf<
|
|
963
|
+
z.output<typeof FeeAmm.schema.getFeeAmmPools.Pool>['poolId']
|
|
964
|
+
>()
|
|
965
|
+
expectTypeOf(json.data[0]!.userToken.address).toEqualTypeOf<
|
|
966
|
+
z.output<typeof FeeAmm.schema.getFeeAmmPools.Token>['address']
|
|
967
|
+
>()
|
|
968
|
+
expectTypeOf(json.data[0]!.userToken.amount).toEqualTypeOf<
|
|
969
|
+
z.output<typeof FeeAmm.schema.getFeeAmmPools.Token>['amount']
|
|
970
|
+
>()
|
|
971
|
+
expectTypeOf(json.data[0]!.validatorToken.formatted).toEqualTypeOf<
|
|
972
|
+
z.output<typeof FeeAmm.schema.getFeeAmmPools.Token>['formatted']
|
|
973
|
+
>()
|
|
974
|
+
expectTypeOf(json.nextCursor).toEqualTypeOf<string | null>()
|
|
975
|
+
void json
|
|
976
|
+
return
|
|
977
|
+
}
|
|
978
|
+
case 400: {
|
|
979
|
+
const json = await res.json()
|
|
980
|
+
expectTypeOf(json.error.code).toEqualTypeOf<Access400<'query_invalid'>>()
|
|
981
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
982
|
+
void json
|
|
983
|
+
return
|
|
984
|
+
}
|
|
985
|
+
case 502: {
|
|
986
|
+
const json = await res.json()
|
|
987
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
988
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
989
|
+
void json
|
|
990
|
+
return
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
})
|
|
994
|
+
|
|
995
|
+
test('GET /v1/fee-amm/mints', async () => {
|
|
996
|
+
const client = Client.create()
|
|
997
|
+
const res = await client.v1['fee-amm'].mints.$get()
|
|
998
|
+
|
|
999
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
1000
|
+
|
|
1001
|
+
switch (res.status) {
|
|
1002
|
+
case 200: {
|
|
1003
|
+
const json = await res.json()
|
|
1004
|
+
expectTypeOf(json.data[0]!.minter).toEqualTypeOf<
|
|
1005
|
+
z.output<typeof FeeAmm.schema.getFeeAmmMints.Mint>['minter']
|
|
1006
|
+
>()
|
|
1007
|
+
expectTypeOf(json.data[0]!.liquidity).toEqualTypeOf<
|
|
1008
|
+
z.output<typeof FeeAmm.schema.getFeeAmmMints.Mint>['liquidity']
|
|
1009
|
+
>()
|
|
1010
|
+
expectTypeOf(json.nextCursor).toEqualTypeOf<string | null>()
|
|
1011
|
+
void json
|
|
1012
|
+
return
|
|
1013
|
+
}
|
|
1014
|
+
case 400: {
|
|
1015
|
+
const json = await res.json()
|
|
1016
|
+
expectTypeOf(json.error.code).toEqualTypeOf<Access400<'query_invalid'>>()
|
|
1017
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
1018
|
+
void json
|
|
1019
|
+
return
|
|
1020
|
+
}
|
|
1021
|
+
case 502: {
|
|
1022
|
+
const json = await res.json()
|
|
1023
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
1024
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
1025
|
+
void json
|
|
1026
|
+
return
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
})
|
|
1030
|
+
|
|
1031
|
+
test('GET /v1/verified-tokens', async () => {
|
|
1032
|
+
const client = Client.create()
|
|
1033
|
+
const res = await client.v1['verified-tokens'].$get()
|
|
1034
|
+
|
|
1035
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
1036
|
+
|
|
1037
|
+
switch (res.status) {
|
|
1038
|
+
case 200: {
|
|
1039
|
+
const json = await res.json()
|
|
1040
|
+
expectTypeOf(json.data[0]!.address).toEqualTypeOf<
|
|
1041
|
+
z.output<typeof VerifiedTokens.schema.Token>['address']
|
|
1042
|
+
>()
|
|
1043
|
+
void json
|
|
1044
|
+
return
|
|
1045
|
+
}
|
|
1046
|
+
case 400: {
|
|
1047
|
+
const json = await res.json()
|
|
1048
|
+
expectTypeOf(json.error.code).toEqualTypeOf<Access400<'query_invalid'>>()
|
|
1049
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
1050
|
+
void json
|
|
1051
|
+
return
|
|
1052
|
+
}
|
|
1053
|
+
case 502: {
|
|
1054
|
+
const json = await res.json()
|
|
1055
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
1056
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
1057
|
+
void json
|
|
1058
|
+
return
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
})
|
|
1062
|
+
|
|
1063
|
+
test('GET /v1/verified-tokens/currencies', async () => {
|
|
1064
|
+
const client = Client.create()
|
|
1065
|
+
const res = await client.v1['verified-tokens'].currencies.$get()
|
|
1066
|
+
|
|
1067
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
1068
|
+
|
|
1069
|
+
switch (res.status) {
|
|
1070
|
+
case 200: {
|
|
1071
|
+
const json = await res.json()
|
|
1072
|
+
expectTypeOf(json.data[0]!).toEqualTypeOf<string>()
|
|
1073
|
+
void json
|
|
1074
|
+
return
|
|
1075
|
+
}
|
|
1076
|
+
case 400: {
|
|
1077
|
+
const json = await res.json()
|
|
1078
|
+
expectTypeOf(json.error.code).toEqualTypeOf<Access400<'query_invalid'>>()
|
|
1079
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
1080
|
+
void json
|
|
1081
|
+
return
|
|
1082
|
+
}
|
|
1083
|
+
case 502: {
|
|
1084
|
+
const json = await res.json()
|
|
1085
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
1086
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
1087
|
+
void json
|
|
1088
|
+
return
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
})
|
|
1092
|
+
|
|
1093
|
+
test('GET /v1/verified-tokens/:address', async () => {
|
|
1094
|
+
const client = Client.create()
|
|
1095
|
+
const res = await client.v1['verified-tokens'][':address'].$get({
|
|
1096
|
+
param: { address: '0x20c0000000000000000000000000000000000000' },
|
|
1097
|
+
})
|
|
1098
|
+
|
|
1099
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 404 | 502 | PaidAccessStatus>()
|
|
1100
|
+
|
|
1101
|
+
switch (res.status) {
|
|
1102
|
+
case 200: {
|
|
1103
|
+
const json = await res.json()
|
|
1104
|
+
expectTypeOf(json.address).toEqualTypeOf<
|
|
1105
|
+
z.output<typeof VerifiedTokens.schema.Token>['address']
|
|
1106
|
+
>()
|
|
1107
|
+
void json
|
|
1108
|
+
return
|
|
1109
|
+
}
|
|
1110
|
+
case 400: {
|
|
1111
|
+
const json = await res.json()
|
|
1112
|
+
expectTypeOf(json.error.code).toEqualTypeOf<
|
|
1113
|
+
Access400<'address_invalid' | 'query_invalid'>
|
|
1114
|
+
>()
|
|
1115
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
1116
|
+
void json
|
|
1117
|
+
return
|
|
1118
|
+
}
|
|
1119
|
+
case 404: {
|
|
1120
|
+
const json = await res.json()
|
|
1121
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'verified_token_not_found'>()
|
|
1122
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
1123
|
+
void json
|
|
1124
|
+
return
|
|
1125
|
+
}
|
|
1126
|
+
case 502: {
|
|
1127
|
+
const json = await res.json()
|
|
1128
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
1129
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
1130
|
+
void json
|
|
1131
|
+
return
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
})
|
|
1135
|
+
|
|
1136
|
+
test('GET /v1/indexer/query', async () => {
|
|
1137
|
+
const client = Client.create()
|
|
1138
|
+
const res = await client.v1.indexer.query.$get({
|
|
1139
|
+
query: { chainId: '42431', sql: 'select 1' },
|
|
1140
|
+
})
|
|
1141
|
+
|
|
1142
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 422 | PaidAccessStatus>()
|
|
1143
|
+
|
|
1144
|
+
switch (res.status) {
|
|
1145
|
+
case 200: {
|
|
1146
|
+
const json = await res.json()
|
|
1147
|
+
expectTypeOf(json.columns[0]!).toEqualTypeOf<
|
|
1148
|
+
z.output<typeof Indexer.schema.Response>['columns'][number]
|
|
1149
|
+
>()
|
|
1150
|
+
expectTypeOf(json.row_count).toEqualTypeOf<
|
|
1151
|
+
z.output<typeof Indexer.schema.Response>['row_count']
|
|
1152
|
+
>()
|
|
1153
|
+
void json
|
|
1154
|
+
return
|
|
1155
|
+
}
|
|
1156
|
+
case 400: {
|
|
1157
|
+
const json = await res.json()
|
|
1158
|
+
if ('ok' in json) {
|
|
1159
|
+
expectTypeOf(json.error).toEqualTypeOf<string>()
|
|
1160
|
+
expectTypeOf(json.ok).toEqualTypeOf<false>()
|
|
1161
|
+
} else {
|
|
1162
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'api_key_malformed'>()
|
|
1163
|
+
}
|
|
1164
|
+
void json
|
|
1165
|
+
return
|
|
1166
|
+
}
|
|
1167
|
+
case 422: {
|
|
1168
|
+
const json = await res.json()
|
|
1169
|
+
expectTypeOf(json.error).toEqualTypeOf<string>()
|
|
1170
|
+
expectTypeOf(json.ok).toEqualTypeOf<false>()
|
|
1171
|
+
void json
|
|
1172
|
+
return
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
})
|
|
1176
|
+
|
|
1177
|
+
test('POST /rpc/:chain', async () => {
|
|
1178
|
+
const client = Client.create()
|
|
1179
|
+
const res = await client.rpc[':chain{mainnet|testnet|[0-9]+}?'].$post({
|
|
1180
|
+
param: { chain: undefined },
|
|
1181
|
+
})
|
|
1182
|
+
|
|
1183
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | PublicAccessStatus>()
|
|
1184
|
+
|
|
1185
|
+
switch (res.status) {
|
|
1186
|
+
case 200: {
|
|
1187
|
+
const json = await res.json()
|
|
1188
|
+
if (Array.isArray(json))
|
|
1189
|
+
expectTypeOf(json[0]!.jsonrpc).toEqualTypeOf<
|
|
1190
|
+
z.output<typeof Rpc.schema.Response>['jsonrpc']
|
|
1191
|
+
>()
|
|
1192
|
+
else
|
|
1193
|
+
expectTypeOf(json.jsonrpc).toEqualTypeOf<
|
|
1194
|
+
z.output<typeof Rpc.schema.Response>['jsonrpc']
|
|
1195
|
+
>()
|
|
1196
|
+
void json
|
|
1197
|
+
return
|
|
1198
|
+
}
|
|
1199
|
+
case 400: {
|
|
1200
|
+
const json = await res.json()
|
|
1201
|
+
expectTypeOf(json.error.code).toEqualTypeOf<Access400<'chain_id_invalid'>>()
|
|
1202
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
1203
|
+
void json
|
|
1204
|
+
return
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
})
|
|
1208
|
+
|
|
1209
|
+
test('POST /rpc/:chain testnet shortcut', async () => {
|
|
1210
|
+
const client = Client.create()
|
|
1211
|
+
const res = await client.rpc[':chain{mainnet|testnet|[0-9]+}?'].$post({
|
|
1212
|
+
param: { chain: 'testnet' },
|
|
1213
|
+
})
|
|
1214
|
+
|
|
1215
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | PublicAccessStatus>()
|
|
1216
|
+
|
|
1217
|
+
switch (res.status) {
|
|
1218
|
+
case 200: {
|
|
1219
|
+
const json = await res.json()
|
|
1220
|
+
if (Array.isArray(json))
|
|
1221
|
+
expectTypeOf(json[0]!.jsonrpc).toEqualTypeOf<
|
|
1222
|
+
z.output<typeof Rpc.schema.Response>['jsonrpc']
|
|
1223
|
+
>()
|
|
1224
|
+
else
|
|
1225
|
+
expectTypeOf(json.jsonrpc).toEqualTypeOf<
|
|
1226
|
+
z.output<typeof Rpc.schema.Response>['jsonrpc']
|
|
1227
|
+
>()
|
|
1228
|
+
void json
|
|
1229
|
+
return
|
|
1230
|
+
}
|
|
1231
|
+
case 400: {
|
|
1232
|
+
const json = await res.json()
|
|
1233
|
+
expectTypeOf(json.error.code).toEqualTypeOf<Access400<'chain_id_invalid'>>()
|
|
1234
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
1235
|
+
void json
|
|
1236
|
+
return
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
})
|
|
1240
|
+
|
|
1241
|
+
test('GET /v1/addresses/:address/activities', async () => {
|
|
1242
|
+
const client = Client.create()
|
|
1243
|
+
const res = await client.v1.addresses[':address'].activities.$get({
|
|
1244
|
+
param: { address: '0x0000000000000000000000000000000000000000' },
|
|
1245
|
+
})
|
|
1246
|
+
|
|
1247
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
1248
|
+
|
|
1249
|
+
switch (res.status) {
|
|
1250
|
+
case 200: {
|
|
1251
|
+
const json = await res.json()
|
|
1252
|
+
expectTypeOf(json.data[0]!.type).toEqualTypeOf<
|
|
1253
|
+
z.output<typeof Activities.schema.getAddressActivities.Response>['data'][number]['type']
|
|
1254
|
+
>()
|
|
1255
|
+
void json
|
|
1256
|
+
return
|
|
1257
|
+
}
|
|
1258
|
+
case 400: {
|
|
1259
|
+
const json = await res.json()
|
|
1260
|
+
expectTypeOf(json.error.code).toEqualTypeOf<
|
|
1261
|
+
Access400<'address_invalid' | 'query_invalid'>
|
|
1262
|
+
>()
|
|
1263
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
1264
|
+
void json
|
|
1265
|
+
return
|
|
1266
|
+
}
|
|
1267
|
+
case 502: {
|
|
1268
|
+
const json = await res.json()
|
|
1269
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
1270
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
1271
|
+
void json
|
|
1272
|
+
return
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
})
|
|
1276
|
+
|
|
1277
|
+
test('GET /v1/webhooks/event-types', async () => {
|
|
1278
|
+
const client = Client.create()
|
|
1279
|
+
const res = await client.v1.webhooks['event-types'].$get()
|
|
1280
|
+
|
|
1281
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 404 | PaidAccessStatus>()
|
|
1282
|
+
|
|
1283
|
+
if (res.status === 200) {
|
|
1284
|
+
const json = await res.json()
|
|
1285
|
+
expectTypeOf(json.data[0]!.type).toEqualTypeOf<Webhooks.EventType>()
|
|
1286
|
+
void json
|
|
1287
|
+
}
|
|
1288
|
+
})
|
|
1289
|
+
|
|
1290
|
+
test('POST /v1/webhooks', async () => {
|
|
1291
|
+
const client = Client.create()
|
|
1292
|
+
const res = await client.v1.webhooks.$post({
|
|
1293
|
+
json: {
|
|
1294
|
+
destination: { type: 'url', url: 'https://example.com/webhook' },
|
|
1295
|
+
eventType: 'token:transfer',
|
|
1296
|
+
filters: {},
|
|
1297
|
+
},
|
|
1298
|
+
})
|
|
1299
|
+
|
|
1300
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 403 | 404 | 502 | PublicAccessStatus>()
|
|
1301
|
+
|
|
1302
|
+
if (res.status === 200) {
|
|
1303
|
+
const json = await res.json()
|
|
1304
|
+
expectTypeOf(json.secret).toEqualTypeOf<
|
|
1305
|
+
z.output<typeof Webhooks.schema.createWebhook.Response>['secret']
|
|
1306
|
+
>()
|
|
1307
|
+
void json
|
|
1308
|
+
}
|
|
1309
|
+
})
|
|
1310
|
+
|
|
1311
|
+
test('GET /v1/webhooks', async () => {
|
|
1312
|
+
const client = Client.create()
|
|
1313
|
+
const res = await client.v1.webhooks.$get()
|
|
1314
|
+
|
|
1315
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 404 | 502 | PublicAccessStatus>()
|
|
1316
|
+
|
|
1317
|
+
if (res.status === 200) {
|
|
1318
|
+
const json = await res.json()
|
|
1319
|
+
expectTypeOf(json.data[0]!.id).toEqualTypeOf<
|
|
1320
|
+
z.output<typeof Webhooks.schema.listWebhooks.Response>['data'][number]['id']
|
|
1321
|
+
>()
|
|
1322
|
+
// `meta` (opt-in `include=totalCount` count) is optional.
|
|
1323
|
+
expectTypeOf(json.meta).toEqualTypeOf<
|
|
1324
|
+
z.output<typeof Webhooks.schema.listWebhooks.Response>['meta']
|
|
1325
|
+
>()
|
|
1326
|
+
void json
|
|
1327
|
+
}
|
|
1328
|
+
})
|
|
1329
|
+
|
|
1330
|
+
test('GET /v1/webhooks/:id', async () => {
|
|
1331
|
+
const client = Client.create()
|
|
1332
|
+
const res = await client.v1.webhooks[':id{wh_[A-Za-z0-9_-]+}'].$get({
|
|
1333
|
+
param: { id: 'wh_test' },
|
|
1334
|
+
})
|
|
1335
|
+
|
|
1336
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 404 | 502 | PublicAccessStatus>()
|
|
1337
|
+
|
|
1338
|
+
if (res.status === 200) {
|
|
1339
|
+
const json = await res.json()
|
|
1340
|
+
expectTypeOf(json.id).toEqualTypeOf<
|
|
1341
|
+
z.output<typeof Webhooks.schema.getWebhook.Response>['id']
|
|
1342
|
+
>()
|
|
1343
|
+
void json
|
|
1344
|
+
}
|
|
1345
|
+
})
|
|
1346
|
+
|
|
1347
|
+
test('GET /v1/webhooks/:id/deliveries', async () => {
|
|
1348
|
+
const client = Client.create()
|
|
1349
|
+
const res = await client.v1.webhooks[':id{wh_[A-Za-z0-9_-]+}'].deliveries.$get({
|
|
1350
|
+
param: { id: 'wh_test' },
|
|
1351
|
+
})
|
|
1352
|
+
|
|
1353
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 404 | 502 | PublicAccessStatus>()
|
|
1354
|
+
|
|
1355
|
+
if (res.status === 200) {
|
|
1356
|
+
const json = await res.json()
|
|
1357
|
+
expectTypeOf(json.data[0]!.id).toEqualTypeOf<
|
|
1358
|
+
z.output<typeof Webhooks.schema.listWebhookDeliveries.Response>['data'][number]['id']
|
|
1359
|
+
>()
|
|
1360
|
+
// `meta` (opt-in `include=totalCount` count) is optional.
|
|
1361
|
+
expectTypeOf(json.meta).toEqualTypeOf<
|
|
1362
|
+
z.output<typeof Webhooks.schema.listWebhookDeliveries.Response>['meta']
|
|
1363
|
+
>()
|
|
1364
|
+
void json
|
|
1365
|
+
}
|
|
1366
|
+
})
|
|
1367
|
+
|
|
1368
|
+
test('POST /v1/webhooks/:id/ping', async () => {
|
|
1369
|
+
const client = Client.create()
|
|
1370
|
+
const res = await client.v1.webhooks[':id{wh_[A-Za-z0-9_-]+}'].ping.$post({
|
|
1371
|
+
param: { id: 'wh_test' },
|
|
1372
|
+
})
|
|
1373
|
+
|
|
1374
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 404 | 502 | PublicAccessStatus>()
|
|
1375
|
+
|
|
1376
|
+
if (res.status === 200) {
|
|
1377
|
+
const json = await res.json()
|
|
1378
|
+
expectTypeOf(json.delivered).toEqualTypeOf<
|
|
1379
|
+
z.output<typeof Webhooks.schema.pingWebhook.Response>['delivered']
|
|
1380
|
+
>()
|
|
1381
|
+
void json
|
|
1382
|
+
}
|
|
1383
|
+
})
|
|
1384
|
+
|
|
1385
|
+
test('POST /v1/webhooks/:id/deliveries/:deliveryId/retry', async () => {
|
|
1386
|
+
const client = Client.create()
|
|
1387
|
+
const res = await client.v1.webhooks[':id{wh_[A-Za-z0-9_-]+}'].deliveries[
|
|
1388
|
+
':deliveryId'
|
|
1389
|
+
].retry.$post({
|
|
1390
|
+
param: { deliveryId: 'whd_test', id: 'wh_test' },
|
|
1391
|
+
})
|
|
1392
|
+
|
|
1393
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 404 | 502 | PublicAccessStatus>()
|
|
1394
|
+
|
|
1395
|
+
if (res.status === 200) {
|
|
1396
|
+
const json = await res.json()
|
|
1397
|
+
expectTypeOf(json.eventId).toEqualTypeOf<
|
|
1398
|
+
z.output<typeof Webhooks.schema.retryWebhookDelivery.Response>['eventId']
|
|
1399
|
+
>()
|
|
1400
|
+
void json
|
|
1401
|
+
}
|
|
1402
|
+
})
|
|
1403
|
+
|
|
1404
|
+
test('PATCH /v1/webhooks/:id', async () => {
|
|
1405
|
+
const client = Client.create()
|
|
1406
|
+
const res = await client.v1.webhooks[':id{wh_[A-Za-z0-9_-]+}'].$patch({
|
|
1407
|
+
json: { status: 'paused' },
|
|
1408
|
+
param: { id: 'wh_test' },
|
|
1409
|
+
})
|
|
1410
|
+
|
|
1411
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 403 | 404 | 502 | PublicAccessStatus>()
|
|
1412
|
+
|
|
1413
|
+
if (res.status === 200) {
|
|
1414
|
+
const json = await res.json()
|
|
1415
|
+
expectTypeOf(json.status).toEqualTypeOf<
|
|
1416
|
+
z.output<typeof Webhooks.schema.updateWebhook.Response>['status']
|
|
1417
|
+
>()
|
|
1418
|
+
void json
|
|
1419
|
+
}
|
|
1420
|
+
})
|
|
1421
|
+
|
|
1422
|
+
test('DELETE /v1/webhooks/:id', async () => {
|
|
1423
|
+
const client = Client.create()
|
|
1424
|
+
const res = await client.v1.webhooks[':id{wh_[A-Za-z0-9_-]+}'].$delete({
|
|
1425
|
+
param: { id: 'wh_test' },
|
|
1426
|
+
})
|
|
1427
|
+
|
|
1428
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 404 | 502 | PublicAccessStatus>()
|
|
1429
|
+
|
|
1430
|
+
if (res.status === 200) {
|
|
1431
|
+
const json = await res.json()
|
|
1432
|
+
expectTypeOf(json.id).toEqualTypeOf<
|
|
1433
|
+
z.output<typeof Webhooks.schema.deleteWebhook.Response>['id']
|
|
1434
|
+
>()
|
|
1435
|
+
void json
|
|
1436
|
+
}
|
|
1437
|
+
})
|
|
1438
|
+
})
|