ox 0.14.13 → 0.14.14

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # ox
2
2
 
3
+ ## 0.14.14
4
+
5
+ ### Patch Changes
6
+
7
+ - [`14137f7`](https://github.com/wevm/ox/commit/14137f77136a1184f5fecbb6083e7a93495ab7f8) Thanks [@jxom](https://github.com/jxom)! - Added `RpcSchema.ToViem` and `RpcSchema.FromViem` type utilities for converting between Ox and Viem RPC schema formats. Added `tempo_simulateV1` RPC schema to `ox/tempo`.
8
+
3
9
  ## 0.14.13
4
10
 
5
11
  ### Patch Changes
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=RpcSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RpcSchema.js","sourceRoot":"","sources":["../../tempo/RpcSchema.ts"],"names":[],"mappings":""}
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TxEnvelopeTempo = exports.TransactionRequest = exports.TransactionReceipt = exports.Transaction = exports.TokenRole = exports.TokenId = exports.Tick = exports.TempoAddress = exports.SignatureEnvelope = exports.PoolId = exports.Period = exports.KeyAuthorization = exports.AuthorizationTempo = void 0;
3
+ exports.TxEnvelopeTempo = exports.TransactionRequest = exports.TransactionReceipt = exports.Transaction = exports.TokenRole = exports.TokenId = exports.Tick = exports.TempoAddress = exports.SignatureEnvelope = exports.RpcSchema = exports.PoolId = exports.Period = exports.KeyAuthorization = exports.AuthorizationTempo = void 0;
4
4
  exports.AuthorizationTempo = require("./AuthorizationTempo.js");
5
5
  exports.KeyAuthorization = require("./KeyAuthorization.js");
6
6
  exports.Period = require("./Period.js");
7
7
  exports.PoolId = require("./PoolId.js");
8
+ exports.RpcSchema = require("./RpcSchema.js");
8
9
  exports.SignatureEnvelope = require("./SignatureEnvelope.js");
9
10
  exports.TempoAddress = require("./TempoAddress.js");
10
11
  exports.Tick = require("./Tick.js");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../tempo/index.ts"],"names":[],"mappings":";;;AAoCA,gEAA6D;AAyC7D,4DAAyD;AA8BzD,wCAAqC;AAsBrC,wCAAqC;AAuBrC,8DAA2D;AAoB3D,oDAAiD;AAqBjD,oCAAiC;AAsBjC,0CAAuC;AAmBvC,8CAA2C;AAmD3C,kDAA+C;AAuB/C,gEAA6D;AAqB7D,gEAA6D;AA6B7D,0DAAuD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../tempo/index.ts"],"names":[],"mappings":";;;AAoCA,gEAA6D;AAyC7D,4DAAyD;AA8BzD,wCAAqC;AAsBrC,wCAAqC;AAoBrC,8CAA2C;AAuB3C,8DAA2D;AAoB3D,oDAAiD;AAqBjD,oCAAiC;AAsBjC,0CAAuC;AAmBvC,8CAA2C;AAmD3C,kDAA+C;AAuB/C,gEAA6D;AAqB7D,gEAA6D;AA6B7D,0DAAuD"}
package/_cjs/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
- exports.version = '0.14.13';
4
+ exports.version = '0.14.14';
5
5
  //# sourceMappingURL=version.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=RpcSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RpcSchema.js","sourceRoot":"","sources":["../../tempo/RpcSchema.ts"],"names":[],"mappings":""}
@@ -121,6 +121,25 @@ export * as Period from './Period.js';
121
121
  * @category Reference
122
122
  */
123
123
  export * as PoolId from './PoolId.js';
124
+ /**
125
+ * Union of all JSON-RPC Methods for the `tempo_` namespace.
126
+ *
127
+ * @example
128
+ * ```ts twoslash
129
+ * import { Provider, RpcSchema } from 'ox'
130
+ * import { RpcSchema as TempoRpcSchema } from 'ox/tempo'
131
+ *
132
+ * const schema = RpcSchema.from<
133
+ * | RpcSchema.Default
134
+ * | TempoRpcSchema.Tempo
135
+ * >()
136
+ *
137
+ * const provider = Provider.from(window.ethereum!, { schema })
138
+ * ```
139
+ *
140
+ * @category Reference
141
+ */
142
+ export * as RpcSchema from './RpcSchema.js';
124
143
  /**
125
144
  * Signature envelope utilities for secp256k1, P256, WebAuthn, and keychain signatures.
126
145
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../tempo/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAA;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAA;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAErC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAErC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAA;AAE3D;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA;AAEjD;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAEvC;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C;;;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,MAAM,kBAAkB,CAAA;AAC/C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAA;AAC7D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAA;AAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAA"}
package/_esm/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  /** @internal */
2
- export const version = '0.14.13';
2
+ export const version = '0.14.14';
3
3
  //# sourceMappingURL=version.js.map
@@ -245,4 +245,68 @@ export type Default = ResolvedRegister['RpcSchema'];
245
245
  * ```
246
246
  */
247
247
  export type MethodNameGeneric<schema extends Generic = Generic> = schema['Request']['method'] | (string & {});
248
+ /**
249
+ * Converts an Ox {@link ox#RpcSchema.Generic} (union of `{ Request, ReturnType }`) to
250
+ * a [Viem-compatible RPC schema](https://viem.sh) (tuple of `{ Method, Parameters, ReturnType }`).
251
+ *
252
+ * @example
253
+ * ```ts twoslash
254
+ * import { RpcSchema } from 'ox'
255
+ *
256
+ * type ViemSchema = RpcSchema.ToViem<
257
+ * | {
258
+ * Request: { method: 'eth_blockNumber'; params?: undefined }
259
+ * ReturnType: `0x${string}`
260
+ * }
261
+ * | {
262
+ * Request: { method: 'eth_chainId'; params?: undefined }
263
+ * ReturnType: `0x${string}`
264
+ * }
265
+ * >
266
+ * // ^? [{ Method: 'eth_blockNumber'; Parameters?: undefined; ReturnType: `0x${string}` }, ...]
267
+ * ```
268
+ */
269
+ export type ToViem<schema extends Generic> = UnionToTuple<schema extends schema ? {
270
+ Method: schema['Request']['method'];
271
+ Parameters: schema['Request']['params'];
272
+ ReturnType: schema extends {
273
+ ReturnType: infer r;
274
+ } ? r : unknown;
275
+ } : never>;
276
+ /**
277
+ * Converts a [Viem-compatible RPC schema](https://viem.sh) (tuple of `{ Method, Parameters, ReturnType }`)
278
+ * to an Ox {@link ox#RpcSchema.Generic} (union of `{ Request, ReturnType }`).
279
+ *
280
+ * @example
281
+ * ```ts twoslash
282
+ * import { RpcSchema } from 'ox'
283
+ *
284
+ * type OxSchema = RpcSchema.FromViem<[
285
+ * { Method: 'eth_blockNumber'; Parameters?: undefined; ReturnType: `0x${string}` },
286
+ * { Method: 'eth_chainId'; Parameters?: undefined; ReturnType: `0x${string}` },
287
+ * ]>
288
+ * // ^? { Request: { method: 'eth_blockNumber'; params?: undefined }; ReturnType: `0x${string}` } | ...
289
+ * ```
290
+ */
291
+ export type FromViem<schema extends readonly ViemSchemaItem[]> = {
292
+ [k in keyof schema]: schema[k] extends ViemSchemaItem ? {
293
+ Request: {
294
+ method: schema[k]['Method'];
295
+ params: schema[k]['Parameters'];
296
+ };
297
+ ReturnType: schema[k]['ReturnType'];
298
+ } : never;
299
+ }[number];
300
+ /** @internal */
301
+ type ViemSchemaItem = {
302
+ Method: string;
303
+ Parameters?: unknown;
304
+ ReturnType?: unknown;
305
+ };
306
+ /** @internal */
307
+ type UnionToIntersection<union> = (union extends unknown ? (arg: () => union) => void : never) extends (arg: infer intersection) => void ? intersection : never;
308
+ /** @internal */
309
+ type UnionLast<union> = UnionToIntersection<union> extends () => infer last ? last : never;
310
+ /** @internal */
311
+ type UnionToTuple<union, last = UnionLast<union>> = [union] extends [never] ? [] : [...UnionToTuple<Exclude<union, last>>, last];
248
312
  //# sourceMappingURL=RpcSchema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RpcSchema.d.ts","sourceRoot":"","sources":["../../core/RpcSchema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAEhE,YAAY,EAAE,GAAG,EAAE,MAAM,8BAA8B,CAAA;AACvD,YAAY,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AAE7D;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EAAE,IAAI,CAAC,CAAA"}
@@ -0,0 +1,70 @@
1
+ import type * as Block from '../core/Block.js';
2
+ import type * as BlockOverrides from '../core/BlockOverrides.js';
3
+ import type * as Hex from '../core/Hex.js';
4
+ import type * as Log from '../core/Log.js';
5
+ import type * as RpcSchema from '../core/RpcSchema.js';
6
+ import type * as StateOverrides from '../core/StateOverrides.js';
7
+ import type * as TransactionRequest from './TransactionRequest.js';
8
+ /**
9
+ * Union of all JSON-RPC Methods for the `tempo_` namespace.
10
+ *
11
+ * @example
12
+ * ```ts twoslash
13
+ * import { RpcSchema } from 'ox/tempo'
14
+ *
15
+ * type Schema = RpcSchema.Tempo
16
+ * // ^?
17
+ *
18
+ *
19
+ *
20
+ *
21
+ *
22
+ *
23
+ *
24
+ *
25
+ *
26
+ *
27
+ *
28
+ * ```
29
+ */
30
+ export type Tempo = RpcSchema.From<{
31
+ Request: {
32
+ method: 'tempo_simulateV1';
33
+ params: [
34
+ {
35
+ blockStateCalls: readonly {
36
+ blockOverrides?: BlockOverrides.Rpc | undefined;
37
+ calls?: readonly TransactionRequest.Rpc[] | undefined;
38
+ stateOverrides?: StateOverrides.Rpc | undefined;
39
+ }[];
40
+ returnFullTransactions?: boolean | undefined;
41
+ traceTransfers?: boolean | undefined;
42
+ validation?: boolean | undefined;
43
+ },
44
+ block: Block.Number<Hex.Hex> | Block.Tag | Block.Hash | Block.Identifier
45
+ ];
46
+ };
47
+ ReturnType: {
48
+ blocks: readonly (Block.Rpc & {
49
+ calls?: readonly {
50
+ error?: {
51
+ data?: Hex.Hex | undefined;
52
+ code: number;
53
+ message: string;
54
+ } | undefined;
55
+ logs?: readonly Log.Rpc[] | undefined;
56
+ gasUsed: Hex.Hex;
57
+ returnData: Hex.Hex;
58
+ status: Hex.Hex;
59
+ }[] | undefined;
60
+ })[];
61
+ tokenMetadata: {
62
+ [address: Hex.Hex]: {
63
+ name: string;
64
+ symbol: string;
65
+ currency: string;
66
+ };
67
+ };
68
+ };
69
+ }>;
70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ACV,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,GAAG,GAAG;YAC5B,KAAK,CAAC,EACF,SAAS;gBACP,KAAK,CAAC,EACF;oBACE,IAAI,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,SAAS,CAAA;oBAC1B,IAAI,EAAE,MAAM,CAAA;oBACZ,OAAO,EAAE,MAAM,CAAA;iBAChB,GACD,SAAS,CAAA;gBACb,IAAI,CAAC,EAAE,SAAS,GAAG,CAAC,GAAG,EAAE,GAAG,SAAS,CAAA;gBACrC,OAAO,EAAE,GAAG,CAAC,GAAG,CAAA;gBAChB,UAAU,EAAE,GAAG,CAAC,GAAG,CAAA;gBACnB,MAAM,EAAE,GAAG,CAAC,GAAG,CAAA;aAChB,EAAE,GACH,SAAS,CAAA;SACd,CAAC,EAAE,CAAA;QACJ,aAAa,EAAE;YACb,CAAC,OAAO,EAAE,GAAG,CAAC,GAAG,GAAG;gBAClB,IAAI,EAAE,MAAM,CAAA;gBACZ,MAAM,EAAE,MAAM,CAAA;gBACd,QAAQ,EAAE,MAAM,CAAA;aACjB,CAAA;SACF,CAAA;KACF,CAAA;CACF,CAAC,CAAA"}
@@ -123,6 +123,25 @@ export * as Period from './Period.js';
123
123
  * @category Reference
124
124
  */
125
125
  export * as PoolId from './PoolId.js';
126
+ /**
127
+ * Union of all JSON-RPC Methods for the `tempo_` namespace.
128
+ *
129
+ * @example
130
+ * ```ts twoslash
131
+ * import { Provider, RpcSchema } from 'ox'
132
+ * import { RpcSchema as TempoRpcSchema } from 'ox/tempo'
133
+ *
134
+ * const schema = RpcSchema.from<
135
+ * | RpcSchema.Default
136
+ * | TempoRpcSchema.Tempo
137
+ * >()
138
+ *
139
+ * const provider = Provider.from(window.ethereum!, { schema })
140
+ * ```
141
+ *
142
+ * @category Reference
143
+ */
144
+ export * as RpcSchema from './RpcSchema.js';
126
145
  /**
127
146
  * Signature envelope utilities for secp256k1, P256, WebAuthn, and keychain signatures.
128
147
  *
@@ -1 +1 @@
1
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;;;;;;;;;;;;;GA2BG;AACH,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAA"}
@@ -1,3 +1,3 @@
1
1
  /** @internal */
2
- export declare const version = "0.14.13";
2
+ export declare const version = "0.14.14";
3
3
  //# sourceMappingURL=version.d.ts.map
package/core/RpcSchema.ts CHANGED
@@ -271,3 +271,88 @@ export type Default = ResolvedRegister['RpcSchema']
271
271
  export type MethodNameGeneric<schema extends Generic = Generic> =
272
272
  | schema['Request']['method']
273
273
  | (string & {})
274
+
275
+ /**
276
+ * Converts an Ox {@link ox#RpcSchema.Generic} (union of `{ Request, ReturnType }`) to
277
+ * a [Viem-compatible RPC schema](https://viem.sh) (tuple of `{ Method, Parameters, ReturnType }`).
278
+ *
279
+ * @example
280
+ * ```ts twoslash
281
+ * import { RpcSchema } from 'ox'
282
+ *
283
+ * type ViemSchema = RpcSchema.ToViem<
284
+ * | {
285
+ * Request: { method: 'eth_blockNumber'; params?: undefined }
286
+ * ReturnType: `0x${string}`
287
+ * }
288
+ * | {
289
+ * Request: { method: 'eth_chainId'; params?: undefined }
290
+ * ReturnType: `0x${string}`
291
+ * }
292
+ * >
293
+ * // ^? [{ Method: 'eth_blockNumber'; Parameters?: undefined; ReturnType: `0x${string}` }, ...]
294
+ * ```
295
+ */
296
+ export type ToViem<schema extends Generic> = UnionToTuple<
297
+ schema extends schema
298
+ ? {
299
+ Method: schema['Request']['method']
300
+ Parameters: schema['Request']['params']
301
+ ReturnType: schema extends { ReturnType: infer r } ? r : unknown
302
+ }
303
+ : never
304
+ >
305
+
306
+ /**
307
+ * Converts a [Viem-compatible RPC schema](https://viem.sh) (tuple of `{ Method, Parameters, ReturnType }`)
308
+ * to an Ox {@link ox#RpcSchema.Generic} (union of `{ Request, ReturnType }`).
309
+ *
310
+ * @example
311
+ * ```ts twoslash
312
+ * import { RpcSchema } from 'ox'
313
+ *
314
+ * type OxSchema = RpcSchema.FromViem<[
315
+ * { Method: 'eth_blockNumber'; Parameters?: undefined; ReturnType: `0x${string}` },
316
+ * { Method: 'eth_chainId'; Parameters?: undefined; ReturnType: `0x${string}` },
317
+ * ]>
318
+ * // ^? { Request: { method: 'eth_blockNumber'; params?: undefined }; ReturnType: `0x${string}` } | ...
319
+ * ```
320
+ */
321
+ export type FromViem<schema extends readonly ViemSchemaItem[]> = {
322
+ [k in keyof schema]: schema[k] extends ViemSchemaItem
323
+ ? {
324
+ Request: {
325
+ method: schema[k]['Method']
326
+ params: schema[k]['Parameters']
327
+ }
328
+ ReturnType: schema[k]['ReturnType']
329
+ }
330
+ : never
331
+ }[number]
332
+
333
+ /** @internal */
334
+ type ViemSchemaItem = {
335
+ Method: string
336
+ Parameters?: unknown
337
+ ReturnType?: unknown
338
+ }
339
+
340
+ // --- Union-to-tuple helpers (order is not guaranteed, but stable) ---
341
+ /** @internal */
342
+ type UnionToIntersection<union> = (
343
+ union extends unknown
344
+ ? (arg: () => union) => void
345
+ : never
346
+ ) extends (arg: infer intersection) => void
347
+ ? intersection
348
+ : never
349
+
350
+ /** @internal */
351
+ type UnionLast<union> = UnionToIntersection<union> extends () => infer last
352
+ ? last
353
+ : never
354
+
355
+ /** @internal */
356
+ type UnionToTuple<union, last = UnionLast<union>> = [union] extends [never]
357
+ ? []
358
+ : [...UnionToTuple<Exclude<union, last>>, last]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ox",
3
3
  "description": "Ethereum Standard Library",
4
- "version": "0.14.13",
4
+ "version": "0.14.14",
5
5
  "main": "./_cjs/index.js",
6
6
  "module": "./_esm/index.js",
7
7
  "types": "./_types/index.d.ts",
@@ -519,6 +519,11 @@
519
519
  "import": "./_esm/tempo/PoolId.js",
520
520
  "default": "./_cjs/tempo/PoolId.js"
521
521
  },
522
+ "./tempo/RpcSchema": {
523
+ "types": "./_types/tempo/RpcSchema.d.ts",
524
+ "import": "./_esm/tempo/RpcSchema.js",
525
+ "default": "./_cjs/tempo/RpcSchema.js"
526
+ },
522
527
  "./tempo/SignatureEnvelope": {
523
528
  "types": "./_types/tempo/SignatureEnvelope.d.ts",
524
529
  "import": "./_esm/tempo/SignatureEnvelope.js",
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "module",
3
+ "types": "../../_types/tempo/RpcSchema.d.ts",
4
+ "main": "../../_cjs/tempo/RpcSchema.js",
5
+ "module": "../../_esm/tempo/RpcSchema.js"
6
+ }
@@ -0,0 +1,74 @@
1
+ import type * as Block from '../core/Block.js'
2
+ import type * as BlockOverrides from '../core/BlockOverrides.js'
3
+ import type * as Hex from '../core/Hex.js'
4
+ import type * as Log from '../core/Log.js'
5
+ import type * as RpcSchema from '../core/RpcSchema.js'
6
+ import type * as StateOverrides from '../core/StateOverrides.js'
7
+ import type * as TransactionRequest from './TransactionRequest.js'
8
+
9
+ /**
10
+ * Union of all JSON-RPC Methods for the `tempo_` namespace.
11
+ *
12
+ * @example
13
+ * ```ts twoslash
14
+ * import { RpcSchema } from 'ox/tempo'
15
+ *
16
+ * type Schema = RpcSchema.Tempo
17
+ * // ^?
18
+ *
19
+ *
20
+ *
21
+ *
22
+ *
23
+ *
24
+ *
25
+ *
26
+ *
27
+ *
28
+ *
29
+ * ```
30
+ */
31
+ export type Tempo = RpcSchema.From<{
32
+ Request: {
33
+ method: 'tempo_simulateV1'
34
+ params: [
35
+ {
36
+ blockStateCalls: readonly {
37
+ blockOverrides?: BlockOverrides.Rpc | undefined
38
+ calls?: readonly TransactionRequest.Rpc[] | undefined
39
+ stateOverrides?: StateOverrides.Rpc | undefined
40
+ }[]
41
+ returnFullTransactions?: boolean | undefined
42
+ traceTransfers?: boolean | undefined
43
+ validation?: boolean | undefined
44
+ },
45
+ block: Block.Number<Hex.Hex> | Block.Tag | Block.Hash | Block.Identifier,
46
+ ]
47
+ }
48
+ ReturnType: {
49
+ blocks: readonly (Block.Rpc & {
50
+ calls?:
51
+ | readonly {
52
+ error?:
53
+ | {
54
+ data?: Hex.Hex | undefined
55
+ code: number
56
+ message: string
57
+ }
58
+ | undefined
59
+ logs?: readonly Log.Rpc[] | undefined
60
+ gasUsed: Hex.Hex
61
+ returnData: Hex.Hex
62
+ status: Hex.Hex
63
+ }[]
64
+ | undefined
65
+ })[]
66
+ tokenMetadata: {
67
+ [address: Hex.Hex]: {
68
+ name: string
69
+ symbol: string
70
+ currency: string
71
+ }
72
+ }
73
+ }
74
+ }>
package/tempo/index.ts CHANGED
@@ -129,6 +129,26 @@ export * as Period from './Period.js'
129
129
  */
130
130
  export * as PoolId from './PoolId.js'
131
131
 
132
+ /**
133
+ * Union of all JSON-RPC Methods for the `tempo_` namespace.
134
+ *
135
+ * @example
136
+ * ```ts twoslash
137
+ * import { Provider, RpcSchema } from 'ox'
138
+ * import { RpcSchema as TempoRpcSchema } from 'ox/tempo'
139
+ *
140
+ * const schema = RpcSchema.from<
141
+ * | RpcSchema.Default
142
+ * | TempoRpcSchema.Tempo
143
+ * >()
144
+ *
145
+ * const provider = Provider.from(window.ethereum!, { schema })
146
+ * ```
147
+ *
148
+ * @category Reference
149
+ */
150
+ export * as RpcSchema from './RpcSchema.js'
151
+
132
152
  /**
133
153
  * Signature envelope utilities for secp256k1, P256, WebAuthn, and keychain signatures.
134
154
  *
package/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  /** @internal */
2
- export const version = '0.14.13'
2
+ export const version = '0.14.14'