Comparing version 2.23.5 to 2.23.6
@@ -14,3 +14,3 @@ "use strict"; | ||
rpcUrls: { | ||
default: { http: ['https://real.drpc.org'] }, | ||
default: { http: ['https://rpc.realforreal.gelato.digital'] }, | ||
}, | ||
@@ -17,0 +17,0 @@ blockExplorers: { |
@@ -15,3 +15,3 @@ "use strict"; | ||
rpcUrls: { | ||
default: { http: ['http://sagaevm-5464-1.jsonrpc.sagarpc.io'] }, | ||
default: { http: ['https://sagaevm.jsonrpc.sagarpc.io'] }, | ||
}, | ||
@@ -21,3 +21,3 @@ blockExplorers: { | ||
name: 'Saga Explorer', | ||
url: 'https://sagaevm-5464-1.sagaexplorer.io', | ||
url: 'https://sagaevm.sagaexplorer.io', | ||
}, | ||
@@ -24,0 +24,0 @@ }, |
@@ -14,3 +14,3 @@ "use strict"; | ||
rpcUrls: { | ||
default: { http: ['https://mainnet.telos.net/evm'] }, | ||
default: { http: ['https://rpc.telos.net'] }, | ||
}, | ||
@@ -17,0 +17,0 @@ blockExplorers: { |
@@ -14,3 +14,3 @@ "use strict"; | ||
rpcUrls: { | ||
default: { http: ['https://testnet.telos.net/evm'] }, | ||
default: { http: ['https://rpc.testnet.telos.net'] }, | ||
}, | ||
@@ -17,0 +17,0 @@ blockExplorers: { |
@@ -10,3 +10,3 @@ "use strict"; | ||
function http(url, config = {}) { | ||
const { batch, fetchOptions, key = 'http', methods, name = 'HTTP JSON-RPC', onFetchRequest, onFetchResponse, retryDelay, } = config; | ||
const { batch, fetchOptions, key = 'http', methods, name = 'HTTP JSON-RPC', onFetchRequest, onFetchResponse, retryDelay, raw, } = config; | ||
return ({ chain, retryCount: retryCount_, timeout: timeout_ }) => { | ||
@@ -50,2 +50,4 @@ const { batchSize = 1000, wait = 0 } = typeof batch === 'object' ? batch : {}; | ||
const [{ error, result }] = await fn(body); | ||
if (raw) | ||
return { error, result }; | ||
if (error) | ||
@@ -52,0 +54,0 @@ throw new request_js_1.RpcRequestError({ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = void 0; | ||
exports.version = '2.23.5'; | ||
exports.version = '2.23.6'; | ||
//# sourceMappingURL=version.js.map |
@@ -20,3 +20,9 @@ "use strict"; | ||
function onMessage({ data }) { | ||
onResponse(JSON.parse(data)); | ||
try { | ||
const _data = JSON.parse(data); | ||
onResponse(_data); | ||
} | ||
catch (error) { | ||
onError(error); | ||
} | ||
} | ||
@@ -23,0 +29,0 @@ socket.addEventListener('close', onClose_); |
@@ -11,3 +11,3 @@ import { defineChain } from '../../utils/chain/defineChain.js'; | ||
rpcUrls: { | ||
default: { http: ['https://real.drpc.org'] }, | ||
default: { http: ['https://rpc.realforreal.gelato.digital'] }, | ||
}, | ||
@@ -14,0 +14,0 @@ blockExplorers: { |
@@ -12,3 +12,3 @@ import { defineChain } from '../../utils/chain/defineChain.js'; | ||
rpcUrls: { | ||
default: { http: ['http://sagaevm-5464-1.jsonrpc.sagarpc.io'] }, | ||
default: { http: ['https://sagaevm.jsonrpc.sagarpc.io'] }, | ||
}, | ||
@@ -18,3 +18,3 @@ blockExplorers: { | ||
name: 'Saga Explorer', | ||
url: 'https://sagaevm-5464-1.sagaexplorer.io', | ||
url: 'https://sagaevm.sagaexplorer.io', | ||
}, | ||
@@ -21,0 +21,0 @@ }, |
@@ -11,3 +11,3 @@ import { defineChain } from '../../utils/chain/defineChain.js'; | ||
rpcUrls: { | ||
default: { http: ['https://mainnet.telos.net/evm'] }, | ||
default: { http: ['https://rpc.telos.net'] }, | ||
}, | ||
@@ -14,0 +14,0 @@ blockExplorers: { |
@@ -11,3 +11,3 @@ import { defineChain } from '../../utils/chain/defineChain.js'; | ||
rpcUrls: { | ||
default: { http: ['https://testnet.telos.net/evm'] }, | ||
default: { http: ['https://rpc.testnet.telos.net'] }, | ||
}, | ||
@@ -14,0 +14,0 @@ blockExplorers: { |
@@ -49,2 +49,3 @@ // biome-ignore lint/performance/noBarrelFile: entrypoint module | ||
export { berachain } from './definitions/berachain.js'; | ||
export { berachainBepolia } from './definitions/berachainBepolia.js'; | ||
export { berachainTestnet } from './definitions/berachainTestnet.js'; | ||
@@ -176,2 +177,3 @@ export { berachainTestnetbArtio } from './definitions/berachainTestnetbArtio.js'; | ||
export { fluenceTestnet } from './definitions/fluenceTestnet.js'; | ||
export { fluentTestnet } from './definitions/fluentTestnet.js'; | ||
export { forma } from './definitions/forma.js'; | ||
@@ -178,0 +180,0 @@ export { form } from './definitions/form.js'; |
@@ -12,3 +12,3 @@ import { RpcRequestError } from '../../errors/request.js'; | ||
url, config = {}) { | ||
const { batch, fetchOptions, key = 'http', methods, name = 'HTTP JSON-RPC', onFetchRequest, onFetchResponse, retryDelay, } = config; | ||
const { batch, fetchOptions, key = 'http', methods, name = 'HTTP JSON-RPC', onFetchRequest, onFetchResponse, retryDelay, raw, } = config; | ||
return ({ chain, retryCount: retryCount_, timeout: timeout_ }) => { | ||
@@ -52,2 +52,4 @@ const { batchSize = 1000, wait = 0 } = typeof batch === 'object' ? batch : {}; | ||
const [{ error, result }] = await fn(body); | ||
if (raw) | ||
return { error, result }; | ||
if (error) | ||
@@ -54,0 +56,0 @@ throw new RpcRequestError({ |
@@ -1,2 +0,2 @@ | ||
export const version = '2.23.5'; | ||
export const version = '2.23.6'; | ||
//# sourceMappingURL=version.js.map |
@@ -17,3 +17,9 @@ import { SocketClosedError, WebSocketRequestError, } from '../../errors/request.js'; | ||
function onMessage({ data }) { | ||
onResponse(JSON.parse(data)); | ||
try { | ||
const _data = JSON.parse(data); | ||
onResponse(_data); | ||
} | ||
catch (error) { | ||
onError(error); | ||
} | ||
} | ||
@@ -20,0 +26,0 @@ // Setup event listeners for RPC & subscription responses. |
@@ -24,3 +24,3 @@ export declare const real: { | ||
readonly default: { | ||
readonly http: readonly ["https://real.drpc.org"]; | ||
readonly http: readonly ["https://rpc.realforreal.gelato.digital"]; | ||
}; | ||
@@ -27,0 +27,0 @@ }; |
@@ -5,3 +5,3 @@ export declare const saga: { | ||
readonly name: "Saga Explorer"; | ||
readonly url: "https://sagaevm-5464-1.sagaexplorer.io"; | ||
readonly url: "https://sagaevm.sagaexplorer.io"; | ||
}; | ||
@@ -24,3 +24,3 @@ }; | ||
readonly default: { | ||
readonly http: readonly ["http://sagaevm-5464-1.jsonrpc.sagarpc.io"]; | ||
readonly http: readonly ["https://sagaevm.jsonrpc.sagarpc.io"]; | ||
}; | ||
@@ -27,0 +27,0 @@ }; |
@@ -23,3 +23,3 @@ export declare const telos: { | ||
readonly default: { | ||
readonly http: readonly ["https://mainnet.telos.net/evm"]; | ||
readonly http: readonly ["https://rpc.telos.net"]; | ||
}; | ||
@@ -26,0 +26,0 @@ }; |
@@ -27,3 +27,3 @@ export declare const telosTestnet: { | ||
readonly default: { | ||
readonly http: readonly ["https://testnet.telos.net/evm"]; | ||
readonly http: readonly ["https://rpc.testnet.telos.net"]; | ||
}; | ||
@@ -30,0 +30,0 @@ }; |
@@ -49,2 +49,3 @@ export type { Chain } from '../types/chain.js'; | ||
export { berachain } from './definitions/berachain.js'; | ||
export { berachainBepolia } from './definitions/berachainBepolia.js'; | ||
export { berachainTestnet } from './definitions/berachainTestnet.js'; | ||
@@ -176,2 +177,3 @@ export { berachainTestnetbArtio } from './definitions/berachainTestnetbArtio.js'; | ||
export { fluenceTestnet } from './definitions/fluenceTestnet.js'; | ||
export { fluentTestnet } from './definitions/fluentTestnet.js'; | ||
export { forma } from './definitions/forma.js'; | ||
@@ -178,0 +180,0 @@ export { form } from './definitions/form.js'; |
@@ -288,5 +288,5 @@ import { type DropTransactionParameters } from '../../actions/test/dropTransaction.js'; | ||
/** | ||
* Returns the details of all transactions currently pending for inclusion in the next block(s), as well as the ones that are being scheduled for future execution only. | ||
* Executes a transaction regardless of the signature. | ||
* | ||
* - Docs: https://viem.sh/docs/actions/test/getTxpoolContent | ||
* - Docs: https://viem.sh/docs/actions/test/sendUnsignedTransaction | ||
* | ||
@@ -293,0 +293,0 @@ * @param args – {@link SendUnsignedTransactionParameters} |
import { type UrlRequiredErrorType } from '../../errors/transport.js'; | ||
import type { ErrorType } from '../../errors/utils.js'; | ||
import type { EIP1193RequestFn, RpcSchema } from '../../types/eip1193.js'; | ||
import { type HttpRpcClientOptions } from '../../utils/rpc/http.js'; | ||
import { type CreateTransportErrorType, type Transport, type TransportConfig } from './createTransport.js'; | ||
export type HttpTransportConfig = { | ||
export type HttpTransportConfig<rpcSchema extends RpcSchema | undefined = undefined, raw extends boolean = false> = { | ||
/** | ||
@@ -31,2 +32,4 @@ * Whether to enable Batch JSON-RPC. | ||
name?: TransportConfig['name'] | undefined; | ||
/** Whether to return JSON RPC errors as responses instead of throwing. */ | ||
raw?: raw | boolean | undefined; | ||
/** The max number of times to retry. */ | ||
@@ -36,9 +39,11 @@ retryCount?: TransportConfig['retryCount'] | undefined; | ||
retryDelay?: TransportConfig['retryDelay'] | undefined; | ||
/** Typed JSON-RPC schema for the transport. */ | ||
rpcSchema?: rpcSchema | RpcSchema | undefined; | ||
/** The timeout (in ms) for the HTTP request. Default: 10_000 */ | ||
timeout?: TransportConfig['timeout'] | undefined; | ||
}; | ||
export type HttpTransport = Transport<'http', { | ||
export type HttpTransport<rpcSchema extends RpcSchema | undefined = undefined, raw extends boolean = false> = Transport<'http', { | ||
fetchOptions?: HttpTransportConfig['fetchOptions'] | undefined; | ||
url?: string | undefined; | ||
}>; | ||
}, EIP1193RequestFn<rpcSchema, raw>>; | ||
export type HttpTransportErrorType = CreateTransportErrorType | UrlRequiredErrorType | ErrorType; | ||
@@ -48,5 +53,5 @@ /** | ||
*/ | ||
export declare function http( | ||
export declare function http<rpcSchema extends RpcSchema | undefined = undefined, raw extends boolean = false>( | ||
/** URL of the JSON-RPC API. Defaults to the chain's public RPC URL. */ | ||
url?: string | undefined, config?: HttpTransportConfig): HttpTransport; | ||
url?: string | undefined, config?: HttpTransportConfig<rpcSchema, raw>): HttpTransport<rpcSchema, raw>; | ||
//# sourceMappingURL=http.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export declare const version = "2.23.5"; | ||
export declare const version = "2.23.6"; | ||
//# sourceMappingURL=version.d.ts.map |
import type { Address } from 'abitype'; | ||
import type * as BlockOverrides from 'ox/BlockOverrides'; | ||
import type * as Rpc from 'ox/RpcResponse'; | ||
import type { RpcEstimateUserOperationGasReturnType, RpcGetUserOperationByHashReturnType, RpcUserOperation, RpcUserOperationReceipt } from '../account-abstraction/types/rpc.js'; | ||
@@ -1766,6 +1767,16 @@ import type { BlockTag } from './block.js'; | ||
}] : rpcSchema; | ||
export type EIP1193RequestFn<rpcSchema extends RpcSchema | undefined = undefined> = <rpcSchemaOverride extends RpcSchemaOverride | undefined = undefined, _parameters extends EIP1193Parameters<DerivedRpcSchema<rpcSchema, rpcSchemaOverride>> = EIP1193Parameters<DerivedRpcSchema<rpcSchema, rpcSchemaOverride>>, _returnType = DerivedRpcSchema<rpcSchema, rpcSchemaOverride> extends RpcSchema ? Extract<DerivedRpcSchema<rpcSchema, rpcSchemaOverride>[number], { | ||
export type EIP1193RequestFn<rpcSchema extends RpcSchema | undefined = undefined, raw extends boolean = false> = <rpcSchemaOverride extends RpcSchemaOverride | undefined = undefined, _parameters extends EIP1193Parameters<DerivedRpcSchema<rpcSchema, rpcSchemaOverride>> = EIP1193Parameters<DerivedRpcSchema<rpcSchema, rpcSchemaOverride>>, _returnType = DerivedRpcSchema<rpcSchema, rpcSchemaOverride> extends RpcSchema ? raw extends true ? OneOf<{ | ||
result: Extract<DerivedRpcSchema<rpcSchema, rpcSchemaOverride>[number], { | ||
Method: _parameters['method']; | ||
}>['ReturnType']; | ||
} | { | ||
error: Rpc.ErrorObject; | ||
}> : Extract<DerivedRpcSchema<rpcSchema, rpcSchemaOverride>[number], { | ||
Method: _parameters['method']; | ||
}>['ReturnType'] : unknown>(args: _parameters, options?: EIP1193RequestOptions | undefined) => Promise<_returnType>; | ||
}>['ReturnType'] : raw extends true ? OneOf<{ | ||
result: unknown; | ||
} | { | ||
error: Rpc.ErrorObject; | ||
}> : unknown>(args: _parameters, options?: EIP1193RequestOptions | undefined) => Promise<_returnType>; | ||
export {}; | ||
//# sourceMappingURL=eip1193.d.ts.map |
@@ -12,3 +12,3 @@ import { defineChain } from '../../utils/chain/defineChain.js' | ||
rpcUrls: { | ||
default: { http: ['https://real.drpc.org'] }, | ||
default: { http: ['https://rpc.realforreal.gelato.digital'] }, | ||
}, | ||
@@ -15,0 +15,0 @@ blockExplorers: { |
@@ -13,3 +13,3 @@ import { defineChain } from '../../utils/chain/defineChain.js' | ||
rpcUrls: { | ||
default: { http: ['http://sagaevm-5464-1.jsonrpc.sagarpc.io'] }, | ||
default: { http: ['https://sagaevm.jsonrpc.sagarpc.io'] }, | ||
}, | ||
@@ -19,3 +19,3 @@ blockExplorers: { | ||
name: 'Saga Explorer', | ||
url: 'https://sagaevm-5464-1.sagaexplorer.io', | ||
url: 'https://sagaevm.sagaexplorer.io', | ||
}, | ||
@@ -22,0 +22,0 @@ }, |
@@ -12,3 +12,3 @@ import { defineChain } from '../../utils/chain/defineChain.js' | ||
rpcUrls: { | ||
default: { http: ['https://mainnet.telos.net/evm'] }, | ||
default: { http: ['https://rpc.telos.net'] }, | ||
}, | ||
@@ -15,0 +15,0 @@ blockExplorers: { |
@@ -12,3 +12,3 @@ import { defineChain } from '../../utils/chain/defineChain.js' | ||
rpcUrls: { | ||
default: { http: ['https://testnet.telos.net/evm'] }, | ||
default: { http: ['https://rpc.testnet.telos.net'] }, | ||
}, | ||
@@ -15,0 +15,0 @@ blockExplorers: { |
@@ -51,2 +51,3 @@ export type { Chain } from '../types/chain.js' | ||
export { berachain } from './definitions/berachain.js' | ||
export { berachainBepolia } from './definitions/berachainBepolia.js' | ||
export { berachainTestnet } from './definitions/berachainTestnet.js' | ||
@@ -178,2 +179,3 @@ export { berachainTestnetbArtio } from './definitions/berachainTestnetbArtio.js' | ||
export { fluenceTestnet } from './definitions/fluenceTestnet.js' | ||
export { fluentTestnet } from './definitions/fluentTestnet.js' | ||
export { forma } from './definitions/forma.js' | ||
@@ -180,0 +182,0 @@ export { form } from './definitions/form.js' |
@@ -359,5 +359,5 @@ import { | ||
/** | ||
* Returns the details of all transactions currently pending for inclusion in the next block(s), as well as the ones that are being scheduled for future execution only. | ||
* Executes a transaction regardless of the signature. | ||
* | ||
* - Docs: https://viem.sh/docs/actions/test/getTxpoolContent | ||
* - Docs: https://viem.sh/docs/actions/test/sendUnsignedTransaction | ||
* | ||
@@ -364,0 +364,0 @@ * @param args – {@link SendUnsignedTransactionParameters} |
@@ -7,2 +7,3 @@ import { RpcRequestError } from '../../errors/request.js' | ||
import type { ErrorType } from '../../errors/utils.js' | ||
import type { EIP1193RequestFn, RpcSchema } from '../../types/eip1193.js' | ||
import type { RpcRequest } from '../../types/rpc.js' | ||
@@ -22,3 +23,6 @@ import { createBatchScheduler } from '../../utils/promise/createBatchScheduler.js' | ||
export type HttpTransportConfig = { | ||
export type HttpTransportConfig< | ||
rpcSchema extends RpcSchema | undefined = undefined, | ||
raw extends boolean = false, | ||
> = { | ||
/** | ||
@@ -52,2 +56,4 @@ * Whether to enable Batch JSON-RPC. | ||
name?: TransportConfig['name'] | undefined | ||
/** Whether to return JSON RPC errors as responses instead of throwing. */ | ||
raw?: raw | boolean | undefined | ||
/** The max number of times to retry. */ | ||
@@ -57,2 +63,4 @@ retryCount?: TransportConfig['retryCount'] | undefined | ||
retryDelay?: TransportConfig['retryDelay'] | undefined | ||
/** Typed JSON-RPC schema for the transport. */ | ||
rpcSchema?: rpcSchema | RpcSchema | undefined | ||
/** The timeout (in ms) for the HTTP request. Default: 10_000 */ | ||
@@ -62,3 +70,6 @@ timeout?: TransportConfig['timeout'] | undefined | ||
export type HttpTransport = Transport< | ||
export type HttpTransport< | ||
rpcSchema extends RpcSchema | undefined = undefined, | ||
raw extends boolean = false, | ||
> = Transport< | ||
'http', | ||
@@ -68,3 +79,4 @@ { | ||
url?: string | undefined | ||
} | ||
}, | ||
EIP1193RequestFn<rpcSchema, raw> | ||
> | ||
@@ -80,7 +92,10 @@ | ||
*/ | ||
export function http( | ||
export function http< | ||
rpcSchema extends RpcSchema | undefined = undefined, | ||
raw extends boolean = false, | ||
>( | ||
/** URL of the JSON-RPC API. Defaults to the chain's public RPC URL. */ | ||
url?: string | undefined, | ||
config: HttpTransportConfig = {}, | ||
): HttpTransport { | ||
config: HttpTransportConfig<rpcSchema, raw> = {}, | ||
): HttpTransport<rpcSchema, raw> { | ||
const { | ||
@@ -95,2 +110,3 @@ batch, | ||
retryDelay, | ||
raw, | ||
} = config | ||
@@ -143,2 +159,4 @@ return ({ chain, retryCount: retryCount_, timeout: timeout_ }) => { | ||
const [{ error, result }] = await fn(body) | ||
if (raw) return { error, result } | ||
if (error) | ||
@@ -145,0 +163,0 @@ throw new RpcRequestError({ |
@@ -1,1 +0,1 @@ | ||
export const version = '2.23.5' | ||
export const version = '2.23.6' |
{ | ||
"name": "viem", | ||
"description": "TypeScript Interface for Ethereum", | ||
"version": "2.23.5", | ||
"version": "2.23.6", | ||
"main": "./_cjs/index.js", | ||
@@ -6,0 +6,0 @@ "module": "./_esm/index.js", |
@@ -264,2 +264,8 @@ <!-- > [!IMPORTANT] --> | ||
</a> | ||
<a href="https://sequence.xyz"> | ||
<picture> | ||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/wevm/.github/main/content/sponsors/sequence-dark.svg"> | ||
<img alt="sequence logo" src="https://raw.githubusercontent.com/wevm/.github/main/content/sponsors/sequence-light.svg" width="auto" height="50"> | ||
</picture> | ||
</a> | ||
@@ -266,0 +272,0 @@ ## Contributing |
import type { Address } from 'abitype' | ||
import type * as BlockOverrides from 'ox/BlockOverrides' | ||
import type * as Rpc from 'ox/RpcResponse' | ||
import type { | ||
@@ -1953,2 +1954,3 @@ RpcEstimateUserOperationGasReturnType, | ||
rpcSchema extends RpcSchema | undefined = undefined, | ||
raw extends boolean = false, | ||
> = < | ||
@@ -1960,7 +1962,26 @@ rpcSchemaOverride extends RpcSchemaOverride | undefined = undefined, | ||
_returnType = DerivedRpcSchema<rpcSchema, rpcSchemaOverride> extends RpcSchema | ||
? Extract< | ||
DerivedRpcSchema<rpcSchema, rpcSchemaOverride>[number], | ||
{ Method: _parameters['method'] } | ||
>['ReturnType'] | ||
: unknown, | ||
? raw extends true | ||
? OneOf< | ||
| { | ||
result: Extract< | ||
DerivedRpcSchema<rpcSchema, rpcSchemaOverride>[number], | ||
{ Method: _parameters['method'] } | ||
>['ReturnType'] | ||
} | ||
| { error: Rpc.ErrorObject } | ||
> | ||
: Extract< | ||
DerivedRpcSchema<rpcSchema, rpcSchemaOverride>[number], | ||
{ Method: _parameters['method'] } | ||
>['ReturnType'] | ||
: raw extends true | ||
? OneOf< | ||
| { | ||
result: unknown | ||
} | ||
| { | ||
error: Rpc.ErrorObject | ||
} | ||
> | ||
: unknown, | ||
>( | ||
@@ -1967,0 +1988,0 @@ args: _parameters, |
@@ -39,3 +39,8 @@ import type { MessageEvent } from 'isows' | ||
function onMessage({ data }: MessageEvent) { | ||
onResponse(JSON.parse(data)) | ||
try { | ||
const _data = JSON.parse(data) | ||
onResponse(_data) | ||
} catch (error) { | ||
onError(error as Error) | ||
} | ||
} | ||
@@ -42,0 +47,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
15395357
7858
281091
291
62
24
5