tapimo 0.0.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -16
- package/dist/ApiKey.d.ts +14 -11
- package/dist/ApiKey.d.ts.map +1 -1
- package/dist/ApiKey.js +11 -12
- package/dist/ApiKey.js.map +1 -1
- package/dist/ApiKeys.d.ts +207 -0
- package/dist/ApiKeys.d.ts.map +1 -0
- package/dist/ApiKeys.js +282 -0
- package/dist/ApiKeys.js.map +1 -0
- package/dist/App.d.ts +6771 -3819
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +145 -317
- package/dist/App.js.map +1 -1
- package/dist/Handler.d.ts +86 -0
- package/dist/Handler.d.ts.map +1 -0
- package/dist/Handler.js +83 -0
- package/dist/Handler.js.map +1 -0
- package/dist/Scope.d.ts +14 -4
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +16 -4
- package/dist/Scope.js.map +1 -1
- package/dist/Webhooks.d.ts +5 -7
- package/dist/Webhooks.d.ts.map +1 -1
- package/dist/Webhooks.js +11 -4
- package/dist/Webhooks.js.map +1 -1
- package/dist/admin/Access.d.ts +1 -3
- package/dist/admin/Access.d.ts.map +1 -1
- package/dist/admin/Access.js +1 -3
- package/dist/admin/Access.js.map +1 -1
- package/dist/admin/App.d.ts +167 -205
- package/dist/admin/App.d.ts.map +1 -1
- package/dist/admin/App.js +2 -4
- package/dist/admin/App.js.map +1 -1
- package/dist/admin/apps/api-keys.d.ts +105 -5
- package/dist/admin/apps/api-keys.d.ts.map +1 -1
- package/dist/admin/apps/api-keys.js +75 -9
- package/dist/admin/apps/api-keys.js.map +1 -1
- package/dist/admin/apps/scopes.d.ts +6 -0
- package/dist/admin/apps/scopes.d.ts.map +1 -1
- package/dist/admin/apps/verified-tokens.d.ts +35 -149
- package/dist/admin/apps/verified-tokens.d.ts.map +1 -1
- package/dist/admin/apps/verified-tokens.js +18 -39
- package/dist/admin/apps/verified-tokens.js.map +1 -1
- package/dist/admin/ui.generated.d.ts +1 -1
- package/dist/admin/ui.generated.js +1 -1
- package/dist/apps/data/App.d.ts +19176 -0
- package/dist/apps/data/App.d.ts.map +1 -0
- package/dist/apps/data/App.js +236 -0
- package/dist/apps/data/App.js.map +1 -0
- package/dist/apps/data/index.d.ts +3 -0
- package/dist/apps/data/index.d.ts.map +1 -0
- package/dist/apps/data/index.js +3 -0
- package/dist/apps/data/index.js.map +1 -0
- package/dist/apps/{activities.d.ts → data/routes/activities.d.ts} +32 -32
- package/dist/apps/{activities.d.ts.map → data/routes/activities.d.ts.map} +1 -1
- package/dist/apps/{activities.js → data/routes/activities.js} +13 -13
- package/dist/apps/data/routes/activities.js.map +1 -0
- package/dist/apps/{addresses.d.ts → data/routes/addresses.d.ts} +22 -22
- package/dist/apps/{addresses.d.ts.map → data/routes/addresses.d.ts.map} +1 -1
- package/dist/apps/{addresses.js → data/routes/addresses.js} +5 -5
- package/dist/apps/data/routes/addresses.js.map +1 -0
- package/dist/apps/{balances.d.ts → data/routes/balances.d.ts} +49 -49
- package/dist/apps/data/routes/balances.d.ts.map +1 -0
- package/dist/apps/{balances.js → data/routes/balances.js} +42 -11
- package/dist/apps/data/routes/balances.js.map +1 -0
- package/dist/apps/{blocks.d.ts → data/routes/blocks.d.ts} +47 -47
- package/dist/apps/data/routes/blocks.d.ts.map +1 -0
- package/dist/apps/{blocks.js → data/routes/blocks.js} +13 -13
- package/dist/apps/data/routes/blocks.js.map +1 -0
- package/dist/apps/{coingecko.d.ts → data/routes/coingecko.d.ts} +183 -183
- package/dist/apps/data/routes/coingecko.d.ts.map +1 -0
- package/dist/apps/{coingecko.js → data/routes/coingecko.js} +13 -13
- package/dist/apps/data/routes/coingecko.js.map +1 -0
- package/dist/apps/{exchanges.d.ts → data/routes/exchanges.d.ts} +460 -460
- package/dist/apps/data/routes/exchanges.d.ts.map +1 -0
- package/dist/apps/{exchanges.js → data/routes/exchanges.js} +19 -19
- package/dist/apps/data/routes/exchanges.js.map +1 -0
- package/dist/apps/{fee-amm.d.ts → data/routes/fee-amm.d.ts} +94 -94
- package/dist/apps/data/routes/fee-amm.d.ts.map +1 -0
- package/dist/apps/{fee-amm.js → data/routes/fee-amm.js} +17 -17
- package/dist/apps/data/routes/fee-amm.js.map +1 -0
- package/dist/apps/{indexer.d.ts → data/routes/indexer.d.ts} +4 -4
- package/dist/apps/data/routes/indexer.d.ts.map +1 -0
- package/dist/apps/{indexer.js → data/routes/indexer.js} +13 -9
- package/dist/apps/data/routes/indexer.js.map +1 -0
- package/dist/apps/{receipts.d.ts → data/routes/receipts.d.ts} +6 -6
- package/dist/apps/data/routes/receipts.d.ts.map +1 -0
- package/dist/apps/{receipts.js → data/routes/receipts.js} +12 -12
- package/dist/apps/data/routes/receipts.js.map +1 -0
- package/dist/apps/{rpc.d.ts → data/routes/rpc.d.ts} +4 -4
- package/dist/apps/data/routes/rpc.d.ts.map +1 -0
- package/dist/apps/{rpc.js → data/routes/rpc.js} +6 -6
- package/dist/apps/data/routes/rpc.js.map +1 -0
- package/dist/apps/{tokenlist.d.ts → data/routes/tokenlist.d.ts} +4 -4
- package/dist/apps/data/routes/tokenlist.d.ts.map +1 -0
- package/dist/apps/{tokenlist.js → data/routes/tokenlist.js} +8 -8
- package/dist/apps/data/routes/tokenlist.js.map +1 -0
- package/dist/apps/{tokens.d.ts → data/routes/tokens.d.ts} +11 -11
- package/dist/apps/data/routes/tokens.d.ts.map +1 -0
- package/dist/apps/{tokens.js → data/routes/tokens.js} +19 -19
- package/dist/apps/data/routes/tokens.js.map +1 -0
- package/dist/apps/{transactions.d.ts → data/routes/transactions.d.ts} +288 -288
- package/dist/apps/data/routes/transactions.d.ts.map +1 -0
- package/dist/apps/{transactions.js → data/routes/transactions.js} +13 -13
- package/dist/apps/data/routes/transactions.js.map +1 -0
- package/dist/apps/{transfers.d.ts → data/routes/transfers.d.ts} +35 -35
- package/dist/apps/data/routes/transfers.d.ts.map +1 -0
- package/dist/apps/{transfers.js → data/routes/transfers.js} +13 -13
- package/dist/apps/data/routes/transfers.js.map +1 -0
- package/dist/apps/{verified-tokens.d.ts → data/routes/verified-tokens.d.ts} +42 -42
- package/dist/apps/data/routes/verified-tokens.d.ts.map +1 -0
- package/dist/apps/{verified-tokens.js → data/routes/verified-tokens.js} +9 -9
- package/dist/apps/data/routes/verified-tokens.js.map +1 -0
- package/dist/apps/{webhooks.d.ts → data/routes/webhooks.d.ts} +66 -63
- package/dist/apps/{webhooks.d.ts.map → data/routes/webhooks.d.ts.map} +1 -1
- package/dist/apps/{webhooks.js → data/routes/webhooks.js} +67 -59
- package/dist/apps/data/routes/webhooks.js.map +1 -0
- package/dist/apps/docs/App.d.ts +27 -0
- package/dist/apps/docs/App.d.ts.map +1 -0
- package/dist/apps/docs/App.js +122 -0
- package/dist/apps/docs/App.js.map +1 -0
- package/dist/{internal/OpenApi.fonts.d.ts → apps/docs/fonts.d.ts} +1 -1
- package/dist/apps/docs/fonts.d.ts.map +1 -0
- package/dist/{internal/OpenApi.fonts.js → apps/docs/fonts.js} +1 -1
- package/dist/apps/docs/fonts.js.map +1 -0
- package/dist/apps/docs/index.d.ts +2 -0
- package/dist/apps/docs/index.d.ts.map +1 -0
- package/dist/apps/docs/index.js +2 -0
- package/dist/apps/docs/index.js.map +1 -0
- package/dist/{internal/OpenApi.logo.d.ts → apps/docs/logo.d.ts} +1 -1
- package/dist/apps/docs/logo.d.ts.map +1 -0
- package/dist/{internal/OpenApi.logo.js → apps/docs/logo.js} +1 -1
- package/dist/apps/docs/logo.js.map +1 -0
- package/dist/apps/index.d.ts +4 -0
- package/dist/apps/index.d.ts.map +1 -0
- package/dist/apps/index.js +4 -0
- package/dist/apps/index.js.map +1 -0
- package/dist/apps/metadata.d.ts +7 -0
- package/dist/apps/metadata.d.ts.map +1 -0
- package/dist/apps/metadata.js +15 -0
- package/dist/apps/metadata.js.map +1 -0
- package/dist/apps/platform/App.d.ts +2985 -0
- package/dist/apps/platform/App.d.ts.map +1 -0
- package/dist/apps/platform/App.js +74 -0
- package/dist/apps/platform/App.js.map +1 -0
- package/dist/apps/platform/index.d.ts +2 -0
- package/dist/apps/platform/index.d.ts.map +1 -0
- package/dist/apps/platform/index.js +2 -0
- package/dist/apps/platform/index.js.map +1 -0
- package/dist/apps/platform/routes/api-keys.d.ts +681 -0
- package/dist/apps/platform/routes/api-keys.d.ts.map +1 -0
- package/dist/apps/platform/routes/api-keys.js +328 -0
- package/dist/apps/platform/routes/api-keys.js.map +1 -0
- package/dist/apps/platform/routes/invitations.d.ts +733 -0
- package/dist/apps/platform/routes/invitations.d.ts.map +1 -0
- package/dist/apps/platform/routes/invitations.js +413 -0
- package/dist/apps/platform/routes/invitations.js.map +1 -0
- package/dist/apps/platform/routes/me.d.ts +95 -0
- package/dist/apps/platform/routes/me.d.ts.map +1 -0
- package/dist/apps/platform/routes/me.js +81 -0
- package/dist/apps/platform/routes/me.js.map +1 -0
- package/dist/apps/platform/routes/members.d.ts +554 -0
- package/dist/apps/platform/routes/members.d.ts.map +1 -0
- package/dist/apps/platform/routes/members.js +251 -0
- package/dist/apps/platform/routes/members.js.map +1 -0
- package/dist/apps/platform/routes/orgs.d.ts +582 -0
- package/dist/apps/platform/routes/orgs.d.ts.map +1 -0
- package/dist/apps/platform/routes/orgs.js +265 -0
- package/dist/apps/platform/routes/orgs.js.map +1 -0
- package/dist/apps/platform/routes/projects.d.ts +740 -0
- package/dist/apps/platform/routes/projects.d.ts.map +1 -0
- package/dist/apps/platform/routes/projects.js +286 -0
- package/dist/apps/platform/routes/projects.js.map +1 -0
- package/dist/apps/relay/App.d.ts +41 -0
- package/dist/apps/relay/App.d.ts.map +1 -0
- package/dist/apps/relay/App.js +103 -0
- package/dist/apps/relay/App.js.map +1 -0
- package/dist/apps/relay/Sponsorships.d.ts +107 -0
- package/dist/apps/relay/Sponsorships.d.ts.map +1 -0
- package/dist/apps/relay/Sponsorships.js +193 -0
- package/dist/apps/relay/Sponsorships.js.map +1 -0
- package/dist/apps/relay/index.d.ts +3 -0
- package/dist/apps/relay/index.d.ts.map +1 -0
- package/dist/apps/relay/index.js +3 -0
- package/dist/apps/relay/index.js.map +1 -0
- package/dist/{Cli.d.ts → cli/Cli.d.ts} +13 -2
- package/dist/cli/Cli.d.ts.map +1 -0
- package/dist/cli/Cli.js +19 -0
- package/dist/cli/Cli.js.map +1 -0
- package/dist/cli/bin.d.ts +3 -0
- package/dist/cli/bin.d.ts.map +1 -0
- package/dist/cli/bin.js +4 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/commands/admin.d.ts +15 -0
- package/dist/cli/commands/admin.d.ts.map +1 -0
- package/dist/cli/commands/admin.js +60 -0
- package/dist/cli/commands/admin.js.map +1 -0
- package/dist/cloudflare.d.ts +7 -0
- package/dist/cloudflare.d.ts.map +1 -1
- package/dist/cloudflare.js +9 -0
- package/dist/cloudflare.js.map +1 -1
- package/dist/db/Db.d.ts +113 -0
- package/dist/db/Db.d.ts.map +1 -0
- package/dist/db/Db.js +402 -0
- package/dist/db/Db.js.map +1 -0
- package/dist/db/Schema.d.ts +168 -0
- package/dist/db/Schema.d.ts.map +1 -0
- package/dist/db/Schema.js +229 -0
- package/dist/db/Schema.js.map +1 -0
- package/dist/db/tables/invitations.d.ts +84 -0
- package/dist/db/tables/invitations.d.ts.map +1 -0
- package/dist/db/tables/invitations.js +165 -0
- package/dist/db/tables/invitations.js.map +1 -0
- package/dist/db/tables/memberships.d.ts +108 -0
- package/dist/db/tables/memberships.d.ts.map +1 -0
- package/dist/db/tables/memberships.js +153 -0
- package/dist/db/tables/memberships.js.map +1 -0
- package/dist/db/tables/organizations.d.ts +123 -0
- package/dist/db/tables/organizations.d.ts.map +1 -0
- package/dist/db/tables/organizations.js +170 -0
- package/dist/db/tables/organizations.js.map +1 -0
- package/dist/db/tables/projects.d.ts +65 -0
- package/dist/db/tables/projects.d.ts.map +1 -0
- package/dist/db/tables/projects.js +75 -0
- package/dist/db/tables/projects.js.map +1 -0
- package/dist/db/tables/sponsoredTransactions.d.ts +120 -0
- package/dist/db/tables/sponsoredTransactions.d.ts.map +1 -0
- package/dist/db/tables/sponsoredTransactions.js +161 -0
- package/dist/db/tables/sponsoredTransactions.js.map +1 -0
- package/dist/db/tables/users.d.ts +48 -0
- package/dist/db/tables/users.d.ts.map +1 -0
- package/dist/db/tables/users.js +65 -0
- package/dist/db/tables/users.js.map +1 -0
- package/dist/db/tables/verifiedTokens.d.ts +53 -0
- package/dist/db/tables/verifiedTokens.d.ts.map +1 -0
- package/dist/db/tables/verifiedTokens.js +74 -0
- package/dist/db/tables/verifiedTokens.js.map +1 -0
- package/dist/db/tables/webhookDeliveries.d.ts +71 -0
- package/dist/db/tables/webhookDeliveries.d.ts.map +1 -0
- package/dist/db/tables/webhookDeliveries.js +119 -0
- package/dist/db/tables/webhookDeliveries.js.map +1 -0
- package/dist/db/tables/webhookSubscriptions.d.ts +158 -0
- package/dist/db/tables/webhookSubscriptions.d.ts.map +1 -0
- package/dist/db/tables/webhookSubscriptions.js +272 -0
- package/dist/db/tables/webhookSubscriptions.js.map +1 -0
- package/dist/handlers/internal/executionError.d.ts +25 -0
- package/dist/handlers/internal/executionError.d.ts.map +1 -0
- package/dist/handlers/internal/executionError.js +186 -0
- package/dist/handlers/internal/executionError.js.map +1 -0
- package/dist/handlers/internal/multisig.d.ts +233 -0
- package/dist/handlers/internal/multisig.d.ts.map +1 -0
- package/dist/handlers/internal/multisig.js +542 -0
- package/dist/handlers/internal/multisig.js.map +1 -0
- package/dist/handlers/internal/requestListener.d.ts +124 -0
- package/dist/handlers/internal/requestListener.d.ts.map +1 -0
- package/dist/handlers/internal/requestListener.js +173 -0
- package/dist/handlers/internal/requestListener.js.map +1 -0
- package/dist/handlers/internal/sponsorship.d.ts +113 -0
- package/dist/handlers/internal/sponsorship.d.ts.map +1 -0
- package/dist/handlers/internal/sponsorship.js +128 -0
- package/dist/handlers/internal/sponsorship.js.map +1 -0
- package/dist/handlers/internal/types.d.ts +284 -0
- package/dist/handlers/internal/types.d.ts.map +1 -0
- package/dist/handlers/internal/types.js +2 -0
- package/dist/handlers/internal/types.js.map +1 -0
- package/dist/handlers/internal/utils.d.ts +34 -0
- package/dist/handlers/internal/utils.d.ts.map +1 -0
- package/dist/handlers/internal/utils.js +131 -0
- package/dist/handlers/internal/utils.js.map +1 -0
- package/dist/handlers/relay.d.ts +123 -0
- package/dist/handlers/relay.d.ts.map +1 -0
- package/dist/handlers/relay.js +1278 -0
- package/dist/handlers/relay.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/internal/Auth.d.ts +224 -16
- package/dist/internal/Auth.d.ts.map +1 -1
- package/dist/internal/Auth.js +572 -33
- package/dist/internal/Auth.js.map +1 -1
- package/dist/internal/Log.d.ts +7 -3
- package/dist/internal/Log.d.ts.map +1 -1
- package/dist/internal/Log.js +4 -0
- package/dist/internal/Log.js.map +1 -1
- package/dist/internal/OpenApi.d.ts +0 -19
- package/dist/internal/OpenApi.d.ts.map +1 -1
- package/dist/internal/OpenApi.js +0 -57
- package/dist/internal/OpenApi.js.map +1 -1
- package/dist/internal/RpcSchema.d.ts +10 -0
- package/dist/internal/RpcSchema.d.ts.map +1 -0
- package/dist/internal/RpcSchema.js +2 -0
- package/dist/internal/RpcSchema.js.map +1 -0
- package/dist/internal/Store.d.ts +49 -4
- package/dist/internal/Store.d.ts.map +1 -1
- package/dist/internal/Store.js +81 -5
- package/dist/internal/Store.js.map +1 -1
- package/dist/internal/VerifiedTokens.d.ts +15 -34
- package/dist/internal/VerifiedTokens.d.ts.map +1 -1
- package/dist/internal/VerifiedTokens.js +115 -159
- package/dist/internal/VerifiedTokens.js.map +1 -1
- package/dist/internal/Viem.d.ts +84 -0
- package/dist/internal/Viem.d.ts.map +1 -1
- package/dist/internal/Webhooks.d.ts +50 -36
- package/dist/internal/Webhooks.d.ts.map +1 -1
- package/dist/internal/Webhooks.js +92 -205
- package/dist/internal/Webhooks.js.map +1 -1
- package/package.json +37 -6
- package/src/ApiKey.test.ts +3 -3
- package/src/ApiKey.ts +11 -12
- package/src/ApiKeys.test.ts +278 -0
- package/src/ApiKeys.ts +358 -0
- package/src/App.test-d.ts +1 -1
- package/src/App.test.ts +40508 -19083
- package/src/App.ts +239 -416
- package/src/Client.test-d.ts +307 -16
- package/src/Handler.ts +154 -0
- package/src/Scope.ts +17 -4
- package/src/Webhooks.test.ts +8 -7
- package/src/Webhooks.ts +13 -7
- package/src/admin/Access.ts +1 -3
- package/src/admin/App.ts +19 -24
- package/src/admin/apps/api-keys.test.ts +70 -18
- package/src/admin/apps/api-keys.ts +92 -9
- package/src/admin/apps/scopes.test.ts +8 -0
- package/src/admin/apps/verified-tokens.test.ts +3 -30
- package/src/admin/apps/verified-tokens.ts +18 -37
- package/src/admin/ui.generated.ts +1 -1
- package/src/apps/composition.test.ts +66 -0
- package/src/apps/data/App.ts +295 -0
- package/src/apps/data/index.ts +2 -0
- package/src/apps/{activities.test.ts → data/routes/activities.test.ts} +3 -3
- package/src/apps/{activities.ts → data/routes/activities.ts} +15 -15
- package/src/apps/{addresses.ts → data/routes/addresses.ts} +6 -6
- package/src/apps/{balances.test.ts → data/routes/balances.test.ts} +6 -5
- package/src/apps/{balances.ts → data/routes/balances.ts} +46 -12
- package/src/apps/{blocks.test.ts → data/routes/blocks.test.ts} +4 -4
- package/src/apps/{blocks.ts → data/routes/blocks.ts} +14 -14
- package/src/apps/{coingecko.test.ts → data/routes/coingecko.test.ts} +2 -2
- package/src/apps/{coingecko.ts → data/routes/coingecko.ts} +14 -14
- package/src/apps/{exchanges.test.ts → data/routes/exchanges.test.ts} +2 -2
- package/src/apps/{exchanges.ts → data/routes/exchanges.ts} +20 -20
- package/src/apps/{fee-amm.test.ts → data/routes/fee-amm.test.ts} +3 -3
- package/src/apps/{fee-amm.ts → data/routes/fee-amm.ts} +18 -18
- package/src/apps/{indexer.test.ts → data/routes/indexer.test.ts} +27 -6
- package/src/apps/{indexer.ts → data/routes/indexer.ts} +13 -10
- package/src/apps/{receipts.test.ts → data/routes/receipts.test.ts} +4 -4
- package/src/apps/{receipts.ts → data/routes/receipts.ts} +13 -13
- package/src/apps/{rpc.test.ts → data/routes/rpc.test.ts} +142 -13
- package/src/apps/{rpc.ts → data/routes/rpc.ts} +7 -7
- package/src/apps/{tokenlist.test.ts → data/routes/tokenlist.test.ts} +8 -10
- package/src/apps/{tokenlist.ts → data/routes/tokenlist.ts} +9 -9
- package/src/apps/{tokens.test.ts → data/routes/tokens.test.ts} +6 -5
- package/src/apps/{tokens.ts → data/routes/tokens.ts} +20 -20
- package/src/apps/{transactions.test.ts → data/routes/transactions.test.ts} +4 -4
- package/src/apps/{transactions.ts → data/routes/transactions.ts} +15 -15
- package/src/apps/{transfers.test.ts → data/routes/transfers.test.ts} +3 -3
- package/src/apps/{transfers.ts → data/routes/transfers.ts} +15 -15
- package/src/apps/{verified-tokens.test.ts → data/routes/verified-tokens.test.ts} +27 -15
- package/src/apps/{verified-tokens.ts → data/routes/verified-tokens.ts} +10 -10
- package/src/apps/{webhooks.test.ts → data/routes/webhooks.test.ts} +137 -150
- package/src/apps/{webhooks.ts → data/routes/webhooks.ts} +83 -81
- package/src/apps/docs/App.ts +136 -0
- package/src/apps/docs/index.ts +1 -0
- package/src/apps/index.ts +3 -0
- package/src/apps/metadata.ts +23 -0
- package/src/apps/platform/App.ts +130 -0
- package/src/apps/platform/index.ts +1 -0
- package/src/apps/platform/routes/api-keys.test.ts +330 -0
- package/src/apps/platform/routes/api-keys.ts +427 -0
- package/src/apps/platform/routes/invitations.test.ts +361 -0
- package/src/apps/platform/routes/invitations.ts +519 -0
- package/src/apps/platform/routes/me.test.ts +121 -0
- package/src/apps/platform/routes/me.ts +106 -0
- package/src/apps/platform/routes/members.test.ts +195 -0
- package/src/apps/platform/routes/members.ts +313 -0
- package/src/apps/platform/routes/orgs.test.ts +313 -0
- package/src/apps/platform/routes/orgs.ts +343 -0
- package/src/apps/platform/routes/projects.test.ts +181 -0
- package/src/apps/platform/routes/projects.ts +367 -0
- package/src/apps/relay/App.test.ts +484 -0
- package/src/apps/relay/App.ts +128 -0
- package/src/apps/relay/Sponsorships.test.ts +375 -0
- package/src/apps/relay/Sponsorships.ts +305 -0
- package/src/apps/relay/index.ts +2 -0
- package/src/{Cli.test.ts → cli/Cli.test.ts} +10 -9
- package/src/{Cli.ts → cli/Cli.ts} +16 -9
- package/src/cli/bin.ts +4 -0
- package/src/cli/commands/admin.test.ts +71 -0
- package/src/cli/commands/admin.ts +60 -0
- package/src/cloudflare.ts +10 -0
- package/src/db/Db.test.ts +84 -0
- package/src/db/Db.ts +542 -0
- package/src/db/Schema.ts +301 -0
- package/src/db/tables/invitations.ts +198 -0
- package/src/db/tables/memberships.ts +208 -0
- package/src/db/tables/organizations.test.ts +160 -0
- package/src/db/tables/organizations.ts +232 -0
- package/src/db/tables/projects.ts +107 -0
- package/src/db/tables/sponsoredTransactions.test.ts +218 -0
- package/src/db/tables/sponsoredTransactions.ts +236 -0
- package/src/db/tables/users.ts +85 -0
- package/src/db/tables/verifiedTokens.ts +111 -0
- package/src/db/tables/webhookDeliveries.ts +159 -0
- package/src/db/tables/webhookSubscriptions.ts +358 -0
- package/src/handlers/internal/executionError.ts +207 -0
- package/src/handlers/internal/multisig.test.ts +818 -0
- package/src/handlers/internal/multisig.ts +823 -0
- package/src/handlers/internal/requestListener.ts +273 -0
- package/src/handlers/internal/sponsorship.ts +245 -0
- package/src/handlers/internal/types.ts +378 -0
- package/src/handlers/internal/utils.ts +153 -0
- package/src/handlers/relay.test.ts +2035 -0
- package/src/handlers/relay.ts +1623 -0
- package/src/index.ts +4 -2
- package/src/internal/Auth.test.ts +337 -21
- package/src/internal/Auth.ts +783 -44
- package/src/internal/Cursor.test.ts +3 -2
- package/src/internal/Log.test.ts +1 -1
- package/src/internal/Log.ts +11 -3
- package/src/internal/MetricSink.ts +1 -1
- package/src/internal/OpenApi.ts +0 -59
- package/src/internal/RateLimit.test.ts +1 -1
- package/src/internal/RpcSchema.ts +10 -0
- package/src/internal/Store.test.ts +150 -10
- package/src/internal/Store.ts +136 -11
- package/src/internal/Tidx.local.test.ts +1 -1
- package/src/internal/VerifiedTokens.test.ts +99 -115
- package/src/internal/VerifiedTokens.ts +123 -175
- package/src/internal/WebhookDestination.test.ts +1 -1
- package/src/internal/Webhooks.test.ts +111 -111
- package/src/internal/Webhooks.ts +103 -221
- package/dist/ApiKeySource.d.ts +0 -166
- package/dist/ApiKeySource.d.ts.map +0 -1
- package/dist/ApiKeySource.js +0 -234
- package/dist/ApiKeySource.js.map +0 -1
- package/dist/Cli.d.ts.map +0 -1
- package/dist/Cli.js +0 -13
- package/dist/Cli.js.map +0 -1
- package/dist/apps/activities.js.map +0 -1
- package/dist/apps/addresses.js.map +0 -1
- package/dist/apps/balances.d.ts.map +0 -1
- package/dist/apps/balances.js.map +0 -1
- package/dist/apps/blocks.d.ts.map +0 -1
- package/dist/apps/blocks.js.map +0 -1
- package/dist/apps/coingecko.d.ts.map +0 -1
- package/dist/apps/coingecko.js.map +0 -1
- package/dist/apps/exchanges.d.ts.map +0 -1
- package/dist/apps/exchanges.js.map +0 -1
- package/dist/apps/fee-amm.d.ts.map +0 -1
- package/dist/apps/fee-amm.js.map +0 -1
- package/dist/apps/indexer.d.ts.map +0 -1
- package/dist/apps/indexer.js.map +0 -1
- package/dist/apps/receipts.d.ts.map +0 -1
- package/dist/apps/receipts.js.map +0 -1
- package/dist/apps/rpc.d.ts.map +0 -1
- package/dist/apps/rpc.js.map +0 -1
- package/dist/apps/tokenlist.d.ts.map +0 -1
- package/dist/apps/tokenlist.js.map +0 -1
- package/dist/apps/tokens.d.ts.map +0 -1
- package/dist/apps/tokens.js.map +0 -1
- package/dist/apps/transactions.d.ts.map +0 -1
- package/dist/apps/transactions.js.map +0 -1
- package/dist/apps/transfers.d.ts.map +0 -1
- package/dist/apps/transfers.js.map +0 -1
- package/dist/apps/verified-tokens.d.ts.map +0 -1
- package/dist/apps/verified-tokens.js.map +0 -1
- package/dist/apps/webhooks.js.map +0 -1
- package/dist/internal/OpenApi.fonts.d.ts.map +0 -1
- package/dist/internal/OpenApi.fonts.js.map +0 -1
- package/dist/internal/OpenApi.logo.d.ts.map +0 -1
- package/dist/internal/OpenApi.logo.js.map +0 -1
- package/seeds/31318/icons/0x20c0000000000000000000000000000000000000.svg +0 -1
- package/seeds/31318/icons/0x20c0000000000000000000000000000000000001.svg +0 -1
- package/seeds/31318/icons/0x20c0000000000000000000000000000000000002.svg +0 -1
- package/seeds/31318/icons/0x20c0000000000000000000000000000000000003.svg +0 -1
- package/seeds/31318/verified-tokens.json +0 -30
- package/seeds/4217/icons/0x20c0000000000000000000000000000000000000.svg +0 -25
- package/seeds/4217/icons/0x20c000000000000000000000048c8f36df1c9a4a.svg +0 -1
- package/seeds/4217/icons/0x20c0000000000000000000000520792dcccccccc.svg +0 -1
- package/seeds/4217/icons/0x20c0000000000000000000000a6da882d075a4c3.svg +0 -4
- package/seeds/4217/icons/0x20c000000000000000000000111111111e910f0f.svg +0 -30
- package/seeds/4217/icons/0x20c00000000000000000000014f22ca97301eb73.svg +0 -1
- package/seeds/4217/icons/0x20c0000000000000000000001621e21f71cf12fb.svg +0 -1
- package/seeds/4217/icons/0x20c0000000000000000000002f52d5cc21a3207b.svg +0 -1
- package/seeds/4217/icons/0x20c0000000000000000000003158081efd85bfc2.svg +0 -11
- package/seeds/4217/icons/0x20c0000000000000000000003554d28269e0f3c2.svg +0 -1
- package/seeds/4217/icons/0x20c000000000000000000000383a23bacb546ab9.svg +0 -1
- package/seeds/4217/icons/0x20c00000000000000000000042109aef2f8b28e1.png +0 -0
- package/seeds/4217/icons/0x20c0000000000000000000005c0bac7cef389a11.svg +0 -1
- package/seeds/4217/icons/0x20c0000000000000000000006fd9a167923ba194.png +0 -0
- package/seeds/4217/icons/0x20c0000000000000000000007f7ba549dd0251b9.svg +0 -1
- package/seeds/4217/icons/0x20c0000000000000000000008191667423f70e67.svg +0 -5
- package/seeds/4217/icons/0x20c0000000000000000000008ee4fcff88888888.svg +0 -1
- package/seeds/4217/icons/0x20c0000000000000000000009a4a4b17e0dc6651.svg +0 -1
- package/seeds/4217/icons/0x20c000000000000000000000ab02d39df30bd17e.svg +0 -1
- package/seeds/4217/icons/0x20c000000000000000000000ae247a1130450f09.svg +0 -1
- package/seeds/4217/icons/0x20c000000000000000000000aeed2ec36a54d0e5.svg +0 -1
- package/seeds/4217/icons/0x20c000000000000000000000b9537d11c60e8b50.svg +0 -1
- package/seeds/4217/icons/0x20c000000000000000000000bd95bfb69fbe6ce3.svg +0 -1
- package/seeds/4217/icons/0x20c000000000000000000000c412ec89d0c08be5.svg +0 -1
- package/seeds/4217/icons/0x20c000000000000000000000f047dd7018e50367.png +0 -0
- package/seeds/4217/verified-tokens.json +0 -177
- package/seeds/42431/icons/0x20c0000000000000000000000000000000000000.svg +0 -25
- package/seeds/42431/icons/0x20c0000000000000000000000000000000000001.svg +0 -1
- package/seeds/42431/icons/0x20c0000000000000000000000000000000000002.svg +0 -1
- package/seeds/42431/icons/0x20c0000000000000000000000000000000000003.svg +0 -1
- package/seeds/42431/icons/0x20c0000000000000000000009e8d7eb59b783726.svg +0 -1
- package/seeds/42431/icons/0x20c000000000000000000000d72572838bbee59c.svg +0 -1
- package/seeds/42431/verified-tokens.json +0 -44
- package/seeds/openrpc/README.md +0 -27
- package/seeds/openrpc/execution-apis.json +0 -8989
- package/src/ApiKeySource.test-d.ts +0 -11
- package/src/ApiKeySource.test.ts +0 -295
- package/src/ApiKeySource.ts +0 -303
- /package/src/{internal/OpenApi.fonts.ts → apps/docs/fonts.ts} +0 -0
- /package/src/{internal/OpenApi.logo.ts → apps/docs/logo.ts} +0 -0
package/src/Client.test-d.ts
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import { Client } from '
|
|
1
|
+
import { Client } from 'tapimo'
|
|
2
2
|
import type * as z from 'zod/mini'
|
|
3
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
|
|
11
|
-
import * as
|
|
12
|
-
import * as
|
|
13
|
-
import * as
|
|
14
|
-
import * as
|
|
15
|
-
import * as
|
|
16
|
-
import * as
|
|
4
|
+
import * as Activities from './apps/data/routes/activities.js'
|
|
5
|
+
import * as Balances from './apps/data/routes/balances.js'
|
|
6
|
+
import * as Blocks from './apps/data/routes/blocks.js'
|
|
7
|
+
import * as Exchanges from './apps/data/routes/exchanges.js'
|
|
8
|
+
import * as FeeAmm from './apps/data/routes/fee-amm.js'
|
|
9
|
+
import * as Indexer from './apps/data/routes/indexer.js'
|
|
10
|
+
import * as Me from './apps/platform/routes/me.js'
|
|
11
|
+
import * as Orgs from './apps/platform/routes/orgs.js'
|
|
12
|
+
import * as Receipts from './apps/data/routes/receipts.js'
|
|
13
|
+
import * as Rpc from './apps/data/routes/rpc.js'
|
|
14
|
+
import * as Tokens from './apps/data/routes/tokens.js'
|
|
15
|
+
import * as Transactions from './apps/data/routes/transactions.js'
|
|
16
|
+
import * as Transfers from './apps/data/routes/transfers.js'
|
|
17
|
+
import * as VerifiedTokens from './apps/data/routes/verified-tokens.js'
|
|
18
|
+
import * as Webhooks from './apps/data/routes/webhooks.js'
|
|
17
19
|
|
|
18
20
|
type Access400<code extends string> = code | 'api_key_malformed'
|
|
19
21
|
type PaidAccessStatus = PublicAccessStatus | 402
|
|
@@ -97,6 +99,295 @@ describe('narrows responses by status', () => {
|
|
|
97
99
|
}
|
|
98
100
|
})
|
|
99
101
|
|
|
102
|
+
test('GET /v1/me', async () => {
|
|
103
|
+
const client = Client.create()
|
|
104
|
+
const res = await client.v1.me.$get()
|
|
105
|
+
|
|
106
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 502>()
|
|
107
|
+
|
|
108
|
+
switch (res.status) {
|
|
109
|
+
case 200: {
|
|
110
|
+
const json = await res.json()
|
|
111
|
+
expectTypeOf(json.id).toEqualTypeOf<z.output<typeof Me.schema.User>['id']>()
|
|
112
|
+
void json
|
|
113
|
+
return
|
|
114
|
+
}
|
|
115
|
+
case 403: {
|
|
116
|
+
const json = await res.json()
|
|
117
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'forbidden'>()
|
|
118
|
+
void json
|
|
119
|
+
return
|
|
120
|
+
}
|
|
121
|
+
case 404: {
|
|
122
|
+
const json = await res.json()
|
|
123
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'user_not_found'>()
|
|
124
|
+
void json
|
|
125
|
+
return
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
test('POST /v1/orgs', async () => {
|
|
131
|
+
const client = Client.create()
|
|
132
|
+
const res = await client.v1.orgs.$post({ json: { name: 'Acme' } })
|
|
133
|
+
|
|
134
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 502>()
|
|
135
|
+
|
|
136
|
+
switch (res.status) {
|
|
137
|
+
case 200: {
|
|
138
|
+
const json = await res.json()
|
|
139
|
+
expectTypeOf(json.id).toEqualTypeOf<z.output<typeof Orgs.schema.Organization>['id']>()
|
|
140
|
+
void json
|
|
141
|
+
return
|
|
142
|
+
}
|
|
143
|
+
case 403: {
|
|
144
|
+
const json = await res.json()
|
|
145
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'forbidden'>()
|
|
146
|
+
void json
|
|
147
|
+
return
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
test('GET /v1/orgs/:orgId', async () => {
|
|
153
|
+
const client = Client.create()
|
|
154
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].$get({
|
|
155
|
+
param: { orgId: 'org_test' },
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404>()
|
|
159
|
+
|
|
160
|
+
switch (res.status) {
|
|
161
|
+
case 200: {
|
|
162
|
+
const json = await res.json()
|
|
163
|
+
expectTypeOf(json.name).toEqualTypeOf<string>()
|
|
164
|
+
void json
|
|
165
|
+
return
|
|
166
|
+
}
|
|
167
|
+
case 404: {
|
|
168
|
+
const json = await res.json()
|
|
169
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'organization_not_found'>()
|
|
170
|
+
void json
|
|
171
|
+
return
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
test('DELETE /v1/orgs/:orgId', async () => {
|
|
177
|
+
const client = Client.create()
|
|
178
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].$delete({
|
|
179
|
+
param: { orgId: 'org_test' },
|
|
180
|
+
})
|
|
181
|
+
|
|
182
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 502>()
|
|
183
|
+
|
|
184
|
+
switch (res.status) {
|
|
185
|
+
case 200: {
|
|
186
|
+
const json = await res.json()
|
|
187
|
+
expectTypeOf(json.id).toEqualTypeOf<string>()
|
|
188
|
+
void json
|
|
189
|
+
return
|
|
190
|
+
}
|
|
191
|
+
case 404: {
|
|
192
|
+
const json = await res.json()
|
|
193
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'organization_not_found'>()
|
|
194
|
+
void json
|
|
195
|
+
return
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
})
|
|
199
|
+
|
|
200
|
+
test('GET /v1/orgs/:orgId/projects/:projectId', async () => {
|
|
201
|
+
const client = Client.create()
|
|
202
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].projects[
|
|
203
|
+
':projectId{prj_[A-Za-z0-9_-]+}'
|
|
204
|
+
].$get({ param: { orgId: 'org_test', projectId: 'prj_test' } })
|
|
205
|
+
|
|
206
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404>()
|
|
207
|
+
|
|
208
|
+
switch (res.status) {
|
|
209
|
+
case 200: {
|
|
210
|
+
const json = await res.json()
|
|
211
|
+
expectTypeOf(json.environments[0]).toEqualTypeOf<'production' | 'sandbox' | undefined>()
|
|
212
|
+
void json
|
|
213
|
+
return
|
|
214
|
+
}
|
|
215
|
+
case 404: {
|
|
216
|
+
const json = await res.json()
|
|
217
|
+
expectTypeOf(json.error.code).toEqualTypeOf<
|
|
218
|
+
'organization_not_found' | 'project_not_found'
|
|
219
|
+
>()
|
|
220
|
+
void json
|
|
221
|
+
return
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
})
|
|
225
|
+
|
|
226
|
+
test('DELETE /v1/orgs/:orgId/projects/:projectId', async () => {
|
|
227
|
+
const client = Client.create()
|
|
228
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].projects[
|
|
229
|
+
':projectId{prj_[A-Za-z0-9_-]+}'
|
|
230
|
+
].$delete({ param: { orgId: 'org_test', projectId: 'prj_test' } })
|
|
231
|
+
|
|
232
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 502>()
|
|
233
|
+
|
|
234
|
+
switch (res.status) {
|
|
235
|
+
case 200: {
|
|
236
|
+
const json = await res.json()
|
|
237
|
+
expectTypeOf(json.id).toEqualTypeOf<string>()
|
|
238
|
+
void json
|
|
239
|
+
return
|
|
240
|
+
}
|
|
241
|
+
case 404: {
|
|
242
|
+
const json = await res.json()
|
|
243
|
+
expectTypeOf(json.error.code).toEqualTypeOf<
|
|
244
|
+
'organization_not_found' | 'project_not_found'
|
|
245
|
+
>()
|
|
246
|
+
void json
|
|
247
|
+
return
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
})
|
|
251
|
+
|
|
252
|
+
test('POST /v1/orgs/:orgId/projects/:projectId/api-keys', async () => {
|
|
253
|
+
const client = Client.create()
|
|
254
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].projects[
|
|
255
|
+
':projectId{prj_[A-Za-z0-9_-]+}'
|
|
256
|
+
]['api-keys'].$post({
|
|
257
|
+
json: { scopes: ['data:read'] },
|
|
258
|
+
param: { orgId: 'org_test', projectId: 'prj_test' },
|
|
259
|
+
})
|
|
260
|
+
|
|
261
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 502>()
|
|
262
|
+
|
|
263
|
+
switch (res.status) {
|
|
264
|
+
case 200: {
|
|
265
|
+
const json = await res.json()
|
|
266
|
+
expectTypeOf(json.token).toEqualTypeOf<string>()
|
|
267
|
+
expectTypeOf(json.id).toEqualTypeOf<string>()
|
|
268
|
+
void json
|
|
269
|
+
return
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
})
|
|
273
|
+
|
|
274
|
+
test('DELETE /v1/orgs/:orgId/projects/:projectId/api-keys/:keyId', async () => {
|
|
275
|
+
const client = Client.create()
|
|
276
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].projects[
|
|
277
|
+
':projectId{prj_[A-Za-z0-9_-]+}'
|
|
278
|
+
]['api-keys'][':keyId{key_[A-Za-z0-9_-]+}'].$delete({
|
|
279
|
+
param: { keyId: 'key_test', orgId: 'org_test', projectId: 'prj_test' },
|
|
280
|
+
})
|
|
281
|
+
|
|
282
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 502>()
|
|
283
|
+
|
|
284
|
+
switch (res.status) {
|
|
285
|
+
case 404: {
|
|
286
|
+
const json = await res.json()
|
|
287
|
+
expectTypeOf(json.error.code).toEqualTypeOf<
|
|
288
|
+
| 'api_key_not_found'
|
|
289
|
+
| 'api_keys_not_enabled'
|
|
290
|
+
| 'organization_not_found'
|
|
291
|
+
| 'project_not_found'
|
|
292
|
+
>()
|
|
293
|
+
void json
|
|
294
|
+
return
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
})
|
|
298
|
+
|
|
299
|
+
test('GET /v1/orgs/:orgId/members', async () => {
|
|
300
|
+
const client = Client.create()
|
|
301
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].members.$get({
|
|
302
|
+
param: { orgId: 'org_test' },
|
|
303
|
+
})
|
|
304
|
+
|
|
305
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 502>()
|
|
306
|
+
|
|
307
|
+
switch (res.status) {
|
|
308
|
+
case 200: {
|
|
309
|
+
const json = await res.json()
|
|
310
|
+
expectTypeOf(json.data[0]!.role).toEqualTypeOf<'admin' | 'member' | 'owner'>()
|
|
311
|
+
void json
|
|
312
|
+
return
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
})
|
|
316
|
+
|
|
317
|
+
test('PATCH /v1/orgs/:orgId/members/:userId', async () => {
|
|
318
|
+
const client = Client.create()
|
|
319
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].members[
|
|
320
|
+
':userId{usr_[A-Za-z0-9_-]+}'
|
|
321
|
+
].$patch({ json: { role: 'admin' }, param: { orgId: 'org_test', userId: 'usr_test' } })
|
|
322
|
+
|
|
323
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 409 | 502>()
|
|
324
|
+
|
|
325
|
+
switch (res.status) {
|
|
326
|
+
case 409: {
|
|
327
|
+
const json = await res.json()
|
|
328
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'last_owner'>()
|
|
329
|
+
void json
|
|
330
|
+
return
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
})
|
|
334
|
+
|
|
335
|
+
test('POST /v1/invitations/:invitationId/accept', async () => {
|
|
336
|
+
const client = Client.create()
|
|
337
|
+
const res = await client.v1.invitations[':invitationId{inv_[A-Za-z0-9_-]+}'].accept.$post({
|
|
338
|
+
param: { invitationId: 'inv_test' },
|
|
339
|
+
})
|
|
340
|
+
|
|
341
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 502>()
|
|
342
|
+
|
|
343
|
+
switch (res.status) {
|
|
344
|
+
case 200: {
|
|
345
|
+
const json = await res.json()
|
|
346
|
+
expectTypeOf(json.role).toEqualTypeOf<'admin' | 'member' | 'owner'>()
|
|
347
|
+
void json
|
|
348
|
+
return
|
|
349
|
+
}
|
|
350
|
+
case 404: {
|
|
351
|
+
const json = await res.json()
|
|
352
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'invitation_not_found'>()
|
|
353
|
+
void json
|
|
354
|
+
return
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
})
|
|
358
|
+
|
|
359
|
+
test('GET /v1/orgs', async () => {
|
|
360
|
+
const client = Client.create()
|
|
361
|
+
const res = await client.v1.orgs.$get()
|
|
362
|
+
|
|
363
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 502>()
|
|
364
|
+
|
|
365
|
+
switch (res.status) {
|
|
366
|
+
case 200: {
|
|
367
|
+
const json = await res.json()
|
|
368
|
+
expectTypeOf(json.data[0]!.id).toEqualTypeOf<
|
|
369
|
+
z.output<typeof Orgs.schema.listOrganizations.Response>['data'][number]['id']
|
|
370
|
+
>()
|
|
371
|
+
void json
|
|
372
|
+
return
|
|
373
|
+
}
|
|
374
|
+
case 403: {
|
|
375
|
+
const json = await res.json()
|
|
376
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'forbidden'>()
|
|
377
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
378
|
+
void json
|
|
379
|
+
return
|
|
380
|
+
}
|
|
381
|
+
case 502: {
|
|
382
|
+
const json = await res.json()
|
|
383
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
384
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
385
|
+
void json
|
|
386
|
+
return
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
})
|
|
390
|
+
|
|
100
391
|
test('GET /v1/blocks/:block', async () => {
|
|
101
392
|
const client = Client.create()
|
|
102
393
|
const res = await client.v1.blocks[':block'].$get({ param: { block: '1' } })
|
|
@@ -1176,7 +1467,7 @@ describe('narrows responses by status', () => {
|
|
|
1176
1467
|
|
|
1177
1468
|
test('POST /rpc/:chain', async () => {
|
|
1178
1469
|
const client = Client.create()
|
|
1179
|
-
const res = await client.rpc[':chain{mainnet|testnet|[0-9]+}?'].$post({
|
|
1470
|
+
const res = await client.rpc[':chain{(mainnet|testnet|[0-9]+)}?'].$post({
|
|
1180
1471
|
param: { chain: undefined },
|
|
1181
1472
|
})
|
|
1182
1473
|
|
|
@@ -1208,7 +1499,7 @@ describe('narrows responses by status', () => {
|
|
|
1208
1499
|
|
|
1209
1500
|
test('POST /rpc/:chain testnet shortcut', async () => {
|
|
1210
1501
|
const client = Client.create()
|
|
1211
|
-
const res = await client.rpc[':chain{mainnet|testnet|[0-9]+}?'].$post({
|
|
1502
|
+
const res = await client.rpc[':chain{(mainnet|testnet|[0-9]+)}?'].$post({
|
|
1212
1503
|
param: { chain: 'testnet' },
|
|
1213
1504
|
})
|
|
1214
1505
|
|
package/src/Handler.ts
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { Hono } from 'hono'
|
|
2
|
+
import type { ExtractSchema, MergeSchemaPath, Schema } from 'hono/types'
|
|
3
|
+
|
|
4
|
+
import type { UnionToIntersection } from './handlers/internal/types.js'
|
|
5
|
+
import * as RequestListener from './handlers/internal/requestListener.js'
|
|
6
|
+
|
|
7
|
+
export { relay } from './handlers/relay.js'
|
|
8
|
+
export * as Multisig from './handlers/internal/multisig.js'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A request handler. Generic over the underlying Hono app shape so chained
|
|
12
|
+
* route definitions (`.post`, `.get`, …) can flow their type information
|
|
13
|
+
* through to consumers — most notably for Hono's typed RPC client
|
|
14
|
+
* (`hc<typeof handler>`).
|
|
15
|
+
*/
|
|
16
|
+
export type Handler<app extends Hono<any, any, any> = Hono> = app & {
|
|
17
|
+
listener: (req: any, res: any) => void
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Merges the route schemas of every sub-handler into a single Hono schema,
|
|
22
|
+
* prefixing each route key with `path`. Used by `compose()` to preserve
|
|
23
|
+
* typed routes for Hono's RPC client (`hc`).
|
|
24
|
+
*/
|
|
25
|
+
export type ComposedSchema<subs extends readonly unknown[], path extends string> =
|
|
26
|
+
UnionToIntersection<
|
|
27
|
+
subs[number] extends infer sub
|
|
28
|
+
? sub extends unknown
|
|
29
|
+
? MergeSchemaPath<Extract<ExtractSchema<sub>, Schema>, path>
|
|
30
|
+
: never
|
|
31
|
+
: never
|
|
32
|
+
> extends infer schema extends Schema
|
|
33
|
+
? schema
|
|
34
|
+
: never
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Mounts each sub-handler onto a fresh Hono app at `path` (default `/`) and
|
|
38
|
+
* returns a single composed handler. Routes are dispatched by Hono's trie
|
|
39
|
+
* — a deterministic match per path — instead of the older "try each handler
|
|
40
|
+
* in order until one returns non-404" loop.
|
|
41
|
+
*
|
|
42
|
+
* The returned handler preserves each sub-handler's route schema so the
|
|
43
|
+
* composed app stays usable from Hono's typed RPC client:
|
|
44
|
+
*
|
|
45
|
+
* ```ts
|
|
46
|
+
* import { hc } from 'hono/client'
|
|
47
|
+
*
|
|
48
|
+
* const app = Handler.compose(
|
|
49
|
+
* [Handler.exchange(), Handler.codeAuth({ store })],
|
|
50
|
+
* { path: '/api' },
|
|
51
|
+
* )
|
|
52
|
+
* type App = typeof app
|
|
53
|
+
*
|
|
54
|
+
* const client = hc<App>('https://wallet.example.com')
|
|
55
|
+
* await client.api.exchange.quote.$post({ json: { ... } }) // typed
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export function compose<const subs extends readonly Handler[], const path extends string = '/'>(
|
|
59
|
+
handlers: subs,
|
|
60
|
+
options: compose.Options & { path?: path } = {},
|
|
61
|
+
): Handler<Hono<{}, ComposedSchema<subs, path>, '/'>> {
|
|
62
|
+
const mountPath = (options.path ?? '/') as path
|
|
63
|
+
|
|
64
|
+
const app = from(options) as unknown as Hono
|
|
65
|
+
for (const sub of handlers) app.route(mountPath, sub)
|
|
66
|
+
app.notFound(() => new Response('Not Found', { status: 404 }))
|
|
67
|
+
|
|
68
|
+
return app as never
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export declare namespace compose {
|
|
72
|
+
export type Options = from.Options & {
|
|
73
|
+
/** The path to use for the handler. */
|
|
74
|
+
path?: string | undefined
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Instantiates a new request handler.
|
|
80
|
+
*
|
|
81
|
+
* @param options - constructor options
|
|
82
|
+
* @returns Handler instance
|
|
83
|
+
*/
|
|
84
|
+
export function from(options: from.Options = {}): Handler {
|
|
85
|
+
const corsHeaders = corsToHeaders(options.cors)
|
|
86
|
+
const mergedHeaders = new Headers(corsHeaders)
|
|
87
|
+
for (const [key, value] of normalizeHeaders(options.headers).entries())
|
|
88
|
+
mergedHeaders.set(key, value)
|
|
89
|
+
|
|
90
|
+
const app = new Hono()
|
|
91
|
+
|
|
92
|
+
app.use(async (c, next) => {
|
|
93
|
+
if (c.req.method === 'OPTIONS') return new Response(null, { headers: mergedHeaders })
|
|
94
|
+
await next()
|
|
95
|
+
for (const [key, value] of mergedHeaders.entries()) c.res.headers.set(key, value)
|
|
96
|
+
return undefined
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
return Object.assign(app, {
|
|
100
|
+
listener: RequestListener.fromFetchHandler((request) => app.fetch(request)),
|
|
101
|
+
}) as never
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export declare namespace from {
|
|
105
|
+
export type Options = {
|
|
106
|
+
/**
|
|
107
|
+
* CORS configuration.
|
|
108
|
+
* - `true` (default): Allow all origins with default methods/headers
|
|
109
|
+
* - `false`: Disable CORS headers
|
|
110
|
+
* - Object: Custom CORS configuration
|
|
111
|
+
*/
|
|
112
|
+
cors?: boolean | Cors | undefined
|
|
113
|
+
/** Headers to add to the response. */
|
|
114
|
+
headers?: Headers | Record<string, string> | undefined
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export type Cors = {
|
|
118
|
+
/** Allowed origins. Defaults to `'*'`. */
|
|
119
|
+
origin?: string | string[] | undefined
|
|
120
|
+
/** Allowed methods. Defaults to `'GET, POST, PUT, DELETE, OPTIONS'`. */
|
|
121
|
+
methods?: string | undefined
|
|
122
|
+
/** Allowed headers. Defaults to `'Content-Type'`. */
|
|
123
|
+
headers?: string | undefined
|
|
124
|
+
/** Whether to allow credentials. */
|
|
125
|
+
credentials?: boolean | undefined
|
|
126
|
+
/** Headers to expose to the browser. */
|
|
127
|
+
exposeHeaders?: string | undefined
|
|
128
|
+
/** Max age for preflight cache in seconds. */
|
|
129
|
+
maxAge?: number | undefined
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function normalizeHeaders(headers?: Headers | Record<string, string>): Headers {
|
|
134
|
+
if (!headers) return new Headers()
|
|
135
|
+
if (headers instanceof Headers) return headers
|
|
136
|
+
return new Headers(headers)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function corsToHeaders(cors?: boolean | from.Cors): Headers {
|
|
140
|
+
if (cors === false) return new Headers()
|
|
141
|
+
|
|
142
|
+
const config = cors === true || cors === undefined ? {} : cors
|
|
143
|
+
|
|
144
|
+
const headers = new Headers()
|
|
145
|
+
const origin = Array.isArray(config.origin) ? config.origin.join(', ') : (config.origin ?? '*')
|
|
146
|
+
headers.set('Access-Control-Allow-Origin', origin)
|
|
147
|
+
headers.set('Access-Control-Allow-Methods', config.methods ?? 'GET, POST, PUT, DELETE, OPTIONS')
|
|
148
|
+
headers.set('Access-Control-Allow-Headers', config.headers ?? 'Content-Type')
|
|
149
|
+
if (config.credentials) headers.set('Access-Control-Allow-Credentials', 'true')
|
|
150
|
+
if (config.exposeHeaders) headers.set('Access-Control-Expose-Headers', config.exposeHeaders)
|
|
151
|
+
if (config.maxAge !== undefined) headers.set('Access-Control-Max-Age', String(config.maxAge))
|
|
152
|
+
|
|
153
|
+
return headers
|
|
154
|
+
}
|
package/src/Scope.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The issuable API-key scope vocabulary: the single source of truth for the
|
|
3
|
-
* `/scopes` catalog, for key minting (`
|
|
4
|
-
* required by route policies (`Auth.policy`). Exposing it publicly lets
|
|
5
|
-
* tooling
|
|
6
|
-
* server enforces.
|
|
3
|
+
* `/scopes` catalog, for key minting (`ApiKeys.mint`), and for the scopes
|
|
4
|
+
* required by route policies (`Auth.policy`). Exposing it publicly lets super
|
|
5
|
+
* admin tooling validate scopes against the same list the server enforces.
|
|
7
6
|
*/
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -36,6 +35,14 @@ export const catalog = [
|
|
|
36
35
|
description: 'Run ad-hoc queries against the raw indexer passthrough.',
|
|
37
36
|
scope: 'indexer:query',
|
|
38
37
|
},
|
|
38
|
+
{
|
|
39
|
+
description: 'Fill and submit transactions through the relay.',
|
|
40
|
+
scope: 'rpc-relay:read',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
description: 'Sponsor transaction fees through the relay as the managed fee payer.',
|
|
44
|
+
scope: 'rpc-relay:sponsor',
|
|
45
|
+
},
|
|
39
46
|
{
|
|
40
47
|
description: 'Read webhook subscriptions.',
|
|
41
48
|
scope: 'webhooks:read',
|
|
@@ -48,3 +55,9 @@ export const catalog = [
|
|
|
48
55
|
|
|
49
56
|
/** Issuable API-key scope identifier — the union of every {@link catalog} entry. */
|
|
50
57
|
export type Id = (typeof catalog)[number]['scope']
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Scopes a session may self-mint through the developer platform. Empty: every
|
|
61
|
+
* scope requires super admin issuance.
|
|
62
|
+
*/
|
|
63
|
+
export const selfServe: readonly Id[] = []
|
package/src/Webhooks.test.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Webhooks } from 'tapimo'
|
|
2
|
+
import * as TestApp from '../test/App.js'
|
|
2
3
|
|
|
3
4
|
describe('createPoller', () => {
|
|
4
5
|
/** Decodes the opaque `(block, index)` keyset cursor the poller stores. */
|
|
@@ -8,9 +9,9 @@ describe('createPoller', () => {
|
|
|
8
9
|
return JSON.parse(json) as [number, number]
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
test('binds a
|
|
12
|
-
const
|
|
13
|
-
const subscription = await Webhooks.createSubscription(
|
|
12
|
+
test('binds a database and runs a tick at an injected head', async () => {
|
|
13
|
+
const db = TestApp.database()
|
|
14
|
+
const subscription = await Webhooks.createSubscription(db, {
|
|
14
15
|
chainId: 42431,
|
|
15
16
|
destination: { type: 'url', url: 'https://hooks.example.com/x' },
|
|
16
17
|
eventType: 'token:transfer',
|
|
@@ -18,12 +19,12 @@ describe('createPoller', () => {
|
|
|
18
19
|
})
|
|
19
20
|
|
|
20
21
|
const poller = Webhooks.createPoller({
|
|
22
|
+
db,
|
|
21
23
|
defaultChainId: 42431,
|
|
22
|
-
webhook: { store },
|
|
23
24
|
})
|
|
24
25
|
|
|
25
26
|
// A brand-new subscription anchors at the confirmed head on its first tick
|
|
26
|
-
// (no backfill), so this exercises the createPoller → poll wiring (
|
|
27
|
+
// (no backfill), so this exercises the createPoller → poll wiring (db
|
|
27
28
|
// binding, default chain id, injected head, result shape) without touching
|
|
28
29
|
// TIDX. Detailed poll/getIndexedHead behavior lives in
|
|
29
30
|
// src/apps/webhooks.test.ts.
|
|
@@ -39,7 +40,7 @@ describe('createPoller', () => {
|
|
|
39
40
|
"subscriptions": 1,
|
|
40
41
|
}
|
|
41
42
|
`)
|
|
42
|
-
expect(decodeCursor(await Webhooks.getCursor(
|
|
43
|
+
expect(decodeCursor(await Webhooks.getCursor(db, subscription.id))).toMatchInlineSnapshot(`
|
|
43
44
|
[
|
|
44
45
|
198,
|
|
45
46
|
2147483647,
|
package/src/Webhooks.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import * as AppWebhooks from './apps/webhooks.js'
|
|
1
|
+
import * as AppWebhooks from './apps/data/routes/webhooks.js'
|
|
2
|
+
import * as Db from './db/Db.js'
|
|
2
3
|
import * as MetricSink from './internal/MetricSink.js'
|
|
3
|
-
import
|
|
4
|
+
import * as Store from './internal/Store.js'
|
|
4
5
|
import type * as Metrics from './Metrics.js'
|
|
5
6
|
import * as Tidx from './internal/Tidx.js'
|
|
6
7
|
import * as Viem from './internal/Viem.js'
|
|
@@ -15,7 +16,7 @@ export * from './internal/Webhooks.js'
|
|
|
15
16
|
// type delivery bodies: `Webhooks.schema.Envelope` (a discriminated union on
|
|
16
17
|
// `type`), plus the per-event `TransferEvent` / `TransactionEvent` / `PingEvent`
|
|
17
18
|
// payloads. Infer a type with `z.infer<typeof Webhooks.schema.Envelope>`.
|
|
18
|
-
export { eventTypes, schema } from './apps/webhooks.js'
|
|
19
|
+
export { eventTypes, schema } from './apps/data/routes/webhooks.js'
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Builds a scheduled webhook poller bound to a state store and chain config.
|
|
@@ -35,7 +36,9 @@ export { eventTypes, schema } from './apps/webhooks.js'
|
|
|
35
36
|
* request state.
|
|
36
37
|
*/
|
|
37
38
|
export function createPoller(options: createPoller.Options): createPoller.Poller {
|
|
38
|
-
|
|
39
|
+
// Persistent memoize cache for token metadata, shared across ticks (the
|
|
40
|
+
// webhook state store used to double-duty as this cache).
|
|
41
|
+
const cache = Store.memory()
|
|
39
42
|
const getTidx = options.tidx
|
|
40
43
|
? Tidx.createGetClient({ defaultChainId: options.defaultChainId, tidx: options.tidx })
|
|
41
44
|
: undefined
|
|
@@ -80,9 +83,13 @@ export function createPoller(options: createPoller.Options): createPoller.Poller
|
|
|
80
83
|
try {
|
|
81
84
|
const result = await AppWebhooks.poll({
|
|
82
85
|
batchSize: input.batchSize ?? options.batchSize,
|
|
86
|
+
cache,
|
|
83
87
|
chainId,
|
|
84
88
|
client: getClient(chainId),
|
|
85
89
|
confirmations: input.confirmations ?? options.confirmations,
|
|
90
|
+
// Resolve per tick so Workers factories build a fresh
|
|
91
|
+
// Hyperdrive-pooled connection each run.
|
|
92
|
+
db: Db.get(options.db),
|
|
86
93
|
dispatch,
|
|
87
94
|
eventTypes: input.eventTypes ?? options.eventTypes,
|
|
88
95
|
...(input.headBlockNumber === undefined
|
|
@@ -90,7 +97,6 @@ export function createPoller(options: createPoller.Options): createPoller.Poller
|
|
|
90
97
|
: { headBlockNumber: input.headBlockNumber }),
|
|
91
98
|
maxBlocks: input.maxBlocks ?? options.maxBlocks,
|
|
92
99
|
now: input.now ?? options.now,
|
|
93
|
-
store,
|
|
94
100
|
...(getTidx ? { tidx: getTidx(chainId) } : {}),
|
|
95
101
|
})
|
|
96
102
|
metrics?.record({
|
|
@@ -144,6 +150,8 @@ export declare namespace createPoller {
|
|
|
144
150
|
|
|
145
151
|
/** Options for {@link createPoller}. */
|
|
146
152
|
type Options = Defaults & {
|
|
153
|
+
/** Database holding subscriptions + cursors, or a factory resolved per tick (Workers/Hyperdrive). */
|
|
154
|
+
db: Db.Source
|
|
147
155
|
/** Tempo chain id polled when a tick omits one. */
|
|
148
156
|
defaultChainId?: Viem.ChainId | undefined
|
|
149
157
|
/** Metrics backend; emits `webhook:tick` per tick and `webhook:enqueue` per dispatch. */
|
|
@@ -152,8 +160,6 @@ export declare namespace createPoller {
|
|
|
152
160
|
rpc?: Viem.getClient.Rpc | undefined
|
|
153
161
|
/** TIDX query client options for the legacy `token:transfer` type. */
|
|
154
162
|
tidx?: Tidx.getClient.Tidx | undefined
|
|
155
|
-
/** Webhook state store (subscriptions + cursors). */
|
|
156
|
-
webhook: { store: Store.State }
|
|
157
163
|
}
|
|
158
164
|
|
|
159
165
|
/** Per-tick overrides; falls back to the {@link Options} defaults. */
|
package/src/admin/Access.ts
CHANGED
|
@@ -29,10 +29,8 @@ const cookieName = 'CF_Authorization'
|
|
|
29
29
|
* ```ts
|
|
30
30
|
* import { App, Access } from 'tapimo/admin'
|
|
31
31
|
*
|
|
32
|
-
* const source = {} as App.create.Options['apiKey']['source']
|
|
33
|
-
*
|
|
34
32
|
* App.create({
|
|
35
|
-
*
|
|
33
|
+
* // ...
|
|
36
34
|
* identify: Access.cloudflareAccess({
|
|
37
35
|
* teamDomain: 'https://tempo.cloudflareaccess.com',
|
|
38
36
|
* }),
|