tapimo 0.5.2 → 0.6.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 +13987 -5755
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js.map +1 -1
- package/dist/admin/App.d.ts +910 -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/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/verified-tokens.d.ts +643 -118
- 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 +45 -33
- package/dist/admin/ui.generated.js.map +1 -1
- package/dist/apps/data/App.d.ts +3733 -2428
- 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 +193 -2
- 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 +3575 -1358
- package/dist/apps/data/routes/activities.d.ts.map +1 -1
- package/dist/apps/data/routes/activities.js +230 -88
- package/dist/apps/data/routes/activities.js.map +1 -1
- package/dist/apps/data/routes/addresses.d.ts +963 -342
- 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 +108 -57
- 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/coingecko.d.ts +169 -169
- package/dist/apps/data/routes/exchanges.d.ts +952 -201
- 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 +24 -24
- package/dist/apps/data/routes/funding.d.ts +8 -2
- package/dist/apps/data/routes/funding.d.ts.map +1 -1
- package/dist/apps/data/routes/funding.js +32 -6
- package/dist/apps/data/routes/funding.js.map +1 -1
- package/dist/apps/data/routes/indexer.d.ts +5 -5
- 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 +166 -173
- package/dist/apps/data/routes/tokens.d.ts.map +1 -1
- package/dist/apps/data/routes/tokens.js +14 -12
- 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 +82 -17
- package/dist/apps/data/routes/transfers.d.ts.map +1 -1
- package/dist/apps/data/routes/transfers.js +70 -13
- 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.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 +459 -479
- 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 +1 -1
- package/dist/apps/index.d.ts.map +1 -1
- package/dist/apps/index.js +1 -1
- package/dist/apps/index.js.map +1 -1
- package/dist/apps/management/App.d.ts +8606 -1681
- 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 +23 -0
- package/dist/apps/management/routes/api-keys.d.ts.map +1 -1
- package/dist/apps/management/routes/api-keys.js +5 -3
- package/dist/apps/management/routes/api-keys.js.map +1 -1
- package/dist/apps/management/routes/billing.d.ts +88 -48
- package/dist/apps/management/routes/billing.d.ts.map +1 -1
- package/dist/apps/management/routes/billing.js +10 -2
- package/dist/apps/management/routes/billing.js.map +1 -1
- package/dist/apps/management/routes/faucet.d.ts +218 -0
- package/dist/apps/management/routes/faucet.d.ts.map +1 -0
- package/dist/apps/management/routes/faucet.js +139 -0
- package/dist/apps/management/routes/faucet.js.map +1 -0
- package/dist/apps/management/routes/invitations.d.ts +121 -121
- package/dist/apps/management/routes/invitations.d.ts.map +1 -1
- package/dist/apps/management/routes/invitations.js +3 -0
- package/dist/apps/management/routes/invitations.js.map +1 -1
- package/dist/apps/management/routes/invite-links.d.ts +197 -168
- 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 +2 -0
- package/dist/apps/management/routes/me.d.ts.map +1 -1
- package/dist/apps/management/routes/me.js +4 -0
- package/dist/apps/management/routes/me.js.map +1 -1
- package/dist/apps/management/routes/members.d.ts +49 -49
- package/dist/apps/management/routes/orgs.d.ts +91 -91
- package/dist/apps/management/routes/projects.d.ts +115 -115
- package/dist/apps/management/routes/usage.d.ts +35 -32
- 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/mcp.d.ts +9 -2
- package/dist/apps/mcp.d.ts.map +1 -1
- package/dist/apps/mcp.js +9 -4
- package/dist/apps/mcp.js.map +1 -1
- package/dist/cli/Cli.d.ts.map +1 -1
- package/dist/cli/Cli.js +7 -2
- package/dist/cli/Cli.js.map +1 -1
- package/dist/db/Db.d.ts +4 -0
- package/dist/db/Db.d.ts.map +1 -1
- package/dist/db/Db.js +83 -0
- package/dist/db/Db.js.map +1 -1
- package/dist/db/Schema.d.ts +41 -0
- package/dist/db/Schema.d.ts.map +1 -1
- package/dist/db/Schema.js +45 -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/invitations.d.ts +12 -1
- package/dist/db/tables/invitations.d.ts.map +1 -1
- package/dist/db/tables/invitations.js +23 -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/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/internal/Auth.d.ts +43 -2
- package/dist/internal/Auth.d.ts.map +1 -1
- package/dist/internal/Auth.js +60 -45
- package/dist/internal/Auth.js.map +1 -1
- package/dist/internal/FundingQuotes.d.ts +69 -15
- package/dist/internal/FundingQuotes.d.ts.map +1 -1
- package/dist/internal/FundingQuotes.js +74 -25
- package/dist/internal/FundingQuotes.js.map +1 -1
- package/dist/internal/Log.d.ts +19 -1
- package/dist/internal/Log.d.ts.map +1 -1
- package/dist/internal/Log.js +2 -0
- package/dist/internal/Log.js.map +1 -1
- package/dist/internal/MetricSink.d.ts.map +1 -1
- package/dist/internal/MetricSink.js +9 -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/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/Viem.d.ts +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 +2 -2
- package/src/App.ts +9 -1
- package/src/Client.test-d.ts +638 -6
- package/src/admin/App.ts +4 -0
- package/src/admin/apps/early-access.test.ts +125 -0
- package/src/admin/apps/early-access.ts +175 -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/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/early-access.tsx +157 -0
- package/src/admin/ui/src/routes/verified-tokens.tsx +230 -19
- package/src/admin/ui.generated.ts +48 -33
- package/src/apps/data/App.ts +22 -14
- package/src/apps/data/FundingQuoteProviders.test.ts +298 -0
- package/src/apps/data/FundingQuoteProviders.ts +257 -4
- 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 +173 -3
- package/src/apps/data/routes/activities.ts +403 -132
- package/src/apps/data/routes/addresses.ts +19 -9
- package/src/apps/data/routes/balances.test.ts +144 -11
- package/src/apps/data/routes/balances.ts +140 -51
- package/src/apps/data/routes/exchanges.test.ts +540 -9
- package/src/apps/data/routes/exchanges.ts +690 -103
- package/src/apps/data/routes/funding.test.ts +84 -0
- package/src/apps/data/routes/funding.ts +38 -6
- package/src/apps/data/routes/receipts.test.ts +125 -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 +27 -12
- 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 +146 -4
- package/src/apps/data/routes/transfers.ts +91 -13
- package/src/apps/data/routes/valuation.test.ts +422 -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 +1 -1
- package/src/apps/management/App.ts +13 -0
- package/src/apps/management/routes/api-keys.test.ts +87 -0
- package/src/apps/management/routes/api-keys.ts +4 -3
- package/src/apps/management/routes/billing.test.ts +112 -1
- package/src/apps/management/routes/billing.ts +7 -2
- package/src/apps/management/routes/faucet.test.ts +79 -0
- package/src/apps/management/routes/faucet.ts +185 -0
- package/src/apps/management/routes/invitations.test.ts +172 -0
- package/src/apps/management/routes/invitations.ts +3 -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 +140 -88
- package/src/apps/management/routes/me.ts +6 -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/mcp.test.ts +13 -0
- package/src/apps/mcp.ts +18 -5
- package/src/cli/Cli.test.ts +36 -0
- package/src/cli/Cli.ts +7 -2
- package/src/db/Db.test.ts +19 -0
- package/src/db/Db.ts +95 -0
- package/src/db/Schema.ts +53 -0
- package/src/db/tables/earlyAccess.ts +86 -0
- package/src/db/tables/invitations.ts +26 -1
- package/src/db/tables/inviteLinks.ts +22 -3
- 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/internal/Auth.ts +73 -45
- package/src/internal/FundingQuotes.test.ts +143 -1
- package/src/internal/FundingQuotes.ts +95 -28
- package/src/internal/Log.test-d.ts +21 -0
- package/src/internal/Log.test.ts +50 -0
- package/src/internal/Log.ts +24 -1
- package/src/internal/MetricSink.test.ts +160 -0
- package/src/internal/MetricSink.ts +10 -0
- package/src/internal/OpenApi.ts +3 -0
- 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
|
@@ -6,23 +6,36 @@ import * as Balances from './apps/data/routes/balances.js'
|
|
|
6
6
|
import * as Billing from './apps/management/routes/billing.js'
|
|
7
7
|
import * as Blocks from './apps/data/routes/blocks.js'
|
|
8
8
|
import * as Exchanges from './apps/data/routes/exchanges.js'
|
|
9
|
+
import * as Faucet from './apps/management/routes/faucet.js'
|
|
9
10
|
import * as FeeAmm from './apps/data/routes/fee-amm.js'
|
|
10
11
|
import * as Funding from './apps/data/routes/funding.js'
|
|
11
12
|
import * as Indexer from './apps/data/routes/indexer.js'
|
|
13
|
+
import * as InviteLinks from './apps/management/routes/invite-links.js'
|
|
12
14
|
import * as Me from './apps/management/routes/me.js'
|
|
13
15
|
import * as Orgs from './apps/management/routes/orgs.js'
|
|
16
|
+
import * as OrgWebhooks from './apps/management/routes/webhooks.js'
|
|
14
17
|
import * as Receipts from './apps/data/routes/receipts.js'
|
|
15
18
|
import * as Rpc from './apps/data/routes/rpc.js'
|
|
16
19
|
import * as Scopes from './apps/management/routes/scopes.js'
|
|
17
20
|
import * as Tokens from './apps/data/routes/tokens.js'
|
|
18
21
|
import * as Transactions from './apps/data/routes/transactions.js'
|
|
19
22
|
import * as Transfers from './apps/data/routes/transfers.js'
|
|
23
|
+
import * as Valuation from './apps/data/routes/valuation.js'
|
|
24
|
+
import * as VerifiedTokenRequests from './apps/management/routes/verified-token-requests.js'
|
|
20
25
|
import * as VerifiedTokens from './apps/data/routes/verified-tokens.js'
|
|
21
26
|
import * as Webhooks from './apps/data/routes/webhooks.js'
|
|
22
27
|
|
|
23
28
|
type Access400<code extends string> = code | 'api_key_malformed'
|
|
24
29
|
type PaidAccessStatus = PublicAccessStatus | 402
|
|
25
30
|
type PublicAccessStatus = 400 | 401 | 403 | 429
|
|
31
|
+
/** A `Schema.TokenAmount` carrying its optional nested valuation. */
|
|
32
|
+
type ValuedTokenAmount = {
|
|
33
|
+
baseUnits: string
|
|
34
|
+
currency: string
|
|
35
|
+
decimals: number
|
|
36
|
+
formatted: string
|
|
37
|
+
valuation?: { amount: string; currency: string } | null | undefined
|
|
38
|
+
}
|
|
26
39
|
|
|
27
40
|
test('returns typed client', async () => {
|
|
28
41
|
const client = Client.create()
|
|
@@ -112,6 +125,7 @@ describe('narrows responses by status', () => {
|
|
|
112
125
|
case 200: {
|
|
113
126
|
const json = await res.json()
|
|
114
127
|
expectTypeOf(json.id).toEqualTypeOf<z.output<typeof Me.schema.User>['id']>()
|
|
128
|
+
expectTypeOf(json.tmp_earlyAccess).toEqualTypeOf<boolean>()
|
|
115
129
|
void json
|
|
116
130
|
return
|
|
117
131
|
}
|
|
@@ -200,6 +214,36 @@ describe('narrows responses by status', () => {
|
|
|
200
214
|
}
|
|
201
215
|
})
|
|
202
216
|
|
|
217
|
+
test('POST /v1/orgs/:orgId/faucet', async () => {
|
|
218
|
+
const client = Client.create()
|
|
219
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].faucet.$post({
|
|
220
|
+
json: { address: '0xbe058e1c4df8a4366a387bf595b284246a93039e' },
|
|
221
|
+
param: { orgId: 'org_test' },
|
|
222
|
+
})
|
|
223
|
+
|
|
224
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 429 | 502>()
|
|
225
|
+
|
|
226
|
+
switch (res.status) {
|
|
227
|
+
case 200: {
|
|
228
|
+
const json = await res.json()
|
|
229
|
+
expectTypeOf(json.tokens).toEqualTypeOf<
|
|
230
|
+
z.output<typeof Faucet.schema.FundResponse>['tokens']
|
|
231
|
+
>()
|
|
232
|
+
expectTypeOf(json.transactionHashes).toEqualTypeOf<
|
|
233
|
+
z.output<typeof Faucet.schema.FundResponse>['transactionHashes']
|
|
234
|
+
>()
|
|
235
|
+
void json
|
|
236
|
+
return
|
|
237
|
+
}
|
|
238
|
+
case 429: {
|
|
239
|
+
const json = await res.json()
|
|
240
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'rate_limit_exceeded'>()
|
|
241
|
+
void json
|
|
242
|
+
return
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
})
|
|
246
|
+
|
|
203
247
|
test('GET /v1/orgs/:orgId/billing', async () => {
|
|
204
248
|
const client = Client.create()
|
|
205
249
|
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].billing.$get({
|
|
@@ -236,6 +280,7 @@ describe('narrows responses by status', () => {
|
|
|
236
280
|
case 200: {
|
|
237
281
|
const json = await res.json()
|
|
238
282
|
expectTypeOf(json.data[0]!.count).toEqualTypeOf<number>()
|
|
283
|
+
expectTypeOf(json.data[0]!.failed).toEqualTypeOf<number>()
|
|
239
284
|
expectTypeOf(json.data[0]!.feeTotal).toEqualTypeOf<{ amount: string; currency: 'usd' }>()
|
|
240
285
|
expectTypeOf(json.data[0]!.timestamp).toEqualTypeOf<string>()
|
|
241
286
|
void json
|
|
@@ -278,6 +323,38 @@ describe('narrows responses by status', () => {
|
|
|
278
323
|
}
|
|
279
324
|
})
|
|
280
325
|
|
|
326
|
+
test('POST /v1/orgs/:orgId/billing/stripe/checkout', async () => {
|
|
327
|
+
const client = Client.create()
|
|
328
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].billing.stripe.checkout.$post({
|
|
329
|
+
param: { orgId: 'org_test' },
|
|
330
|
+
})
|
|
331
|
+
|
|
332
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 404 | 501 | 502 | PublicAccessStatus>()
|
|
333
|
+
|
|
334
|
+
switch (res.status) {
|
|
335
|
+
case 200: {
|
|
336
|
+
const json = await res.json()
|
|
337
|
+
expectTypeOf(json.url).toEqualTypeOf<string>()
|
|
338
|
+
void json
|
|
339
|
+
return
|
|
340
|
+
}
|
|
341
|
+
case 403: {
|
|
342
|
+
const json = await res.json()
|
|
343
|
+
expectTypeOf(json.error.code).toEqualTypeOf<
|
|
344
|
+
'api_key_forbidden' | 'early_access_required' | 'forbidden'
|
|
345
|
+
>()
|
|
346
|
+
void json
|
|
347
|
+
return
|
|
348
|
+
}
|
|
349
|
+
case 404: {
|
|
350
|
+
const json = await res.json()
|
|
351
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'organization_not_found'>()
|
|
352
|
+
void json
|
|
353
|
+
return
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
})
|
|
357
|
+
|
|
281
358
|
test('POST /v1/orgs/:orgId/billing/stripe/manage', async () => {
|
|
282
359
|
const client = Client.create()
|
|
283
360
|
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].billing.stripe.manage.$post({
|
|
@@ -388,6 +465,112 @@ describe('narrows responses by status', () => {
|
|
|
388
465
|
}
|
|
389
466
|
})
|
|
390
467
|
|
|
468
|
+
test('POST /v1/orgs/:orgId/verified-token-requests', async () => {
|
|
469
|
+
const client = Client.create()
|
|
470
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}']['verified-token-requests'].$post(
|
|
471
|
+
{
|
|
472
|
+
json: {
|
|
473
|
+
address: '0x20c00000000000000000000000000000000000aa',
|
|
474
|
+
chainId: 4217,
|
|
475
|
+
currency: 'USD',
|
|
476
|
+
decimals: 6,
|
|
477
|
+
name: 'Test USD',
|
|
478
|
+
symbol: 'tUSD',
|
|
479
|
+
},
|
|
480
|
+
param: { orgId: 'org_test' },
|
|
481
|
+
},
|
|
482
|
+
)
|
|
483
|
+
|
|
484
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 409 | 502>()
|
|
485
|
+
|
|
486
|
+
switch (res.status) {
|
|
487
|
+
case 200: {
|
|
488
|
+
const json = await res.json()
|
|
489
|
+
expectTypeOf(json.status).toEqualTypeOf<
|
|
490
|
+
z.output<typeof VerifiedTokenRequests.schema.VerifiedTokenRequest>['status']
|
|
491
|
+
>()
|
|
492
|
+
expectTypeOf(json.reviewNote).toEqualTypeOf<string | null>()
|
|
493
|
+
void json
|
|
494
|
+
return
|
|
495
|
+
}
|
|
496
|
+
case 404: {
|
|
497
|
+
const json = await res.json()
|
|
498
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'organization_not_found'>()
|
|
499
|
+
void json
|
|
500
|
+
return
|
|
501
|
+
}
|
|
502
|
+
case 409: {
|
|
503
|
+
const json = await res.json()
|
|
504
|
+
expectTypeOf(json.error.code).toEqualTypeOf<
|
|
505
|
+
| 'request_limit_reached'
|
|
506
|
+
| 'request_pending_exists'
|
|
507
|
+
| 'verified_symbol_exists'
|
|
508
|
+
| 'verified_token_exists'
|
|
509
|
+
>()
|
|
510
|
+
void json
|
|
511
|
+
return
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
})
|
|
515
|
+
|
|
516
|
+
test('GET /v1/orgs/:orgId/verified-token-requests', async () => {
|
|
517
|
+
const client = Client.create()
|
|
518
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}']['verified-token-requests'].$get({
|
|
519
|
+
param: { orgId: 'org_test' },
|
|
520
|
+
})
|
|
521
|
+
|
|
522
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 502>()
|
|
523
|
+
|
|
524
|
+
switch (res.status) {
|
|
525
|
+
case 200: {
|
|
526
|
+
const json = await res.json()
|
|
527
|
+
expectTypeOf(json.data[0]!.id).toEqualTypeOf<
|
|
528
|
+
z.output<typeof VerifiedTokenRequests.schema.VerifiedTokenRequest>['id']
|
|
529
|
+
>()
|
|
530
|
+
void json
|
|
531
|
+
return
|
|
532
|
+
}
|
|
533
|
+
case 404: {
|
|
534
|
+
const json = await res.json()
|
|
535
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'organization_not_found'>()
|
|
536
|
+
void json
|
|
537
|
+
return
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
})
|
|
541
|
+
|
|
542
|
+
test('DELETE /v1/orgs/:orgId/verified-token-requests/:requestId', async () => {
|
|
543
|
+
const client = Client.create()
|
|
544
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}']['verified-token-requests'][
|
|
545
|
+
':requestId{vtr_[A-Za-z0-9_-]+}'
|
|
546
|
+
].$delete({ param: { orgId: 'org_test', requestId: 'vtr_test' } })
|
|
547
|
+
|
|
548
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 409 | 502>()
|
|
549
|
+
|
|
550
|
+
switch (res.status) {
|
|
551
|
+
case 200: {
|
|
552
|
+
const json = await res.json()
|
|
553
|
+
expectTypeOf(json.id).toEqualTypeOf<string>()
|
|
554
|
+
void json
|
|
555
|
+
return
|
|
556
|
+
}
|
|
557
|
+
case 404: {
|
|
558
|
+
const json = await res.json()
|
|
559
|
+
expectTypeOf(json.error.code).toEqualTypeOf<
|
|
560
|
+
'organization_not_found' | 'verified_token_request_not_found'
|
|
561
|
+
>()
|
|
562
|
+
void json
|
|
563
|
+
return
|
|
564
|
+
}
|
|
565
|
+
case 409: {
|
|
566
|
+
const json = await res.json()
|
|
567
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'request_not_pending'>()
|
|
568
|
+
void json
|
|
569
|
+
return
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
})
|
|
573
|
+
|
|
391
574
|
test('GET /v1/orgs/:orgId/projects/:projectId', async () => {
|
|
392
575
|
const client = Client.create()
|
|
393
576
|
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].projects[
|
|
@@ -459,6 +642,14 @@ describe('narrows responses by status', () => {
|
|
|
459
642
|
void json
|
|
460
643
|
return
|
|
461
644
|
}
|
|
645
|
+
case 403: {
|
|
646
|
+
const json = await res.json()
|
|
647
|
+
expectTypeOf(json.error.code).toEqualTypeOf<
|
|
648
|
+
'early_access_required' | 'forbidden' | 'scope_not_issuable'
|
|
649
|
+
>()
|
|
650
|
+
void json
|
|
651
|
+
return
|
|
652
|
+
}
|
|
462
653
|
}
|
|
463
654
|
})
|
|
464
655
|
|
|
@@ -581,6 +772,48 @@ describe('narrows responses by status', () => {
|
|
|
581
772
|
}
|
|
582
773
|
})
|
|
583
774
|
|
|
775
|
+
test('POST /v1/orgs/:orgId/invite-links', async () => {
|
|
776
|
+
const client = Client.create()
|
|
777
|
+
const orgLinks = client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}']['invite-links']
|
|
778
|
+
const res = await orgLinks.$post({
|
|
779
|
+
json: { allowedEmailDomains: ['example.com'], name: 'Community' },
|
|
780
|
+
param: { orgId: 'org_test' },
|
|
781
|
+
})
|
|
782
|
+
await orgLinks.$post({ json: { name: 'Unrestricted' }, param: { orgId: 'org_test' } })
|
|
783
|
+
await orgLinks.$post({
|
|
784
|
+
json: { allowedEmailDomains: null },
|
|
785
|
+
param: { orgId: 'org_test' },
|
|
786
|
+
})
|
|
787
|
+
|
|
788
|
+
type Input = Parameters<typeof orgLinks.$post>[0]
|
|
789
|
+
expectTypeOf<Input['json']['allowedEmailDomains']>().toEqualTypeOf<
|
|
790
|
+
readonly string[] | null | undefined
|
|
791
|
+
>()
|
|
792
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 502>()
|
|
793
|
+
|
|
794
|
+
if (res.status === 200) {
|
|
795
|
+
const json = await res.json()
|
|
796
|
+
expectTypeOf(json.allowedEmailDomains).toEqualTypeOf<readonly string[] | null>()
|
|
797
|
+
expectTypeOf(json.allowedEmailDomains).toEqualTypeOf<
|
|
798
|
+
z.output<typeof InviteLinks.schema.InviteLink>['allowedEmailDomains']
|
|
799
|
+
>()
|
|
800
|
+
void json
|
|
801
|
+
}
|
|
802
|
+
})
|
|
803
|
+
|
|
804
|
+
test('POST /v1/invite-links/accept', async () => {
|
|
805
|
+
const client = Client.create()
|
|
806
|
+
const res = await client.v1['invite-links'].accept.$post({ json: { token: 'lnk_test' } })
|
|
807
|
+
|
|
808
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 502>()
|
|
809
|
+
|
|
810
|
+
if (res.status === 403) {
|
|
811
|
+
const json = await res.json()
|
|
812
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'forbidden' | 'invite_link_email_forbidden'>()
|
|
813
|
+
void json
|
|
814
|
+
}
|
|
815
|
+
})
|
|
816
|
+
|
|
584
817
|
test('POST /v1/invitations/:invitationId/accept', async () => {
|
|
585
818
|
const client = Client.create()
|
|
586
819
|
const res = await client.v1.invitations[':invitationId{inv_[A-Za-z0-9_-]+}'].accept.$post({
|
|
@@ -701,7 +934,9 @@ describe('narrows responses by status', () => {
|
|
|
701
934
|
|
|
702
935
|
test('GET /v1/transactions', async () => {
|
|
703
936
|
const client = Client.create()
|
|
704
|
-
const res = await client.v1.transactions.$get(
|
|
937
|
+
const res = await client.v1.transactions.$get({
|
|
938
|
+
query: { include: 'feeToken.logoUri,feeToken.verified' },
|
|
939
|
+
})
|
|
705
940
|
|
|
706
941
|
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
707
942
|
|
|
@@ -717,6 +952,12 @@ describe('narrows responses by status', () => {
|
|
|
717
952
|
expectTypeOf(json.data[0]!.meta.receipt?.gasUsed).toEqualTypeOf<
|
|
718
953
|
z.output<typeof Receipts.schema.Receipt>['gasUsed'] | undefined
|
|
719
954
|
>()
|
|
955
|
+
expectTypeOf(json.data[0]!.meta.receipt?.feeAmount).toEqualTypeOf<
|
|
956
|
+
ValuedTokenAmount | undefined
|
|
957
|
+
>()
|
|
958
|
+
expectTypeOf(json.data[0]!.feeToken).toEqualTypeOf<
|
|
959
|
+
z.output<typeof Tokens.schema.TokenReference> | undefined
|
|
960
|
+
>()
|
|
720
961
|
void json
|
|
721
962
|
return
|
|
722
963
|
}
|
|
@@ -743,6 +984,7 @@ describe('narrows responses by status', () => {
|
|
|
743
984
|
param: {
|
|
744
985
|
transactionHash: '0x515801d7f9a5ac705e793e85904c9c69b3f1694b465cc8fb6ba3f0298dc82665',
|
|
745
986
|
},
|
|
987
|
+
query: { include: 'feeToken.logoUri,feeToken.verified' },
|
|
746
988
|
})
|
|
747
989
|
|
|
748
990
|
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 404 | 502 | PaidAccessStatus>()
|
|
@@ -756,6 +998,10 @@ describe('narrows responses by status', () => {
|
|
|
756
998
|
expectTypeOf(json.meta.receipt?.status).toEqualTypeOf<
|
|
757
999
|
z.output<typeof Receipts.schema.Receipt>['status'] | undefined
|
|
758
1000
|
>()
|
|
1001
|
+
expectTypeOf(json.meta.receipt?.feeAmount).toEqualTypeOf<ValuedTokenAmount | undefined>()
|
|
1002
|
+
expectTypeOf(json.feeToken).toEqualTypeOf<
|
|
1003
|
+
z.output<typeof Tokens.schema.TokenReference> | undefined
|
|
1004
|
+
>()
|
|
759
1005
|
expectTypeOf(json.sender).toEqualTypeOf<
|
|
760
1006
|
z.output<typeof Transactions.schema.Transaction>['sender']
|
|
761
1007
|
>()
|
|
@@ -790,7 +1036,9 @@ describe('narrows responses by status', () => {
|
|
|
790
1036
|
|
|
791
1037
|
test('GET /v1/transactions/receipts', async () => {
|
|
792
1038
|
const client = Client.create()
|
|
793
|
-
const res = await client.v1.transactions.receipts.$get(
|
|
1039
|
+
const res = await client.v1.transactions.receipts.$get({
|
|
1040
|
+
query: { include: 'feeToken.logoUri,feeToken.verified' },
|
|
1041
|
+
})
|
|
794
1042
|
|
|
795
1043
|
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
796
1044
|
|
|
@@ -800,6 +1048,10 @@ describe('narrows responses by status', () => {
|
|
|
800
1048
|
expectTypeOf(json.data[0]!.transactionHash).toEqualTypeOf<
|
|
801
1049
|
z.output<typeof Receipts.schema.Receipt>['transactionHash']
|
|
802
1050
|
>()
|
|
1051
|
+
expectTypeOf(json.data[0]!.feeAmount).toEqualTypeOf<ValuedTokenAmount>()
|
|
1052
|
+
expectTypeOf(json.data[0]!.feeToken).toEqualTypeOf<
|
|
1053
|
+
z.output<typeof Tokens.schema.TokenReference> | undefined
|
|
1054
|
+
>()
|
|
803
1055
|
void json
|
|
804
1056
|
return
|
|
805
1057
|
}
|
|
@@ -826,6 +1078,7 @@ describe('narrows responses by status', () => {
|
|
|
826
1078
|
param: {
|
|
827
1079
|
transactionHash: '0x515801d7f9a5ac705e793e85904c9c69b3f1694b465cc8fb6ba3f0298dc82665',
|
|
828
1080
|
},
|
|
1081
|
+
query: { include: 'feeToken.logoUri,feeToken.verified' },
|
|
829
1082
|
})
|
|
830
1083
|
|
|
831
1084
|
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 404 | 502 | PaidAccessStatus>()
|
|
@@ -839,6 +1092,13 @@ describe('narrows responses by status', () => {
|
|
|
839
1092
|
expectTypeOf(json.sender).toEqualTypeOf<
|
|
840
1093
|
z.output<typeof Receipts.schema.Receipt>['sender']
|
|
841
1094
|
>()
|
|
1095
|
+
expectTypeOf(json.feeAmount).toEqualTypeOf<ValuedTokenAmount>()
|
|
1096
|
+
expectTypeOf(json.feeToken).toEqualTypeOf<
|
|
1097
|
+
z.output<typeof Tokens.schema.TokenReference> | undefined
|
|
1098
|
+
>()
|
|
1099
|
+
expectTypeOf(json.meta.pricing).toEqualTypeOf<
|
|
1100
|
+
z.output<typeof Valuation.schema.Pricing> | undefined
|
|
1101
|
+
>()
|
|
842
1102
|
void json
|
|
843
1103
|
return
|
|
844
1104
|
}
|
|
@@ -874,6 +1134,7 @@ describe('narrows responses by status', () => {
|
|
|
874
1134
|
param: {
|
|
875
1135
|
transactionHash: '0x4845ae2098724ab26a5d89370dce5124d044be6a5acc164afc348662de67d474',
|
|
876
1136
|
},
|
|
1137
|
+
query: { include: 'token.logoUri,token.verified' },
|
|
877
1138
|
})
|
|
878
1139
|
|
|
879
1140
|
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 404 | 502 | PaidAccessStatus>()
|
|
@@ -886,6 +1147,24 @@ describe('narrows responses by status', () => {
|
|
|
886
1147
|
typeof Activities.schema.getTransactionActivities.Response
|
|
887
1148
|
>['data'][number]['type']
|
|
888
1149
|
>()
|
|
1150
|
+
const item = json.data[0]!
|
|
1151
|
+
if (item.type === 'swap') {
|
|
1152
|
+
expectTypeOf(item.data.destinationAmount).toEqualTypeOf<ValuedTokenAmount>()
|
|
1153
|
+
// @ts-expect-error token references do not contain quantities
|
|
1154
|
+
void item.data.destinationToken.amount
|
|
1155
|
+
expectTypeOf(item.data.sourceAmount).toEqualTypeOf<ValuedTokenAmount>()
|
|
1156
|
+
expectTypeOf(item.data.sourceToken.currency).toEqualTypeOf<string>()
|
|
1157
|
+
expectTypeOf(item.data.sourceToken.decimals).toEqualTypeOf<number>()
|
|
1158
|
+
expectTypeOf(item.data.sourceToken.logoUri).toEqualTypeOf<string | undefined>()
|
|
1159
|
+
expectTypeOf(item.data.sourceToken.name).toEqualTypeOf<string>()
|
|
1160
|
+
expectTypeOf(item.data.sourceToken.symbol).toEqualTypeOf<string>()
|
|
1161
|
+
expectTypeOf(item.data.sourceToken.verified).toEqualTypeOf<boolean | undefined>()
|
|
1162
|
+
}
|
|
1163
|
+
if (item.type === 'session-closed') {
|
|
1164
|
+
expectTypeOf(item.data.refundAmount).toEqualTypeOf<ValuedTokenAmount | undefined>()
|
|
1165
|
+
// @ts-expect-error token references do not contain quantities
|
|
1166
|
+
void item.data.refund?.amount
|
|
1167
|
+
}
|
|
889
1168
|
void json
|
|
890
1169
|
return
|
|
891
1170
|
}
|
|
@@ -1077,6 +1356,7 @@ describe('narrows responses by status', () => {
|
|
|
1077
1356
|
const client = Client.create()
|
|
1078
1357
|
const res = await client.v1.tokens[':token'].transactions.$get({
|
|
1079
1358
|
param: { token: '0x20c0000000000000000000000000000000000000' },
|
|
1359
|
+
query: { include: 'feeToken.logoUri,feeToken.verified' },
|
|
1080
1360
|
})
|
|
1081
1361
|
|
|
1082
1362
|
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
@@ -1087,6 +1367,9 @@ describe('narrows responses by status', () => {
|
|
|
1087
1367
|
expectTypeOf(json.data[0]!.hash).toEqualTypeOf<
|
|
1088
1368
|
z.output<typeof Transactions.schema.Transaction>['hash']
|
|
1089
1369
|
>()
|
|
1370
|
+
expectTypeOf(json.data[0]!.feeToken).toEqualTypeOf<
|
|
1371
|
+
z.output<typeof Tokens.schema.TokenReference> | undefined
|
|
1372
|
+
>()
|
|
1090
1373
|
void json
|
|
1091
1374
|
return
|
|
1092
1375
|
}
|
|
@@ -1111,6 +1394,7 @@ describe('narrows responses by status', () => {
|
|
|
1111
1394
|
const client = Client.create()
|
|
1112
1395
|
const res = await client.v1.addresses[':address'].balances.$get({
|
|
1113
1396
|
param: { address: '0x0000000000000000000000000000000000000000' },
|
|
1397
|
+
query: {},
|
|
1114
1398
|
})
|
|
1115
1399
|
|
|
1116
1400
|
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
@@ -1122,11 +1406,17 @@ describe('narrows responses by status', () => {
|
|
|
1122
1406
|
z.output<typeof Balances.schema.getAddressBalances.Response>['data'][number]['amount']
|
|
1123
1407
|
>()
|
|
1124
1408
|
expectTypeOf(json.data[0]!.formatted).toEqualTypeOf<string>()
|
|
1409
|
+
expectTypeOf(json.data[0]!.currency).toEqualTypeOf<string>()
|
|
1410
|
+
expectTypeOf(json.data[0]!.decimals).toEqualTypeOf<number>()
|
|
1125
1411
|
// `feeEligible` is best-effort, so it is an optional boolean.
|
|
1126
1412
|
expectTypeOf(json.data[0]!.feeEligible).toEqualTypeOf<boolean | undefined>()
|
|
1127
|
-
expectTypeOf(json.data[0]!.token).toEqualTypeOf<
|
|
1128
|
-
|
|
1129
|
-
|
|
1413
|
+
expectTypeOf(json.data[0]!.token.logoUri).toEqualTypeOf<string | undefined>()
|
|
1414
|
+
expectTypeOf(json.data[0]!.token.verified).toEqualTypeOf<boolean>()
|
|
1415
|
+
// `valuation` is `null` for unverified or unpriceable holdings.
|
|
1416
|
+
expectTypeOf(json.data[0]!.valuation).toEqualTypeOf<{
|
|
1417
|
+
amount: string
|
|
1418
|
+
currency: string
|
|
1419
|
+
} | null>()
|
|
1130
1420
|
// `meta` (opt-in `include=totalCount` capped count) is optional.
|
|
1131
1421
|
expectTypeOf(json.meta).toEqualTypeOf<
|
|
1132
1422
|
z.output<typeof Balances.schema.getAddressBalances.Response>['meta']
|
|
@@ -1153,6 +1443,48 @@ describe('narrows responses by status', () => {
|
|
|
1153
1443
|
}
|
|
1154
1444
|
})
|
|
1155
1445
|
|
|
1446
|
+
test('GET /v1/addresses/:address/valuation', async () => {
|
|
1447
|
+
const client = Client.create()
|
|
1448
|
+
const res = await client.v1.addresses[':address'].valuation.$get({
|
|
1449
|
+
param: { address: '0x0000000000000000000000000000000000000000' },
|
|
1450
|
+
query: {},
|
|
1451
|
+
})
|
|
1452
|
+
|
|
1453
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
1454
|
+
|
|
1455
|
+
switch (res.status) {
|
|
1456
|
+
case 200: {
|
|
1457
|
+
const json = await res.json()
|
|
1458
|
+
expectTypeOf(json.amount).toEqualTypeOf<string>()
|
|
1459
|
+
expectTypeOf(json.currency).toEqualTypeOf<string>()
|
|
1460
|
+
expectTypeOf(json.id).toEqualTypeOf<string>()
|
|
1461
|
+
// `pricing` is `null` when no currency conversion was needed.
|
|
1462
|
+
expectTypeOf(json.pricing).toEqualTypeOf<
|
|
1463
|
+
z.output<typeof Valuation.schema.getAddressValuation.Response>['pricing']
|
|
1464
|
+
>()
|
|
1465
|
+
expectTypeOf(json.unpriced).toEqualTypeOf<string[]>()
|
|
1466
|
+
void json
|
|
1467
|
+
return
|
|
1468
|
+
}
|
|
1469
|
+
case 400: {
|
|
1470
|
+
const json = await res.json()
|
|
1471
|
+
expectTypeOf(json.error.code).toEqualTypeOf<
|
|
1472
|
+
Access400<'address_invalid' | 'query_invalid'>
|
|
1473
|
+
>()
|
|
1474
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
1475
|
+
void json
|
|
1476
|
+
return
|
|
1477
|
+
}
|
|
1478
|
+
case 502: {
|
|
1479
|
+
const json = await res.json()
|
|
1480
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
1481
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
1482
|
+
void json
|
|
1483
|
+
return
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
})
|
|
1487
|
+
|
|
1156
1488
|
test('GET /v1/transfers', async () => {
|
|
1157
1489
|
const client = Client.create()
|
|
1158
1490
|
const res = await client.v1.transfers.$get()
|
|
@@ -1171,6 +1503,10 @@ describe('narrows responses by status', () => {
|
|
|
1171
1503
|
expectTypeOf(json.data[0]!.attribution).toEqualTypeOf<
|
|
1172
1504
|
z.output<typeof Transfers.schema.getTransfers.Transfer>['attribution']
|
|
1173
1505
|
>()
|
|
1506
|
+
// `valuation` is `null` for unverified or unpriceable legs.
|
|
1507
|
+
expectTypeOf(json.data[0]!.sourceToken.valuation).toEqualTypeOf<
|
|
1508
|
+
{ amount: string; currency: string } | null | undefined
|
|
1509
|
+
>()
|
|
1174
1510
|
// `meta` (the opt-in `include=totalCount` capped count) is optional.
|
|
1175
1511
|
expectTypeOf(json.meta).toEqualTypeOf<
|
|
1176
1512
|
z.output<typeof Transfers.schema.getTransfers.Response>['meta']
|
|
@@ -1215,7 +1551,7 @@ describe('narrows responses by status', () => {
|
|
|
1215
1551
|
z.output<typeof Funding.schema.quoteFunding.Response>['data'][number]['sourceAmount']
|
|
1216
1552
|
>()
|
|
1217
1553
|
expectTypeOf(json.data[0]!.provider.id).toEqualTypeOf<
|
|
1218
|
-
'across' | 'relay' | 'rhino' | 'squid'
|
|
1554
|
+
'across' | 'relay' | 'rhino' | 'squid' | 'symbiosis'
|
|
1219
1555
|
>()
|
|
1220
1556
|
expectTypeOf(json.data[0]!.quote.expiresAt).toEqualTypeOf<string | undefined>()
|
|
1221
1557
|
expectTypeOf(json.data[0]!.quote.outputAmount).toEqualTypeOf<string>()
|
|
@@ -1303,6 +1639,14 @@ describe('narrows responses by status', () => {
|
|
|
1303
1639
|
expectTypeOf(json.data[0]!.transactionHash).toEqualTypeOf<
|
|
1304
1640
|
z.output<typeof Exchanges.schema.getSwaps.Response>['data'][number]['transactionHash']
|
|
1305
1641
|
>()
|
|
1642
|
+
expectTypeOf(json.data[0]!.destinationAmount).toEqualTypeOf<ValuedTokenAmount>()
|
|
1643
|
+
expectTypeOf(json.data[0]!.sourceAmount).toEqualTypeOf<ValuedTokenAmount>()
|
|
1644
|
+
expectTypeOf(json.data[0]!.fills[0]!.destinationAmount).toEqualTypeOf<ValuedTokenAmount>()
|
|
1645
|
+
expectTypeOf(json.data[0]!.fills[0]!.sourceAmount).toEqualTypeOf<ValuedTokenAmount>()
|
|
1646
|
+
// @ts-expect-error token references do not contain quantities
|
|
1647
|
+
void json.data[0]!.sourceToken.amount
|
|
1648
|
+
// @ts-expect-error token references do not contain quantities
|
|
1649
|
+
void json.data[0]!.fills[0]!.destinationToken.amount
|
|
1306
1650
|
void json
|
|
1307
1651
|
return
|
|
1308
1652
|
}
|
|
@@ -1323,6 +1667,90 @@ describe('narrows responses by status', () => {
|
|
|
1323
1667
|
}
|
|
1324
1668
|
})
|
|
1325
1669
|
|
|
1670
|
+
test('POST /v1/exchange/quotes', async () => {
|
|
1671
|
+
const client = Client.create()
|
|
1672
|
+
const res = await client.v1.exchange.quotes.$post({
|
|
1673
|
+
json: {
|
|
1674
|
+
amount: '1000000',
|
|
1675
|
+
destinationToken: '0x20c000000000000000000000b9537d11c60e8b50',
|
|
1676
|
+
mode: 'exactSource',
|
|
1677
|
+
slippageBps: 50,
|
|
1678
|
+
sourceToken: '0x20c0000000000000000000008f5425160ebe5525',
|
|
1679
|
+
},
|
|
1680
|
+
query: { include: 'token.logoUri,token.verified' },
|
|
1681
|
+
})
|
|
1682
|
+
|
|
1683
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 404 | 502 | PaidAccessStatus>()
|
|
1684
|
+
|
|
1685
|
+
switch (res.status) {
|
|
1686
|
+
case 200: {
|
|
1687
|
+
const json = await res.json()
|
|
1688
|
+
expectTypeOf(json.destinationAmount).toEqualTypeOf<ValuedTokenAmount>()
|
|
1689
|
+
// @ts-expect-error token references do not contain quantities
|
|
1690
|
+
void json.destinationToken.amount
|
|
1691
|
+
expectTypeOf(json.destinationToken.logoUri).toEqualTypeOf<string | undefined>()
|
|
1692
|
+
expectTypeOf(json.destinationToken.symbol).toEqualTypeOf<string>()
|
|
1693
|
+
expectTypeOf(json.destinationToken.verified).toEqualTypeOf<boolean | undefined>()
|
|
1694
|
+
expectTypeOf(json.meta?.pricing).toEqualTypeOf<
|
|
1695
|
+
z.output<typeof Valuation.schema.Pricing> | undefined
|
|
1696
|
+
>()
|
|
1697
|
+
expectTypeOf(json.sourceAmount).toEqualTypeOf<ValuedTokenAmount>()
|
|
1698
|
+
// @ts-expect-error token references do not contain quantities
|
|
1699
|
+
void json.sourceToken.amount
|
|
1700
|
+
expectTypeOf(json.sourceToken.logoUri).toEqualTypeOf<string | undefined>()
|
|
1701
|
+
expectTypeOf(json.sourceToken.symbol).toEqualTypeOf<string>()
|
|
1702
|
+
expectTypeOf(json.sourceToken.verified).toEqualTypeOf<boolean | undefined>()
|
|
1703
|
+
expectTypeOf(json.transaction.calls[0]!.data).toEqualTypeOf<
|
|
1704
|
+
z.output<
|
|
1705
|
+
typeof Exchanges.schema.createQuote.Response
|
|
1706
|
+
>['transaction']['calls'][number]['data']
|
|
1707
|
+
>()
|
|
1708
|
+
if (json.mode === 'exactSource') {
|
|
1709
|
+
expectTypeOf(json.destinationAmountMin).toEqualTypeOf<ValuedTokenAmount>()
|
|
1710
|
+
// @ts-expect-error slippage quantities live on destinationAmountMin
|
|
1711
|
+
void json.destinationToken.minimumAmount
|
|
1712
|
+
// @ts-expect-error exact-source responses do not carry a maximum source amount
|
|
1713
|
+
void json.sourceAmountMax
|
|
1714
|
+
// @ts-expect-error token references do not contain quantities
|
|
1715
|
+
void json.sourceToken.maximumAmount
|
|
1716
|
+
} else {
|
|
1717
|
+
expectTypeOf(json.sourceAmountMax).toEqualTypeOf<ValuedTokenAmount>()
|
|
1718
|
+
// @ts-expect-error slippage quantities live on sourceAmountMax
|
|
1719
|
+
void json.sourceToken.maximumAmount
|
|
1720
|
+
// @ts-expect-error exact-destination responses do not carry a minimum destination amount
|
|
1721
|
+
void json.destinationAmountMin
|
|
1722
|
+
// @ts-expect-error token references do not contain quantities
|
|
1723
|
+
void json.destinationToken.minimumAmount
|
|
1724
|
+
}
|
|
1725
|
+
void json
|
|
1726
|
+
return
|
|
1727
|
+
}
|
|
1728
|
+
case 400: {
|
|
1729
|
+
const json = await res.json()
|
|
1730
|
+
expectTypeOf(json.error.code).toEqualTypeOf<
|
|
1731
|
+
Access400<'body_invalid' | 'query_invalid' | 'quote_amount_out_of_range'>
|
|
1732
|
+
>()
|
|
1733
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
1734
|
+
void json
|
|
1735
|
+
return
|
|
1736
|
+
}
|
|
1737
|
+
case 404: {
|
|
1738
|
+
const json = await res.json()
|
|
1739
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'quote_not_available'>()
|
|
1740
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
1741
|
+
void json
|
|
1742
|
+
return
|
|
1743
|
+
}
|
|
1744
|
+
case 502: {
|
|
1745
|
+
const json = await res.json()
|
|
1746
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'upstream_error'>()
|
|
1747
|
+
expectTypeOf(json.error.message).toEqualTypeOf<string>()
|
|
1748
|
+
void json
|
|
1749
|
+
return
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
})
|
|
1753
|
+
|
|
1326
1754
|
test('GET /v1/exchange/pairs', async () => {
|
|
1327
1755
|
const client = Client.create()
|
|
1328
1756
|
const res = await client.v1.exchange.pairs.$get()
|
|
@@ -1902,6 +2330,7 @@ describe('narrows responses by status', () => {
|
|
|
1902
2330
|
const client = Client.create()
|
|
1903
2331
|
const res = await client.v1.addresses[':address'].activities.$get({
|
|
1904
2332
|
param: { address: '0x0000000000000000000000000000000000000000' },
|
|
2333
|
+
query: { include: 'token.logoUri,token.verified' },
|
|
1905
2334
|
})
|
|
1906
2335
|
|
|
1907
2336
|
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 502 | PaidAccessStatus>()
|
|
@@ -1912,6 +2341,17 @@ describe('narrows responses by status', () => {
|
|
|
1912
2341
|
expectTypeOf(json.data[0]!.type).toEqualTypeOf<
|
|
1913
2342
|
z.output<typeof Activities.schema.getAddressActivities.Response>['data'][number]['type']
|
|
1914
2343
|
>()
|
|
2344
|
+
const entry = json.data[0]!
|
|
2345
|
+
if (entry.type === 'transfer') {
|
|
2346
|
+
expectTypeOf(entry.data.destinationAmount).toEqualTypeOf<ValuedTokenAmount | undefined>()
|
|
2347
|
+
expectTypeOf(entry.data.sourceAmount).toEqualTypeOf<ValuedTokenAmount>()
|
|
2348
|
+
// @ts-expect-error token references do not contain quantities
|
|
2349
|
+
void entry.data.sourceToken.amount
|
|
2350
|
+
expectTypeOf(entry.data.sourceToken.currency).toEqualTypeOf<string>()
|
|
2351
|
+
expectTypeOf(entry.data.sourceToken.decimals).toEqualTypeOf<number>()
|
|
2352
|
+
expectTypeOf(entry.data.sourceToken.name).toEqualTypeOf<string>()
|
|
2353
|
+
expectTypeOf(entry.data.sourceToken.symbol).toEqualTypeOf<string>()
|
|
2354
|
+
}
|
|
1915
2355
|
void json
|
|
1916
2356
|
return
|
|
1917
2357
|
}
|
|
@@ -1971,6 +2411,16 @@ describe('narrows responses by status', () => {
|
|
|
1971
2411
|
>()
|
|
1972
2412
|
void json
|
|
1973
2413
|
}
|
|
2414
|
+
if (res.status === 400) {
|
|
2415
|
+
const json = await res.json()
|
|
2416
|
+
expectTypeOf(json.error.code).toEqualTypeOf<
|
|
2417
|
+
Access400<'body_invalid' | 'chain_id_unsupported' | 'filters_invalid' | 'url_invalid'>
|
|
2418
|
+
>()
|
|
2419
|
+
}
|
|
2420
|
+
if (res.status === 403) {
|
|
2421
|
+
const json = await res.json()
|
|
2422
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'api_key_forbidden' | 'limit_exceeded'>()
|
|
2423
|
+
}
|
|
1974
2424
|
})
|
|
1975
2425
|
|
|
1976
2426
|
test('GET /v1/webhooks', async () => {
|
|
@@ -2095,6 +2545,18 @@ describe('narrows responses by status', () => {
|
|
|
2095
2545
|
>()
|
|
2096
2546
|
void json
|
|
2097
2547
|
}
|
|
2548
|
+
if (res.status === 400) {
|
|
2549
|
+
const json = await res.json()
|
|
2550
|
+
expectTypeOf(json.error.code).toEqualTypeOf<
|
|
2551
|
+
Access400<
|
|
2552
|
+
| 'body_invalid'
|
|
2553
|
+
| 'destination_transition_invalid'
|
|
2554
|
+
| 'filters_invalid'
|
|
2555
|
+
| 'param_invalid'
|
|
2556
|
+
| 'url_invalid'
|
|
2557
|
+
>
|
|
2558
|
+
>()
|
|
2559
|
+
}
|
|
2098
2560
|
})
|
|
2099
2561
|
|
|
2100
2562
|
test('DELETE /v1/webhooks/:id', async () => {
|
|
@@ -2113,4 +2575,174 @@ describe('narrows responses by status', () => {
|
|
|
2113
2575
|
void json
|
|
2114
2576
|
}
|
|
2115
2577
|
})
|
|
2578
|
+
|
|
2579
|
+
test('POST /v1/orgs/:orgId/webhooks', async () => {
|
|
2580
|
+
const client = Client.create()
|
|
2581
|
+
void client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].webhooks.$post({
|
|
2582
|
+
// @ts-expect-error Organization webhook creation requires an explicit chain id.
|
|
2583
|
+
json: {
|
|
2584
|
+
destination: { type: 'url', url: 'https://example.com/webhook' },
|
|
2585
|
+
eventType: 'token:transfer',
|
|
2586
|
+
filters: {},
|
|
2587
|
+
},
|
|
2588
|
+
param: { orgId: 'org_test' },
|
|
2589
|
+
})
|
|
2590
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].webhooks.$post({
|
|
2591
|
+
json: {
|
|
2592
|
+
chainId: 4217,
|
|
2593
|
+
destination: { type: 'url', url: 'https://example.com/webhook' },
|
|
2594
|
+
eventType: 'token:transfer',
|
|
2595
|
+
filters: {},
|
|
2596
|
+
},
|
|
2597
|
+
param: { orgId: 'org_test' },
|
|
2598
|
+
})
|
|
2599
|
+
|
|
2600
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 502>()
|
|
2601
|
+
|
|
2602
|
+
if (res.status === 200) {
|
|
2603
|
+
const json = await res.json()
|
|
2604
|
+
if ('secret' in json) {
|
|
2605
|
+
expectTypeOf(json.destination.type).toEqualTypeOf<'url'>()
|
|
2606
|
+
expectTypeOf(json.secret).toEqualTypeOf<string>()
|
|
2607
|
+
} else expectTypeOf(json.destination.type).toEqualTypeOf<'betterstack' | 'slack'>()
|
|
2608
|
+
expectTypeOf(json.status).toEqualTypeOf<
|
|
2609
|
+
z.output<typeof OrgWebhooks.schema.createWebhook.Response>['status']
|
|
2610
|
+
>()
|
|
2611
|
+
}
|
|
2612
|
+
if (res.status === 403) {
|
|
2613
|
+
const json = await res.json()
|
|
2614
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'forbidden' | 'limit_exceeded'>()
|
|
2615
|
+
}
|
|
2616
|
+
})
|
|
2617
|
+
|
|
2618
|
+
test('GET /v1/orgs/:orgId/webhooks', async () => {
|
|
2619
|
+
const client = Client.create()
|
|
2620
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].webhooks.$get({
|
|
2621
|
+
param: { orgId: 'org_test' },
|
|
2622
|
+
})
|
|
2623
|
+
|
|
2624
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 502>()
|
|
2625
|
+
|
|
2626
|
+
if (res.status === 200) {
|
|
2627
|
+
const json = await res.json()
|
|
2628
|
+
expectTypeOf(json.data[0]!.id).toEqualTypeOf<string>()
|
|
2629
|
+
}
|
|
2630
|
+
})
|
|
2631
|
+
|
|
2632
|
+
test('GET /v1/orgs/:orgId/webhooks/:id/deliveries', async () => {
|
|
2633
|
+
const client = Client.create()
|
|
2634
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].webhooks[
|
|
2635
|
+
':id{wh_[A-Za-z0-9_-]+}'
|
|
2636
|
+
].deliveries.$get({
|
|
2637
|
+
param: { id: 'wh_test', orgId: 'org_test' },
|
|
2638
|
+
})
|
|
2639
|
+
|
|
2640
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 502>()
|
|
2641
|
+
|
|
2642
|
+
if (res.status === 200) {
|
|
2643
|
+
const json = await res.json()
|
|
2644
|
+
expectTypeOf(json.data[0]!.id).toEqualTypeOf<
|
|
2645
|
+
z.output<typeof OrgWebhooks.schema.listWebhookDeliveries.Response>['data'][number]['id']
|
|
2646
|
+
>()
|
|
2647
|
+
expectTypeOf(json.meta).toEqualTypeOf<
|
|
2648
|
+
z.output<typeof OrgWebhooks.schema.listWebhookDeliveries.Response>['meta']
|
|
2649
|
+
>()
|
|
2650
|
+
void json
|
|
2651
|
+
}
|
|
2652
|
+
})
|
|
2653
|
+
|
|
2654
|
+
test('GET /v1/orgs/:orgId/webhooks/:id/deliveries/:deliveryId', async () => {
|
|
2655
|
+
const client = Client.create()
|
|
2656
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].webhooks[
|
|
2657
|
+
':id{wh_[A-Za-z0-9_-]+}'
|
|
2658
|
+
].deliveries[':deliveryId'].$get({
|
|
2659
|
+
param: { deliveryId: 'whd_test', id: 'wh_test', orgId: 'org_test' },
|
|
2660
|
+
})
|
|
2661
|
+
|
|
2662
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 502>()
|
|
2663
|
+
|
|
2664
|
+
if (res.status === 200) {
|
|
2665
|
+
const json = await res.json()
|
|
2666
|
+
expectTypeOf(json.envelope.type).toEqualTypeOf<
|
|
2667
|
+
z.output<typeof OrgWebhooks.schema.getWebhookDelivery.Response>['envelope']['type']
|
|
2668
|
+
>()
|
|
2669
|
+
if (json.envelope.type === 'block:created')
|
|
2670
|
+
expectTypeOf(json.envelope.data.number).toEqualTypeOf<number>()
|
|
2671
|
+
expectTypeOf(json.requestUrl).toEqualTypeOf<string>()
|
|
2672
|
+
void json
|
|
2673
|
+
}
|
|
2674
|
+
if (res.status === 404) {
|
|
2675
|
+
const json = await res.json()
|
|
2676
|
+
expectTypeOf(json.error.code).toEqualTypeOf<
|
|
2677
|
+
| 'delivery_not_found'
|
|
2678
|
+
| 'organization_not_found'
|
|
2679
|
+
| 'webhook_not_found'
|
|
2680
|
+
| 'webhooks_not_enabled'
|
|
2681
|
+
>()
|
|
2682
|
+
}
|
|
2683
|
+
})
|
|
2684
|
+
|
|
2685
|
+
test('POST /v1/orgs/:orgId/webhooks/:id/deliveries/:deliveryId/retry', async () => {
|
|
2686
|
+
const client = Client.create()
|
|
2687
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].webhooks[
|
|
2688
|
+
':id{wh_[A-Za-z0-9_-]+}'
|
|
2689
|
+
].deliveries[':deliveryId'].retry.$post({
|
|
2690
|
+
param: { deliveryId: 'whd_test', id: 'wh_test', orgId: 'org_test' },
|
|
2691
|
+
})
|
|
2692
|
+
|
|
2693
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 502>()
|
|
2694
|
+
|
|
2695
|
+
if (res.status === 200) {
|
|
2696
|
+
const json = await res.json()
|
|
2697
|
+
expectTypeOf(json.eventId).toEqualTypeOf<
|
|
2698
|
+
z.output<typeof OrgWebhooks.schema.retryWebhookDelivery.Response>['eventId']
|
|
2699
|
+
>()
|
|
2700
|
+
void json
|
|
2701
|
+
}
|
|
2702
|
+
if (res.status === 403) {
|
|
2703
|
+
const json = await res.json()
|
|
2704
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'forbidden'>()
|
|
2705
|
+
}
|
|
2706
|
+
})
|
|
2707
|
+
|
|
2708
|
+
test('PATCH /v1/orgs/:orgId/webhooks/:id', async () => {
|
|
2709
|
+
const client = Client.create()
|
|
2710
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].webhooks[
|
|
2711
|
+
':id{wh_[A-Za-z0-9_-]+}'
|
|
2712
|
+
].$patch({
|
|
2713
|
+
json: { status: 'paused' },
|
|
2714
|
+
param: { id: 'wh_test', orgId: 'org_test' },
|
|
2715
|
+
})
|
|
2716
|
+
|
|
2717
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 502>()
|
|
2718
|
+
|
|
2719
|
+
if (res.status === 200) {
|
|
2720
|
+
const json = await res.json()
|
|
2721
|
+
expectTypeOf(json.status).toEqualTypeOf<
|
|
2722
|
+
z.output<typeof OrgWebhooks.schema.Subscription>['status']
|
|
2723
|
+
>()
|
|
2724
|
+
}
|
|
2725
|
+
if (res.status === 403) {
|
|
2726
|
+
const json = await res.json()
|
|
2727
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'forbidden'>()
|
|
2728
|
+
}
|
|
2729
|
+
})
|
|
2730
|
+
|
|
2731
|
+
test('DELETE /v1/orgs/:orgId/webhooks/:id', async () => {
|
|
2732
|
+
const client = Client.create()
|
|
2733
|
+
const res = await client.v1.orgs[':orgId{org_[A-Za-z0-9_-]+}'].webhooks[
|
|
2734
|
+
':id{wh_[A-Za-z0-9_-]+}'
|
|
2735
|
+
].$delete({ param: { id: 'wh_test', orgId: 'org_test' } })
|
|
2736
|
+
|
|
2737
|
+
expectTypeOf(res.status).toEqualTypeOf<200 | 400 | 401 | 403 | 404 | 502>()
|
|
2738
|
+
|
|
2739
|
+
if (res.status === 200) {
|
|
2740
|
+
const json = await res.json()
|
|
2741
|
+
expectTypeOf(json).toEqualTypeOf<z.output<typeof OrgWebhooks.schema.DeleteResponse>>()
|
|
2742
|
+
}
|
|
2743
|
+
if (res.status === 403) {
|
|
2744
|
+
const json = await res.json()
|
|
2745
|
+
expectTypeOf(json.error.code).toEqualTypeOf<'forbidden'>()
|
|
2746
|
+
}
|
|
2747
|
+
})
|
|
2116
2748
|
})
|