tapimo 0.5.1 → 0.5.3
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 +34 -18
- package/dist/App.d.ts.map +1 -1
- package/dist/apps/data/App.d.ts +3217 -3217
- package/dist/apps/data/FundingQuoteProviders.d.ts +32 -0
- package/dist/apps/data/FundingQuoteProviders.d.ts.map +1 -1
- package/dist/apps/data/FundingQuoteProviders.js +134 -1
- package/dist/apps/data/FundingQuoteProviders.js.map +1 -1
- package/dist/apps/data/routes/balances.d.ts +46 -46
- package/dist/apps/data/routes/coingecko.d.ts +169 -169
- package/dist/apps/data/routes/funding.d.ts +8 -2
- package/dist/apps/data/routes/funding.d.ts.map +1 -1
- package/dist/apps/data/routes/funding.js +4 -4
- 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/receipts.d.ts +228 -228
- package/dist/apps/data/routes/transfers.d.ts +8 -15
- package/dist/apps/data/routes/transfers.d.ts.map +1 -1
- package/dist/apps/data/routes/transfers.js +21 -27
- package/dist/apps/data/routes/transfers.js.map +1 -1
- package/dist/apps/data/routes/webhooks.d.ts +35 -35
- package/dist/apps/data/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/data/routes/webhooks.js +176 -42
- package/dist/apps/data/routes/webhooks.js.map +1 -1
- package/dist/apps/management/App.d.ts +982 -966
- package/dist/apps/management/App.d.ts.map +1 -1
- package/dist/apps/management/Billing.d.ts.map +1 -1
- package/dist/apps/management/Billing.js +5 -4
- package/dist/apps/management/Billing.js.map +1 -1
- package/dist/apps/management/routes/billing.d.ts.map +1 -1
- package/dist/apps/management/routes/billing.js +1 -1
- package/dist/apps/management/routes/billing.js.map +1 -1
- package/dist/apps/management/routes/invitations.d.ts +121 -121
- package/dist/apps/management/routes/orgs.d.ts +102 -86
- package/dist/apps/management/routes/orgs.d.ts.map +1 -1
- package/dist/apps/management/routes/orgs.js +18 -1
- package/dist/apps/management/routes/orgs.js.map +1 -1
- package/dist/apps/mcp.d.ts +9 -2
- package/dist/apps/mcp.d.ts.map +1 -1
- package/dist/apps/mcp.js +9 -4
- package/dist/apps/mcp.js.map +1 -1
- package/dist/apps/relay/Sponsorships.d.ts +3 -0
- package/dist/apps/relay/Sponsorships.d.ts.map +1 -1
- package/dist/apps/relay/Sponsorships.js +15 -1
- package/dist/apps/relay/Sponsorships.js.map +1 -1
- package/dist/cli/Cli.d.ts.map +1 -1
- package/dist/cli/Cli.js +7 -2
- package/dist/cli/Cli.js.map +1 -1
- package/dist/db/Db.d.ts.map +1 -1
- package/dist/db/Db.js +4 -0
- package/dist/db/Db.js.map +1 -1
- package/dist/db/Schema.js +1 -1
- package/dist/db/Schema.js.map +1 -1
- package/dist/db/tables/organizations.d.ts +6 -0
- package/dist/db/tables/organizations.d.ts.map +1 -1
- package/dist/db/tables/organizations.js +26 -0
- package/dist/db/tables/organizations.js.map +1 -1
- package/dist/db/tables/requestUsage.d.ts +2 -11
- package/dist/db/tables/requestUsage.d.ts.map +1 -1
- package/dist/db/tables/requestUsage.js +1 -20
- package/dist/db/tables/requestUsage.js.map +1 -1
- package/dist/db/tables/sponsoredTransactions.d.ts +2 -1
- package/dist/db/tables/sponsoredTransactions.d.ts.map +1 -1
- package/dist/db/tables/sponsoredTransactions.js +46 -8
- package/dist/db/tables/sponsoredTransactions.js.map +1 -1
- package/dist/internal/Auth.d.ts +4 -0
- package/dist/internal/Auth.d.ts.map +1 -1
- package/dist/internal/Auth.js +7 -8
- package/dist/internal/Auth.js.map +1 -1
- package/dist/internal/Cache.d.ts.map +1 -1
- package/dist/internal/Cache.js +9 -1
- package/dist/internal/Cache.js.map +1 -1
- package/dist/internal/EdgeCache.d.ts.map +1 -1
- package/dist/internal/EdgeCache.js +12 -3
- package/dist/internal/EdgeCache.js.map +1 -1
- package/dist/internal/FundingQuotes.d.ts +16 -10
- package/dist/internal/FundingQuotes.d.ts.map +1 -1
- package/dist/internal/FundingQuotes.js +9 -0
- package/dist/internal/FundingQuotes.js.map +1 -1
- package/dist/internal/RateLimit.d.ts +2 -0
- package/dist/internal/RateLimit.d.ts.map +1 -1
- package/dist/internal/RateLimit.js +4 -4
- package/dist/internal/RateLimit.js.map +1 -1
- package/package.json +7 -2
- package/src/App.test.ts +2 -2
- package/src/Client.test-d.ts +28 -2
- package/src/apps/data/FundingQuoteProviders.test.ts +184 -0
- package/src/apps/data/FundingQuoteProviders.ts +185 -1
- package/src/apps/data/routes/funding.test.ts +7 -0
- package/src/apps/data/routes/funding.ts +4 -4
- package/src/apps/data/routes/tokens.test.ts +54 -0
- package/src/apps/data/routes/transfers.test.ts +73 -1
- package/src/apps/data/routes/transfers.ts +24 -30
- package/src/apps/data/routes/webhooks.test.ts +203 -0
- package/src/apps/data/routes/webhooks.ts +191 -54
- package/src/apps/management/Billing.test.ts +50 -1
- package/src/apps/management/Billing.ts +5 -4
- package/src/apps/management/routes/billing.ts +6 -1
- package/src/apps/management/routes/orgs.ts +19 -1
- package/src/apps/mcp.test.ts +13 -0
- package/src/apps/mcp.ts +18 -5
- package/src/apps/relay/Sponsorships.ts +24 -1
- package/src/cli/Cli.test.ts +36 -0
- package/src/cli/Cli.ts +7 -2
- package/src/db/Db.ts +4 -0
- package/src/db/Schema.ts +1 -1
- package/src/db/tables/organizations.test.ts +30 -0
- package/src/db/tables/organizations.ts +28 -0
- package/src/db/tables/requestUsage.ts +3 -23
- package/src/db/tables/sponsoredTransactions.test.ts +41 -0
- package/src/db/tables/sponsoredTransactions.ts +46 -7
- package/src/internal/Auth.test.ts +63 -10
- package/src/internal/Auth.ts +11 -9
- package/src/internal/Cache.test.ts +19 -0
- package/src/internal/Cache.ts +13 -1
- package/src/internal/EdgeCache.test.ts +40 -0
- package/src/internal/EdgeCache.ts +11 -3
- package/src/internal/FundingQuotes.test.ts +33 -0
- package/src/internal/FundingQuotes.ts +9 -0
- package/src/internal/RateLimit.test.ts +12 -0
- package/src/internal/RateLimit.ts +4 -4
|
@@ -33,12 +33,16 @@ const volatileHeaders = [
|
|
|
33
33
|
'cf-cache-status',
|
|
34
34
|
'content-encoding',
|
|
35
35
|
'content-length',
|
|
36
|
-
'
|
|
37
|
-
'
|
|
36
|
+
'payment-receipt',
|
|
37
|
+
'payment-session-snapshot',
|
|
38
38
|
'ratelimit-limit',
|
|
39
39
|
'ratelimit-remaining',
|
|
40
40
|
'ratelimit-reset',
|
|
41
|
+
'ratelimit-scope',
|
|
42
|
+
'server-timing',
|
|
43
|
+
'set-cookie',
|
|
41
44
|
'tempo-request-id',
|
|
45
|
+
'www-authenticate',
|
|
42
46
|
]
|
|
43
47
|
|
|
44
48
|
/**
|
|
@@ -115,6 +119,8 @@ export function middleware<environment extends Env>(
|
|
|
115
119
|
if (c.res.status < 200 || c.res.status >= 300) return
|
|
116
120
|
if (c.res.headers.has('set-cookie')) return
|
|
117
121
|
if (c.res.headers.get('content-type')?.includes('text/event-stream')) return
|
|
122
|
+
const responseDirectives = (c.res.headers.get('cache-control') ?? '').toLowerCase()
|
|
123
|
+
if (responseDirectives.includes('no-cache') || responseDirectives.includes('no-store')) return
|
|
118
124
|
|
|
119
125
|
// Store a public, sanitized copy; the client still receives the original
|
|
120
126
|
// (private, metered) response for this miss. Clone synchronously — the
|
|
@@ -247,7 +253,9 @@ function isTextual(contentType: string | null): boolean {
|
|
|
247
253
|
function cacheKey(requestUrl: string) {
|
|
248
254
|
const url = new URL(requestUrl)
|
|
249
255
|
url.searchParams.sort()
|
|
250
|
-
|
|
256
|
+
// Version the key so entries written before a sanitizer change cannot
|
|
257
|
+
// survive the deployment that changes the shared-cache boundary.
|
|
258
|
+
return `edge:v2:${url.toString()}`
|
|
251
259
|
}
|
|
252
260
|
|
|
253
261
|
function getWaitUntil(c: { executionCtx?: { waitUntil(promise: Promise<unknown>): void } }) {
|
|
@@ -235,6 +235,32 @@ describe('listQuoteCandidates', () => {
|
|
|
235
235
|
|
|
236
236
|
expect(candidate?.id).toBe('tron-usdt-tempo-usdt0-rhino')
|
|
237
237
|
})
|
|
238
|
+
|
|
239
|
+
test('selects proven Squid stablecoin corridors', () => {
|
|
240
|
+
const candidates = [
|
|
241
|
+
FundingQuotes.listQuoteCandidates({
|
|
242
|
+
destinationToken: 'USDC.e',
|
|
243
|
+
provider: 'squid',
|
|
244
|
+
sourceAmount: '1000000',
|
|
245
|
+
sourceAmountUnits: 'baseUnits',
|
|
246
|
+
sourceChain: 'base',
|
|
247
|
+
sourceToken: 'USDC',
|
|
248
|
+
})[0],
|
|
249
|
+
FundingQuotes.listQuoteCandidates({
|
|
250
|
+
destinationToken: 'USDT0',
|
|
251
|
+
provider: 'squid',
|
|
252
|
+
sourceAmount: '1000000',
|
|
253
|
+
sourceAmountUnits: 'baseUnits',
|
|
254
|
+
sourceChain: 'ethereum',
|
|
255
|
+
sourceToken: 'USDT',
|
|
256
|
+
})[0],
|
|
257
|
+
]
|
|
258
|
+
|
|
259
|
+
expect(candidates.map((candidate) => candidate?.id)).toEqual([
|
|
260
|
+
'base-usdc-tempo-usdce-squid',
|
|
261
|
+
'ethereum-usdt-tempo-usdt0-squid',
|
|
262
|
+
])
|
|
263
|
+
})
|
|
238
264
|
})
|
|
239
265
|
|
|
240
266
|
describe('listProviders', () => {
|
|
@@ -262,6 +288,13 @@ describe('listProviders', () => {
|
|
|
262
288
|
"requiresApiKey": false,
|
|
263
289
|
"status": "unconfigured",
|
|
264
290
|
},
|
|
291
|
+
{
|
|
292
|
+
"id": "squid",
|
|
293
|
+
"kind": "solverNetwork",
|
|
294
|
+
"name": "Squid",
|
|
295
|
+
"requiresApiKey": true,
|
|
296
|
+
"status": "unconfigured",
|
|
297
|
+
},
|
|
265
298
|
]
|
|
266
299
|
`)
|
|
267
300
|
})
|
|
@@ -245,6 +245,13 @@ const providers = [
|
|
|
245
245
|
requiresApiKey: false,
|
|
246
246
|
status: 'unconfigured',
|
|
247
247
|
},
|
|
248
|
+
{
|
|
249
|
+
id: 'squid',
|
|
250
|
+
kind: 'solverNetwork',
|
|
251
|
+
name: 'Squid',
|
|
252
|
+
requiresApiKey: true,
|
|
253
|
+
status: 'unconfigured',
|
|
254
|
+
},
|
|
248
255
|
] as const
|
|
249
256
|
|
|
250
257
|
type TokenInput = (typeof sourceChains)[number]['tokens'][number]
|
|
@@ -369,7 +376,9 @@ const inventory: readonly InventoryEntry[] = [
|
|
|
369
376
|
{ destinationToken: 'usdce', provider: 'across', sourceChains: ['ethereum', 'base', 'bnb'], sourceTokens: ['USDC'] }, // prettier-ignore
|
|
370
377
|
{ destinationToken: 'usdce', provider: 'relay', sourceChains: ['ethereum', 'base', 'bnb'], sourceTokens: ['USDC', 'USDT'] }, // prettier-ignore
|
|
371
378
|
{ destinationToken: 'usdce', provider: 'rhino', sourceChains: ['base', 'solana'], sourceTokens: ['USDC'] }, // prettier-ignore
|
|
379
|
+
{ destinationToken: 'usdce', provider: 'squid', sourceChains: ['ethereum', 'base', 'bnb'], sourceTokens: ['USDC'] }, // prettier-ignore
|
|
372
380
|
{ destinationToken: 'usdt0', provider: 'rhino', sourceChains: ['tron'], sourceTokens: ['USDT'] }, // prettier-ignore
|
|
381
|
+
{ destinationToken: 'usdt0', provider: 'squid', sourceChains: ['ethereum', 'base', 'bnb'], sourceTokens: ['USDT'] }, // prettier-ignore
|
|
373
382
|
]
|
|
374
383
|
|
|
375
384
|
type InventoryEntry = {
|
|
@@ -130,6 +130,18 @@ describe('edge', () => {
|
|
|
130
130
|
expect(ip.limit).toHaveBeenCalledWith({ key: '2001:db8:abcd:12' })
|
|
131
131
|
})
|
|
132
132
|
|
|
133
|
+
test('normalizes equivalent IPv6 addresses to the same /64 prefix', () => {
|
|
134
|
+
expect([
|
|
135
|
+
RateLimit.normalizeIp('2001:0db8:abcd:0012::1'),
|
|
136
|
+
RateLimit.normalizeIp('2001:db8:abcd:12:ffff::2'),
|
|
137
|
+
]).toMatchInlineSnapshot(`
|
|
138
|
+
[
|
|
139
|
+
"2001:db8:abcd:12",
|
|
140
|
+
"2001:db8:abcd:12",
|
|
141
|
+
]
|
|
142
|
+
`)
|
|
143
|
+
})
|
|
144
|
+
|
|
133
145
|
test('returns 429 when any layer denies', async () => {
|
|
134
146
|
const response = await RateLimit.edge(request({ asn: 64512, ip: '203.0.113.7' }), {
|
|
135
147
|
asn: binding(false),
|
|
@@ -139,12 +139,12 @@ type CfProperties = { asn?: number | undefined }
|
|
|
139
139
|
function clientKey(request: Request): string {
|
|
140
140
|
const ip = request.headers.get('cf-connecting-ip')
|
|
141
141
|
if (!ip) return 'unknown'
|
|
142
|
-
|
|
143
|
-
return ipv6Prefix(ip)
|
|
142
|
+
return normalizeIp(ip)
|
|
144
143
|
}
|
|
145
144
|
|
|
146
|
-
/**
|
|
147
|
-
function
|
|
145
|
+
/** Normalizes an IPv4 address or IPv6 /64 prefix for per-client quotas. */
|
|
146
|
+
export function normalizeIp(ip: string): string {
|
|
147
|
+
if (ip.includes('.')) return ip
|
|
148
148
|
const [address = ''] = ip.split('%')
|
|
149
149
|
const [head = '', tail = ''] = address.split('::')
|
|
150
150
|
const left = head ? head.split(':') : []
|