tapimo 0.10.0 → 0.10.1
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/ApiKey.d.ts +2 -1
- package/dist/ApiKey.d.ts.map +1 -1
- package/dist/ApiKeys.d.ts +4 -2
- package/dist/ApiKeys.d.ts.map +1 -1
- package/dist/ApiKeys.js +26 -1
- package/dist/ApiKeys.js.map +1 -1
- package/dist/App.d.ts +3346 -2575
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +1 -0
- package/dist/App.js.map +1 -1
- package/dist/Webhooks.d.ts.map +1 -1
- package/dist/Webhooks.js +5 -5
- package/dist/Webhooks.js.map +1 -1
- package/dist/admin/App.d.ts +91 -84
- package/dist/admin/App.d.ts.map +1 -1
- package/dist/admin/apps/api-keys.d.ts +26 -17
- package/dist/admin/apps/api-keys.d.ts.map +1 -1
- package/dist/admin/apps/api-keys.js +6 -0
- package/dist/admin/apps/api-keys.js.map +1 -1
- package/dist/admin/apps/organizations.d.ts +4 -2
- package/dist/admin/apps/organizations.d.ts.map +1 -1
- package/dist/admin/ui.generated.d.ts +1 -1
- package/dist/admin/ui.generated.js +69 -69
- package/dist/admin/ui.generated.js.map +1 -1
- package/dist/analytics/Analytics.d.ts.map +1 -1
- package/dist/analytics/Analytics.js +26 -0
- package/dist/analytics/Analytics.js.map +1 -1
- package/dist/apps/Zones.d.ts +4266 -82
- package/dist/apps/Zones.d.ts.map +1 -1
- package/dist/apps/Zones.js +27 -8
- package/dist/apps/Zones.js.map +1 -1
- package/dist/apps/data/App.d.ts +3467 -2696
- package/dist/apps/data/App.d.ts.map +1 -1
- package/dist/apps/data/routes/activities.d.ts +2999 -100
- package/dist/apps/data/routes/activities.d.ts.map +1 -1
- package/dist/apps/data/routes/activities.js +340 -2
- package/dist/apps/data/routes/activities.js.map +1 -1
- package/dist/apps/data/routes/addresses.d.ts +850 -336
- package/dist/apps/data/routes/addresses.d.ts.map +1 -1
- package/dist/apps/data/routes/balances.d.ts +26 -26
- package/dist/apps/data/routes/balances.d.ts.map +1 -1
- package/dist/apps/data/routes/balances.js +11 -3
- package/dist/apps/data/routes/balances.js.map +1 -1
- package/dist/apps/data/routes/blocks.d.ts +4 -4
- package/dist/apps/data/routes/coingecko.d.ts +176 -176
- package/dist/apps/data/routes/earn.d.ts +75 -75
- package/dist/apps/data/routes/earn.js +2 -2
- package/dist/apps/data/routes/earn.js.map +1 -1
- package/dist/apps/data/routes/exchanges.d.ts +120 -120
- package/dist/apps/data/routes/fee-amm.d.ts +24 -24
- package/dist/apps/data/routes/indexer.d.ts +35 -34
- package/dist/apps/data/routes/indexer.d.ts.map +1 -1
- package/dist/apps/data/routes/indexer.js +3 -2
- package/dist/apps/data/routes/indexer.js.map +1 -1
- package/dist/apps/data/routes/rpc.d.ts.map +1 -1
- package/dist/apps/data/routes/rpc.js +5 -1
- package/dist/apps/data/routes/rpc.js.map +1 -1
- package/dist/apps/data/routes/tokenlist.d.ts +12 -12
- package/dist/apps/data/routes/transactions.d.ts +281 -281
- package/dist/apps/data/routes/verified-tokens.d.ts +37 -37
- package/dist/apps/data/routes/webhooks.d.ts +418 -364
- package/dist/apps/data/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/data/routes/webhooks.js +161 -14
- package/dist/apps/data/routes/webhooks.js.map +1 -1
- package/dist/apps/data/routes/zones.d.ts +31 -31
- package/dist/apps/data/routes/zones.js +1 -1
- package/dist/apps/data/routes/zones.js.map +1 -1
- package/dist/apps/funding/App.d.ts +96 -96
- package/dist/apps/funding/routes/deposit-addresses.d.ts +52 -52
- package/dist/apps/funding/routes/deposit-addresses.js +1 -1
- package/dist/apps/funding/routes/deposit-addresses.js.map +1 -1
- package/dist/apps/funding/routes/providers.d.ts +13 -13
- package/dist/apps/funding/routes/transfers.d.ts +32 -32
- package/dist/apps/funding/routes/transfers.js +1 -1
- package/dist/apps/funding/routes/transfers.js.map +1 -1
- package/dist/apps/management/App.d.ts +418 -418
- package/dist/apps/management/routes/api-keys.d.ts +50 -50
- package/dist/apps/management/routes/billing.d.ts +72 -72
- package/dist/apps/management/routes/billing.js +1 -1
- package/dist/apps/management/routes/billing.js.map +1 -1
- package/dist/apps/management/routes/faucet.d.ts +37 -37
- package/dist/apps/management/routes/faucet.js +2 -2
- package/dist/apps/management/routes/faucet.js.map +1 -1
- package/dist/apps/management/routes/invite-links.d.ts +42 -42
- package/dist/apps/management/routes/me.d.ts +6 -6
- package/dist/apps/management/routes/members.d.ts +75 -75
- package/dist/apps/management/routes/projects.d.ts +40 -40
- package/dist/apps/management/routes/usage.d.ts +76 -76
- package/dist/apps/management/routes/webhooks.d.ts +49 -49
- package/dist/apps/mcp.d.ts.map +1 -1
- package/dist/apps/mcp.js +4 -1
- package/dist/apps/mcp.js.map +1 -1
- package/dist/db/Db.d.ts +2 -0
- package/dist/db/Db.d.ts.map +1 -1
- package/dist/db/Db.js +58 -0
- package/dist/db/Db.js.map +1 -1
- package/dist/db/Schema.d.ts +19 -0
- package/dist/db/Schema.d.ts.map +1 -1
- package/dist/db/Schema.js +24 -0
- package/dist/db/Schema.js.map +1 -1
- package/dist/db/tables/webhookQueueEvents.d.ts +122 -0
- package/dist/db/tables/webhookQueueEvents.d.ts.map +1 -0
- package/dist/db/tables/webhookQueueEvents.js +160 -0
- package/dist/db/tables/webhookQueueEvents.js.map +1 -0
- package/dist/db/tables/webhookSubscriptions.d.ts +2 -0
- package/dist/db/tables/webhookSubscriptions.d.ts.map +1 -1
- package/dist/db/tables/webhookSubscriptions.js +10 -0
- package/dist/db/tables/webhookSubscriptions.js.map +1 -1
- package/dist/internal/Auth.d.ts +3 -0
- package/dist/internal/Auth.d.ts.map +1 -1
- package/dist/internal/Auth.js +6 -4
- package/dist/internal/Auth.js.map +1 -1
- package/dist/internal/MetricSink.d.ts +27 -0
- package/dist/internal/MetricSink.d.ts.map +1 -1
- package/dist/internal/MetricSink.js +29 -2
- package/dist/internal/MetricSink.js.map +1 -1
- package/dist/internal/RateLimit.d.ts +4 -6
- package/dist/internal/RateLimit.d.ts.map +1 -1
- package/dist/internal/RateLimit.js +15 -14
- package/dist/internal/RateLimit.js.map +1 -1
- package/dist/internal/Store.d.ts +2 -1
- package/dist/internal/Store.d.ts.map +1 -1
- package/dist/internal/Store.js +57 -18
- package/dist/internal/Store.js.map +1 -1
- package/dist/internal/Value.d.ts +2 -0
- package/dist/internal/Value.d.ts.map +1 -1
- package/dist/internal/Value.js +25 -0
- package/dist/internal/Value.js.map +1 -1
- package/dist/internal/WebhookTransfer.d.ts +20 -0
- package/dist/internal/WebhookTransfer.d.ts.map +1 -1
- package/dist/internal/WebhookTransfer.js +7 -4
- package/dist/internal/WebhookTransfer.js.map +1 -1
- package/dist/internal/Webhooks.d.ts +139 -0
- package/dist/internal/Webhooks.d.ts.map +1 -1
- package/dist/internal/Webhooks.js +129 -7
- package/dist/internal/Webhooks.js.map +1 -1
- package/dist/internal/funding/providers/relay.d.ts +3 -4
- package/dist/internal/funding/providers/relay.d.ts.map +1 -1
- package/dist/internal/funding/providers/relay.js +59 -8
- package/dist/internal/funding/providers/relay.js.map +1 -1
- package/package.json +3 -3
- package/src/ApiKeys.test.ts +20 -0
- package/src/ApiKeys.ts +28 -1
- package/src/App.test.ts +10 -8
- package/src/App.ts +1 -0
- package/src/Client.test-d.ts +1 -0
- package/src/Webhooks.ts +19 -17
- package/src/admin/apps/api-keys.test.ts +9 -0
- package/src/admin/apps/api-keys.ts +15 -0
- package/src/admin/ui/src/lib/query-client.ts +3 -2
- package/src/admin/ui/src/routes/api-keys.tsx +31 -9
- package/src/admin/ui.generated.ts +69 -69
- package/src/analytics/Analytics.test.ts +8 -0
- package/src/analytics/Analytics.ts +26 -0
- package/src/apps/Zones.test.ts +20 -3
- package/src/apps/Zones.ts +28 -8
- package/src/apps/composition.test.ts +1 -0
- package/src/apps/data/App.test.ts +2 -2
- package/src/apps/data/routes/activities.bench.ts +41 -0
- package/src/apps/data/routes/activities.test.ts +103 -2
- package/src/apps/data/routes/activities.ts +401 -2
- package/src/apps/data/routes/balances.bench.ts +21 -0
- package/src/apps/data/routes/balances.ts +11 -3
- package/src/apps/data/routes/blocks.bench.ts +34 -0
- package/src/apps/data/routes/coingecko.bench.ts +53 -0
- package/src/apps/data/routes/earn.bench.ts +71 -0
- package/src/apps/data/routes/earn.ts +2 -2
- package/src/apps/data/routes/exchanges.bench.ts +85 -0
- package/src/apps/data/routes/fee-amm.bench.ts +13 -0
- package/src/apps/data/routes/indexer.bench.ts +8 -0
- package/src/apps/data/routes/indexer.test.ts +2 -1
- package/src/apps/data/routes/indexer.ts +3 -2
- package/src/apps/data/routes/receipts.bench.ts +39 -0
- package/src/apps/data/routes/rpc.bench.ts +14 -0
- package/src/apps/data/routes/rpc.test.ts +27 -0
- package/src/apps/data/routes/rpc.ts +5 -1
- package/src/apps/data/routes/tokenlist.bench.ts +3 -0
- package/src/apps/data/routes/tokens.bench.ts +76 -0
- package/src/apps/data/routes/transactions.bench.ts +40 -0
- package/src/apps/data/routes/transfers.bench.ts +28 -0
- package/src/apps/data/routes/valuation.bench.ts +14 -0
- package/src/apps/data/routes/verified-tokens.bench.ts +8 -0
- package/src/apps/data/routes/webhooks.bench.ts +26 -0
- package/src/apps/data/routes/webhooks.scan.test.ts +326 -0
- package/src/apps/data/routes/webhooks.test.ts +53 -6
- package/src/apps/data/routes/webhooks.ts +221 -14
- package/src/apps/data/routes/zones.bench.ts +32 -0
- package/src/apps/data/routes/zones.test.ts +1 -1
- package/src/apps/data/routes/zones.ts +1 -1
- package/src/apps/funding/routes/chains.test.ts +1 -1
- package/src/apps/funding/routes/deposit-addresses.test.ts +1 -1
- package/src/apps/funding/routes/deposit-addresses.ts +1 -1
- package/src/apps/funding/routes/providers.test.ts +1 -1
- package/src/apps/funding/routes/quotes.test.ts +1 -1
- package/src/apps/funding/routes/transfers.test.ts +3 -6
- package/src/apps/funding/routes/transfers.ts +1 -1
- package/src/apps/management/routes/billing.ts +1 -1
- package/src/apps/management/routes/faucet.ts +2 -2
- package/src/apps/management/routes/me.test.ts +31 -0
- package/src/apps/mcp.ts +4 -1
- package/src/db/Db.ts +81 -0
- package/src/db/Schema.ts +32 -0
- package/src/db/tables/webhookQueueEvents.ts +285 -0
- package/src/db/tables/webhookSubscriptions.ts +15 -0
- package/src/internal/Auth.test.ts +61 -50
- package/src/internal/Auth.ts +9 -4
- package/src/internal/EarnVaults.test.ts +2 -2
- package/src/internal/MetricSink.test.ts +58 -1
- package/src/internal/MetricSink.ts +60 -2
- package/src/internal/RateLimit.test.ts +23 -18
- package/src/internal/RateLimit.ts +23 -15
- package/src/internal/Store.test.ts +99 -13
- package/src/internal/Store.ts +52 -17
- package/src/internal/Tidx.test.ts +4 -4
- package/src/internal/Value.test.ts +25 -0
- package/src/internal/Value.ts +29 -0
- package/src/internal/WebhookTransfer.test.ts +89 -0
- package/src/internal/WebhookTransfer.ts +11 -7
- package/src/internal/Webhooks.test.ts +479 -0
- package/src/internal/Webhooks.ts +281 -7
- package/src/internal/funding/Provider.test.ts +1 -1
- package/src/internal/funding/providers/index.test.ts +73 -3
- package/src/internal/funding/providers/relay.test.ts +1 -5
- package/src/internal/funding/providers/relay.ts +56 -12
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import * as QueryBench from '../../../../test/QueryBench.js'
|
|
2
|
+
|
|
3
|
+
const fixtures = {
|
|
4
|
+
4217: {
|
|
5
|
+
base: '0x20c0000000000000000000001a47bebe936d00d7',
|
|
6
|
+
filledOrderId: '3881',
|
|
7
|
+
orderId: '3312',
|
|
8
|
+
},
|
|
9
|
+
42431: {
|
|
10
|
+
base: '0x20c000000000000000000000746cbc54ce86a3cb',
|
|
11
|
+
filledOrderId: '18047908',
|
|
12
|
+
orderId: '18048313',
|
|
13
|
+
},
|
|
14
|
+
} as const
|
|
15
|
+
|
|
16
|
+
QueryBench.bench({
|
|
17
|
+
name: 'getSwaps',
|
|
18
|
+
path: '/v1/exchange/swaps',
|
|
19
|
+
queries: ['include=token.logoUri', 'include=token.verified', 'valuation.currency=USD'],
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
QueryBench.bench({
|
|
23
|
+
name: 'getPairs',
|
|
24
|
+
path: '/v1/exchange/pairs',
|
|
25
|
+
queries: ['include=tokens', 'include=totalCount', 'sort=liquidity'],
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
QueryBench.bench({
|
|
29
|
+
name: 'getPair',
|
|
30
|
+
path: {
|
|
31
|
+
4217: `/v1/exchange/pairs/${fixtures[4217].base}`,
|
|
32
|
+
42431: `/v1/exchange/pairs/${fixtures[42431].base}`,
|
|
33
|
+
},
|
|
34
|
+
queries: ['include=tokens'],
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
QueryBench.bench({
|
|
38
|
+
name: 'getOrders',
|
|
39
|
+
path: '/v1/exchange/orders',
|
|
40
|
+
queries: ['include=tokens', 'include=totalCount'],
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
QueryBench.bench({
|
|
44
|
+
name: 'getOrders?base',
|
|
45
|
+
path: {
|
|
46
|
+
4217: `/v1/exchange/orders?base=${fixtures[4217].base}`,
|
|
47
|
+
42431: `/v1/exchange/orders?base=${fixtures[42431].base}`,
|
|
48
|
+
},
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
QueryBench.bench({
|
|
52
|
+
name: 'getOrder',
|
|
53
|
+
path: {
|
|
54
|
+
4217: `/v1/exchange/orders/${fixtures[4217].orderId}`,
|
|
55
|
+
42431: `/v1/exchange/orders/${fixtures[42431].orderId}`,
|
|
56
|
+
},
|
|
57
|
+
queries: ['include=tokens'],
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
QueryBench.bench({
|
|
61
|
+
name: 'getOrderFills',
|
|
62
|
+
path: {
|
|
63
|
+
4217: `/v1/exchange/orders/${fixtures[4217].filledOrderId}/fills`,
|
|
64
|
+
42431: `/v1/exchange/orders/${fixtures[42431].filledOrderId}/fills`,
|
|
65
|
+
},
|
|
66
|
+
queries: ['include=totalCount'],
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
QueryBench.bench({
|
|
70
|
+
name: 'getPairOhlc',
|
|
71
|
+
path: {
|
|
72
|
+
4217: `/v1/exchange/pairs/${fixtures[4217].base}/ohlc`,
|
|
73
|
+
42431: `/v1/exchange/pairs/${fixtures[42431].base}/ohlc`,
|
|
74
|
+
},
|
|
75
|
+
queries: ['include=tokens'],
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
QueryBench.bench({
|
|
79
|
+
name: 'getPairDepth',
|
|
80
|
+
path: {
|
|
81
|
+
4217: `/v1/exchange/pairs/${fixtures[4217].base}/depth`,
|
|
82
|
+
42431: `/v1/exchange/pairs/${fixtures[42431].base}/depth`,
|
|
83
|
+
},
|
|
84
|
+
queries: ['include=tokens'],
|
|
85
|
+
})
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as QueryBench from '../../../../test/QueryBench.js'
|
|
2
|
+
|
|
3
|
+
QueryBench.bench({
|
|
4
|
+
name: 'getFeeAmmPools',
|
|
5
|
+
path: '/v1/fee-amm/pools',
|
|
6
|
+
queries: ['include=token.logoUri', 'include=token.verified'],
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
QueryBench.bench({
|
|
10
|
+
name: 'getFeeAmmMints',
|
|
11
|
+
path: '/v1/fee-amm/mints',
|
|
12
|
+
queries: ['include=totalCount'],
|
|
13
|
+
})
|
|
@@ -150,7 +150,7 @@ describe('GET /indexer/query', () => {
|
|
|
150
150
|
const client = TestApp.client()
|
|
151
151
|
const response = await client.v1.indexer.query.$get(
|
|
152
152
|
{ query: { sql: 'select 1', chainId } },
|
|
153
|
-
TestApp.
|
|
153
|
+
{ headers: { 'x-api-key': TestApp.key.token } },
|
|
154
154
|
)
|
|
155
155
|
|
|
156
156
|
expect(response.status).toMatchInlineSnapshot(`200`)
|
|
@@ -161,6 +161,7 @@ describe('GET /indexer/query', () => {
|
|
|
161
161
|
// Tempo API enforces the documented execution bounds upstream even when the
|
|
162
162
|
// caller omits them.
|
|
163
163
|
const upstream = new URL((fetch.mock.calls[0]![0] as Request).url)
|
|
164
|
+
expect((fetch.mock.calls[0]![0] as Request).headers.get('x-api-key')).toBeNull()
|
|
164
165
|
expect(upstream.searchParams.get('timeout_ms')).toMatchInlineSnapshot(`"5000"`)
|
|
165
166
|
expect(upstream.searchParams.get('limit')).toMatchInlineSnapshot(`"10000"`)
|
|
166
167
|
} finally {
|
|
@@ -23,10 +23,11 @@ const strippedHeaders = new Set([
|
|
|
23
23
|
'keep-alive',
|
|
24
24
|
'proxy-authorization',
|
|
25
25
|
'te',
|
|
26
|
+
'tempo-api-key',
|
|
26
27
|
'trailer',
|
|
27
28
|
'transfer-encoding',
|
|
28
29
|
'upgrade',
|
|
29
|
-
'
|
|
30
|
+
'x-api-key',
|
|
30
31
|
ZoneRpcAuthentication.headerName.toLowerCase(),
|
|
31
32
|
])
|
|
32
33
|
|
|
@@ -63,7 +64,7 @@ export namespace schema {
|
|
|
63
64
|
z.meta({ examples: [1] }),
|
|
64
65
|
),
|
|
65
66
|
engine: z
|
|
66
|
-
.optional(z.enum(['postgres', 'clickhouse']))
|
|
67
|
+
.optional(z.enum(['postgres', 'clickhouse', 'tiered']))
|
|
67
68
|
.check(
|
|
68
69
|
z.describe('Indexer engine that ran the query.'),
|
|
69
70
|
z.meta({ examples: ['postgres'] }),
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as QueryBench from '../../../../test/QueryBench.js'
|
|
2
|
+
|
|
3
|
+
const hash = {
|
|
4
|
+
4217: '0x7f98e4b2bf4d1444b257526f7dd294ac3480d73cd91f723bf0df6062d1ba1c82',
|
|
5
|
+
42431: '0x1c8ccebb169f863b72388cc057fcecee240032eb7d2c64aa6f6fb8e5a60d3f9a',
|
|
6
|
+
} as const
|
|
7
|
+
|
|
8
|
+
const address = {
|
|
9
|
+
4217: '0xc24357119432595a547cb2c1e41c51d753645519',
|
|
10
|
+
42431: '0x15496d3123afb2cfadc0ac068eadd11d0f8ae799',
|
|
11
|
+
} as const
|
|
12
|
+
|
|
13
|
+
QueryBench.bench({
|
|
14
|
+
name: 'getReceipts',
|
|
15
|
+
path: '/v1/transactions/receipts',
|
|
16
|
+
queries: [
|
|
17
|
+
'include=feeToken.logoUri',
|
|
18
|
+
'include=feeToken.verified',
|
|
19
|
+
'include=totalCount',
|
|
20
|
+
'valuation.currency=USD',
|
|
21
|
+
],
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
QueryBench.bench({
|
|
25
|
+
name: 'getReceipts?address&include=totalCount',
|
|
26
|
+
path: {
|
|
27
|
+
4217: `/v1/transactions/receipts?address=${address[4217]}&include=totalCount`,
|
|
28
|
+
42431: `/v1/transactions/receipts?address=${address[42431]}&include=totalCount`,
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
QueryBench.bench({
|
|
33
|
+
name: 'getReceipt',
|
|
34
|
+
path: {
|
|
35
|
+
4217: `/v1/transactions/${hash[4217]}/receipt`,
|
|
36
|
+
42431: `/v1/transactions/${hash[42431]}/receipt`,
|
|
37
|
+
},
|
|
38
|
+
queries: ['include=feeToken.logoUri', 'include=feeToken.verified', 'valuation.currency=USD'],
|
|
39
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as QueryBench from '../../../../test/QueryBench.js'
|
|
2
|
+
|
|
3
|
+
QueryBench.bench({
|
|
4
|
+
body: {
|
|
5
|
+
id: 1,
|
|
6
|
+
jsonrpc: '2.0',
|
|
7
|
+
method: 'eth_blockNumber',
|
|
8
|
+
params: [],
|
|
9
|
+
},
|
|
10
|
+
chainId: false,
|
|
11
|
+
method: 'POST',
|
|
12
|
+
name: 'rpcRequest',
|
|
13
|
+
path: { 4217: '/rpc/mainnet', 42431: '/rpc/testnet' },
|
|
14
|
+
})
|
|
@@ -53,6 +53,30 @@ function zoneToken() {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
describe('POST /rpc', () => {
|
|
56
|
+
test('allows 20 public requests per second', async () => {
|
|
57
|
+
vi.useFakeTimers({ now: new Date('2026-08-12T00:00:00.000Z') })
|
|
58
|
+
try {
|
|
59
|
+
const app = TestApp.create()
|
|
60
|
+
const request = () =>
|
|
61
|
+
app.request('/rpc', {
|
|
62
|
+
body: JSON.stringify({ id: 1, jsonrpc: '2.0', method: 'tempo_blockNumber' }),
|
|
63
|
+
method: 'POST',
|
|
64
|
+
})
|
|
65
|
+
const responses = await Promise.all(
|
|
66
|
+
Array.from({ length: 21 }, () => Promise.resolve(request())),
|
|
67
|
+
)
|
|
68
|
+
const limited = responses.find((response) => response.status === 429)!
|
|
69
|
+
|
|
70
|
+
expect(responses.filter((response) => response.status === 401)).toHaveLength(20)
|
|
71
|
+
expect(limited.headers.get('RateLimit-Limit')).toBe('20')
|
|
72
|
+
|
|
73
|
+
vi.advanceTimersByTime(1_000)
|
|
74
|
+
expect((await Promise.resolve(request())).status).toBe(401)
|
|
75
|
+
} finally {
|
|
76
|
+
vi.useRealTimers()
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
|
|
56
80
|
test('routes by principal: a resolver sees the request principal and routes accordingly', async () => {
|
|
57
81
|
const fetch = mockRpc()
|
|
58
82
|
// A resolver that routes API-key principals to the private upstream and
|
|
@@ -113,6 +137,7 @@ describe('POST /rpc', () => {
|
|
|
113
137
|
'content-type': 'application/json',
|
|
114
138
|
cookie: 'session=secret',
|
|
115
139
|
'tempo-api-key': 'caller-key',
|
|
140
|
+
'x-api-key': 'legacy-caller-key',
|
|
116
141
|
'x-authorization-token': 'zone-secret',
|
|
117
142
|
'x-client-trace': 'trace_test',
|
|
118
143
|
},
|
|
@@ -139,6 +164,7 @@ describe('POST /rpc', () => {
|
|
|
139
164
|
expect(call.headers['authorization']).toMatchInlineSnapshot(`"Basic cnBjOnNlY3JldA=="`)
|
|
140
165
|
expect(call.headers['cookie']).toMatchInlineSnapshot(`null`)
|
|
141
166
|
expect(call.headers['tempo-api-key']).toMatchInlineSnapshot(`null`)
|
|
167
|
+
expect(call.headers['x-api-key']).toBeNull()
|
|
142
168
|
expect(call.headers['x-authorization-token']).toBeNull()
|
|
143
169
|
expect(call.headers['x-client-trace']).toMatchInlineSnapshot(`"trace_test"`)
|
|
144
170
|
} finally {
|
|
@@ -1156,6 +1182,7 @@ function mockRpc() {
|
|
|
1156
1182
|
authorization: request.headers.get('authorization'),
|
|
1157
1183
|
cookie: request.headers.get('cookie'),
|
|
1158
1184
|
'tempo-api-key': request.headers.get('tempo-api-key'),
|
|
1185
|
+
'x-api-key': request.headers.get('x-api-key'),
|
|
1159
1186
|
'x-authorization-token': request.headers.get('x-authorization-token'),
|
|
1160
1187
|
'x-client-trace': request.headers.get('x-client-trace'),
|
|
1161
1188
|
},
|
|
@@ -26,6 +26,7 @@ const strippedHeaders = new Set([
|
|
|
26
26
|
'trailer',
|
|
27
27
|
'transfer-encoding',
|
|
28
28
|
'upgrade',
|
|
29
|
+
'x-api-key',
|
|
29
30
|
ZoneRpcAuthentication.headerName.toLowerCase(),
|
|
30
31
|
])
|
|
31
32
|
|
|
@@ -163,7 +164,10 @@ export namespace schema {
|
|
|
163
164
|
export function rpc() {
|
|
164
165
|
return new Hono<App.Environment>().post(
|
|
165
166
|
'/rpc/:chain{(mainnet|testnet|[0-9]+)}?',
|
|
166
|
-
Auth.policy({
|
|
167
|
+
Auth.policy({
|
|
168
|
+
apiKey: { scopes: ['data:read'] },
|
|
169
|
+
public: { rateLimit: { limit: 20, period: 'second' } },
|
|
170
|
+
}),
|
|
167
171
|
OpenApi.describeRoute({
|
|
168
172
|
description:
|
|
169
173
|
'Sends a single or batch Ethereum JSON-RPC request directly to Tempo. Use `/rpc/testnet`, `/rpc/mainnet`, or `/rpc/:chain` to choose a chain. Zone read scopes permit read-only methods; Zone write scopes also permit signed transaction broadcasts. A Zone token in `X-Authorization-Token` is forwarded to the authenticated Zone RPC. This passthrough is not part of the stable API contract and is supported on a best-effort basis only. It has no compatibility, latency, availability, or data-freshness guarantees, and breaking changes may happen with limited notice.',
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import * as QueryBench from '../../../../test/QueryBench.js'
|
|
2
|
+
|
|
3
|
+
const address = {
|
|
4
|
+
4217: '0xc24357119432595a547cb2c1e41c51d753645519',
|
|
5
|
+
42431: '0x15496d3123afb2cfadc0ac068eadd11d0f8ae799',
|
|
6
|
+
} as const
|
|
7
|
+
|
|
8
|
+
QueryBench.bench({
|
|
9
|
+
name: 'getTokens',
|
|
10
|
+
path: '/v1/tokens',
|
|
11
|
+
queries: [
|
|
12
|
+
`addresses=${QueryBench.pathUsd}`,
|
|
13
|
+
`addresses=${QueryBench.pathUsd}&include=admin,createdAt,holderCount,quoteToken,transferStats`,
|
|
14
|
+
'include=admin',
|
|
15
|
+
'include=createdAt',
|
|
16
|
+
'include=holderCount',
|
|
17
|
+
'include=quoteToken',
|
|
18
|
+
'include=transferStats',
|
|
19
|
+
'verified=true',
|
|
20
|
+
'verified=true&include=admin,createdAt,holderCount,quoteToken,transferStats',
|
|
21
|
+
],
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
QueryBench.bench({
|
|
25
|
+
name: 'getTokenBySymbol',
|
|
26
|
+
path: '/v1/tokens/pathUSD',
|
|
27
|
+
queries: [
|
|
28
|
+
'include=admin',
|
|
29
|
+
'include=createdAt',
|
|
30
|
+
'include=holderCount',
|
|
31
|
+
'include=quoteToken',
|
|
32
|
+
'include=transferStats',
|
|
33
|
+
],
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
QueryBench.bench({
|
|
37
|
+
name: 'getToken',
|
|
38
|
+
path: `/v1/tokens/${QueryBench.pathUsd}`,
|
|
39
|
+
queries: [
|
|
40
|
+
'include=admin',
|
|
41
|
+
'include=createdAt',
|
|
42
|
+
'include=holderCount',
|
|
43
|
+
'include=quoteToken',
|
|
44
|
+
'include=transferStats',
|
|
45
|
+
],
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
QueryBench.bench({
|
|
49
|
+
name: 'getTokenLogo',
|
|
50
|
+
path: `/v1/tokens/${QueryBench.pathUsd}/logo`,
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
QueryBench.bench({
|
|
54
|
+
name: 'getTokenHolders',
|
|
55
|
+
path: `/v1/tokens/${QueryBench.pathUsd}/holders`,
|
|
56
|
+
queries: ['include=token', 'include=totalCount'],
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
QueryBench.bench({
|
|
60
|
+
name: 'getTokenTransactions',
|
|
61
|
+
path: `/v1/tokens/${QueryBench.pathUsd}/transactions`,
|
|
62
|
+
queries: [
|
|
63
|
+
'include=feeToken.logoUri',
|
|
64
|
+
'include=feeToken.verified',
|
|
65
|
+
'include=token',
|
|
66
|
+
'include=totalCount',
|
|
67
|
+
],
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
QueryBench.bench({
|
|
71
|
+
name: 'getTokenTransactions?feePayer&include=totalCount',
|
|
72
|
+
path: {
|
|
73
|
+
4217: `/v1/tokens/${QueryBench.pathUsd}/transactions?feePayer=${address[4217]}&include=totalCount`,
|
|
74
|
+
42431: `/v1/tokens/${QueryBench.pathUsd}/transactions?feePayer=${address[42431]}&include=totalCount`,
|
|
75
|
+
},
|
|
76
|
+
})
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as QueryBench from '../../../../test/QueryBench.js'
|
|
2
|
+
|
|
3
|
+
const hash = {
|
|
4
|
+
4217: '0x7f98e4b2bf4d1444b257526f7dd294ac3480d73cd91f723bf0df6062d1ba1c82',
|
|
5
|
+
42431: '0x1c8ccebb169f863b72388cc057fcecee240032eb7d2c64aa6f6fb8e5a60d3f9a',
|
|
6
|
+
} as const
|
|
7
|
+
|
|
8
|
+
const address = {
|
|
9
|
+
4217: '0xc24357119432595a547cb2c1e41c51d753645519',
|
|
10
|
+
42431: '0x15496d3123afb2cfadc0ac068eadd11d0f8ae799',
|
|
11
|
+
} as const
|
|
12
|
+
|
|
13
|
+
QueryBench.bench({
|
|
14
|
+
name: 'getTransactions',
|
|
15
|
+
path: '/v1/transactions',
|
|
16
|
+
queries: [
|
|
17
|
+
'include=feeToken.logoUri',
|
|
18
|
+
'include=feeToken.verified',
|
|
19
|
+
'include=receipt',
|
|
20
|
+
'include=totalCount',
|
|
21
|
+
'status=success&include=totalCount',
|
|
22
|
+
],
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
QueryBench.bench({
|
|
26
|
+
name: 'getTransactions?address&include=totalCount',
|
|
27
|
+
path: {
|
|
28
|
+
4217: `/v1/transactions?address=${address[4217]}&include=totalCount`,
|
|
29
|
+
42431: `/v1/transactions?address=${address[42431]}&include=totalCount`,
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
QueryBench.bench({
|
|
34
|
+
name: 'getTransaction',
|
|
35
|
+
path: {
|
|
36
|
+
4217: `/v1/transactions/${hash[4217]}`,
|
|
37
|
+
42431: `/v1/transactions/${hash[42431]}`,
|
|
38
|
+
},
|
|
39
|
+
queries: ['include=feeToken.logoUri', 'include=feeToken.verified', 'include=receipt'],
|
|
40
|
+
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as QueryBench from '../../../../test/QueryBench.js'
|
|
2
|
+
|
|
3
|
+
const address = {
|
|
4
|
+
4217: '0xc24357119432595a547cb2c1e41c51d753645519',
|
|
5
|
+
42431: '0x15496d3123afb2cfadc0ac068eadd11d0f8ae799',
|
|
6
|
+
} as const
|
|
7
|
+
|
|
8
|
+
QueryBench.bench({
|
|
9
|
+
name: 'getTransfers',
|
|
10
|
+
path: '/v1/transfers',
|
|
11
|
+
queries: [
|
|
12
|
+
'include=crossToken',
|
|
13
|
+
'include=crossToken,totalCount',
|
|
14
|
+
'include=memo',
|
|
15
|
+
'include=token.logoUri',
|
|
16
|
+
'include=token.verified',
|
|
17
|
+
'include=totalCount',
|
|
18
|
+
'valuation.currency=USD',
|
|
19
|
+
],
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
QueryBench.bench({
|
|
23
|
+
name: 'getTransfers?address&include=totalCount',
|
|
24
|
+
path: {
|
|
25
|
+
4217: `/v1/transfers?address=${address[4217]}&include=totalCount`,
|
|
26
|
+
42431: `/v1/transfers?address=${address[42431]}&include=totalCount`,
|
|
27
|
+
},
|
|
28
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as QueryBench from '../../../../test/QueryBench.js'
|
|
2
|
+
|
|
3
|
+
const address = {
|
|
4
|
+
4217: '0xc24357119432595a547cb2c1e41c51d753645519',
|
|
5
|
+
42431: '0x15496d3123afb2cfadc0ac068eadd11d0f8ae799',
|
|
6
|
+
} as const
|
|
7
|
+
|
|
8
|
+
QueryBench.bench({
|
|
9
|
+
name: 'getAddressValuation',
|
|
10
|
+
path: {
|
|
11
|
+
4217: `/v1/addresses/${address[4217]}/valuation`,
|
|
12
|
+
42431: `/v1/addresses/${address[42431]}/valuation`,
|
|
13
|
+
},
|
|
14
|
+
})
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as QueryBench from '../../../../test/QueryBench.js'
|
|
2
|
+
|
|
3
|
+
QueryBench.bench({ name: 'listVerifiedTokens', path: '/v1/verified-tokens' })
|
|
4
|
+
QueryBench.bench({ name: 'getVerifiedTokenCurrencies', path: '/v1/verified-tokens/currencies' })
|
|
5
|
+
QueryBench.bench({
|
|
6
|
+
name: 'getVerifiedToken',
|
|
7
|
+
path: `/v1/verified-tokens/${QueryBench.pathUsd}`,
|
|
8
|
+
})
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as QueryBench from '../../../../test/QueryBench.js'
|
|
2
|
+
|
|
3
|
+
QueryBench.bench({ name: 'getWebhookEventTypes', path: '/v1/webhooks/event-types' })
|
|
4
|
+
|
|
5
|
+
QueryBench.bench({
|
|
6
|
+
name: 'listWebhooks',
|
|
7
|
+
path: '/v1/webhooks',
|
|
8
|
+
queries: ['include=totalCount'],
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
QueryBench.bench({
|
|
12
|
+
name: 'getWebhook',
|
|
13
|
+
path: {
|
|
14
|
+
4217: `/v1/webhooks/${QueryBench.webhookId[4217]}`,
|
|
15
|
+
42431: `/v1/webhooks/${QueryBench.webhookId[42431]}`,
|
|
16
|
+
},
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
QueryBench.bench({
|
|
20
|
+
name: 'listWebhookDeliveries',
|
|
21
|
+
path: {
|
|
22
|
+
4217: `/v1/webhooks/${QueryBench.webhookId[4217]}/deliveries`,
|
|
23
|
+
42431: `/v1/webhooks/${QueryBench.webhookId[42431]}/deliveries`,
|
|
24
|
+
},
|
|
25
|
+
queries: ['include=totalCount'],
|
|
26
|
+
})
|