tapimo 0.4.4 → 0.5.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/App.d.ts +4701 -3416
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +24 -2
- package/dist/App.js.map +1 -1
- package/dist/Assets.js +3 -3
- package/dist/Assets.js.map +1 -1
- package/dist/Scope.d.ts +18 -1
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +23 -3
- package/dist/Scope.js.map +1 -1
- package/dist/Webhooks.d.ts +1 -1
- package/dist/Webhooks.d.ts.map +1 -1
- package/dist/Webhooks.js +5 -10
- package/dist/Webhooks.js.map +1 -1
- package/dist/admin/App.d.ts +6 -34
- package/dist/admin/App.d.ts.map +1 -1
- package/dist/admin/apps/api-keys.d.ts +3 -3
- package/dist/admin/apps/api-keys.d.ts.map +1 -1
- package/dist/admin/apps/api-keys.js +4 -1
- package/dist/admin/apps/api-keys.js.map +1 -1
- package/dist/admin/apps/scopes.d.ts +6 -34
- package/dist/admin/apps/scopes.d.ts.map +1 -1
- package/dist/admin/apps/scopes.js +2 -2
- package/dist/admin/apps/scopes.js.map +1 -1
- package/dist/admin/apps/verified-tokens.d.ts +57 -57
- package/dist/admin/ui.generated.d.ts +1 -1
- package/dist/admin/ui.generated.js +33 -33
- package/dist/admin/ui.generated.js.map +1 -1
- package/dist/apps/data/App.d.ts +4574 -4277
- package/dist/apps/data/App.d.ts.map +1 -1
- package/dist/apps/data/App.js +155 -77
- package/dist/apps/data/App.js.map +1 -1
- package/dist/apps/data/FundingQuoteProviders.d.ts +109 -0
- package/dist/apps/data/FundingQuoteProviders.d.ts.map +1 -0
- package/dist/apps/data/FundingQuoteProviders.js +464 -0
- package/dist/apps/data/FundingQuoteProviders.js.map +1 -0
- package/dist/apps/data/index.d.ts +1 -1
- package/dist/apps/data/index.js +1 -1
- package/dist/apps/data/routes/activities.d.ts +26 -26
- package/dist/apps/data/routes/addresses.d.ts +38 -38
- package/dist/apps/data/routes/balances.d.ts +45 -45
- package/dist/apps/data/routes/balances.d.ts.map +1 -1
- package/dist/apps/data/routes/balances.js +67 -149
- package/dist/apps/data/routes/balances.js.map +1 -1
- package/dist/apps/data/routes/blocks.d.ts +2 -3
- package/dist/apps/data/routes/blocks.d.ts.map +1 -1
- package/dist/apps/data/routes/blocks.js +3 -5
- package/dist/apps/data/routes/blocks.js.map +1 -1
- package/dist/apps/data/routes/coingecko.d.ts +177 -176
- package/dist/apps/data/routes/coingecko.d.ts.map +1 -1
- package/dist/apps/data/routes/coingecko.js +3 -8
- package/dist/apps/data/routes/coingecko.js.map +1 -1
- package/dist/apps/data/routes/funding.d.ts +131 -228
- package/dist/apps/data/routes/funding.d.ts.map +1 -1
- package/dist/apps/data/routes/funding.js +152 -219
- package/dist/apps/data/routes/funding.js.map +1 -1
- package/dist/apps/data/routes/indexer.d.ts +34 -34
- package/dist/apps/data/routes/indexer.d.ts.map +1 -1
- package/dist/apps/data/routes/indexer.js +9 -2
- package/dist/apps/data/routes/indexer.js.map +1 -1
- package/dist/apps/data/routes/receipts.d.ts +228 -228
- package/dist/apps/data/routes/rpc.d.ts.map +1 -1
- package/dist/apps/data/routes/rpc.js +86 -16
- 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/verified-tokens.d.ts +5 -5
- package/dist/apps/data/routes/webhooks.d.ts +340 -0
- package/dist/apps/data/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/data/routes/webhooks.js +13 -1
- package/dist/apps/data/routes/webhooks.js.map +1 -1
- package/dist/apps/index.d.ts +1 -1
- package/dist/apps/index.js +1 -1
- package/dist/apps/management/App.d.ts +1833 -851
- package/dist/apps/management/App.d.ts.map +1 -1
- package/dist/apps/management/App.js +4 -0
- package/dist/apps/management/App.js.map +1 -1
- package/dist/apps/management/routes/api-keys.d.ts +41 -41
- package/dist/apps/management/routes/api-keys.js +2 -2
- package/dist/apps/management/routes/api-keys.js.map +1 -1
- package/dist/apps/management/routes/billing.d.ts +48 -48
- package/dist/apps/management/routes/invitations.d.ts +132 -132
- package/dist/apps/management/routes/invite-links.d.ts +1100 -0
- package/dist/apps/management/routes/invite-links.d.ts.map +1 -0
- package/dist/apps/management/routes/invite-links.js +411 -0
- package/dist/apps/management/routes/invite-links.js.map +1 -0
- package/dist/apps/management/routes/members.d.ts +41 -41
- package/dist/apps/management/routes/orgs.d.ts +92 -92
- package/dist/apps/management/routes/projects.d.ts +9 -9
- package/dist/apps/management/routes/scopes.d.ts.map +1 -1
- package/dist/apps/management/routes/scopes.js +2 -2
- package/dist/apps/management/routes/scopes.js.map +1 -1
- package/dist/apps/management/routes/usage.d.ts +24 -24
- package/dist/apps/mcp.js +2 -2
- package/dist/apps/mcp.js.map +1 -1
- package/dist/apps/relay/App.d.ts +2 -2
- package/dist/apps/relay/App.d.ts.map +1 -1
- package/dist/apps/relay/App.js +44 -6
- package/dist/apps/relay/App.js.map +1 -1
- package/dist/db/Db.d.ts +3 -0
- package/dist/db/Db.d.ts.map +1 -1
- package/dist/db/Db.js +57 -0
- package/dist/db/Db.js.map +1 -1
- package/dist/db/Schema.d.ts +31 -0
- package/dist/db/Schema.d.ts.map +1 -1
- package/dist/db/Schema.js +31 -0
- package/dist/db/Schema.js.map +1 -1
- package/dist/db/tables/inviteLinks.d.ts +42 -0
- package/dist/db/tables/inviteLinks.d.ts.map +1 -0
- package/dist/db/tables/inviteLinks.js +148 -0
- package/dist/db/tables/inviteLinks.js.map +1 -0
- package/dist/db/tables/organizations.d.ts.map +1 -1
- package/dist/db/tables/organizations.js +2 -0
- package/dist/db/tables/organizations.js.map +1 -1
- package/dist/db/tables/sponsoredTransactions.d.ts.map +1 -1
- package/dist/db/tables/sponsoredTransactions.js +6 -2
- package/dist/db/tables/sponsoredTransactions.js.map +1 -1
- package/dist/handlers/relay.d.ts.map +1 -1
- package/dist/handlers/relay.js +13 -3
- package/dist/handlers/relay.js.map +1 -1
- package/dist/internal/Auth.d.ts +9 -1
- package/dist/internal/Auth.d.ts.map +1 -1
- package/dist/internal/Auth.js +138 -10
- package/dist/internal/Auth.js.map +1 -1
- package/dist/internal/EdgeCache.d.ts +3 -1
- package/dist/internal/EdgeCache.d.ts.map +1 -1
- package/dist/internal/EdgeCache.js +17 -2
- package/dist/internal/EdgeCache.js.map +1 -1
- package/dist/internal/{FundingRoutes.d.ts → FundingQuotes.d.ts} +240 -369
- package/dist/internal/FundingQuotes.d.ts.map +1 -0
- package/dist/internal/{FundingRoutes.js → FundingQuotes.js} +144 -183
- package/dist/internal/FundingQuotes.js.map +1 -0
- package/dist/internal/Log.d.ts +18 -12
- 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/Tidx.d.ts +9 -3
- package/dist/internal/Tidx.d.ts.map +1 -1
- package/dist/internal/Tidx.js +13 -7
- package/dist/internal/Tidx.js.map +1 -1
- package/dist/internal/Viem.d.ts +17 -2
- package/dist/internal/Viem.d.ts.map +1 -1
- package/dist/internal/Viem.js +30 -3
- package/dist/internal/Viem.js.map +1 -1
- package/dist/internal/index.d.ts +1 -1
- package/dist/internal/index.js +1 -1
- package/package.json +2 -2
- package/src/ApiKeys.test.ts +25 -0
- package/src/App.test-d.ts +2 -0
- package/src/App.test.ts +13 -2
- package/src/App.ts +37 -5
- package/src/Assets.ts +3 -3
- package/src/Client.test-d.ts +21 -11
- package/src/Scope.test.ts +1 -0
- package/src/Scope.ts +32 -4
- package/src/Webhooks.ts +5 -10
- package/src/admin/apps/api-keys.test.ts +27 -0
- package/src/admin/apps/api-keys.ts +8 -1
- package/src/admin/apps/scopes.test.ts +7 -2
- package/src/admin/apps/scopes.ts +2 -2
- package/src/admin/ui/src/components/Dialog.tsx +8 -2
- package/src/admin/ui/src/lib/scopes.test.ts +19 -0
- package/src/admin/ui/src/lib/scopes.ts +12 -0
- package/src/admin/ui/src/routes/api-keys.tsx +128 -27
- package/src/admin/ui.generated.ts +33 -33
- package/src/apps/composition.test.ts +77 -0
- package/src/apps/data/App.test.ts +354 -0
- package/src/apps/data/App.ts +178 -91
- package/src/apps/data/FundingQuoteProviders.test.ts +577 -0
- package/src/apps/data/FundingQuoteProviders.ts +633 -0
- package/src/apps/data/index.ts +1 -1
- package/src/apps/data/routes/balances.test.ts +64 -18
- package/src/apps/data/routes/balances.ts +76 -177
- package/src/apps/data/routes/blocks.ts +3 -5
- package/src/apps/data/routes/coingecko.ts +3 -8
- package/src/apps/data/routes/funding.test.ts +304 -192
- package/src/apps/data/routes/funding.ts +166 -286
- package/src/apps/data/routes/indexer.test.ts +173 -15
- package/src/apps/data/routes/indexer.ts +8 -2
- package/src/apps/data/routes/rpc.test.ts +219 -0
- package/src/apps/data/routes/rpc.ts +92 -17
- package/src/apps/data/routes/webhooks.test.ts +21 -0
- package/src/apps/data/routes/webhooks.ts +13 -1
- package/src/apps/index.ts +1 -1
- package/src/apps/management/App.ts +4 -0
- package/src/apps/management/Billing.test.ts +2 -2
- package/src/apps/management/routes/api-keys.test.ts +47 -3
- package/src/apps/management/routes/api-keys.ts +2 -2
- package/src/apps/management/routes/invite-links.test.ts +385 -0
- package/src/apps/management/routes/invite-links.ts +570 -0
- package/src/apps/management/routes/scopes.test.ts +3 -2
- package/src/apps/management/routes/scopes.ts +4 -2
- package/src/apps/mcp.test.ts +18 -0
- package/src/apps/mcp.ts +2 -2
- package/src/apps/relay/App.test.ts +328 -7
- package/src/apps/relay/App.ts +42 -6
- package/src/apps/relay/Sponsorships.test.ts +2 -2
- package/src/db/Db.test.ts +5 -5
- package/src/db/Db.ts +65 -0
- package/src/db/Schema.ts +39 -0
- package/src/db/tables/billingSettings.test.ts +2 -2
- package/src/db/tables/inviteLinks.ts +187 -0
- package/src/db/tables/organizations.test.ts +2 -2
- package/src/db/tables/organizations.ts +2 -0
- package/src/db/tables/sponsoredTransactions.test.ts +19 -2
- package/src/db/tables/sponsoredTransactions.ts +21 -14
- package/src/db/tables/stripeCustomers.test.ts +2 -2
- package/src/handlers/relay.ts +16 -4
- package/src/internal/Auth.test.ts +132 -22
- package/src/internal/Auth.ts +181 -14
- package/src/internal/EdgeCache.test.ts +24 -3
- package/src/internal/EdgeCache.ts +18 -2
- package/src/internal/FundingQuotes.test.ts +268 -0
- package/src/internal/{FundingRoutes.ts → FundingQuotes.ts} +216 -277
- package/src/internal/Log.ts +21 -14
- package/src/internal/Tidx.test.ts +48 -0
- package/src/internal/Tidx.ts +21 -7
- package/src/internal/Viem.test.ts +46 -0
- package/src/internal/Viem.ts +48 -6
- package/src/internal/index.test.ts +1 -1
- package/src/internal/index.ts +1 -1
- package/dist/apps/data/FundingRouteProviders.d.ts +0 -36
- package/dist/apps/data/FundingRouteProviders.d.ts.map +0 -1
- package/dist/apps/data/FundingRouteProviders.js +0 -245
- package/dist/apps/data/FundingRouteProviders.js.map +0 -1
- package/dist/internal/FundingRoutes.d.ts.map +0 -1
- package/dist/internal/FundingRoutes.js.map +0 -1
- package/src/apps/data/FundingRouteProviders.test.ts +0 -225
- package/src/apps/data/FundingRouteProviders.ts +0 -312
- package/src/internal/FundingRoutes.test.ts +0 -213
|
@@ -4,18 +4,19 @@ import * as z from 'zod/mini'
|
|
|
4
4
|
import type * as App from '../../../App.js'
|
|
5
5
|
import * as Auth from '../../../internal/Auth.js'
|
|
6
6
|
import * as Cache from '../../../internal/Cache.js'
|
|
7
|
-
import * as
|
|
7
|
+
import * as FundingQuotes from '../../../internal/FundingQuotes.js'
|
|
8
8
|
import * as OpenApi from '../../../internal/OpenApi.js'
|
|
9
9
|
import * as Response from '../../../internal/Response.js'
|
|
10
10
|
import * as Schema from '../../../internal/Schema.js'
|
|
11
|
+
import * as FundingQuoteProviders from '../FundingQuoteProviders.js'
|
|
11
12
|
|
|
12
|
-
/** Zod schemas owned by
|
|
13
|
+
/** Zod schemas owned by funding quote resources. */
|
|
13
14
|
export namespace schema {
|
|
14
15
|
/** Source or destination chain reference. */
|
|
15
16
|
export const Chain = Schema.describe(
|
|
16
17
|
z.object({
|
|
17
18
|
addressFormat: z
|
|
18
|
-
.enum(['
|
|
19
|
+
.enum(['base58', 'base58check', 'evm'])
|
|
19
20
|
.check(
|
|
20
21
|
z.describe('Address family used by accounts and token identifiers on this chain.'),
|
|
21
22
|
z.meta({ examples: ['evm'] }),
|
|
@@ -24,7 +25,7 @@ export namespace schema {
|
|
|
24
25
|
.string()
|
|
25
26
|
.check(
|
|
26
27
|
z.describe(
|
|
27
|
-
'Stable chain id
|
|
28
|
+
'Stable chain id. Uses CAIP-2 where standardized and a Tempo-defined compatible id otherwise.',
|
|
28
29
|
),
|
|
29
30
|
z.meta({ examples: ['eip155:8453'] }),
|
|
30
31
|
),
|
|
@@ -40,11 +41,11 @@ export namespace schema {
|
|
|
40
41
|
providerIds: z
|
|
41
42
|
.optional(z.record(z.string(), z.string()))
|
|
42
43
|
.check(
|
|
43
|
-
z.describe('Provider-specific chain ids Tempo uses when
|
|
44
|
-
z.meta({ examples: [{
|
|
44
|
+
z.describe('Provider-specific chain ids Tempo uses when requesting quotes.'),
|
|
45
|
+
z.meta({ examples: [{ across: '8453', relay: '8453', rhino: 'BASE' }] }),
|
|
45
46
|
),
|
|
46
47
|
}),
|
|
47
|
-
'A normalized chain reference for funding
|
|
48
|
+
'A normalized chain reference for funding quotes.',
|
|
48
49
|
)
|
|
49
50
|
|
|
50
51
|
/** Source or destination token reference. */
|
|
@@ -88,14 +89,14 @@ export namespace schema {
|
|
|
88
89
|
verified: z
|
|
89
90
|
.boolean()
|
|
90
91
|
.check(
|
|
91
|
-
z.describe('Whether Tempo recognizes this token in its funding
|
|
92
|
+
z.describe('Whether Tempo recognizes this token in its funding quote inventory.'),
|
|
92
93
|
z.meta({ examples: [true] }),
|
|
93
94
|
),
|
|
94
95
|
}),
|
|
95
|
-
'A normalized token reference for funding
|
|
96
|
+
'A normalized token reference for funding quotes.',
|
|
96
97
|
)
|
|
97
98
|
|
|
98
|
-
/** Source amount echoed by a funding
|
|
99
|
+
/** Source amount echoed by a funding quote response. */
|
|
99
100
|
export const TokenAmount = Schema.describe(
|
|
100
101
|
z.object({
|
|
101
102
|
amount: Schema.DecimalString.check(
|
|
@@ -109,25 +110,21 @@ export namespace schema {
|
|
|
109
110
|
),
|
|
110
111
|
z.meta({ examples: ['1'] }),
|
|
111
112
|
),
|
|
112
|
-
usd: z
|
|
113
|
-
.nullable(z.string())
|
|
114
|
-
.check(
|
|
115
|
-
z.describe('USD estimate for the requested source amount, when available.'),
|
|
116
|
-
z.meta({ examples: ['1.00'] }),
|
|
117
|
-
),
|
|
118
113
|
}),
|
|
119
114
|
'The requested source amount in provider-safe base units and display form.',
|
|
120
115
|
)
|
|
121
116
|
|
|
122
|
-
/** Provider summary embedded in a
|
|
117
|
+
/** Provider summary embedded in a funding quote. */
|
|
123
118
|
export const ProviderRef = Schema.describe(
|
|
124
119
|
z.object({
|
|
125
|
-
id: z
|
|
120
|
+
id: z
|
|
121
|
+
.enum(['across', 'relay', 'rhino'])
|
|
122
|
+
.check(z.describe('Stable provider id.'), z.meta({ examples: ['relay'] })),
|
|
126
123
|
kind: z
|
|
127
124
|
.string()
|
|
128
125
|
.check(
|
|
129
|
-
z.describe('Provider category, such as
|
|
130
|
-
z.meta({ examples: ['
|
|
126
|
+
z.describe('Provider category, such as a solver network or aggregator.'),
|
|
127
|
+
z.meta({ examples: ['solverNetwork'] }),
|
|
131
128
|
),
|
|
132
129
|
name: z
|
|
133
130
|
.string()
|
|
@@ -136,124 +133,71 @@ export namespace schema {
|
|
|
136
133
|
.boolean()
|
|
137
134
|
.check(
|
|
138
135
|
z.describe('Whether Tempo needs provider credentials to query or use this provider.'),
|
|
139
|
-
z.meta({ examples: [
|
|
136
|
+
z.meta({ examples: [false] }),
|
|
140
137
|
),
|
|
141
138
|
}),
|
|
142
|
-
'Provider metadata embedded in a
|
|
139
|
+
'Provider metadata embedded in a funding quote.',
|
|
143
140
|
)
|
|
144
141
|
|
|
145
|
-
/**
|
|
142
|
+
/** Quote quality signals exposed directly instead of implied by list order. */
|
|
146
143
|
export const Quality = Schema.describe(
|
|
147
144
|
z.object({
|
|
148
|
-
availableVolumeUsd: z
|
|
149
|
-
.nullable(z.string())
|
|
150
|
-
.check(
|
|
151
|
-
z.describe('Available USD capacity, when available.'),
|
|
152
|
-
z.meta({ examples: ['1114274.43'] }),
|
|
153
|
-
),
|
|
154
145
|
estimatedSeconds: z
|
|
155
|
-
.
|
|
146
|
+
.optional(z.number().check(z.int(), z.nonnegative()))
|
|
156
147
|
.check(
|
|
157
148
|
z.describe('Estimated settlement time in seconds, when known.'),
|
|
158
149
|
z.meta({ examples: [2] }),
|
|
159
150
|
),
|
|
160
|
-
feeBps: z
|
|
161
|
-
.nullable(z.number().check(z.int(), z.nonnegative()))
|
|
162
|
-
.check(
|
|
163
|
-
z.describe('Estimated fee in basis points, when known.'),
|
|
164
|
-
z.meta({ examples: [109] }),
|
|
165
|
-
),
|
|
166
|
-
historicalVolumeUsd24h: z
|
|
167
|
-
.nullable(z.string())
|
|
168
|
-
.check(
|
|
169
|
-
z.describe('24h routed volume in USD, when available.'),
|
|
170
|
-
z.meta({ examples: ['250000.00'] }),
|
|
171
|
-
),
|
|
172
|
-
instantVolumeUsd: z
|
|
173
|
-
.nullable(z.string())
|
|
174
|
-
.check(
|
|
175
|
-
z.describe('Instant USD capacity, when available.'),
|
|
176
|
-
z.meta({ examples: ['12453.94'] }),
|
|
177
|
-
),
|
|
178
151
|
liquiditySource: z
|
|
179
152
|
.string()
|
|
180
153
|
.check(
|
|
181
|
-
z.describe('
|
|
182
|
-
z.meta({ examples: ['
|
|
183
|
-
),
|
|
184
|
-
score: z
|
|
185
|
-
.nullable(z.number().check(z.int(), z.gte(0), z.lte(100)))
|
|
186
|
-
.check(
|
|
187
|
-
z.describe('Explainable route score from 0 to 100, when enough signals are available.'),
|
|
188
|
-
z.meta({ examples: [91] }),
|
|
154
|
+
z.describe('Provider source for the live quote quality signal.'),
|
|
155
|
+
z.meta({ examples: ['providerQuote'] }),
|
|
189
156
|
),
|
|
190
157
|
sourceDetail: z
|
|
191
|
-
.
|
|
158
|
+
.optional(z.string())
|
|
192
159
|
.check(
|
|
193
160
|
z.describe('Provider-specific source or endpoint detail for the quality signal.'),
|
|
194
161
|
z.meta({ examples: ['providerEndpoint'] }),
|
|
195
162
|
),
|
|
196
163
|
tier: z
|
|
197
|
-
.enum(['liquid', 'thin'
|
|
164
|
+
.enum(['liquid', 'thin'])
|
|
198
165
|
.check(
|
|
199
|
-
z.describe('Machine-readable
|
|
200
|
-
z.meta({ examples: ['
|
|
166
|
+
z.describe('Machine-readable quality tier for a successful quote.'),
|
|
167
|
+
z.meta({ examples: ['liquid'] }),
|
|
201
168
|
),
|
|
202
169
|
}),
|
|
203
|
-
'Machine-readable liquidity, fee, and source signals for a
|
|
170
|
+
'Machine-readable liquidity, fee, and source signals for a successful quote.',
|
|
204
171
|
)
|
|
205
172
|
|
|
206
|
-
/** Provider-derived
|
|
207
|
-
export const
|
|
173
|
+
/** Provider-derived output, limits, and freshness data. */
|
|
174
|
+
export const QuoteDetails = Schema.describe(
|
|
208
175
|
z.object({
|
|
209
176
|
expiresAt: z
|
|
210
|
-
.
|
|
177
|
+
.optional(z.iso.datetime())
|
|
211
178
|
.check(
|
|
212
|
-
z.describe('
|
|
213
|
-
z.meta({ examples: ['2026-01-01T00:
|
|
179
|
+
z.describe('Timestamp after which the provider quote is no longer valid.'),
|
|
180
|
+
z.meta({ examples: ['2026-01-01T00:01:00Z'] }),
|
|
214
181
|
),
|
|
215
182
|
inputAmount: Schema.DecimalString.check(
|
|
216
183
|
z.describe('Source amount sent to the provider in base units.'),
|
|
217
184
|
z.meta({ examples: ['1000000'] }),
|
|
218
185
|
),
|
|
219
|
-
limits: z
|
|
220
|
-
.nullable(
|
|
221
|
-
z.object({
|
|
222
|
-
instantSourceAmount: z
|
|
223
|
-
.nullable(Schema.DecimalString)
|
|
224
|
-
.check(
|
|
225
|
-
z.describe('Provider-reported instant source amount capacity.'),
|
|
226
|
-
z.meta({ examples: ['12453940000'] }),
|
|
227
|
-
),
|
|
228
|
-
maxSourceAmount: z
|
|
229
|
-
.nullable(Schema.DecimalString)
|
|
230
|
-
.check(
|
|
231
|
-
z.describe('Provider-reported maximum source amount.'),
|
|
232
|
-
z.meta({ examples: ['1114274433200'] }),
|
|
233
|
-
),
|
|
234
|
-
minSourceAmount: z
|
|
235
|
-
.nullable(Schema.DecimalString)
|
|
236
|
-
.check(
|
|
237
|
-
z.describe('Provider-reported minimum source amount.'),
|
|
238
|
-
z.meta({ examples: ['500063'] }),
|
|
239
|
-
),
|
|
240
|
-
}),
|
|
241
|
-
)
|
|
242
|
-
.check(z.describe('Provider limits expressed in source base units.')),
|
|
243
186
|
minimumOutputAmount: z
|
|
244
|
-
.
|
|
187
|
+
.optional(Schema.DecimalString)
|
|
245
188
|
.check(
|
|
246
189
|
z.describe('Slippage-adjusted minimum destination amount in base units.'),
|
|
247
190
|
z.meta({ examples: ['988000'] }),
|
|
248
191
|
),
|
|
249
192
|
outputAmount: z
|
|
250
|
-
.
|
|
193
|
+
.string()
|
|
194
|
+
.check(z.regex(/^\d+$/))
|
|
251
195
|
.check(
|
|
252
196
|
z.describe('Expected destination amount in base units.'),
|
|
253
197
|
z.meta({ examples: ['989102'] }),
|
|
254
198
|
),
|
|
255
199
|
outputAmountFormatted: z
|
|
256
|
-
.
|
|
200
|
+
.string()
|
|
257
201
|
.check(
|
|
258
202
|
z.describe('Expected destination amount rendered with destination token decimals.'),
|
|
259
203
|
z.meta({ examples: ['0.989102'] }),
|
|
@@ -261,58 +205,40 @@ export namespace schema {
|
|
|
261
205
|
sampledAt: z.iso
|
|
262
206
|
.datetime()
|
|
263
207
|
.check(
|
|
264
|
-
z.describe('Timestamp for the live quote
|
|
208
|
+
z.describe('Timestamp for the live quote probe.'),
|
|
265
209
|
z.meta({ examples: ['2026-01-01T00:00:00Z'] }),
|
|
266
210
|
),
|
|
267
211
|
}),
|
|
268
|
-
'Provider-derived
|
|
212
|
+
'Provider-derived output, limits, and freshness data for a funding quote.',
|
|
269
213
|
)
|
|
270
214
|
|
|
271
|
-
/**
|
|
272
|
-
export const
|
|
215
|
+
/** Successful live funding quote. */
|
|
216
|
+
export const FundingQuote = Schema.describe(
|
|
273
217
|
z.object({
|
|
274
218
|
destinationChain: Chain.check(z.describe('Destination chain, always Tempo mainnet in V1.')),
|
|
275
|
-
destinationToken: Token.check(z.describe('Tempo token expected from this
|
|
276
|
-
errorCode: z
|
|
277
|
-
.nullable(z.string())
|
|
278
|
-
.check(
|
|
279
|
-
z.describe('Stable route error code, when status is `error`.'),
|
|
280
|
-
z.meta({ examples: ['provider_timeout'] }),
|
|
281
|
-
),
|
|
219
|
+
destinationToken: Token.check(z.describe('Tempo token expected from this quote.')),
|
|
282
220
|
id: z
|
|
283
221
|
.string()
|
|
284
222
|
.check(
|
|
285
|
-
z.describe('Stable deterministic
|
|
223
|
+
z.describe('Stable deterministic funding quote id.'),
|
|
286
224
|
z.meta({ examples: ['base-usdc-tempo-usdce-relay'] }),
|
|
287
225
|
),
|
|
288
226
|
provider: ProviderRef,
|
|
289
227
|
quality: Quality,
|
|
290
|
-
quote:
|
|
291
|
-
.nullable(RouteQuote)
|
|
292
|
-
.check(z.describe('Provider-derived quote data, when a live route probe succeeds.')),
|
|
228
|
+
quote: QuoteDetails,
|
|
293
229
|
sourceAmount: TokenAmount,
|
|
294
230
|
sourceChain: Chain.check(z.describe('Chain where the caller currently holds funds.')),
|
|
295
231
|
sourceToken: Token.check(z.describe('Token the caller currently holds.')),
|
|
296
|
-
status: z
|
|
297
|
-
.enum(['available', 'thin', 'unknown', 'unavailable', 'error'])
|
|
298
|
-
.check(
|
|
299
|
-
z.describe('Provider-specific route status for the requested amount.'),
|
|
300
|
-
z.meta({ examples: ['unknown'] }),
|
|
301
|
-
),
|
|
302
232
|
}),
|
|
303
|
-
'One provider-specific funding
|
|
233
|
+
'One successful provider-specific funding quote.',
|
|
304
234
|
)
|
|
305
235
|
|
|
306
|
-
/**
|
|
236
|
+
/** Funding quote provider catalog entry. */
|
|
307
237
|
export const Provider = Schema.describe(
|
|
308
238
|
z.object({
|
|
309
|
-
|
|
310
|
-
.
|
|
311
|
-
.check(
|
|
312
|
-
z.describe('Provider capabilities Tempo exposes through public APIs.'),
|
|
313
|
-
z.meta({ examples: [['fundingRoutes']] }),
|
|
314
|
-
),
|
|
315
|
-
id: z.string().check(z.describe('Stable provider id.'), z.meta({ examples: ['relay'] })),
|
|
239
|
+
id: z
|
|
240
|
+
.enum(['across', 'relay', 'rhino'])
|
|
241
|
+
.check(z.describe('Stable provider id.'), z.meta({ examples: ['relay'] })),
|
|
316
242
|
kind: z
|
|
317
243
|
.string()
|
|
318
244
|
.check(z.describe('Provider category.'), z.meta({ examples: ['solverNetwork'] })),
|
|
@@ -326,15 +252,15 @@ export namespace schema {
|
|
|
326
252
|
z.meta({ examples: [false] }),
|
|
327
253
|
),
|
|
328
254
|
status: z
|
|
329
|
-
.enum(['configured', '
|
|
255
|
+
.enum(['configured', 'unconfigured'])
|
|
330
256
|
.check(
|
|
331
257
|
z.describe(
|
|
332
|
-
'`
|
|
258
|
+
'`configured` means live quotes are enabled for this deployment. `unconfigured` means the provider is supported but unavailable here.',
|
|
333
259
|
),
|
|
334
|
-
z.meta({ examples: ['
|
|
260
|
+
z.meta({ examples: ['configured', 'unconfigured'] }),
|
|
335
261
|
),
|
|
336
262
|
}),
|
|
337
|
-
'One
|
|
263
|
+
'One funding quote provider.',
|
|
338
264
|
)
|
|
339
265
|
|
|
340
266
|
/** Chain inventory entry returned by the funding chains endpoint. */
|
|
@@ -345,9 +271,9 @@ export namespace schema {
|
|
|
345
271
|
'One source chain and its known stablecoin inventory.',
|
|
346
272
|
)
|
|
347
273
|
|
|
348
|
-
/** Schemas for the
|
|
349
|
-
export namespace
|
|
350
|
-
/** Query parameters for funding
|
|
274
|
+
/** Schemas for the quoteFunding operation. */
|
|
275
|
+
export namespace quoteFunding {
|
|
276
|
+
/** Query parameters for live funding quotes. */
|
|
351
277
|
export const Query = z
|
|
352
278
|
.strictObject({
|
|
353
279
|
destinationToken: z
|
|
@@ -358,26 +284,21 @@ export namespace schema {
|
|
|
358
284
|
),
|
|
359
285
|
z.meta({ examples: ['USDC.e'] }),
|
|
360
286
|
),
|
|
361
|
-
include: z
|
|
362
|
-
.optional(z.string())
|
|
363
|
-
.check(
|
|
364
|
-
z.describe('Comma-separated response expansions. V1 accepts `quotes`.'),
|
|
365
|
-
z.meta({ examples: ['quotes'] }),
|
|
366
|
-
),
|
|
367
|
-
limit: Schema.Limit,
|
|
368
287
|
provider: z
|
|
369
|
-
.optional(z.
|
|
288
|
+
.optional(z.enum(['across', 'relay', 'rhino']))
|
|
370
289
|
.check(
|
|
371
290
|
z.describe(
|
|
372
|
-
'Only
|
|
291
|
+
'Only request a quote from this provider. Supported ids are `across`, `relay`, and `rhino`; omit it to query every configured provider.',
|
|
373
292
|
),
|
|
374
|
-
z.meta({ examples: ['relay'
|
|
293
|
+
z.meta({ examples: ['relay'] }),
|
|
375
294
|
),
|
|
376
295
|
sourceAmount: z
|
|
377
296
|
.string()
|
|
378
297
|
.check(
|
|
379
|
-
z.
|
|
380
|
-
z.describe(
|
|
298
|
+
z.regex(/^(?=.*[1-9])\d+(\.\d+)?$/),
|
|
299
|
+
z.describe(
|
|
300
|
+
'Positive source token amount. Base units by default, so 1 USDC is `1000000`.',
|
|
301
|
+
),
|
|
381
302
|
z.meta({ examples: ['1000000'] }),
|
|
382
303
|
),
|
|
383
304
|
sourceAmountUnits: z
|
|
@@ -391,34 +312,28 @@ export namespace schema {
|
|
|
391
312
|
.check(
|
|
392
313
|
z.minLength(1),
|
|
393
314
|
z.describe(
|
|
394
|
-
'Source chain alias or
|
|
315
|
+
'Source chain alias or stable id, such as `base`, `solana`, or `eip155:8453`.',
|
|
395
316
|
),
|
|
396
|
-
z.meta({ examples: ['base', '
|
|
317
|
+
z.meta({ examples: ['base', 'eip155:8453'] }),
|
|
397
318
|
),
|
|
398
|
-
sourceToken: z
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
319
|
+
sourceToken: z
|
|
320
|
+
.string()
|
|
321
|
+
.check(
|
|
322
|
+
z.minLength(1),
|
|
323
|
+
z.describe(
|
|
324
|
+
'Source token symbol, contract address, or Tempo token key. Lookup is scoped to `sourceChain`; non-EVM addresses are case-sensitive. An unknown token returns an empty list.',
|
|
325
|
+
),
|
|
326
|
+
z.meta({ examples: ['USDC', '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913'] }),
|
|
402
327
|
),
|
|
403
|
-
z.meta({
|
|
404
|
-
examples: [
|
|
405
|
-
'USDC',
|
|
406
|
-
'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
|
|
407
|
-
'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',
|
|
408
|
-
],
|
|
409
|
-
}),
|
|
410
|
-
),
|
|
411
328
|
})
|
|
412
|
-
.check(z.describe('Query parameters for
|
|
329
|
+
.check(z.describe('Query parameters for live funding quotes into Tempo.'))
|
|
413
330
|
|
|
414
|
-
/** Non-paginated list of funding
|
|
331
|
+
/** Non-paginated list of successful funding quotes. */
|
|
415
332
|
export const Response = Schema.describe(
|
|
416
333
|
z.object({
|
|
417
|
-
data: z
|
|
418
|
-
.array(RouteCandidate)
|
|
419
|
-
.check(z.describe('Funding route candidates matching the request.')),
|
|
334
|
+
data: z.array(FundingQuote).check(z.describe('Successful live funding quotes.')),
|
|
420
335
|
}),
|
|
421
|
-
'A non-paginated list of funding
|
|
336
|
+
'A non-paginated list of successful live funding quotes.',
|
|
422
337
|
)
|
|
423
338
|
}
|
|
424
339
|
|
|
@@ -429,7 +344,7 @@ export namespace schema {
|
|
|
429
344
|
z.object({
|
|
430
345
|
data: z
|
|
431
346
|
.array(ChainInventory)
|
|
432
|
-
.check(z.describe('Source chains and stablecoins
|
|
347
|
+
.check(z.describe('Source chains and stablecoins supported by funding quotes.')),
|
|
433
348
|
}),
|
|
434
349
|
'A non-paginated list of source chains and stablecoin inventory.',
|
|
435
350
|
)
|
|
@@ -437,118 +352,90 @@ export namespace schema {
|
|
|
437
352
|
|
|
438
353
|
/** Schemas for the listProviders operation. */
|
|
439
354
|
export namespace listProviders {
|
|
440
|
-
/**
|
|
441
|
-
export const Query = z
|
|
442
|
-
.strictObject({
|
|
443
|
-
capability: z
|
|
444
|
-
.optional(z.enum(['fundingRoutes']))
|
|
445
|
-
.check(
|
|
446
|
-
z.describe('Optional provider capability filter.'),
|
|
447
|
-
z.meta({ examples: ['fundingRoutes'] }),
|
|
448
|
-
),
|
|
449
|
-
})
|
|
450
|
-
.check(z.describe('Query parameters for listing providers.'))
|
|
451
|
-
|
|
452
|
-
/** Non-paginated generic provider catalog. */
|
|
355
|
+
/** Non-paginated funding quote provider catalog. */
|
|
453
356
|
export const Response = Schema.describe(
|
|
454
357
|
z.object({
|
|
455
|
-
data: z.array(Provider).check(z.describe("Providers in Tempo's
|
|
358
|
+
data: z.array(Provider).check(z.describe("Providers in Tempo's funding quote catalog.")),
|
|
456
359
|
}),
|
|
457
|
-
'A non-paginated list of providers.',
|
|
360
|
+
'A non-paginated list of funding quote providers.',
|
|
458
361
|
)
|
|
459
362
|
}
|
|
460
363
|
}
|
|
461
364
|
|
|
462
|
-
|
|
463
|
-
const
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
} satisfies z.output<typeof schema.listFundingRoutes.Response>,
|
|
493
|
-
},
|
|
494
|
-
tronUsdt: {
|
|
495
|
-
description:
|
|
496
|
-
'`GET /v1/funding/routes?sourceChain=tron&sourceToken=TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t&sourceAmount=1000000&provider=bridge`',
|
|
497
|
-
summary: 'Tron USDT',
|
|
498
|
-
value: {
|
|
499
|
-
data: FundingRoutes.listStaticRoutes({
|
|
500
|
-
limit: 10,
|
|
501
|
-
provider: 'bridge',
|
|
502
|
-
sourceAmount: '1000000',
|
|
503
|
-
sourceAmountUnits: 'baseUnits',
|
|
504
|
-
sourceChain: 'tron',
|
|
505
|
-
sourceToken: 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',
|
|
506
|
-
}),
|
|
507
|
-
} satisfies z.output<typeof schema.listFundingRoutes.Response>,
|
|
508
|
-
},
|
|
509
|
-
} satisfies OpenApi.responses.Options<
|
|
510
|
-
typeof schema.listFundingRoutes.Response
|
|
511
|
-
>['success']['examples']
|
|
365
|
+
const fundingQuoteResponseExample = (() => {
|
|
366
|
+
const [candidate] = FundingQuotes.listQuoteCandidates({
|
|
367
|
+
provider: 'relay',
|
|
368
|
+
sourceAmount: '1000000',
|
|
369
|
+
sourceAmountUnits: 'baseUnits',
|
|
370
|
+
sourceChain: 'base',
|
|
371
|
+
sourceToken: 'USDC',
|
|
372
|
+
})
|
|
373
|
+
if (!candidate) throw new Error('Missing Relay funding quote example candidate')
|
|
374
|
+
return {
|
|
375
|
+
data: [
|
|
376
|
+
{
|
|
377
|
+
...candidate,
|
|
378
|
+
quality: {
|
|
379
|
+
estimatedSeconds: 1,
|
|
380
|
+
liquiditySource: 'providerQuote',
|
|
381
|
+
sourceDetail: 'relay:quote-v2',
|
|
382
|
+
tier: 'liquid',
|
|
383
|
+
},
|
|
384
|
+
quote: {
|
|
385
|
+
inputAmount: '1000000',
|
|
386
|
+
minimumOutputAmount: '939242',
|
|
387
|
+
outputAmount: '979295',
|
|
388
|
+
outputAmountFormatted: '0.979295',
|
|
389
|
+
sampledAt: '2026-01-01T00:00:00.000Z',
|
|
390
|
+
},
|
|
391
|
+
},
|
|
392
|
+
],
|
|
393
|
+
}
|
|
394
|
+
})() satisfies z.output<typeof schema.quoteFunding.Response>
|
|
512
395
|
|
|
513
396
|
const fundingChainsResponseExample = {
|
|
514
|
-
data:
|
|
397
|
+
data: FundingQuotes.listChains(),
|
|
515
398
|
} satisfies z.output<typeof schema.listFundingChains.Response>
|
|
516
399
|
|
|
517
400
|
const providersResponseExample = {
|
|
518
|
-
data:
|
|
401
|
+
data: FundingQuotes.listProviders().map((provider) => ({
|
|
402
|
+
...provider,
|
|
403
|
+
status: 'configured' as const,
|
|
404
|
+
})),
|
|
519
405
|
} satisfies z.output<typeof schema.listProviders.Response>
|
|
520
406
|
|
|
521
|
-
/** Mounts funding
|
|
407
|
+
/** Mounts live funding quotes and their supporting inventory endpoints. */
|
|
522
408
|
export function funding(options: funding.Options = {}) {
|
|
523
409
|
return new Hono<App.Environment>()
|
|
524
410
|
.get(
|
|
525
|
-
'/v1/funding/
|
|
411
|
+
'/v1/funding/quotes',
|
|
526
412
|
Auth.policy({ apiKey: { scopes: ['data:read'] }, mpp: true, public: true }),
|
|
527
|
-
OpenApi.validate('query', schema.
|
|
413
|
+
OpenApi.validate('query', schema.quoteFunding.Query, {
|
|
528
414
|
code: 'query_invalid',
|
|
529
415
|
message: 'Invalid query parameters',
|
|
530
416
|
}),
|
|
531
417
|
OpenApi.describeRoute({
|
|
532
418
|
description:
|
|
533
|
-
'
|
|
534
|
-
operationId: '
|
|
419
|
+
'Returns live quotes for funding Tempo with a stablecoin. Omit `provider` to query all configured providers. This endpoint does not execute a transfer.',
|
|
420
|
+
operationId: 'quoteFunding',
|
|
535
421
|
responses: OpenApi.responses({
|
|
536
|
-
errors: {
|
|
422
|
+
errors: {
|
|
423
|
+
400: { codes: ['query_invalid'] },
|
|
424
|
+
502: {
|
|
425
|
+
codes: ['upstream_error'],
|
|
426
|
+
description:
|
|
427
|
+
'No quote succeeded and at least one matching provider failed unexpectedly.',
|
|
428
|
+
},
|
|
429
|
+
},
|
|
537
430
|
success: {
|
|
538
|
-
description:
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
schema: schema.listFundingRoutes.Response,
|
|
431
|
+
description: 'Live funding quotes. An empty list means no provider returned a quote.',
|
|
432
|
+
example: fundingQuoteResponseExample,
|
|
433
|
+
schema: schema.quoteFunding.Response,
|
|
542
434
|
},
|
|
543
435
|
}),
|
|
544
|
-
summary: '
|
|
436
|
+
summary: 'Get funding quotes',
|
|
545
437
|
tags: ['Funding'],
|
|
546
438
|
}),
|
|
547
|
-
Cache.response<App.Environment>({
|
|
548
|
-
cacheControl: Cache.policies.noStore,
|
|
549
|
-
name: 'tempo-api:funding-routes:v1',
|
|
550
|
-
key: (c) => Cache.urlKey(c, schema.listFundingRoutes.Query),
|
|
551
|
-
}),
|
|
552
439
|
async (c) => {
|
|
553
440
|
if (Auth.narrowAccess) return Auth.paidAccessError(c)
|
|
554
441
|
if (OpenApi.narrowValidation)
|
|
@@ -559,16 +446,14 @@ export function funding(options: funding.Options = {}) {
|
|
|
559
446
|
|
|
560
447
|
const query = c.req.valid('query')
|
|
561
448
|
try {
|
|
562
|
-
|
|
449
|
+
c.header('Cache-Control', 'no-store')
|
|
563
450
|
return c.json(
|
|
564
|
-
Response.validated(schema.
|
|
565
|
-
data: await
|
|
451
|
+
Response.validated(schema.quoteFunding.Response, {
|
|
452
|
+
data: await FundingQuotes.listQuotes({
|
|
566
453
|
adapters: options.adapters,
|
|
567
454
|
adapterTimeoutMs: options.adapterTimeoutMs,
|
|
568
455
|
cache: { bypass: cacheBypass(c.req.raw) },
|
|
569
456
|
destinationToken: query.destinationToken,
|
|
570
|
-
include,
|
|
571
|
-
limit: query.limit,
|
|
572
457
|
provider: query.provider,
|
|
573
458
|
sourceAmount: query.sourceAmount,
|
|
574
459
|
sourceAmountUnits: query.sourceAmountUnits,
|
|
@@ -581,6 +466,17 @@ export function funding(options: funding.Options = {}) {
|
|
|
581
466
|
} catch (cause) {
|
|
582
467
|
const message = requestErrorMessage(cause)
|
|
583
468
|
if (message) return Response.error(c, { code: 'query_invalid', message, status: 400 })
|
|
469
|
+
if (cause instanceof FundingQuotes.ProviderQuoteError) {
|
|
470
|
+
const failures = cause.failures.map(FundingQuoteProviders.providerFailure)
|
|
471
|
+
const failure = failures[0]
|
|
472
|
+
if (failure) c.set('providerFailure', failure)
|
|
473
|
+
if (failures.length > 1) c.set('providerFailures', failures)
|
|
474
|
+
return Response.error(c, {
|
|
475
|
+
code: 'upstream_error',
|
|
476
|
+
message: 'Quote providers could not complete the request.',
|
|
477
|
+
status: 502,
|
|
478
|
+
})
|
|
479
|
+
}
|
|
584
480
|
throw cause
|
|
585
481
|
}
|
|
586
482
|
},
|
|
@@ -590,11 +486,11 @@ export function funding(options: funding.Options = {}) {
|
|
|
590
486
|
Auth.policy({ apiKey: { scopes: ['data:read'] }, mpp: true, public: true }),
|
|
591
487
|
OpenApi.describeRoute({
|
|
592
488
|
description:
|
|
593
|
-
'Lists source chains and stablecoins
|
|
489
|
+
'Lists the source chains and stablecoins you can use when requesting a funding quote.',
|
|
594
490
|
operationId: 'listFundingChains',
|
|
595
491
|
responses: OpenApi.responses({
|
|
596
492
|
success: {
|
|
597
|
-
description: '
|
|
493
|
+
description: 'Supported source chains and stablecoins.',
|
|
598
494
|
example: fundingChainsResponseExample,
|
|
599
495
|
schema: schema.listFundingChains.Response,
|
|
600
496
|
},
|
|
@@ -611,54 +507,39 @@ export function funding(options: funding.Options = {}) {
|
|
|
611
507
|
if (Auth.narrowAccess) return Auth.paidAccessError(c)
|
|
612
508
|
return c.json(
|
|
613
509
|
Response.validated(schema.listFundingChains.Response, {
|
|
614
|
-
data:
|
|
510
|
+
data: FundingQuotes.listChains(),
|
|
615
511
|
}),
|
|
616
512
|
200,
|
|
617
513
|
)
|
|
618
514
|
},
|
|
619
515
|
)
|
|
620
516
|
.get(
|
|
621
|
-
'/v1/providers',
|
|
517
|
+
'/v1/funding/providers',
|
|
622
518
|
Auth.policy({ apiKey: { scopes: ['data:read'] }, mpp: true, public: true }),
|
|
623
|
-
OpenApi.validate('query', schema.listProviders.Query, {
|
|
624
|
-
code: 'query_invalid',
|
|
625
|
-
message: 'Invalid query parameters',
|
|
626
|
-
}),
|
|
627
519
|
OpenApi.describeRoute({
|
|
628
520
|
description:
|
|
629
|
-
'Lists
|
|
630
|
-
operationId: '
|
|
521
|
+
'Lists funding quote providers and whether live quoting is configured for this deployment.',
|
|
522
|
+
operationId: 'listFundingProviders',
|
|
631
523
|
responses: OpenApi.responses({
|
|
632
|
-
errors: { 400: { codes: ['query_invalid'] } },
|
|
633
524
|
success: {
|
|
634
|
-
description: '
|
|
525
|
+
description: 'Funding quote providers supported by Tempo.',
|
|
635
526
|
example: providersResponseExample,
|
|
636
527
|
schema: schema.listProviders.Response,
|
|
637
528
|
},
|
|
638
529
|
}),
|
|
639
|
-
summary: 'List providers',
|
|
640
|
-
tags: ['
|
|
530
|
+
summary: 'List funding providers',
|
|
531
|
+
tags: ['Funding'],
|
|
641
532
|
}),
|
|
642
533
|
Cache.response<App.Environment>({
|
|
643
534
|
cacheControl: Cache.policies.stable,
|
|
644
|
-
name: 'tempo-api:providers:v1',
|
|
645
|
-
key: (c) =>
|
|
535
|
+
name: 'tempo-api:funding-providers:v1',
|
|
536
|
+
key: (c) => c.req.url,
|
|
646
537
|
}),
|
|
647
538
|
(c) => {
|
|
648
539
|
if (Auth.narrowAccess) return Auth.paidAccessError(c)
|
|
649
|
-
if (OpenApi.narrowValidation)
|
|
650
|
-
return OpenApi.validationError(c, {
|
|
651
|
-
code: 'query_invalid',
|
|
652
|
-
message: 'Invalid query parameters',
|
|
653
|
-
})
|
|
654
|
-
|
|
655
|
-
const query = c.req.valid('query')
|
|
656
540
|
return c.json(
|
|
657
541
|
Response.validated(schema.listProviders.Response, {
|
|
658
|
-
data:
|
|
659
|
-
adapters: options.adapters,
|
|
660
|
-
capability: query.capability,
|
|
661
|
-
}),
|
|
542
|
+
data: FundingQuotes.listProviders({ adapters: options.adapters }),
|
|
662
543
|
}),
|
|
663
544
|
200,
|
|
664
545
|
)
|
|
@@ -667,10 +548,10 @@ export function funding(options: funding.Options = {}) {
|
|
|
667
548
|
}
|
|
668
549
|
|
|
669
550
|
export declare namespace funding {
|
|
670
|
-
/** Options for funding
|
|
551
|
+
/** Options for live funding quotes. */
|
|
671
552
|
type Options = {
|
|
672
|
-
/** Provider adapters used to
|
|
673
|
-
adapters?:
|
|
553
|
+
/** Provider adapters used to request live quotes. */
|
|
554
|
+
adapters?: FundingQuotes.ProviderAdapters | undefined
|
|
674
555
|
/** Per-provider quote timeout in milliseconds. */
|
|
675
556
|
adapterTimeoutMs?: number | undefined
|
|
676
557
|
}
|
|
@@ -678,12 +559,11 @@ export declare namespace funding {
|
|
|
678
559
|
|
|
679
560
|
// Maps caller-input errors to a specific 400 message; anything else rethrows.
|
|
680
561
|
function requestErrorMessage(cause: unknown) {
|
|
681
|
-
if (cause instanceof
|
|
682
|
-
if (cause instanceof
|
|
683
|
-
if (cause instanceof FundingRoutes.UnsupportedDestinationTokenError)
|
|
562
|
+
if (cause instanceof FundingQuotes.InvalidAmountError) return 'Invalid `sourceAmount`.'
|
|
563
|
+
if (cause instanceof FundingQuotes.UnsupportedDestinationTokenError)
|
|
684
564
|
return 'Unsupported `destinationToken`.'
|
|
685
|
-
if (cause instanceof
|
|
686
|
-
if (cause instanceof
|
|
565
|
+
if (cause instanceof FundingQuotes.UnsupportedProviderError) return 'Unsupported `provider`.'
|
|
566
|
+
if (cause instanceof FundingQuotes.UnsupportedSourceChainError)
|
|
687
567
|
return 'Unsupported `sourceChain`.'
|
|
688
568
|
return undefined
|
|
689
569
|
}
|