viem 2.14.0 → 2.14.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/CHANGELOG.md +14 -0
- package/_cjs/actions/index.js +5 -4
- package/_cjs/actions/index.js.map +1 -1
- package/_cjs/actions/public/call.js +33 -12
- package/_cjs/actions/public/call.js.map +1 -1
- package/_cjs/actions/public/{getBytecode.js → getCode.js} +4 -4
- package/_cjs/actions/public/getCode.js.map +1 -0
- package/_cjs/actions/public/readContract.js.map +1 -1
- package/_cjs/actions/public/simulateContract.js.map +1 -1
- package/_cjs/actions/wallet/writeContract.js.map +1 -1
- package/_cjs/chains/definitions/mode.js +15 -0
- package/_cjs/chains/definitions/mode.js.map +1 -1
- package/_cjs/clients/decorators/public.js +3 -2
- package/_cjs/clients/decorators/public.js.map +1 -1
- package/_cjs/constants/contracts.js +3 -2
- package/_cjs/constants/contracts.js.map +1 -1
- package/_cjs/errors/contract.js +1 -1
- package/_cjs/errors/contract.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/index.js.map +1 -1
- package/_esm/actions/index.js +3 -1
- package/_esm/actions/index.js.map +1 -1
- package/_esm/actions/public/call.js +36 -17
- package/_esm/actions/public/call.js.map +1 -1
- package/_esm/actions/public/{getBytecode.js → getCode.js} +7 -7
- package/_esm/actions/public/getCode.js.map +1 -0
- package/_esm/actions/public/readContract.js.map +1 -1
- package/_esm/actions/public/simulateContract.js.map +1 -1
- package/_esm/actions/wallet/writeContract.js.map +1 -1
- package/_esm/chains/definitions/mode.js +15 -0
- package/_esm/chains/definitions/mode.js.map +1 -1
- package/_esm/clients/decorators/public.js +3 -2
- package/_esm/clients/decorators/public.js.map +1 -1
- package/_esm/constants/contracts.js +2 -1
- package/_esm/constants/contracts.js.map +1 -1
- package/_esm/errors/contract.js +1 -1
- package/_esm/errors/contract.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/index.js.map +1 -1
- package/_types/actions/index.d.ts +9 -1
- package/_types/actions/index.d.ts.map +1 -1
- package/_types/actions/public/call.d.ts +8 -2
- package/_types/actions/public/call.d.ts.map +1 -1
- package/_types/actions/public/{getBytecode.d.ts → getCode.d.ts} +10 -10
- package/_types/actions/public/getCode.d.ts.map +1 -0
- package/_types/actions/public/readContract.d.ts +1 -1
- package/_types/actions/public/readContract.d.ts.map +1 -1
- package/_types/actions/public/simulateContract.d.ts +1 -1
- package/_types/actions/public/simulateContract.d.ts.map +1 -1
- package/_types/actions/wallet/writeContract.d.ts +1 -1
- package/_types/actions/wallet/writeContract.d.ts.map +1 -1
- package/_types/chains/definitions/mode.d.ts +15 -0
- package/_types/chains/definitions/mode.d.ts.map +1 -1
- package/_types/clients/decorators/public.d.ts +19 -17
- package/_types/clients/decorators/public.d.ts.map +1 -1
- package/_types/constants/contracts.d.ts +2 -1
- package/_types/constants/contracts.d.ts.map +1 -1
- package/_types/errors/contract.d.ts +1 -1
- package/_types/errors/contract.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/index.d.ts +8 -2
- package/_types/index.d.ts.map +1 -1
- package/_types/types/contract.d.ts +6 -2
- package/_types/types/contract.d.ts.map +1 -1
- package/actions/index.ts +14 -6
- package/actions/public/call.ts +61 -18
- package/actions/public/{getBytecode.ts → getCode.ts} +11 -11
- package/actions/public/readContract.ts +2 -2
- package/actions/public/simulateContract.ts +8 -1
- package/actions/wallet/writeContract.ts +1 -0
- package/chains/definitions/mode.ts +15 -0
- package/clients/decorators/public.ts +25 -22
- package/constants/contracts.ts +4 -1
- package/errors/contract.ts +4 -2
- package/errors/version.ts +1 -1
- package/index.ts +12 -4
- package/package.json +1 -1
- package/types/contract.ts +5 -2
- package/_cjs/actions/public/getBytecode.js.map +0 -1
- package/_esm/actions/public/getBytecode.js.map +0 -1
- package/_types/actions/public/getBytecode.d.ts.map +0 -1
package/actions/public/call.ts
CHANGED
@@ -9,7 +9,10 @@ import type { Client } from '../../clients/createClient.js'
|
|
9
9
|
import type { Transport } from '../../clients/transports/createTransport.js'
|
10
10
|
import { multicall3Abi } from '../../constants/abis.js'
|
11
11
|
import { aggregate3Signature } from '../../constants/contract.js'
|
12
|
-
import {
|
12
|
+
import {
|
13
|
+
deploylessCallViaBytecodeBytecode,
|
14
|
+
deploylessCallViaFactoryBytecode,
|
15
|
+
} from '../../constants/contracts.js'
|
13
16
|
import { BaseError } from '../../errors/base.js'
|
14
17
|
import {
|
15
18
|
ChainDoesNotSupportContract,
|
@@ -76,12 +79,17 @@ import type {
|
|
76
79
|
export type CallParameters<
|
77
80
|
TChain extends Chain | undefined = Chain | undefined,
|
78
81
|
> = UnionOmit<FormattedCall<TChain>, 'from'> & {
|
82
|
+
/** Account attached to the call (msg.sender). */
|
79
83
|
account?: Account | Address | undefined
|
84
|
+
/** Whether or not to enable multicall batching on this call. */
|
80
85
|
batch?: boolean | undefined
|
86
|
+
/** Bytecode to perform the call on. */
|
87
|
+
code?: Hex | undefined
|
81
88
|
/** Contract deployment factory address (ie. Create2 factory, Smart Account factory, etc). */
|
82
89
|
factory?: Address | undefined
|
83
90
|
/** Calldata to execute on the factory to deploy the contract. */
|
84
91
|
factoryData?: Hex | undefined
|
92
|
+
/** State overrides for the call. */
|
85
93
|
stateOverride?: StateOverride | undefined
|
86
94
|
} & (
|
87
95
|
| {
|
@@ -111,7 +119,8 @@ export type CallErrorType = GetCallErrorReturnType<
|
|
111
119
|
| FormatTransactionRequestErrorType
|
112
120
|
| ScheduleMulticallErrorType
|
113
121
|
| RequestErrorType
|
114
|
-
|
|
122
|
+
| ToDeploylessCallViaBytecodeDataErrorType
|
123
|
+
| ToDeploylessCallViaFactoryDataErrorType
|
115
124
|
>
|
116
125
|
|
117
126
|
/**
|
@@ -150,6 +159,7 @@ export async function call<TChain extends Chain | undefined>(
|
|
150
159
|
blockTag = 'latest',
|
151
160
|
accessList,
|
152
161
|
blobs,
|
162
|
+
code,
|
153
163
|
data: data_,
|
154
164
|
factory,
|
155
165
|
factoryData,
|
@@ -166,14 +176,32 @@ export async function call<TChain extends Chain | undefined>(
|
|
166
176
|
} = args
|
167
177
|
const account = account_ ? parseAccount(account_) : undefined
|
168
178
|
|
169
|
-
|
170
|
-
|
179
|
+
if (code && (factory || factoryData))
|
180
|
+
throw new BaseError(
|
181
|
+
'Cannot provide both `code` & `factory`/`factoryData` as parameters.',
|
182
|
+
)
|
183
|
+
if (code && to)
|
184
|
+
throw new BaseError('Cannot provide both `code` & `to` as parameters.')
|
185
|
+
|
186
|
+
// Check if the call is deployless via bytecode.
|
187
|
+
const deploylessCallViaBytecode = code && data_
|
188
|
+
// Check if the call is deployless via a factory.
|
189
|
+
const deploylessCallViaFactory = factory && factoryData && to && data_
|
190
|
+
const deploylessCall = deploylessCallViaBytecode || deploylessCallViaFactory
|
191
|
+
|
171
192
|
const data = (() => {
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
193
|
+
if (deploylessCallViaBytecode)
|
194
|
+
return toDeploylessCallViaBytecodeData({
|
195
|
+
code,
|
196
|
+
data: data_,
|
197
|
+
})
|
198
|
+
if (deploylessCallViaFactory)
|
199
|
+
return toDeploylessCallViaFactoryData({
|
200
|
+
data: data_,
|
201
|
+
factory,
|
202
|
+
factoryData,
|
203
|
+
to,
|
204
|
+
})
|
177
205
|
return data_
|
178
206
|
})()
|
179
207
|
|
@@ -201,7 +229,7 @@ export async function call<TChain extends Chain | undefined>(
|
|
201
229
|
maxFeePerGas,
|
202
230
|
maxPriorityFeePerGas,
|
203
231
|
nonce,
|
204
|
-
to:
|
232
|
+
to: deploylessCall ? undefined : to,
|
205
233
|
value,
|
206
234
|
} as TransactionRequest) as TransactionRequest
|
207
235
|
|
@@ -248,7 +276,7 @@ export async function call<TChain extends Chain | undefined>(
|
|
248
276
|
return { data: await offchainLookup(client, { data, to }) }
|
249
277
|
|
250
278
|
// Check for counterfactual deployment error.
|
251
|
-
if (
|
279
|
+
if (deploylessCall && data?.slice(0, 10) === '0x101bb98d')
|
252
280
|
throw new CounterfactualDeploymentFailedError({ factory })
|
253
281
|
|
254
282
|
throw getCallError(err as ErrorType, {
|
@@ -374,9 +402,27 @@ async function scheduleMulticall<TChain extends Chain | undefined>(
|
|
374
402
|
return { data: returnData }
|
375
403
|
}
|
376
404
|
|
377
|
-
type
|
405
|
+
type ToDeploylessCallViaBytecodeDataErrorType =
|
406
|
+
| EncodeDeployDataErrorType
|
407
|
+
| ErrorType
|
408
|
+
|
409
|
+
function toDeploylessCallViaBytecodeData(parameters: {
|
410
|
+
code: Hex
|
411
|
+
data: Hex
|
412
|
+
}) {
|
413
|
+
const { code, data } = parameters
|
414
|
+
return encodeDeployData({
|
415
|
+
abi: parseAbi(['constructor(bytes, bytes)']),
|
416
|
+
bytecode: deploylessCallViaBytecodeBytecode,
|
417
|
+
args: [code, data],
|
418
|
+
})
|
419
|
+
}
|
420
|
+
|
421
|
+
type ToDeploylessCallViaFactoryDataErrorType =
|
422
|
+
| EncodeDeployDataErrorType
|
423
|
+
| ErrorType
|
378
424
|
|
379
|
-
function
|
425
|
+
function toDeploylessCallViaFactoryData(parameters: {
|
380
426
|
data: Hex
|
381
427
|
factory: Address
|
382
428
|
factoryData: Hex
|
@@ -384,11 +430,8 @@ function toCounterfactualData(parameters: {
|
|
384
430
|
}) {
|
385
431
|
const { data, factory, factoryData, to } = parameters
|
386
432
|
return encodeDeployData({
|
387
|
-
abi: parseAbi([
|
388
|
-
|
389
|
-
'constructor(address, bytes, address, bytes)',
|
390
|
-
]),
|
391
|
-
bytecode: counterfactualContractCallByteCode,
|
433
|
+
abi: parseAbi(['constructor(address, bytes, address, bytes)']),
|
434
|
+
bytecode: deploylessCallViaFactoryBytecode,
|
392
435
|
args: [to, data, factory, factoryData],
|
393
436
|
})
|
394
437
|
}
|
@@ -12,7 +12,7 @@ import {
|
|
12
12
|
numberToHex,
|
13
13
|
} from '../../utils/encoding/toHex.js'
|
14
14
|
|
15
|
-
export type
|
15
|
+
export type GetCodeParameters = {
|
16
16
|
address: Address
|
17
17
|
} & (
|
18
18
|
| {
|
@@ -25,9 +25,9 @@ export type GetBytecodeParameters = {
|
|
25
25
|
}
|
26
26
|
)
|
27
27
|
|
28
|
-
export type
|
28
|
+
export type GetCodeReturnType = Hex | undefined
|
29
29
|
|
30
|
-
export type
|
30
|
+
export type GetCodeErrorType =
|
31
31
|
| NumberToHexErrorType
|
32
32
|
| RequestErrorType
|
33
33
|
| ErrorType
|
@@ -35,30 +35,30 @@ export type GetBytecodeErrorType =
|
|
35
35
|
/**
|
36
36
|
* Retrieves the bytecode at an address.
|
37
37
|
*
|
38
|
-
* - Docs: https://viem.sh/docs/contract/
|
38
|
+
* - Docs: https://viem.sh/docs/contract/getCode
|
39
39
|
* - JSON-RPC Methods: [`eth_getCode`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getcode)
|
40
40
|
*
|
41
41
|
* @param client - Client to use
|
42
|
-
* @param parameters - {@link
|
43
|
-
* @returns The contract's bytecode. {@link
|
42
|
+
* @param parameters - {@link GetCodeParameters}
|
43
|
+
* @returns The contract's bytecode. {@link GetCodeReturnType}
|
44
44
|
*
|
45
45
|
* @example
|
46
46
|
* import { createPublicClient, http } from 'viem'
|
47
47
|
* import { mainnet } from 'viem/chains'
|
48
|
-
* import {
|
48
|
+
* import { getCode } from 'viem/contract'
|
49
49
|
*
|
50
50
|
* const client = createPublicClient({
|
51
51
|
* chain: mainnet,
|
52
52
|
* transport: http(),
|
53
53
|
* })
|
54
|
-
* const code = await
|
54
|
+
* const code = await getCode(client, {
|
55
55
|
* address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
|
56
56
|
* })
|
57
57
|
*/
|
58
|
-
export async function
|
58
|
+
export async function getCode<TChain extends Chain | undefined>(
|
59
59
|
client: Client<Transport, TChain>,
|
60
|
-
{ address, blockNumber, blockTag = 'latest' }:
|
61
|
-
): Promise<
|
60
|
+
{ address, blockNumber, blockTag = 'latest' }: GetCodeParameters,
|
61
|
+
): Promise<GetCodeReturnType> {
|
62
62
|
const blockNumberHex =
|
63
63
|
blockNumber !== undefined ? numberToHex(blockNumber) : undefined
|
64
64
|
const hex = await client.request({
|
@@ -50,7 +50,7 @@ export type ReadContractParameters<
|
|
50
50
|
| 'stateOverride'
|
51
51
|
>
|
52
52
|
> &
|
53
|
-
ContractFunctionParameters<abi, 'pure' | 'view', functionName, args>
|
53
|
+
ContractFunctionParameters<abi, 'pure' | 'view', functionName, args, boolean>
|
54
54
|
|
55
55
|
export type ReadContractReturnType<
|
56
56
|
abi extends Abi | readonly unknown[] = Abi,
|
@@ -124,7 +124,7 @@ export async function readContract<
|
|
124
124
|
)({
|
125
125
|
...(rest as CallParameters),
|
126
126
|
data: calldata,
|
127
|
-
to: address
|
127
|
+
to: address!,
|
128
128
|
})
|
129
129
|
return decodeFunctionResult({
|
130
130
|
abi,
|
@@ -66,7 +66,14 @@ export type SimulateContractParameters<
|
|
66
66
|
> &
|
67
67
|
UnionOmit<
|
68
68
|
CallParameters<derivedChain>,
|
69
|
-
|
69
|
+
| 'account'
|
70
|
+
| 'batch'
|
71
|
+
| 'code'
|
72
|
+
| 'to'
|
73
|
+
| 'data'
|
74
|
+
| 'factory'
|
75
|
+
| 'factoryData'
|
76
|
+
| 'value'
|
70
77
|
> &
|
71
78
|
GetValue<
|
72
79
|
abi,
|
@@ -22,6 +22,21 @@ export const mode = /*#__PURE__*/ defineChain({
|
|
22
22
|
address: '0xca11bde05977b3631167028862be2a173976ca11',
|
23
23
|
blockCreated: 2465882,
|
24
24
|
},
|
25
|
+
l2OutputOracle: {
|
26
|
+
[sourceId]: {
|
27
|
+
address: '0x4317ba146D4933D889518a3e5E11Fe7a53199b04',
|
28
|
+
},
|
29
|
+
},
|
30
|
+
portal: {
|
31
|
+
[sourceId]: {
|
32
|
+
address: '0x8B34b14c7c7123459Cf3076b8Cb929BE097d0C07',
|
33
|
+
},
|
34
|
+
},
|
35
|
+
l1StandardBridge: {
|
36
|
+
[sourceId]: {
|
37
|
+
address: '0x735aDBbE72226BD52e818E7181953f42E3b0FF21',
|
38
|
+
},
|
39
|
+
},
|
25
40
|
},
|
26
41
|
sourceId,
|
27
42
|
})
|
@@ -92,15 +92,15 @@ import {
|
|
92
92
|
type GetBlockTransactionCountReturnType,
|
93
93
|
getBlockTransactionCount,
|
94
94
|
} from '../../actions/public/getBlockTransactionCount.js'
|
95
|
-
import {
|
96
|
-
type GetBytecodeParameters,
|
97
|
-
type GetBytecodeReturnType,
|
98
|
-
getBytecode,
|
99
|
-
} from '../../actions/public/getBytecode.js'
|
100
95
|
import {
|
101
96
|
type GetChainIdReturnType,
|
102
97
|
getChainId,
|
103
98
|
} from '../../actions/public/getChainId.js'
|
99
|
+
import {
|
100
|
+
type GetCodeParameters,
|
101
|
+
type GetCodeReturnType,
|
102
|
+
getCode,
|
103
|
+
} from '../../actions/public/getCode.js'
|
104
104
|
import {
|
105
105
|
type GetContractEventsParameters,
|
106
106
|
type GetContractEventsReturnType,
|
@@ -624,14 +624,15 @@ export type PublicActions<
|
|
624
624
|
getBlockTransactionCount: (
|
625
625
|
args?: GetBlockTransactionCountParameters | undefined,
|
626
626
|
) => Promise<GetBlockTransactionCountReturnType>
|
627
|
+
/** @deprecated Use `getCode` instead. */
|
628
|
+
getBytecode: (args: GetCodeParameters) => Promise<GetCodeReturnType>
|
627
629
|
/**
|
628
|
-
*
|
630
|
+
* Returns the chain ID associated with the current network.
|
629
631
|
*
|
630
|
-
* - Docs: https://viem.sh/docs/
|
631
|
-
* - JSON-RPC Methods: [`
|
632
|
+
* - Docs: https://viem.sh/docs/actions/public/getChainId
|
633
|
+
* - JSON-RPC Methods: [`eth_chainId`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_chainid)
|
632
634
|
*
|
633
|
-
* @
|
634
|
-
* @returns The contract's bytecode. {@link GetBytecodeReturnType}
|
635
|
+
* @returns The current chain ID. {@link GetChainIdReturnType}
|
635
636
|
*
|
636
637
|
* @example
|
637
638
|
* import { createPublicClient, http } from 'viem'
|
@@ -641,18 +642,18 @@ export type PublicActions<
|
|
641
642
|
* chain: mainnet,
|
642
643
|
* transport: http(),
|
643
644
|
* })
|
644
|
-
* const
|
645
|
-
*
|
646
|
-
* })
|
645
|
+
* const chainId = await client.getChainId()
|
646
|
+
* // 1
|
647
647
|
*/
|
648
|
-
|
648
|
+
getChainId: () => Promise<GetChainIdReturnType>
|
649
649
|
/**
|
650
|
-
*
|
650
|
+
* Retrieves the bytecode at an address.
|
651
651
|
*
|
652
|
-
* - Docs: https://viem.sh/docs/
|
653
|
-
* - JSON-RPC Methods: [`
|
652
|
+
* - Docs: https://viem.sh/docs/contract/getCode
|
653
|
+
* - JSON-RPC Methods: [`eth_getCode`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getcode)
|
654
654
|
*
|
655
|
-
* @
|
655
|
+
* @param args - {@link GetBytecodeParameters}
|
656
|
+
* @returns The contract's bytecode. {@link GetBytecodeReturnType}
|
656
657
|
*
|
657
658
|
* @example
|
658
659
|
* import { createPublicClient, http } from 'viem'
|
@@ -662,10 +663,11 @@ export type PublicActions<
|
|
662
663
|
* chain: mainnet,
|
663
664
|
* transport: http(),
|
664
665
|
* })
|
665
|
-
* const
|
666
|
-
*
|
666
|
+
* const code = await client.getCode({
|
667
|
+
* address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
|
668
|
+
* })
|
667
669
|
*/
|
668
|
-
|
670
|
+
getCode: (args: GetCodeParameters) => Promise<GetCodeReturnType>
|
669
671
|
/**
|
670
672
|
* Returns a list of event logs emitted by a contract.
|
671
673
|
*
|
@@ -1853,8 +1855,9 @@ export function publicActions<
|
|
1853
1855
|
getBlock: (args) => getBlock(client, args),
|
1854
1856
|
getBlockNumber: (args) => getBlockNumber(client, args),
|
1855
1857
|
getBlockTransactionCount: (args) => getBlockTransactionCount(client, args),
|
1856
|
-
getBytecode: (args) =>
|
1858
|
+
getBytecode: (args) => getCode(client, args),
|
1857
1859
|
getChainId: () => getChainId(client),
|
1860
|
+
getCode: (args) => getCode(client, args),
|
1858
1861
|
getContractEvents: (args) => getContractEvents(client, args),
|
1859
1862
|
getEip712Domain: (args) => getEip712Domain(client, args),
|
1860
1863
|
getEnsAddress: (args) => getEnsAddress(client, args),
|
package/constants/contracts.ts
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
export const
|
1
|
+
export const deploylessCallViaBytecodeBytecode =
|
2
|
+
'0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe'
|
3
|
+
|
4
|
+
export const deploylessCallViaFactoryBytecode =
|
2
5
|
'0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe'
|
3
6
|
|
4
7
|
export const universalSignatureValidatorByteCode =
|
package/errors/contract.ts
CHANGED
@@ -284,9 +284,11 @@ export type CounterfactualDeploymentFailedErrorType =
|
|
284
284
|
}
|
285
285
|
export class CounterfactualDeploymentFailedError extends BaseError {
|
286
286
|
override name = 'CounterfactualDeploymentFailedError'
|
287
|
-
constructor({ factory }: { factory
|
287
|
+
constructor({ factory }: { factory?: Address | undefined }) {
|
288
288
|
super(
|
289
|
-
`Deployment for counterfactual contract call failed
|
289
|
+
`Deployment for counterfactual contract call failed${
|
290
|
+
factory ? ` for factory "${factory}".` : ''
|
291
|
+
}`,
|
290
292
|
{
|
291
293
|
metaMessages: [
|
292
294
|
'Please ensure:',
|
package/errors/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = '2.14.
|
1
|
+
export const version = '2.14.2'
|
package/index.ts
CHANGED
@@ -146,10 +146,16 @@ export type {
|
|
146
146
|
GetBlockTransactionCountReturnType,
|
147
147
|
} from './actions/public/getBlockTransactionCount.js'
|
148
148
|
export type {
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
149
|
+
/** @deprecated Use `GetCodeErrorType` instead */
|
150
|
+
GetCodeErrorType as GetBytecodeErrorType,
|
151
|
+
/** @deprecated Use `GetCodeParameters` instead */
|
152
|
+
GetCodeParameters as GetBytecodeParameters,
|
153
|
+
/** @deprecated Use `GetCodeReturnType` instead */
|
154
|
+
GetCodeReturnType as GetBytecodeReturnType,
|
155
|
+
GetCodeErrorType,
|
156
|
+
GetCodeParameters,
|
157
|
+
GetCodeReturnType,
|
158
|
+
} from './actions/public/getCode.js'
|
153
159
|
export type {
|
154
160
|
GetChainIdErrorType,
|
155
161
|
GetChainIdReturnType,
|
@@ -923,6 +929,8 @@ export type {
|
|
923
929
|
LogTopicType,
|
924
930
|
MaybeAbiEventName,
|
925
931
|
MaybeExtractEventArgsFromAbi,
|
932
|
+
UnionWiden,
|
933
|
+
Widen,
|
926
934
|
} from './types/contract.js'
|
927
935
|
export type {
|
928
936
|
AccessList,
|
package/package.json
CHANGED
package/types/contract.ts
CHANGED
@@ -197,19 +197,22 @@ export type ContractFunctionParameters<
|
|
197
197
|
mutability,
|
198
198
|
functionName
|
199
199
|
> = ContractFunctionArgs<abi, mutability, functionName>,
|
200
|
+
deployless extends boolean = false,
|
200
201
|
///
|
201
202
|
allFunctionNames = ContractFunctionName<abi, mutability>,
|
202
203
|
allArgs = ContractFunctionArgs<abi, mutability, functionName>,
|
203
204
|
// when `args` is inferred to `readonly []` ("inputs": []) or `never` (`abi` declared as `Abi` or not inferrable), allow `args` to be optional.
|
204
205
|
// important that both branches return same structural type
|
205
206
|
> = {
|
206
|
-
address: Address
|
207
207
|
abi: abi
|
208
208
|
functionName:
|
209
209
|
| allFunctionNames // show all options
|
210
210
|
| (functionName extends allFunctionNames ? functionName : never) // infer value
|
211
211
|
args?: (abi extends Abi ? UnionWiden<args> : never) | allArgs | undefined
|
212
|
-
} & (readonly [] extends allArgs ? {} : { args: Widen<args> })
|
212
|
+
} & (readonly [] extends allArgs ? {} : { args: Widen<args> }) &
|
213
|
+
(deployless extends true
|
214
|
+
? { address?: undefined; code: Hex }
|
215
|
+
: { address: Address })
|
213
216
|
|
214
217
|
export type ContractFunctionReturnType<
|
215
218
|
abi extends Abi | readonly unknown[] = Abi,
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"getBytecode.js","sourceRoot":"","sources":["../../../actions/public/getBytecode.ts"],"names":[],"mappings":";;;AASA,4DAGsC;AA6C/B,KAAK,UAAU,WAAW,CAC/B,MAAiC,EACjC,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,GAAG,QAAQ,EAAyB;IAEpE,MAAM,cAAc,GAClB,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,IAAA,sBAAW,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAClE,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QAC/B,MAAM,EAAE,aAAa;QACrB,MAAM,EAAE,CAAC,OAAO,EAAE,cAAc,IAAI,QAAQ,CAAC;KAC9C,CAAC,CAAA;IACF,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,SAAS,CAAA;IAClC,OAAO,GAAG,CAAA;AACZ,CAAC;AAZD,kCAYC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"getBytecode.js","sourceRoot":"","sources":["../../../actions/public/getBytecode.ts"],"names":[],"mappings":"AASA,OAAO,EAEL,WAAW,GACZ,MAAM,+BAA+B,CAAA;AAsBtC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAAiC,EACjC,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,GAAG,QAAQ,EAAyB;IAEpE,MAAM,cAAc,GAClB,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAClE,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QAC/B,MAAM,EAAE,aAAa;QACrB,MAAM,EAAE,CAAC,OAAO,EAAE,cAAc,IAAI,QAAQ,CAAC;KAC9C,CAAC,CAAA;IACF,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,SAAS,CAAA;IAClC,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"getBytecode.d.ts","sourceRoot":"","sources":["../../../actions/public/getBytecode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAC5E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,+BAA+B,CAAA;AAEtC,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,OAAO,CAAA;CACjB,GAAG,CACA;IACE,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;CAChC,GACD;IACE,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,CACJ,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG,GAAG,GAAG,SAAS,CAAA;AAEnD,MAAM,MAAM,oBAAoB,GAC5B,oBAAoB,GACpB,gBAAgB,GAChB,SAAS,CAAA;AAEb;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,WAAW,CAAC,MAAM,SAAS,KAAK,GAAG,SAAS,EAChE,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,EACjC,EAAE,OAAO,EAAE,WAAW,EAAE,QAAmB,EAAE,EAAE,qBAAqB,GACnE,OAAO,CAAC,qBAAqB,CAAC,CAShC"}
|