viem 1.19.8 → 1.19.10
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 +425 -405
- package/README.md +46 -46
- package/_cjs/accounts/utils/signTransaction.js.map +1 -1
- package/_cjs/actions/public/createContractEventFilter.js.map +1 -1
- package/_cjs/actions/public/estimateMaxPriorityFeePerGas.js +1 -1
- package/_cjs/actions/public/estimateMaxPriorityFeePerGas.js.map +1 -1
- package/_cjs/chains/celo/serializers.js +3 -7
- package/_cjs/chains/celo/serializers.js.map +1 -1
- package/_cjs/chains/definitions/confluxESpace.js +2 -0
- package/_cjs/chains/definitions/confluxESpace.js.map +1 -1
- package/_cjs/chains/definitions/confluxESpaceTestnet.js +34 -0
- package/_cjs/chains/definitions/confluxESpaceTestnet.js.map +1 -0
- package/_cjs/chains/definitions/filecoin.js +6 -0
- package/_cjs/chains/definitions/filecoin.js.map +1 -1
- package/_cjs/chains/definitions/pgn.js +38 -0
- package/_cjs/chains/definitions/pgn.js.map +1 -0
- package/_cjs/chains/definitions/pgnTestnet.js +39 -0
- package/_cjs/chains/definitions/pgnTestnet.js.map +1 -0
- package/_cjs/chains/definitions/sapphire.js +33 -0
- package/_cjs/chains/definitions/sapphire.js.map +1 -0
- package/_cjs/chains/definitions/sapphireTestnet.js +28 -0
- package/_cjs/chains/definitions/sapphireTestnet.js.map +1 -0
- package/_cjs/chains/index.js +14 -4
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/errors/base.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/errors/version.js.map +1 -1
- package/_cjs/utils/abi/encodeEventTopics.js.map +1 -1
- package/_cjs/utils/ccip.js +3 -1
- package/_cjs/utils/ccip.js.map +1 -1
- package/_cjs/utils/encoding/toBytes.js +2 -2
- package/_cjs/utils/encoding/toBytes.js.map +1 -1
- package/_cjs/utils/ens/avatar/utils.js +1 -1
- package/_cjs/utils/ens/avatar/utils.js.map +1 -1
- package/_cjs/utils/errors/getContractError.js.map +1 -1
- package/_cjs/utils/errors/getNodeError.js +11 -11
- package/_cjs/utils/errors/getNodeError.js.map +1 -1
- package/_cjs/utils/transaction/getTransactionType.js.map +1 -1
- package/_cjs/utils/transaction/serializeTransaction.js.map +1 -1
- package/_esm/accounts/utils/signTransaction.js.map +1 -1
- package/_esm/actions/ens/getEnsAddress.js +2 -2
- package/_esm/actions/ens/getEnsAvatar.js +2 -2
- package/_esm/actions/ens/getEnsName.js +2 -2
- package/_esm/actions/ens/getEnsResolver.js +2 -2
- package/_esm/actions/ens/getEnsText.js +2 -2
- package/_esm/actions/public/createContractEventFilter.js.map +1 -1
- package/_esm/actions/public/estimateMaxPriorityFeePerGas.js +1 -1
- package/_esm/actions/public/estimateMaxPriorityFeePerGas.js.map +1 -1
- package/_esm/actions/public/getBlock.js +1 -1
- package/_esm/actions/public/getBlockNumber.js +1 -1
- package/_esm/actions/public/getLogs.js +1 -1
- package/_esm/actions/public/getTransaction.js +1 -1
- package/_esm/actions/public/getTransactionConfirmations.js +1 -1
- package/_esm/actions/public/getTransactionReceipt.js +1 -1
- package/_esm/actions/public/readContract.js +1 -1
- package/_esm/actions/public/simulateContract.js +1 -1
- package/_esm/actions/public/waitForTransactionReceipt.js +1 -1
- package/_esm/actions/public/watchBlockNumber.js +1 -1
- package/_esm/actions/public/watchBlocks.js +1 -1
- package/_esm/actions/wallet/deployContract.js +1 -1
- package/_esm/actions/wallet/sendTransaction.js +1 -1
- package/_esm/actions/wallet/writeContract.js +1 -1
- package/_esm/chains/celo/serializers.js +3 -7
- package/_esm/chains/celo/serializers.js.map +1 -1
- package/_esm/chains/definitions/confluxESpace.js +2 -0
- package/_esm/chains/definitions/confluxESpace.js.map +1 -1
- package/_esm/chains/definitions/confluxESpaceTestnet.js +31 -0
- package/_esm/chains/definitions/confluxESpaceTestnet.js.map +1 -0
- package/_esm/chains/definitions/filecoin.js +6 -0
- package/_esm/chains/definitions/filecoin.js.map +1 -1
- package/_esm/chains/definitions/pgn.js +35 -0
- package/_esm/chains/definitions/pgn.js.map +1 -0
- package/_esm/chains/definitions/pgnTestnet.js +36 -0
- package/_esm/chains/definitions/pgnTestnet.js.map +1 -0
- package/_esm/chains/definitions/sapphire.js +30 -0
- package/_esm/chains/definitions/sapphire.js.map +1 -0
- package/_esm/chains/definitions/sapphireTestnet.js +25 -0
- package/_esm/chains/definitions/sapphireTestnet.js.map +1 -0
- package/_esm/chains/index.js +5 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/errors/base.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/errors/version.js.map +1 -1
- package/_esm/utils/abi/encodeEventTopics.js.map +1 -1
- package/_esm/utils/ccip.js +3 -1
- package/_esm/utils/ccip.js.map +1 -1
- package/_esm/utils/encoding/toBytes.js +2 -2
- package/_esm/utils/encoding/toBytes.js.map +1 -1
- package/_esm/utils/ens/avatar/utils.js +1 -1
- package/_esm/utils/ens/avatar/utils.js.map +1 -1
- package/_esm/utils/ens/namehash.js +1 -1
- package/_esm/utils/ens/normalize.js +2 -2
- package/_esm/utils/errors/getContractError.js.map +1 -1
- package/_esm/utils/errors/getNodeError.js +11 -11
- package/_esm/utils/errors/getNodeError.js.map +1 -1
- package/_esm/utils/transaction/getTransactionType.js.map +1 -1
- package/_esm/utils/transaction/serializeTransaction.js.map +1 -1
- package/_types/accounts/utils/signTransaction.d.ts.map +1 -1
- package/_types/actions/ens/getEnsAddress.d.ts +2 -2
- package/_types/actions/ens/getEnsAvatar.d.ts +2 -2
- package/_types/actions/ens/getEnsName.d.ts +2 -2
- package/_types/actions/ens/getEnsResolver.d.ts +2 -2
- package/_types/actions/ens/getEnsText.d.ts +2 -2
- package/_types/actions/public/createContractEventFilter.d.ts.map +1 -1
- package/_types/actions/public/estimateMaxPriorityFeePerGas.d.ts.map +1 -1
- package/_types/actions/public/getBlock.d.ts +1 -1
- package/_types/actions/public/getBlockNumber.d.ts +1 -1
- package/_types/actions/public/getLogs.d.ts +1 -1
- package/_types/actions/public/getTransaction.d.ts +1 -1
- package/_types/actions/public/getTransactionConfirmations.d.ts +1 -1
- package/_types/actions/public/getTransactionReceipt.d.ts +1 -1
- package/_types/actions/public/readContract.d.ts +1 -1
- package/_types/actions/public/simulateContract.d.ts +1 -1
- package/_types/actions/public/waitForTransactionReceipt.d.ts +1 -1
- package/_types/actions/public/watchBlockNumber.d.ts +1 -1
- package/_types/actions/public/watchBlocks.d.ts +1 -1
- package/_types/actions/wallet/deployContract.d.ts +1 -1
- package/_types/actions/wallet/sendTransaction.d.ts +1 -1
- package/_types/actions/wallet/writeContract.d.ts +1 -1
- package/_types/chains/celo/serializers.d.ts.map +1 -1
- package/_types/chains/definitions/confluxESpace.d.ts +2 -0
- package/_types/chains/definitions/confluxESpace.d.ts.map +1 -1
- package/_types/chains/definitions/confluxESpaceTestnet.d.ts +34 -0
- package/_types/chains/definitions/confluxESpaceTestnet.d.ts.map +1 -0
- package/_types/chains/definitions/filecoin.d.ts +6 -0
- package/_types/chains/definitions/filecoin.d.ts.map +1 -1
- package/_types/chains/definitions/pgn.d.ts +340 -0
- package/_types/chains/definitions/pgn.d.ts.map +1 -0
- package/_types/chains/definitions/pgnTestnet.d.ts +341 -0
- package/_types/chains/definitions/pgnTestnet.d.ts.map +1 -0
- package/_types/chains/definitions/sapphire.d.ts +33 -0
- package/_types/chains/definitions/sapphire.d.ts.map +1 -0
- package/_types/chains/definitions/sapphireTestnet.d.ts +28 -0
- package/_types/chains/definitions/sapphireTestnet.d.ts.map +1 -0
- package/_types/chains/index.d.ts +5 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/clients/decorators/public.d.ts +21 -21
- package/_types/clients/decorators/wallet.d.ts +3 -3
- package/_types/errors/version.d.ts +1 -1
- package/_types/errors/version.d.ts.map +1 -1
- package/_types/types/contract.d.ts.map +1 -1
- package/_types/types/filter.d.ts.map +1 -1
- package/_types/types/log.d.ts.map +1 -1
- package/_types/types/multicall.d.ts.map +1 -1
- package/_types/types/transaction.d.ts.map +1 -1
- package/_types/types/typedData.d.ts.map +1 -1
- package/_types/types/utils.d.ts.map +1 -1
- package/_types/utils/abi/decodeFunctionResult.d.ts.map +1 -1
- package/_types/utils/abi/encodeErrorResult.d.ts.map +1 -1
- package/_types/utils/abi/encodeEventTopics.d.ts.map +1 -1
- package/_types/utils/abi/encodeFunctionData.d.ts.map +1 -1
- package/_types/utils/abi/encodeFunctionResult.d.ts.map +1 -1
- package/_types/utils/ccip.d.ts.map +1 -1
- package/_types/utils/encoding/fromBytes.d.ts.map +1 -1
- package/_types/utils/encoding/fromHex.d.ts.map +1 -1
- package/_types/utils/ens/avatar/utils.d.ts.map +1 -1
- package/_types/utils/ens/namehash.d.ts +1 -1
- package/_types/utils/ens/normalize.d.ts +2 -2
- package/_types/utils/errors/getNodeError.d.ts.map +1 -1
- package/_types/utils/transaction/getSerializedTransactionType.d.ts.map +1 -1
- package/_types/utils/transaction/getTransactionType.d.ts.map +1 -1
- package/_types/utils/transaction/serializeTransaction.d.ts.map +1 -1
- package/accounts/utils/signTransaction.ts +4 -2
- package/actions/ens/getEnsAddress.ts +3 -3
- package/actions/ens/getEnsAvatar.ts +2 -2
- package/actions/ens/getEnsName.ts +2 -2
- package/actions/ens/getEnsResolver.ts +2 -2
- package/actions/ens/getEnsText.ts +2 -2
- package/actions/public/call.ts +1 -1
- package/actions/public/createContractEventFilter.ts +11 -9
- package/actions/public/estimateMaxPriorityFeePerGas.ts +3 -1
- package/actions/public/getBlock.ts +1 -1
- package/actions/public/getBlockNumber.ts +1 -1
- package/actions/public/getLogs.ts +1 -1
- package/actions/public/getTransaction.ts +1 -1
- package/actions/public/getTransactionConfirmations.ts +1 -1
- package/actions/public/getTransactionReceipt.ts +1 -1
- package/actions/public/readContract.ts +1 -1
- package/actions/public/simulateContract.ts +1 -1
- package/actions/public/verifyHash.ts +1 -1
- package/actions/public/verifyMessage.ts +1 -1
- package/actions/public/verifyTypedData.ts +1 -1
- package/actions/public/waitForTransactionReceipt.ts +1 -1
- package/actions/public/watchBlockNumber.ts +1 -1
- package/actions/public/watchBlocks.ts +1 -1
- package/actions/wallet/deployContract.ts +1 -1
- package/actions/wallet/sendRawTransaction.ts +1 -1
- package/actions/wallet/sendTransaction.ts +1 -1
- package/actions/wallet/writeContract.ts +1 -1
- package/chains/celo/serializers.ts +3 -7
- package/chains/definitions/confluxESpace.ts +2 -0
- package/chains/definitions/confluxESpaceTestnet.ts +31 -0
- package/chains/definitions/filecoin.ts +6 -0
- package/chains/definitions/pgn.ts +38 -0
- package/chains/definitions/pgnTestnet.ts +39 -0
- package/chains/definitions/sapphire.ts +30 -0
- package/chains/definitions/sapphireTestnet.ts +25 -0
- package/chains/index.ts +5 -0
- package/clients/decorators/public.ts +21 -21
- package/clients/decorators/wallet.ts +3 -3
- package/errors/base.ts +2 -2
- package/errors/version.ts +1 -1
- package/package.json +3 -3
- package/types/contract.ts +63 -64
- package/types/filter.ts +12 -12
- package/types/log.ts +4 -4
- package/types/multicall.ts +65 -57
- package/types/transaction.ts +4 -4
- package/types/typedData.ts +12 -12
- package/types/utils.ts +6 -7
- package/utils/abi/decodeFunctionResult.ts +2 -2
- package/utils/abi/encodeErrorResult.ts +2 -2
- package/utils/abi/encodeEventTopics.ts +6 -6
- package/utils/abi/encodeFunctionData.ts +2 -2
- package/utils/abi/encodeFunctionResult.ts +5 -5
- package/utils/ccip.ts +4 -2
- package/utils/encoding/fromBytes.ts +8 -8
- package/utils/encoding/fromHex.ts +8 -8
- package/utils/encoding/toBytes.ts +2 -2
- package/utils/ens/avatar/utils.ts +3 -1
- package/utils/ens/namehash.ts +1 -1
- package/utils/ens/normalize.ts +2 -2
- package/utils/errors/getContractError.ts +2 -2
- package/utils/errors/getNodeError.ts +12 -11
- package/utils/rpc.ts +1 -1
- package/utils/transaction/getSerializedTransactionType.ts +2 -2
- package/utils/transaction/getTransactionType.ts +2 -1
- package/utils/transaction/serializeTransaction.ts +6 -3
@@ -62,7 +62,7 @@ export type GetEnsAddressErrorType =
|
|
62
62
|
* Gets address for ENS name.
|
63
63
|
*
|
64
64
|
* - Docs: https://viem.sh/docs/ens/actions/getEnsAddress.html
|
65
|
-
* - Examples: https://stackblitz.com/github/
|
65
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens
|
66
66
|
*
|
67
67
|
* Calls `resolve(bytes, bytes)` on ENS Universal Resolver Contract.
|
68
68
|
*
|
@@ -82,11 +82,11 @@ export type GetEnsAddressErrorType =
|
|
82
82
|
* transport: http(),
|
83
83
|
* })
|
84
84
|
* const ensAddress = await getEnsAddress(client, {
|
85
|
-
* name: normalize('
|
85
|
+
* name: normalize('wevm.eth'),
|
86
86
|
* })
|
87
87
|
* // '0xd2135CfB216b74109775236E36d4b433F1DF507B'
|
88
88
|
*/
|
89
|
-
export async function getEnsAddress<TChain extends Chain | undefined
|
89
|
+
export async function getEnsAddress<TChain extends Chain | undefined>(
|
90
90
|
client: Client<Transport, TChain>,
|
91
91
|
{
|
92
92
|
blockNumber,
|
@@ -34,7 +34,7 @@ export type GetEnsAvatarErrorType =
|
|
34
34
|
* Gets the avatar of an ENS name.
|
35
35
|
*
|
36
36
|
* - Docs: https://viem.sh/docs/ens/actions/getEnsAvatar.html
|
37
|
-
* - Examples: https://stackblitz.com/github/
|
37
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens
|
38
38
|
*
|
39
39
|
* Calls [`getEnsText`](https://viem.sh/docs/ens/actions/getEnsText.html) with `key` set to `'avatar'`.
|
40
40
|
*
|
@@ -54,7 +54,7 @@ export type GetEnsAvatarErrorType =
|
|
54
54
|
* transport: http(),
|
55
55
|
* })
|
56
56
|
* const ensAvatar = await getEnsAvatar(client, {
|
57
|
-
* name: normalize('
|
57
|
+
* name: normalize('wevm.eth'),
|
58
58
|
* })
|
59
59
|
* // 'https://ipfs.io/ipfs/Qma8mnp6xV3J2cRNf3mTth5C8nV11CAnceVinc3y8jSbio'
|
60
60
|
*/
|
@@ -45,7 +45,7 @@ export type GetEnsNameErrorType =
|
|
45
45
|
* Gets primary name for specified address.
|
46
46
|
*
|
47
47
|
* - Docs: https://viem.sh/docs/ens/actions/getEnsName.html
|
48
|
-
* - Examples: https://stackblitz.com/github/
|
48
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens
|
49
49
|
*
|
50
50
|
* Calls `reverse(bytes)` on ENS Universal Resolver Contract to "reverse resolve" the address to the primary ENS name.
|
51
51
|
*
|
@@ -65,7 +65,7 @@ export type GetEnsNameErrorType =
|
|
65
65
|
* const ensName = await getEnsName(client, {
|
66
66
|
* address: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
|
67
67
|
* })
|
68
|
-
* // '
|
68
|
+
* // 'wevm.eth'
|
69
69
|
*/
|
70
70
|
export async function getEnsName<TChain extends Chain | undefined>(
|
71
71
|
client: Client<Transport, TChain>,
|
@@ -41,7 +41,7 @@ export type GetEnsResolverErrorType =
|
|
41
41
|
* Gets resolver for ENS name.
|
42
42
|
*
|
43
43
|
* - Docs: https://viem.sh/docs/ens/actions/getEnsResolver.html
|
44
|
-
* - Examples: https://stackblitz.com/github/
|
44
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens
|
45
45
|
*
|
46
46
|
* Calls `findResolver(bytes)` on ENS Universal Resolver Contract to retrieve the resolver of an ENS name.
|
47
47
|
*
|
@@ -61,7 +61,7 @@ export type GetEnsResolverErrorType =
|
|
61
61
|
* transport: http(),
|
62
62
|
* })
|
63
63
|
* const resolverAddress = await getEnsResolver(client, {
|
64
|
-
* name: normalize('
|
64
|
+
* name: normalize('wevm.eth'),
|
65
65
|
* })
|
66
66
|
* // '0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41'
|
67
67
|
*/
|
@@ -60,7 +60,7 @@ export type GetEnsTextErrorType =
|
|
60
60
|
* Gets a text record for specified ENS name.
|
61
61
|
*
|
62
62
|
* - Docs: https://viem.sh/docs/ens/actions/getEnsResolver.html
|
63
|
-
* - Examples: https://stackblitz.com/github/
|
63
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens
|
64
64
|
*
|
65
65
|
* Calls `resolve(bytes, bytes)` on ENS Universal Resolver Contract.
|
66
66
|
*
|
@@ -80,7 +80,7 @@ export type GetEnsTextErrorType =
|
|
80
80
|
* transport: http(),
|
81
81
|
* })
|
82
82
|
* const twitterRecord = await getEnsText(client, {
|
83
|
-
* name: normalize('
|
83
|
+
* name: normalize('wevm.eth'),
|
84
84
|
* key: 'com.twitter',
|
85
85
|
* })
|
86
86
|
* // 'wagmi_sh'
|
package/actions/public/call.ts
CHANGED
@@ -244,7 +244,7 @@ export type ScheduleMulticallErrorType =
|
|
244
244
|
| RawContractErrorType
|
245
245
|
| ErrorType
|
246
246
|
|
247
|
-
async function scheduleMulticall<TChain extends Chain | undefined
|
247
|
+
async function scheduleMulticall<TChain extends Chain | undefined>(
|
248
248
|
client: Client<Transport>,
|
249
249
|
args: ScheduleMulticallParameters<TChain>,
|
250
250
|
) {
|
@@ -48,15 +48,17 @@ export type CreateContractEventFilterParameters<
|
|
48
48
|
args?: never
|
49
49
|
}
|
50
50
|
: MaybeExtractEventArgsFromAbi<
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
51
|
+
TAbi,
|
52
|
+
TEventName
|
53
|
+
> extends infer TEventFilterArgs
|
54
|
+
? {
|
55
|
+
args?:
|
56
|
+
| TEventFilterArgs
|
57
|
+
| (TArgs extends TEventFilterArgs ? TArgs : never)
|
58
|
+
}
|
59
|
+
: {
|
60
|
+
args?: never
|
61
|
+
})
|
60
62
|
|
61
63
|
export type CreateContractEventFilterReturnType<
|
62
64
|
TAbi extends Abi | readonly unknown[] = Abi,
|
@@ -89,7 +89,9 @@ export async function internal_estimateMaxPriorityFeePerGas<
|
|
89
89
|
client,
|
90
90
|
request,
|
91
91
|
} as ChainFeesFnParameters)
|
92
|
-
}
|
92
|
+
}
|
93
|
+
|
94
|
+
if (typeof chain?.fees?.defaultPriorityFee !== 'undefined')
|
93
95
|
return chain?.fees?.defaultPriorityFee
|
94
96
|
|
95
97
|
try {
|
@@ -66,7 +66,7 @@ export type GetBlockErrorType =
|
|
66
66
|
* Returns information about a block at a block number, hash, or tag.
|
67
67
|
*
|
68
68
|
* - Docs: https://viem.sh/docs/actions/public/getBlock.html
|
69
|
-
* - Examples: https://stackblitz.com/github/
|
69
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks/fetching-blocks
|
70
70
|
* - JSON-RPC Methods:
|
71
71
|
* - Calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbynumber) for `blockNumber` & `blockTag`.
|
72
72
|
* - Calls [`eth_getBlockByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbyhash) for `blockHash`.
|
@@ -26,7 +26,7 @@ export function getBlockNumberCache(id: string) {
|
|
26
26
|
* Returns the number of the most recent block seen.
|
27
27
|
*
|
28
28
|
* - Docs: https://viem.sh/docs/actions/public/getBlockNumber.html
|
29
|
-
* - Examples: https://stackblitz.com/github/
|
29
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks/fetching-blocks
|
30
30
|
* - JSON-RPC Methods: [`eth_blockNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blocknumber)
|
31
31
|
*
|
32
32
|
* @param client - Client to use
|
@@ -119,7 +119,7 @@ export type GetLogsErrorType =
|
|
119
119
|
* Returns a list of event logs matching the provided parameters.
|
120
120
|
*
|
121
121
|
* - Docs: https://viem.sh/docs/actions/public/getLogs.html
|
122
|
-
* - Examples: https://stackblitz.com/github/
|
122
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/filters-and-logs/event-logs
|
123
123
|
* - JSON-RPC Methods: [`eth_getLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getlogs)
|
124
124
|
*
|
125
125
|
* @param client - Client to use
|
@@ -67,7 +67,7 @@ export type GetTransactionErrorType =
|
|
67
67
|
* Returns information about a [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) given a hash or block identifier.
|
68
68
|
*
|
69
69
|
* - Docs: https://viem.sh/docs/actions/public/getTransaction.html
|
70
|
-
* - Example: https://stackblitz.com/github/
|
70
|
+
* - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/fetching-transactions
|
71
71
|
* - JSON-RPC Methods: [`eth_getTransactionByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionByHash)
|
72
72
|
*
|
73
73
|
* @param client - Client to use
|
@@ -40,7 +40,7 @@ export type GetTransactionConfirmationsErrorType =
|
|
40
40
|
* Returns the number of blocks passed (confirmations) since the transaction was processed on a block.
|
41
41
|
*
|
42
42
|
* - Docs: https://viem.sh/docs/actions/public/getTransactionConfirmations.html
|
43
|
-
* - Example: https://stackblitz.com/github/
|
43
|
+
* - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/fetching-transactions
|
44
44
|
* - JSON-RPC Methods: [`eth_getTransactionConfirmations`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionConfirmations)
|
45
45
|
*
|
46
46
|
* @param client - Client to use
|
@@ -31,7 +31,7 @@ export type GetTransactionReceiptErrorType =
|
|
31
31
|
* Returns the [Transaction Receipt](https://viem.sh/docs/glossary/terms.html#transaction-receipt) given a [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash.
|
32
32
|
*
|
33
33
|
* - Docs: https://viem.sh/docs/actions/public/getTransactionReceipt.html
|
34
|
-
* - Example: https://stackblitz.com/github/
|
34
|
+
* - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/fetching-transactions
|
35
35
|
* - JSON-RPC Methods: [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gettransactionreceipt)
|
36
36
|
*
|
37
37
|
* @param client - Client to use
|
@@ -45,7 +45,7 @@ export type ReadContractErrorType = GetContractErrorReturnType<
|
|
45
45
|
* Calls a read-only function on a contract, and returns the response.
|
46
46
|
*
|
47
47
|
* - Docs: https://viem.sh/docs/contract/readContract.html
|
48
|
-
* - Examples: https://stackblitz.com/github/
|
48
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts/reading-contracts
|
49
49
|
*
|
50
50
|
* A "read-only" function (constant function) on a Solidity contract is denoted by a `view` or `pure` keyword. They can only read the state of the contract, and cannot make any changes to it. Since read-only methods do not change the state of the contract, they do not require any gas to be executed, and can be called by any user without the need to pay for gas.
|
51
51
|
*
|
@@ -89,7 +89,7 @@ export type SimulateContractErrorType =
|
|
89
89
|
* Simulates/validates a contract interaction. This is useful for retrieving **return data** and **revert reasons** of contract write functions.
|
90
90
|
*
|
91
91
|
* - Docs: https://viem.sh/docs/contract/simulateContract.html
|
92
|
-
* - Examples: https://stackblitz.com/github/
|
92
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts/writing-to-contracts
|
93
93
|
*
|
94
94
|
* This function does not require gas to execute and _**does not**_ change the state of the blockchain. It is almost identical to [`readContract`](https://viem.sh/docs/contract/readContract.html), but also supports contract write functions.
|
95
95
|
*
|
@@ -48,7 +48,7 @@ export type VerifyHashErrorType =
|
|
48
48
|
* @param parameters - {@link VerifyHashParameters}
|
49
49
|
* @returns Whether or not the signature is valid. {@link VerifyHashReturnType}
|
50
50
|
*/
|
51
|
-
export async function verifyHash<TChain extends Chain | undefined
|
51
|
+
export async function verifyHash<TChain extends Chain | undefined>(
|
52
52
|
client: Client<Transport, TChain>,
|
53
53
|
{ address, hash, signature, ...callRequest }: VerifyHashParameters,
|
54
54
|
): Promise<VerifyHashReturnType> {
|
@@ -40,7 +40,7 @@ export type VerifyMessageErrorType =
|
|
40
40
|
* @param parameters - {@link VerifyMessageParameters}
|
41
41
|
* @returns Whether or not the signature is valid. {@link VerifyMessageReturnType}
|
42
42
|
*/
|
43
|
-
export async function verifyMessage<TChain extends Chain | undefined
|
43
|
+
export async function verifyMessage<TChain extends Chain | undefined>(
|
44
44
|
client: Client<Transport, TChain>,
|
45
45
|
{ address, message, signature, ...callRequest }: VerifyMessageParameters,
|
46
46
|
): Promise<VerifyMessageReturnType> {
|
@@ -43,7 +43,7 @@ export type VerifyTypedDataErrorType =
|
|
43
43
|
* @param parameters - {@link VerifyTypedDataParameters}
|
44
44
|
* @returns Whether or not the signature is valid. {@link VerifyTypedDataReturnType}
|
45
45
|
*/
|
46
|
-
export async function verifyTypedData<TChain extends Chain | undefined
|
46
|
+
export async function verifyTypedData<TChain extends Chain | undefined>(
|
47
47
|
client: Client<Transport, TChain>,
|
48
48
|
{
|
49
49
|
address,
|
@@ -77,7 +77,7 @@ export type WaitForTransactionReceiptErrorType =
|
|
77
77
|
* Waits for the [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) to be included on a [Block](https://viem.sh/docs/glossary/terms.html#block) (one confirmation), and then returns the [Transaction Receipt](https://viem.sh/docs/glossary/terms.html#transaction-receipt). If the Transaction reverts, then the action will throw an error.
|
78
78
|
*
|
79
79
|
* - Docs: https://viem.sh/docs/actions/public/waitForTransactionReceipt.html
|
80
|
-
* - Example: https://stackblitz.com/github/
|
80
|
+
* - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/sending-transactions
|
81
81
|
* - JSON-RPC Methods:
|
82
82
|
* - Polls [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionReceipt) on each block until it has been processed.
|
83
83
|
* - If a Transaction has been replaced:
|
@@ -56,7 +56,7 @@ export type WatchBlockNumberErrorType = PollErrorType | ErrorType
|
|
56
56
|
* Watches and returns incoming block numbers.
|
57
57
|
*
|
58
58
|
* - Docs: https://viem.sh/docs/actions/public/watchBlockNumber.html
|
59
|
-
* - Examples: https://stackblitz.com/github/
|
59
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks/watching-blocks
|
60
60
|
* - JSON-RPC Methods:
|
61
61
|
* - When `poll: true`, calls [`eth_blockNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blocknumber) on a polling interval.
|
62
62
|
* - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newHeads"` event.
|
@@ -80,7 +80,7 @@ export type WatchBlocksErrorType =
|
|
80
80
|
* Watches and returns information for incoming blocks.
|
81
81
|
*
|
82
82
|
* - Docs: https://viem.sh/docs/actions/public/watchBlocks.html
|
83
|
-
* - Examples: https://stackblitz.com/github/
|
83
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks/watching-blocks
|
84
84
|
* - JSON-RPC Methods:
|
85
85
|
* - When `poll: true`, calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getBlockByNumber) on a polling interval.
|
86
86
|
* - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newHeads"` event.
|
@@ -40,7 +40,7 @@ export type DeployContractErrorType = SendTransactionErrorType | ErrorType
|
|
40
40
|
* Deploys a contract to the network, given bytecode and constructor arguments.
|
41
41
|
*
|
42
42
|
* - Docs: https://viem.sh/docs/contract/deployContract.html
|
43
|
-
* - Examples: https://stackblitz.com/github/
|
43
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts/deploying-contracts
|
44
44
|
*
|
45
45
|
* @param client - Client to use
|
46
46
|
* @param parameters - {@link DeployContractParameters}
|
@@ -41,7 +41,7 @@ export type SendRawTransactionErrorType = RequestErrorType | ErrorType
|
|
41
41
|
* serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33'
|
42
42
|
* })
|
43
43
|
*/
|
44
|
-
export async function sendRawTransaction<TChain extends Chain | undefined
|
44
|
+
export async function sendRawTransaction<TChain extends Chain | undefined>(
|
45
45
|
client: Client<Transport, TChain>,
|
46
46
|
{ serializedTransaction }: SendRawTransactionParameters,
|
47
47
|
): Promise<SendRawTransactionReturnType> {
|
@@ -80,7 +80,7 @@ export type SendTransactionErrorType =
|
|
80
80
|
* Creates, signs, and sends a new transaction to the network.
|
81
81
|
*
|
82
82
|
* - Docs: https://viem.sh/docs/actions/wallet/sendTransaction.html
|
83
|
-
* - Examples: https://stackblitz.com/github/
|
83
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/sending-transactions
|
84
84
|
* - JSON-RPC Methods:
|
85
85
|
* - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction)
|
86
86
|
* - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction)
|
@@ -61,7 +61,7 @@ export type WriteContractErrorType =
|
|
61
61
|
* Executes a write function on a contract.
|
62
62
|
*
|
63
63
|
* - Docs: https://viem.sh/docs/contract/writeContract.html
|
64
|
-
* - Examples: https://stackblitz.com/github/
|
64
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts/writing-to-contracts
|
65
65
|
*
|
66
66
|
* A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a [Transaction](https://viem.sh/docs/glossary/terms.html) is needed to be broadcast in order to change the state.
|
67
67
|
*
|
@@ -27,13 +27,9 @@ import { isCIP42, isCIP64, isEmpty, isPresent } from './utils.js'
|
|
27
27
|
export const serializeTransactionCelo: SerializeTransactionFn<
|
28
28
|
CeloTransactionSerializable | TransactionSerializable
|
29
29
|
> = (tx, signature) => {
|
30
|
-
if (isCIP64(tx))
|
31
|
-
|
32
|
-
|
33
|
-
return serializeTransactionCIP42(tx, signature)
|
34
|
-
} else {
|
35
|
-
return serializeTransaction(tx as TransactionSerializable, signature)
|
36
|
-
}
|
30
|
+
if (isCIP64(tx)) return serializeTransactionCIP64(tx, signature)
|
31
|
+
if (isCIP42(tx)) return serializeTransactionCIP42(tx, signature)
|
32
|
+
return serializeTransaction(tx as TransactionSerializable, signature)
|
37
33
|
}
|
38
34
|
|
39
35
|
export const serializersCelo = {
|
@@ -8,9 +8,11 @@ export const confluxESpace = /*#__PURE__*/ defineChain({
|
|
8
8
|
rpcUrls: {
|
9
9
|
default: {
|
10
10
|
http: ['https://evm.confluxrpc.org'],
|
11
|
+
webSocket: ['wss://evm.confluxrpc.org/ws'],
|
11
12
|
},
|
12
13
|
public: {
|
13
14
|
http: ['https://evm.confluxrpc.org'],
|
15
|
+
webSocket: ['wss://evm.confluxrpc.org/ws'],
|
14
16
|
},
|
15
17
|
},
|
16
18
|
blockExplorers: {
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
2
|
+
|
3
|
+
export const confluxESpaceTestnet = /*#__PURE__*/ defineChain({
|
4
|
+
id: 71,
|
5
|
+
name: 'Conflux eSpace Testnet',
|
6
|
+
network: 'cfx-espace-testnet',
|
7
|
+
testnet: true,
|
8
|
+
nativeCurrency: { name: 'Conflux', symbol: 'CFX', decimals: 18 },
|
9
|
+
rpcUrls: {
|
10
|
+
default: {
|
11
|
+
http: ['https://evmtestnet.confluxrpc.org'],
|
12
|
+
webSocket: ['wss://evmtestnet.confluxrpc.org/ws'],
|
13
|
+
},
|
14
|
+
public: {
|
15
|
+
http: ['https://evmtestnet.confluxrpc.org'],
|
16
|
+
webSocket: ['wss://evmtestnet.confluxrpc.org/ws'],
|
17
|
+
},
|
18
|
+
},
|
19
|
+
blockExplorers: {
|
20
|
+
default: {
|
21
|
+
name: 'ConfluxScan',
|
22
|
+
url: 'https://evmtestnet.confluxscan.io',
|
23
|
+
},
|
24
|
+
},
|
25
|
+
contracts: {
|
26
|
+
multicall3: {
|
27
|
+
address: '0xEFf0078910f638cd81996cc117bccD3eDf2B072F',
|
28
|
+
blockCreated: 117499050,
|
29
|
+
},
|
30
|
+
},
|
31
|
+
})
|
@@ -19,4 +19,10 @@ export const filecoin = /*#__PURE__*/ defineChain({
|
|
19
19
|
filscout: { name: 'Filscout', url: 'https://filscout.io/en' },
|
20
20
|
glif: { name: 'Glif', url: 'https://explorer.glif.io' },
|
21
21
|
},
|
22
|
+
contracts: {
|
23
|
+
multicall3: {
|
24
|
+
address: '0xcA11bde05977b3631167028862bE2a173976CA11',
|
25
|
+
blockCreated: 3328594,
|
26
|
+
},
|
27
|
+
},
|
22
28
|
})
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
2
|
+
import { formattersOptimism } from '../optimism/formatters.js'
|
3
|
+
|
4
|
+
export const pgn = /*#__PURE__*/ defineChain(
|
5
|
+
{
|
6
|
+
id: 424,
|
7
|
+
network: 'pgn',
|
8
|
+
name: 'PGN',
|
9
|
+
nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
|
10
|
+
rpcUrls: {
|
11
|
+
default: {
|
12
|
+
http: ['https://rpc.publicgoods.network'],
|
13
|
+
},
|
14
|
+
public: {
|
15
|
+
http: ['https://rpc.publicgoods.network'],
|
16
|
+
},
|
17
|
+
},
|
18
|
+
blockExplorers: {
|
19
|
+
default: {
|
20
|
+
name: 'PGN Explorer',
|
21
|
+
url: 'https://explorer.publicgoods.network',
|
22
|
+
},
|
23
|
+
blocksout: {
|
24
|
+
name: 'PGN Explorer',
|
25
|
+
url: 'https://explorer.publicgoods.network',
|
26
|
+
},
|
27
|
+
},
|
28
|
+
contracts: {
|
29
|
+
multicall3: {
|
30
|
+
address: '0xcA11bde05977b3631167028862bE2a173976CA11',
|
31
|
+
blockCreated: 3380209,
|
32
|
+
},
|
33
|
+
},
|
34
|
+
},
|
35
|
+
{
|
36
|
+
formatters: formattersOptimism,
|
37
|
+
},
|
38
|
+
)
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
2
|
+
import { formattersOptimism } from '../optimism/formatters.js'
|
3
|
+
|
4
|
+
export const pgnTestnet = /*#__PURE__*/ defineChain(
|
5
|
+
{
|
6
|
+
id: 58008,
|
7
|
+
network: 'pgn-testnet',
|
8
|
+
name: 'PGN ',
|
9
|
+
nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
|
10
|
+
rpcUrls: {
|
11
|
+
default: {
|
12
|
+
http: ['https://sepolia.publicgoods.network'],
|
13
|
+
},
|
14
|
+
public: {
|
15
|
+
http: ['https://sepolia.publicgoods.network'],
|
16
|
+
},
|
17
|
+
},
|
18
|
+
blockExplorers: {
|
19
|
+
default: {
|
20
|
+
name: 'PGN Testnet Explorer',
|
21
|
+
url: 'https://explorer.sepolia.publicgoods.network',
|
22
|
+
},
|
23
|
+
blocksout: {
|
24
|
+
name: 'PGN Testnet Explorer',
|
25
|
+
url: 'https://explorer.sepolia.publicgoods.network',
|
26
|
+
},
|
27
|
+
},
|
28
|
+
contracts: {
|
29
|
+
multicall3: {
|
30
|
+
address: '0xcA11bde05977b3631167028862bE2a173976CA11',
|
31
|
+
blockCreated: 3754925,
|
32
|
+
},
|
33
|
+
},
|
34
|
+
testnet: true,
|
35
|
+
},
|
36
|
+
{
|
37
|
+
formatters: formattersOptimism,
|
38
|
+
},
|
39
|
+
)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
2
|
+
|
3
|
+
export const sapphire = /*#__PURE__*/ defineChain({
|
4
|
+
id: 23294,
|
5
|
+
name: 'Oasis Sapphire',
|
6
|
+
network: 'sapphire',
|
7
|
+
nativeCurrency: { name: 'Sapphire Rose', symbol: 'ROSE', decimals: 18 },
|
8
|
+
rpcUrls: {
|
9
|
+
default: {
|
10
|
+
http: ['https://sapphire.oasis.io'],
|
11
|
+
webSocket: ['wss://sapphire.oasis.io/ws'],
|
12
|
+
},
|
13
|
+
public: {
|
14
|
+
http: ['https://sapphire.oasis.io'],
|
15
|
+
webSocket: ['wss://sapphire.oasis.io/ws'],
|
16
|
+
},
|
17
|
+
},
|
18
|
+
blockExplorers: {
|
19
|
+
default: {
|
20
|
+
name: 'Oasis Sapphire Explorer',
|
21
|
+
url: 'https://explorer.sapphire.oasis.io',
|
22
|
+
},
|
23
|
+
},
|
24
|
+
contracts: {
|
25
|
+
multicall3: {
|
26
|
+
address: '0xcA11bde05977b3631167028862bE2a173976CA11',
|
27
|
+
blockCreated: 734531,
|
28
|
+
},
|
29
|
+
},
|
30
|
+
})
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
2
|
+
|
3
|
+
export const sapphireTestnet = /*#__PURE__*/ defineChain({
|
4
|
+
id: 23295,
|
5
|
+
name: 'Oasis Sapphire Testnet',
|
6
|
+
network: 'sapphire-testnet',
|
7
|
+
nativeCurrency: { name: 'Sapphire Test Rose', symbol: 'TEST', decimals: 18 },
|
8
|
+
rpcUrls: {
|
9
|
+
default: {
|
10
|
+
http: ['https://testnet.sapphire.oasis.dev'],
|
11
|
+
webSocket: ['wss://testnet.sapphire.oasis.dev/ws'],
|
12
|
+
},
|
13
|
+
public: {
|
14
|
+
http: ['https://testnet.sapphire.oasis.dev'],
|
15
|
+
webSocket: ['wss://testnet.sapphire.oasis.dev/ws'],
|
16
|
+
},
|
17
|
+
},
|
18
|
+
blockExplorers: {
|
19
|
+
default: {
|
20
|
+
name: 'Oasis Sapphire Testnet Explorer',
|
21
|
+
url: 'https://testnet.explorer.sapphire.oasis.dev',
|
22
|
+
},
|
23
|
+
},
|
24
|
+
testnet: true,
|
25
|
+
})
|
package/chains/index.ts
CHANGED
@@ -29,6 +29,7 @@ export { chiliz } from './definitions/chiliz.js'
|
|
29
29
|
export { celoCannoli } from './definitions/celoCannoli.js'
|
30
30
|
export { classic } from './definitions/classic.js'
|
31
31
|
export { confluxESpace } from './definitions/confluxESpace.js'
|
32
|
+
export { confluxESpaceTestnet } from './definitions/confluxESpaceTestnet.js'
|
32
33
|
export { coreDao } from './definitions/coreDao.js'
|
33
34
|
export { cronos } from './definitions/cronos.js'
|
34
35
|
export { cronosTestnet } from './definitions/cronosTestnet.js'
|
@@ -102,6 +103,8 @@ export { optimismGoerli } from './definitions/optimismGoerli.js'
|
|
102
103
|
export { optimismSepolia } from './definitions/optimismSepolia.js'
|
103
104
|
export { opBNB } from './definitions/opBNB.js'
|
104
105
|
export { opBNBTestnet } from './definitions/opBNBTestnet.js'
|
106
|
+
export { pgn } from './definitions/pgn.js'
|
107
|
+
export { pgnTestnet } from './definitions/pgnTestnet.js'
|
105
108
|
export { plinga } from './definitions/plinga.js'
|
106
109
|
export { polygon } from './definitions/polygon.js'
|
107
110
|
export { polygonMumbai } from './definitions/polygonMumbai.js'
|
@@ -116,6 +119,8 @@ export { rolluxTestnet } from './definitions/rolluxTestnet.js'
|
|
116
119
|
export { ronin } from './definitions/ronin.js'
|
117
120
|
export { rootstock } from './definitions/rootstock.js'
|
118
121
|
export { saigon } from './definitions/saigon.js'
|
122
|
+
export { sapphire } from './definitions/sapphire.js'
|
123
|
+
export { sapphireTestnet } from './definitions/sapphireTestnet.js'
|
119
124
|
export { scroll } from './definitions/scroll.js'
|
120
125
|
export { scrollSepolia } from './definitions/scrollSepolia.js'
|
121
126
|
export { scrollTestnet } from './definitions/scrollTestnet.js'
|