tapimo 0.10.1 → 0.10.2
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 +1776 -1543
- package/dist/App.d.ts.map +1 -1
- package/dist/Webhooks.d.ts +1 -1
- package/dist/Webhooks.d.ts.map +1 -1
- package/dist/Webhooks.js +1 -1
- package/dist/Webhooks.js.map +1 -1
- package/dist/admin/apps/api-keys.d.ts +4 -4
- package/dist/analytics/Analytics.d.ts.map +1 -1
- package/dist/analytics/Analytics.js +206 -0
- package/dist/analytics/Analytics.js.map +1 -1
- package/dist/analytics/tables/requestEvents.d.ts +4 -0
- package/dist/analytics/tables/requestEvents.d.ts.map +1 -1
- package/dist/analytics/tables/requestEvents.js +2 -0
- package/dist/analytics/tables/requestEvents.js.map +1 -1
- package/dist/apps/data/App.d.ts.map +1 -1
- package/dist/apps/data/App.js +2 -0
- package/dist/apps/data/App.js.map +1 -1
- package/dist/apps/data/routes/addresses.d.ts +340 -340
- package/dist/apps/data/routes/balances.d.ts.map +1 -1
- package/dist/apps/data/routes/balances.js +2 -6
- package/dist/apps/data/routes/balances.js.map +1 -1
- package/dist/apps/data/routes/coingecko.d.ts +176 -176
- package/dist/apps/data/routes/earn.d.ts.map +1 -1
- package/dist/apps/data/routes/earn.js +63 -34
- package/dist/apps/data/routes/earn.js.map +1 -1
- package/dist/apps/data/routes/exchanges.d.ts +4 -0
- package/dist/apps/data/routes/exchanges.d.ts.map +1 -1
- package/dist/apps/data/routes/exchanges.js +115 -77
- package/dist/apps/data/routes/exchanges.js.map +1 -1
- package/dist/apps/data/routes/indexer.d.ts +34 -34
- package/dist/apps/data/routes/receipts.d.ts +4 -3
- package/dist/apps/data/routes/receipts.d.ts.map +1 -1
- package/dist/apps/data/routes/receipts.js +15 -14
- package/dist/apps/data/routes/receipts.js.map +1 -1
- package/dist/apps/data/routes/tokens.d.ts +1 -1
- package/dist/apps/data/routes/tokens.d.ts.map +1 -1
- package/dist/apps/data/routes/tokens.js +4 -3
- package/dist/apps/data/routes/tokens.js.map +1 -1
- package/dist/apps/data/routes/transactions.d.ts +281 -281
- package/dist/apps/data/routes/transfers.d.ts.map +1 -1
- package/dist/apps/data/routes/transfers.js +25 -7
- package/dist/apps/data/routes/transfers.js.map +1 -1
- package/dist/apps/data/routes/webhooks.d.ts +380 -364
- package/dist/apps/data/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/data/routes/webhooks.js +16 -9
- package/dist/apps/data/routes/webhooks.js.map +1 -1
- package/dist/apps/data/routes/zones.d.ts +31 -31
- package/dist/apps/funding/App.d.ts +233 -0
- package/dist/apps/funding/App.d.ts.map +1 -1
- package/dist/apps/funding/routes/deposit-addresses.d.ts +330 -0
- package/dist/apps/funding/routes/deposit-addresses.d.ts.map +1 -1
- package/dist/apps/funding/routes/deposit-addresses.js +207 -11
- package/dist/apps/funding/routes/deposit-addresses.js.map +1 -1
- package/dist/apps/funding/routes/providers.d.ts +13 -13
- package/dist/apps/management/routes/faucet.d.ts +32 -32
- package/dist/apps/management/routes/members.d.ts +79 -79
- package/dist/apps/management/routes/usage.d.ts +80 -80
- package/dist/db/Db.d.ts.map +1 -1
- package/dist/db/Db.js +32 -0
- package/dist/db/Db.js.map +1 -1
- package/dist/db/tables/fundingDepositAddresses.d.ts +20 -0
- package/dist/db/tables/fundingDepositAddresses.d.ts.map +1 -1
- package/dist/db/tables/fundingDepositAddresses.js +17 -0
- package/dist/db/tables/fundingDepositAddresses.js.map +1 -1
- package/dist/db/tables/fundingDeposits.d.ts +41 -0
- package/dist/db/tables/fundingDeposits.d.ts.map +1 -1
- package/dist/db/tables/fundingDeposits.js +69 -0
- package/dist/db/tables/fundingDeposits.js.map +1 -1
- package/dist/internal/Auth.d.ts +0 -26
- package/dist/internal/Auth.d.ts.map +1 -1
- package/dist/internal/Auth.js +0 -33
- package/dist/internal/Auth.js.map +1 -1
- package/dist/internal/Credential.d.ts +27 -0
- package/dist/internal/Credential.d.ts.map +1 -0
- package/dist/internal/Credential.js +34 -0
- package/dist/internal/Credential.js.map +1 -0
- package/dist/internal/EarnRates.js +11 -7
- package/dist/internal/EarnRates.js.map +1 -1
- package/dist/internal/Log.d.ts +8 -0
- package/dist/internal/Log.d.ts.map +1 -1
- package/dist/internal/Log.js +4 -0
- package/dist/internal/Log.js.map +1 -1
- package/dist/internal/MetricSink.d.ts +24 -0
- package/dist/internal/MetricSink.d.ts.map +1 -1
- package/dist/internal/MetricSink.js +25 -0
- package/dist/internal/MetricSink.js.map +1 -1
- package/dist/internal/Tidx.d.ts +4 -3
- package/dist/internal/Tidx.d.ts.map +1 -1
- package/dist/internal/Tidx.js +2 -2
- package/dist/internal/Tidx.js.map +1 -1
- package/dist/internal/Viem.d.ts +4 -3
- package/dist/internal/Viem.d.ts.map +1 -1
- package/dist/internal/Viem.js +3 -2
- package/dist/internal/Viem.js.map +1 -1
- package/dist/internal/Webhooks.d.ts +2 -0
- package/dist/internal/Webhooks.d.ts.map +1 -1
- package/dist/internal/Webhooks.js +10 -3
- package/dist/internal/Webhooks.js.map +1 -1
- package/dist/internal/index.d.ts +1 -0
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +1 -0
- package/dist/internal/index.js.map +1 -1
- package/package.json +1 -1
- package/src/App.test.ts +30 -0
- package/src/Client.test-d.ts +33 -1
- package/src/Webhooks.ts +1 -1
- package/src/analytics/Analytics.test.ts +34 -0
- package/src/analytics/Analytics.ts +206 -0
- package/src/analytics/tables/requestEvents.ts +6 -0
- package/src/apps/composition.test.ts +1 -0
- package/src/apps/data/App.ts +2 -0
- package/src/apps/data/routes/balances.ts +2 -6
- package/src/apps/data/routes/earn.ts +64 -34
- package/src/apps/data/routes/exchanges.test.ts +8 -3
- package/src/apps/data/routes/exchanges.ts +134 -82
- package/src/apps/data/routes/receipts.ts +16 -14
- package/src/apps/data/routes/tokens.ts +3 -2
- package/src/apps/data/routes/transactions.bench.ts +8 -0
- package/src/apps/data/routes/transfers.ts +36 -10
- package/src/apps/data/routes/webhooks.ts +31 -10
- package/src/apps/funding/routes/deposit-addresses.test.ts +216 -2
- package/src/apps/funding/routes/deposit-addresses.ts +254 -18
- package/src/apps/funding/routes/transfers.test.ts +17 -2
- package/src/db/Db.ts +36 -0
- package/src/db/tables/fundingDepositAddresses.test.ts +28 -0
- package/src/db/tables/fundingDepositAddresses.ts +39 -0
- package/src/db/tables/fundingDeposits.test.ts +82 -0
- package/src/db/tables/fundingDeposits.ts +130 -0
- package/src/internal/Auth.test.ts +0 -48
- package/src/internal/Auth.ts +0 -59
- package/src/internal/Credential.test.ts +51 -0
- package/src/internal/Credential.ts +58 -0
- package/src/internal/EarnRates.ts +13 -7
- package/src/internal/Log.test.ts +3 -1
- package/src/internal/Log.ts +14 -0
- package/src/internal/MetricSink.test.ts +50 -1
- package/src/internal/MetricSink.ts +52 -0
- package/src/internal/Tidx.ts +5 -4
- package/src/internal/Viem.test.ts +4 -0
- package/src/internal/Viem.ts +6 -4
- package/src/internal/Webhooks.test.ts +9 -0
- package/src/internal/Webhooks.ts +10 -3
- package/src/internal/index.test.ts +1 -0
- package/src/internal/index.ts +1 -0
package/src/internal/Tidx.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Tidx } from 'tidx.ts'
|
|
2
2
|
import type { Chain } from 'viem'
|
|
3
3
|
|
|
4
|
-
import * as Auth from './Auth.js'
|
|
4
|
+
import type * as Auth from './Auth.js'
|
|
5
|
+
import * as Credential from './Credential.js'
|
|
5
6
|
import * as Errors from './Errors.js'
|
|
6
7
|
import type * as Log from './Log.js'
|
|
7
8
|
import * as Viem from './Viem.js'
|
|
@@ -40,7 +41,7 @@ export function resolve(
|
|
|
40
41
|
): resolve.Resolved {
|
|
41
42
|
const config = typeof tidx === 'function' ? tidx(context) : tidx
|
|
42
43
|
return {
|
|
43
|
-
...
|
|
44
|
+
...Credential.resolveCredential({ chainId: context.chainId, value: config?.auth }),
|
|
44
45
|
...(context.zone && config?.zoneHeaders ? { zoneHeaders: config.zoneHeaders } : {}),
|
|
45
46
|
baseUrl:
|
|
46
47
|
Viem.resolveUrl(config?.baseUrl, context.chainId) ??
|
|
@@ -319,7 +320,7 @@ export declare namespace getClient {
|
|
|
319
320
|
type Tidx =
|
|
320
321
|
| {
|
|
321
322
|
/** Shared or per-chain TIDX credentials. Values containing `:` use Basic auth; others use Bearer auth. */
|
|
322
|
-
auth?:
|
|
323
|
+
auth?: Credential.ChainCredential | undefined
|
|
323
324
|
/** Resolves the TIDX base URL for a Tempo chain id, or a static base URL. */
|
|
324
325
|
baseUrl?: UrlResolver | undefined
|
|
325
326
|
/** Headers sent to Zone indexer upstreams. */
|
|
@@ -327,7 +328,7 @@ export declare namespace getClient {
|
|
|
327
328
|
}
|
|
328
329
|
| ((context: Viem.resolveRpc.Context) => {
|
|
329
330
|
/** Shared or per-chain TIDX credentials, or undefined for none. */
|
|
330
|
-
auth?:
|
|
331
|
+
auth?: Credential.ChainCredential | undefined
|
|
331
332
|
/** TIDX base URL to use; falls back to the built-in public host when omitted. */
|
|
332
333
|
baseUrl?: string | undefined
|
|
333
334
|
/** Headers sent to Zone indexer upstreams. */
|
|
@@ -220,6 +220,10 @@ describe('resolveRpc', () => {
|
|
|
220
220
|
})
|
|
221
221
|
|
|
222
222
|
describe('getClient', () => {
|
|
223
|
+
test('disables CCIP-Read', () => {
|
|
224
|
+
expect(Viem.getClient({ chainId: 4217 }).ccipRead).toBe(false)
|
|
225
|
+
})
|
|
226
|
+
|
|
223
227
|
test('disables multicall for Zones', () => {
|
|
224
228
|
const l1Client = Viem.getClient({ chainId: 4217 })
|
|
225
229
|
const zoneClient = Viem.getClient({ chainId: zone.id, zone })
|
package/src/internal/Viem.ts
CHANGED
|
@@ -6,7 +6,8 @@ import type { TempoActions } from 'viem/tempo'
|
|
|
6
6
|
import { tempoMainnet, tempoTestnet } from 'viem/tempo/chains'
|
|
7
7
|
import type * as z from 'zod/mini'
|
|
8
8
|
|
|
9
|
-
import * as Auth from './Auth.js'
|
|
9
|
+
import type * as Auth from './Auth.js'
|
|
10
|
+
import * as Credential from './Credential.js'
|
|
10
11
|
import type * as Schema from './Schema.js'
|
|
11
12
|
|
|
12
13
|
/** Known Tempo chains keyed by id, for metadata lookups. */
|
|
@@ -79,7 +80,7 @@ export function resolveRpc(
|
|
|
79
80
|
context: resolveRpc.Context,
|
|
80
81
|
): resolveRpc.Resolved {
|
|
81
82
|
const config = typeof rpc === 'function' ? rpc(context) : rpc
|
|
82
|
-
const auth =
|
|
83
|
+
const auth = Credential.resolveCredential({ chainId: context.chainId, value: config?.auth })
|
|
83
84
|
const publicZoneUrl = context.zone
|
|
84
85
|
? (resolveUrl(config?.publicZoneUrl, context.chainId) ?? context.zone.rpcUrls.default.http[0])
|
|
85
86
|
: undefined
|
|
@@ -165,6 +166,7 @@ export function getClient(options: getClient.Options): getClient.ReturnType {
|
|
|
165
166
|
// configure a deployed multicall3, can still serve the aggregated call.
|
|
166
167
|
// Zones disable multicall entirely and issue concurrent direct `eth_call`s instead.
|
|
167
168
|
batch: { multicall: zone ? false : { deployless: true } },
|
|
169
|
+
ccipRead: false,
|
|
168
170
|
chain: { ...tempoMainnet, id: chainId },
|
|
169
171
|
transport: http(rpcUrl, fetchOptions ? { fetchOptions } : {}),
|
|
170
172
|
})
|
|
@@ -250,7 +252,7 @@ export declare namespace getClient {
|
|
|
250
252
|
type Rpc =
|
|
251
253
|
| {
|
|
252
254
|
/** Shared or per-chain RPC credentials. Values containing `:` use Basic auth; others use Bearer auth. */
|
|
253
|
-
auth?:
|
|
255
|
+
auth?: Credential.ChainCredential | undefined
|
|
254
256
|
/** Resolves the public Zone RPC URL used with caller-provided authorization. */
|
|
255
257
|
publicZoneUrl?: UrlResolver | undefined
|
|
256
258
|
/** Headers sent to Zone RPC upstreams. */
|
|
@@ -260,7 +262,7 @@ export declare namespace getClient {
|
|
|
260
262
|
}
|
|
261
263
|
| ((context: resolveRpc.Context) => {
|
|
262
264
|
/** Shared or per-chain RPC credentials, or undefined for none. */
|
|
263
|
-
auth?:
|
|
265
|
+
auth?: Credential.ChainCredential | undefined
|
|
264
266
|
/** Public Zone RPC URL used with caller-provided authorization. */
|
|
265
267
|
publicZoneUrl?: string | undefined
|
|
266
268
|
/** Headers sent to Zone RPC upstreams. */
|
|
@@ -1256,6 +1256,15 @@ describe('retryDelayMs', () => {
|
|
|
1256
1256
|
})
|
|
1257
1257
|
})
|
|
1258
1258
|
|
|
1259
|
+
describe('cursorBlock', () => {
|
|
1260
|
+
test('decodes one- and two-part cursors and rejects the rest', () => {
|
|
1261
|
+
expect(Webhooks.cursorBlock(null)).toBeUndefined()
|
|
1262
|
+
expect(Webhooks.cursorBlock('not-a-cursor')).toBeUndefined()
|
|
1263
|
+
expect(Webhooks.cursorBlock(Cursor.encode([123]))).toBe(123)
|
|
1264
|
+
expect(Webhooks.cursorBlock(Cursor.encode([456, 7]))).toBe(456)
|
|
1265
|
+
})
|
|
1266
|
+
})
|
|
1267
|
+
|
|
1259
1268
|
describe('dueQueueEvents', () => {
|
|
1260
1269
|
beforeEach(() => {
|
|
1261
1270
|
vi.useFakeTimers({ toFake: ['Date'] })
|
package/src/internal/Webhooks.ts
CHANGED
|
@@ -373,13 +373,20 @@ export async function maxCursorBlock(db: Db.Db, chainId: number): Promise<number
|
|
|
373
373
|
)
|
|
374
374
|
let max: number | null = null
|
|
375
375
|
for (const cursor of cursors) {
|
|
376
|
-
const
|
|
377
|
-
|
|
378
|
-
if (typeof block === 'number' && (max === null || block > max)) max = block
|
|
376
|
+
const block = cursorBlock(cursor)
|
|
377
|
+
if (block !== undefined && (max === null || block > max)) max = block
|
|
379
378
|
}
|
|
380
379
|
return max
|
|
381
380
|
}
|
|
382
381
|
|
|
382
|
+
/** Decodes the block component of a subscription cursor, if any. */
|
|
383
|
+
export function cursorBlock(cursor: string | null): number | undefined {
|
|
384
|
+
if (cursor === null) return undefined
|
|
385
|
+
const decoded = Cursor.decode(cursor, ['int', 'int']) ?? Cursor.decode(cursor, ['int'])
|
|
386
|
+
const block = decoded?.[0]
|
|
387
|
+
return typeof block === 'number' ? block : undefined
|
|
388
|
+
}
|
|
389
|
+
|
|
383
390
|
/** Reads a subscription's keyset cursor. Returns null when unset. */
|
|
384
391
|
export async function getCursor(db: Db.Db, subscriptionId: string): Promise<string | null> {
|
|
385
392
|
return WebhookSubscriptions.getCursor(db, subscriptionId)
|
package/src/internal/index.ts
CHANGED