viem 0.0.1-alpha.16 → 0.0.1-alpha.18
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/chains.d.ts +1 -1
- package/dist/chains.js +5 -5
- package/dist/chains.mjs +1 -1
- package/dist/{chunk-U7QDLGQL.mjs → chunk-3E5WSIQU.mjs} +2 -2
- package/dist/{chunk-U7QDLGQL.mjs.map → chunk-3E5WSIQU.mjs.map} +0 -0
- package/dist/{chunk-XJKOJIX3.js → chunk-3EXLRM3B.js} +12 -12
- package/dist/{chunk-XJKOJIX3.js.map → chunk-3EXLRM3B.js.map} +0 -0
- package/dist/{chunk-EWTLCB3N.js → chunk-6CXRXH25.js} +2 -2
- package/dist/{chunk-EWTLCB3N.js.map → chunk-6CXRXH25.js.map} +0 -0
- package/dist/{chunk-WTXKCAG7.js → chunk-A4HJ47I6.js} +144 -53
- package/dist/chunk-A4HJ47I6.js.map +1 -0
- package/dist/{chunk-4XREGFHD.js → chunk-BW2LPGYJ.js} +36 -13
- package/dist/chunk-BW2LPGYJ.js.map +1 -0
- package/dist/{chunk-KM6AFT2K.mjs → chunk-NSPSPOUF.mjs} +2 -2
- package/dist/{chunk-KM6AFT2K.mjs.map → chunk-NSPSPOUF.mjs.map} +0 -0
- package/dist/{chunk-B7A2CAHU.mjs → chunk-OGQGNULX.mjs} +98 -7
- package/dist/chunk-OGQGNULX.mjs.map +1 -0
- package/dist/{chunk-TSJ3OOJW.mjs → chunk-TO7QJO5X.mjs} +2 -2
- package/dist/{chunk-TSJ3OOJW.mjs.map → chunk-TO7QJO5X.mjs.map} +0 -0
- package/dist/{chunk-LQXQPPTU.js → chunk-XQZRYOPA.js} +14 -14
- package/dist/{chunk-LQXQPPTU.js.map → chunk-XQZRYOPA.js.map} +0 -0
- package/dist/{chunk-KCMYVU3Z.mjs → chunk-Y3PSHZGB.mjs} +26 -3
- package/dist/chunk-Y3PSHZGB.mjs.map +1 -0
- package/dist/clients/index.d.ts +7 -7
- package/dist/clients/index.js +3 -3
- package/dist/clients/index.mjs +2 -2
- package/dist/{createClient-cd948138.d.ts → createClient-aadeff37.d.ts} +1 -1
- package/dist/{createPublicClient-989a0556.d.ts → createPublicClient-88f35518.d.ts} +2 -2
- package/dist/{createTestClient-81507f58.d.ts → createTestClient-fbf66ec2.d.ts} +2 -2
- package/dist/{createWalletClient-43f801b9.d.ts → createWalletClient-b13dabd6.d.ts} +2 -2
- package/dist/{eip1193-4330b722.d.ts → eip1193-3a40c941.d.ts} +9 -6
- package/dist/index.d.ts +57 -17
- package/dist/index.js +12 -6
- package/dist/index.mjs +15 -9
- package/dist/{parseGwei-f2d23de6.d.ts → parseGwei-dbd12305.d.ts} +2 -2
- package/dist/public.d.ts +9 -9
- package/dist/public.js +4 -4
- package/dist/public.mjs +5 -5
- package/dist/{rpc-b77c5aee.d.ts → rpc-858670f1.d.ts} +12 -1
- package/dist/{sendTransaction-7a9d241a.d.ts → sendTransaction-bd109cd4.d.ts} +3 -3
- package/dist/{stopImpersonatingAccount-8113150e.d.ts → stopImpersonatingAccount-6603ebdd.d.ts} +2 -2
- package/dist/test.d.ts +5 -5
- package/dist/test.js +3 -3
- package/dist/test.mjs +2 -2
- package/dist/{transactionReceipt-5d332aab.d.ts → transactionReceipt-aed524b4.d.ts} +30 -4
- package/dist/{transactionRequest-327eb7c2.d.ts → transactionRequest-8e970b0e.d.ts} +1 -1
- package/dist/utils/index.d.ts +5 -5
- package/dist/utils/index.js +2 -2
- package/dist/utils/index.mjs +1 -1
- package/dist/wallet.d.ts +7 -7
- package/dist/wallet.js +3 -3
- package/dist/wallet.mjs +2 -2
- package/dist/{watchAsset-0088384c.d.ts → watchAsset-7ef25553.d.ts} +3 -3
- package/dist/{watchPendingTransactions-670a7ca3.d.ts → watchPendingTransactions-7cbbef80.d.ts} +26 -11
- package/dist/{webSocket-9a3b0b26.d.ts → webSocket-2a77cdb3.d.ts} +2 -2
- package/dist/window.d.ts +2 -2
- package/package.json +1 -1
- package/src/actions/index.test.ts +4 -1
- package/src/actions/index.ts +12 -3
- package/src/actions/public/createEventFilter.ts +2 -4
- package/src/actions/public/deployContract.test.ts +8 -8
- package/src/actions/public/getLogs.test.ts +105 -0
- package/src/actions/public/getLogs.ts +83 -0
- package/src/actions/public/index.test.ts +3 -1
- package/src/actions/public/index.ts +13 -5
- package/src/actions/public/readContract.test.ts +128 -0
- package/src/actions/public/{callContract.ts → readContract.ts} +23 -16
- package/src/actions/public/simulateContract.bench.ts +31 -0
- package/src/actions/public/simulateContract.test.ts +238 -0
- package/src/actions/public/simulateContract.ts +98 -0
- package/src/actions/wallet/index.test.ts +1 -0
- package/src/actions/wallet/index.ts +3 -0
- package/src/actions/wallet/writeContract.test.ts +54 -0
- package/src/actions/wallet/writeContract.ts +56 -0
- package/src/index.test.ts +4 -1
- package/src/index.ts +12 -3
- package/src/public.ts +3 -3
- package/src/types/eip1193.ts +9 -6
- package/src/types/index.ts +1 -1
- package/src/types/misc.ts +1 -0
- package/dist/chunk-4XREGFHD.js.map +0 -1
- package/dist/chunk-B7A2CAHU.mjs.map +0 -1
- package/dist/chunk-KCMYVU3Z.mjs.map +0 -1
- package/dist/chunk-WTXKCAG7.js.map +0 -1
- package/src/actions/public/callContract.bench.ts +0 -24
- package/src/actions/public/callContract.test.ts +0 -285
package/dist/chains.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { R as RpcBlock,
|
1
|
+
import { R as RpcBlock, f as Block, q as RpcTransaction, D as Transaction, r as RpcTransactionReceipt, T as TransactionReceipt, v as TransactionRequest, s as RpcTransactionRequest, N as TransactionType, b as Hex } from './rpc-858670f1.js';
|
2
2
|
import { Chain as Chain$1 } from '@wagmi/chains';
|
3
3
|
|
4
4
|
type Formatter<TSource = any, TTarget = any> = (value: TSource & {
|
package/dist/chains.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
|
5
5
|
|
6
|
-
var
|
6
|
+
var _chunk6CXRXH25js = require('./chunk-6CXRXH25.js');
|
7
7
|
|
8
8
|
// src/chains.ts
|
9
9
|
|
@@ -48,13 +48,13 @@ function defineFormatter({
|
|
48
48
|
};
|
49
49
|
};
|
50
50
|
}
|
51
|
-
var defineBlock = defineFormatter({ format:
|
52
|
-
var defineTransaction = defineFormatter({ format:
|
51
|
+
var defineBlock = defineFormatter({ format: _chunk6CXRXH25js.formatBlock });
|
52
|
+
var defineTransaction = defineFormatter({ format: _chunk6CXRXH25js.formatTransaction });
|
53
53
|
var defineTransactionRequest = defineFormatter({
|
54
|
-
format:
|
54
|
+
format: _chunk6CXRXH25js.formatTransactionRequest
|
55
55
|
});
|
56
56
|
var defineTransactionReceipt = defineFormatter({
|
57
|
-
format:
|
57
|
+
format: _chunk6CXRXH25js.formatTransactionReceipt
|
58
58
|
});
|
59
59
|
var arbitrumGoerli = defineChain(_chains.arbitrumGoerli);
|
60
60
|
var arbitrum = defineChain(_chains.arbitrum);
|
package/dist/chains.mjs
CHANGED
@@ -2,7 +2,7 @@ import {
|
|
2
2
|
formatTransactionRequest,
|
3
3
|
hexToNumber,
|
4
4
|
numberToHex
|
5
|
-
} from "./chunk-
|
5
|
+
} from "./chunk-NSPSPOUF.mjs";
|
6
6
|
|
7
7
|
// src/actions/test/dropTransaction.ts
|
8
8
|
async function dropTransaction(client, { hash }) {
|
@@ -253,4 +253,4 @@ export {
|
|
253
253
|
snapshot,
|
254
254
|
stopImpersonatingAccount
|
255
255
|
};
|
256
|
-
//# sourceMappingURL=chunk-
|
256
|
+
//# sourceMappingURL=chunk-3E5WSIQU.mjs.map
|
File without changes
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
|
5
5
|
|
6
|
-
var
|
6
|
+
var _chunk6CXRXH25js = require('./chunk-6CXRXH25.js');
|
7
7
|
|
8
8
|
// src/clients/transports/createTransport.ts
|
9
9
|
function createTransport(config, value) {
|
@@ -60,13 +60,13 @@ function http(url, { key = "http", name = "HTTP JSON-RPC" } = {}) {
|
|
60
60
|
return ({ chain }) => {
|
61
61
|
const url_ = url || _optionalChain([chain, 'optionalAccess', _ => _.rpcUrls, 'access', _2 => _2.default, 'access', _3 => _3.http, 'access', _4 => _4[0]]);
|
62
62
|
if (!url_)
|
63
|
-
throw new (0,
|
63
|
+
throw new (0, _chunk6CXRXH25js.UrlRequiredError)();
|
64
64
|
return createTransport(
|
65
65
|
{
|
66
66
|
key,
|
67
67
|
name,
|
68
68
|
async request({ method, params }) {
|
69
|
-
const { result } = await
|
69
|
+
const { result } = await _chunk6CXRXH25js.rpc.http(url_, {
|
70
70
|
body: {
|
71
71
|
method,
|
72
72
|
params
|
@@ -91,14 +91,14 @@ function webSocket(url, {
|
|
91
91
|
return ({ chain }) => {
|
92
92
|
const url_ = url || _optionalChain([chain, 'optionalAccess', _5 => _5.rpcUrls, 'access', _6 => _6.default, 'access', _7 => _7.webSocket, 'optionalAccess', _8 => _8[0]]);
|
93
93
|
if (!url_)
|
94
|
-
throw new (0,
|
94
|
+
throw new (0, _chunk6CXRXH25js.UrlRequiredError)();
|
95
95
|
return createTransport(
|
96
96
|
{
|
97
97
|
key,
|
98
98
|
name,
|
99
99
|
async request({ method, params }) {
|
100
|
-
const socket = await
|
101
|
-
const { result } = await
|
100
|
+
const socket = await _chunk6CXRXH25js.getSocket.call(void 0, url_);
|
101
|
+
const { result } = await _chunk6CXRXH25js.rpc.webSocketAsync(socket, {
|
102
102
|
body: { method, params }
|
103
103
|
});
|
104
104
|
return result;
|
@@ -107,12 +107,12 @@ function webSocket(url, {
|
|
107
107
|
},
|
108
108
|
{
|
109
109
|
getSocket() {
|
110
|
-
return
|
110
|
+
return _chunk6CXRXH25js.getSocket.call(void 0, url_);
|
111
111
|
},
|
112
112
|
async subscribe({ params, onData, onError }) {
|
113
|
-
const socket = await
|
113
|
+
const socket = await _chunk6CXRXH25js.getSocket.call(void 0, url_);
|
114
114
|
const { result: subscriptionId } = await new Promise(
|
115
|
-
(resolve, reject) =>
|
115
|
+
(resolve, reject) => _chunk6CXRXH25js.rpc.webSocket(socket, {
|
116
116
|
body: {
|
117
117
|
method: "eth_subscribe",
|
118
118
|
params
|
@@ -134,7 +134,7 @@ function webSocket(url, {
|
|
134
134
|
subscriptionId,
|
135
135
|
async unsubscribe() {
|
136
136
|
return new Promise(
|
137
|
-
(resolve, reject) =>
|
137
|
+
(resolve, reject) => _chunk6CXRXH25js.rpc.webSocket(socket, {
|
138
138
|
body: {
|
139
139
|
method: "eth_unsubscribe",
|
140
140
|
params: [subscriptionId]
|
@@ -181,7 +181,7 @@ function createClient({
|
|
181
181
|
key,
|
182
182
|
name,
|
183
183
|
pollingInterval,
|
184
|
-
request:
|
184
|
+
request: _chunk6CXRXH25js.buildRequest.call(void 0, config.request),
|
185
185
|
transport: { ...config, ...value },
|
186
186
|
type,
|
187
187
|
uid: uid()
|
@@ -256,4 +256,4 @@ function createWalletClient({
|
|
256
256
|
|
257
257
|
|
258
258
|
exports.createTransport = createTransport; exports.custom = custom; exports.fallback = fallback; exports.http = http; exports.webSocket = webSocket; exports.createClient = createClient; exports.createPublicClient = createPublicClient; exports.createTestClient = createTestClient; exports.createWalletClient = createWalletClient;
|
259
|
-
//# sourceMappingURL=chunk-
|
259
|
+
//# sourceMappingURL=chunk-3EXLRM3B.js.map
|
File without changes
|
@@ -9,7 +9,7 @@ var __publicField = (obj, key, value) => {
|
|
9
9
|
var package_default = {
|
10
10
|
name: "viem",
|
11
11
|
description: "TypeScript Interface for Ethereum",
|
12
|
-
version: "0.0.1-alpha.
|
12
|
+
version: "0.0.1-alpha.18",
|
13
13
|
scripts: {
|
14
14
|
anvil: "source .env && anvil --fork-url $VITE_ANVIL_FORK_URL --fork-block-number $VITE_ANVIL_BLOCK_NUMBER --block-time $VITE_ANVIL_BLOCK_TIME",
|
15
15
|
bench: "vitest bench --no-threads",
|
@@ -2642,4 +2642,4 @@ function parseGwei(ether, unit = "wei") {
|
|
2642
2642
|
|
2643
2643
|
|
2644
2644
|
exports.stringify = stringify; exports.BaseError = BaseError; exports.AbiConstructorNotFoundError = AbiConstructorNotFoundError; exports.AbiConstructorParamsNotFoundError = AbiConstructorParamsNotFoundError; exports.AbiDecodingDataSizeInvalidError = AbiDecodingDataSizeInvalidError; exports.AbiEncodingArrayLengthMismatchError = AbiEncodingArrayLengthMismatchError; exports.AbiEncodingLengthMismatchError = AbiEncodingLengthMismatchError; exports.AbiErrorInputsNotFoundError = AbiErrorInputsNotFoundError; exports.AbiErrorNotFoundError = AbiErrorNotFoundError; exports.AbiErrorSignatureNotFoundError = AbiErrorSignatureNotFoundError; exports.AbiEventNotFoundError = AbiEventNotFoundError; exports.AbiFunctionNotFoundError = AbiFunctionNotFoundError; exports.AbiFunctionOutputsNotFoundError = AbiFunctionOutputsNotFoundError; exports.AbiFunctionSignatureNotFoundError = AbiFunctionSignatureNotFoundError; exports.InvalidAbiEncodingTypeError = InvalidAbiEncodingTypeError; exports.InvalidAbiDecodingTypeError = InvalidAbiDecodingTypeError; exports.InvalidArrayError = InvalidArrayError; exports.InvalidDefinitionTypeError = InvalidDefinitionTypeError; exports.InvalidAddressError = InvalidAddressError; exports.BlockNotFoundError = BlockNotFoundError; exports.SizeExceedsPaddingSizeError = SizeExceedsPaddingSizeError; exports.DataLengthTooLongError = DataLengthTooLongError; exports.DataLengthTooShortError = DataLengthTooShortError; exports.InvalidBytesBooleanError = InvalidBytesBooleanError; exports.InvalidHexBooleanError = InvalidHexBooleanError; exports.InvalidHexValueError = InvalidHexValueError; exports.OffsetOutOfBoundsError = OffsetOutOfBoundsError; exports.FilterTypeNotSupportedError = FilterTypeNotSupportedError; exports.RequestError = RequestError; exports.RpcRequestError = RpcRequestError; exports.ParseRpcError = ParseRpcError; exports.InvalidRequestRpcError = InvalidRequestRpcError; exports.MethodNotFoundRpcError = MethodNotFoundRpcError; exports.InvalidParamsRpcError = InvalidParamsRpcError; exports.InternalRpcError = InternalRpcError; exports.InvalidInputRpcError = InvalidInputRpcError; exports.ResourceNotFoundRpcError = ResourceNotFoundRpcError; exports.ResourceUnavailableRpcError = ResourceUnavailableRpcError; exports.TransactionRejectedRpcError = TransactionRejectedRpcError; exports.MethodNotSupportedRpcError = MethodNotSupportedRpcError; exports.LimitExceededRpcError = LimitExceededRpcError; exports.JsonRpcVersionUnsupportedError = JsonRpcVersionUnsupportedError; exports.UnknownRpcError = UnknownRpcError; exports.isBytes = isBytes; exports.isHex = isHex; exports.pad = pad; exports.padHex = padHex; exports.padBytes = padBytes; exports.trim = trim; exports.size = size; exports.slice = slice; exports.sliceBytes = sliceBytes; exports.sliceHex = sliceHex; exports.boolToHex = boolToHex; exports.bytesToHex = bytesToHex; exports.encodeHex = encodeHex; exports.numberToHex = numberToHex; exports.stringToHex = stringToHex; exports.boolToBytes = boolToBytes; exports.encodeBytes = encodeBytes; exports.hexToBytes = hexToBytes; exports.numberToBytes = numberToBytes; exports.stringToBytes = stringToBytes; exports.encodeRlp = encodeRlp; exports.decodeHex = decodeHex; exports.hexToBigInt = hexToBigInt; exports.hexToBool = hexToBool; exports.hexToNumber = hexToNumber; exports.hexToString = hexToString; exports.decodeBytes = decodeBytes; exports.bytesToBigint = bytesToBigint; exports.bytesToBool = bytesToBool; exports.bytesToNumber = bytesToNumber; exports.bytesToString = bytesToString; exports.decodeRlp = decodeRlp; exports.extractFunctionParts = extractFunctionParts; exports.extractFunctionName = extractFunctionName; exports.extractFunctionParams = extractFunctionParams; exports.extractFunctionType = extractFunctionType; exports.getContractError = getContractError; exports.keccak256 = keccak256; exports.getEventSignature = getEventSignature; exports.getFunctionSignature = getFunctionSignature; exports.checksumAddress = checksumAddress; exports.getAddress = getAddress; exports.getContractAddress = getContractAddress; exports.getCreateAddress = getCreateAddress; exports.getCreate2Address = getCreate2Address; exports.isAddress = isAddress; exports.isAddressEqual = isAddressEqual; exports.encodeAbi = encodeAbi; exports.decodeAbi = decodeAbi; exports.formatAbiItemWithParams = formatAbiItemWithParams; exports.decodeErrorResult = decodeErrorResult; exports.decodeFunctionData = decodeFunctionData; exports.decodeFunctionResult = decodeFunctionResult; exports.encodeDeployData = encodeDeployData; exports.getAbiItem = getAbiItem; exports.encodeErrorResult = encodeErrorResult; exports.encodeEventTopics = encodeEventTopics; exports.encodeFunctionData = encodeFunctionData; exports.encodeFunctionResult = encodeFunctionResult; exports.formatAbiItemWithArgs = formatAbiItemWithArgs; exports.buildRequest = buildRequest; exports.etherUnits = etherUnits; exports.gweiUnits = gweiUnits; exports.weiUnits = weiUnits; exports.transactionType = transactionType; exports.formatTransaction = formatTransaction; exports.formatBlock = formatBlock; exports.extract = extract; exports.formatFeeHistory = formatFeeHistory; exports.format = format3; exports.formatLog = formatLog; exports.formatTransactionReceipt = formatTransactionReceipt; exports.formatTransactionRequest = formatTransactionRequest; exports.getCache = getCache; exports.withCache = withCache; exports.wait = wait; exports.getSocket = getSocket; exports.rpc = rpc; exports.formatUnit = formatUnit; exports.formatEther = formatEther; exports.formatGwei = formatGwei; exports.parseUnit = parseUnit; exports.parseEther = parseEther; exports.parseGwei = parseGwei; exports.HttpRequestError = HttpRequestError; exports.WebSocketRequestError = WebSocketRequestError; exports.RpcError = RpcError; exports.TimeoutError = TimeoutError; exports.InvalidGasArgumentsError = InvalidGasArgumentsError; exports.TransactionNotFoundError = TransactionNotFoundError; exports.TransactionReceiptNotFoundError = TransactionReceiptNotFoundError; exports.WaitForTransactionReceiptTimeoutError = WaitForTransactionReceiptTimeoutError; exports.UrlRequiredError = UrlRequiredError;
|
2645
|
-
//# sourceMappingURL=chunk-
|
2645
|
+
//# sourceMappingURL=chunk-6CXRXH25.js.map
|
File without changes
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
2
2
|
|
3
|
-
var
|
3
|
+
var _chunkBW2LPGYJjs = require('./chunk-BW2LPGYJ.js');
|
4
4
|
|
5
5
|
|
6
6
|
|
@@ -24,7 +24,8 @@ var _chunk4XREGFHDjs = require('./chunk-4XREGFHD.js');
|
|
24
24
|
|
25
25
|
|
26
26
|
|
27
|
-
|
27
|
+
|
28
|
+
var _chunk6CXRXH25js = require('./chunk-6CXRXH25.js');
|
28
29
|
|
29
30
|
// src/actions/public/call.ts
|
30
31
|
async function call(client, {
|
@@ -44,10 +45,10 @@ async function call(client, {
|
|
44
45
|
...rest
|
45
46
|
}) {
|
46
47
|
if (maxFeePerGas !== void 0 && maxPriorityFeePerGas !== void 0 && maxFeePerGas < maxPriorityFeePerGas)
|
47
|
-
throw new (0,
|
48
|
-
const blockNumberHex = blockNumber ?
|
48
|
+
throw new (0, _chunk6CXRXH25js.InvalidGasArgumentsError)();
|
49
|
+
const blockNumberHex = blockNumber ? _chunk6CXRXH25js.numberToHex.call(void 0, blockNumber) : void 0;
|
49
50
|
const formatter = _optionalChain([chain, 'optionalAccess', _ => _.formatters, 'optionalAccess', _2 => _2.transactionRequest]);
|
50
|
-
const request_ =
|
51
|
+
const request_ = _chunk6CXRXH25js.format.call(void 0,
|
51
52
|
{
|
52
53
|
from,
|
53
54
|
accessList,
|
@@ -59,10 +60,10 @@ async function call(client, {
|
|
59
60
|
nonce,
|
60
61
|
to,
|
61
62
|
value,
|
62
|
-
...
|
63
|
+
..._chunk6CXRXH25js.extract.call(void 0, rest, { formatter })
|
63
64
|
},
|
64
65
|
{
|
65
|
-
formatter: formatter ||
|
66
|
+
formatter: formatter || _chunk6CXRXH25js.formatTransactionRequest
|
66
67
|
}
|
67
68
|
);
|
68
69
|
const response = await client.request({
|
@@ -74,15 +75,15 @@ async function call(client, {
|
|
74
75
|
return { data: response };
|
75
76
|
}
|
76
77
|
|
77
|
-
// src/actions/public/
|
78
|
-
async function
|
78
|
+
// src/actions/public/simulateContract.ts
|
79
|
+
async function simulateContract(client, {
|
79
80
|
abi,
|
80
81
|
address,
|
81
82
|
args,
|
82
83
|
functionName,
|
83
84
|
...callRequest
|
84
85
|
}) {
|
85
|
-
const calldata =
|
86
|
+
const calldata = _chunk6CXRXH25js.encodeFunctionData.call(void 0, {
|
86
87
|
abi,
|
87
88
|
args,
|
88
89
|
functionName
|
@@ -93,13 +94,23 @@ async function callContract(client, {
|
|
93
94
|
to: address,
|
94
95
|
...callRequest
|
95
96
|
});
|
96
|
-
|
97
|
+
const result = _chunk6CXRXH25js.decodeFunctionResult.call(void 0, {
|
97
98
|
abi,
|
98
99
|
functionName,
|
99
100
|
data: data || "0x"
|
100
101
|
});
|
102
|
+
return {
|
103
|
+
result,
|
104
|
+
request: {
|
105
|
+
abi,
|
106
|
+
address,
|
107
|
+
args,
|
108
|
+
functionName,
|
109
|
+
...callRequest
|
110
|
+
}
|
111
|
+
};
|
101
112
|
} catch (err) {
|
102
|
-
throw
|
113
|
+
throw _chunk6CXRXH25js.getContractError.call(void 0, err, {
|
103
114
|
abi,
|
104
115
|
address,
|
105
116
|
args,
|
@@ -127,12 +138,12 @@ async function createBlockFilter(client) {
|
|
127
138
|
|
128
139
|
// src/actions/public/deployContract.ts
|
129
140
|
function deployContract(walletClient, { abi, args, bytecode, ...request }) {
|
130
|
-
const calldata =
|
141
|
+
const calldata = _chunk6CXRXH25js.encodeDeployData.call(void 0, {
|
131
142
|
abi,
|
132
143
|
args,
|
133
144
|
bytecode
|
134
145
|
});
|
135
|
-
return
|
146
|
+
return _chunkBW2LPGYJjs.sendTransaction.call(void 0, walletClient, {
|
136
147
|
...request,
|
137
148
|
data: calldata
|
138
149
|
});
|
@@ -151,16 +162,16 @@ async function estimateGas(client, {
|
|
151
162
|
to,
|
152
163
|
value
|
153
164
|
}) {
|
154
|
-
const blockNumberHex = blockNumber ?
|
165
|
+
const blockNumberHex = blockNumber ? _chunk6CXRXH25js.numberToHex.call(void 0, blockNumber) : void 0;
|
155
166
|
const parameters = {
|
156
167
|
data,
|
157
168
|
from,
|
158
|
-
gas: gas ?
|
159
|
-
gasPrice: gasPrice ?
|
160
|
-
maxFeePerGas: maxFeePerGas ?
|
161
|
-
maxPriorityFeePerGas: maxPriorityFeePerGas ?
|
169
|
+
gas: gas ? _chunk6CXRXH25js.numberToHex.call(void 0, gas) : void 0,
|
170
|
+
gasPrice: gasPrice ? _chunk6CXRXH25js.numberToHex.call(void 0, gasPrice) : void 0,
|
171
|
+
maxFeePerGas: maxFeePerGas ? _chunk6CXRXH25js.numberToHex.call(void 0, maxFeePerGas) : void 0,
|
172
|
+
maxPriorityFeePerGas: maxPriorityFeePerGas ? _chunk6CXRXH25js.numberToHex.call(void 0, maxPriorityFeePerGas) : void 0,
|
162
173
|
to,
|
163
|
-
value: value ?
|
174
|
+
value: value ? _chunk6CXRXH25js.numberToHex.call(void 0, value) : void 0
|
164
175
|
};
|
165
176
|
const balance = await client.request({
|
166
177
|
method: "eth_estimateGas",
|
@@ -171,7 +182,7 @@ async function estimateGas(client, {
|
|
171
182
|
|
172
183
|
// src/actions/public/getBalance.ts
|
173
184
|
async function getBalance(client, { address, blockNumber, blockTag = "latest" }) {
|
174
|
-
const blockNumberHex = blockNumber ?
|
185
|
+
const blockNumberHex = blockNumber ? _chunk6CXRXH25js.numberToHex.call(void 0, blockNumber) : void 0;
|
175
186
|
const balance = await client.request({
|
176
187
|
method: "eth_getBalance",
|
177
188
|
params: [address, blockNumberHex || blockTag]
|
@@ -186,7 +197,7 @@ async function getBlock(client, {
|
|
186
197
|
blockTag = "latest",
|
187
198
|
includeTransactions = false
|
188
199
|
} = {}) {
|
189
|
-
const blockNumberHex = blockNumber !== void 0 ?
|
200
|
+
const blockNumberHex = blockNumber !== void 0 ? _chunk6CXRXH25js.numberToHex.call(void 0, blockNumber) : void 0;
|
190
201
|
let block = null;
|
191
202
|
if (blockHash) {
|
192
203
|
block = await client.request({
|
@@ -200,19 +211,19 @@ async function getBlock(client, {
|
|
200
211
|
});
|
201
212
|
}
|
202
213
|
if (!block)
|
203
|
-
throw new (0,
|
204
|
-
return
|
205
|
-
formatter: _optionalChain([client, 'access', _3 => _3.chain, 'optionalAccess', _4 => _4.formatters, 'optionalAccess', _5 => _5.block]) ||
|
214
|
+
throw new (0, _chunk6CXRXH25js.BlockNotFoundError)({ blockHash, blockNumber });
|
215
|
+
return _chunk6CXRXH25js.format.call(void 0, block, {
|
216
|
+
formatter: _optionalChain([client, 'access', _3 => _3.chain, 'optionalAccess', _4 => _4.formatters, 'optionalAccess', _5 => _5.block]) || _chunk6CXRXH25js.formatBlock
|
206
217
|
});
|
207
218
|
}
|
208
219
|
|
209
220
|
// src/actions/public/getBlockNumber.ts
|
210
221
|
var cacheKey = (id) => `blockNumber.${id}`;
|
211
222
|
function getBlockNumberCache(id) {
|
212
|
-
return
|
223
|
+
return _chunk6CXRXH25js.getCache.call(void 0, cacheKey(id));
|
213
224
|
}
|
214
225
|
async function getBlockNumber(client, { maxAge = client.pollingInterval } = {}) {
|
215
|
-
const blockNumberHex = await
|
226
|
+
const blockNumberHex = await _chunk6CXRXH25js.withCache.call(void 0,
|
216
227
|
() => client.request({
|
217
228
|
method: "eth_blockNumber"
|
218
229
|
}),
|
@@ -227,7 +238,7 @@ async function getBlockTransactionCount(client, {
|
|
227
238
|
blockNumber,
|
228
239
|
blockTag = "latest"
|
229
240
|
} = {}) {
|
230
|
-
const blockNumberHex = blockNumber !== void 0 ?
|
241
|
+
const blockNumberHex = blockNumber !== void 0 ? _chunk6CXRXH25js.numberToHex.call(void 0, blockNumber) : void 0;
|
231
242
|
let count = null;
|
232
243
|
if (blockHash) {
|
233
244
|
count = await client.request({
|
@@ -240,12 +251,12 @@ async function getBlockTransactionCount(client, {
|
|
240
251
|
params: [blockNumberHex || blockTag]
|
241
252
|
});
|
242
253
|
}
|
243
|
-
return
|
254
|
+
return _chunk6CXRXH25js.hexToNumber.call(void 0, count);
|
244
255
|
}
|
245
256
|
|
246
257
|
// src/actions/public/getBytecode.ts
|
247
258
|
async function getBytecode(client, { address, blockNumber, blockTag = "latest" }) {
|
248
|
-
const blockNumberHex = blockNumber !== void 0 ?
|
259
|
+
const blockNumberHex = blockNumber !== void 0 ? _chunk6CXRXH25js.numberToHex.call(void 0, blockNumber) : void 0;
|
249
260
|
const hex = await client.request({
|
250
261
|
method: "eth_getCode",
|
251
262
|
params: [address, blockNumberHex || blockTag]
|
@@ -258,7 +269,7 @@ async function getBytecode(client, { address, blockNumber, blockTag = "latest" }
|
|
258
269
|
// src/actions/public/getChainId.ts
|
259
270
|
async function getChainId(client) {
|
260
271
|
const chainIdHex = await client.request({ method: "eth_chainId" });
|
261
|
-
return
|
272
|
+
return _chunk6CXRXH25js.hexToNumber.call(void 0, chainIdHex);
|
262
273
|
}
|
263
274
|
|
264
275
|
// src/actions/public/getFeeHistory.ts
|
@@ -268,16 +279,16 @@ async function getFeeHistory(client, {
|
|
268
279
|
blockTag = "latest",
|
269
280
|
rewardPercentiles
|
270
281
|
}) {
|
271
|
-
const blockNumberHex = blockNumber ?
|
282
|
+
const blockNumberHex = blockNumber ? _chunk6CXRXH25js.numberToHex.call(void 0, blockNumber) : void 0;
|
272
283
|
const feeHistory = await client.request({
|
273
284
|
method: "eth_feeHistory",
|
274
285
|
params: [
|
275
|
-
|
286
|
+
_chunk6CXRXH25js.numberToHex.call(void 0, blockCount),
|
276
287
|
blockNumberHex || blockTag,
|
277
288
|
rewardPercentiles
|
278
289
|
]
|
279
290
|
});
|
280
|
-
return
|
291
|
+
return _chunk6CXRXH25js.formatFeeHistory.call(void 0, feeHistory);
|
281
292
|
}
|
282
293
|
|
283
294
|
// src/actions/public/getFilterChanges.ts
|
@@ -287,7 +298,7 @@ async function getFilterChanges(client, { filter }) {
|
|
287
298
|
params: [filter.id]
|
288
299
|
});
|
289
300
|
return logs.map(
|
290
|
-
(log) => typeof log === "string" ? log :
|
301
|
+
(log) => typeof log === "string" ? log : _chunk6CXRXH25js.formatLog.call(void 0, log)
|
291
302
|
);
|
292
303
|
}
|
293
304
|
|
@@ -297,7 +308,7 @@ async function getFilterLogs(client, { filter }) {
|
|
297
308
|
method: "eth_getFilterLogs",
|
298
309
|
params: [filter.id]
|
299
310
|
});
|
300
|
-
return logs.map(
|
311
|
+
return logs.map(_chunk6CXRXH25js.formatLog);
|
301
312
|
}
|
302
313
|
|
303
314
|
// src/actions/public/getGasPrice.ts
|
@@ -308,6 +319,50 @@ async function getGasPrice(client) {
|
|
308
319
|
return BigInt(gasPrice);
|
309
320
|
}
|
310
321
|
|
322
|
+
// src/actions/public/createEventFilter.ts
|
323
|
+
function buildFilterTopics({
|
324
|
+
event,
|
325
|
+
args: _args
|
326
|
+
}) {
|
327
|
+
const signature = _chunk6CXRXH25js.getEventSignature.call(void 0, event);
|
328
|
+
return [signature];
|
329
|
+
}
|
330
|
+
|
331
|
+
// src/actions/public/getLogs.ts
|
332
|
+
async function getLogs(client, {
|
333
|
+
address,
|
334
|
+
blockHash,
|
335
|
+
fromBlock,
|
336
|
+
toBlock,
|
337
|
+
event,
|
338
|
+
args
|
339
|
+
} = {}) {
|
340
|
+
let topics = [];
|
341
|
+
if (event) {
|
342
|
+
topics = buildFilterTopics({ event, args });
|
343
|
+
}
|
344
|
+
let logs;
|
345
|
+
if (blockHash) {
|
346
|
+
logs = await client.request({
|
347
|
+
method: "eth_getLogs",
|
348
|
+
params: [{ address, topics, blockHash }]
|
349
|
+
});
|
350
|
+
} else {
|
351
|
+
logs = await client.request({
|
352
|
+
method: "eth_getLogs",
|
353
|
+
params: [
|
354
|
+
{
|
355
|
+
address,
|
356
|
+
topics,
|
357
|
+
fromBlock: typeof fromBlock === "bigint" ? _chunk6CXRXH25js.numberToHex.call(void 0, fromBlock) : fromBlock,
|
358
|
+
toBlock: typeof toBlock === "bigint" ? _chunk6CXRXH25js.numberToHex.call(void 0, toBlock) : toBlock
|
359
|
+
}
|
360
|
+
]
|
361
|
+
});
|
362
|
+
}
|
363
|
+
return logs.map(_chunk6CXRXH25js.formatLog);
|
364
|
+
}
|
365
|
+
|
311
366
|
// src/actions/public/getTransaction.ts
|
312
367
|
async function getTransaction(client, {
|
313
368
|
blockHash,
|
@@ -316,7 +371,7 @@ async function getTransaction(client, {
|
|
316
371
|
hash,
|
317
372
|
index
|
318
373
|
}) {
|
319
|
-
const blockNumberHex = blockNumber !== void 0 ?
|
374
|
+
const blockNumberHex = blockNumber !== void 0 ? _chunk6CXRXH25js.numberToHex.call(void 0, blockNumber) : void 0;
|
320
375
|
let transaction = null;
|
321
376
|
if (hash) {
|
322
377
|
transaction = await client.request({
|
@@ -326,24 +381,24 @@ async function getTransaction(client, {
|
|
326
381
|
} else if (blockHash) {
|
327
382
|
transaction = await client.request({
|
328
383
|
method: "eth_getTransactionByBlockHashAndIndex",
|
329
|
-
params: [blockHash,
|
384
|
+
params: [blockHash, _chunk6CXRXH25js.numberToHex.call(void 0, index)]
|
330
385
|
});
|
331
386
|
} else if (blockNumberHex || blockTag) {
|
332
387
|
transaction = await client.request({
|
333
388
|
method: "eth_getTransactionByBlockNumberAndIndex",
|
334
|
-
params: [blockNumberHex || blockTag,
|
389
|
+
params: [blockNumberHex || blockTag, _chunk6CXRXH25js.numberToHex.call(void 0, index)]
|
335
390
|
});
|
336
391
|
}
|
337
392
|
if (!transaction)
|
338
|
-
throw new (0,
|
393
|
+
throw new (0, _chunk6CXRXH25js.TransactionNotFoundError)({
|
339
394
|
blockHash,
|
340
395
|
blockNumber,
|
341
396
|
blockTag,
|
342
397
|
hash,
|
343
398
|
index
|
344
399
|
});
|
345
|
-
return
|
346
|
-
formatter: _optionalChain([client, 'access', _6 => _6.chain, 'optionalAccess', _7 => _7.formatters, 'optionalAccess', _8 => _8.transaction]) ||
|
400
|
+
return _chunk6CXRXH25js.format.call(void 0, transaction, {
|
401
|
+
formatter: _optionalChain([client, 'access', _6 => _6.chain, 'optionalAccess', _7 => _7.formatters, 'optionalAccess', _8 => _8.transaction]) || _chunk6CXRXH25js.formatTransaction
|
347
402
|
});
|
348
403
|
}
|
349
404
|
|
@@ -363,9 +418,9 @@ async function getTransactionConfirmations(client, { hash, transactionReceipt })
|
|
363
418
|
async function getTransactionCount(client, { address, blockTag = "latest", blockNumber }) {
|
364
419
|
const count = await client.request({
|
365
420
|
method: "eth_getTransactionCount",
|
366
|
-
params: [address, blockNumber ?
|
421
|
+
params: [address, blockNumber ? _chunk6CXRXH25js.numberToHex.call(void 0, blockNumber) : blockTag]
|
367
422
|
});
|
368
|
-
return
|
423
|
+
return _chunk6CXRXH25js.hexToNumber.call(void 0, count);
|
369
424
|
}
|
370
425
|
|
371
426
|
// src/actions/public/getTransactionReceipt.ts
|
@@ -375,10 +430,44 @@ async function getTransactionReceipt(client, { hash }) {
|
|
375
430
|
params: [hash]
|
376
431
|
});
|
377
432
|
if (!receipt)
|
378
|
-
throw new (0,
|
379
|
-
return
|
380
|
-
formatter: _optionalChain([client, 'access', _11 => _11.chain, 'optionalAccess', _12 => _12.formatters, 'optionalAccess', _13 => _13.transactionReceipt]) ||
|
433
|
+
throw new (0, _chunk6CXRXH25js.TransactionReceiptNotFoundError)({ hash });
|
434
|
+
return _chunk6CXRXH25js.format.call(void 0, receipt, {
|
435
|
+
formatter: _optionalChain([client, 'access', _11 => _11.chain, 'optionalAccess', _12 => _12.formatters, 'optionalAccess', _13 => _13.transactionReceipt]) || _chunk6CXRXH25js.formatTransactionReceipt
|
436
|
+
});
|
437
|
+
}
|
438
|
+
|
439
|
+
// src/actions/public/readContract.ts
|
440
|
+
async function readContract(client, {
|
441
|
+
abi,
|
442
|
+
address,
|
443
|
+
args,
|
444
|
+
functionName,
|
445
|
+
...callRequest
|
446
|
+
}) {
|
447
|
+
const calldata = _chunk6CXRXH25js.encodeFunctionData.call(void 0, {
|
448
|
+
abi,
|
449
|
+
args,
|
450
|
+
functionName
|
381
451
|
});
|
452
|
+
try {
|
453
|
+
const { data } = await call(client, {
|
454
|
+
data: calldata,
|
455
|
+
to: address,
|
456
|
+
...callRequest
|
457
|
+
});
|
458
|
+
return _chunk6CXRXH25js.decodeFunctionResult.call(void 0, {
|
459
|
+
abi,
|
460
|
+
functionName,
|
461
|
+
data: data || "0x"
|
462
|
+
});
|
463
|
+
} catch (err) {
|
464
|
+
throw _chunk6CXRXH25js.getContractError.call(void 0, err, {
|
465
|
+
abi,
|
466
|
+
address,
|
467
|
+
args,
|
468
|
+
functionName
|
469
|
+
});
|
470
|
+
}
|
382
471
|
}
|
383
472
|
|
384
473
|
// src/actions/public/uninstallFilter.ts
|
@@ -440,12 +529,12 @@ function poll(fn, { emitOnBegin, initialWaitTime, interval }) {
|
|
440
529
|
if (emitOnBegin)
|
441
530
|
data = await fn({ unpoll: unwatch });
|
442
531
|
const initialWait = await _asyncNullishCoalesce(await _optionalChain([initialWaitTime, 'optionalCall', _17 => _17(data)]), async () => ( interval));
|
443
|
-
await
|
532
|
+
await _chunk6CXRXH25js.wait.call(void 0, initialWait);
|
444
533
|
const poll2 = async () => {
|
445
534
|
if (!active)
|
446
535
|
return;
|
447
536
|
await fn({ unpoll: unwatch });
|
448
|
-
await
|
537
|
+
await _chunk6CXRXH25js.wait.call(void 0, interval);
|
449
538
|
poll2();
|
450
539
|
};
|
451
540
|
poll2();
|
@@ -626,7 +715,7 @@ async function waitForTransactionReceipt(client, {
|
|
626
715
|
return new Promise((resolve, reject) => {
|
627
716
|
if (timeout)
|
628
717
|
setTimeout(
|
629
|
-
() => reject(new (0,
|
718
|
+
() => reject(new (0, _chunk6CXRXH25js.WaitForTransactionReceiptTimeoutError)({ hash })),
|
630
719
|
timeout
|
631
720
|
);
|
632
721
|
const unobserve = observe(
|
@@ -656,7 +745,7 @@ async function waitForTransactionReceipt(client, {
|
|
656
745
|
return;
|
657
746
|
done(() => emit.resolve(receipt));
|
658
747
|
} catch (err) {
|
659
|
-
if (transaction && (err instanceof
|
748
|
+
if (transaction && (err instanceof _chunk6CXRXH25js.TransactionNotFoundError || err instanceof _chunk6CXRXH25js.TransactionReceiptNotFoundError)) {
|
660
749
|
replacedTransaction = transaction;
|
661
750
|
const block = await getBlock(client, {
|
662
751
|
blockNumber,
|
@@ -726,5 +815,7 @@ async function waitForTransactionReceipt(client, {
|
|
726
815
|
|
727
816
|
|
728
817
|
|
729
|
-
|
730
|
-
|
818
|
+
|
819
|
+
|
820
|
+
exports.call = call; exports.simulateContract = simulateContract; exports.createPendingTransactionFilter = createPendingTransactionFilter; exports.createBlockFilter = createBlockFilter; exports.deployContract = deployContract; exports.estimateGas = estimateGas; exports.getBalance = getBalance; exports.getBlock = getBlock; exports.getBlockNumberCache = getBlockNumberCache; exports.getBlockNumber = getBlockNumber; exports.getBlockTransactionCount = getBlockTransactionCount; exports.getBytecode = getBytecode; exports.getChainId = getChainId; exports.getFeeHistory = getFeeHistory; exports.getFilterChanges = getFilterChanges; exports.getFilterLogs = getFilterLogs; exports.getGasPrice = getGasPrice; exports.getLogs = getLogs; exports.getTransaction = getTransaction; exports.getTransactionConfirmations = getTransactionConfirmations; exports.getTransactionCount = getTransactionCount; exports.getTransactionReceipt = getTransactionReceipt; exports.readContract = readContract; exports.uninstallFilter = uninstallFilter; exports.waitForTransactionReceipt = waitForTransactionReceipt; exports.watchBlockNumber = watchBlockNumber; exports.watchBlocks = watchBlocks; exports.watchPendingTransactions = watchPendingTransactions;
|
821
|
+
//# sourceMappingURL=chunk-A4HJ47I6.js.map
|