viem 0.2.0-0-2-0.20230330T023229 → 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.
- package/dist/abi.d.ts +3 -3
- package/dist/abi.js +2 -2
- package/dist/abi.mjs +1 -1
- package/dist/accounts/index.d.ts +4 -4
- package/dist/accounts/index.js +16 -16
- package/dist/accounts/index.mjs +2 -2
- package/dist/{chain-9da1e6b6.d.ts → chain-5507c6f0.d.ts} +25 -14
- package/dist/{chain-b53ed5d9.d.ts → chain-fe47467d.d.ts} +1 -1
- package/dist/chains.d.ts +3 -3
- package/dist/chains.js +89 -89
- package/dist/chains.mjs +1 -1
- package/dist/{chunk-S4GWZ3LJ.mjs → chunk-EMXJKA5P.mjs} +2 -2
- package/dist/{chunk-B7WOV4RY.mjs → chunk-KILBOPDD.mjs} +738 -19
- package/dist/chunk-KILBOPDD.mjs.map +1 -0
- package/dist/{chunk-GNHXOZCH.js → chunk-KQOOAYBY.js} +6 -6
- package/dist/{chunk-2ESQNALV.js → chunk-PWUNCH5G.js} +762 -43
- package/dist/chunk-PWUNCH5G.js.map +1 -0
- package/dist/contract.d.ts +8 -8
- package/dist/contract.js +2 -2
- package/dist/contract.mjs +1 -1
- package/dist/{createTransport-e031366b.d.ts → createTransport-21a0d2b3.d.ts} +2 -2
- package/dist/{eip1193-e79469af.d.ts → eip1193-2f3a9cd2.d.ts} +1 -1
- package/dist/{encodeFunctionResult-d206ceb9.d.ts → encodeFunctionResult-c5185b98.d.ts} +1 -1
- package/dist/{encodePacked-b36ce88a.d.ts → encodePacked-98f67d09.d.ts} +1 -1
- package/dist/ens.d.ts +5 -5
- package/dist/ens.js +8 -3
- package/dist/ens.js.map +1 -1
- package/dist/ens.mjs +7 -2
- package/dist/ens.mjs.map +1 -1
- package/dist/ethers.d.ts +2 -2
- package/dist/ethers.js +4 -4
- package/dist/ethers.mjs +2 -2
- package/dist/{formatAbiItem-a7a3fb0f.d.ts → formatAbiItem-56dff508.d.ts} +1 -1
- package/dist/{getAbiItem-5e8b01de.d.ts → getAbiItem-bfba73d1.d.ts} +1 -1
- package/dist/{watchPendingTransactions-53449c4e.d.ts → getEnsResolver-9e26c596.d.ts} +177 -127
- package/dist/index.d.ts +126 -17
- package/dist/index.js +100 -92
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -7
- package/dist/index.mjs.map +1 -1
- package/dist/{parseGwei-7678c2fa.d.ts → parseGwei-d2147f8b.d.ts} +5 -5
- package/dist/public.d.ts +5 -5
- package/dist/public.js +2 -2
- package/dist/public.mjs +1 -1
- package/dist/{publicKeyToAddress-87b9856c.d.ts → publicKeyToAddress-623eb398.d.ts} +2 -2
- package/dist/{test-68dbda5b.d.ts → test-b67569fe.d.ts} +3 -3
- package/dist/test.d.ts +5 -5
- package/dist/test.js +2 -2
- package/dist/test.mjs +1 -1
- package/dist/{typedData-8b24374d.d.ts → typedData-46b4d81f.d.ts} +1 -1
- package/dist/utils/index.d.ts +15 -15
- package/dist/utils/index.js +2 -2
- package/dist/utils/index.mjs +1 -1
- package/dist/wallet.d.ts +5 -5
- package/dist/wallet.js +2 -2
- package/dist/wallet.mjs +1 -1
- package/dist/window.d.ts +2 -2
- package/package.json +3 -2
- package/dist/chunk-2ESQNALV.js.map +0 -1
- package/dist/chunk-ASAFFZMD.js +0 -186
- package/dist/chunk-ASAFFZMD.js.map +0 -1
- package/dist/chunk-B7WOV4RY.mjs.map +0 -1
- package/dist/chunk-RFOQRRYW.mjs +0 -186
- package/dist/chunk-RFOQRRYW.mjs.map +0 -1
- /package/dist/{chunk-S4GWZ3LJ.mjs.map → chunk-EMXJKA5P.mjs.map} +0 -0
- /package/dist/{chunk-GNHXOZCH.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
|
+
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",
|
@@ -147,8 +147,9 @@ var package_default = {
|
|
147
147
|
types: "dist/index.d.ts",
|
148
148
|
sideEffects: false,
|
149
149
|
dependencies: {
|
150
|
-
"@
|
150
|
+
"@ensdomains/address-encoder": "^0.2.21",
|
151
151
|
"@noble/curves": "^0.9.0",
|
152
|
+
"@noble/hashes": "^1.1.2",
|
152
153
|
"@scure/bip32": "^1.2.0",
|
153
154
|
"@scure/bip39": "^1.1.1",
|
154
155
|
"@wagmi/chains": "~0.2.15",
|
@@ -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:
|
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, {
|
@@ -3958,6 +4037,272 @@ function getTransactionType(transaction) {
|
|
3958
4037
|
throw new InvalidSerializableTransactionError({ transaction });
|
3959
4038
|
}
|
3960
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
|
+
|
3961
4306
|
// src/actions/public/call.ts
|
3962
4307
|
async function call(client, args) {
|
3963
4308
|
const {
|
@@ -3979,10 +4324,10 @@ async function call(client, args) {
|
|
3979
4324
|
try {
|
3980
4325
|
assertRequest(args);
|
3981
4326
|
const blockNumberHex = blockNumber ? numberToHex(blockNumber) : void 0;
|
3982
|
-
const formatter = _optionalChain([client, 'access',
|
4327
|
+
const formatter = _optionalChain([client, 'access', _100 => _100.chain, 'optionalAccess', _101 => _101.formatters, 'optionalAccess', _102 => _102.transactionRequest]);
|
3983
4328
|
const request_ = format3(
|
3984
4329
|
{
|
3985
|
-
from: _optionalChain([account, 'optionalAccess',
|
4330
|
+
from: _optionalChain([account, 'optionalAccess', _103 => _103.address]),
|
3986
4331
|
accessList,
|
3987
4332
|
data,
|
3988
4333
|
gas,
|
@@ -4058,7 +4403,7 @@ async function simulateContract(client, {
|
|
4058
4403
|
args,
|
4059
4404
|
docsPath: "/docs/contract/simulateContract",
|
4060
4405
|
functionName,
|
4061
|
-
sender: _optionalChain([account, 'optionalAccess',
|
4406
|
+
sender: _optionalChain([account, 'optionalAccess', _104 => _104.address])
|
4062
4407
|
});
|
4063
4408
|
}
|
4064
4409
|
}
|
@@ -4172,7 +4517,7 @@ async function estimateGas(client, args) {
|
|
4172
4517
|
} = account.type === "local" ? await prepareRequest(client, args) : args;
|
4173
4518
|
const blockNumberHex = blockNumber ? numberToHex(blockNumber) : void 0;
|
4174
4519
|
assertRequest(args);
|
4175
|
-
const formatter = _optionalChain([client, 'access',
|
4520
|
+
const formatter = _optionalChain([client, 'access', _105 => _105.chain, 'optionalAccess', _106 => _106.formatters, 'optionalAccess', _107 => _107.transactionRequest]);
|
4176
4521
|
const request = format3(
|
4177
4522
|
{
|
4178
4523
|
from: account.address,
|
@@ -4234,7 +4579,7 @@ async function estimateContractGas(client, {
|
|
4234
4579
|
args,
|
4235
4580
|
docsPath: "/docs/contract/simulateContract",
|
4236
4581
|
functionName,
|
4237
|
-
sender: _optionalChain([account, 'optionalAccess',
|
4582
|
+
sender: _optionalChain([account, 'optionalAccess', _108 => _108.address])
|
4238
4583
|
});
|
4239
4584
|
}
|
4240
4585
|
}
|
@@ -4272,7 +4617,7 @@ async function getBlock(client, {
|
|
4272
4617
|
if (!block)
|
4273
4618
|
throw new BlockNotFoundError({ blockHash, blockNumber });
|
4274
4619
|
return format3(block, {
|
4275
|
-
formatter: _optionalChain([client, 'access',
|
4620
|
+
formatter: _optionalChain([client, 'access', _109 => _109.chain, 'optionalAccess', _110 => _110.formatters, 'optionalAccess', _111 => _111.block]) || formatBlock
|
4276
4621
|
});
|
4277
4622
|
}
|
4278
4623
|
|
@@ -4484,7 +4829,7 @@ async function getTransaction(client, {
|
|
4484
4829
|
index
|
4485
4830
|
});
|
4486
4831
|
return format3(transaction, {
|
4487
|
-
formatter: _optionalChain([client, 'access',
|
4832
|
+
formatter: _optionalChain([client, 'access', _112 => _112.chain, 'optionalAccess', _113 => _113.formatters, 'optionalAccess', _114 => _114.transaction]) || formatTransaction
|
4488
4833
|
});
|
4489
4834
|
}
|
4490
4835
|
|
@@ -4494,7 +4839,7 @@ async function getTransactionConfirmations(client, { hash: hash2, transactionRec
|
|
4494
4839
|
getBlockNumber(client),
|
4495
4840
|
hash2 ? getTransaction(client, { hash: hash2 }) : void 0
|
4496
4841
|
]);
|
4497
|
-
const transactionBlockNumber = _optionalChain([transactionReceipt, 'optionalAccess',
|
4842
|
+
const transactionBlockNumber = _optionalChain([transactionReceipt, 'optionalAccess', _115 => _115.blockNumber]) || _optionalChain([transaction, 'optionalAccess', _116 => _116.blockNumber]);
|
4498
4843
|
if (!transactionBlockNumber)
|
4499
4844
|
return 0n;
|
4500
4845
|
return blockNumber - transactionBlockNumber + 1n;
|
@@ -4518,7 +4863,7 @@ async function getTransactionReceipt(client, { hash: hash2 }) {
|
|
4518
4863
|
if (!receipt)
|
4519
4864
|
throw new TransactionReceiptNotFoundError({ hash: hash2 });
|
4520
4865
|
return format3(receipt, {
|
4521
|
-
formatter: _optionalChain([client, 'access',
|
4866
|
+
formatter: _optionalChain([client, 'access', _117 => _117.chain, 'optionalAccess', _118 => _118.formatters, 'optionalAccess', _119 => _119.transactionReceipt]) || formatTransactionReceipt
|
4522
4867
|
});
|
4523
4868
|
}
|
4524
4869
|
|
@@ -4687,7 +5032,7 @@ function observe(observerId, callbacks, fn) {
|
|
4687
5032
|
const listeners2 = getListeners();
|
4688
5033
|
if (listeners2.length === 0)
|
4689
5034
|
return;
|
4690
|
-
listeners2.forEach((listener) => _optionalChain([listener, 'access',
|
5035
|
+
listeners2.forEach((listener) => _optionalChain([listener, 'access', _120 => _120.fns, 'access', _121 => _121[key], 'optionalCall', _122 => _122(...args)]));
|
4691
5036
|
};
|
4692
5037
|
}
|
4693
5038
|
const cleanup = fn(emit);
|
@@ -4769,7 +5114,7 @@ async function waitForTransactionReceipt(client, {
|
|
4769
5114
|
reason = "cancelled";
|
4770
5115
|
}
|
4771
5116
|
done(() => {
|
4772
|
-
_optionalChain([emit, 'access',
|
5117
|
+
_optionalChain([emit, 'access', _123 => _123.onReplaced, 'optionalCall', _124 => _124({
|
4773
5118
|
reason,
|
4774
5119
|
replacedTransaction,
|
4775
5120
|
transaction: replacementTransaction,
|
@@ -4797,7 +5142,7 @@ function poll(fn, { emitOnBegin, initialWaitTime, interval }) {
|
|
4797
5142
|
let data;
|
4798
5143
|
if (emitOnBegin)
|
4799
5144
|
data = await fn({ unpoll: unwatch });
|
4800
|
-
const initialWait = await _asyncNullishCoalesce(await _optionalChain([initialWaitTime, 'optionalCall',
|
5145
|
+
const initialWait = await _asyncNullishCoalesce(await _optionalChain([initialWaitTime, 'optionalCall', _125 => _125(data)]), async () => ( interval));
|
4801
5146
|
await wait(initialWait);
|
4802
5147
|
const poll2 = async () => {
|
4803
5148
|
if (!active)
|
@@ -4853,7 +5198,7 @@ function watchBlockNumber(client, {
|
|
4853
5198
|
prevBlockNumber = blockNumber;
|
4854
5199
|
}
|
4855
5200
|
} catch (err) {
|
4856
|
-
_optionalChain([emit, 'access',
|
5201
|
+
_optionalChain([emit, 'access', _126 => _126.onError, 'optionalCall', _127 => _127(err)]);
|
4857
5202
|
}
|
4858
5203
|
},
|
4859
5204
|
{
|
@@ -4873,19 +5218,19 @@ function watchBlockNumber(client, {
|
|
4873
5218
|
onData(data) {
|
4874
5219
|
if (!active)
|
4875
5220
|
return;
|
4876
|
-
const blockNumber = hexToBigInt(_optionalChain([data, 'access',
|
5221
|
+
const blockNumber = hexToBigInt(_optionalChain([data, 'access', _128 => _128.result, 'optionalAccess', _129 => _129.number]));
|
4877
5222
|
onBlockNumber(blockNumber, prevBlockNumber);
|
4878
5223
|
prevBlockNumber = blockNumber;
|
4879
5224
|
},
|
4880
5225
|
onError(error) {
|
4881
|
-
_optionalChain([onError, 'optionalCall',
|
5226
|
+
_optionalChain([onError, 'optionalCall', _130 => _130(error)]);
|
4882
5227
|
}
|
4883
5228
|
});
|
4884
5229
|
unsubscribe = unsubscribe_;
|
4885
5230
|
if (!active)
|
4886
5231
|
unsubscribe();
|
4887
5232
|
} catch (err) {
|
4888
|
-
_optionalChain([onError, 'optionalCall',
|
5233
|
+
_optionalChain([onError, 'optionalCall', _131 => _131(err)]);
|
4889
5234
|
}
|
4890
5235
|
})();
|
4891
5236
|
return unsubscribe;
|
@@ -4925,11 +5270,11 @@ function watchBlocks(client, {
|
|
4925
5270
|
blockTag,
|
4926
5271
|
includeTransactions
|
4927
5272
|
});
|
4928
|
-
if (block.number && _optionalChain([prevBlock, 'optionalAccess',
|
5273
|
+
if (block.number && _optionalChain([prevBlock, 'optionalAccess', _132 => _132.number])) {
|
4929
5274
|
if (block.number === prevBlock.number)
|
4930
5275
|
return;
|
4931
5276
|
if (block.number - prevBlock.number > 1 && emitMissed) {
|
4932
|
-
for (let i = _optionalChain([prevBlock, 'optionalAccess',
|
5277
|
+
for (let i = _optionalChain([prevBlock, 'optionalAccess', _133 => _133.number]) + 1n; i < block.number; i++) {
|
4933
5278
|
const block2 = await getBlock(client, {
|
4934
5279
|
blockNumber: i,
|
4935
5280
|
includeTransactions
|
@@ -4941,8 +5286,8 @@ function watchBlocks(client, {
|
|
4941
5286
|
}
|
4942
5287
|
if (
|
4943
5288
|
// If no previous block exists, emit.
|
4944
|
-
!_optionalChain([prevBlock, 'optionalAccess',
|
4945
|
-
blockTag === "pending" && !_optionalChain([block, 'optionalAccess',
|
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.
|
4946
5291
|
// We don't want to emit blocks in the past.
|
4947
5292
|
block.number && block.number > prevBlock.number
|
4948
5293
|
) {
|
@@ -4950,7 +5295,7 @@ function watchBlocks(client, {
|
|
4950
5295
|
prevBlock = block;
|
4951
5296
|
}
|
4952
5297
|
} catch (err) {
|
4953
|
-
_optionalChain([emit, 'access',
|
5298
|
+
_optionalChain([emit, 'access', _136 => _136.onError, 'optionalCall', _137 => _137(err)]);
|
4954
5299
|
}
|
4955
5300
|
},
|
4956
5301
|
{
|
@@ -4975,14 +5320,14 @@ function watchBlocks(client, {
|
|
4975
5320
|
prevBlock = block;
|
4976
5321
|
},
|
4977
5322
|
onError(error) {
|
4978
|
-
_optionalChain([onError, 'optionalCall',
|
5323
|
+
_optionalChain([onError, 'optionalCall', _138 => _138(error)]);
|
4979
5324
|
}
|
4980
5325
|
});
|
4981
5326
|
unsubscribe = unsubscribe_;
|
4982
5327
|
if (!active)
|
4983
5328
|
unsubscribe();
|
4984
5329
|
} catch (err) {
|
4985
|
-
_optionalChain([onError, 'optionalCall',
|
5330
|
+
_optionalChain([onError, 'optionalCall', _139 => _139(err)]);
|
4986
5331
|
}
|
4987
5332
|
})();
|
4988
5333
|
return unsubscribe;
|
@@ -5024,7 +5369,7 @@ function watchContractEvent(client, {
|
|
5024
5369
|
args,
|
5025
5370
|
eventName
|
5026
5371
|
});
|
5027
|
-
} catch (
|
5372
|
+
} catch (e2) {
|
5028
5373
|
}
|
5029
5374
|
initialized = true;
|
5030
5375
|
return;
|
@@ -5058,7 +5403,7 @@ function watchContractEvent(client, {
|
|
5058
5403
|
else
|
5059
5404
|
logs.forEach((log) => emit.onLogs([log]));
|
5060
5405
|
} catch (err) {
|
5061
|
-
_optionalChain([emit, 'access',
|
5406
|
+
_optionalChain([emit, 'access', _140 => _140.onError, 'optionalCall', _141 => _141(err)]);
|
5062
5407
|
}
|
5063
5408
|
},
|
5064
5409
|
{
|
@@ -5106,7 +5451,7 @@ function watchEvent(client, {
|
|
5106
5451
|
args,
|
5107
5452
|
event
|
5108
5453
|
});
|
5109
|
-
} catch (
|
5454
|
+
} catch (e3) {
|
5110
5455
|
}
|
5111
5456
|
initialized = true;
|
5112
5457
|
return;
|
@@ -5137,7 +5482,7 @@ function watchEvent(client, {
|
|
5137
5482
|
else
|
5138
5483
|
logs.forEach((log) => emit.onLogs([log]));
|
5139
5484
|
} catch (err) {
|
5140
|
-
_optionalChain([emit, 'access',
|
5485
|
+
_optionalChain([emit, 'access', _142 => _142.onError, 'optionalCall', _143 => _143(err)]);
|
5141
5486
|
}
|
5142
5487
|
},
|
5143
5488
|
{
|
@@ -5191,7 +5536,7 @@ function watchPendingTransactions(client, {
|
|
5191
5536
|
else
|
5192
5537
|
hashes.forEach((hash2) => emit.onTransactions([hash2]));
|
5193
5538
|
} catch (err) {
|
5194
|
-
_optionalChain([emit, 'access',
|
5539
|
+
_optionalChain([emit, 'access', _144 => _144.onError, 'optionalCall', _145 => _145(err)]);
|
5195
5540
|
}
|
5196
5541
|
},
|
5197
5542
|
{
|
@@ -5220,14 +5565,14 @@ function watchPendingTransactions(client, {
|
|
5220
5565
|
onTransactions([transaction]);
|
5221
5566
|
},
|
5222
5567
|
onError(error) {
|
5223
|
-
_optionalChain([onError, 'optionalCall',
|
5568
|
+
_optionalChain([onError, 'optionalCall', _146 => _146(error)]);
|
5224
5569
|
}
|
5225
5570
|
});
|
5226
5571
|
unsubscribe = unsubscribe_;
|
5227
5572
|
if (!active)
|
5228
5573
|
unsubscribe();
|
5229
5574
|
} catch (err) {
|
5230
|
-
_optionalChain([onError, 'optionalCall',
|
5575
|
+
_optionalChain([onError, 'optionalCall', _147 => _147(err)]);
|
5231
5576
|
}
|
5232
5577
|
})();
|
5233
5578
|
return unsubscribe;
|
@@ -5235,6 +5580,202 @@ function watchPendingTransactions(client, {
|
|
5235
5580
|
return enablePolling ? pollPendingTransactions() : subscribePendingTransactions();
|
5236
5581
|
}
|
5237
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
|
+
|
5238
5779
|
// src/actions/test/dropTransaction.ts
|
5239
5780
|
async function dropTransaction(client, { hash: hash2 }) {
|
5240
5781
|
return await client.request({
|
@@ -5548,7 +6089,7 @@ async function sendTransaction(client, args) {
|
|
5548
6089
|
try {
|
5549
6090
|
assertRequest(args);
|
5550
6091
|
const chainId = await getChainId(client);
|
5551
|
-
if (chain !== null && chainId !== _optionalChain([chain, 'optionalAccess',
|
6092
|
+
if (chain !== null && chainId !== _optionalChain([chain, 'optionalAccess', _148 => _148.id])) {
|
5552
6093
|
if (!chain)
|
5553
6094
|
throw new ChainNotFoundError();
|
5554
6095
|
throw new ChainMismatchError({ chain, currentChainId: chainId });
|
@@ -5577,7 +6118,7 @@ async function sendTransaction(client, args) {
|
|
5577
6118
|
params: [signedRequest]
|
5578
6119
|
});
|
5579
6120
|
}
|
5580
|
-
const formatter = _optionalChain([chain, 'optionalAccess',
|
6121
|
+
const formatter = _optionalChain([chain, 'optionalAccess', _149 => _149.formatters, 'optionalAccess', _150 => _150.transactionRequest]);
|
5581
6122
|
const request = format3(
|
5582
6123
|
{
|
5583
6124
|
accessList,
|
@@ -5643,14 +6184,14 @@ async function signTypedData(client, {
|
|
5643
6184
|
const account = parseAccount(account_);
|
5644
6185
|
const types = {
|
5645
6186
|
EIP712Domain: [
|
5646
|
-
_optionalChain([domain, 'optionalAccess',
|
5647
|
-
_optionalChain([domain, 'optionalAccess',
|
5648
|
-
_optionalChain([domain, 'optionalAccess',
|
5649
|
-
_optionalChain([domain, 'optionalAccess',
|
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]) && {
|
5650
6191
|
name: "verifyingContract",
|
5651
6192
|
type: "address"
|
5652
6193
|
},
|
5653
|
-
_optionalChain([domain, 'optionalAccess',
|
6194
|
+
_optionalChain([domain, 'optionalAccess', _155 => _155.salt]) && { name: "salt", type: "bytes32" }
|
5654
6195
|
].filter(Boolean),
|
5655
6196
|
...types_
|
5656
6197
|
};
|
@@ -5719,6 +6260,176 @@ async function writeContract(client, {
|
|
5719
6260
|
return hash2;
|
5720
6261
|
}
|
5721
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
|
+
|
5722
6433
|
// src/utils/unit/parseUnits.ts
|
5723
6434
|
function parseUnits(value, decimals) {
|
5724
6435
|
let [integer, fraction = "0"] = value.split(".");
|
@@ -6499,5 +7210,13 @@ function parseEther(ether, unit = "wei") {
|
|
6499
7210
|
|
6500
7211
|
|
6501
7212
|
|
6502
|
-
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.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.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;
|
6503
|
-
|
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
|