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
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Webhooks } from 'tapimo'
|
|
2
|
+
import * as TestApp from '../../test/App.js'
|
|
2
3
|
|
|
3
4
|
const apiKeyOwner = { orgId: 'org_1', type: 'api_key' } as const
|
|
4
5
|
const mppOwner = { payer: 'did:pkh:eip155:1:0xabc', type: 'mpp' } as const
|
|
@@ -26,8 +27,8 @@ function createInput(overrides: Partial<Webhooks.CreateInput> = {}): Webhooks.Cr
|
|
|
26
27
|
|
|
27
28
|
describe('createSubscription', () => {
|
|
28
29
|
test('persists a subscription with generated id and secret', async () => {
|
|
29
|
-
const
|
|
30
|
-
const subscription = await Webhooks.createSubscription(
|
|
30
|
+
const db = TestApp.database()
|
|
31
|
+
const subscription = await Webhooks.createSubscription(db, createInput(), { now: fixedNow })
|
|
31
32
|
|
|
32
33
|
expect(redact(subscription)).toMatchInlineSnapshot(`
|
|
33
34
|
{
|
|
@@ -51,14 +52,14 @@ describe('createSubscription', () => {
|
|
|
51
52
|
}
|
|
52
53
|
`)
|
|
53
54
|
|
|
54
|
-
const read = await Webhooks.getSubscription(
|
|
55
|
+
const read = await Webhooks.getSubscription(db, apiKeyOwner, subscription.id)
|
|
55
56
|
expect(read).toEqual(subscription)
|
|
56
57
|
})
|
|
57
58
|
|
|
58
59
|
test('sets expiresAt from ttl for MPP-owned subscriptions', async () => {
|
|
59
|
-
const
|
|
60
|
+
const db = TestApp.database()
|
|
60
61
|
const subscription = await Webhooks.createSubscription(
|
|
61
|
-
|
|
62
|
+
db,
|
|
62
63
|
createInput({ owner: mppOwner, ttl: 60_000 }),
|
|
63
64
|
{ now: fixedNow },
|
|
64
65
|
)
|
|
@@ -67,77 +68,75 @@ describe('createSubscription', () => {
|
|
|
67
68
|
})
|
|
68
69
|
|
|
69
70
|
test('enforces a per-owner cap', async () => {
|
|
70
|
-
const
|
|
71
|
-
await Webhooks.createSubscription(
|
|
71
|
+
const db = TestApp.database()
|
|
72
|
+
await Webhooks.createSubscription(db, createInput(), { maxPerOwner: 1 })
|
|
72
73
|
|
|
73
74
|
await expect(
|
|
74
|
-
Webhooks.createSubscription(
|
|
75
|
+
Webhooks.createSubscription(db, createInput(), { maxPerOwner: 1 }),
|
|
75
76
|
).rejects.toThrowErrorMatchingInlineSnapshot(
|
|
76
77
|
`[Webhooks.LimitExceededError: Webhook subscription limit reached (1).]`,
|
|
77
78
|
)
|
|
78
79
|
})
|
|
79
80
|
|
|
80
81
|
test('rejects an undeliverable URL before persisting', async () => {
|
|
81
|
-
const
|
|
82
|
+
const db = TestApp.database()
|
|
82
83
|
await expect(
|
|
83
84
|
Webhooks.createSubscription(
|
|
84
|
-
|
|
85
|
+
db,
|
|
85
86
|
createInput({ destination: { type: 'url', url: 'http://localhost/x' } }),
|
|
86
87
|
),
|
|
87
88
|
).rejects.toThrowErrorMatchingInlineSnapshot(
|
|
88
89
|
`[Webhooks.InvalidUrlError: Webhook URL rejected (protocol): http://localhost/x]`,
|
|
89
90
|
)
|
|
90
91
|
|
|
91
|
-
expect(await Webhooks.listSubscriptions(
|
|
92
|
+
expect(await Webhooks.listSubscriptions(db, apiKeyOwner)).toMatchInlineSnapshot(`[]`)
|
|
92
93
|
})
|
|
93
94
|
})
|
|
94
95
|
|
|
95
96
|
describe('owner isolation', () => {
|
|
96
97
|
test('an owner cannot read or list another owner subscriptions', async () => {
|
|
97
|
-
const
|
|
98
|
-
const mine = await Webhooks.createSubscription(
|
|
99
|
-
await Webhooks.createSubscription(
|
|
98
|
+
const db = TestApp.database()
|
|
99
|
+
const mine = await Webhooks.createSubscription(db, createInput({ owner: apiKeyOwner }))
|
|
100
|
+
await Webhooks.createSubscription(db, createInput({ owner: mppOwner }))
|
|
100
101
|
|
|
101
|
-
expect(await Webhooks.getSubscription(
|
|
102
|
+
expect(await Webhooks.getSubscription(db, mppOwner, mine.id)).toMatchInlineSnapshot(`null`)
|
|
102
103
|
|
|
103
|
-
const apiKeyList = await Webhooks.listSubscriptions(
|
|
104
|
+
const apiKeyList = await Webhooks.listSubscriptions(db, apiKeyOwner)
|
|
104
105
|
expect(apiKeyList.map((s) => s.id)).toEqual([mine.id])
|
|
105
106
|
|
|
106
|
-
const mppList = await Webhooks.listSubscriptions(
|
|
107
|
+
const mppList = await Webhooks.listSubscriptions(db, mppOwner)
|
|
107
108
|
expect(mppList).toHaveLength(1)
|
|
108
109
|
expect(mppList[0]?.id).not.toBe(mine.id)
|
|
109
110
|
})
|
|
110
111
|
|
|
111
112
|
test('an owner cannot delete another owner subscription', async () => {
|
|
112
|
-
const
|
|
113
|
-
const mine = await Webhooks.createSubscription(
|
|
113
|
+
const db = TestApp.database()
|
|
114
|
+
const mine = await Webhooks.createSubscription(db, createInput({ owner: apiKeyOwner }))
|
|
114
115
|
|
|
115
|
-
expect(await Webhooks.deleteSubscription(
|
|
116
|
-
|
|
117
|
-
)
|
|
118
|
-
expect(await Webhooks.getSubscription(store, apiKeyOwner, mine.id)).not.toBeNull()
|
|
116
|
+
expect(await Webhooks.deleteSubscription(db, mppOwner, mine.id)).toMatchInlineSnapshot(`false`)
|
|
117
|
+
expect(await Webhooks.getSubscription(db, apiKeyOwner, mine.id)).not.toBeNull()
|
|
119
118
|
})
|
|
120
119
|
})
|
|
121
120
|
|
|
122
121
|
describe('listSubscriptions', () => {
|
|
123
122
|
test('lists subscriptions newest-first with keyset paging', async () => {
|
|
124
|
-
const
|
|
123
|
+
const db = TestApp.database()
|
|
125
124
|
const created = []
|
|
126
125
|
for (const minute of [0, 1, 2]) {
|
|
127
126
|
const now = () => new Date(`2026-01-01T00:0${minute}:00.000Z`)
|
|
128
|
-
created.push(await Webhooks.createSubscription(
|
|
127
|
+
created.push(await Webhooks.createSubscription(db, createInput(), { now }))
|
|
129
128
|
}
|
|
130
129
|
const [first, second, third] = created
|
|
131
130
|
|
|
132
131
|
// Newest first: most recently created subscription leads.
|
|
133
|
-
const all = await Webhooks.listSubscriptions(
|
|
132
|
+
const all = await Webhooks.listSubscriptions(db, apiKeyOwner)
|
|
134
133
|
expect(all.map((s) => s.id)).toEqual([third!.id, second!.id, first!.id])
|
|
135
134
|
|
|
136
135
|
// First page of two, then resume after the last id for the older remainder.
|
|
137
|
-
const page = await Webhooks.listSubscriptions(
|
|
136
|
+
const page = await Webhooks.listSubscriptions(db, apiKeyOwner, { limit: 2 })
|
|
138
137
|
expect(page.map((s) => s.id)).toEqual([third!.id, second!.id])
|
|
139
138
|
|
|
140
|
-
const next = await Webhooks.listSubscriptions(
|
|
139
|
+
const next = await Webhooks.listSubscriptions(db, apiKeyOwner, {
|
|
141
140
|
cursor: page.at(-1)?.id,
|
|
142
141
|
limit: 2,
|
|
143
142
|
})
|
|
@@ -147,16 +146,16 @@ describe('listSubscriptions', () => {
|
|
|
147
146
|
|
|
148
147
|
describe('updateSubscription', () => {
|
|
149
148
|
test('patches fields and bumps updatedAt', async () => {
|
|
150
|
-
const
|
|
151
|
-
const created = await Webhooks.createSubscription(
|
|
149
|
+
const db = TestApp.database()
|
|
150
|
+
const created = await Webhooks.createSubscription(db, createInput(), { now: fixedNow })
|
|
152
151
|
|
|
153
152
|
const updated = await Webhooks.updateSubscription(
|
|
154
|
-
|
|
153
|
+
db,
|
|
155
154
|
apiKeyOwner,
|
|
156
155
|
created.id,
|
|
157
156
|
{
|
|
158
157
|
destination: { type: 'url', url: 'https://hooks.example.com/v2' },
|
|
159
|
-
filters: { token: '
|
|
158
|
+
filters: { token: `0x${'aa'.repeat(20)}` },
|
|
160
159
|
},
|
|
161
160
|
{ now: () => new Date('2026-01-02T00:00:00.000Z') },
|
|
162
161
|
)
|
|
@@ -172,7 +171,7 @@ describe('updateSubscription', () => {
|
|
|
172
171
|
"eventType": "token:transfer",
|
|
173
172
|
"failureCount": 0,
|
|
174
173
|
"filters": {
|
|
175
|
-
"token": "
|
|
174
|
+
"token": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
176
175
|
},
|
|
177
176
|
"id": "<id>",
|
|
178
177
|
"owner": {
|
|
@@ -187,18 +186,18 @@ describe('updateSubscription', () => {
|
|
|
187
186
|
})
|
|
188
187
|
|
|
189
188
|
test('returns null for a missing subscription', async () => {
|
|
190
|
-
const
|
|
189
|
+
const db = TestApp.database()
|
|
191
190
|
expect(
|
|
192
|
-
await Webhooks.updateSubscription(
|
|
191
|
+
await Webhooks.updateSubscription(db, apiKeyOwner, 'wh_missing', { status: 'paused' }),
|
|
193
192
|
).toMatchInlineSnapshot(`null`)
|
|
194
193
|
})
|
|
195
194
|
|
|
196
195
|
test('rejects a patched URL that fails validation', async () => {
|
|
197
|
-
const
|
|
198
|
-
const created = await Webhooks.createSubscription(
|
|
196
|
+
const db = TestApp.database()
|
|
197
|
+
const created = await Webhooks.createSubscription(db, createInput())
|
|
199
198
|
|
|
200
199
|
await expect(
|
|
201
|
-
Webhooks.updateSubscription(
|
|
200
|
+
Webhooks.updateSubscription(db, apiKeyOwner, created.id, {
|
|
202
201
|
destination: { type: 'url', url: 'http://10.0.0.1' },
|
|
203
202
|
}),
|
|
204
203
|
).rejects.toThrowErrorMatchingInlineSnapshot(
|
|
@@ -209,46 +208,49 @@ describe('updateSubscription', () => {
|
|
|
209
208
|
|
|
210
209
|
describe('listActive', () => {
|
|
211
210
|
test('returns only active subscriptions for a stream', async () => {
|
|
212
|
-
const
|
|
213
|
-
const a = await Webhooks.createSubscription(
|
|
214
|
-
const b = await Webhooks.createSubscription(
|
|
215
|
-
await Webhooks.createSubscription(
|
|
211
|
+
const db = TestApp.database()
|
|
212
|
+
const a = await Webhooks.createSubscription(db, createInput())
|
|
213
|
+
const b = await Webhooks.createSubscription(db, createInput({ owner: mppOwner }))
|
|
214
|
+
await Webhooks.createSubscription(db, createInput({ eventType: 'transaction:included' }))
|
|
216
215
|
|
|
217
|
-
let active = await Webhooks.listActive(
|
|
216
|
+
let active = await Webhooks.listActive(db, 4217, 'token:transfer')
|
|
218
217
|
expect(active.map((s) => s.id).sort()).toEqual([a.id, b.id].sort())
|
|
219
218
|
|
|
220
|
-
await Webhooks.updateSubscription(
|
|
221
|
-
active = await Webhooks.listActive(
|
|
219
|
+
await Webhooks.updateSubscription(db, apiKeyOwner, a.id, { status: 'paused' })
|
|
220
|
+
active = await Webhooks.listActive(db, 4217, 'token:transfer')
|
|
222
221
|
expect(active.map((s) => s.id)).toEqual([b.id])
|
|
223
222
|
})
|
|
224
223
|
|
|
225
224
|
test('drops a deleted subscription from the index', async () => {
|
|
226
|
-
const
|
|
227
|
-
const a = await Webhooks.createSubscription(
|
|
225
|
+
const db = TestApp.database()
|
|
226
|
+
const a = await Webhooks.createSubscription(db, createInput())
|
|
228
227
|
|
|
229
|
-
await Webhooks.deleteSubscription(
|
|
230
|
-
expect(await Webhooks.listActive(
|
|
228
|
+
await Webhooks.deleteSubscription(db, apiKeyOwner, a.id)
|
|
229
|
+
expect(await Webhooks.listActive(db, 4217, 'token:transfer')).toMatchInlineSnapshot(`[]`)
|
|
231
230
|
})
|
|
232
231
|
})
|
|
233
232
|
|
|
234
233
|
describe('cursors', () => {
|
|
235
234
|
test('round-trips a per-subscription cursor', async () => {
|
|
236
|
-
const
|
|
237
|
-
|
|
235
|
+
const db = TestApp.database()
|
|
236
|
+
// The cursor is a column on the subscription row, so it needs a real
|
|
237
|
+
// subscription (the old key space allowed orphan cursors).
|
|
238
|
+
const created = await Webhooks.createSubscription(db, createInput())
|
|
239
|
+
expect(await Webhooks.getCursor(db, created.id)).toMatchInlineSnapshot(`null`)
|
|
238
240
|
|
|
239
|
-
await Webhooks.setCursor(
|
|
240
|
-
expect(await Webhooks.getCursor(
|
|
241
|
+
await Webhooks.setCursor(db, created.id, '12345:7')
|
|
242
|
+
expect(await Webhooks.getCursor(db, created.id)).toMatchInlineSnapshot(`"12345:7"`)
|
|
241
243
|
})
|
|
242
244
|
})
|
|
243
245
|
|
|
244
246
|
describe('recordSuccess / recordFailure', () => {
|
|
245
247
|
test('recordSuccess resets failures and stamps lastDeliveryAt', async () => {
|
|
246
|
-
const
|
|
247
|
-
const created = await Webhooks.createSubscription(
|
|
248
|
-
const failed = await Webhooks.recordFailure(
|
|
248
|
+
const db = TestApp.database()
|
|
249
|
+
const created = await Webhooks.createSubscription(db, createInput())
|
|
250
|
+
const failed = await Webhooks.recordFailure(db, created, { now: fixedNow })
|
|
249
251
|
expect(failed.failureCount).toMatchInlineSnapshot(`1`)
|
|
250
252
|
|
|
251
|
-
const ok = await Webhooks.recordSuccess(
|
|
253
|
+
const ok = await Webhooks.recordSuccess(db, failed, { now: fixedNow })
|
|
252
254
|
expect({ failureCount: ok.failureCount, lastDeliveryAt: ok.lastDeliveryAt })
|
|
253
255
|
.toMatchInlineSnapshot(`
|
|
254
256
|
{
|
|
@@ -258,24 +260,24 @@ describe('recordSuccess / recordFailure', () => {
|
|
|
258
260
|
`)
|
|
259
261
|
|
|
260
262
|
// Persisted, not just returned.
|
|
261
|
-
const read = await Webhooks.getSubscription(
|
|
263
|
+
const read = await Webhooks.getSubscription(db, apiKeyOwner, created.id)
|
|
262
264
|
expect(read?.lastDeliveryAt).toBe('2026-01-01T00:00:00.000Z')
|
|
263
265
|
})
|
|
264
266
|
|
|
265
267
|
test('recordFailure auto-disables at the threshold and drops from the active index', async () => {
|
|
266
|
-
const
|
|
267
|
-
let subscription = await Webhooks.createSubscription(
|
|
268
|
+
const db = TestApp.database()
|
|
269
|
+
let subscription = await Webhooks.createSubscription(db, createInput())
|
|
268
270
|
|
|
269
271
|
// Below the threshold: stays active.
|
|
270
|
-
subscription = await Webhooks.recordFailure(
|
|
271
|
-
subscription = await Webhooks.recordFailure(
|
|
272
|
+
subscription = await Webhooks.recordFailure(db, subscription, { maxFailures: 3 })
|
|
273
|
+
subscription = await Webhooks.recordFailure(db, subscription, { maxFailures: 3 })
|
|
272
274
|
expect(subscription.status).toMatchInlineSnapshot(`"active"`)
|
|
273
|
-
expect((await Webhooks.listActive(
|
|
275
|
+
expect((await Webhooks.listActive(db, 4217, 'token:transfer')).map((s) => s.id)).toEqual([
|
|
274
276
|
subscription.id,
|
|
275
277
|
])
|
|
276
278
|
|
|
277
279
|
// Hitting the threshold disables it and removes it from the poller's index.
|
|
278
|
-
subscription = await Webhooks.recordFailure(
|
|
280
|
+
subscription = await Webhooks.recordFailure(db, subscription, { maxFailures: 3 })
|
|
279
281
|
expect({ failureCount: subscription.failureCount, status: subscription.status })
|
|
280
282
|
.toMatchInlineSnapshot(`
|
|
281
283
|
{
|
|
@@ -283,7 +285,7 @@ describe('recordSuccess / recordFailure', () => {
|
|
|
283
285
|
"status": "disabled",
|
|
284
286
|
}
|
|
285
287
|
`)
|
|
286
|
-
expect(await Webhooks.listActive(
|
|
288
|
+
expect(await Webhooks.listActive(db, 4217, 'token:transfer')).toMatchInlineSnapshot(`[]`)
|
|
287
289
|
})
|
|
288
290
|
})
|
|
289
291
|
|
|
@@ -372,13 +374,13 @@ describe('eventId / buildEnvelope', () => {
|
|
|
372
374
|
})
|
|
373
375
|
|
|
374
376
|
test('buildEnvelope embeds the data row and a stable id', async () => {
|
|
375
|
-
const
|
|
376
|
-
const subscription = await Webhooks.createSubscription(
|
|
377
|
+
const db = TestApp.database()
|
|
378
|
+
const subscription = await Webhooks.createSubscription(db, createInput())
|
|
377
379
|
|
|
378
380
|
const envelope = Webhooks.buildEnvelope({
|
|
379
381
|
blockNumber: 100,
|
|
380
382
|
createdAt: new Date('2026-01-01T00:00:00.000Z'),
|
|
381
|
-
data: { amount: '1', to: '
|
|
383
|
+
data: { amount: '1', to: `0x${'aa'.repeat(20)}` },
|
|
382
384
|
logIndex: 3,
|
|
383
385
|
subscription,
|
|
384
386
|
})
|
|
@@ -390,7 +392,7 @@ describe('eventId / buildEnvelope', () => {
|
|
|
390
392
|
"createdAt": "2026-01-01T00:00:00.000Z",
|
|
391
393
|
"data": {
|
|
392
394
|
"amount": "1",
|
|
393
|
-
"to": "
|
|
395
|
+
"to": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
394
396
|
},
|
|
395
397
|
"id": "evt_d7c75afd0abccdc90a391d9313762a957c7e4383cac1fae76e5de56e49c9d3f8",
|
|
396
398
|
"subscriptionId": "<subscriptionId>",
|
|
@@ -436,12 +438,12 @@ describe('delivery log', () => {
|
|
|
436
438
|
}
|
|
437
439
|
|
|
438
440
|
test('lists rows newest-first with keyset paging', async () => {
|
|
439
|
-
const
|
|
440
|
-
const created = await Webhooks.createSubscription(
|
|
441
|
-
for (const n of [1, 2, 3]) await Webhooks.recordDelivery(
|
|
441
|
+
const db = TestApp.database()
|
|
442
|
+
const created = await Webhooks.createSubscription(db, createInput())
|
|
443
|
+
for (const n of [1, 2, 3]) await Webhooks.recordDelivery(db, row(created.id, n))
|
|
442
444
|
|
|
443
445
|
// Newest first.
|
|
444
|
-
const all = await Webhooks.listDeliveries(
|
|
446
|
+
const all = await Webhooks.listDeliveries(db, created.id)
|
|
445
447
|
expect(all.map((d) => d.eventId)).toMatchInlineSnapshot(`
|
|
446
448
|
[
|
|
447
449
|
"evt_3",
|
|
@@ -451,10 +453,10 @@ describe('delivery log', () => {
|
|
|
451
453
|
`)
|
|
452
454
|
|
|
453
455
|
// First page of two, then resume after the last id for the older remainder.
|
|
454
|
-
const page = await Webhooks.listDeliveries(
|
|
456
|
+
const page = await Webhooks.listDeliveries(db, created.id, { limit: 2 })
|
|
455
457
|
expect(page.map((d) => d.eventId)).toEqual(['evt_3', 'evt_2'])
|
|
456
458
|
|
|
457
|
-
const next = await Webhooks.listDeliveries(
|
|
459
|
+
const next = await Webhooks.listDeliveries(db, created.id, {
|
|
458
460
|
cursor: page.at(-1)?.id,
|
|
459
461
|
limit: 2,
|
|
460
462
|
})
|
|
@@ -462,8 +464,8 @@ describe('delivery log', () => {
|
|
|
462
464
|
})
|
|
463
465
|
|
|
464
466
|
test('deliverAndRecord appends a succeeded row', async () => {
|
|
465
|
-
const
|
|
466
|
-
const created = await Webhooks.createSubscription(
|
|
467
|
+
const db = TestApp.database()
|
|
468
|
+
const created = await Webhooks.createSubscription(db, createInput())
|
|
467
469
|
const envelope = {
|
|
468
470
|
chainId: 4217,
|
|
469
471
|
createdAt: '2026-01-01T00:00:00.000Z',
|
|
@@ -475,9 +477,9 @@ describe('delivery log', () => {
|
|
|
475
477
|
|
|
476
478
|
const fetch = (async () =>
|
|
477
479
|
new Response(null, { status: 200 })) satisfies typeof globalThis.fetch
|
|
478
|
-
await Webhooks.deliverAndRecord(
|
|
480
|
+
await Webhooks.deliverAndRecord(db, created, envelope, { fetch, now: fixedNow })
|
|
479
481
|
|
|
480
|
-
const [delivery] = await Webhooks.listDeliveries(
|
|
482
|
+
const [delivery] = await Webhooks.listDeliveries(db, created.id)
|
|
481
483
|
expect(redactDelivery(delivery!)).toMatchInlineSnapshot(`
|
|
482
484
|
{
|
|
483
485
|
"attempt": 1,
|
|
@@ -504,8 +506,8 @@ describe('delivery log', () => {
|
|
|
504
506
|
})
|
|
505
507
|
|
|
506
508
|
test('deliverAndRecord appends a failed row with the error and status', async () => {
|
|
507
|
-
const
|
|
508
|
-
const created = await Webhooks.createSubscription(
|
|
509
|
+
const db = TestApp.database()
|
|
510
|
+
const created = await Webhooks.createSubscription(db, createInput())
|
|
509
511
|
const envelope = {
|
|
510
512
|
chainId: 4217,
|
|
511
513
|
createdAt: '2026-01-01T00:00:00.000Z',
|
|
@@ -517,9 +519,9 @@ describe('delivery log', () => {
|
|
|
517
519
|
|
|
518
520
|
const fetch = (async () =>
|
|
519
521
|
new Response(null, { status: 500 })) satisfies typeof globalThis.fetch
|
|
520
|
-
await Webhooks.deliverAndRecord(
|
|
522
|
+
await Webhooks.deliverAndRecord(db, created, envelope, { fetch, now: fixedNow })
|
|
521
523
|
|
|
522
|
-
const [delivery] = await Webhooks.listDeliveries(
|
|
524
|
+
const [delivery] = await Webhooks.listDeliveries(db, created.id)
|
|
523
525
|
expect(redactDelivery(delivery!)).toMatchInlineSnapshot(`
|
|
524
526
|
{
|
|
525
527
|
"attempt": 1,
|
|
@@ -547,36 +549,34 @@ describe('delivery log', () => {
|
|
|
547
549
|
})
|
|
548
550
|
|
|
549
551
|
test('deleteSubscription removes the delivery log', async () => {
|
|
550
|
-
const
|
|
551
|
-
const created = await Webhooks.createSubscription(
|
|
552
|
-
for (const n of [1, 2]) await Webhooks.recordDelivery(
|
|
553
|
-
expect(await Webhooks.listDeliveries(
|
|
552
|
+
const db = TestApp.database()
|
|
553
|
+
const created = await Webhooks.createSubscription(db, createInput())
|
|
554
|
+
for (const n of [1, 2]) await Webhooks.recordDelivery(db, row(created.id, n))
|
|
555
|
+
expect(await Webhooks.listDeliveries(db, created.id)).toHaveLength(2)
|
|
554
556
|
|
|
555
|
-
await Webhooks.deleteSubscription(
|
|
556
|
-
expect(await Webhooks.listDeliveries(
|
|
557
|
+
await Webhooks.deleteSubscription(db, apiKeyOwner, created.id)
|
|
558
|
+
expect(await Webhooks.listDeliveries(db, created.id)).toMatchInlineSnapshot(`[]`)
|
|
557
559
|
})
|
|
558
560
|
|
|
559
561
|
test('getDelivery loads one row by id and returns null when absent', async () => {
|
|
560
|
-
const
|
|
561
|
-
const created = await Webhooks.createSubscription(
|
|
562
|
-
await Webhooks.recordDelivery(
|
|
562
|
+
const db = TestApp.database()
|
|
563
|
+
const created = await Webhooks.createSubscription(db, createInput())
|
|
564
|
+
await Webhooks.recordDelivery(db, row(created.id, 1))
|
|
563
565
|
const id = row(created.id, 1).id
|
|
564
566
|
|
|
565
|
-
const found = await Webhooks.getDelivery(
|
|
567
|
+
const found = await Webhooks.getDelivery(db, created.id, id)
|
|
566
568
|
expect(found?.eventId).toMatchInlineSnapshot(`"evt_1"`)
|
|
567
569
|
// The persisted row carries the full envelope for replay.
|
|
568
570
|
expect(found?.envelope.id).toMatchInlineSnapshot(`"evt_1"`)
|
|
569
571
|
|
|
570
|
-
expect(await Webhooks.getDelivery(
|
|
571
|
-
`null`,
|
|
572
|
-
)
|
|
572
|
+
expect(await Webhooks.getDelivery(db, created.id, 'whd_missing')).toMatchInlineSnapshot(`null`)
|
|
573
573
|
})
|
|
574
574
|
})
|
|
575
575
|
|
|
576
576
|
describe('buildPingEnvelope', () => {
|
|
577
577
|
test('builds a synthetic ping envelope with a deterministic id from the nonce', async () => {
|
|
578
|
-
const
|
|
579
|
-
const created = await Webhooks.createSubscription(
|
|
578
|
+
const db = TestApp.database()
|
|
579
|
+
const created = await Webhooks.createSubscription(db, createInput())
|
|
580
580
|
const envelope = Webhooks.buildPingEnvelope(created, {
|
|
581
581
|
createdAt: fixedNow(),
|
|
582
582
|
nonce: 'test-nonce',
|
|
@@ -598,8 +598,8 @@ describe('buildPingEnvelope', () => {
|
|
|
598
598
|
})
|
|
599
599
|
|
|
600
600
|
test('randomizes the id per call so repeated pings are not deduped', async () => {
|
|
601
|
-
const
|
|
602
|
-
const created = await Webhooks.createSubscription(
|
|
601
|
+
const db = TestApp.database()
|
|
602
|
+
const created = await Webhooks.createSubscription(db, createInput())
|
|
603
603
|
const a = Webhooks.buildPingEnvelope(created)
|
|
604
604
|
const b = Webhooks.buildPingEnvelope(created)
|
|
605
605
|
expect(a.id).not.toBe(b.id)
|
|
@@ -608,8 +608,8 @@ describe('buildPingEnvelope', () => {
|
|
|
608
608
|
|
|
609
609
|
describe('ping', () => {
|
|
610
610
|
test('delivers, records a log row, and leaves the subscription state untouched', async () => {
|
|
611
|
-
const
|
|
612
|
-
const created = await Webhooks.createSubscription(
|
|
611
|
+
const db = TestApp.database()
|
|
612
|
+
const created = await Webhooks.createSubscription(db, createInput())
|
|
613
613
|
|
|
614
614
|
const captured: { body: string; signature: string | null } = { body: '', signature: null }
|
|
615
615
|
const fetch = (async (_url, init) => {
|
|
@@ -618,7 +618,7 @@ describe('ping', () => {
|
|
|
618
618
|
return new Response(null, { status: 200 })
|
|
619
619
|
}) satisfies typeof globalThis.fetch
|
|
620
620
|
|
|
621
|
-
const { envelope, result } = await Webhooks.ping(
|
|
621
|
+
const { envelope, result } = await Webhooks.ping(db, created, {
|
|
622
622
|
fetch,
|
|
623
623
|
nonce: 'test-nonce',
|
|
624
624
|
now: fixedNow,
|
|
@@ -637,31 +637,31 @@ describe('ping', () => {
|
|
|
637
637
|
).toBe(true)
|
|
638
638
|
|
|
639
639
|
// A ping is observable in the delivery log.
|
|
640
|
-
const [delivery] = await Webhooks.listDeliveries(
|
|
640
|
+
const [delivery] = await Webhooks.listDeliveries(db, created.id)
|
|
641
641
|
expect(delivery?.eventId).toBe(envelope.id)
|
|
642
642
|
expect(delivery?.status).toMatchInlineSnapshot(`"succeeded"`)
|
|
643
643
|
|
|
644
644
|
// A ping never mutates the subscription's failure/lifecycle state.
|
|
645
|
-
const after = await Webhooks.getSubscription(
|
|
645
|
+
const after = await Webhooks.getSubscription(db, apiKeyOwner, created.id)
|
|
646
646
|
expect(after?.failureCount).toMatchInlineSnapshot(`0`)
|
|
647
647
|
expect(after?.status).toMatchInlineSnapshot(`"active"`)
|
|
648
648
|
expect(after?.lastDeliveryAt).toMatchInlineSnapshot(`undefined`)
|
|
649
649
|
})
|
|
650
650
|
|
|
651
651
|
test('a failed ping records a failed row without disabling the subscription', async () => {
|
|
652
|
-
const
|
|
653
|
-
const created = await Webhooks.createSubscription(
|
|
652
|
+
const db = TestApp.database()
|
|
653
|
+
const created = await Webhooks.createSubscription(db, createInput())
|
|
654
654
|
|
|
655
655
|
const fetch = (async () =>
|
|
656
656
|
new Response(null, { status: 500 })) satisfies typeof globalThis.fetch
|
|
657
|
-
const { result } = await Webhooks.ping(
|
|
657
|
+
const { result } = await Webhooks.ping(db, created, { fetch, now: fixedNow })
|
|
658
658
|
|
|
659
659
|
expect(result.ok).toBe(false)
|
|
660
|
-
const [delivery] = await Webhooks.listDeliveries(
|
|
660
|
+
const [delivery] = await Webhooks.listDeliveries(db, created.id)
|
|
661
661
|
expect(delivery?.status).toMatchInlineSnapshot(`"failed"`)
|
|
662
662
|
|
|
663
663
|
// Crucially, a failed test ping must NOT count toward auto-disable.
|
|
664
|
-
const after = await Webhooks.getSubscription(
|
|
664
|
+
const after = await Webhooks.getSubscription(db, apiKeyOwner, created.id)
|
|
665
665
|
expect(after?.failureCount).toMatchInlineSnapshot(`0`)
|
|
666
666
|
expect(after?.status).toMatchInlineSnapshot(`"active"`)
|
|
667
667
|
})
|