tapimo 0.5.3 → 0.7.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/dist/App.d.ts +15830 -7220
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +9 -1
- package/dist/App.js.map +1 -1
- package/dist/Scope.d.ts +4 -0
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +5 -0
- package/dist/Scope.js.map +1 -1
- package/dist/admin/App.d.ts +1011 -412
- package/dist/admin/App.d.ts.map +1 -1
- package/dist/admin/App.js +4 -0
- package/dist/admin/App.js.map +1 -1
- package/dist/admin/apps/api-keys.d.ts +2 -1
- package/dist/admin/apps/api-keys.d.ts.map +1 -1
- package/dist/admin/apps/early-access.d.ts +148 -0
- package/dist/admin/apps/early-access.d.ts.map +1 -0
- package/dist/admin/apps/early-access.js +133 -0
- package/dist/admin/apps/early-access.js.map +1 -0
- package/dist/admin/apps/organizations.d.ts +124 -1
- package/dist/admin/apps/organizations.d.ts.map +1 -1
- package/dist/admin/apps/organizations.js +97 -6
- package/dist/admin/apps/organizations.js.map +1 -1
- package/dist/admin/apps/verified-tokens.d.ts +526 -1
- package/dist/admin/apps/verified-tokens.d.ts.map +1 -1
- package/dist/admin/apps/verified-tokens.js +214 -1
- package/dist/admin/apps/verified-tokens.js.map +1 -1
- package/dist/admin/ui.generated.d.ts +1 -1
- package/dist/admin/ui.generated.d.ts.map +1 -1
- package/dist/admin/ui.generated.js +95 -75
- package/dist/admin/ui.generated.js.map +1 -1
- package/dist/analytics/Analytics.d.ts.map +1 -1
- package/dist/analytics/Analytics.js +20 -0
- package/dist/analytics/Analytics.js.map +1 -1
- package/dist/analytics/tables/requestEvents.d.ts +18 -0
- package/dist/analytics/tables/requestEvents.d.ts.map +1 -1
- package/dist/analytics/tables/requestEvents.js +36 -7
- package/dist/analytics/tables/requestEvents.js.map +1 -1
- package/dist/apps/data/App.d.ts +6260 -4924
- package/dist/apps/data/App.d.ts.map +1 -1
- package/dist/apps/data/App.js +11 -6
- package/dist/apps/data/App.js.map +1 -1
- package/dist/apps/data/FundingQuoteProviders.d.ts +34 -1
- package/dist/apps/data/FundingQuoteProviders.d.ts.map +1 -1
- package/dist/apps/data/FundingQuoteProviders.js +194 -16
- package/dist/apps/data/FundingQuoteProviders.js.map +1 -1
- package/dist/apps/data/FxOracle.d.ts +71 -0
- package/dist/apps/data/FxOracle.d.ts.map +1 -0
- package/dist/apps/data/FxOracle.js +97 -0
- package/dist/apps/data/FxOracle.js.map +1 -0
- package/dist/apps/data/index.d.ts +1 -0
- package/dist/apps/data/index.d.ts.map +1 -1
- package/dist/apps/data/index.js +1 -0
- package/dist/apps/data/index.js.map +1 -1
- package/dist/apps/data/routes/activities.d.ts +3599 -1382
- package/dist/apps/data/routes/activities.d.ts.map +1 -1
- package/dist/apps/data/routes/activities.js +250 -88
- package/dist/apps/data/routes/activities.js.map +1 -1
- package/dist/apps/data/routes/addresses.d.ts +872 -251
- package/dist/apps/data/routes/addresses.d.ts.map +1 -1
- package/dist/apps/data/routes/addresses.js +11 -9
- package/dist/apps/data/routes/addresses.js.map +1 -1
- package/dist/apps/data/routes/balances.d.ts +77 -26
- package/dist/apps/data/routes/balances.d.ts.map +1 -1
- package/dist/apps/data/routes/balances.js +88 -45
- package/dist/apps/data/routes/balances.js.map +1 -1
- package/dist/apps/data/routes/blocks.d.ts +39 -39
- package/dist/apps/data/routes/coingecko.d.ts +54 -54
- package/dist/apps/data/routes/exchanges.d.ts +856 -105
- package/dist/apps/data/routes/exchanges.d.ts.map +1 -1
- package/dist/apps/data/routes/exchanges.js +518 -76
- package/dist/apps/data/routes/exchanges.js.map +1 -1
- package/dist/apps/data/routes/fee-amm.d.ts +81 -67
- package/dist/apps/data/routes/fee-amm.d.ts.map +1 -1
- package/dist/apps/data/routes/fee-amm.js +76 -91
- package/dist/apps/data/routes/fee-amm.js.map +1 -1
- package/dist/apps/data/routes/funding.d.ts +80 -36
- package/dist/apps/data/routes/funding.d.ts.map +1 -1
- package/dist/apps/data/routes/funding.js +65 -31
- package/dist/apps/data/routes/funding.js.map +1 -1
- package/dist/apps/data/routes/receipts.d.ts +392 -315
- package/dist/apps/data/routes/receipts.d.ts.map +1 -1
- package/dist/apps/data/routes/receipts.js +152 -77
- package/dist/apps/data/routes/receipts.js.map +1 -1
- package/dist/apps/data/routes/tokens.d.ts +167 -174
- package/dist/apps/data/routes/tokens.d.ts.map +1 -1
- package/dist/apps/data/routes/tokens.js +15 -13
- package/dist/apps/data/routes/tokens.js.map +1 -1
- package/dist/apps/data/routes/transactions.d.ts +277 -536
- package/dist/apps/data/routes/transactions.d.ts.map +1 -1
- package/dist/apps/data/routes/transactions.js +96 -77
- package/dist/apps/data/routes/transactions.js.map +1 -1
- package/dist/apps/data/routes/transfers.d.ts +157 -81
- package/dist/apps/data/routes/transfers.d.ts.map +1 -1
- package/dist/apps/data/routes/transfers.js +272 -130
- package/dist/apps/data/routes/transfers.js.map +1 -1
- package/dist/apps/data/routes/valuation.d.ts +307 -0
- package/dist/apps/data/routes/valuation.d.ts.map +1 -0
- package/dist/apps/data/routes/valuation.js +292 -0
- package/dist/apps/data/routes/valuation.js.map +1 -0
- package/dist/apps/data/routes/verified-tokens.d.ts +36 -36
- package/dist/apps/data/routes/verified-tokens.d.ts.map +1 -1
- package/dist/apps/data/routes/verified-tokens.js +7 -5
- package/dist/apps/data/routes/verified-tokens.js.map +1 -1
- package/dist/apps/data/routes/webhooks.d.ts +103 -123
- package/dist/apps/data/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/data/routes/webhooks.js +124 -25
- package/dist/apps/data/routes/webhooks.js.map +1 -1
- package/dist/apps/index.d.ts +2 -1
- package/dist/apps/index.d.ts.map +1 -1
- package/dist/apps/index.js +2 -1
- package/dist/apps/index.js.map +1 -1
- package/dist/apps/management/App.d.ts +8554 -1692
- package/dist/apps/management/App.d.ts.map +1 -1
- package/dist/apps/management/App.js +12 -1
- package/dist/apps/management/App.js.map +1 -1
- package/dist/apps/management/routes/api-keys.d.ts +7 -0
- package/dist/apps/management/routes/api-keys.d.ts.map +1 -1
- package/dist/apps/management/routes/api-keys.js +17 -3
- package/dist/apps/management/routes/api-keys.js.map +1 -1
- package/dist/apps/management/routes/billing.d.ts +157 -162
- package/dist/apps/management/routes/billing.d.ts.map +1 -1
- package/dist/apps/management/routes/billing.js +31 -23
- package/dist/apps/management/routes/billing.js.map +1 -1
- package/dist/apps/management/routes/faucet.d.ts +232 -0
- package/dist/apps/management/routes/faucet.d.ts.map +1 -0
- package/dist/apps/management/routes/faucet.js +154 -0
- package/dist/apps/management/routes/faucet.js.map +1 -0
- package/dist/apps/management/routes/invitations.d.ts +60 -60
- package/dist/apps/management/routes/invite-links.d.ts +49 -20
- package/dist/apps/management/routes/invite-links.d.ts.map +1 -1
- package/dist/apps/management/routes/invite-links.js +26 -1
- package/dist/apps/management/routes/invite-links.js.map +1 -1
- package/dist/apps/management/routes/me.d.ts +6 -6
- package/dist/apps/management/routes/members.d.ts +6 -6
- package/dist/apps/management/routes/orgs.d.ts +42 -42
- package/dist/apps/management/routes/orgs.d.ts.map +1 -1
- package/dist/apps/management/routes/orgs.js +5 -0
- package/dist/apps/management/routes/orgs.js.map +1 -1
- package/dist/apps/management/routes/projects.d.ts +44 -44
- package/dist/apps/management/routes/usage.d.ts +3 -0
- package/dist/apps/management/routes/usage.d.ts.map +1 -1
- package/dist/apps/management/routes/usage.js +4 -0
- package/dist/apps/management/routes/usage.js.map +1 -1
- package/dist/apps/management/routes/verified-token-requests.d.ts +697 -0
- package/dist/apps/management/routes/verified-token-requests.d.ts.map +1 -0
- package/dist/apps/management/routes/verified-token-requests.js +271 -0
- package/dist/apps/management/routes/verified-token-requests.js.map +1 -0
- package/dist/apps/management/routes/webhooks.d.ts +6977 -0
- package/dist/apps/management/routes/webhooks.d.ts.map +1 -0
- package/dist/apps/management/routes/webhooks.js +573 -0
- package/dist/apps/management/routes/webhooks.js.map +1 -0
- package/dist/apps/mpp/App.d.ts +363 -0
- package/dist/apps/mpp/App.d.ts.map +1 -0
- package/dist/apps/mpp/App.js +72 -0
- package/dist/apps/mpp/App.js.map +1 -0
- package/dist/apps/mpp/Mpp.d.ts +178 -0
- package/dist/apps/mpp/Mpp.d.ts.map +1 -0
- package/dist/apps/mpp/Mpp.js +183 -0
- package/dist/apps/mpp/Mpp.js.map +1 -0
- package/dist/apps/mpp/index.d.ts +3 -0
- package/dist/apps/mpp/index.d.ts.map +1 -0
- package/dist/apps/mpp/index.js +3 -0
- package/dist/apps/mpp/index.js.map +1 -0
- package/dist/apps/relay/App.d.ts.map +1 -1
- package/dist/apps/relay/App.js +56 -9
- package/dist/apps/relay/App.js.map +1 -1
- package/dist/db/Db.d.ts +6 -0
- package/dist/db/Db.d.ts.map +1 -1
- package/dist/db/Db.js +110 -0
- package/dist/db/Db.js.map +1 -1
- package/dist/db/Schema.d.ts +53 -0
- package/dist/db/Schema.d.ts.map +1 -1
- package/dist/db/Schema.js +56 -0
- package/dist/db/Schema.js.map +1 -1
- package/dist/db/tables/earlyAccess.d.ts +50 -0
- package/dist/db/tables/earlyAccess.d.ts.map +1 -0
- package/dist/db/tables/earlyAccess.js +63 -0
- package/dist/db/tables/earlyAccess.js.map +1 -0
- package/dist/db/tables/enabledBillingSources.d.ts +73 -0
- package/dist/db/tables/enabledBillingSources.d.ts.map +1 -0
- package/dist/db/tables/enabledBillingSources.js +69 -0
- package/dist/db/tables/enabledBillingSources.js.map +1 -0
- package/dist/db/tables/invitations.d.ts.map +1 -1
- package/dist/db/tables/invitations.js +3 -0
- package/dist/db/tables/invitations.js.map +1 -1
- package/dist/db/tables/inviteLinks.d.ts +10 -2
- package/dist/db/tables/inviteLinks.d.ts.map +1 -1
- package/dist/db/tables/inviteLinks.js +10 -1
- package/dist/db/tables/inviteLinks.js.map +1 -1
- package/dist/db/tables/organizations.d.ts +5 -2
- package/dist/db/tables/organizations.d.ts.map +1 -1
- package/dist/db/tables/organizations.js +13 -2
- package/dist/db/tables/organizations.js.map +1 -1
- package/dist/db/tables/sponsoredTransactions.d.ts +2 -0
- package/dist/db/tables/sponsoredTransactions.d.ts.map +1 -1
- package/dist/db/tables/sponsoredTransactions.js +2 -0
- package/dist/db/tables/sponsoredTransactions.js.map +1 -1
- package/dist/db/tables/verifiedTokenRequests.d.ts +94 -0
- package/dist/db/tables/verifiedTokenRequests.d.ts.map +1 -0
- package/dist/db/tables/verifiedTokenRequests.js +120 -0
- package/dist/db/tables/verifiedTokenRequests.js.map +1 -0
- package/dist/db/tables/webhookSubscriptions.d.ts +14 -0
- package/dist/db/tables/webhookSubscriptions.d.ts.map +1 -1
- package/dist/db/tables/webhookSubscriptions.js +16 -0
- package/dist/db/tables/webhookSubscriptions.js.map +1 -1
- package/dist/handlers/internal/utils.d.ts +1 -16
- package/dist/handlers/internal/utils.d.ts.map +1 -1
- package/dist/handlers/internal/utils.js +17 -6
- package/dist/handlers/internal/utils.js.map +1 -1
- package/dist/handlers/relay.d.ts.map +1 -1
- package/dist/handlers/relay.js +37 -5
- package/dist/handlers/relay.js.map +1 -1
- package/dist/internal/Auth.d.ts +11 -2
- package/dist/internal/Auth.d.ts.map +1 -1
- package/dist/internal/Auth.js +14 -47
- package/dist/internal/Auth.js.map +1 -1
- package/dist/internal/FundingQuotes.d.ts +147 -47
- package/dist/internal/FundingQuotes.d.ts.map +1 -1
- package/dist/internal/FundingQuotes.js +119 -33
- package/dist/internal/FundingQuotes.js.map +1 -1
- package/dist/internal/Log.d.ts +37 -5
- package/dist/internal/Log.d.ts.map +1 -1
- package/dist/internal/Log.js +52 -3
- package/dist/internal/Log.js.map +1 -1
- package/dist/internal/MetricSink.d.ts.map +1 -1
- package/dist/internal/MetricSink.js +24 -0
- package/dist/internal/MetricSink.js.map +1 -1
- package/dist/internal/OpenApi.d.ts +2 -2
- package/dist/internal/OpenApi.d.ts.map +1 -1
- package/dist/internal/OpenApi.js +3 -0
- package/dist/internal/OpenApi.js.map +1 -1
- package/dist/internal/Response.d.ts +2 -2
- package/dist/internal/Response.d.ts.map +1 -1
- package/dist/internal/Response.js +12 -4
- package/dist/internal/Response.js.map +1 -1
- package/dist/internal/Schema.d.ts +14 -5
- package/dist/internal/Schema.d.ts.map +1 -1
- package/dist/internal/Schema.js +23 -5
- package/dist/internal/Schema.js.map +1 -1
- package/dist/internal/Value.d.ts +18 -0
- package/dist/internal/Value.d.ts.map +1 -1
- package/dist/internal/Value.js +11 -1
- package/dist/internal/Value.js.map +1 -1
- package/dist/internal/VerifiedTokens.d.ts.map +1 -1
- package/dist/internal/VerifiedTokens.js +10 -1
- package/dist/internal/VerifiedTokens.js.map +1 -1
- package/dist/internal/Webhooks.d.ts +24 -3
- package/dist/internal/Webhooks.d.ts.map +1 -1
- package/dist/internal/Webhooks.js +34 -8
- package/dist/internal/Webhooks.js.map +1 -1
- package/package.json +7 -2
- package/src/App.test.ts +9 -4
- package/src/App.ts +23 -3
- package/src/Client.test-d.ts +733 -20
- package/src/Scope.ts +5 -0
- package/src/admin/App.test.ts +4 -0
- package/src/admin/App.ts +4 -0
- package/src/admin/apps/early-access.test.ts +125 -0
- package/src/admin/apps/early-access.ts +176 -0
- package/src/admin/apps/organizations.test.ts +86 -2
- package/src/admin/apps/organizations.ts +155 -31
- package/src/admin/apps/scopes.test.ts +5 -0
- package/src/admin/apps/verified-tokens.test.ts +201 -0
- package/src/admin/apps/verified-tokens.ts +532 -286
- package/src/admin/ui/plugin.ts +2 -1
- package/src/admin/ui/src/lib/early-access.ts +63 -0
- package/src/admin/ui/src/lib/organizations.test.ts +81 -1
- package/src/admin/ui/src/lib/organizations.ts +92 -0
- package/src/admin/ui/src/lib/verified-tokens.ts +79 -0
- package/src/admin/ui/src/routeTree.gen.ts +33 -2
- package/src/admin/ui/src/routes/__root.tsx +2 -1
- package/src/admin/ui/src/routes/api-keys.tsx +1 -1
- package/src/admin/ui/src/routes/early-access.tsx +162 -0
- package/src/admin/ui/src/routes/organizations_.$orgId.tsx +103 -0
- package/src/admin/ui/src/routes/verified-tokens.tsx +230 -19
- package/src/admin/ui.generated.ts +95 -94
- package/src/analytics/Analytics.test.ts +83 -0
- package/src/analytics/Analytics.ts +20 -0
- package/src/analytics/tables/requestEvents.ts +60 -7
- package/src/apps/composition.test.ts +11 -2
- package/src/apps/data/App.test.ts +1 -1
- package/src/apps/data/App.ts +22 -14
- package/src/apps/data/FundingQuoteProviders.test.ts +297 -4
- package/src/apps/data/FundingQuoteProviders.ts +255 -29
- package/src/apps/data/FxOracle.test.ts +118 -0
- package/src/apps/data/FxOracle.ts +153 -0
- package/src/apps/data/index.ts +1 -0
- package/src/apps/data/routes/activities.test.ts +177 -3
- package/src/apps/data/routes/activities.ts +441 -132
- package/src/apps/data/routes/addresses.ts +19 -9
- package/src/apps/data/routes/balances.test.ts +148 -11
- package/src/apps/data/routes/balances.ts +140 -51
- package/src/apps/data/routes/exchanges.test.ts +544 -9
- package/src/apps/data/routes/exchanges.ts +690 -103
- package/src/apps/data/routes/fee-amm.test.ts +47 -23
- package/src/apps/data/routes/fee-amm.ts +98 -119
- package/src/apps/data/routes/funding.test.ts +113 -8
- package/src/apps/data/routes/funding.ts +77 -51
- package/src/apps/data/routes/receipts.test.ts +129 -23
- package/src/apps/data/routes/receipts.ts +205 -100
- package/src/apps/data/routes/tokens.test.ts +43 -0
- package/src/apps/data/routes/tokens.ts +28 -13
- package/src/apps/data/routes/transactions.test.ts +72 -19
- package/src/apps/data/routes/transactions.ts +162 -92
- package/src/apps/data/routes/transfers.test.ts +341 -31
- package/src/apps/data/routes/transfers.ts +358 -158
- package/src/apps/data/routes/valuation.test.ts +437 -0
- package/src/apps/data/routes/valuation.ts +423 -0
- package/src/apps/data/routes/verified-tokens.ts +14 -2
- package/src/apps/data/routes/webhooks.test.ts +56 -8
- package/src/apps/data/routes/webhooks.ts +144 -27
- package/src/apps/index.ts +2 -1
- package/src/apps/management/App.ts +13 -0
- package/src/apps/management/routes/api-keys.test.ts +14 -0
- package/src/apps/management/routes/api-keys.ts +27 -3
- package/src/apps/management/routes/billing.test.ts +152 -20
- package/src/apps/management/routes/billing.ts +34 -18
- package/src/apps/management/routes/faucet.test.ts +87 -0
- package/src/apps/management/routes/faucet.ts +201 -0
- package/src/apps/management/routes/invite-links.test.ts +117 -0
- package/src/apps/management/routes/invite-links.ts +43 -1
- package/src/apps/management/routes/me.test.ts +9 -99
- package/src/apps/management/routes/orgs.test.ts +45 -2
- package/src/apps/management/routes/orgs.ts +6 -0
- package/src/apps/management/routes/scopes.test.ts +1 -0
- package/src/apps/management/routes/usage.test.ts +6 -0
- package/src/apps/management/routes/usage.ts +7 -0
- package/src/apps/management/routes/verified-token-requests.test.ts +377 -0
- package/src/apps/management/routes/verified-token-requests.ts +397 -0
- package/src/apps/management/routes/webhooks.test.ts +426 -0
- package/src/apps/management/routes/webhooks.ts +672 -0
- package/src/apps/mpp/App.ts +86 -0
- package/src/apps/mpp/Mpp.test.ts +193 -0
- package/src/apps/mpp/Mpp.ts +353 -0
- package/src/apps/mpp/index.ts +2 -0
- package/src/apps/mpp/internal/Adapter.ts +11 -0
- package/src/apps/mpp/internal/Error.ts +9 -0
- package/src/apps/mpp/internal/Idempotency.ts +7 -0
- package/src/apps/mpp/internal/Screening.ts +10 -0
- package/src/apps/relay/App.test.ts +88 -6
- package/src/apps/relay/App.ts +61 -9
- package/src/db/Db.test.ts +19 -0
- package/src/db/Db.ts +125 -0
- package/src/db/Schema.ts +68 -0
- package/src/db/tables/earlyAccess.ts +86 -0
- package/src/db/tables/enabledBillingSources.test.ts +303 -0
- package/src/db/tables/enabledBillingSources.ts +118 -0
- package/src/db/tables/invitations.ts +3 -0
- package/src/db/tables/inviteLinks.ts +22 -3
- package/src/db/tables/organizations.test.ts +103 -0
- package/src/db/tables/organizations.ts +18 -2
- package/src/db/tables/sponsoredTransactions.ts +4 -0
- package/src/db/tables/verifiedTokenRequests.test.ts +200 -0
- package/src/db/tables/verifiedTokenRequests.ts +182 -0
- package/src/db/tables/webhookSubscriptions.ts +31 -0
- package/src/handlers/internal/utils.ts +22 -6
- package/src/handlers/relay.errors.test.ts +153 -0
- package/src/handlers/relay.ts +42 -7
- package/src/internal/Auth.test.ts +3 -3
- package/src/internal/Auth.ts +15 -47
- package/src/internal/FundingQuotes.test.ts +161 -6
- package/src/internal/FundingQuotes.ts +141 -39
- package/src/internal/Log.test-d.ts +21 -0
- package/src/internal/Log.test.ts +141 -0
- package/src/internal/Log.ts +93 -6
- package/src/internal/MetricSink.test.ts +215 -0
- package/src/internal/MetricSink.ts +24 -0
- package/src/internal/OpenApi.ts +3 -0
- package/src/internal/Response.test.ts +28 -0
- package/src/internal/Response.ts +12 -4
- package/src/internal/Schema.ts +50 -5
- package/src/internal/Value.test.ts +20 -0
- package/src/internal/Value.ts +24 -1
- package/src/internal/VerifiedTokens.ts +9 -1
- package/src/internal/Webhooks.test.ts +140 -0
- package/src/internal/Webhooks.ts +53 -9
package/src/Client.test-d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Client } from 'tapimo'
|
|
2
|
+
import { Mpp as PublicMpp } from 'tapimo/mpp'
|
|
2
3
|
import type * as z from 'zod/mini'
|
|
3
4
|
|
|
4
5
|
import * as Activities from './apps/data/routes/activities.js'
|
|
@@ -6,23 +7,49 @@ import * as Balances from './apps/data/routes/balances.js'
|
|
|
6
7
|
import * as Billing from './apps/management/routes/billing.js'
|
|
7
8
|
import * as Blocks from './apps/data/routes/blocks.js'
|
|
8
9
|
import * as Exchanges from './apps/data/routes/exchanges.js'
|
|
10
|
+
import * as Faucet from './apps/management/routes/faucet.js'
|
|
9
11
|
import * as FeeAmm from './apps/data/routes/fee-amm.js'
|
|
10
12
|
import * as Funding from './apps/data/routes/funding.js'
|
|
11
13
|
import * as Indexer from './apps/data/routes/indexer.js'
|
|
14
|
+
import * as InviteLinks from './apps/management/routes/invite-links.js'
|
|
12
15
|
import * as Me from './apps/management/routes/me.js'
|
|
16
|
+
import * as Mpp from './apps/mpp/Mpp.js'
|
|
13
17
|
import * as Orgs from './apps/management/routes/orgs.js'
|
|
18
|
+
import * as OrgWebhooks from './apps/management/routes/webhooks.js'
|
|
14
19
|
import * as Receipts from './apps/data/routes/receipts.js'
|
|
15
20
|
import * as Rpc from './apps/data/routes/rpc.js'
|
|
16
21
|
import * as Scopes from './apps/management/routes/scopes.js'
|
|
17
22
|
import * as Tokens from './apps/data/routes/tokens.js'
|
|
18
23
|
import * as Transactions from './apps/data/routes/transactions.js'
|
|
19
24
|
import * as Transfers from './apps/data/routes/transfers.js'
|
|
25
|
+
import * as Valuation from './apps/data/routes/valuation.js'
|
|
26
|
+
import * as VerifiedTokenRequests from './apps/management/routes/verified-token-requests.js'
|
|
20
27
|
import * as VerifiedTokens from './apps/data/routes/verified-tokens.js'
|
|
21
28
|
import * as Webhooks from './apps/data/routes/webhooks.js'
|
|
22
29
|
|
|
23
30
|
type Access400<code extends string> = code | 'api_key_malformed'
|
|
24
31
|
type PaidAccessStatus = PublicAccessStatus | 402
|
|
25
32
|
type PublicAccessStatus = 400 | 401 | 403 | 429
|
|
33
|
+
const mppInput = {
|
|
34
|
+
challenge: {
|
|
35
|
+
description: 'Tempo API payment',
|
|
36
|
+
id: 'ch_01j3j1k2l3m4n5p6q7r8s9t0u',
|
|
37
|
+
intent: 'charge',
|
|
38
|
+
method: 'tempo',
|
|
39
|
+
opaque: 'eyJhbGciOiJIUzI1NiJ9',
|
|
40
|
+
realm: 'merchant.example',
|
|
41
|
+
request: { amount: '1', currency: 'USD' },
|
|
42
|
+
},
|
|
43
|
+
payload: { signature: `0x${'aa'.repeat(65)}`, type: 'transaction' },
|
|
44
|
+
} satisfies Mpp.RelayInput
|
|
45
|
+
/** A `Schema.TokenAmount` carrying its optional nested valuation. */
|
|
46
|
+
type ValuedTokenAmount = {
|
|
47
|
+
baseUnits: string
|
|
48
|
+
currency: string
|
|
49
|
+
decimals: number
|
|
50
|
+
formatted: string
|
|
51
|
+
valuation?: { amount: string; currency: string } | null | undefined
|
|
52
|
+
}
|
|
26
53
|
|
|
27
54
|
test('returns typed client', async () => {
|
|
28
55
|
const client = Client.create()
|
|
@@ -41,9 +68,49 @@ test('returns typed client', async () => {
|
|
|
41
68
|
|
|
42
69
|
const typed: Client.Client = client
|
|
43
70
|
void typed
|
|
71
|
+
|
|
72
|
+
expectTypeOf<PublicMpp.RelayInput>().toEqualTypeOf<Mpp.RelayInput>()
|
|
44
73
|
})
|
|
45
74
|
|
|
46
75
|
describe('narrows responses by status', () => {
|
|
76
|
+
test('POST /v1/mpp/verify', async () => {
|
|
77
|
+
const client = Client.create()
|
|
78
|
+
const res = await client.v1.mpp.verify.$post({ json: mppInput })
|
|
79
|
+
|
|
80
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 429 | 503>()
|
|
81
|
+
|
|
82
|
+
if (res.status === 200) {
|
|
83
|
+
const json = await res.json()
|
|
84
|
+
expectTypeOf(json).toEqualTypeOf<Mpp.VerifyResponse>()
|
|
85
|
+
return
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (res.status === 503) {
|
|
89
|
+
const json = await res.json()
|
|
90
|
+
expectTypeOf(json).toEqualTypeOf<Mpp.Unavailable>()
|
|
91
|
+
return
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
test('POST /v1/mpp/broadcast', async () => {
|
|
96
|
+
const client = Client.create()
|
|
97
|
+
const res = await client.v1.mpp.broadcast.$post({ json: mppInput })
|
|
98
|
+
|
|
99
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 429 | 503>()
|
|
100
|
+
|
|
101
|
+
if (res.status === 200) {
|
|
102
|
+
const json = await res.json()
|
|
103
|
+
expectTypeOf(json).toEqualTypeOf<Mpp.BroadcastResponse>()
|
|
104
|
+
return
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (res.status === 503) {
|
|
108
|
+
const json = await res.json()
|
|
109
|
+
expectTypeOf(json).toEqualTypeOf<Mpp.Unavailable>()
|
|
110
|
+
return
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
|
|
47
114
|
test('GET /v1/blocks', async () => {
|
|
48
115
|
const client = Client.create()
|
|
49
116
|
const res = await client.v1.blocks.$get()
|
|
@@ -200,24 +267,57 @@ describe('narrows responses by status', () => {
|
|
|
200
267
|
}
|
|
201
268
|
})
|
|
202
269
|
|
|
203
|
-
test('
|
|
270
|
+
test('POST /v1/orgs/:orgId/faucet', async () => {
|
|
204
271
|
const client = Client.create()
|
|
205
|
-
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].
|
|
272
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].faucet.$post({
|
|
273
|
+
json: { address: '0xbe058e1c4df8a4366a387bf595b284246a93039e' },
|
|
206
274
|
param: { orgId: 'org_test' },
|
|
207
275
|
})
|
|
208
276
|
|
|
209
|
-
expectTypeOf(res.status).toEqualTypeOf<200 |
|
|
277
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 429 | 502>()
|
|
210
278
|
|
|
211
279
|
switch (res.status) {
|
|
212
280
|
case 200: {
|
|
213
281
|
const json = await res.json()
|
|
214
|
-
expectTypeOf(json.
|
|
282
|
+
expectTypeOf(json.tokens).toEqualTypeOf<
|
|
283
|
+
z.output<typeof Faucet.schema.FundResponse>['tokens']
|
|
284
|
+
>()
|
|
285
|
+
expectTypeOf(json.tokens[0]!.amount).toEqualTypeOf<
|
|
286
|
+
z.output<typeof Faucet.schema.FundResponse>['tokens'][number]['amount']
|
|
287
|
+
>()
|
|
288
|
+
expectTypeOf(json.tokens[0]!.token.symbol).toEqualTypeOf<string>()
|
|
289
|
+
// @ts-expect-error token metadata is nested under `token`
|
|
290
|
+
void json.tokens[0]!.symbol
|
|
291
|
+
// @ts-expect-error quantities are nested under `amount`
|
|
292
|
+
void json.tokens[0]!.token.amount
|
|
293
|
+
expectTypeOf(json.transactionHashes).toEqualTypeOf<
|
|
294
|
+
z.output<typeof Faucet.schema.FundResponse>['transactionHashes']
|
|
295
|
+
>()
|
|
215
296
|
void json
|
|
216
297
|
return
|
|
217
298
|
}
|
|
218
|
-
case
|
|
299
|
+
case 429: {
|
|
219
300
|
const json = await res.json()
|
|
220
|
-
expectTypeOf(json.error.code).toEqualTypeOf<'
|
|
301
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'rate_limit_exceeded'>()
|
|
302
|
+
void json
|
|
303
|
+
return
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
})
|
|
307
|
+
|
|
308
|
+
test('GET /v1/orgs/:orgId/billing', async () => {
|
|
309
|
+
const client = Client.create()
|
|
310
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].billing.$get({
|
|
311
|
+
param: { orgId: 'org_test' },
|
|
312
|
+
})
|
|
313
|
+
|
|
314
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 404 | 502 | PublicAccessStatus>()
|
|
315
|
+
|
|
316
|
+
switch (res.status) {
|
|
317
|
+
case 200: {
|
|
318
|
+
const json = await res.json()
|
|
319
|
+
expectTypeOf(json.enabledSources).toEqualTypeOf<('stripe' | 'tempo')[]>()
|
|
320
|
+
expectTypeOf(json.status).toEqualTypeOf<z.output<typeof Billing.schema.Billing>['status']>()
|
|
221
321
|
void json
|
|
222
322
|
return
|
|
223
323
|
}
|
|
@@ -236,6 +336,7 @@ describe('narrows responses by status', () => {
|
|
|
236
336
|
case 200: {
|
|
237
337
|
const json = await res.json()
|
|
238
338
|
expectTypeOf(json.data[0]!.count).toEqualTypeOf<number>()
|
|
339
|
+
expectTypeOf(json.data[0]!.failed).toEqualTypeOf<number>()
|
|
239
340
|
expectTypeOf(json.data[0]!.feeTotal).toEqualTypeOf<{ amount: string; currency: 'usd' }>()
|
|
240
341
|
expectTypeOf(json.data[0]!.timestamp).toEqualTypeOf<string>()
|
|
241
342
|
void json
|
|
@@ -257,11 +358,12 @@ describe('narrows responses by status', () => {
|
|
|
257
358
|
param: { orgId: 'org_test' },
|
|
258
359
|
})
|
|
259
360
|
|
|
260
|
-
expectTypeOf(res.status).toEqualTypeOf<200 | 404 |
|
|
361
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 404 | 502 | PublicAccessStatus>()
|
|
261
362
|
|
|
262
363
|
switch (res.status) {
|
|
263
364
|
case 200: {
|
|
264
365
|
const json = await res.json()
|
|
366
|
+
expectTypeOf(json.enabledSources).toEqualTypeOf<('stripe' | 'tempo')[]>()
|
|
265
367
|
expectTypeOf(json.spendLimit).toEqualTypeOf<
|
|
266
368
|
z.output<typeof Billing.schema.SpendLimit> | undefined
|
|
267
369
|
>()
|
|
@@ -269,9 +371,35 @@ describe('narrows responses by status', () => {
|
|
|
269
371
|
void json
|
|
270
372
|
return
|
|
271
373
|
}
|
|
272
|
-
|
|
374
|
+
}
|
|
375
|
+
})
|
|
376
|
+
|
|
377
|
+
test('POST /v1/orgs/:orgId/billing/stripe/checkout', async () => {
|
|
378
|
+
const client = Client.create()
|
|
379
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].billing.stripe.checkout.$post({
|
|
380
|
+
param: { orgId: 'org_test' },
|
|
381
|
+
})
|
|
382
|
+
|
|
383
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 404 | 501 | 502 | PublicAccessStatus>()
|
|
384
|
+
|
|
385
|
+
switch (res.status) {
|
|
386
|
+
case 200: {
|
|
273
387
|
const json = await res.json()
|
|
274
|
-
expectTypeOf(json.
|
|
388
|
+
expectTypeOf(json.url).toEqualTypeOf<string>()
|
|
389
|
+
void json
|
|
390
|
+
return
|
|
391
|
+
}
|
|
392
|
+
case 403: {
|
|
393
|
+
const json = await res.json()
|
|
394
|
+
expectTypeOf(json.error.code).toEqualTypeOf<
|
|
395
|
+
'api_key_forbidden' | 'billing_source_disabled' | 'forbidden'
|
|
396
|
+
>()
|
|
397
|
+
void json
|
|
398
|
+
return
|
|
399
|
+
}
|
|
400
|
+
case 404: {
|
|
401
|
+
const json = await res.json()
|
|
402
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'organization_not_found'>()
|
|
275
403
|
void json
|
|
276
404
|
return
|
|
277
405
|
}
|
|
@@ -388,6 +516,112 @@ describe('narrows responses by status', () => {
|
|
|
388
516
|
}
|
|
389
517
|
})
|
|
390
518
|
|
|
519
|
+
test('POST /v1/orgs/:orgId/verified-token-requests', async () => {
|
|
520
|
+
const client = Client.create()
|
|
521
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}']['verified-token-requests'].$post(
|
|
522
|
+
{
|
|
523
|
+
json: {
|
|
524
|
+
address: '0x20c00000000000000000000000000000000000aa',
|
|
525
|
+
chainId: 4217,
|
|
526
|
+
currency: 'USD',
|
|
527
|
+
decimals: 6,
|
|
528
|
+
name: 'Test USD',
|
|
529
|
+
symbol: 'tUSD',
|
|
530
|
+
},
|
|
531
|
+
param: { orgId: 'org_test' },
|
|
532
|
+
},
|
|
533
|
+
)
|
|
534
|
+
|
|
535
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 409 | 502>()
|
|
536
|
+
|
|
537
|
+
switch (res.status) {
|
|
538
|
+
case 200: {
|
|
539
|
+
const json = await res.json()
|
|
540
|
+
expectTypeOf(json.status).toEqualTypeOf<
|
|
541
|
+
z.output<typeof VerifiedTokenRequests.schema.VerifiedTokenRequest>['status']
|
|
542
|
+
>()
|
|
543
|
+
expectTypeOf(json.reviewNote).toEqualTypeOf<string | null>()
|
|
544
|
+
void json
|
|
545
|
+
return
|
|
546
|
+
}
|
|
547
|
+
case 404: {
|
|
548
|
+
const json = await res.json()
|
|
549
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'organization_not_found'>()
|
|
550
|
+
void json
|
|
551
|
+
return
|
|
552
|
+
}
|
|
553
|
+
case 409: {
|
|
554
|
+
const json = await res.json()
|
|
555
|
+
expectTypeOf(json.error.code).toEqualTypeOf<
|
|
556
|
+
| 'request_limit_reached'
|
|
557
|
+
| 'request_pending_exists'
|
|
558
|
+
| 'verified_symbol_exists'
|
|
559
|
+
| 'verified_token_exists'
|
|
560
|
+
>()
|
|
561
|
+
void json
|
|
562
|
+
return
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
})
|
|
566
|
+
|
|
567
|
+
test('GET /v1/orgs/:orgId/verified-token-requests', async () => {
|
|
568
|
+
const client = Client.create()
|
|
569
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}']['verified-token-requests'].$get({
|
|
570
|
+
param: { orgId: 'org_test' },
|
|
571
|
+
})
|
|
572
|
+
|
|
573
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 502>()
|
|
574
|
+
|
|
575
|
+
switch (res.status) {
|
|
576
|
+
case 200: {
|
|
577
|
+
const json = await res.json()
|
|
578
|
+
expectTypeOf(json.data[0]!.id).toEqualTypeOf<
|
|
579
|
+
z.output<typeof VerifiedTokenRequests.schema.VerifiedTokenRequest>['id']
|
|
580
|
+
>()
|
|
581
|
+
void json
|
|
582
|
+
return
|
|
583
|
+
}
|
|
584
|
+
case 404: {
|
|
585
|
+
const json = await res.json()
|
|
586
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'organization_not_found'>()
|
|
587
|
+
void json
|
|
588
|
+
return
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
})
|
|
592
|
+
|
|
593
|
+
test('DELETE /v1/orgs/:orgId/verified-token-requests/:requestId', async () => {
|
|
594
|
+
const client = Client.create()
|
|
595
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}']['verified-token-requests'][
|
|
596
|
+
':requestId{vtr_[A-Za-z0-9_-]+}'
|
|
597
|
+
].$delete({ param: { orgId: 'org_test', requestId: 'vtr_test' } })
|
|
598
|
+
|
|
599
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 409 | 502>()
|
|
600
|
+
|
|
601
|
+
switch (res.status) {
|
|
602
|
+
case 200: {
|
|
603
|
+
const json = await res.json()
|
|
604
|
+
expectTypeOf(json.id).toEqualTypeOf<string>()
|
|
605
|
+
void json
|
|
606
|
+
return
|
|
607
|
+
}
|
|
608
|
+
case 404: {
|
|
609
|
+
const json = await res.json()
|
|
610
|
+
expectTypeOf(json.error.code).toEqualTypeOf<
|
|
611
|
+
'organization_not_found' | 'verified_token_request_not_found'
|
|
612
|
+
>()
|
|
613
|
+
void json
|
|
614
|
+
return
|
|
615
|
+
}
|
|
616
|
+
case 409: {
|
|
617
|
+
const json = await res.json()
|
|
618
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'request_not_pending'>()
|
|
619
|
+
void json
|
|
620
|
+
return
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
})
|
|
624
|
+
|
|
391
625
|
test('GET /v1/orgs/:orgId/projects/:projectId', async () => {
|
|
392
626
|
const client = Client.create()
|
|
393
627
|
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].projects[
|
|
@@ -459,6 +693,12 @@ describe('narrows responses by status', () => {
|
|
|
459
693
|
void json
|
|
460
694
|
return
|
|
461
695
|
}
|
|
696
|
+
case 403: {
|
|
697
|
+
const json = await res.json()
|
|
698
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'forbidden' | 'scope_not_issuable'>()
|
|
699
|
+
void json
|
|
700
|
+
return
|
|
701
|
+
}
|
|
462
702
|
}
|
|
463
703
|
})
|
|
464
704
|
|
|
@@ -581,6 +821,48 @@ describe('narrows responses by status', () => {
|
|
|
581
821
|
}
|
|
582
822
|
})
|
|
583
823
|
|
|
824
|
+
test('POST /v1/orgs/:orgId/invite-links', async () => {
|
|
825
|
+
const client = Client.create()
|
|
826
|
+
const orgLinks = client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}']['invite-links']
|
|
827
|
+
const res = await orgLinks.$post({
|
|
828
|
+
json: { allowedEmailDomains: ['example.com'], name: 'Community' },
|
|
829
|
+
param: { orgId: 'org_test' },
|
|
830
|
+
})
|
|
831
|
+
await orgLinks.$post({ json: { name: 'Unrestricted' }, param: { orgId: 'org_test' } })
|
|
832
|
+
await orgLinks.$post({
|
|
833
|
+
json: { allowedEmailDomains: null },
|
|
834
|
+
param: { orgId: 'org_test' },
|
|
835
|
+
})
|
|
836
|
+
|
|
837
|
+
type Input = Parameters<typeof orgLinks.$post>[0]
|
|
838
|
+
expectTypeOf<Input['json']['allowedEmailDomains']>().toEqualTypeOf<
|
|
839
|
+
readonly string[] | null | undefined
|
|
840
|
+
>()
|
|
841
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 502>()
|
|
842
|
+
|
|
843
|
+
if (res.status === 200) {
|
|
844
|
+
const json = await res.json()
|
|
845
|
+
expectTypeOf(json.allowedEmailDomains).toEqualTypeOf<readonly string[] | null>()
|
|
846
|
+
expectTypeOf(json.allowedEmailDomains).toEqualTypeOf<
|
|
847
|
+
z.output<typeof InviteLinks.schema.InviteLink>['allowedEmailDomains']
|
|
848
|
+
>()
|
|
849
|
+
void json
|
|
850
|
+
}
|
|
851
|
+
})
|
|
852
|
+
|
|
853
|
+
test('POST /v1/invite-links/accept', async () => {
|
|
854
|
+
const client = Client.create()
|
|
855
|
+
const res = await client.v1['invite-links'].accept.$post({ json: { token: 'lnk_test' } })
|
|
856
|
+
|
|
857
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 502>()
|
|
858
|
+
|
|
859
|
+
if (res.status === 403) {
|
|
860
|
+
const json = await res.json()
|
|
861
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'forbidden' | 'invite_link_email_forbidden'>()
|
|
862
|
+
void json
|
|
863
|
+
}
|
|
864
|
+
})
|
|
865
|
+
|
|
584
866
|
test('POST /v1/invitations/:invitationId/accept', async () => {
|
|
585
867
|
const client = Client.create()
|
|
586
868
|
const res = await client.v1.invitations[':invitationId{inv_[A-Za-z0-9_-]+}'].accept.$post({
|
|
@@ -701,7 +983,9 @@ describe('narrows responses by status', () => {
|
|
|
701
983
|
|
|
702
984
|
test('GET /v1/transactions', async () => {
|
|
703
985
|
const client = Client.create()
|
|
704
|
-
const res = await client.v1.transactions.$get(
|
|
986
|
+
const res = await client.v1.transactions.$get({
|
|
987
|
+
query: { include: 'feeToken.logoUri,feeToken.verified' },
|
|
988
|
+
})
|
|
705
989
|
|
|
706
990
|
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
707
991
|
|
|
@@ -717,6 +1001,12 @@ describe('narrows responses by status', () => {
|
|
|
717
1001
|
expectTypeOf(json.data[0]!.meta.receipt?.gasUsed).toEqualTypeOf<
|
|
718
1002
|
z.output<typeof Receipts.schema.Receipt>['gasUsed'] | undefined
|
|
719
1003
|
>()
|
|
1004
|
+
expectTypeOf(json.data[0]!.meta.receipt?.feeAmount).toEqualTypeOf<
|
|
1005
|
+
ValuedTokenAmount | undefined
|
|
1006
|
+
>()
|
|
1007
|
+
expectTypeOf(json.data[0]!.feeToken).toEqualTypeOf<
|
|
1008
|
+
z.output<typeof Tokens.schema.TokenReference> | undefined
|
|
1009
|
+
>()
|
|
720
1010
|
void json
|
|
721
1011
|
return
|
|
722
1012
|
}
|
|
@@ -743,6 +1033,7 @@ describe('narrows responses by status', () => {
|
|
|
743
1033
|
param: {
|
|
744
1034
|
transactionHash: '0x515801d7f9a5ac705e793e85904c9c69b3f1694b465cc8fb6ba3f0298dc82665',
|
|
745
1035
|
},
|
|
1036
|
+
query: { include: 'feeToken.logoUri,feeToken.verified' },
|
|
746
1037
|
})
|
|
747
1038
|
|
|
748
1039
|
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 404 | 502 | PaidAccessStatus>()
|
|
@@ -756,6 +1047,10 @@ describe('narrows responses by status', () => {
|
|
|
756
1047
|
expectTypeOf(json.meta.receipt?.status).toEqualTypeOf<
|
|
757
1048
|
z.output<typeof Receipts.schema.Receipt>['status'] | undefined
|
|
758
1049
|
>()
|
|
1050
|
+
expectTypeOf(json.meta.receipt?.feeAmount).toEqualTypeOf<ValuedTokenAmount | undefined>()
|
|
1051
|
+
expectTypeOf(json.feeToken).toEqualTypeOf<
|
|
1052
|
+
z.output<typeof Tokens.schema.TokenReference> | undefined
|
|
1053
|
+
>()
|
|
759
1054
|
expectTypeOf(json.sender).toEqualTypeOf<
|
|
760
1055
|
z.output<typeof Transactions.schema.Transaction>['sender']
|
|
761
1056
|
>()
|
|
@@ -790,7 +1085,9 @@ describe('narrows responses by status', () => {
|
|
|
790
1085
|
|
|
791
1086
|
test('GET /v1/transactions/receipts', async () => {
|
|
792
1087
|
const client = Client.create()
|
|
793
|
-
const res = await client.v1.transactions.receipts.$get(
|
|
1088
|
+
const res = await client.v1.transactions.receipts.$get({
|
|
1089
|
+
query: { include: 'feeToken.logoUri,feeToken.verified' },
|
|
1090
|
+
})
|
|
794
1091
|
|
|
795
1092
|
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
796
1093
|
|
|
@@ -800,6 +1097,10 @@ describe('narrows responses by status', () => {
|
|
|
800
1097
|
expectTypeOf(json.data[0]!.transactionHash).toEqualTypeOf<
|
|
801
1098
|
z.output<typeof Receipts.schema.Receipt>['transactionHash']
|
|
802
1099
|
>()
|
|
1100
|
+
expectTypeOf(json.data[0]!.feeAmount).toEqualTypeOf<ValuedTokenAmount>()
|
|
1101
|
+
expectTypeOf(json.data[0]!.feeToken).toEqualTypeOf<
|
|
1102
|
+
z.output<typeof Tokens.schema.TokenReference> | undefined
|
|
1103
|
+
>()
|
|
803
1104
|
void json
|
|
804
1105
|
return
|
|
805
1106
|
}
|
|
@@ -826,6 +1127,7 @@ describe('narrows responses by status', () => {
|
|
|
826
1127
|
param: {
|
|
827
1128
|
transactionHash: '0x515801d7f9a5ac705e793e85904c9c69b3f1694b465cc8fb6ba3f0298dc82665',
|
|
828
1129
|
},
|
|
1130
|
+
query: { include: 'feeToken.logoUri,feeToken.verified' },
|
|
829
1131
|
})
|
|
830
1132
|
|
|
831
1133
|
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 404 | 502 | PaidAccessStatus>()
|
|
@@ -839,6 +1141,13 @@ describe('narrows responses by status', () => {
|
|
|
839
1141
|
expectTypeOf(json.sender).toEqualTypeOf<
|
|
840
1142
|
z.output<typeof Receipts.schema.Receipt>['sender']
|
|
841
1143
|
>()
|
|
1144
|
+
expectTypeOf(json.feeAmount).toEqualTypeOf<ValuedTokenAmount>()
|
|
1145
|
+
expectTypeOf(json.feeToken).toEqualTypeOf<
|
|
1146
|
+
z.output<typeof Tokens.schema.TokenReference> | undefined
|
|
1147
|
+
>()
|
|
1148
|
+
expectTypeOf(json.meta.pricing).toEqualTypeOf<
|
|
1149
|
+
z.output<typeof Valuation.schema.Pricing> | undefined
|
|
1150
|
+
>()
|
|
842
1151
|
void json
|
|
843
1152
|
return
|
|
844
1153
|
}
|
|
@@ -874,6 +1183,7 @@ describe('narrows responses by status', () => {
|
|
|
874
1183
|
param: {
|
|
875
1184
|
transactionHash: '0x4845ae2098724ab26a5d89370dce5124d044be6a5acc164afc348662de67d474',
|
|
876
1185
|
},
|
|
1186
|
+
query: { include: 'token.logoUri,token.verified' },
|
|
877
1187
|
})
|
|
878
1188
|
|
|
879
1189
|
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 404 | 502 | PaidAccessStatus>()
|
|
@@ -886,6 +1196,24 @@ describe('narrows responses by status', () => {
|
|
|
886
1196
|
typeof Activities.schema.getTransactionActivities.Response
|
|
887
1197
|
>['data'][number]['type']
|
|
888
1198
|
>()
|
|
1199
|
+
const item = json.data[0]!
|
|
1200
|
+
if (item.type === 'swap') {
|
|
1201
|
+
expectTypeOf(item.data.destinationAmount).toEqualTypeOf<ValuedTokenAmount>()
|
|
1202
|
+
// @ts-expect-error token references do not contain quantities
|
|
1203
|
+
void item.data.destinationToken.amount
|
|
1204
|
+
expectTypeOf(item.data.sourceAmount).toEqualTypeOf<ValuedTokenAmount>()
|
|
1205
|
+
expectTypeOf(item.data.sourceToken.currency).toEqualTypeOf<string>()
|
|
1206
|
+
expectTypeOf(item.data.sourceToken.decimals).toEqualTypeOf<number>()
|
|
1207
|
+
expectTypeOf(item.data.sourceToken.logoUri).toEqualTypeOf<string | undefined>()
|
|
1208
|
+
expectTypeOf(item.data.sourceToken.name).toEqualTypeOf<string>()
|
|
1209
|
+
expectTypeOf(item.data.sourceToken.symbol).toEqualTypeOf<string>()
|
|
1210
|
+
expectTypeOf(item.data.sourceToken.verified).toEqualTypeOf<boolean | undefined>()
|
|
1211
|
+
}
|
|
1212
|
+
if (item.type === 'session-closed') {
|
|
1213
|
+
expectTypeOf(item.data.refundAmount).toEqualTypeOf<ValuedTokenAmount | undefined>()
|
|
1214
|
+
// @ts-expect-error token references do not contain quantities
|
|
1215
|
+
void item.data.refund?.amount
|
|
1216
|
+
}
|
|
889
1217
|
void json
|
|
890
1218
|
return
|
|
891
1219
|
}
|
|
@@ -1077,6 +1405,7 @@ describe('narrows responses by status', () => {
|
|
|
1077
1405
|
const client = Client.create()
|
|
1078
1406
|
const res = await client.v1.tokens[':token'].transactions.$get({
|
|
1079
1407
|
param: { token: '0x20c0000000000000000000000000000000000000' },
|
|
1408
|
+
query: { include: 'feeToken.logoUri,feeToken.verified' },
|
|
1080
1409
|
})
|
|
1081
1410
|
|
|
1082
1411
|
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
@@ -1087,6 +1416,9 @@ describe('narrows responses by status', () => {
|
|
|
1087
1416
|
expectTypeOf(json.data[0]!.hash).toEqualTypeOf<
|
|
1088
1417
|
z.output<typeof Transactions.schema.Transaction>['hash']
|
|
1089
1418
|
>()
|
|
1419
|
+
expectTypeOf(json.data[0]!.feeToken).toEqualTypeOf<
|
|
1420
|
+
z.output<typeof Tokens.schema.TokenReference> | undefined
|
|
1421
|
+
>()
|
|
1090
1422
|
void json
|
|
1091
1423
|
return
|
|
1092
1424
|
}
|
|
@@ -1111,6 +1443,7 @@ describe('narrows responses by status', () => {
|
|
|
1111
1443
|
const client = Client.create()
|
|
1112
1444
|
const res = await client.v1.addresses[':address'].balances.$get({
|
|
1113
1445
|
param: { address: '0x0000000000000000000000000000000000000000' },
|
|
1446
|
+
query: {},
|
|
1114
1447
|
})
|
|
1115
1448
|
|
|
1116
1449
|
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
@@ -1122,11 +1455,17 @@ describe('narrows responses by status', () => {
|
|
|
1122
1455
|
z.output<typeof Balances.schema.getAddressBalances.Response>['data'][number]['amount']
|
|
1123
1456
|
>()
|
|
1124
1457
|
expectTypeOf(json.data[0]!.formatted).toEqualTypeOf<string>()
|
|
1458
|
+
expectTypeOf(json.data[0]!.currency).toEqualTypeOf<string>()
|
|
1459
|
+
expectTypeOf(json.data[0]!.decimals).toEqualTypeOf<number>()
|
|
1125
1460
|
// `feeEligible` is best-effort, so it is an optional boolean.
|
|
1126
1461
|
expectTypeOf(json.data[0]!.feeEligible).toEqualTypeOf<boolean | undefined>()
|
|
1127
|
-
expectTypeOf(json.data[0]!.token).toEqualTypeOf<
|
|
1128
|
-
|
|
1129
|
-
|
|
1462
|
+
expectTypeOf(json.data[0]!.token.logoUri).toEqualTypeOf<string | undefined>()
|
|
1463
|
+
expectTypeOf(json.data[0]!.token.verified).toEqualTypeOf<boolean>()
|
|
1464
|
+
// `valuation` is `null` for unverified or unpriceable holdings.
|
|
1465
|
+
expectTypeOf(json.data[0]!.valuation).toEqualTypeOf<{
|
|
1466
|
+
amount: string
|
|
1467
|
+
currency: string
|
|
1468
|
+
} | null>()
|
|
1130
1469
|
// `meta` (opt-in `include=totalCount` capped count) is optional.
|
|
1131
1470
|
expectTypeOf(json.meta).toEqualTypeOf<
|
|
1132
1471
|
z.output<typeof Balances.schema.getAddressBalances.Response>['meta']
|
|
@@ -1153,6 +1492,48 @@ describe('narrows responses by status', () => {
|
|
|
1153
1492
|
}
|
|
1154
1493
|
})
|
|
1155
1494
|
|
|
1495
|
+
test('GET /v1/addresses/:address/valuation', async () => {
|
|
1496
|
+
const client = Client.create()
|
|
1497
|
+
const res = await client.v1.addresses[':address'].valuation.$get({
|
|
1498
|
+
param: { address: '0x0000000000000000000000000000000000000000' },
|
|
1499
|
+
query: {},
|
|
1500
|
+
})
|
|
1501
|
+
|
|
1502
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
1503
|
+
|
|
1504
|
+
switch (res.status) {
|
|
1505
|
+
case 200: {
|
|
1506
|
+
const json = await res.json()
|
|
1507
|
+
expectTypeOf(json.amount).toEqualTypeOf<string>()
|
|
1508
|
+
expectTypeOf(json.currency).toEqualTypeOf<string>()
|
|
1509
|
+
expectTypeOf(json.id).toEqualTypeOf<string>()
|
|
1510
|
+
// `pricing` is `null` when no currency conversion was needed.
|
|
1511
|
+
expectTypeOf(json.pricing).toEqualTypeOf<
|
|
1512
|
+
z.output<typeof Valuation.schema.getAddressValuation.Response>['pricing']
|
|
1513
|
+
>()
|
|
1514
|
+
expectTypeOf(json.unpriced).toEqualTypeOf<string[]>()
|
|
1515
|
+
void json
|
|
1516
|
+
return
|
|
1517
|
+
}
|
|
1518
|
+
case 400: {
|
|
1519
|
+
const json = await res.json()
|
|
1520
|
+
expectTypeOf(json.error.code).toEqualTypeOf<
|
|
1521
|
+
Access400<'address_invalid' | 'query_invalid'>
|
|
1522
|
+
>()
|
|
1523
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
1524
|
+
void json
|
|
1525
|
+
return
|
|
1526
|
+
}
|
|
1527
|
+
case 502: {
|
|
1528
|
+
const json = await res.json()
|
|
1529
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
1530
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
1531
|
+
void json
|
|
1532
|
+
return
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
})
|
|
1536
|
+
|
|
1156
1537
|
test('GET /v1/transfers', async () => {
|
|
1157
1538
|
const client = Client.create()
|
|
1158
1539
|
const res = await client.v1.transfers.$get()
|
|
@@ -1171,6 +1552,20 @@ describe('narrows responses by status', () => {
|
|
|
1171
1552
|
expectTypeOf(json.data[0]!.attribution).toEqualTypeOf<
|
|
1172
1553
|
z.output<typeof Transfers.schema.getTransfers.Transfer>['attribution']
|
|
1173
1554
|
>()
|
|
1555
|
+
expectTypeOf(json.data[0]!.destinationAmount).toEqualTypeOf<ValuedTokenAmount | undefined>()
|
|
1556
|
+
expectTypeOf(json.data[0]!.sourceAmount).toEqualTypeOf<ValuedTokenAmount>()
|
|
1557
|
+
expectTypeOf(json.data[0]!.sourceToken.currency).toEqualTypeOf<string>()
|
|
1558
|
+
expectTypeOf(json.data[0]!.sourceToken.decimals).toEqualTypeOf<number>()
|
|
1559
|
+
expectTypeOf(json.data[0]!.sourceToken.name).toEqualTypeOf<string>()
|
|
1560
|
+
expectTypeOf(json.data[0]!.sourceToken.symbol).toEqualTypeOf<string>()
|
|
1561
|
+
// @ts-expect-error token references do not contain quantities
|
|
1562
|
+
void json.data[0]!.sourceToken.amount
|
|
1563
|
+
// @ts-expect-error valuations belong to amount fields
|
|
1564
|
+
void json.data[0]!.sourceToken.valuation
|
|
1565
|
+
// @ts-expect-error destination token references do not contain quantities
|
|
1566
|
+
void json.data[0]!.destinationToken?.amount
|
|
1567
|
+
// @ts-expect-error destination valuations belong to amount fields
|
|
1568
|
+
void json.data[0]!.destinationToken?.valuation
|
|
1174
1569
|
// `meta` (the opt-in `include=totalCount` capped count) is optional.
|
|
1175
1570
|
expectTypeOf(json.meta).toEqualTypeOf<
|
|
1176
1571
|
z.output<typeof Transfers.schema.getTransfers.Response>['meta']
|
|
@@ -1211,14 +1606,32 @@ describe('narrows responses by status', () => {
|
|
|
1211
1606
|
switch (res.status) {
|
|
1212
1607
|
case 200: {
|
|
1213
1608
|
const json = await res.json()
|
|
1609
|
+
expectTypeOf(json.data[0]!.destinationAmount).toEqualTypeOf<{
|
|
1610
|
+
baseUnits: string
|
|
1611
|
+
currency: string
|
|
1612
|
+
decimals: number
|
|
1613
|
+
formatted: string
|
|
1614
|
+
}>()
|
|
1615
|
+
expectTypeOf(json.data[0]!.destinationAmountMin).toEqualTypeOf<
|
|
1616
|
+
| {
|
|
1617
|
+
baseUnits: string
|
|
1618
|
+
currency: string
|
|
1619
|
+
decimals: number
|
|
1620
|
+
formatted: string
|
|
1621
|
+
}
|
|
1622
|
+
| undefined
|
|
1623
|
+
>()
|
|
1214
1624
|
expectTypeOf(json.data[0]!.sourceAmount).toEqualTypeOf<
|
|
1215
1625
|
z.output<typeof Funding.schema.quoteFunding.Response>['data'][number]['sourceAmount']
|
|
1216
1626
|
>()
|
|
1627
|
+
// @ts-expect-error token references do not contain quantities
|
|
1628
|
+
void json.data[0]!.sourceToken.amount
|
|
1629
|
+
// @ts-expect-error provider details no longer duplicate destination amounts
|
|
1630
|
+
void json.data[0]!.quote.outputAmount
|
|
1217
1631
|
expectTypeOf(json.data[0]!.provider.id).toEqualTypeOf<
|
|
1218
|
-
'across' | 'relay' | 'rhino' | 'squid'
|
|
1632
|
+
'across' | 'relay' | 'rhino' | 'squid' | 'symbiosis'
|
|
1219
1633
|
>()
|
|
1220
1634
|
expectTypeOf(json.data[0]!.quote.expiresAt).toEqualTypeOf<string | undefined>()
|
|
1221
|
-
expectTypeOf(json.data[0]!.quote.outputAmount).toEqualTypeOf<string>()
|
|
1222
1635
|
void json
|
|
1223
1636
|
return
|
|
1224
1637
|
}
|
|
@@ -1303,6 +1716,14 @@ describe('narrows responses by status', () => {
|
|
|
1303
1716
|
expectTypeOf(json.data[0]!.transactionHash).toEqualTypeOf<
|
|
1304
1717
|
z.output<typeof Exchanges.schema.getSwaps.Response>['data'][number]['transactionHash']
|
|
1305
1718
|
>()
|
|
1719
|
+
expectTypeOf(json.data[0]!.destinationAmount).toEqualTypeOf<ValuedTokenAmount>()
|
|
1720
|
+
expectTypeOf(json.data[0]!.sourceAmount).toEqualTypeOf<ValuedTokenAmount>()
|
|
1721
|
+
expectTypeOf(json.data[0]!.fills[0]!.destinationAmount).toEqualTypeOf<ValuedTokenAmount>()
|
|
1722
|
+
expectTypeOf(json.data[0]!.fills[0]!.sourceAmount).toEqualTypeOf<ValuedTokenAmount>()
|
|
1723
|
+
// @ts-expect-error token references do not contain quantities
|
|
1724
|
+
void json.data[0]!.sourceToken.amount
|
|
1725
|
+
// @ts-expect-error token references do not contain quantities
|
|
1726
|
+
void json.data[0]!.fills[0]!.destinationToken.amount
|
|
1306
1727
|
void json
|
|
1307
1728
|
return
|
|
1308
1729
|
}
|
|
@@ -1323,6 +1744,90 @@ describe('narrows responses by status', () => {
|
|
|
1323
1744
|
}
|
|
1324
1745
|
})
|
|
1325
1746
|
|
|
1747
|
+
test('POST /v1/exchange/quotes', async () => {
|
|
1748
|
+
const client = Client.create()
|
|
1749
|
+
const res = await client.v1.exchange.quotes.$post({
|
|
1750
|
+
json: {
|
|
1751
|
+
amount: '1000000',
|
|
1752
|
+
destinationToken: '0x20c000000000000000000000b9537d11c60e8b50',
|
|
1753
|
+
mode: 'exactSource',
|
|
1754
|
+
slippageBps: 50,
|
|
1755
|
+
sourceToken: '0x20c0000000000000000000008f5425160ebe5525',
|
|
1756
|
+
},
|
|
1757
|
+
query: { include: 'token.logoUri,token.verified' },
|
|
1758
|
+
})
|
|
1759
|
+
|
|
1760
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 404 | 502 | PaidAccessStatus>()
|
|
1761
|
+
|
|
1762
|
+
switch (res.status) {
|
|
1763
|
+
case 200: {
|
|
1764
|
+
const json = await res.json()
|
|
1765
|
+
expectTypeOf(json.destinationAmount).toEqualTypeOf<ValuedTokenAmount>()
|
|
1766
|
+
// @ts-expect-error token references do not contain quantities
|
|
1767
|
+
void json.destinationToken.amount
|
|
1768
|
+
expectTypeOf(json.destinationToken.logoUri).toEqualTypeOf<string | undefined>()
|
|
1769
|
+
expectTypeOf(json.destinationToken.symbol).toEqualTypeOf<string>()
|
|
1770
|
+
expectTypeOf(json.destinationToken.verified).toEqualTypeOf<boolean | undefined>()
|
|
1771
|
+
expectTypeOf(json.meta?.pricing).toEqualTypeOf<
|
|
1772
|
+
z.output<typeof Valuation.schema.Pricing> | undefined
|
|
1773
|
+
>()
|
|
1774
|
+
expectTypeOf(json.sourceAmount).toEqualTypeOf<ValuedTokenAmount>()
|
|
1775
|
+
// @ts-expect-error token references do not contain quantities
|
|
1776
|
+
void json.sourceToken.amount
|
|
1777
|
+
expectTypeOf(json.sourceToken.logoUri).toEqualTypeOf<string | undefined>()
|
|
1778
|
+
expectTypeOf(json.sourceToken.symbol).toEqualTypeOf<string>()
|
|
1779
|
+
expectTypeOf(json.sourceToken.verified).toEqualTypeOf<boolean | undefined>()
|
|
1780
|
+
expectTypeOf(json.transaction.calls[0]!.data).toEqualTypeOf<
|
|
1781
|
+
z.output<
|
|
1782
|
+
typeof Exchanges.schema.createQuote.Response
|
|
1783
|
+
>['transaction']['calls'][number]['data']
|
|
1784
|
+
>()
|
|
1785
|
+
if (json.mode === 'exactSource') {
|
|
1786
|
+
expectTypeOf(json.destinationAmountMin).toEqualTypeOf<ValuedTokenAmount>()
|
|
1787
|
+
// @ts-expect-error slippage quantities live on destinationAmountMin
|
|
1788
|
+
void json.destinationToken.minimumAmount
|
|
1789
|
+
// @ts-expect-error exact-source responses do not carry a maximum source amount
|
|
1790
|
+
void json.sourceAmountMax
|
|
1791
|
+
// @ts-expect-error token references do not contain quantities
|
|
1792
|
+
void json.sourceToken.maximumAmount
|
|
1793
|
+
} else {
|
|
1794
|
+
expectTypeOf(json.sourceAmountMax).toEqualTypeOf<ValuedTokenAmount>()
|
|
1795
|
+
// @ts-expect-error slippage quantities live on sourceAmountMax
|
|
1796
|
+
void json.sourceToken.maximumAmount
|
|
1797
|
+
// @ts-expect-error exact-destination responses do not carry a minimum destination amount
|
|
1798
|
+
void json.destinationAmountMin
|
|
1799
|
+
// @ts-expect-error token references do not contain quantities
|
|
1800
|
+
void json.destinationToken.minimumAmount
|
|
1801
|
+
}
|
|
1802
|
+
void json
|
|
1803
|
+
return
|
|
1804
|
+
}
|
|
1805
|
+
case 400: {
|
|
1806
|
+
const json = await res.json()
|
|
1807
|
+
expectTypeOf(json.error.code).toEqualTypeOf<
|
|
1808
|
+
Access400<'body_invalid' | 'query_invalid' | 'quote_amount_out_of_range'>
|
|
1809
|
+
>()
|
|
1810
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
1811
|
+
void json
|
|
1812
|
+
return
|
|
1813
|
+
}
|
|
1814
|
+
case 404: {
|
|
1815
|
+
const json = await res.json()
|
|
1816
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'quote_not_available'>()
|
|
1817
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
1818
|
+
void json
|
|
1819
|
+
return
|
|
1820
|
+
}
|
|
1821
|
+
case 502: {
|
|
1822
|
+
const json = await res.json()
|
|
1823
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
1824
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
1825
|
+
void json
|
|
1826
|
+
return
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
})
|
|
1830
|
+
|
|
1326
1831
|
test('GET /v1/exchange/pairs', async () => {
|
|
1327
1832
|
const client = Client.create()
|
|
1328
1833
|
const res = await client.v1.exchange.pairs.$get()
|
|
@@ -1625,12 +2130,16 @@ describe('narrows responses by status', () => {
|
|
|
1625
2130
|
expectTypeOf(json.data[0]!.userToken.address).toEqualTypeOf<
|
|
1626
2131
|
z.output<typeof FeeAmm.schema.getFeeAmmPools.Token>['address']
|
|
1627
2132
|
>()
|
|
1628
|
-
expectTypeOf(json.data[0]!.
|
|
1629
|
-
z.output<typeof FeeAmm.schema.getFeeAmmPools.
|
|
2133
|
+
expectTypeOf(json.data[0]!.userAmount).toEqualTypeOf<
|
|
2134
|
+
z.output<typeof FeeAmm.schema.getFeeAmmPools.Pool>['userAmount']
|
|
1630
2135
|
>()
|
|
1631
|
-
expectTypeOf(json.data[0]!.
|
|
1632
|
-
z.output<typeof FeeAmm.schema.getFeeAmmPools.
|
|
2136
|
+
expectTypeOf(json.data[0]!.validatorAmount).toEqualTypeOf<
|
|
2137
|
+
z.output<typeof FeeAmm.schema.getFeeAmmPools.Pool>['validatorAmount']
|
|
1633
2138
|
>()
|
|
2139
|
+
// @ts-expect-error token references do not contain quantities
|
|
2140
|
+
void json.data[0]!.userToken.amount
|
|
2141
|
+
// @ts-expect-error token references do not contain formatted quantities
|
|
2142
|
+
void json.data[0]!.validatorToken.formatted
|
|
1634
2143
|
expectTypeOf(json.nextCursor).toEqualTypeOf<string | null>()
|
|
1635
2144
|
void json
|
|
1636
2145
|
return
|
|
@@ -1902,6 +2411,7 @@ describe('narrows responses by status', () => {
|
|
|
1902
2411
|
const client = Client.create()
|
|
1903
2412
|
const res = await client.v1.addresses[':address'].activities.$get({
|
|
1904
2413
|
param: { address: '0x0000000000000000000000000000000000000000' },
|
|
2414
|
+
query: { include: 'token.logoUri,token.verified' },
|
|
1905
2415
|
})
|
|
1906
2416
|
|
|
1907
2417
|
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
@@ -1912,6 +2422,17 @@ describe('narrows responses by status', () => {
|
|
|
1912
2422
|
expectTypeOf(json.data[0]!.type).toEqualTypeOf<
|
|
1913
2423
|
z.output<typeof Activities.schema.getAddressActivities.Response>['data'][number]['type']
|
|
1914
2424
|
>()
|
|
2425
|
+
const entry = json.data[0]!
|
|
2426
|
+
if (entry.type === 'transfer') {
|
|
2427
|
+
expectTypeOf(entry.data.destinationAmount).toEqualTypeOf<ValuedTokenAmount | undefined>()
|
|
2428
|
+
expectTypeOf(entry.data.sourceAmount).toEqualTypeOf<ValuedTokenAmount>()
|
|
2429
|
+
// @ts-expect-error token references do not contain quantities
|
|
2430
|
+
void entry.data.sourceToken.amount
|
|
2431
|
+
expectTypeOf(entry.data.sourceToken.currency).toEqualTypeOf<string>()
|
|
2432
|
+
expectTypeOf(entry.data.sourceToken.decimals).toEqualTypeOf<number>()
|
|
2433
|
+
expectTypeOf(entry.data.sourceToken.name).toEqualTypeOf<string>()
|
|
2434
|
+
expectTypeOf(entry.data.sourceToken.symbol).toEqualTypeOf<string>()
|
|
2435
|
+
}
|
|
1915
2436
|
void json
|
|
1916
2437
|
return
|
|
1917
2438
|
}
|
|
@@ -1971,6 +2492,16 @@ describe('narrows responses by status', () => {
|
|
|
1971
2492
|
>()
|
|
1972
2493
|
void json
|
|
1973
2494
|
}
|
|
2495
|
+
if (res.status === 400) {
|
|
2496
|
+
const json = await res.json()
|
|
2497
|
+
expectTypeOf(json.error.code).toEqualTypeOf<
|
|
2498
|
+
Access400<'body_invalid' | 'chain_id_unsupported' | 'filters_invalid' | 'url_invalid'>
|
|
2499
|
+
>()
|
|
2500
|
+
}
|
|
2501
|
+
if (res.status === 403) {
|
|
2502
|
+
const json = await res.json()
|
|
2503
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'api_key_forbidden' | 'limit_exceeded'>()
|
|
2504
|
+
}
|
|
1974
2505
|
})
|
|
1975
2506
|
|
|
1976
2507
|
test('GET /v1/webhooks', async () => {
|
|
@@ -2095,6 +2626,18 @@ describe('narrows responses by status', () => {
|
|
|
2095
2626
|
>()
|
|
2096
2627
|
void json
|
|
2097
2628
|
}
|
|
2629
|
+
if (res.status === 400) {
|
|
2630
|
+
const json = await res.json()
|
|
2631
|
+
expectTypeOf(json.error.code).toEqualTypeOf<
|
|
2632
|
+
Access400<
|
|
2633
|
+
| 'body_invalid'
|
|
2634
|
+
| 'destination_transition_invalid'
|
|
2635
|
+
| 'filters_invalid'
|
|
2636
|
+
| 'param_invalid'
|
|
2637
|
+
| 'url_invalid'
|
|
2638
|
+
>
|
|
2639
|
+
>()
|
|
2640
|
+
}
|
|
2098
2641
|
})
|
|
2099
2642
|
|
|
2100
2643
|
test('DELETE /v1/webhooks/:id', async () => {
|
|
@@ -2113,4 +2656,174 @@ describe('narrows responses by status', () => {
|
|
|
2113
2656
|
void json
|
|
2114
2657
|
}
|
|
2115
2658
|
})
|
|
2659
|
+
|
|
2660
|
+
test('POST /v1/orgs/:orgId/webhooks', async () => {
|
|
2661
|
+
const client = Client.create()
|
|
2662
|
+
void client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].webhooks.$post({
|
|
2663
|
+
// @ts-expect-error Organization webhook creation requires an explicit chain id.
|
|
2664
|
+
json: {
|
|
2665
|
+
destination: { type: 'url', url: 'https://example.com/webhook' },
|
|
2666
|
+
eventType: 'token:transfer',
|
|
2667
|
+
filters: {},
|
|
2668
|
+
},
|
|
2669
|
+
param: { orgId: 'org_test' },
|
|
2670
|
+
})
|
|
2671
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].webhooks.$post({
|
|
2672
|
+
json: {
|
|
2673
|
+
chainId: 4217,
|
|
2674
|
+
destination: { type: 'url', url: 'https://example.com/webhook' },
|
|
2675
|
+
eventType: 'token:transfer',
|
|
2676
|
+
filters: {},
|
|
2677
|
+
},
|
|
2678
|
+
param: { orgId: 'org_test' },
|
|
2679
|
+
})
|
|
2680
|
+
|
|
2681
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 502>()
|
|
2682
|
+
|
|
2683
|
+
if (res.status === 200) {
|
|
2684
|
+
const json = await res.json()
|
|
2685
|
+
if ('secret' in json) {
|
|
2686
|
+
expectTypeOf(json.destination.type).toEqualTypeOf<'url'>()
|
|
2687
|
+
expectTypeOf(json.secret).toEqualTypeOf<string>()
|
|
2688
|
+
} else expectTypeOf(json.destination.type).toEqualTypeOf<'betterstack' | 'slack'>()
|
|
2689
|
+
expectTypeOf(json.status).toEqualTypeOf<
|
|
2690
|
+
z.output<typeof OrgWebhooks.schema.createWebhook.Response>['status']
|
|
2691
|
+
>()
|
|
2692
|
+
}
|
|
2693
|
+
if (res.status === 403) {
|
|
2694
|
+
const json = await res.json()
|
|
2695
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'forbidden' | 'limit_exceeded'>()
|
|
2696
|
+
}
|
|
2697
|
+
})
|
|
2698
|
+
|
|
2699
|
+
test('GET /v1/orgs/:orgId/webhooks', async () => {
|
|
2700
|
+
const client = Client.create()
|
|
2701
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].webhooks.$get({
|
|
2702
|
+
param: { orgId: 'org_test' },
|
|
2703
|
+
})
|
|
2704
|
+
|
|
2705
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 502>()
|
|
2706
|
+
|
|
2707
|
+
if (res.status === 200) {
|
|
2708
|
+
const json = await res.json()
|
|
2709
|
+
expectTypeOf(json.data[0]!.id).toEqualTypeOf<string>()
|
|
2710
|
+
}
|
|
2711
|
+
})
|
|
2712
|
+
|
|
2713
|
+
test('GET /v1/orgs/:orgId/webhooks/:id/deliveries', async () => {
|
|
2714
|
+
const client = Client.create()
|
|
2715
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].webhooks[
|
|
2716
|
+
':id{wh_[A-Za-z0-9_-]+}'
|
|
2717
|
+
].deliveries.$get({
|
|
2718
|
+
param: { id: 'wh_test', orgId: 'org_test' },
|
|
2719
|
+
})
|
|
2720
|
+
|
|
2721
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 502>()
|
|
2722
|
+
|
|
2723
|
+
if (res.status === 200) {
|
|
2724
|
+
const json = await res.json()
|
|
2725
|
+
expectTypeOf(json.data[0]!.id).toEqualTypeOf<
|
|
2726
|
+
z.output<typeof OrgWebhooks.schema.listWebhookDeliveries.Response>['data'][number]['id']
|
|
2727
|
+
>()
|
|
2728
|
+
expectTypeOf(json.meta).toEqualTypeOf<
|
|
2729
|
+
z.output<typeof OrgWebhooks.schema.listWebhookDeliveries.Response>['meta']
|
|
2730
|
+
>()
|
|
2731
|
+
void json
|
|
2732
|
+
}
|
|
2733
|
+
})
|
|
2734
|
+
|
|
2735
|
+
test('GET /v1/orgs/:orgId/webhooks/:id/deliveries/:deliveryId', async () => {
|
|
2736
|
+
const client = Client.create()
|
|
2737
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].webhooks[
|
|
2738
|
+
':id{wh_[A-Za-z0-9_-]+}'
|
|
2739
|
+
].deliveries[':deliveryId'].$get({
|
|
2740
|
+
param: { deliveryId: 'whd_test', id: 'wh_test', orgId: 'org_test' },
|
|
2741
|
+
})
|
|
2742
|
+
|
|
2743
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 502>()
|
|
2744
|
+
|
|
2745
|
+
if (res.status === 200) {
|
|
2746
|
+
const json = await res.json()
|
|
2747
|
+
expectTypeOf(json.envelope.type).toEqualTypeOf<
|
|
2748
|
+
z.output<typeof OrgWebhooks.schema.getWebhookDelivery.Response>['envelope']['type']
|
|
2749
|
+
>()
|
|
2750
|
+
if (json.envelope.type === 'block:created')
|
|
2751
|
+
expectTypeOf(json.envelope.data.number).toEqualTypeOf<number>()
|
|
2752
|
+
expectTypeOf(json.requestUrl).toEqualTypeOf<string>()
|
|
2753
|
+
void json
|
|
2754
|
+
}
|
|
2755
|
+
if (res.status === 404) {
|
|
2756
|
+
const json = await res.json()
|
|
2757
|
+
expectTypeOf(json.error.code).toEqualTypeOf<
|
|
2758
|
+
| 'delivery_not_found'
|
|
2759
|
+
| 'organization_not_found'
|
|
2760
|
+
| 'webhook_not_found'
|
|
2761
|
+
| 'webhooks_not_enabled'
|
|
2762
|
+
>()
|
|
2763
|
+
}
|
|
2764
|
+
})
|
|
2765
|
+
|
|
2766
|
+
test('POST /v1/orgs/:orgId/webhooks/:id/deliveries/:deliveryId/retry', async () => {
|
|
2767
|
+
const client = Client.create()
|
|
2768
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].webhooks[
|
|
2769
|
+
':id{wh_[A-Za-z0-9_-]+}'
|
|
2770
|
+
].deliveries[':deliveryId'].retry.$post({
|
|
2771
|
+
param: { deliveryId: 'whd_test', id: 'wh_test', orgId: 'org_test' },
|
|
2772
|
+
})
|
|
2773
|
+
|
|
2774
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 502>()
|
|
2775
|
+
|
|
2776
|
+
if (res.status === 200) {
|
|
2777
|
+
const json = await res.json()
|
|
2778
|
+
expectTypeOf(json.eventId).toEqualTypeOf<
|
|
2779
|
+
z.output<typeof OrgWebhooks.schema.retryWebhookDelivery.Response>['eventId']
|
|
2780
|
+
>()
|
|
2781
|
+
void json
|
|
2782
|
+
}
|
|
2783
|
+
if (res.status === 403) {
|
|
2784
|
+
const json = await res.json()
|
|
2785
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'forbidden'>()
|
|
2786
|
+
}
|
|
2787
|
+
})
|
|
2788
|
+
|
|
2789
|
+
test('PATCH /v1/orgs/:orgId/webhooks/:id', async () => {
|
|
2790
|
+
const client = Client.create()
|
|
2791
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].webhooks[
|
|
2792
|
+
':id{wh_[A-Za-z0-9_-]+}'
|
|
2793
|
+
].$patch({
|
|
2794
|
+
json: { status: 'paused' },
|
|
2795
|
+
param: { id: 'wh_test', orgId: 'org_test' },
|
|
2796
|
+
})
|
|
2797
|
+
|
|
2798
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 502>()
|
|
2799
|
+
|
|
2800
|
+
if (res.status === 200) {
|
|
2801
|
+
const json = await res.json()
|
|
2802
|
+
expectTypeOf(json.status).toEqualTypeOf<
|
|
2803
|
+
z.output<typeof OrgWebhooks.schema.Subscription>['status']
|
|
2804
|
+
>()
|
|
2805
|
+
}
|
|
2806
|
+
if (res.status === 403) {
|
|
2807
|
+
const json = await res.json()
|
|
2808
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'forbidden'>()
|
|
2809
|
+
}
|
|
2810
|
+
})
|
|
2811
|
+
|
|
2812
|
+
test('DELETE /v1/orgs/:orgId/webhooks/:id', async () => {
|
|
2813
|
+
const client = Client.create()
|
|
2814
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].webhooks[
|
|
2815
|
+
':id{wh_[A-Za-z0-9_-]+}'
|
|
2816
|
+
].$delete({ param: { id: 'wh_test', orgId: 'org_test' } })
|
|
2817
|
+
|
|
2818
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 502>()
|
|
2819
|
+
|
|
2820
|
+
if (res.status === 200) {
|
|
2821
|
+
const json = await res.json()
|
|
2822
|
+
expectTypeOf(json).toEqualTypeOf<z.output<typeof OrgWebhooks.schema.DeleteResponse>>()
|
|
2823
|
+
}
|
|
2824
|
+
if (res.status === 403) {
|
|
2825
|
+
const json = await res.json()
|
|
2826
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'forbidden'>()
|
|
2827
|
+
}
|
|
2828
|
+
})
|
|
2116
2829
|
})
|