viem 0.2.0-0-2-0.20230329T025357 → 0.2.0-0-2-0.20230403T055238

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.
Files changed (71) hide show
  1. package/dist/abi.d.ts +3 -3
  2. package/dist/abi.js +2 -2
  3. package/dist/abi.mjs +1 -1
  4. package/dist/accounts/index.d.ts +5 -14
  5. package/dist/accounts/index.js +20 -30
  6. package/dist/accounts/index.js.map +1 -1
  7. package/dist/accounts/index.mjs +14 -24
  8. package/dist/accounts/index.mjs.map +1 -1
  9. package/dist/{chain-5b28fc53.d.ts → chain-5507c6f0.d.ts} +143 -120
  10. package/dist/{chain-e9b996ff.d.ts → chain-fe47467d.d.ts} +1 -1
  11. package/dist/chains.d.ts +867 -99
  12. package/dist/chains.js +115 -63
  13. package/dist/chains.js.map +1 -1
  14. package/dist/chains.mjs +58 -6
  15. package/dist/chains.mjs.map +1 -1
  16. package/dist/{chunk-7QEOFHC7.mjs → chunk-EMXJKA5P.mjs} +2 -2
  17. package/dist/{chunk-UCZWRYV5.mjs → chunk-KILBOPDD.mjs} +754 -33
  18. package/dist/chunk-KILBOPDD.mjs.map +1 -0
  19. package/dist/{chunk-D3ALNUWN.js → chunk-KQOOAYBY.js} +6 -6
  20. package/dist/{chunk-564BCC7H.js → chunk-PWUNCH5G.js} +777 -56
  21. package/dist/chunk-PWUNCH5G.js.map +1 -0
  22. package/dist/contract.d.ts +8 -8
  23. package/dist/contract.js +2 -2
  24. package/dist/contract.mjs +1 -1
  25. package/dist/{createClient-e52de308.d.ts → createTransport-21a0d2b3.d.ts} +36 -34
  26. package/dist/{eip1193-9080db42.d.ts → eip1193-2f3a9cd2.d.ts} +1 -1
  27. package/dist/{encodeFunctionResult-47ad60ed.d.ts → encodeFunctionResult-c5185b98.d.ts} +15 -15
  28. package/dist/{encodePacked-35c796fb.d.ts → encodePacked-98f67d09.d.ts} +1 -1
  29. package/dist/ens.d.ts +5 -5
  30. package/dist/ens.js +8 -3
  31. package/dist/ens.js.map +1 -1
  32. package/dist/ens.mjs +7 -2
  33. package/dist/ens.mjs.map +1 -1
  34. package/dist/ethers.d.ts +2 -2
  35. package/dist/ethers.js +4 -4
  36. package/dist/ethers.mjs +2 -2
  37. package/dist/{formatAbiItem-d9e801dd.d.ts → formatAbiItem-56dff508.d.ts} +1 -1
  38. package/dist/{getAbiItem-1d94ae0e.d.ts → getAbiItem-bfba73d1.d.ts} +3 -3
  39. package/dist/{watchPendingTransactions-468f53f2.d.ts → getEnsResolver-9e26c596.d.ts} +203 -150
  40. package/dist/index.d.ts +161 -18
  41. package/dist/index.js +222 -138
  42. package/dist/index.js.map +1 -1
  43. package/dist/index.mjs +136 -52
  44. package/dist/index.mjs.map +1 -1
  45. package/dist/{parseGwei-f14525ab.d.ts → parseGwei-d2147f8b.d.ts} +5 -5
  46. package/dist/public.d.ts +5 -5
  47. package/dist/public.js +2 -2
  48. package/dist/public.mjs +1 -1
  49. package/dist/publicKeyToAddress-623eb398.d.ts +16 -0
  50. package/dist/{test-f3d06763.d.ts → test-b67569fe.d.ts} +3 -3
  51. package/dist/test.d.ts +5 -5
  52. package/dist/test.js +2 -2
  53. package/dist/test.mjs +1 -1
  54. package/dist/{typedData-42b43450.d.ts → typedData-46b4d81f.d.ts} +1 -1
  55. package/dist/utils/index.d.ts +15 -15
  56. package/dist/utils/index.js +4 -2
  57. package/dist/utils/index.mjs +3 -1
  58. package/dist/wallet.d.ts +5 -5
  59. package/dist/wallet.js +2 -2
  60. package/dist/wallet.mjs +1 -1
  61. package/dist/window.d.ts +2 -2
  62. package/package.json +4 -3
  63. package/dist/chunk-564BCC7H.js.map +0 -1
  64. package/dist/chunk-BJ5KRDTG.mjs +0 -186
  65. package/dist/chunk-BJ5KRDTG.mjs.map +0 -1
  66. package/dist/chunk-CXE4XSMF.js +0 -186
  67. package/dist/chunk-CXE4XSMF.js.map +0 -1
  68. package/dist/chunk-UCZWRYV5.mjs.map +0 -1
  69. package/dist/parseAccount-4209fa24.d.ts +0 -6
  70. /package/dist/{chunk-7QEOFHC7.mjs.map → chunk-EMXJKA5P.mjs.map} +0 -0
  71. /package/dist/{chunk-D3ALNUWN.js.map → chunk-KQOOAYBY.js.map} +0 -0
@@ -20,7 +20,7 @@ var _abitype = require('abitype');
20
20
  var package_default = {
21
21
  name: "viem",
22
22
  description: "TypeScript Interface for Ethereum",
23
- version: "0.1.23",
23
+ version: "0.1.26",
24
24
  scripts: {
25
25
  anvil: "source .env && anvil --fork-url $VITE_ANVIL_FORK_URL --fork-block-number $VITE_ANVIL_BLOCK_NUMBER --block-time $VITE_ANVIL_BLOCK_TIME",
26
26
  bench: "vitest bench --no-threads",
@@ -35,7 +35,7 @@ var package_default = {
35
35
  "dev:docs": "pnpm -r --filter site dev",
36
36
  format: "rome format src/ --write",
37
37
  lint: "rome check .",
38
- "lint:fix": "pnpm lint --apply-suggested",
38
+ "lint:fix": "pnpm lint --apply",
39
39
  playground: "pnpm --filter playground-browser dev",
40
40
  postinstall: "pnpm dev && pnpm contracts:build",
41
41
  preinstall: "npx only-allow pnpm",
@@ -147,11 +147,12 @@ var package_default = {
147
147
  types: "dist/index.d.ts",
148
148
  sideEffects: false,
149
149
  dependencies: {
150
+ "@ensdomains/address-encoder": "^0.2.21",
151
+ "@noble/curves": "^0.9.0",
150
152
  "@noble/hashes": "^1.1.2",
151
- "@noble/secp256k1": "^1.7.1",
152
153
  "@scure/bip32": "^1.2.0",
153
154
  "@scure/bip39": "^1.1.1",
154
- "@wagmi/chains": "~0.2.11",
155
+ "@wagmi/chains": "~0.2.15",
155
156
  abitype: "~0.7.1",
156
157
  "idna-uts46-hx": "^4.1.2",
157
158
  "isomorphic-ws": "^5.0.0",
@@ -179,7 +180,7 @@ var package_default = {
179
180
  execa: "^6.1.0",
180
181
  "fs-extra": "^10.1.0",
181
182
  rimraf: "^4.1.2",
182
- rome: "^11.0.0",
183
+ rome: "^12.0.0",
183
184
  "simple-git-hooks": "^2.8.1",
184
185
  "size-limit": "^8.2.4",
185
186
  tsup: "^6.6.0",
@@ -209,6 +210,9 @@ var package_default = {
209
210
  "pre-commit": "pnpm format && pnpm lint:fix"
210
211
  },
211
212
  pnpm: {
213
+ overrides: {
214
+ viem: "workspace:*"
215
+ },
212
216
  patchedDependencies: {
213
217
  "vitepress@1.0.0-alpha.61": "patches/vitepress@1.0.0-alpha.61.patch"
214
218
  },
@@ -680,6 +684,42 @@ var multicall3Abi = [
680
684
  type: "function"
681
685
  }
682
686
  ];
687
+ var universalResolverAbi = [
688
+ {
689
+ name: "resolve",
690
+ type: "function",
691
+ stateMutability: "view",
692
+ inputs: [
693
+ { name: "name", type: "bytes" },
694
+ { name: "data", type: "bytes" }
695
+ ],
696
+ outputs: [
697
+ { name: "", type: "bytes" },
698
+ { name: "address", type: "address" }
699
+ ]
700
+ }
701
+ ];
702
+ var textResolverAbi = [
703
+ {
704
+ name: "text",
705
+ type: "function",
706
+ stateMutability: "view",
707
+ inputs: [
708
+ { name: "name", type: "bytes32" },
709
+ { name: "key", type: "string" }
710
+ ],
711
+ outputs: [{ name: "", type: "string" }]
712
+ }
713
+ ];
714
+ var singleAddressResolverAbi = [
715
+ {
716
+ name: "addr",
717
+ type: "function",
718
+ stateMutability: "view",
719
+ inputs: [{ name: "name", type: "bytes32" }],
720
+ outputs: [{ name: "", type: "address" }]
721
+ }
722
+ ];
683
723
 
684
724
  // src/constants/solidity.ts
685
725
  var panicReasons = {
@@ -1132,6 +1172,45 @@ var OffsetOutOfBoundsError = class extends BaseError {
1132
1172
  }
1133
1173
  };
1134
1174
 
1175
+ // src/errors/ens.ts
1176
+ var EnsAvatarInvalidMetadataError = class extends BaseError {
1177
+ constructor({ data }) {
1178
+ super(
1179
+ "Unable to extract image from metadata. The metadata may be malformed or invalid.",
1180
+ {
1181
+ metaMessages: [
1182
+ "- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.",
1183
+ "",
1184
+ `Provided data: ${JSON.stringify(data)}`
1185
+ ]
1186
+ }
1187
+ );
1188
+ __publicField(this, "name", "EnsAvatarInvalidMetadataError");
1189
+ }
1190
+ };
1191
+ var EnsAvatarInvalidNftUriError = class extends BaseError {
1192
+ constructor({ reason }) {
1193
+ super(`ENS NFT avatar URI is invalid. ${reason}`);
1194
+ __publicField(this, "name", "EnsAvatarInvalidNftUriError");
1195
+ }
1196
+ };
1197
+ var EnsAvatarUriResolutionError = class extends BaseError {
1198
+ constructor({ uri }) {
1199
+ super(
1200
+ `Unable to resolve ENS avatar URI "${uri}". The URI may be malformed, invalid, or does not respond with a valid image.`
1201
+ );
1202
+ __publicField(this, "name", "EnsAvatarUriResolutionError");
1203
+ }
1204
+ };
1205
+ var EnsAvatarUnsupportedNamespaceError = class extends BaseError {
1206
+ constructor({ namespace }) {
1207
+ super(
1208
+ `ENS NFT avatar namespace "${namespace}" is not supported. Must be "erc721" or "erc1155".`
1209
+ );
1210
+ __publicField(this, "name", "EnsAvatarUnsupportedNamespaceError");
1211
+ }
1212
+ };
1213
+
1135
1214
  // src/errors/estimateGas.ts
1136
1215
  var EstimateGasExecutionError = class extends BaseError {
1137
1216
  constructor(cause, {
@@ -2421,7 +2500,7 @@ function decodeArray(data, {
2421
2500
  consumed2 += decodedChild.consumed;
2422
2501
  value2.push(decodedChild.value);
2423
2502
  }
2424
- return { value: value2, consumed: consumed2 };
2503
+ return { value: value2, consumed: 32 };
2425
2504
  }
2426
2505
  let consumed = 0;
2427
2506
  let value = [];
@@ -2627,7 +2706,7 @@ function decodeFunctionData({
2627
2706
  }) {
2628
2707
  const signature = slice(data, 0, 4);
2629
2708
  const description = abi.find(
2630
- (x) => signature === getFunctionSelector(formatAbiItem(x))
2709
+ (x) => x.type === "function" && signature === getFunctionSelector(formatAbiItem(x))
2631
2710
  );
2632
2711
  if (!description)
2633
2712
  throw new AbiFunctionSignatureNotFoundError(signature, {
@@ -2956,6 +3035,12 @@ function parseAccount(account) {
2956
3035
  return account;
2957
3036
  }
2958
3037
 
3038
+ // src/accounts/utils/publicKeyToAddress.ts
3039
+ function publicKeyToAddress(publicKey) {
3040
+ const address = keccak256(`0x${publicKey.substring(4)}`).substring(26);
3041
+ return checksumAddress(`0x${address}`);
3042
+ }
3043
+
2959
3044
  // src/utils/promise/withCache.ts
2960
3045
  var promiseCache = /* @__PURE__ */ new Map();
2961
3046
  var responseCache = /* @__PURE__ */ new Map();
@@ -3837,16 +3922,11 @@ async function recoverAddress({
3837
3922
  const signatureHex = isHex(signature) ? signature : toHex(signature);
3838
3923
  const hashHex = isHex(hash2) ? hash2 : toHex(hash2);
3839
3924
  const v = hexToNumber(`0x${signatureHex.slice(130)}`);
3840
- const { recoverPublicKey } = await Promise.resolve().then(() => require("@noble/secp256k1"));
3841
- const publicKey = toHex(
3842
- recoverPublicKey(
3843
- hashHex.substring(2),
3844
- signatureHex.substring(2, 130),
3845
- v - 27
3846
- )
3847
- );
3848
- const address = keccak256(`0x${publicKey.substring(4)}`).substring(26);
3849
- return checksumAddress(`0x${address}`);
3925
+ const { secp256k1 } = await Promise.resolve().then(() => require("@noble/curves/secp256k1"));
3926
+ const publicKey = secp256k1.Signature.fromCompact(
3927
+ signatureHex.substring(2, 130)
3928
+ ).addRecoveryBit(v - 27).recoverPublicKey(hashHex.substring(2)).toHex(false);
3929
+ return publicKeyToAddress(`0x${publicKey}`);
3850
3930
  }
3851
3931
 
3852
3932
  // src/utils/signature/recoverMessageAddress.ts
@@ -3957,6 +4037,272 @@ function getTransactionType(transaction) {
3957
4037
  throw new InvalidSerializableTransactionError({ transaction });
3958
4038
  }
3959
4039
 
4040
+ // src/utils/ens/avatar/utils.ts
4041
+ var networkRegex = /(?<protocol>https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/;
4042
+ var ipfsHashRegex = /^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/;
4043
+ var base64Regex = /^data:([a-zA-Z\-/+]*);base64,([^"].*)/;
4044
+ var dataURIRegex = /^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;
4045
+ async function isImageUri(uri) {
4046
+ try {
4047
+ const res = await fetch(uri, { method: "HEAD" });
4048
+ if (res.status === 200) {
4049
+ const contentType = res.headers.get("content-type");
4050
+ return _optionalChain([contentType, 'optionalAccess', _93 => _93.startsWith, 'call', _94 => _94("image/")]);
4051
+ }
4052
+ return false;
4053
+ } catch (error) {
4054
+ if (typeof error === "object" && typeof error.response !== "undefined") {
4055
+ return false;
4056
+ }
4057
+ if (!globalThis.hasOwnProperty("Image"))
4058
+ return false;
4059
+ return new Promise((resolve) => {
4060
+ const img = new Image();
4061
+ img.onload = () => {
4062
+ resolve(true);
4063
+ };
4064
+ img.onerror = () => {
4065
+ resolve(false);
4066
+ };
4067
+ img.src = uri;
4068
+ });
4069
+ }
4070
+ }
4071
+ function getGateway(custom, defaultGateway) {
4072
+ if (!custom)
4073
+ return defaultGateway;
4074
+ if (custom.endsWith("/"))
4075
+ return custom.slice(0, -1);
4076
+ return custom;
4077
+ }
4078
+ function resolveAvatarUri({
4079
+ uri,
4080
+ gatewayUrls
4081
+ }) {
4082
+ const isEncoded = base64Regex.test(uri);
4083
+ if (isEncoded)
4084
+ return { uri, isOnChain: true, isEncoded };
4085
+ const ipfsGateway = getGateway(_optionalChain([gatewayUrls, 'optionalAccess', _95 => _95.ipfs]), "https://ipfs.io");
4086
+ const arweaveGateway = getGateway(_optionalChain([gatewayUrls, 'optionalAccess', _96 => _96.arweave]), "https://arweave.net");
4087
+ const networkRegexMatch = uri.match(networkRegex);
4088
+ const {
4089
+ protocol,
4090
+ subpath,
4091
+ target,
4092
+ subtarget = ""
4093
+ } = _optionalChain([networkRegexMatch, 'optionalAccess', _97 => _97.groups]) || {};
4094
+ const isIPNS = protocol === "ipns:/" || subpath === "ipns/";
4095
+ const isIPFS = protocol === "ipfs:/" || subpath === "ipfs/" || ipfsHashRegex.test(uri);
4096
+ if (uri.startsWith("http") && !isIPNS && !isIPFS) {
4097
+ let replacedUri = uri;
4098
+ if (_optionalChain([gatewayUrls, 'optionalAccess', _98 => _98.arweave]))
4099
+ replacedUri = uri.replace(/https:\/\/arweave.net/g, _optionalChain([gatewayUrls, 'optionalAccess', _99 => _99.arweave]));
4100
+ return { uri: replacedUri, isOnChain: false, isEncoded: false };
4101
+ }
4102
+ if ((isIPNS || isIPFS) && target) {
4103
+ return {
4104
+ uri: `${ipfsGateway}/${isIPNS ? "ipns" : "ipfs"}/${target}${subtarget}`,
4105
+ isOnChain: false,
4106
+ isEncoded: false
4107
+ };
4108
+ } else if (protocol === "ar:/" && target) {
4109
+ return {
4110
+ uri: `${arweaveGateway}/${target}${subtarget || ""}`,
4111
+ isOnChain: false,
4112
+ isEncoded: false
4113
+ };
4114
+ }
4115
+ let parsedUri = uri.replace(dataURIRegex, "");
4116
+ if (parsedUri.startsWith("<svg")) {
4117
+ parsedUri = `data:image/svg+xml;base64,${btoa(parsedUri)}`;
4118
+ }
4119
+ if (parsedUri.startsWith("data:") || parsedUri.startsWith("{")) {
4120
+ return {
4121
+ uri: parsedUri,
4122
+ isOnChain: true,
4123
+ isEncoded: false
4124
+ };
4125
+ }
4126
+ throw new EnsAvatarUriResolutionError({ uri });
4127
+ }
4128
+ function getJsonImage(data) {
4129
+ if (typeof data !== "object" || !("image" in data) && !("image_url" in data) && !("image_data" in data)) {
4130
+ throw new EnsAvatarInvalidMetadataError({ data });
4131
+ }
4132
+ return data.image || data.image_url || data.image_data;
4133
+ }
4134
+ async function getMetadataAvatarUri({
4135
+ gatewayUrls,
4136
+ uri
4137
+ }) {
4138
+ try {
4139
+ const res = await fetch(uri).then((res2) => res2.json());
4140
+ const image = await parseAvatarUri({
4141
+ gatewayUrls,
4142
+ uri: getJsonImage(res)
4143
+ });
4144
+ return image;
4145
+ } catch (e) {
4146
+ throw new EnsAvatarUriResolutionError({ uri });
4147
+ }
4148
+ }
4149
+ async function parseAvatarUri({
4150
+ gatewayUrls,
4151
+ uri
4152
+ }) {
4153
+ const { uri: resolvedURI, isOnChain } = resolveAvatarUri({ uri, gatewayUrls });
4154
+ if (isOnChain)
4155
+ return resolvedURI;
4156
+ const isImage = await isImageUri(resolvedURI);
4157
+ if (isImage)
4158
+ return resolvedURI;
4159
+ throw new EnsAvatarUriResolutionError({ uri });
4160
+ }
4161
+ function parseNftUri(uri) {
4162
+ if (uri.startsWith("did:nft:")) {
4163
+ uri = uri.replace("did:nft:", "").replace(/_/g, "/");
4164
+ }
4165
+ const [reference, asset_namespace, tokenID] = uri.split("/");
4166
+ const [eip_namespace, chainID] = reference.split(":");
4167
+ const [erc_namespace, contractAddress] = asset_namespace.split(":");
4168
+ if (!eip_namespace || eip_namespace.toLowerCase() !== "eip155")
4169
+ throw new EnsAvatarInvalidNftUriError({ reason: "Only EIP-155 supported" });
4170
+ if (!chainID)
4171
+ throw new EnsAvatarInvalidNftUriError({ reason: "Chain ID not found" });
4172
+ if (!contractAddress)
4173
+ throw new EnsAvatarInvalidNftUriError({
4174
+ reason: "Contract address not found"
4175
+ });
4176
+ if (!tokenID)
4177
+ throw new EnsAvatarInvalidNftUriError({ reason: "Token ID not found" });
4178
+ if (!erc_namespace)
4179
+ throw new EnsAvatarInvalidNftUriError({ reason: "ERC namespace not found" });
4180
+ return {
4181
+ chainID: parseInt(chainID),
4182
+ namespace: erc_namespace.toLowerCase(),
4183
+ contractAddress,
4184
+ tokenID
4185
+ };
4186
+ }
4187
+ async function getNftTokenUri(client, { nft }) {
4188
+ if (nft.namespace === "erc721") {
4189
+ return readContract(client, {
4190
+ address: nft.contractAddress,
4191
+ abi: [
4192
+ {
4193
+ name: "tokenURI",
4194
+ type: "function",
4195
+ stateMutability: "view",
4196
+ inputs: [{ name: "tokenId", type: "uint256" }],
4197
+ outputs: [{ name: "", type: "string" }]
4198
+ }
4199
+ ],
4200
+ functionName: "tokenURI",
4201
+ args: [BigInt(nft.tokenID)]
4202
+ });
4203
+ }
4204
+ if (nft.namespace === "erc1155") {
4205
+ return readContract(client, {
4206
+ address: nft.contractAddress,
4207
+ abi: [
4208
+ {
4209
+ name: "uri",
4210
+ type: "function",
4211
+ stateMutability: "view",
4212
+ inputs: [{ name: "_id", type: "uint256" }],
4213
+ outputs: [{ name: "", type: "string" }]
4214
+ }
4215
+ ],
4216
+ functionName: "uri",
4217
+ args: [BigInt(nft.tokenID)]
4218
+ });
4219
+ }
4220
+ throw new EnsAvatarUnsupportedNamespaceError({ namespace: nft.namespace });
4221
+ }
4222
+
4223
+ // src/utils/ens/avatar/parseAvatarRecord.ts
4224
+ async function parseAvatarRecord(client, {
4225
+ gatewayUrls,
4226
+ record
4227
+ }) {
4228
+ if (/eip155:/i.test(record))
4229
+ return parseNftAvatarUri(client, { gatewayUrls, record });
4230
+ return parseAvatarUri({ uri: record, gatewayUrls });
4231
+ }
4232
+ async function parseNftAvatarUri(client, {
4233
+ gatewayUrls,
4234
+ record
4235
+ }) {
4236
+ const nft = parseNftUri(record);
4237
+ const nftUri = await getNftTokenUri(client, { nft });
4238
+ const {
4239
+ uri: resolvedNftUri,
4240
+ isOnChain,
4241
+ isEncoded
4242
+ } = resolveAvatarUri({ uri: nftUri, gatewayUrls });
4243
+ if (isOnChain && (resolvedNftUri.includes("data:application/json;base64,") || resolvedNftUri.startsWith("{"))) {
4244
+ const encodedJson = isEncoded ? (
4245
+ // if it is encoded, decode it
4246
+ atob(resolvedNftUri.replace("data:application/json;base64,", ""))
4247
+ ) : (
4248
+ // if it isn't encoded assume it is a JSON string, but it could be anything (it will error if it is)
4249
+ resolvedNftUri
4250
+ );
4251
+ const decoded = JSON.parse(encodedJson);
4252
+ return parseAvatarUri({ uri: getJsonImage(decoded), gatewayUrls });
4253
+ }
4254
+ let uriTokenId = nft.tokenID;
4255
+ if (nft.namespace === "erc1155")
4256
+ uriTokenId = uriTokenId.replace("0x", "").padStart(64, "0");
4257
+ return getMetadataAvatarUri({
4258
+ gatewayUrls,
4259
+ uri: resolvedNftUri.replace(/(?:0x)?{id}/, uriTokenId)
4260
+ });
4261
+ }
4262
+
4263
+ // src/utils/ens/labelhash.ts
4264
+ function labelhash(label) {
4265
+ let result = new Uint8Array(32).fill(0);
4266
+ if (!label)
4267
+ return bytesToHex(result);
4268
+ return keccak256(stringToBytes(label));
4269
+ }
4270
+
4271
+ // src/utils/ens/namehash.ts
4272
+ function namehash(name) {
4273
+ let result = new Uint8Array(32).fill(0);
4274
+ if (!name)
4275
+ return bytesToHex(result);
4276
+ const labels = name.split(".");
4277
+ for (let i = labels.length - 1; i >= 0; i -= 1) {
4278
+ const hashed = keccak256(stringToBytes(labels[i]), "bytes");
4279
+ result = keccak256(concat([result, hashed]), "bytes");
4280
+ }
4281
+ return bytesToHex(result);
4282
+ }
4283
+
4284
+ // src/utils/ens/packetToBytes.ts
4285
+ function packetToBytes(packet) {
4286
+ function length(value2) {
4287
+ if (value2 === "." || value2 === "..")
4288
+ return 1;
4289
+ return toBytes(value2.replace(/^\.|\.$/gm, "")).length + 2;
4290
+ }
4291
+ const bytes = new Uint8Array(length(packet));
4292
+ const value = packet.replace(/^\.|\.$/gm, "");
4293
+ if (!value.length)
4294
+ return bytes;
4295
+ let offset = 0;
4296
+ const list = value.split(".");
4297
+ for (let i = 0; i < list.length; i++) {
4298
+ const encoded = toBytes(list[i]);
4299
+ bytes[offset] = encoded.length;
4300
+ bytes.set(encoded, offset + 1);
4301
+ offset += encoded.length + 1;
4302
+ }
4303
+ return bytes;
4304
+ }
4305
+
3960
4306
  // src/actions/public/call.ts
3961
4307
  async function call(client, args) {
3962
4308
  const {
@@ -3978,10 +4324,10 @@ async function call(client, args) {
3978
4324
  try {
3979
4325
  assertRequest(args);
3980
4326
  const blockNumberHex = blockNumber ? numberToHex(blockNumber) : void 0;
3981
- const formatter = _optionalChain([client, 'access', _93 => _93.chain, 'optionalAccess', _94 => _94.formatters, 'optionalAccess', _95 => _95.transactionRequest]);
4327
+ const formatter = _optionalChain([client, 'access', _100 => _100.chain, 'optionalAccess', _101 => _101.formatters, 'optionalAccess', _102 => _102.transactionRequest]);
3982
4328
  const request_ = format3(
3983
4329
  {
3984
- from: _optionalChain([account, 'optionalAccess', _96 => _96.address]),
4330
+ from: _optionalChain([account, 'optionalAccess', _103 => _103.address]),
3985
4331
  accessList,
3986
4332
  data,
3987
4333
  gas,
@@ -4057,7 +4403,7 @@ async function simulateContract(client, {
4057
4403
  args,
4058
4404
  docsPath: "/docs/contract/simulateContract",
4059
4405
  functionName,
4060
- sender: _optionalChain([account, 'optionalAccess', _97 => _97.address])
4406
+ sender: _optionalChain([account, 'optionalAccess', _104 => _104.address])
4061
4407
  });
4062
4408
  }
4063
4409
  }
@@ -4171,7 +4517,7 @@ async function estimateGas(client, args) {
4171
4517
  } = account.type === "local" ? await prepareRequest(client, args) : args;
4172
4518
  const blockNumberHex = blockNumber ? numberToHex(blockNumber) : void 0;
4173
4519
  assertRequest(args);
4174
- const formatter = _optionalChain([client, 'access', _98 => _98.chain, 'optionalAccess', _99 => _99.formatters, 'optionalAccess', _100 => _100.transactionRequest]);
4520
+ const formatter = _optionalChain([client, 'access', _105 => _105.chain, 'optionalAccess', _106 => _106.formatters, 'optionalAccess', _107 => _107.transactionRequest]);
4175
4521
  const request = format3(
4176
4522
  {
4177
4523
  from: account.address,
@@ -4233,7 +4579,7 @@ async function estimateContractGas(client, {
4233
4579
  args,
4234
4580
  docsPath: "/docs/contract/simulateContract",
4235
4581
  functionName,
4236
- sender: _optionalChain([account, 'optionalAccess', _101 => _101.address])
4582
+ sender: _optionalChain([account, 'optionalAccess', _108 => _108.address])
4237
4583
  });
4238
4584
  }
4239
4585
  }
@@ -4271,7 +4617,7 @@ async function getBlock(client, {
4271
4617
  if (!block)
4272
4618
  throw new BlockNotFoundError({ blockHash, blockNumber });
4273
4619
  return format3(block, {
4274
- formatter: _optionalChain([client, 'access', _102 => _102.chain, 'optionalAccess', _103 => _103.formatters, 'optionalAccess', _104 => _104.block]) || formatBlock
4620
+ formatter: _optionalChain([client, 'access', _109 => _109.chain, 'optionalAccess', _110 => _110.formatters, 'optionalAccess', _111 => _111.block]) || formatBlock
4275
4621
  });
4276
4622
  }
4277
4623
 
@@ -4483,7 +4829,7 @@ async function getTransaction(client, {
4483
4829
  index
4484
4830
  });
4485
4831
  return format3(transaction, {
4486
- formatter: _optionalChain([client, 'access', _105 => _105.chain, 'optionalAccess', _106 => _106.formatters, 'optionalAccess', _107 => _107.transaction]) || formatTransaction
4832
+ formatter: _optionalChain([client, 'access', _112 => _112.chain, 'optionalAccess', _113 => _113.formatters, 'optionalAccess', _114 => _114.transaction]) || formatTransaction
4487
4833
  });
4488
4834
  }
4489
4835
 
@@ -4493,7 +4839,7 @@ async function getTransactionConfirmations(client, { hash: hash2, transactionRec
4493
4839
  getBlockNumber(client),
4494
4840
  hash2 ? getTransaction(client, { hash: hash2 }) : void 0
4495
4841
  ]);
4496
- const transactionBlockNumber = _optionalChain([transactionReceipt, 'optionalAccess', _108 => _108.blockNumber]) || _optionalChain([transaction, 'optionalAccess', _109 => _109.blockNumber]);
4842
+ const transactionBlockNumber = _optionalChain([transactionReceipt, 'optionalAccess', _115 => _115.blockNumber]) || _optionalChain([transaction, 'optionalAccess', _116 => _116.blockNumber]);
4497
4843
  if (!transactionBlockNumber)
4498
4844
  return 0n;
4499
4845
  return blockNumber - transactionBlockNumber + 1n;
@@ -4517,7 +4863,7 @@ async function getTransactionReceipt(client, { hash: hash2 }) {
4517
4863
  if (!receipt)
4518
4864
  throw new TransactionReceiptNotFoundError({ hash: hash2 });
4519
4865
  return format3(receipt, {
4520
- formatter: _optionalChain([client, 'access', _110 => _110.chain, 'optionalAccess', _111 => _111.formatters, 'optionalAccess', _112 => _112.transactionReceipt]) || formatTransactionReceipt
4866
+ formatter: _optionalChain([client, 'access', _117 => _117.chain, 'optionalAccess', _118 => _118.formatters, 'optionalAccess', _119 => _119.transactionReceipt]) || formatTransactionReceipt
4521
4867
  });
4522
4868
  }
4523
4869
 
@@ -4686,7 +5032,7 @@ function observe(observerId, callbacks, fn) {
4686
5032
  const listeners2 = getListeners();
4687
5033
  if (listeners2.length === 0)
4688
5034
  return;
4689
- listeners2.forEach((listener) => _optionalChain([listener, 'access', _113 => _113.fns, 'access', _114 => _114[key], 'optionalCall', _115 => _115(...args)]));
5035
+ listeners2.forEach((listener) => _optionalChain([listener, 'access', _120 => _120.fns, 'access', _121 => _121[key], 'optionalCall', _122 => _122(...args)]));
4690
5036
  };
4691
5037
  }
4692
5038
  const cleanup = fn(emit);
@@ -4768,7 +5114,7 @@ async function waitForTransactionReceipt(client, {
4768
5114
  reason = "cancelled";
4769
5115
  }
4770
5116
  done(() => {
4771
- _optionalChain([emit, 'access', _116 => _116.onReplaced, 'optionalCall', _117 => _117({
5117
+ _optionalChain([emit, 'access', _123 => _123.onReplaced, 'optionalCall', _124 => _124({
4772
5118
  reason,
4773
5119
  replacedTransaction,
4774
5120
  transaction: replacementTransaction,
@@ -4796,7 +5142,7 @@ function poll(fn, { emitOnBegin, initialWaitTime, interval }) {
4796
5142
  let data;
4797
5143
  if (emitOnBegin)
4798
5144
  data = await fn({ unpoll: unwatch });
4799
- const initialWait = await _asyncNullishCoalesce(await _optionalChain([initialWaitTime, 'optionalCall', _118 => _118(data)]), async () => ( interval));
5145
+ const initialWait = await _asyncNullishCoalesce(await _optionalChain([initialWaitTime, 'optionalCall', _125 => _125(data)]), async () => ( interval));
4800
5146
  await wait(initialWait);
4801
5147
  const poll2 = async () => {
4802
5148
  if (!active)
@@ -4852,7 +5198,7 @@ function watchBlockNumber(client, {
4852
5198
  prevBlockNumber = blockNumber;
4853
5199
  }
4854
5200
  } catch (err) {
4855
- _optionalChain([emit, 'access', _119 => _119.onError, 'optionalCall', _120 => _120(err)]);
5201
+ _optionalChain([emit, 'access', _126 => _126.onError, 'optionalCall', _127 => _127(err)]);
4856
5202
  }
4857
5203
  },
4858
5204
  {
@@ -4872,19 +5218,19 @@ function watchBlockNumber(client, {
4872
5218
  onData(data) {
4873
5219
  if (!active)
4874
5220
  return;
4875
- const blockNumber = hexToBigInt(_optionalChain([data, 'access', _121 => _121.result, 'optionalAccess', _122 => _122.number]));
5221
+ const blockNumber = hexToBigInt(_optionalChain([data, 'access', _128 => _128.result, 'optionalAccess', _129 => _129.number]));
4876
5222
  onBlockNumber(blockNumber, prevBlockNumber);
4877
5223
  prevBlockNumber = blockNumber;
4878
5224
  },
4879
5225
  onError(error) {
4880
- _optionalChain([onError, 'optionalCall', _123 => _123(error)]);
5226
+ _optionalChain([onError, 'optionalCall', _130 => _130(error)]);
4881
5227
  }
4882
5228
  });
4883
5229
  unsubscribe = unsubscribe_;
4884
5230
  if (!active)
4885
5231
  unsubscribe();
4886
5232
  } catch (err) {
4887
- _optionalChain([onError, 'optionalCall', _124 => _124(err)]);
5233
+ _optionalChain([onError, 'optionalCall', _131 => _131(err)]);
4888
5234
  }
4889
5235
  })();
4890
5236
  return unsubscribe;
@@ -4924,11 +5270,11 @@ function watchBlocks(client, {
4924
5270
  blockTag,
4925
5271
  includeTransactions
4926
5272
  });
4927
- if (block.number && _optionalChain([prevBlock, 'optionalAccess', _125 => _125.number])) {
5273
+ if (block.number && _optionalChain([prevBlock, 'optionalAccess', _132 => _132.number])) {
4928
5274
  if (block.number === prevBlock.number)
4929
5275
  return;
4930
5276
  if (block.number - prevBlock.number > 1 && emitMissed) {
4931
- for (let i = _optionalChain([prevBlock, 'optionalAccess', _126 => _126.number]) + 1n; i < block.number; i++) {
5277
+ for (let i = _optionalChain([prevBlock, 'optionalAccess', _133 => _133.number]) + 1n; i < block.number; i++) {
4932
5278
  const block2 = await getBlock(client, {
4933
5279
  blockNumber: i,
4934
5280
  includeTransactions
@@ -4940,8 +5286,8 @@ function watchBlocks(client, {
4940
5286
  }
4941
5287
  if (
4942
5288
  // If no previous block exists, emit.
4943
- !_optionalChain([prevBlock, 'optionalAccess', _127 => _127.number]) || // If the block tag is "pending" with no block number, emit.
4944
- blockTag === "pending" && !_optionalChain([block, 'optionalAccess', _128 => _128.number]) || // If the next block number is greater than the previous block number, emit.
5289
+ !_optionalChain([prevBlock, 'optionalAccess', _134 => _134.number]) || // If the block tag is "pending" with no block number, emit.
5290
+ blockTag === "pending" && !_optionalChain([block, 'optionalAccess', _135 => _135.number]) || // If the next block number is greater than the previous block number, emit.
4945
5291
  // We don't want to emit blocks in the past.
4946
5292
  block.number && block.number > prevBlock.number
4947
5293
  ) {
@@ -4949,7 +5295,7 @@ function watchBlocks(client, {
4949
5295
  prevBlock = block;
4950
5296
  }
4951
5297
  } catch (err) {
4952
- _optionalChain([emit, 'access', _129 => _129.onError, 'optionalCall', _130 => _130(err)]);
5298
+ _optionalChain([emit, 'access', _136 => _136.onError, 'optionalCall', _137 => _137(err)]);
4953
5299
  }
4954
5300
  },
4955
5301
  {
@@ -4974,14 +5320,14 @@ function watchBlocks(client, {
4974
5320
  prevBlock = block;
4975
5321
  },
4976
5322
  onError(error) {
4977
- _optionalChain([onError, 'optionalCall', _131 => _131(error)]);
5323
+ _optionalChain([onError, 'optionalCall', _138 => _138(error)]);
4978
5324
  }
4979
5325
  });
4980
5326
  unsubscribe = unsubscribe_;
4981
5327
  if (!active)
4982
5328
  unsubscribe();
4983
5329
  } catch (err) {
4984
- _optionalChain([onError, 'optionalCall', _132 => _132(err)]);
5330
+ _optionalChain([onError, 'optionalCall', _139 => _139(err)]);
4985
5331
  }
4986
5332
  })();
4987
5333
  return unsubscribe;
@@ -5023,7 +5369,7 @@ function watchContractEvent(client, {
5023
5369
  args,
5024
5370
  eventName
5025
5371
  });
5026
- } catch (e) {
5372
+ } catch (e2) {
5027
5373
  }
5028
5374
  initialized = true;
5029
5375
  return;
@@ -5057,7 +5403,7 @@ function watchContractEvent(client, {
5057
5403
  else
5058
5404
  logs.forEach((log) => emit.onLogs([log]));
5059
5405
  } catch (err) {
5060
- _optionalChain([emit, 'access', _133 => _133.onError, 'optionalCall', _134 => _134(err)]);
5406
+ _optionalChain([emit, 'access', _140 => _140.onError, 'optionalCall', _141 => _141(err)]);
5061
5407
  }
5062
5408
  },
5063
5409
  {
@@ -5105,7 +5451,7 @@ function watchEvent(client, {
5105
5451
  args,
5106
5452
  event
5107
5453
  });
5108
- } catch (e2) {
5454
+ } catch (e3) {
5109
5455
  }
5110
5456
  initialized = true;
5111
5457
  return;
@@ -5136,7 +5482,7 @@ function watchEvent(client, {
5136
5482
  else
5137
5483
  logs.forEach((log) => emit.onLogs([log]));
5138
5484
  } catch (err) {
5139
- _optionalChain([emit, 'access', _135 => _135.onError, 'optionalCall', _136 => _136(err)]);
5485
+ _optionalChain([emit, 'access', _142 => _142.onError, 'optionalCall', _143 => _143(err)]);
5140
5486
  }
5141
5487
  },
5142
5488
  {
@@ -5190,7 +5536,7 @@ function watchPendingTransactions(client, {
5190
5536
  else
5191
5537
  hashes.forEach((hash2) => emit.onTransactions([hash2]));
5192
5538
  } catch (err) {
5193
- _optionalChain([emit, 'access', _137 => _137.onError, 'optionalCall', _138 => _138(err)]);
5539
+ _optionalChain([emit, 'access', _144 => _144.onError, 'optionalCall', _145 => _145(err)]);
5194
5540
  }
5195
5541
  },
5196
5542
  {
@@ -5219,14 +5565,14 @@ function watchPendingTransactions(client, {
5219
5565
  onTransactions([transaction]);
5220
5566
  },
5221
5567
  onError(error) {
5222
- _optionalChain([onError, 'optionalCall', _139 => _139(error)]);
5568
+ _optionalChain([onError, 'optionalCall', _146 => _146(error)]);
5223
5569
  }
5224
5570
  });
5225
5571
  unsubscribe = unsubscribe_;
5226
5572
  if (!active)
5227
5573
  unsubscribe();
5228
5574
  } catch (err) {
5229
- _optionalChain([onError, 'optionalCall', _140 => _140(err)]);
5575
+ _optionalChain([onError, 'optionalCall', _147 => _147(err)]);
5230
5576
  }
5231
5577
  })();
5232
5578
  return unsubscribe;
@@ -5234,6 +5580,202 @@ function watchPendingTransactions(client, {
5234
5580
  return enablePolling ? pollPendingTransactions() : subscribePendingTransactions();
5235
5581
  }
5236
5582
 
5583
+ // src/actions/ens/getEnsAddress.ts
5584
+ async function getEnsAddress(client, {
5585
+ blockNumber,
5586
+ blockTag,
5587
+ name,
5588
+ universalResolverAddress: universalResolverAddress_
5589
+ }) {
5590
+ let universalResolverAddress = universalResolverAddress_;
5591
+ if (!universalResolverAddress) {
5592
+ if (!client.chain)
5593
+ throw new Error(
5594
+ "client chain not configured. universalResolverAddress is required."
5595
+ );
5596
+ universalResolverAddress = getChainContractAddress({
5597
+ blockNumber,
5598
+ chain: client.chain,
5599
+ contract: "ensUniversalResolver"
5600
+ });
5601
+ }
5602
+ const res = await readContract(client, {
5603
+ address: universalResolverAddress,
5604
+ abi: universalResolverAbi,
5605
+ functionName: "resolve",
5606
+ args: [
5607
+ toHex(packetToBytes(name)),
5608
+ encodeFunctionData({
5609
+ abi: singleAddressResolverAbi,
5610
+ functionName: "addr",
5611
+ args: [namehash(name)]
5612
+ })
5613
+ ],
5614
+ blockNumber,
5615
+ blockTag
5616
+ });
5617
+ return decodeFunctionResult({
5618
+ abi: singleAddressResolverAbi,
5619
+ functionName: "addr",
5620
+ data: res[0]
5621
+ });
5622
+ }
5623
+
5624
+ // src/actions/ens/getEnsText.ts
5625
+ async function getEnsText(client, {
5626
+ blockNumber,
5627
+ blockTag,
5628
+ name,
5629
+ key,
5630
+ universalResolverAddress: universalResolverAddress_
5631
+ }) {
5632
+ let universalResolverAddress = universalResolverAddress_;
5633
+ if (!universalResolverAddress) {
5634
+ if (!client.chain)
5635
+ throw new Error(
5636
+ "client chain not configured. universalResolverAddress is required."
5637
+ );
5638
+ universalResolverAddress = getChainContractAddress({
5639
+ blockNumber,
5640
+ chain: client.chain,
5641
+ contract: "ensUniversalResolver"
5642
+ });
5643
+ }
5644
+ const res = await readContract(client, {
5645
+ address: universalResolverAddress,
5646
+ abi: universalResolverAbi,
5647
+ functionName: "resolve",
5648
+ args: [
5649
+ toHex(packetToBytes(name)),
5650
+ encodeFunctionData({
5651
+ abi: textResolverAbi,
5652
+ functionName: "text",
5653
+ args: [namehash(name), key]
5654
+ })
5655
+ ],
5656
+ blockNumber,
5657
+ blockTag
5658
+ });
5659
+ const record = decodeFunctionResult({
5660
+ abi: textResolverAbi,
5661
+ functionName: "text",
5662
+ data: res[0]
5663
+ });
5664
+ return record === "" ? null : record;
5665
+ }
5666
+
5667
+ // src/actions/ens/getEnsAvatar.ts
5668
+ async function getEnsAvatar(client, {
5669
+ blockNumber,
5670
+ blockTag,
5671
+ gatewayUrls,
5672
+ name,
5673
+ universalResolverAddress
5674
+ }) {
5675
+ const record = await getEnsText(client, {
5676
+ blockNumber,
5677
+ blockTag,
5678
+ key: "avatar",
5679
+ name,
5680
+ universalResolverAddress
5681
+ });
5682
+ if (!record)
5683
+ return null;
5684
+ try {
5685
+ return await parseAvatarRecord(client, { record, gatewayUrls });
5686
+ } catch (e4) {
5687
+ return null;
5688
+ }
5689
+ }
5690
+
5691
+ // src/actions/ens/getEnsName.ts
5692
+ async function getEnsName(client, {
5693
+ address,
5694
+ blockNumber,
5695
+ blockTag,
5696
+ universalResolverAddress: universalResolverAddress_
5697
+ }) {
5698
+ let universalResolverAddress = universalResolverAddress_;
5699
+ if (!universalResolverAddress) {
5700
+ if (!client.chain)
5701
+ throw new Error(
5702
+ "client chain not configured. universalResolverAddress is required."
5703
+ );
5704
+ universalResolverAddress = getChainContractAddress({
5705
+ blockNumber,
5706
+ chain: client.chain,
5707
+ contract: "ensUniversalResolver"
5708
+ });
5709
+ }
5710
+ const reverseNode = `${address.toLowerCase().substring(2)}.addr.reverse`;
5711
+ try {
5712
+ const res = await readContract(client, {
5713
+ address: universalResolverAddress,
5714
+ abi: [
5715
+ {
5716
+ name: "reverse",
5717
+ type: "function",
5718
+ stateMutability: "view",
5719
+ inputs: [{ type: "bytes", name: "reverseName" }],
5720
+ outputs: [
5721
+ { type: "string", name: "resolvedName" },
5722
+ { type: "address", name: "resolvedAddress" },
5723
+ { type: "address", name: "reverseResolver" },
5724
+ { type: "address", name: "resolver" }
5725
+ ]
5726
+ }
5727
+ ],
5728
+ functionName: "reverse",
5729
+ args: [toHex(packetToBytes(reverseNode))],
5730
+ blockNumber,
5731
+ blockTag
5732
+ });
5733
+ return res[0];
5734
+ } catch (error) {
5735
+ if (error instanceof ContractFunctionExecutionError && error.cause.reason === panicReasons[50])
5736
+ return null;
5737
+ throw error;
5738
+ }
5739
+ }
5740
+
5741
+ // src/actions/ens/getEnsResolver.ts
5742
+ async function getEnsResolver(client, {
5743
+ blockNumber,
5744
+ blockTag,
5745
+ name,
5746
+ universalResolverAddress: universalResolverAddress_
5747
+ }) {
5748
+ let universalResolverAddress = universalResolverAddress_;
5749
+ if (!universalResolverAddress) {
5750
+ if (!client.chain)
5751
+ throw new Error(
5752
+ "client chain not configured. universalResolverAddress is required."
5753
+ );
5754
+ universalResolverAddress = getChainContractAddress({
5755
+ blockNumber,
5756
+ chain: client.chain,
5757
+ contract: "ensUniversalResolver"
5758
+ });
5759
+ }
5760
+ const [resolverAddress] = await readContract(client, {
5761
+ address: universalResolverAddress,
5762
+ abi: [
5763
+ {
5764
+ inputs: [{ type: "bytes" }],
5765
+ name: "findResolver",
5766
+ outputs: [{ type: "address" }, { type: "bytes32" }],
5767
+ stateMutability: "view",
5768
+ type: "function"
5769
+ }
5770
+ ],
5771
+ functionName: "findResolver",
5772
+ args: [toHex(packetToBytes(name))],
5773
+ blockNumber,
5774
+ blockTag
5775
+ });
5776
+ return resolverAddress;
5777
+ }
5778
+
5237
5779
  // src/actions/test/dropTransaction.ts
5238
5780
  async function dropTransaction(client, { hash: hash2 }) {
5239
5781
  return await client.request({
@@ -5547,7 +6089,7 @@ async function sendTransaction(client, args) {
5547
6089
  try {
5548
6090
  assertRequest(args);
5549
6091
  const chainId = await getChainId(client);
5550
- if (chain !== null && chainId !== _optionalChain([chain, 'optionalAccess', _141 => _141.id])) {
6092
+ if (chain !== null && chainId !== _optionalChain([chain, 'optionalAccess', _148 => _148.id])) {
5551
6093
  if (!chain)
5552
6094
  throw new ChainNotFoundError();
5553
6095
  throw new ChainMismatchError({ chain, currentChainId: chainId });
@@ -5576,7 +6118,7 @@ async function sendTransaction(client, args) {
5576
6118
  params: [signedRequest]
5577
6119
  });
5578
6120
  }
5579
- const formatter = _optionalChain([chain, 'optionalAccess', _142 => _142.formatters, 'optionalAccess', _143 => _143.transactionRequest]);
6121
+ const formatter = _optionalChain([chain, 'optionalAccess', _149 => _149.formatters, 'optionalAccess', _150 => _150.transactionRequest]);
5580
6122
  const request = format3(
5581
6123
  {
5582
6124
  accessList,
@@ -5642,14 +6184,14 @@ async function signTypedData(client, {
5642
6184
  const account = parseAccount(account_);
5643
6185
  const types = {
5644
6186
  EIP712Domain: [
5645
- _optionalChain([domain, 'optionalAccess', _144 => _144.name]) && { name: "name", type: "string" },
5646
- _optionalChain([domain, 'optionalAccess', _145 => _145.version]) && { name: "version", type: "string" },
5647
- _optionalChain([domain, 'optionalAccess', _146 => _146.chainId]) && { name: "chainId", type: "uint256" },
5648
- _optionalChain([domain, 'optionalAccess', _147 => _147.verifyingContract]) && {
6187
+ _optionalChain([domain, 'optionalAccess', _151 => _151.name]) && { name: "name", type: "string" },
6188
+ _optionalChain([domain, 'optionalAccess', _152 => _152.version]) && { name: "version", type: "string" },
6189
+ _optionalChain([domain, 'optionalAccess', _153 => _153.chainId]) && { name: "chainId", type: "uint256" },
6190
+ _optionalChain([domain, 'optionalAccess', _154 => _154.verifyingContract]) && {
5649
6191
  name: "verifyingContract",
5650
6192
  type: "address"
5651
6193
  },
5652
- _optionalChain([domain, 'optionalAccess', _148 => _148.salt]) && { name: "salt", type: "bytes32" }
6194
+ _optionalChain([domain, 'optionalAccess', _155 => _155.salt]) && { name: "salt", type: "bytes32" }
5653
6195
  ].filter(Boolean),
5654
6196
  ...types_
5655
6197
  };
@@ -5718,6 +6260,176 @@ async function writeContract(client, {
5718
6260
  return hash2;
5719
6261
  }
5720
6262
 
6263
+ // src/actions/getContract.ts
6264
+ function getContract({
6265
+ abi,
6266
+ address,
6267
+ publicClient,
6268
+ walletClient
6269
+ }) {
6270
+ const hasPublicClient = publicClient !== void 0 && publicClient !== null;
6271
+ const hasWalletClient = walletClient !== void 0 && walletClient !== null;
6272
+ const contract = {};
6273
+ let hasReadFunction = false;
6274
+ let hasWriteFunction = false;
6275
+ let hasEvent = false;
6276
+ for (const item of abi) {
6277
+ if (item.type === "function")
6278
+ if (item.stateMutability === "view" || item.stateMutability === "pure")
6279
+ hasReadFunction = true;
6280
+ else
6281
+ hasWriteFunction = true;
6282
+ else if (item.type === "event")
6283
+ hasEvent = true;
6284
+ if (hasReadFunction && hasWriteFunction && hasEvent)
6285
+ break;
6286
+ }
6287
+ if (hasPublicClient) {
6288
+ if (hasReadFunction)
6289
+ contract.read = new Proxy(
6290
+ {},
6291
+ {
6292
+ get(_, functionName) {
6293
+ return (...parameters) => {
6294
+ const { args, options } = getFunctionParameters(parameters);
6295
+ return readContract(publicClient, {
6296
+ abi,
6297
+ address,
6298
+ functionName,
6299
+ args,
6300
+ ...options
6301
+ });
6302
+ };
6303
+ }
6304
+ }
6305
+ );
6306
+ if (hasWriteFunction) {
6307
+ contract.estimateGas = new Proxy(
6308
+ {},
6309
+ {
6310
+ get(_, functionName) {
6311
+ return (...parameters) => {
6312
+ const { args, options } = getFunctionParameters(parameters);
6313
+ return estimateContractGas(publicClient, {
6314
+ abi,
6315
+ address,
6316
+ functionName,
6317
+ args,
6318
+ ...options
6319
+ });
6320
+ };
6321
+ }
6322
+ }
6323
+ );
6324
+ contract.simulate = new Proxy(
6325
+ {},
6326
+ {
6327
+ get(_, functionName) {
6328
+ return (...parameters) => {
6329
+ const { args, options } = getFunctionParameters(parameters);
6330
+ return simulateContract(publicClient, {
6331
+ abi,
6332
+ address,
6333
+ functionName,
6334
+ args,
6335
+ ...options
6336
+ });
6337
+ };
6338
+ }
6339
+ }
6340
+ );
6341
+ }
6342
+ if (hasEvent) {
6343
+ contract.createEventFilter = new Proxy(
6344
+ {},
6345
+ {
6346
+ get(_, eventName) {
6347
+ return (...parameters) => {
6348
+ const abiEvent = abi.find(
6349
+ (x) => x.type === "event" && x.name === eventName
6350
+ );
6351
+ const { args, options } = getEventParameters(
6352
+ parameters,
6353
+ abiEvent
6354
+ );
6355
+ return createContractEventFilter(publicClient, {
6356
+ abi,
6357
+ address,
6358
+ eventName,
6359
+ args,
6360
+ ...options
6361
+ });
6362
+ };
6363
+ }
6364
+ }
6365
+ );
6366
+ contract.watchEvent = new Proxy(
6367
+ {},
6368
+ {
6369
+ get(_, eventName) {
6370
+ return (...parameters) => {
6371
+ const abiEvent = abi.find(
6372
+ (x) => x.type === "event" && x.name === eventName
6373
+ );
6374
+ const { args, options } = getEventParameters(
6375
+ parameters,
6376
+ abiEvent
6377
+ );
6378
+ return watchContractEvent(publicClient, {
6379
+ abi,
6380
+ address,
6381
+ eventName,
6382
+ args,
6383
+ ...options
6384
+ });
6385
+ };
6386
+ }
6387
+ }
6388
+ );
6389
+ }
6390
+ }
6391
+ if (hasWalletClient) {
6392
+ if (hasWriteFunction)
6393
+ contract.write = new Proxy(
6394
+ {},
6395
+ {
6396
+ get(_, functionName) {
6397
+ return (...parameters) => {
6398
+ const { args, options } = getFunctionParameters(parameters);
6399
+ return writeContract(walletClient, {
6400
+ abi,
6401
+ address,
6402
+ functionName,
6403
+ args,
6404
+ ...options
6405
+ });
6406
+ };
6407
+ }
6408
+ }
6409
+ );
6410
+ }
6411
+ return contract;
6412
+ }
6413
+ function getFunctionParameters(values) {
6414
+ const hasArgs = values.length && Array.isArray(values[0]);
6415
+ const args = hasArgs ? values[0] : [];
6416
+ const options = _nullishCoalesce((hasArgs ? values[1] : values[0]), () => ( {}));
6417
+ return { args, options };
6418
+ }
6419
+ function getEventParameters(values, abiEvent) {
6420
+ let hasArgs = false;
6421
+ if (Array.isArray(values[0]))
6422
+ hasArgs = true;
6423
+ else if (values.length === 1) {
6424
+ hasArgs = abiEvent.inputs.some((x) => x.indexed);
6425
+ } else if (values.length === 2) {
6426
+ hasArgs = true;
6427
+ }
6428
+ const args = hasArgs ? values[0] : void 0;
6429
+ const options = _nullishCoalesce((hasArgs ? values[1] : values[0]), () => ( {}));
6430
+ return { args, options };
6431
+ }
6432
+
5721
6433
  // src/utils/unit/parseUnits.ts
5722
6434
  function parseUnits(value, decimals) {
5723
6435
  let [integer, fraction = "0"] = value.split(".");
@@ -6497,5 +7209,14 @@ function parseEther(ether, unit = "wei") {
6497
7209
 
6498
7210
 
6499
7211
 
6500
- exports.BaseError = BaseError; exports.AbiConstructorNotFoundError = AbiConstructorNotFoundError; exports.AbiConstructorParamsNotFoundError = AbiConstructorParamsNotFoundError; exports.AbiDecodingDataSizeInvalidError = AbiDecodingDataSizeInvalidError; exports.AbiDecodingZeroDataError = AbiDecodingZeroDataError; exports.AbiEncodingArrayLengthMismatchError = AbiEncodingArrayLengthMismatchError; exports.AbiEncodingLengthMismatchError = AbiEncodingLengthMismatchError; exports.AbiErrorInputsNotFoundError = AbiErrorInputsNotFoundError; exports.AbiErrorNotFoundError = AbiErrorNotFoundError; exports.AbiErrorSignatureNotFoundError = AbiErrorSignatureNotFoundError; exports.AbiEventSignatureEmptyTopicsError = AbiEventSignatureEmptyTopicsError; exports.AbiEventSignatureNotFoundError = AbiEventSignatureNotFoundError; exports.AbiEventNotFoundError = AbiEventNotFoundError; exports.AbiFunctionNotFoundError = AbiFunctionNotFoundError; exports.AbiFunctionOutputsNotFoundError = AbiFunctionOutputsNotFoundError; exports.AbiFunctionSignatureNotFoundError = AbiFunctionSignatureNotFoundError; exports.DecodeLogTopicsMismatch = DecodeLogTopicsMismatch; exports.InvalidAbiEncodingTypeError = InvalidAbiEncodingTypeError; exports.InvalidAbiDecodingTypeError = InvalidAbiDecodingTypeError; exports.InvalidArrayError = InvalidArrayError; exports.InvalidDefinitionTypeError = InvalidDefinitionTypeError; exports.InvalidAddressError = InvalidAddressError; exports.BlockNotFoundError = BlockNotFoundError; exports.ChainDoesNotSupportContract = ChainDoesNotSupportContract; exports.InvalidChainIdError = InvalidChainIdError; exports.multicall3Abi = multicall3Abi; exports.panicReasons = panicReasons; exports.etherUnits = etherUnits; exports.gweiUnits = gweiUnits; exports.weiUnits = weiUnits; exports.InvalidLegacyVError = InvalidLegacyVError; exports.TransactionExecutionError = TransactionExecutionError; exports.TransactionNotFoundError = TransactionNotFoundError; exports.TransactionReceiptNotFoundError = TransactionReceiptNotFoundError; exports.WaitForTransactionReceiptTimeoutError = WaitForTransactionReceiptTimeoutError; exports.CallExecutionError = CallExecutionError; exports.ContractFunctionExecutionError = ContractFunctionExecutionError; exports.ContractFunctionRevertedError = ContractFunctionRevertedError; exports.ContractFunctionZeroDataError = ContractFunctionZeroDataError; exports.RawContractError = RawContractError; exports.SizeExceedsPaddingSizeError = SizeExceedsPaddingSizeError; exports.DataLengthTooLongError = DataLengthTooLongError; exports.DataLengthTooShortError = DataLengthTooShortError; exports.InvalidBytesBooleanError = InvalidBytesBooleanError; exports.InvalidHexBooleanError = InvalidHexBooleanError; exports.InvalidHexValueError = InvalidHexValueError; exports.OffsetOutOfBoundsError = OffsetOutOfBoundsError; exports.EstimateGasExecutionError = EstimateGasExecutionError; exports.FilterTypeNotSupportedError = FilterTypeNotSupportedError; exports.ExecutionRevertedError = ExecutionRevertedError; exports.FeeCapTooHighError = FeeCapTooHighError; exports.FeeCapTooLowError = FeeCapTooLowError; exports.NonceTooHighError = NonceTooHighError; exports.NonceTooLowError = NonceTooLowError; exports.NonceMaxValueError = NonceMaxValueError; exports.InsufficientFundsError = InsufficientFundsError; exports.IntrinsicGasTooHighError = IntrinsicGasTooHighError; exports.IntrinsicGasTooLowError = IntrinsicGasTooLowError; exports.TransactionTypeNotSupportedError = TransactionTypeNotSupportedError; exports.TipAboveFeeCapError = TipAboveFeeCapError; exports.UnknownNodeError = UnknownNodeError; 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.UserRejectedRequestError = UserRejectedRequestError; exports.SwitchChainError = SwitchChainError; exports.UnknownRpcError = UnknownRpcError; exports.HttpRequestError = HttpRequestError; exports.WebSocketRequestError = WebSocketRequestError; exports.RpcError = RpcError; exports.TimeoutError = TimeoutError; exports.UrlRequiredError = UrlRequiredError; exports.concat = concat; exports.concatBytes = concatBytes; exports.concatHex = concatHex; 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.toHex = toHex; exports.numberToHex = numberToHex; exports.stringToHex = stringToHex; exports.toBytes = toBytes; exports.boolToBytes = boolToBytes; exports.hexToBytes = hexToBytes; exports.numberToBytes = numberToBytes; exports.stringToBytes = stringToBytes; exports.toRlp = toRlp; exports.fromHex = fromHex; exports.hexToBigInt = hexToBigInt; exports.hexToBool = hexToBool; exports.hexToNumber = hexToNumber; exports.hexToString = hexToString; exports.fromBytes = fromBytes; exports.bytesToBigint = bytesToBigint; exports.bytesToBool = bytesToBool; exports.bytesToNumber = bytesToNumber; exports.bytesToString = bytesToString; exports.fromRlp = fromRlp; exports.extractFunctionParts = extractFunctionParts; exports.extractFunctionName = extractFunctionName; exports.extractFunctionParams = extractFunctionParams; exports.extractFunctionType = extractFunctionType; exports.keccak256 = keccak256; exports.getEventSelector = getEventSelector; exports.getFunctionSelector = getFunctionSelector; exports.isHash = isHash; exports.isAddress = isAddress; exports.checksumAddress = checksumAddress; exports.getAddress = getAddress; exports.getContractAddress = getContractAddress2; exports.getCreateAddress = getCreateAddress; exports.getCreate2Address = getCreate2Address; exports.isAddressEqual = isAddressEqual; exports.encodeAbiParameters = encodeAbiParameters; exports.decodeAbiParameters = decodeAbiParameters; exports.formatAbiItem = formatAbiItem; exports.decodeErrorResult = decodeErrorResult; exports.decodeEventLog = decodeEventLog; exports.decodeFunctionData = decodeFunctionData; exports.getAbiItem = getAbiItem; exports.decodeFunctionResult = decodeFunctionResult; exports.encodeDeployData = encodeDeployData; exports.encodeErrorResult = encodeErrorResult; exports.encodeEventTopics = encodeEventTopics; exports.encodeFunctionData = encodeFunctionData; exports.encodeFunctionResult = encodeFunctionResult; exports.arrayRegex = arrayRegex; exports.bytesRegex = bytesRegex; exports.integerRegex = integerRegex; exports.encodePacked = encodePacked; exports.formatAbiItemWithArgs = formatAbiItemWithArgs; exports.parseAbi = _abitype.parseAbi; exports.parseAbiItem = _abitype.parseAbiItem; exports.parseAbiParameter = _abitype.parseAbiParameter; exports.parseAbiParameters = _abitype.parseAbiParameters; exports.parseAccount = parseAccount; exports.isDeterministicError = isDeterministicError; exports.buildRequest = buildRequest; exports.defineChain = defineChain; exports.getChainContractAddress = getChainContractAddress; exports.format = format3; exports.defineFormatter = defineFormatter; exports.transactionType = transactionType; exports.formatTransaction = formatTransaction; exports.defineTransaction = defineTransaction; exports.formatBlock = formatBlock; exports.defineBlock = defineBlock; exports.extract = extract; exports.defineTransactionReceipt = defineTransactionReceipt; exports.formatTransactionRequest = formatTransactionRequest; exports.defineTransactionRequest = defineTransactionRequest; exports.containsNodeError = containsNodeError; exports.getNodeError = getNodeError; exports.getCallError = getCallError; exports.getContractError = getContractError; exports.getEstimateGasError = getEstimateGasError; exports.getTransactionError = getTransactionError; exports.stringify = stringify; exports.getSocket = getSocket; exports.rpc = rpc; exports.hashMessage = hashMessage; exports.validateTypedData = validateTypedData; exports.hashTypedData = hashTypedData; exports.recoverAddress = recoverAddress; exports.recoverMessageAddress = recoverMessageAddress; exports.recoverTypedDataAddress = recoverTypedDataAddress; exports.verifyMessage = verifyMessage; exports.verifyTypedData = verifyTypedData; exports.assertRequest = assertRequest; exports.getSerializedTransactionType = getSerializedTransactionType; exports.getTransactionType = getTransactionType; exports.call = call; exports.simulateContract = simulateContract; exports.createPendingTransactionFilter = createPendingTransactionFilter; exports.createBlockFilter = createBlockFilter; exports.createEventFilter = createEventFilter; exports.createContractEventFilter = createContractEventFilter; exports.estimateGas = estimateGas; exports.estimateContractGas = estimateContractGas; 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.getStorageAt = getStorageAt; exports.getTransaction = getTransaction; exports.getTransactionConfirmations = getTransactionConfirmations; exports.getTransactionCount = getTransactionCount; exports.getTransactionReceipt = getTransactionReceipt; exports.readContract = readContract; exports.multicall = multicall; exports.uninstallFilter = uninstallFilter; exports.waitForTransactionReceipt = waitForTransactionReceipt; exports.watchBlockNumber = watchBlockNumber; exports.watchBlocks = watchBlocks; exports.watchContractEvent = watchContractEvent; exports.watchEvent = watchEvent; exports.watchPendingTransactions = watchPendingTransactions; exports.dropTransaction = dropTransaction; exports.getAutomine = getAutomine; exports.getTxpoolContent = getTxpoolContent; exports.getTxpoolStatus = getTxpoolStatus; exports.impersonateAccount = impersonateAccount; exports.increaseTime = increaseTime; exports.inspectTxpool = inspectTxpool; exports.mine = mine; exports.removeBlockTimestampInterval = removeBlockTimestampInterval; exports.reset = reset; exports.revert = revert; exports.sendUnsignedTransaction = sendUnsignedTransaction; exports.setAutomine = setAutomine; exports.setBalance = setBalance; exports.setBlockGasLimit = setBlockGasLimit; exports.setBlockTimestampInterval = setBlockTimestampInterval; exports.setCode = setCode; exports.setCoinbase = setCoinbase; exports.setIntervalMining = setIntervalMining; exports.setLoggingEnabled = setLoggingEnabled; exports.setMinGasPrice = setMinGasPrice; exports.setNextBlockBaseFeePerGas = setNextBlockBaseFeePerGas; exports.setNextBlockTimestamp = setNextBlockTimestamp; exports.setNonce = setNonce; exports.setRpcUrl = setRpcUrl; exports.setStorageAt = setStorageAt; exports.snapshot = snapshot; exports.stopImpersonatingAccount = stopImpersonatingAccount; exports.addChain = addChain; exports.deployContract = deployContract; exports.getAddresses = getAddresses; exports.getPermissions = getPermissions; exports.requestAddresses = requestAddresses; exports.requestPermissions = requestPermissions; exports.sendTransaction = sendTransaction; exports.signMessage = signMessage; exports.signTypedData = signTypedData; exports.switchChain = switchChain; exports.watchAsset = watchAsset; exports.writeContract = writeContract; exports.parseUnits = parseUnits; exports.parseGwei = parseGwei; exports.prepareRequest = prepareRequest; exports.assertTransactionEIP1559 = assertTransactionEIP1559; exports.assertTransactionEIP2930 = assertTransactionEIP2930; exports.assertTransactionLegacy = assertTransactionLegacy; exports.parseTransaction = parseTransaction; exports.serializeTransaction = serializeTransaction; exports.formatUnits = formatUnits; exports.formatEther = formatEther; exports.formatGwei = formatGwei; exports.parseEther = parseEther;
6501
- //# sourceMappingURL=chunk-564BCC7H.js.map
7212
+
7213
+
7214
+
7215
+
7216
+
7217
+
7218
+
7219
+
7220
+
7221
+ exports.multicall3Abi = multicall3Abi; exports.BaseError = BaseError; exports.AbiConstructorNotFoundError = AbiConstructorNotFoundError; exports.AbiConstructorParamsNotFoundError = AbiConstructorParamsNotFoundError; exports.AbiDecodingDataSizeInvalidError = AbiDecodingDataSizeInvalidError; exports.AbiDecodingZeroDataError = AbiDecodingZeroDataError; exports.AbiEncodingArrayLengthMismatchError = AbiEncodingArrayLengthMismatchError; exports.AbiEncodingLengthMismatchError = AbiEncodingLengthMismatchError; exports.AbiErrorInputsNotFoundError = AbiErrorInputsNotFoundError; exports.AbiErrorNotFoundError = AbiErrorNotFoundError; exports.AbiErrorSignatureNotFoundError = AbiErrorSignatureNotFoundError; exports.AbiEventSignatureEmptyTopicsError = AbiEventSignatureEmptyTopicsError; exports.AbiEventSignatureNotFoundError = AbiEventSignatureNotFoundError; exports.AbiEventNotFoundError = AbiEventNotFoundError; exports.AbiFunctionNotFoundError = AbiFunctionNotFoundError; exports.AbiFunctionOutputsNotFoundError = AbiFunctionOutputsNotFoundError; exports.AbiFunctionSignatureNotFoundError = AbiFunctionSignatureNotFoundError; exports.DecodeLogTopicsMismatch = DecodeLogTopicsMismatch; exports.InvalidAbiEncodingTypeError = InvalidAbiEncodingTypeError; exports.InvalidAbiDecodingTypeError = InvalidAbiDecodingTypeError; exports.InvalidArrayError = InvalidArrayError; exports.InvalidDefinitionTypeError = InvalidDefinitionTypeError; exports.InvalidAddressError = InvalidAddressError; exports.BlockNotFoundError = BlockNotFoundError; exports.ChainDoesNotSupportContract = ChainDoesNotSupportContract; exports.InvalidChainIdError = InvalidChainIdError; exports.etherUnits = etherUnits; exports.gweiUnits = gweiUnits; exports.weiUnits = weiUnits; exports.InvalidLegacyVError = InvalidLegacyVError; exports.TransactionExecutionError = TransactionExecutionError; exports.TransactionNotFoundError = TransactionNotFoundError; exports.TransactionReceiptNotFoundError = TransactionReceiptNotFoundError; exports.WaitForTransactionReceiptTimeoutError = WaitForTransactionReceiptTimeoutError; exports.CallExecutionError = CallExecutionError; exports.ContractFunctionExecutionError = ContractFunctionExecutionError; exports.ContractFunctionRevertedError = ContractFunctionRevertedError; exports.ContractFunctionZeroDataError = ContractFunctionZeroDataError; exports.RawContractError = RawContractError; exports.SizeExceedsPaddingSizeError = SizeExceedsPaddingSizeError; exports.DataLengthTooLongError = DataLengthTooLongError; exports.DataLengthTooShortError = DataLengthTooShortError; exports.InvalidBytesBooleanError = InvalidBytesBooleanError; exports.InvalidHexBooleanError = InvalidHexBooleanError; exports.InvalidHexValueError = InvalidHexValueError; exports.OffsetOutOfBoundsError = OffsetOutOfBoundsError; exports.EnsAvatarUriResolutionError = EnsAvatarUriResolutionError; exports.EstimateGasExecutionError = EstimateGasExecutionError; exports.FilterTypeNotSupportedError = FilterTypeNotSupportedError; exports.ExecutionRevertedError = ExecutionRevertedError; exports.FeeCapTooHighError = FeeCapTooHighError; exports.FeeCapTooLowError = FeeCapTooLowError; exports.NonceTooHighError = NonceTooHighError; exports.NonceTooLowError = NonceTooLowError; exports.NonceMaxValueError = NonceMaxValueError; exports.InsufficientFundsError = InsufficientFundsError; exports.IntrinsicGasTooHighError = IntrinsicGasTooHighError; exports.IntrinsicGasTooLowError = IntrinsicGasTooLowError; exports.TransactionTypeNotSupportedError = TransactionTypeNotSupportedError; exports.TipAboveFeeCapError = TipAboveFeeCapError; exports.UnknownNodeError = UnknownNodeError; 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.UserRejectedRequestError = UserRejectedRequestError; exports.SwitchChainError = SwitchChainError; exports.UnknownRpcError = UnknownRpcError; exports.HttpRequestError = HttpRequestError; exports.WebSocketRequestError = WebSocketRequestError; exports.RpcError = RpcError; exports.TimeoutError = TimeoutError; exports.UrlRequiredError = UrlRequiredError; exports.concat = concat; exports.concatBytes = concatBytes; exports.concatHex = concatHex; 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.toHex = toHex; exports.numberToHex = numberToHex; exports.stringToHex = stringToHex; exports.toBytes = toBytes; exports.boolToBytes = boolToBytes; exports.hexToBytes = hexToBytes; exports.numberToBytes = numberToBytes; exports.stringToBytes = stringToBytes; exports.toRlp = toRlp; exports.fromHex = fromHex; exports.hexToBigInt = hexToBigInt; exports.hexToBool = hexToBool; exports.hexToNumber = hexToNumber; exports.hexToString = hexToString; exports.fromBytes = fromBytes; exports.bytesToBigint = bytesToBigint; exports.bytesToBool = bytesToBool; exports.bytesToNumber = bytesToNumber; exports.bytesToString = bytesToString; exports.fromRlp = fromRlp; exports.extractFunctionParts = extractFunctionParts; exports.extractFunctionName = extractFunctionName; exports.extractFunctionParams = extractFunctionParams; exports.extractFunctionType = extractFunctionType; exports.keccak256 = keccak256; exports.getEventSelector = getEventSelector; exports.getFunctionSelector = getFunctionSelector; exports.isHash = isHash; exports.isAddress = isAddress; exports.getAddress = getAddress; exports.getContractAddress = getContractAddress2; exports.getCreateAddress = getCreateAddress; exports.getCreate2Address = getCreate2Address; exports.isAddressEqual = isAddressEqual; exports.encodeAbiParameters = encodeAbiParameters; exports.decodeAbiParameters = decodeAbiParameters; exports.formatAbiItem = formatAbiItem; exports.decodeErrorResult = decodeErrorResult; exports.decodeEventLog = decodeEventLog; exports.decodeFunctionData = decodeFunctionData; exports.getAbiItem = getAbiItem; exports.decodeFunctionResult = decodeFunctionResult; exports.encodeDeployData = encodeDeployData; exports.encodeErrorResult = encodeErrorResult; exports.encodeEventTopics = encodeEventTopics; exports.encodeFunctionData = encodeFunctionData; exports.encodeFunctionResult = encodeFunctionResult; exports.arrayRegex = arrayRegex; exports.bytesRegex = bytesRegex; exports.integerRegex = integerRegex; exports.encodePacked = encodePacked; exports.formatAbiItemWithArgs = formatAbiItemWithArgs; exports.parseAbi = _abitype.parseAbi; exports.parseAbiItem = _abitype.parseAbiItem; exports.parseAbiParameter = _abitype.parseAbiParameter; exports.parseAbiParameters = _abitype.parseAbiParameters; exports.parseAccount = parseAccount; exports.publicKeyToAddress = publicKeyToAddress; exports.wait = wait; exports.isDeterministicError = isDeterministicError; exports.buildRequest = buildRequest; exports.defineChain = defineChain; exports.getChainContractAddress = getChainContractAddress; exports.format = format3; exports.defineFormatter = defineFormatter; exports.transactionType = transactionType; exports.formatTransaction = formatTransaction; exports.defineTransaction = defineTransaction; exports.formatBlock = formatBlock; exports.defineBlock = defineBlock; exports.extract = extract; exports.defineTransactionReceipt = defineTransactionReceipt; exports.formatTransactionRequest = formatTransactionRequest; exports.defineTransactionRequest = defineTransactionRequest; exports.containsNodeError = containsNodeError; exports.getNodeError = getNodeError; exports.getCallError = getCallError; exports.getContractError = getContractError; exports.getEstimateGasError = getEstimateGasError; exports.getTransactionError = getTransactionError; exports.stringify = stringify; exports.getSocket = getSocket; exports.rpc = rpc; exports.hashMessage = hashMessage; exports.validateTypedData = validateTypedData; exports.hashTypedData = hashTypedData; exports.recoverAddress = recoverAddress; exports.recoverMessageAddress = recoverMessageAddress; exports.recoverTypedDataAddress = recoverTypedDataAddress; exports.verifyMessage = verifyMessage; exports.verifyTypedData = verifyTypedData; exports.assertRequest = assertRequest; exports.getSerializedTransactionType = getSerializedTransactionType; exports.getTransactionType = getTransactionType; exports.parseUnits = parseUnits; exports.parseGwei = parseGwei; exports.prepareRequest = prepareRequest; exports.assertTransactionEIP1559 = assertTransactionEIP1559; exports.assertTransactionEIP2930 = assertTransactionEIP2930; exports.assertTransactionLegacy = assertTransactionLegacy; exports.parseTransaction = parseTransaction; exports.serializeTransaction = serializeTransaction; exports.formatUnits = formatUnits; exports.formatEther = formatEther; exports.formatGwei = formatGwei; exports.parseEther = parseEther; exports.labelhash = labelhash; exports.namehash = namehash; exports.call = call; exports.simulateContract = simulateContract; exports.createPendingTransactionFilter = createPendingTransactionFilter; exports.createBlockFilter = createBlockFilter; exports.createEventFilter = createEventFilter; exports.createContractEventFilter = createContractEventFilter; exports.estimateGas = estimateGas; exports.estimateContractGas = estimateContractGas; 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.getStorageAt = getStorageAt; exports.getTransaction = getTransaction; exports.getTransactionConfirmations = getTransactionConfirmations; exports.getTransactionCount = getTransactionCount; exports.getTransactionReceipt = getTransactionReceipt; exports.readContract = readContract; exports.multicall = multicall; exports.uninstallFilter = uninstallFilter; exports.waitForTransactionReceipt = waitForTransactionReceipt; exports.watchBlockNumber = watchBlockNumber; exports.watchBlocks = watchBlocks; exports.watchContractEvent = watchContractEvent; exports.watchEvent = watchEvent; exports.watchPendingTransactions = watchPendingTransactions; exports.getEnsAddress = getEnsAddress; exports.getEnsText = getEnsText; exports.getEnsAvatar = getEnsAvatar; exports.getEnsName = getEnsName; exports.getEnsResolver = getEnsResolver; exports.dropTransaction = dropTransaction; exports.getAutomine = getAutomine; exports.getTxpoolContent = getTxpoolContent; exports.getTxpoolStatus = getTxpoolStatus; exports.impersonateAccount = impersonateAccount; exports.increaseTime = increaseTime; exports.inspectTxpool = inspectTxpool; exports.mine = mine; exports.removeBlockTimestampInterval = removeBlockTimestampInterval; exports.reset = reset; exports.revert = revert; exports.sendUnsignedTransaction = sendUnsignedTransaction; exports.setAutomine = setAutomine; exports.setBalance = setBalance; exports.setBlockGasLimit = setBlockGasLimit; exports.setBlockTimestampInterval = setBlockTimestampInterval; exports.setCode = setCode; exports.setCoinbase = setCoinbase; exports.setIntervalMining = setIntervalMining; exports.setLoggingEnabled = setLoggingEnabled; exports.setMinGasPrice = setMinGasPrice; exports.setNextBlockBaseFeePerGas = setNextBlockBaseFeePerGas; exports.setNextBlockTimestamp = setNextBlockTimestamp; exports.setNonce = setNonce; exports.setRpcUrl = setRpcUrl; exports.setStorageAt = setStorageAt; exports.snapshot = snapshot; exports.stopImpersonatingAccount = stopImpersonatingAccount; exports.addChain = addChain; exports.deployContract = deployContract; exports.getAddresses = getAddresses; exports.getPermissions = getPermissions; exports.requestAddresses = requestAddresses; exports.requestPermissions = requestPermissions; exports.sendTransaction = sendTransaction; exports.signMessage = signMessage; exports.signTypedData = signTypedData; exports.switchChain = switchChain; exports.watchAsset = watchAsset; exports.writeContract = writeContract; exports.getContract = getContract;
7222
+ //# sourceMappingURL=chunk-PWUNCH5G.js.map