tapimo 0.4.4 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/App.d.ts +7403 -6127
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +4 -0
- package/dist/App.js.map +1 -1
- package/dist/Scope.d.ts +18 -1
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +24 -3
- package/dist/Scope.js.map +1 -1
- package/dist/admin/apps/verified-tokens.d.ts +115 -115
- package/dist/apps/data/App.d.ts +1838 -1534
- package/dist/apps/data/App.d.ts.map +1 -1
- package/dist/apps/data/App.js +135 -44
- package/dist/apps/data/App.js.map +1 -1
- package/dist/apps/data/{FundingRouteProviders.d.ts → FundingQuoteProviders.d.ts} +7 -7
- package/dist/apps/data/{FundingRouteProviders.d.ts.map → FundingQuoteProviders.d.ts.map} +1 -1
- package/dist/apps/data/{FundingRouteProviders.js → FundingQuoteProviders.js} +36 -91
- 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 +242 -242
- package/dist/apps/data/routes/addresses.d.ts +227 -227
- package/dist/apps/data/routes/balances.d.ts +12 -12
- 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 +125 -126
- 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 +55 -54
- 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 +207 -388
- package/dist/apps/data/routes/funding.d.ts.map +1 -1
- package/dist/apps/data/routes/funding.js +143 -221
- package/dist/apps/data/routes/funding.js.map +1 -1
- 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 +33 -33
- package/dist/apps/data/routes/transactions.d.ts +281 -281
- package/dist/apps/data/routes/transfers.d.ts +58 -58
- package/dist/apps/data/routes/verified-tokens.d.ts +86 -86
- 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 +1090 -108
- 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 +118 -118
- 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 +207 -207
- 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/me.d.ts +17 -17
- package/dist/apps/management/routes/members.d.ts +71 -71
- package/dist/apps/management/routes/orgs.d.ts +12 -12
- package/dist/apps/management/routes/projects.d.ts +70 -70
- package/dist/apps/management/routes/scopes.d.ts +11 -11
- 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 +75 -75
- package/dist/apps/relay/App.d.ts.map +1 -1
- package/dist/apps/relay/App.js +42 -4
- 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/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 +130 -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} +185 -428
- package/dist/internal/FundingQuotes.d.ts.map +1 -0
- package/dist/internal/{FundingRoutes.js → FundingQuotes.js} +93 -218
- package/dist/internal/FundingQuotes.js.map +1 -0
- package/dist/internal/Viem.d.ts +3 -1
- package/dist/internal/Viem.d.ts.map +1 -1
- package/dist/internal/Viem.js +11 -2
- 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 +1 -1
- package/src/ApiKeys.test.ts +23 -0
- package/src/App.test-d.ts +2 -0
- package/src/App.ts +6 -0
- package/src/Client.test-d.ts +20 -11
- package/src/Scope.test.ts +1 -0
- package/src/Scope.ts +30 -4
- package/src/apps/data/App.test.ts +354 -0
- package/src/apps/data/App.ts +159 -52
- package/src/apps/data/FundingQuoteProviders.test.ts +151 -0
- package/src/apps/data/{FundingRouteProviders.ts → FundingQuoteProviders.ts} +40 -101
- 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 +151 -206
- package/src/apps/data/routes/funding.ts +156 -291
- package/src/apps/data/routes/indexer.test.ts +97 -1
- 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/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/relay/App.test.ts +324 -4
- package/src/apps/relay/App.ts +40 -4
- package/src/db/Db.ts +65 -0
- package/src/db/Schema.ts +39 -0
- package/src/db/tables/inviteLinks.ts +187 -0
- package/src/db/tables/organizations.ts +2 -0
- package/src/handlers/relay.ts +16 -4
- package/src/internal/Auth.test.ts +132 -22
- package/src/internal/Auth.ts +171 -14
- package/src/internal/EdgeCache.test.ts +24 -3
- package/src/internal/EdgeCache.ts +18 -2
- package/src/internal/FundingQuotes.test.ts +174 -0
- package/src/internal/{FundingRoutes.ts → FundingQuotes.ts} +153 -312
- package/src/internal/Viem.ts +14 -5
- package/src/internal/index.test.ts +1 -1
- package/src/internal/index.ts +1 -1
- 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/internal/FundingRoutes.test.ts +0 -213
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"funding.d.ts","sourceRoot":"","sources":["../../../../src/apps/data/routes/funding.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAA;AAE7B,OAAO,KAAK,KAAK,GAAG,MAAM,iBAAiB,CAAA;AAG3C,OAAO,KAAK,aAAa,MAAM,oCAAoC,CAAA;AAEnE,OAAO,KAAK,QAAQ,MAAM,+BAA+B,CAAA;AAGzD,
|
|
1
|
+
{"version":3,"file":"funding.d.ts","sourceRoot":"","sources":["../../../../src/apps/data/routes/funding.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAA;AAE7B,OAAO,KAAK,KAAK,GAAG,MAAM,iBAAiB,CAAA;AAG3C,OAAO,KAAK,aAAa,MAAM,oCAAoC,CAAA;AAEnE,OAAO,KAAK,QAAQ,MAAM,+BAA+B,CAAA;AAGzD,oDAAoD;AACpD,yBAAiB,MAAM,CAAC;IACtB,6CAA6C;IACtC,MAAM,KAAK;;;;;;qBAiCjB,CAAA;IAED,6CAA6C;IACtC,MAAM,KAAK;;;;;;;;;qBA6CjB,CAAA;IAED,wDAAwD;IACjD,MAAM,WAAW;;;qBAevB,CAAA;IAED,oDAAoD;IAC7C,MAAM,WAAW;;;;;qBAsBvB,CAAA;IAED,+EAA+E;IACxE,MAAM,OAAO;;;;;;;;qBA4BnB,CAAA;IAED,2DAA2D;IACpD,MAAM,YAAY;;;;;;qBAiCxB,CAAA;IAED,qCAAqC;IAC9B,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAkBxB,CAAA;IAED,4CAA4C;IACrC,MAAM,QAAQ;;;;;;;;;qBA2BpB,CAAA;IAED,qEAAqE;IAC9D,MAAM,cAAc;;;;;;;;;;;;;;;;qBAK1B,CAAA;IAED,8CAA8C;IAC9C,UAAiB,YAAY,CAAC;QAC5B,gDAAgD;QACzC,MAAM,KAAK;;;;;;;;;;0BAkD0D,CAAA;QAE5E,uDAAuD;QAChD,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAKpB,CAAA;KACF;IAED,mDAAmD;IACnD,UAAiB,iBAAiB,CAAC;QACjC,4CAA4C;QACrC,MAAM,QAAQ;;;;;;;;;;;;;;;;;;yBAOpB,CAAA;KACF;IAED,+CAA+C;IAC/C,UAAiB,aAAa,CAAC;QAC7B,oDAAoD;QAC7C,MAAM,QAAQ;;;;;;;;;;;yBAKpB,CAAA;KACF;CACF;AA4CD,2EAA2E;AAC3E,wBAAgB,OAAO,CAAC,OAAO,GAAE,OAAO,CAAC,OAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAsIpD;AAED,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,uCAAuC;IACvC,KAAK,OAAO,GAAG;QACb,qDAAqD;QACrD,QAAQ,CAAC,EAAE,aAAa,CAAC,gBAAgB,GAAG,SAAS,CAAA;QACrD,kDAAkD;QAClD,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KACtC,CAAA;CACF"}
|
|
@@ -2,31 +2,31 @@ import { Hono } from 'hono';
|
|
|
2
2
|
import * as z from 'zod/mini';
|
|
3
3
|
import * as Auth from '../../../internal/Auth.js';
|
|
4
4
|
import * as Cache from '../../../internal/Cache.js';
|
|
5
|
-
import * as
|
|
5
|
+
import * as FundingQuotes from '../../../internal/FundingQuotes.js';
|
|
6
6
|
import * as OpenApi from '../../../internal/OpenApi.js';
|
|
7
7
|
import * as Response from '../../../internal/Response.js';
|
|
8
8
|
import * as Schema from '../../../internal/Schema.js';
|
|
9
|
-
/** Zod schemas owned by
|
|
9
|
+
/** Zod schemas owned by funding quote resources. */
|
|
10
10
|
export var schema;
|
|
11
11
|
(function (schema) {
|
|
12
12
|
/** Source or destination chain reference. */
|
|
13
13
|
schema.Chain = Schema.describe(z.object({
|
|
14
14
|
addressFormat: z
|
|
15
|
-
.
|
|
15
|
+
.literal('evm')
|
|
16
16
|
.check(z.describe('Address family used by accounts and token identifiers on this chain.'), z.meta({ examples: ['evm'] })),
|
|
17
17
|
id: z
|
|
18
18
|
.string()
|
|
19
|
-
.check(z.describe('Stable
|
|
19
|
+
.check(z.describe('Stable CAIP-2 chain id, represented as a string instead of the numeric `chainId` used elsewhere.'), z.meta({ examples: ['eip155:8453'] })),
|
|
20
20
|
kind: z
|
|
21
|
-
.
|
|
21
|
+
.literal('evm')
|
|
22
22
|
.check(z.describe('Chain execution family used for provider routing.'), z.meta({ examples: ['evm'] })),
|
|
23
23
|
name: z
|
|
24
24
|
.string()
|
|
25
25
|
.check(z.describe('Human-readable chain name.'), z.meta({ examples: ['Base'] })),
|
|
26
26
|
providerIds: z
|
|
27
27
|
.optional(z.record(z.string(), z.string()))
|
|
28
|
-
.check(z.describe('Provider-specific chain ids Tempo uses when
|
|
29
|
-
}), 'A normalized chain reference for funding
|
|
28
|
+
.check(z.describe('Provider-specific chain ids Tempo uses when requesting quotes.'), z.meta({ examples: [{ relay: '8453' }] })),
|
|
29
|
+
}), 'A normalized chain reference for funding quotes.');
|
|
30
30
|
/** Source or destination token reference. */
|
|
31
31
|
schema.Token = Schema.describe(z.object({
|
|
32
32
|
address: z
|
|
@@ -52,121 +52,81 @@ export var schema;
|
|
|
52
52
|
})),
|
|
53
53
|
verified: z
|
|
54
54
|
.boolean()
|
|
55
|
-
.check(z.describe('Whether Tempo recognizes this token in its funding
|
|
56
|
-
}), 'A normalized token reference for funding
|
|
57
|
-
/** Source amount echoed by a funding
|
|
55
|
+
.check(z.describe('Whether Tempo recognizes this token in its funding quote inventory.'), z.meta({ examples: [true] })),
|
|
56
|
+
}), 'A normalized token reference for funding quotes.');
|
|
57
|
+
/** Source amount echoed by a funding quote response. */
|
|
58
58
|
schema.TokenAmount = Schema.describe(z.object({
|
|
59
59
|
amount: Schema.DecimalString.check(z.describe("The requested source amount in the token's smallest unit.")),
|
|
60
60
|
formatted: z
|
|
61
61
|
.string()
|
|
62
62
|
.check(z.describe('The same amount in human-readable decimal form, using the source token’s `decimals`.'), z.meta({ examples: ['1'] })),
|
|
63
|
-
usd: z
|
|
64
|
-
.nullable(z.string())
|
|
65
|
-
.check(z.describe('USD estimate for the requested source amount, when available.'), z.meta({ examples: ['1.00'] })),
|
|
66
63
|
}), 'The requested source amount in provider-safe base units and display form.');
|
|
67
|
-
/** Provider summary embedded in a
|
|
64
|
+
/** Provider summary embedded in a funding quote. */
|
|
68
65
|
schema.ProviderRef = Schema.describe(z.object({
|
|
69
|
-
id: z
|
|
66
|
+
id: z
|
|
67
|
+
.literal('relay')
|
|
68
|
+
.check(z.describe('Stable provider id.'), z.meta({ examples: ['relay'] })),
|
|
70
69
|
kind: z
|
|
71
70
|
.string()
|
|
72
|
-
.check(z.describe('Provider category, such as
|
|
71
|
+
.check(z.describe('Provider category, such as a solver network or aggregator.'), z.meta({ examples: ['solverNetwork'] })),
|
|
73
72
|
name: z
|
|
74
73
|
.string()
|
|
75
74
|
.check(z.describe('Human-readable provider name.'), z.meta({ examples: ['Relay'] })),
|
|
76
75
|
requiresApiKey: z
|
|
77
76
|
.boolean()
|
|
78
|
-
.check(z.describe('Whether Tempo needs provider credentials to query or use this provider.'), z.meta({ examples: [
|
|
79
|
-
}), 'Provider metadata embedded in a
|
|
80
|
-
/**
|
|
77
|
+
.check(z.describe('Whether Tempo needs provider credentials to query or use this provider.'), z.meta({ examples: [false] })),
|
|
78
|
+
}), 'Provider metadata embedded in a funding quote.');
|
|
79
|
+
/** Quote quality signals exposed directly instead of implied by list order. */
|
|
81
80
|
schema.Quality = Schema.describe(z.object({
|
|
82
|
-
availableVolumeUsd: z
|
|
83
|
-
.nullable(z.string())
|
|
84
|
-
.check(z.describe('Available USD capacity, when available.'), z.meta({ examples: ['1114274.43'] })),
|
|
85
81
|
estimatedSeconds: z
|
|
86
|
-
.
|
|
82
|
+
.optional(z.number().check(z.int(), z.nonnegative()))
|
|
87
83
|
.check(z.describe('Estimated settlement time in seconds, when known.'), z.meta({ examples: [2] })),
|
|
88
|
-
feeBps: z
|
|
89
|
-
.nullable(z.number().check(z.int(), z.nonnegative()))
|
|
90
|
-
.check(z.describe('Estimated fee in basis points, when known.'), z.meta({ examples: [109] })),
|
|
91
|
-
historicalVolumeUsd24h: z
|
|
92
|
-
.nullable(z.string())
|
|
93
|
-
.check(z.describe('24h routed volume in USD, when available.'), z.meta({ examples: ['250000.00'] })),
|
|
94
|
-
instantVolumeUsd: z
|
|
95
|
-
.nullable(z.string())
|
|
96
|
-
.check(z.describe('Instant USD capacity, when available.'), z.meta({ examples: ['12453.94'] })),
|
|
97
84
|
liquiditySource: z
|
|
98
85
|
.string()
|
|
99
|
-
.check(z.describe('
|
|
100
|
-
score: z
|
|
101
|
-
.nullable(z.number().check(z.int(), z.gte(0), z.lte(100)))
|
|
102
|
-
.check(z.describe('Explainable route score from 0 to 100, when enough signals are available.'), z.meta({ examples: [91] })),
|
|
86
|
+
.check(z.describe('Provider source for the live quote quality signal.'), z.meta({ examples: ['providerQuote'] })),
|
|
103
87
|
sourceDetail: z
|
|
104
|
-
.
|
|
88
|
+
.optional(z.string())
|
|
105
89
|
.check(z.describe('Provider-specific source or endpoint detail for the quality signal.'), z.meta({ examples: ['providerEndpoint'] })),
|
|
106
90
|
tier: z
|
|
107
|
-
.enum(['liquid', 'thin'
|
|
108
|
-
.check(z.describe('Machine-readable
|
|
109
|
-
}), 'Machine-readable liquidity, fee, and source signals for a
|
|
110
|
-
/** Provider-derived
|
|
111
|
-
schema.
|
|
112
|
-
expiresAt: z
|
|
113
|
-
.nullable(z.iso.datetime())
|
|
114
|
-
.check(z.describe('Provider quote expiry timestamp.'), z.meta({ examples: ['2026-01-01T00:00:30Z'] })),
|
|
91
|
+
.enum(['liquid', 'thin'])
|
|
92
|
+
.check(z.describe('Machine-readable quality tier for a successful quote.'), z.meta({ examples: ['liquid'] })),
|
|
93
|
+
}), 'Machine-readable liquidity, fee, and source signals for a successful quote.');
|
|
94
|
+
/** Provider-derived output, limits, and freshness data. */
|
|
95
|
+
schema.QuoteDetails = Schema.describe(z.object({
|
|
115
96
|
inputAmount: Schema.DecimalString.check(z.describe('Source amount sent to the provider in base units.'), z.meta({ examples: ['1000000'] })),
|
|
116
|
-
limits: z
|
|
117
|
-
.nullable(z.object({
|
|
118
|
-
instantSourceAmount: z
|
|
119
|
-
.nullable(Schema.DecimalString)
|
|
120
|
-
.check(z.describe('Provider-reported instant source amount capacity.'), z.meta({ examples: ['12453940000'] })),
|
|
121
|
-
maxSourceAmount: z
|
|
122
|
-
.nullable(Schema.DecimalString)
|
|
123
|
-
.check(z.describe('Provider-reported maximum source amount.'), z.meta({ examples: ['1114274433200'] })),
|
|
124
|
-
minSourceAmount: z
|
|
125
|
-
.nullable(Schema.DecimalString)
|
|
126
|
-
.check(z.describe('Provider-reported minimum source amount.'), z.meta({ examples: ['500063'] })),
|
|
127
|
-
}))
|
|
128
|
-
.check(z.describe('Provider limits expressed in source base units.')),
|
|
129
97
|
minimumOutputAmount: z
|
|
130
|
-
.
|
|
98
|
+
.optional(Schema.DecimalString)
|
|
131
99
|
.check(z.describe('Slippage-adjusted minimum destination amount in base units.'), z.meta({ examples: ['988000'] })),
|
|
132
100
|
outputAmount: z
|
|
133
|
-
.
|
|
101
|
+
.string()
|
|
102
|
+
.check(z.regex(/^\d+$/))
|
|
134
103
|
.check(z.describe('Expected destination amount in base units.'), z.meta({ examples: ['989102'] })),
|
|
135
104
|
outputAmountFormatted: z
|
|
136
|
-
.
|
|
105
|
+
.string()
|
|
137
106
|
.check(z.describe('Expected destination amount rendered with destination token decimals.'), z.meta({ examples: ['0.989102'] })),
|
|
138
107
|
sampledAt: z.iso
|
|
139
108
|
.datetime()
|
|
140
|
-
.check(z.describe('Timestamp for the live quote
|
|
141
|
-
}), 'Provider-derived
|
|
142
|
-
/**
|
|
143
|
-
schema.
|
|
109
|
+
.check(z.describe('Timestamp for the live quote probe.'), z.meta({ examples: ['2026-01-01T00:00:00Z'] })),
|
|
110
|
+
}), 'Provider-derived output, limits, and freshness data for a funding quote.');
|
|
111
|
+
/** Successful live funding quote. */
|
|
112
|
+
schema.FundingQuote = Schema.describe(z.object({
|
|
144
113
|
destinationChain: schema.Chain.check(z.describe('Destination chain, always Tempo mainnet in V1.')),
|
|
145
|
-
destinationToken: schema.Token.check(z.describe('Tempo token expected from this
|
|
146
|
-
errorCode: z
|
|
147
|
-
.nullable(z.string())
|
|
148
|
-
.check(z.describe('Stable route error code, when status is `error`.'), z.meta({ examples: ['provider_timeout'] })),
|
|
114
|
+
destinationToken: schema.Token.check(z.describe('Tempo token expected from this quote.')),
|
|
149
115
|
id: z
|
|
150
116
|
.string()
|
|
151
|
-
.check(z.describe('Stable deterministic
|
|
117
|
+
.check(z.describe('Stable deterministic funding quote id.'), z.meta({ examples: ['base-usdc-tempo-usdce-relay'] })),
|
|
152
118
|
provider: schema.ProviderRef,
|
|
153
119
|
quality: schema.Quality,
|
|
154
|
-
quote:
|
|
155
|
-
.nullable(schema.RouteQuote)
|
|
156
|
-
.check(z.describe('Provider-derived quote data, when a live route probe succeeds.')),
|
|
120
|
+
quote: schema.QuoteDetails,
|
|
157
121
|
sourceAmount: schema.TokenAmount,
|
|
158
122
|
sourceChain: schema.Chain.check(z.describe('Chain where the caller currently holds funds.')),
|
|
159
123
|
sourceToken: schema.Token.check(z.describe('Token the caller currently holds.')),
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
.check(z.describe('Provider-specific route status for the requested amount.'), z.meta({ examples: ['unknown'] })),
|
|
163
|
-
}), 'One provider-specific funding route candidate.');
|
|
164
|
-
/** Generic provider catalog entry. */
|
|
124
|
+
}), 'One successful provider-specific funding quote.');
|
|
125
|
+
/** Funding quote provider catalog entry. */
|
|
165
126
|
schema.Provider = Schema.describe(z.object({
|
|
166
|
-
|
|
167
|
-
.
|
|
168
|
-
.check(z.describe('
|
|
169
|
-
id: z.string().check(z.describe('Stable provider id.'), z.meta({ examples: ['relay'] })),
|
|
127
|
+
id: z
|
|
128
|
+
.literal('relay')
|
|
129
|
+
.check(z.describe('Stable provider id.'), z.meta({ examples: ['relay'] })),
|
|
170
130
|
kind: z
|
|
171
131
|
.string()
|
|
172
132
|
.check(z.describe('Provider category.'), z.meta({ examples: ['solverNetwork'] })),
|
|
@@ -177,54 +137,44 @@ export var schema;
|
|
|
177
137
|
.boolean()
|
|
178
138
|
.check(z.describe('Whether Tempo needs provider credentials to query or use this provider.'), z.meta({ examples: [false] })),
|
|
179
139
|
status: z
|
|
180
|
-
.enum(['configured', '
|
|
181
|
-
.check(z.describe('`
|
|
182
|
-
}), 'One
|
|
140
|
+
.enum(['configured', 'unconfigured'])
|
|
141
|
+
.check(z.describe('`configured` means live quotes are enabled for this deployment. `unconfigured` means the provider is supported but unavailable here.'), z.meta({ examples: ['configured', 'unconfigured'] })),
|
|
142
|
+
}), 'One funding quote provider.');
|
|
183
143
|
/** Chain inventory entry returned by the funding chains endpoint. */
|
|
184
144
|
schema.ChainInventory = Schema.describe(z.extend(schema.Chain, {
|
|
185
145
|
tokens: z.array(schema.Token).check(z.describe('Stablecoins known on this source chain.')),
|
|
186
146
|
}), 'One source chain and its known stablecoin inventory.');
|
|
187
|
-
/** Schemas for the
|
|
188
|
-
let
|
|
189
|
-
(function (
|
|
190
|
-
/** Query parameters for funding
|
|
191
|
-
|
|
147
|
+
/** Schemas for the quoteFunding operation. */
|
|
148
|
+
let quoteFunding;
|
|
149
|
+
(function (quoteFunding) {
|
|
150
|
+
/** Query parameters for live funding quotes. */
|
|
151
|
+
quoteFunding.Query = z
|
|
192
152
|
.strictObject({
|
|
193
153
|
destinationToken: z
|
|
194
154
|
.optional(z.string())
|
|
195
155
|
.check(z.describe('Tempo destination token symbol, address, or token key. Defaults to USDC.e.'), z.meta({ examples: ['USDC.e'] })),
|
|
196
|
-
include: z
|
|
197
|
-
.optional(z.string())
|
|
198
|
-
.check(z.describe('Comma-separated response expansions. V1 accepts `quotes`.'), z.meta({ examples: ['quotes'] })),
|
|
199
|
-
limit: Schema.Limit,
|
|
200
156
|
provider: z
|
|
201
|
-
.optional(z.
|
|
202
|
-
.check(z.describe('Only
|
|
157
|
+
.optional(z.literal('relay'))
|
|
158
|
+
.check(z.describe('Only request a quote from this provider. The supported id is `relay`; omit it to query every configured provider.'), z.meta({ examples: ['relay'] })),
|
|
203
159
|
sourceAmount: z
|
|
204
160
|
.string()
|
|
205
|
-
.check(z.
|
|
161
|
+
.check(z.regex(/^(?=.*[1-9])\d+(\.\d+)?$/), z.describe('Positive source token amount. Base units by default, so 1 USDC is `1000000`.'), z.meta({ examples: ['1000000'] })),
|
|
206
162
|
sourceAmountUnits: z
|
|
207
163
|
._default(z.enum(['baseUnits', 'decimal']), 'baseUnits')
|
|
208
164
|
.check(z.describe('Whether `sourceAmount` is base units or a human-readable decimal.'), z.meta({ examples: ['baseUnits', 'decimal'] })),
|
|
209
165
|
sourceChain: z
|
|
210
166
|
.string()
|
|
211
|
-
.check(z.minLength(1), z.describe('Source chain alias or CAIP-2 id, such as `base
|
|
212
|
-
sourceToken: z
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
|
|
216
|
-
'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',
|
|
217
|
-
],
|
|
218
|
-
})),
|
|
167
|
+
.check(z.minLength(1), z.describe('Source chain alias or CAIP-2 id, such as `base` or `eip155:8453`.'), z.meta({ examples: ['base', 'eip155:8453'] })),
|
|
168
|
+
sourceToken: z
|
|
169
|
+
.string()
|
|
170
|
+
.check(z.minLength(1), z.describe('Source token symbol, contract address, or Tempo token key. Symbol and address lookup is scoped to `sourceChain` and case-insensitive. An unknown token returns an empty list.'), z.meta({ examples: ['USDC', '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913'] })),
|
|
219
171
|
})
|
|
220
|
-
.check(z.describe('Query parameters for
|
|
221
|
-
/** Non-paginated list of funding
|
|
222
|
-
|
|
223
|
-
data: z
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
}), 'A non-paginated list of funding route candidates.');
|
|
227
|
-
})(listFundingRoutes = schema.listFundingRoutes || (schema.listFundingRoutes = {}));
|
|
172
|
+
.check(z.describe('Query parameters for live funding quotes into Tempo.'));
|
|
173
|
+
/** Non-paginated list of successful funding quotes. */
|
|
174
|
+
quoteFunding.Response = Schema.describe(z.object({
|
|
175
|
+
data: z.array(schema.FundingQuote).check(z.describe('Successful live funding quotes.')),
|
|
176
|
+
}), 'A non-paginated list of successful live funding quotes.');
|
|
177
|
+
})(quoteFunding = schema.quoteFunding || (schema.quoteFunding = {}));
|
|
228
178
|
/** Schemas for the listFundingChains operation. */
|
|
229
179
|
let listFundingChains;
|
|
230
180
|
(function (listFundingChains) {
|
|
@@ -232,100 +182,83 @@ export var schema;
|
|
|
232
182
|
listFundingChains.Response = Schema.describe(z.object({
|
|
233
183
|
data: z
|
|
234
184
|
.array(schema.ChainInventory)
|
|
235
|
-
.check(z.describe('Source chains and stablecoins
|
|
185
|
+
.check(z.describe('Source chains and stablecoins supported by funding quotes.')),
|
|
236
186
|
}), 'A non-paginated list of source chains and stablecoin inventory.');
|
|
237
187
|
})(listFundingChains = schema.listFundingChains || (schema.listFundingChains = {}));
|
|
238
188
|
/** Schemas for the listProviders operation. */
|
|
239
189
|
let listProviders;
|
|
240
190
|
(function (listProviders) {
|
|
241
|
-
/**
|
|
242
|
-
listProviders.Query = z
|
|
243
|
-
.strictObject({
|
|
244
|
-
capability: z
|
|
245
|
-
.optional(z.enum(['fundingRoutes']))
|
|
246
|
-
.check(z.describe('Optional provider capability filter.'), z.meta({ examples: ['fundingRoutes'] })),
|
|
247
|
-
})
|
|
248
|
-
.check(z.describe('Query parameters for listing providers.'));
|
|
249
|
-
/** Non-paginated generic provider catalog. */
|
|
191
|
+
/** Non-paginated funding quote provider catalog. */
|
|
250
192
|
listProviders.Response = Schema.describe(z.object({
|
|
251
|
-
data: z.array(schema.Provider).check(z.describe("Providers in Tempo's
|
|
252
|
-
}), 'A non-paginated list of providers.');
|
|
193
|
+
data: z.array(schema.Provider).check(z.describe("Providers in Tempo's funding quote catalog.")),
|
|
194
|
+
}), 'A non-paginated list of funding quote providers.');
|
|
253
195
|
})(listProviders = schema.listProviders || (schema.listProviders = {}));
|
|
254
196
|
})(schema || (schema = {}));
|
|
255
|
-
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
description: '`GET /v1/funding/routes?sourceChain=tron&sourceToken=TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t&sourceAmount=1000000&provider=bridge`',
|
|
287
|
-
summary: 'Tron USDT',
|
|
288
|
-
value: {
|
|
289
|
-
data: FundingRoutes.listStaticRoutes({
|
|
290
|
-
limit: 10,
|
|
291
|
-
provider: 'bridge',
|
|
292
|
-
sourceAmount: '1000000',
|
|
293
|
-
sourceAmountUnits: 'baseUnits',
|
|
294
|
-
sourceChain: 'tron',
|
|
295
|
-
sourceToken: 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',
|
|
296
|
-
}),
|
|
297
|
-
},
|
|
298
|
-
},
|
|
299
|
-
};
|
|
197
|
+
const fundingQuoteResponseExample = (() => {
|
|
198
|
+
const [candidate] = FundingQuotes.listQuoteCandidates({
|
|
199
|
+
provider: 'relay',
|
|
200
|
+
sourceAmount: '1000000',
|
|
201
|
+
sourceAmountUnits: 'baseUnits',
|
|
202
|
+
sourceChain: 'base',
|
|
203
|
+
sourceToken: 'USDC',
|
|
204
|
+
});
|
|
205
|
+
if (!candidate)
|
|
206
|
+
throw new Error('Missing Relay funding quote example candidate');
|
|
207
|
+
return {
|
|
208
|
+
data: [
|
|
209
|
+
{
|
|
210
|
+
...candidate,
|
|
211
|
+
quality: {
|
|
212
|
+
estimatedSeconds: 1,
|
|
213
|
+
liquiditySource: 'providerQuote',
|
|
214
|
+
sourceDetail: 'relay:quote-v2',
|
|
215
|
+
tier: 'liquid',
|
|
216
|
+
},
|
|
217
|
+
quote: {
|
|
218
|
+
inputAmount: '1000000',
|
|
219
|
+
minimumOutputAmount: '939242',
|
|
220
|
+
outputAmount: '979295',
|
|
221
|
+
outputAmountFormatted: '0.979295',
|
|
222
|
+
sampledAt: '2026-01-01T00:00:00.000Z',
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
],
|
|
226
|
+
};
|
|
227
|
+
})();
|
|
300
228
|
const fundingChainsResponseExample = {
|
|
301
|
-
data:
|
|
229
|
+
data: FundingQuotes.listChains(),
|
|
302
230
|
};
|
|
303
231
|
const providersResponseExample = {
|
|
304
|
-
data:
|
|
232
|
+
data: FundingQuotes.listProviders().map((provider) => ({
|
|
233
|
+
...provider,
|
|
234
|
+
status: 'configured',
|
|
235
|
+
})),
|
|
305
236
|
};
|
|
306
|
-
/** Mounts funding
|
|
237
|
+
/** Mounts live funding quotes and their supporting inventory endpoints. */
|
|
307
238
|
export function funding(options = {}) {
|
|
308
239
|
return new Hono()
|
|
309
|
-
.get('/v1/funding/
|
|
240
|
+
.get('/v1/funding/quotes', Auth.policy({ apiKey: { scopes: ['data:read'] }, mpp: true, public: true }), OpenApi.validate('query', schema.quoteFunding.Query, {
|
|
310
241
|
code: 'query_invalid',
|
|
311
242
|
message: 'Invalid query parameters',
|
|
312
243
|
}), OpenApi.describeRoute({
|
|
313
|
-
description: '
|
|
314
|
-
operationId: '
|
|
244
|
+
description: 'Returns live quotes for funding Tempo with a stablecoin. Omit `provider` to query all configured providers. This endpoint does not execute a transfer.',
|
|
245
|
+
operationId: 'quoteFunding',
|
|
315
246
|
responses: OpenApi.responses({
|
|
316
|
-
errors: {
|
|
247
|
+
errors: {
|
|
248
|
+
400: { codes: ['query_invalid'] },
|
|
249
|
+
502: {
|
|
250
|
+
codes: ['upstream_error'],
|
|
251
|
+
description: 'Every matching quote provider failed unexpectedly.',
|
|
252
|
+
},
|
|
253
|
+
},
|
|
317
254
|
success: {
|
|
318
|
-
description: '
|
|
319
|
-
|
|
320
|
-
schema: schema.
|
|
255
|
+
description: 'Live funding quotes. An empty list means no provider returned a quote.',
|
|
256
|
+
example: fundingQuoteResponseExample,
|
|
257
|
+
schema: schema.quoteFunding.Response,
|
|
321
258
|
},
|
|
322
259
|
}),
|
|
323
|
-
summary: '
|
|
260
|
+
summary: 'Get funding quotes',
|
|
324
261
|
tags: ['Funding'],
|
|
325
|
-
}), Cache.response({
|
|
326
|
-
cacheControl: Cache.policies.noStore,
|
|
327
|
-
name: 'tempo-api:funding-routes:v1',
|
|
328
|
-
key: (c) => Cache.urlKey(c, schema.listFundingRoutes.Query),
|
|
329
262
|
}), async (c) => {
|
|
330
263
|
if (Auth.narrowAccess)
|
|
331
264
|
return Auth.paidAccessError(c);
|
|
@@ -336,15 +269,13 @@ export function funding(options = {}) {
|
|
|
336
269
|
});
|
|
337
270
|
const query = c.req.valid('query');
|
|
338
271
|
try {
|
|
339
|
-
|
|
340
|
-
return c.json(Response.validated(schema.
|
|
341
|
-
data: await
|
|
272
|
+
c.header('Cache-Control', 'no-store');
|
|
273
|
+
return c.json(Response.validated(schema.quoteFunding.Response, {
|
|
274
|
+
data: await FundingQuotes.listQuotes({
|
|
342
275
|
adapters: options.adapters,
|
|
343
276
|
adapterTimeoutMs: options.adapterTimeoutMs,
|
|
344
277
|
cache: { bypass: cacheBypass(c.req.raw) },
|
|
345
278
|
destinationToken: query.destinationToken,
|
|
346
|
-
include,
|
|
347
|
-
limit: query.limit,
|
|
348
279
|
provider: query.provider,
|
|
349
280
|
sourceAmount: query.sourceAmount,
|
|
350
281
|
sourceAmountUnits: query.sourceAmountUnits,
|
|
@@ -357,15 +288,21 @@ export function funding(options = {}) {
|
|
|
357
288
|
const message = requestErrorMessage(cause);
|
|
358
289
|
if (message)
|
|
359
290
|
return Response.error(c, { code: 'query_invalid', message, status: 400 });
|
|
291
|
+
if (cause instanceof FundingQuotes.ProviderQuoteError)
|
|
292
|
+
return Response.error(c, {
|
|
293
|
+
code: 'upstream_error',
|
|
294
|
+
message: 'Quote providers could not complete the request.',
|
|
295
|
+
status: 502,
|
|
296
|
+
});
|
|
360
297
|
throw cause;
|
|
361
298
|
}
|
|
362
299
|
})
|
|
363
300
|
.get('/v1/funding/chains', Auth.policy({ apiKey: { scopes: ['data:read'] }, mpp: true, public: true }), OpenApi.describeRoute({
|
|
364
|
-
description: 'Lists source chains and stablecoins
|
|
301
|
+
description: 'Lists the source chains and stablecoins you can use when requesting a funding quote.',
|
|
365
302
|
operationId: 'listFundingChains',
|
|
366
303
|
responses: OpenApi.responses({
|
|
367
304
|
success: {
|
|
368
|
-
description: '
|
|
305
|
+
description: 'Supported source chains and stablecoins.',
|
|
369
306
|
example: fundingChainsResponseExample,
|
|
370
307
|
schema: schema.listFundingChains.Response,
|
|
371
308
|
},
|
|
@@ -380,57 +317,42 @@ export function funding(options = {}) {
|
|
|
380
317
|
if (Auth.narrowAccess)
|
|
381
318
|
return Auth.paidAccessError(c);
|
|
382
319
|
return c.json(Response.validated(schema.listFundingChains.Response, {
|
|
383
|
-
data:
|
|
320
|
+
data: FundingQuotes.listChains(),
|
|
384
321
|
}), 200);
|
|
385
322
|
})
|
|
386
|
-
.get('/v1/providers', Auth.policy({ apiKey: { scopes: ['data:read'] }, mpp: true, public: true }), OpenApi.
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
}), OpenApi.describeRoute({
|
|
390
|
-
description: 'Lists provider metadata, capability flags, auth requirements, and integration status across provider domains. `inventoryOnly` providers can appear in static route candidates; `planned` providers are visible for roadmap transparency and may not return candidates.',
|
|
391
|
-
operationId: 'listProviders',
|
|
323
|
+
.get('/v1/funding/providers', Auth.policy({ apiKey: { scopes: ['data:read'] }, mpp: true, public: true }), OpenApi.describeRoute({
|
|
324
|
+
description: 'Lists funding quote providers and whether live quoting is configured for this deployment.',
|
|
325
|
+
operationId: 'listFundingProviders',
|
|
392
326
|
responses: OpenApi.responses({
|
|
393
|
-
errors: { 400: { codes: ['query_invalid'] } },
|
|
394
327
|
success: {
|
|
395
|
-
description: '
|
|
328
|
+
description: 'Funding quote providers supported by Tempo.',
|
|
396
329
|
example: providersResponseExample,
|
|
397
330
|
schema: schema.listProviders.Response,
|
|
398
331
|
},
|
|
399
332
|
}),
|
|
400
|
-
summary: 'List providers',
|
|
401
|
-
tags: ['
|
|
333
|
+
summary: 'List funding providers',
|
|
334
|
+
tags: ['Funding'],
|
|
402
335
|
}), Cache.response({
|
|
403
336
|
cacheControl: Cache.policies.stable,
|
|
404
|
-
name: 'tempo-api:providers:v1',
|
|
405
|
-
key: (c) =>
|
|
337
|
+
name: 'tempo-api:funding-providers:v1',
|
|
338
|
+
key: (c) => c.req.url,
|
|
406
339
|
}), (c) => {
|
|
407
340
|
if (Auth.narrowAccess)
|
|
408
341
|
return Auth.paidAccessError(c);
|
|
409
|
-
if (OpenApi.narrowValidation)
|
|
410
|
-
return OpenApi.validationError(c, {
|
|
411
|
-
code: 'query_invalid',
|
|
412
|
-
message: 'Invalid query parameters',
|
|
413
|
-
});
|
|
414
|
-
const query = c.req.valid('query');
|
|
415
342
|
return c.json(Response.validated(schema.listProviders.Response, {
|
|
416
|
-
data:
|
|
417
|
-
adapters: options.adapters,
|
|
418
|
-
capability: query.capability,
|
|
419
|
-
}),
|
|
343
|
+
data: FundingQuotes.listProviders({ adapters: options.adapters }),
|
|
420
344
|
}), 200);
|
|
421
345
|
});
|
|
422
346
|
}
|
|
423
347
|
// Maps caller-input errors to a specific 400 message; anything else rethrows.
|
|
424
348
|
function requestErrorMessage(cause) {
|
|
425
|
-
if (cause instanceof
|
|
349
|
+
if (cause instanceof FundingQuotes.InvalidAmountError)
|
|
426
350
|
return 'Invalid `sourceAmount`.';
|
|
427
|
-
if (cause instanceof
|
|
428
|
-
return 'Unsupported `include`.';
|
|
429
|
-
if (cause instanceof FundingRoutes.UnsupportedDestinationTokenError)
|
|
351
|
+
if (cause instanceof FundingQuotes.UnsupportedDestinationTokenError)
|
|
430
352
|
return 'Unsupported `destinationToken`.';
|
|
431
|
-
if (cause instanceof
|
|
353
|
+
if (cause instanceof FundingQuotes.UnsupportedProviderError)
|
|
432
354
|
return 'Unsupported `provider`.';
|
|
433
|
-
if (cause instanceof
|
|
355
|
+
if (cause instanceof FundingQuotes.UnsupportedSourceChainError)
|
|
434
356
|
return 'Unsupported `sourceChain`.';
|
|
435
357
|
return undefined;
|
|
436
358
|
}
|