tapimo 0.9.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 +4292 -3708
- 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 +21 -20
- package/dist/Webhooks.d.ts.map +1 -1
- package/dist/Webhooks.js +66 -23
- 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/apps/verified-tokens.d.ts +168 -168
- 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 +4280 -84
- package/dist/apps/Zones.d.ts.map +1 -1
- package/dist/apps/Zones.js +30 -10
- package/dist/apps/Zones.js.map +1 -1
- package/dist/apps/data/App.d.ts +5799 -4929
- package/dist/apps/data/App.d.ts.map +1 -1
- package/dist/apps/data/FxOracle.d.ts +4 -5
- package/dist/apps/data/FxOracle.d.ts.map +1 -1
- package/dist/apps/data/FxOracle.js +19 -4
- package/dist/apps/data/FxOracle.js.map +1 -1
- package/dist/apps/data/routes/activities.d.ts +3391 -492
- package/dist/apps/data/routes/activities.d.ts.map +1 -1
- package/dist/apps/data/routes/activities.js +372 -29
- package/dist/apps/data/routes/activities.js.map +1 -1
- package/dist/apps/data/routes/addresses.d.ts +853 -339
- package/dist/apps/data/routes/addresses.d.ts.map +1 -1
- package/dist/apps/data/routes/balances.d.ts +10 -10
- package/dist/apps/data/routes/balances.d.ts.map +1 -1
- package/dist/apps/data/routes/balances.js +145 -83
- package/dist/apps/data/routes/balances.js.map +1 -1
- package/dist/apps/data/routes/blocks.d.ts +123 -123
- package/dist/apps/data/routes/coingecko.d.ts +169 -169
- package/dist/apps/data/routes/earn.d.ts +455 -1
- package/dist/apps/data/routes/earn.d.ts.map +1 -1
- package/dist/apps/data/routes/earn.js +369 -45
- package/dist/apps/data/routes/earn.js.map +1 -1
- package/dist/apps/data/routes/exchanges.d.ts.map +1 -1
- package/dist/apps/data/routes/exchanges.js +114 -118
- 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/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/receipts.d.ts.map +1 -1
- package/dist/apps/data/routes/receipts.js +68 -47
- package/dist/apps/data/routes/receipts.js.map +1 -1
- package/dist/apps/data/routes/rpc.d.ts +31 -31
- 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/tokens.d.ts +461 -459
- package/dist/apps/data/routes/tokens.d.ts.map +1 -1
- package/dist/apps/data/routes/transactions.d.ts +313 -305
- package/dist/apps/data/routes/transactions.d.ts.map +1 -1
- package/dist/apps/data/routes/transactions.js +25 -23
- package/dist/apps/data/routes/transactions.js.map +1 -1
- package/dist/apps/data/routes/transfers.d.ts +108 -86
- package/dist/apps/data/routes/transfers.d.ts.map +1 -1
- package/dist/apps/data/routes/transfers.js +618 -105
- package/dist/apps/data/routes/transfers.js.map +1 -1
- package/dist/apps/data/routes/valuation.d.ts +21 -21
- package/dist/apps/data/routes/valuation.d.ts.map +1 -1
- package/dist/apps/data/routes/valuation.js +2 -2
- package/dist/apps/data/routes/valuation.js.map +1 -1
- package/dist/apps/data/routes/webhooks.d.ts +519 -868
- package/dist/apps/data/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/data/routes/webhooks.js +642 -353
- 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.d.ts.map +1 -1
- package/dist/apps/data/routes/zones.js +4 -2
- package/dist/apps/data/routes/zones.js.map +1 -1
- 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/quotes.d.ts +89 -89
- package/dist/apps/funding/routes/transfers.d.ts +36 -36
- 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 +11 -309
- package/dist/apps/management/App.d.ts.map +1 -1
- package/dist/apps/management/routes/api-keys.d.ts +74 -74
- 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 +35 -35
- package/dist/apps/management/routes/faucet.js +2 -2
- package/dist/apps/management/routes/faucet.js.map +1 -1
- package/dist/apps/management/routes/invitations.d.ts +134 -134
- package/dist/apps/management/routes/invite-links.d.ts +80 -80
- package/dist/apps/management/routes/members.d.ts +69 -69
- package/dist/apps/management/routes/orgs.d.ts +98 -98
- package/dist/apps/management/routes/projects.d.ts +60 -60
- package/dist/apps/management/routes/usage.d.ts +72 -72
- package/dist/apps/management/routes/verified-token-requests.d.ts +83 -83
- package/dist/apps/management/routes/webhooks.d.ts +203 -618
- package/dist/apps/management/routes/webhooks.d.ts.map +1 -1
- 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/apps/mpp/App.d.ts +56 -44
- package/dist/apps/mpp/App.d.ts.map +1 -1
- package/dist/apps/mpp/Mpp.d.ts +3 -0
- package/dist/apps/mpp/Mpp.d.ts.map +1 -1
- package/dist/apps/mpp/Mpp.js +3 -0
- package/dist/apps/mpp/Mpp.js.map +1 -1
- package/dist/apps/mpp/internal/Adapter.d.ts.map +1 -1
- package/dist/apps/mpp/internal/Adapter.js +9 -2
- package/dist/apps/mpp/internal/Adapter.js.map +1 -1
- package/dist/db/Db.d.ts +4 -2
- package/dist/db/Db.d.ts.map +1 -1
- package/dist/db/Db.js +75 -15
- 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/sponsoredTransactions.d.ts.map +1 -1
- package/dist/db/tables/sponsoredTransactions.js +4 -1
- package/dist/db/tables/sponsoredTransactions.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 +58 -3
- package/dist/db/tables/webhookSubscriptions.d.ts.map +1 -1
- package/dist/db/tables/webhookSubscriptions.js +86 -3
- 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 +139 -3
- package/dist/internal/MetricSink.d.ts.map +1 -1
- package/dist/internal/MetricSink.js +144 -4
- 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/Schema.js +1 -1
- package/dist/internal/Schema.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/Tidx.d.ts +1 -3
- package/dist/internal/Tidx.d.ts.map +1 -1
- package/dist/internal/Tidx.js +1 -3
- package/dist/internal/Tidx.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/Viem.d.ts.map +1 -1
- package/dist/internal/Viem.js +2 -1
- package/dist/internal/Viem.js.map +1 -1
- package/dist/internal/WebhookDestination.d.ts +2 -0
- package/dist/internal/WebhookDestination.d.ts.map +1 -1
- package/dist/internal/WebhookDestination.js +11 -0
- package/dist/internal/WebhookDestination.js.map +1 -1
- package/dist/internal/WebhookTransfer.d.ts +75 -0
- package/dist/internal/WebhookTransfer.d.ts.map +1 -0
- package/dist/internal/WebhookTransfer.js +299 -0
- package/dist/internal/WebhookTransfer.js.map +1 -0
- package/dist/internal/Webhooks.d.ts +176 -0
- package/dist/internal/Webhooks.d.ts.map +1 -1
- package/dist/internal/Webhooks.js +216 -20
- package/dist/internal/Webhooks.js.map +1 -1
- package/dist/internal/funding/Provider.d.ts +4 -0
- package/dist/internal/funding/Provider.d.ts.map +1 -1
- package/dist/internal/funding/Provider.js +11 -7
- package/dist/internal/funding/Provider.js.map +1 -1
- package/dist/internal/funding/Reconciliation.d.ts.map +1 -1
- package/dist/internal/funding/Reconciliation.js +128 -0
- package/dist/internal/funding/Reconciliation.js.map +1 -1
- package/dist/internal/funding/providers/relay.d.ts +6 -4
- package/dist/internal/funding/providers/relay.d.ts.map +1 -1
- package/dist/internal/funding/providers/relay.js +71 -9
- package/dist/internal/funding/providers/relay.js.map +1 -1
- package/package.json +4 -4
- 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 +61 -5
- package/src/Webhooks.bench.ts +714 -0
- package/src/Webhooks.memory.bench.ts +250 -0
- package/src/Webhooks.test.ts +77 -6
- package/src/Webhooks.ts +85 -29
- 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 +23 -5
- package/src/apps/Zones.ts +31 -10
- package/src/apps/composition.test.ts +1 -0
- package/src/apps/data/App.test.ts +2 -2
- package/src/apps/data/FxOracle.test.ts +18 -0
- package/src/apps/data/FxOracle.ts +28 -5
- package/src/apps/data/routes/activities.bench.ts +41 -0
- package/src/apps/data/routes/activities.test.ts +122 -2
- package/src/apps/data/routes/activities.ts +435 -32
- package/src/apps/data/routes/balances.bench.ts +21 -0
- package/src/apps/data/routes/balances.test.ts +119 -10
- package/src/apps/data/routes/balances.ts +164 -97
- package/src/apps/data/routes/blocks.bench.ts +34 -0
- package/src/apps/data/routes/blocks.test.ts +12 -6
- 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.test.ts +197 -0
- package/src/apps/data/routes/earn.ts +487 -45
- package/src/apps/data/routes/exchanges.bench.ts +85 -0
- package/src/apps/data/routes/exchanges.test.ts +7 -6
- package/src/apps/data/routes/exchanges.ts +124 -117
- 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/receipts.test.ts +24 -7
- package/src/apps/data/routes/receipts.ts +67 -50
- 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/tokens.test.ts +51 -0
- package/src/apps/data/routes/transactions.bench.ts +40 -0
- package/src/apps/data/routes/transactions.test.ts +42 -0
- package/src/apps/data/routes/transactions.ts +44 -39
- package/src/apps/data/routes/transfers.bench.ts +28 -0
- package/src/apps/data/routes/transfers.test.ts +402 -24
- package/src/apps/data/routes/transfers.ts +708 -101
- package/src/apps/data/routes/valuation.bench.ts +14 -0
- package/src/apps/data/routes/valuation.test.ts +26 -0
- package/src/apps/data/routes/valuation.ts +6 -2
- 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 +466 -135
- package/src/apps/data/routes/webhooks.ts +820 -429
- 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 +7 -2
- 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 +2 -2
- 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/apps/mpp/Mpp.test.ts +13 -1
- package/src/apps/mpp/Mpp.ts +8 -0
- package/src/apps/mpp/internal/Adapter.ts +10 -2
- package/src/db/Db.test.ts +40 -6
- package/src/db/Db.ts +114 -19
- package/src/db/Schema.ts +32 -0
- package/src/db/tables/sponsoredTransactions.ts +9 -2
- package/src/db/tables/webhookQueueEvents.ts +285 -0
- package/src/db/tables/webhookSubscriptions.ts +131 -4
- 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 +575 -0
- package/src/internal/MetricSink.ts +325 -10
- package/src/internal/RateLimit.test.ts +23 -18
- package/src/internal/RateLimit.ts +23 -15
- package/src/internal/Schema.ts +1 -1
- 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/Tidx.ts +1 -3
- package/src/internal/Value.test.ts +25 -0
- package/src/internal/Value.ts +29 -0
- package/src/internal/Viem.test.ts +8 -0
- package/src/internal/Viem.ts +2 -1
- package/src/internal/WebhookDestination.test.ts +20 -0
- package/src/internal/WebhookDestination.ts +10 -0
- package/src/internal/WebhookTransfer.test.ts +89 -0
- package/src/internal/WebhookTransfer.ts +430 -0
- package/src/internal/Webhooks.test.ts +616 -0
- package/src/internal/Webhooks.ts +412 -24
- package/src/internal/funding/Provider.test.ts +48 -8
- package/src/internal/funding/Provider.ts +12 -7
- package/src/internal/funding/Reconciliation.local.test.ts +3 -1
- package/src/internal/funding/Reconciliation.test.ts +1240 -0
- package/src/internal/funding/Reconciliation.ts +136 -0
- package/src/internal/funding/SourceObservation.test.ts +1 -0
- package/src/internal/funding/providers/index.test.ts +73 -3
- package/src/internal/funding/providers/relay.test.ts +2 -9
- package/src/internal/funding/providers/relay.ts +72 -13
|
@@ -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
|
+
})
|
|
@@ -690,6 +690,7 @@ describe('GET /exchange/swaps', () => {
|
|
|
690
690
|
expect(response.status).toBe(200)
|
|
691
691
|
const body = await TestApp.json(response, Exchanges.schema.getSwaps.Response)
|
|
692
692
|
expect(body.data.length).toBeLessThanOrEqual(10)
|
|
693
|
+
expect(response.headers.get('server-timing')).not.toContain('valuation_rates;dur=')
|
|
693
694
|
if (body.data.length === 0) return
|
|
694
695
|
|
|
695
696
|
for (const swap of body.data) {
|
|
@@ -708,6 +709,7 @@ describe('GET /exchange/swaps', () => {
|
|
|
708
709
|
expect(swap.sourceAmount.currency).toBe(swap.sourceToken.currency)
|
|
709
710
|
expect(swap.sourceAmount.decimals).toBe(swap.sourceToken.decimals)
|
|
710
711
|
expect(swap.sourceAmount.formatted).toMatch(/^\d+(\.\d+)?$/)
|
|
712
|
+
expect('valuation' in swap.sourceAmount).toBe(false)
|
|
711
713
|
expect(swap.destinationToken.address).toMatch(/^0x[0-9a-f]{40}$/)
|
|
712
714
|
expect(swap.destinationToken).not.toHaveProperty('amount')
|
|
713
715
|
expect(typeof swap.destinationToken.currency).toBe('string')
|
|
@@ -720,6 +722,7 @@ describe('GET /exchange/swaps', () => {
|
|
|
720
722
|
expect(swap.destinationAmount.currency).toBe(swap.destinationToken.currency)
|
|
721
723
|
expect(swap.destinationAmount.decimals).toBe(swap.destinationToken.decimals)
|
|
722
724
|
expect(swap.destinationAmount.formatted).toMatch(/^\d+(\.\d+)?$/)
|
|
725
|
+
expect('valuation' in swap.destinationAmount).toBe(false)
|
|
723
726
|
expect(swap.rate).toMatch(/^\d+(\.\d+)?$/)
|
|
724
727
|
expect(swap.filledAt).toMatch(/^\d{4}-\d{2}-\d{2}T/)
|
|
725
728
|
// `route` spans source → destination; its ends mirror the side tokens.
|
|
@@ -739,10 +742,12 @@ describe('GET /exchange/swaps', () => {
|
|
|
739
742
|
expect(fill.sourceAmount.baseUnits).toMatch(/^\d+$/)
|
|
740
743
|
expect(fill.sourceAmount.currency).toBe(fill.sourceToken.currency)
|
|
741
744
|
expect(fill.sourceAmount.decimals).toBe(fill.sourceToken.decimals)
|
|
745
|
+
expect('valuation' in fill.sourceAmount).toBe(false)
|
|
742
746
|
expect(fill.destinationToken).not.toHaveProperty('amount')
|
|
743
747
|
expect(fill.destinationAmount.baseUnits).toMatch(/^\d+$/)
|
|
744
748
|
expect(fill.destinationAmount.currency).toBe(fill.destinationToken.currency)
|
|
745
749
|
expect(fill.destinationAmount.decimals).toBe(fill.destinationToken.decimals)
|
|
750
|
+
expect('valuation' in fill.destinationAmount).toBe(false)
|
|
746
751
|
}
|
|
747
752
|
for (let i = 1; i < swap.fills.length; i++)
|
|
748
753
|
expect(swap.fills[i]!.logIndex).toBeGreaterThan(swap.fills[i - 1]!.logIndex)
|
|
@@ -1033,7 +1038,7 @@ describe('POST /exchange/quotes', () => {
|
|
|
1033
1038
|
}, 120_000)
|
|
1034
1039
|
|
|
1035
1040
|
test('quotes exact-source liquidity and returns approval then sell calls', async () => {
|
|
1036
|
-
// Pin an empty curated list so
|
|
1041
|
+
// Pin an empty curated list so optional curated fields stay deterministic.
|
|
1037
1042
|
const db = TestApp.database()
|
|
1038
1043
|
await TestApp.verifiedSeed(db, Runtime.get().chainId, { tokens: [] })
|
|
1039
1044
|
const client = TestApp.client({ db })
|
|
@@ -1061,7 +1066,6 @@ describe('POST /exchange/quotes', () => {
|
|
|
1061
1066
|
currency: 'USD',
|
|
1062
1067
|
decimals: 6,
|
|
1063
1068
|
formatted: '0.000001',
|
|
1064
|
-
valuation: null,
|
|
1065
1069
|
})
|
|
1066
1070
|
expect(body.destinationToken).toMatchObject({
|
|
1067
1071
|
address: Addresses.pathUsd,
|
|
@@ -1076,7 +1080,6 @@ describe('POST /exchange/quotes', () => {
|
|
|
1076
1080
|
currency: 'USD',
|
|
1077
1081
|
decimals: 6,
|
|
1078
1082
|
formatted: '0.000001',
|
|
1079
|
-
valuation: null,
|
|
1080
1083
|
})
|
|
1081
1084
|
expect(body.sourceToken).toMatchObject({
|
|
1082
1085
|
address: baseToken,
|
|
@@ -1103,7 +1106,7 @@ describe('POST /exchange/quotes', () => {
|
|
|
1103
1106
|
}, 60_000)
|
|
1104
1107
|
|
|
1105
1108
|
test('quotes exact-destination liquidity and returns approval then buy calls', async () => {
|
|
1106
|
-
// Pin an empty curated list so
|
|
1109
|
+
// Pin an empty curated list so optional curated fields stay deterministic.
|
|
1107
1110
|
const db = TestApp.database()
|
|
1108
1111
|
await TestApp.verifiedSeed(db, Runtime.get().chainId, { tokens: [] })
|
|
1109
1112
|
const client = TestApp.client({ db })
|
|
@@ -1132,7 +1135,6 @@ describe('POST /exchange/quotes', () => {
|
|
|
1132
1135
|
currency: 'USD',
|
|
1133
1136
|
decimals: 6,
|
|
1134
1137
|
formatted: '0.000001',
|
|
1135
|
-
valuation: null,
|
|
1136
1138
|
})
|
|
1137
1139
|
expect(body.destinationToken).toMatchObject({
|
|
1138
1140
|
address: baseToken,
|
|
@@ -1147,7 +1149,6 @@ describe('POST /exchange/quotes', () => {
|
|
|
1147
1149
|
currency: 'USD',
|
|
1148
1150
|
decimals: 6,
|
|
1149
1151
|
formatted: '0.000002',
|
|
1150
|
-
valuation: null,
|
|
1151
1152
|
})
|
|
1152
1153
|
expect(body.sourceAmount).toEqual(body.destinationAmount)
|
|
1153
1154
|
expect(body.sourceToken).toMatchObject({
|
|
@@ -1776,18 +1776,22 @@ export function exchanges(options: exchanges.Options = {}) {
|
|
|
1776
1776
|
try {
|
|
1777
1777
|
// Value quoted amounts via their curated display currency; snapshot
|
|
1778
1778
|
// or rate failures degrade the values to `null`, never the quote.
|
|
1779
|
-
const denomination = query['valuation.currency']
|
|
1780
|
-
const snapshot =
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1779
|
+
const denomination = query['valuation.currency']
|
|
1780
|
+
const snapshot = denomination
|
|
1781
|
+
? await VerifiedTokens.snapshot(c, chainId).catch(() => undefined)
|
|
1782
|
+
: undefined
|
|
1783
|
+
const rates = denomination
|
|
1784
|
+
? await Valuation.ratesFor(c, {
|
|
1785
|
+
currencies: snapshot
|
|
1786
|
+
? [request.destinationToken, request.sourceToken].flatMap((address) => {
|
|
1787
|
+
const held = snapshot.byAddress.get(address.toLowerCase())?.currency
|
|
1788
|
+
return held === undefined ? [] : [held]
|
|
1789
|
+
})
|
|
1790
|
+
: [],
|
|
1791
|
+
denomination,
|
|
1792
|
+
oracle,
|
|
1793
|
+
})
|
|
1794
|
+
: undefined
|
|
1791
1795
|
const valued = (
|
|
1792
1796
|
baseUnits: bigint | string,
|
|
1793
1797
|
address: string,
|
|
@@ -1798,12 +1802,16 @@ export function exchanges(options: exchanges.Options = {}) {
|
|
|
1798
1802
|
currency: token.currency,
|
|
1799
1803
|
decimals: token.decimals,
|
|
1800
1804
|
}),
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1805
|
+
...(denomination
|
|
1806
|
+
? {
|
|
1807
|
+
valuation: Valuation.valuationFor({
|
|
1808
|
+
amount: BigInt(baseUnits),
|
|
1809
|
+
denomination,
|
|
1810
|
+
rates,
|
|
1811
|
+
token: snapshot?.byAddress.get(address.toLowerCase()),
|
|
1812
|
+
}),
|
|
1813
|
+
}
|
|
1814
|
+
: {}),
|
|
1807
1815
|
})
|
|
1808
1816
|
|
|
1809
1817
|
if (options.nativeDex === false || amount > maxSwapAmount)
|
|
@@ -2210,23 +2218,25 @@ export function exchanges(options: exchanges.Options = {}) {
|
|
|
2210
2218
|
})
|
|
2211
2219
|
// Value amounts via their curated display currency; snapshot or rate
|
|
2212
2220
|
// failures degrade the values to `null`, never the feed.
|
|
2213
|
-
const denomination = options['valuation.currency']
|
|
2221
|
+
const denomination = options['valuation.currency']
|
|
2214
2222
|
const snapshot =
|
|
2215
|
-
page.data.length > 0
|
|
2223
|
+
denomination !== undefined && page.data.length > 0
|
|
2216
2224
|
? await VerifiedTokens.snapshot(c, chainId).catch(() => undefined)
|
|
2217
2225
|
: undefined
|
|
2218
|
-
const rates =
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2226
|
+
const rates = denomination
|
|
2227
|
+
? await Valuation.ratesFor(c, {
|
|
2228
|
+
currencies: snapshot
|
|
2229
|
+
? page.data.flatMap((swap) =>
|
|
2230
|
+
swap.route.flatMap((address) => {
|
|
2231
|
+
const held = snapshot.byAddress.get(address.toLowerCase())?.currency
|
|
2232
|
+
return held === undefined ? [] : [held]
|
|
2233
|
+
}),
|
|
2234
|
+
)
|
|
2235
|
+
: [],
|
|
2236
|
+
denomination,
|
|
2237
|
+
oracle,
|
|
2238
|
+
})
|
|
2239
|
+
: undefined
|
|
2230
2240
|
const enrichSide = (side: getSwaps.Side) => {
|
|
2231
2241
|
const token = tokensByAddress.get(side.address)
|
|
2232
2242
|
if (!token) throw new Error(`Token metadata unavailable for ${side.address}`)
|
|
@@ -2237,12 +2247,16 @@ export function exchanges(options: exchanges.Options = {}) {
|
|
|
2237
2247
|
currency: token.currency,
|
|
2238
2248
|
decimals: token.decimals,
|
|
2239
2249
|
}),
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2250
|
+
...(denomination
|
|
2251
|
+
? {
|
|
2252
|
+
valuation: Valuation.valuationFor({
|
|
2253
|
+
amount: BigInt(side.amount),
|
|
2254
|
+
denomination,
|
|
2255
|
+
rates,
|
|
2256
|
+
token: snapshot?.byAddress.get(side.address.toLowerCase()),
|
|
2257
|
+
}),
|
|
2258
|
+
}
|
|
2259
|
+
: {}),
|
|
2246
2260
|
},
|
|
2247
2261
|
token: {
|
|
2248
2262
|
address: side.address,
|
|
@@ -3705,12 +3719,8 @@ async function getSwaps(c: Context<App.Environment>, options: getSwaps.Options)
|
|
|
3705
3719
|
}
|
|
3706
3720
|
|
|
3707
3721
|
// A selective row predicate (`taker`/`maker`/`participant`/`transactionHash`)
|
|
3708
|
-
// makes matching fills sparse across a wide block range
|
|
3709
|
-
//
|
|
3710
|
-
// no `GROUP BY`/`groupArray`) and lets the window sweep jump straight to the
|
|
3711
|
-
// next populated block instead of paying a full grouped round-trip for every
|
|
3712
|
-
// empty `swapWindowBlocks` gap between clusters. The block list also yields
|
|
3713
|
-
// the scan bounds, so no separate `min`/`max` query is needed.
|
|
3722
|
+
// makes matching fills sparse across a wide block range. Find the next
|
|
3723
|
+
// populated block before each window so the sweep skips empty gaps.
|
|
3714
3724
|
//
|
|
3715
3725
|
// The discovery predicate must be a *superset* of the grouped page query's
|
|
3716
3726
|
// matches. The page query applies `maker`/`participant` as existential
|
|
@@ -3735,24 +3745,35 @@ async function getSwaps(c: Context<App.Environment>, options: getSwaps.Options)
|
|
|
3735
3745
|
if (witnesses.length > 0) blockFilters.push(`(${witnesses.join(' OR ')})`)
|
|
3736
3746
|
}
|
|
3737
3747
|
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
//
|
|
3741
|
-
|
|
3742
|
-
const
|
|
3748
|
+
const cursorBlock = cursor !== undefined ? Number(cursor[0]) : undefined
|
|
3749
|
+
|
|
3750
|
+
// Keep discovery bounded so TIDX response limits cannot truncate the scan
|
|
3751
|
+
// head. The predicate stays a superset of the grouped query.
|
|
3752
|
+
const findMatchingBlock = async (anchor: number | undefined) => {
|
|
3753
|
+
const filters = [...blockFilters]
|
|
3754
|
+
if (anchor !== undefined)
|
|
3755
|
+
filters.push(`f.block_num ${order === 'asc' ? '>=' : '<='} ${anchor}`)
|
|
3756
|
+
const result = await tidx.fetch({
|
|
3757
|
+
chainId,
|
|
3758
|
+
engine: 'clickhouse',
|
|
3759
|
+
query:
|
|
3760
|
+
`SELECT f.block_num AS block_num FROM dex_fills f WHERE ${filters.join(' AND ')} ORDER BY block_num ${direction} LIMIT 1` as string,
|
|
3761
|
+
})
|
|
3762
|
+
const row = result.rows[0]
|
|
3763
|
+
return row ? Value.toNumber(row['block_num']) : undefined
|
|
3764
|
+
}
|
|
3765
|
+
|
|
3766
|
+
type ScanBounds = BlockWindow & { firstMatchingBlock?: number | undefined }
|
|
3767
|
+
const bounds: ScanBounds | undefined = await Timing.time(c, 'swap_bounds', async () => {
|
|
3743
3768
|
if (selective) {
|
|
3744
|
-
const
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
.filter((block): block is number => block !== undefined)
|
|
3753
|
-
const lo = matchingBlocks[0]
|
|
3754
|
-
const hi = matchingBlocks.at(-1)
|
|
3755
|
-
return lo !== undefined && hi !== undefined ? { hi, lo } : undefined
|
|
3769
|
+
const firstMatchingBlock = await findMatchingBlock(cursorBlock)
|
|
3770
|
+
return firstMatchingBlock !== undefined
|
|
3771
|
+
? {
|
|
3772
|
+
firstMatchingBlock,
|
|
3773
|
+
hi: toBlock ?? Number.MAX_SAFE_INTEGER,
|
|
3774
|
+
lo: fromBlock ?? 0,
|
|
3775
|
+
}
|
|
3776
|
+
: undefined
|
|
3756
3777
|
}
|
|
3757
3778
|
const result = await tidx.fetch({
|
|
3758
3779
|
chainId,
|
|
@@ -3779,60 +3800,38 @@ async function getSwaps(c: Context<App.Environment>, options: getSwaps.Options)
|
|
|
3779
3800
|
// exhausts the window and slides the sweep to the next disjoint range.
|
|
3780
3801
|
const batchLimit = limit + 1
|
|
3781
3802
|
let activeCursor = cursor
|
|
3782
|
-
const cursorBlock = cursor !== undefined ? Number(cursor[0]) : undefined
|
|
3783
|
-
|
|
3784
|
-
// Snap an anchor block onto the matching-block list (selective queries):
|
|
3785
|
-
// the largest matching block `<= value` (desc) / smallest `>= value`
|
|
3786
|
-
// (asc). This collapses the empty gaps between fill clusters — `slideWindow`
|
|
3787
|
-
// jumps straight to the next populated block. `undefined` when no matching
|
|
3788
|
-
// block remains in range. `matchingBlocks` is ascending.
|
|
3789
|
-
const lastAtMost = (value: number): number | undefined => {
|
|
3790
|
-
if (matchingBlocks === undefined) return value
|
|
3791
|
-
let lo = 0
|
|
3792
|
-
let hi = matchingBlocks.length
|
|
3793
|
-
while (lo < hi) {
|
|
3794
|
-
const mid = (lo + hi) >> 1
|
|
3795
|
-
if (matchingBlocks[mid]! <= value) lo = mid + 1
|
|
3796
|
-
else hi = mid
|
|
3797
|
-
}
|
|
3798
|
-
return lo === 0 ? undefined : matchingBlocks[lo - 1]
|
|
3799
|
-
}
|
|
3800
|
-
const firstAtLeast = (value: number): number | undefined => {
|
|
3801
|
-
if (matchingBlocks === undefined) return value
|
|
3802
|
-
let lo = 0
|
|
3803
|
-
let hi = matchingBlocks.length
|
|
3804
|
-
while (lo < hi) {
|
|
3805
|
-
const mid = (lo + hi) >> 1
|
|
3806
|
-
if (matchingBlocks[mid]! < value) lo = mid + 1
|
|
3807
|
-
else hi = mid
|
|
3808
|
-
}
|
|
3809
|
-
return lo === matchingBlocks.length ? undefined : matchingBlocks[lo]
|
|
3810
|
-
}
|
|
3811
3803
|
|
|
3812
|
-
|
|
3804
|
+
// Selective scans jump to the next populated block through a bounded
|
|
3805
|
+
// lookup. Unfiltered scans retain the fixed-stride min/max sweep.
|
|
3806
|
+
const windowFrom = async (
|
|
3807
|
+
anchor: number | undefined,
|
|
3808
|
+
knownMatchingBlock?: number,
|
|
3809
|
+
): Promise<BlockWindow | undefined> => {
|
|
3813
3810
|
if (order === 'desc') {
|
|
3814
|
-
const
|
|
3811
|
+
const value = Math.min(upperBound, anchor ?? upperBound)
|
|
3812
|
+
const hi = selective ? (knownMatchingBlock ?? (await findMatchingBlock(value))) : value
|
|
3815
3813
|
return hi !== undefined && hi >= lowerBound
|
|
3816
3814
|
? { hi, lo: Math.max(lowerBound, hi - swapWindowBlocks + 1) }
|
|
3817
3815
|
: undefined
|
|
3818
3816
|
}
|
|
3819
|
-
const
|
|
3817
|
+
const value = Math.max(lowerBound, anchor ?? lowerBound)
|
|
3818
|
+
const lo = selective ? (knownMatchingBlock ?? (await findMatchingBlock(value))) : value
|
|
3820
3819
|
return lo !== undefined && lo <= upperBound
|
|
3821
3820
|
? { hi: Math.min(upperBound, lo + swapWindowBlocks - 1), lo }
|
|
3822
3821
|
: undefined
|
|
3823
3822
|
}
|
|
3824
3823
|
|
|
3825
|
-
let window = windowFrom(cursorBlock)
|
|
3824
|
+
let window = await windowFrom(cursorBlock, bounds.firstMatchingBlock)
|
|
3826
3825
|
|
|
3827
3826
|
// Slide to the next disjoint window away from the newest block and reset
|
|
3828
3827
|
// the cursor: every row in the next window is already past the cursor
|
|
3829
3828
|
// anchor in the requested order, so no anchor refinement is needed.
|
|
3830
|
-
const slideWindow = () => {
|
|
3829
|
+
const slideWindow = async () => {
|
|
3831
3830
|
activeCursor = undefined
|
|
3832
3831
|
window =
|
|
3833
3832
|
window === undefined
|
|
3834
3833
|
? undefined
|
|
3835
|
-
: windowFrom(order === 'desc' ? window.lo - 1 : window.hi + 1)
|
|
3834
|
+
: await windowFrom(order === 'desc' ? window.lo - 1 : window.hi + 1)
|
|
3836
3835
|
}
|
|
3837
3836
|
|
|
3838
3837
|
while (accumulated.length <= limit && window !== undefined) {
|
|
@@ -3857,14 +3856,14 @@ async function getSwaps(c: Context<App.Environment>, options: getSwaps.Options)
|
|
|
3857
3856
|
const tail = groups.at(-1)
|
|
3858
3857
|
if (tail === undefined) {
|
|
3859
3858
|
if (fetchedFull) break
|
|
3860
|
-
slideWindow()
|
|
3859
|
+
await slideWindow()
|
|
3861
3860
|
continue
|
|
3862
3861
|
}
|
|
3863
3862
|
|
|
3864
3863
|
// A short batch exhausts this window; a full one may leave more groups
|
|
3865
3864
|
// in it, so advance the keyset cursor and re-query the same window.
|
|
3866
3865
|
if (!fetchedFull) {
|
|
3867
|
-
slideWindow()
|
|
3866
|
+
await slideWindow()
|
|
3868
3867
|
continue
|
|
3869
3868
|
}
|
|
3870
3869
|
const next = cursorAfterWholeGroup(tail)
|
|
@@ -3875,7 +3874,7 @@ async function getSwaps(c: Context<App.Environment>, options: getSwaps.Options)
|
|
|
3875
3874
|
Number(activeCursor[1]) === next[1] &&
|
|
3876
3875
|
Number(activeCursor[2]) === next[2]
|
|
3877
3876
|
) {
|
|
3878
|
-
slideWindow()
|
|
3877
|
+
await slideWindow()
|
|
3879
3878
|
continue
|
|
3880
3879
|
}
|
|
3881
3880
|
activeCursor = [next[0], next[1], next[2]]
|
|
@@ -5623,30 +5622,38 @@ async function providerQuoteResponse(
|
|
|
5623
5622
|
if (!destinationToken || !sourceToken)
|
|
5624
5623
|
throw new Error('Unable to resolve exchange quote token metadata')
|
|
5625
5624
|
|
|
5626
|
-
const denomination = query['valuation.currency']
|
|
5627
|
-
const snapshot =
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5625
|
+
const denomination = query['valuation.currency']
|
|
5626
|
+
const snapshot = denomination
|
|
5627
|
+
? await VerifiedTokens.snapshot(c, chainId).catch(() => undefined)
|
|
5628
|
+
: undefined
|
|
5629
|
+
const rates = denomination
|
|
5630
|
+
? await Valuation.ratesFor(c, {
|
|
5631
|
+
currencies: snapshot
|
|
5632
|
+
? [request.destinationToken, request.sourceToken].flatMap((address) => {
|
|
5633
|
+
const held = snapshot.byAddress.get(address.toLowerCase())?.currency
|
|
5634
|
+
return held === undefined ? [] : [held]
|
|
5635
|
+
})
|
|
5636
|
+
: [],
|
|
5637
|
+
denomination,
|
|
5638
|
+
oracle,
|
|
5639
|
+
})
|
|
5640
|
+
: undefined
|
|
5638
5641
|
const valued = (
|
|
5639
5642
|
baseUnits: bigint | string,
|
|
5640
5643
|
address: string,
|
|
5641
5644
|
token: { currency: string; decimals: number },
|
|
5642
5645
|
) => ({
|
|
5643
5646
|
...Value.tokenAmount({ baseUnits, currency: token.currency, decimals: token.decimals }),
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5647
|
+
...(denomination
|
|
5648
|
+
? {
|
|
5649
|
+
valuation: Valuation.valuationFor({
|
|
5650
|
+
amount: BigInt(baseUnits),
|
|
5651
|
+
denomination,
|
|
5652
|
+
rates,
|
|
5653
|
+
token: snapshot?.byAddress.get(address.toLowerCase()),
|
|
5654
|
+
}),
|
|
5655
|
+
}
|
|
5656
|
+
: {}),
|
|
5650
5657
|
})
|
|
5651
5658
|
const execution =
|
|
5652
5659
|
quote.status === 'ready'
|
|
@@ -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
|
+
})
|