@latticexyz/world-module-erc20 2.2.18-f0433092876e2ac9b5b12cd0ecae9c120a2d0368 → 2.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_esm-H47RQ4ED.js +3915 -0
- package/dist/{_esm-BQNWKNND.js.map → _esm-H47RQ4ED.js.map} +1 -1
- package/dist/ccip-VJWDNI4X.js +15 -0
- package/dist/chunk-2VXHCW2O.js +132 -0
- package/dist/{chunk-TJJDXMQ6.js.map → chunk-2VXHCW2O.js.map} +1 -1
- package/dist/chunk-LIWKL347.js +3833 -0
- package/dist/{chunk-GSBUANUZ.js.map → chunk-LIWKL347.js.map} +1 -1
- package/dist/chunk-PR4QN5HX.js +43 -0
- package/dist/internal.js +27 -1
- package/dist/internal.js.map +1 -1
- package/dist/mud.config.js +83 -1
- package/dist/mud.config.js.map +1 -1
- package/dist/secp256k1-XVT662DN.js +2395 -0
- package/dist/{secp256k1-UMYSD4MC.js.map → secp256k1-XVT662DN.js.map} +1 -1
- package/out/AccessManagementSystem.sol/AccessManagementSystem.json +1 -1
- package/out/BalanceTransferSystem.sol/BalanceTransferSystem.json +1 -1
- package/out/BatchCallSystem.sol/BatchCallSystem.json +1 -1
- package/out/Constants.sol/ERC20TableNames.json +1 -1
- package/out/Constants.sol/ModuleConstants.json +1 -1
- package/out/Constants.sol/OwnableTableNames.json +1 -1
- package/out/Constants.sol/PausableTableNames.json +1 -1
- package/out/Context.sol/Context.abi.json +15 -1
- package/out/Context.sol/Context.abi.json.d.ts +17 -0
- package/out/Context.sol/Context.json +1 -1
- package/out/Delegation.sol/Delegation.json +1 -1
- package/out/ERC20BaseTest.t.sol/ERC20BehaviorTest.json +1 -1
- package/out/ERC20BaseTest.t.sol/ERC20WithInternalStoreBehaviorTest.json +1 -1
- package/out/ERC20BaseTest.t.sol/ERC20WithInternalStoreTest.json +1 -1
- package/out/ERC20BaseTest.t.sol/ERC20WithWorldBehaviorTest.json +1 -1
- package/out/ERC20BaseTest.t.sol/ERC20WithWorldTest.json +1 -1
- package/out/ERC20BaseTest.t.sol/MockERC20Base.abi.json +13 -0
- package/out/ERC20BaseTest.t.sol/MockERC20Base.abi.json.d.ts +13 -0
- package/out/ERC20BaseTest.t.sol/MockERC20Base.json +1 -1
- package/out/ERC20BaseTest.t.sol/MockERC20WithInternalStore.abi.json +13 -0
- package/out/ERC20BaseTest.t.sol/MockERC20WithInternalStore.abi.json.d.ts +13 -0
- package/out/ERC20BaseTest.t.sol/MockERC20WithInternalStore.json +1 -1
- package/out/ERC20BaseTest.t.sol/MockERC20WithWorld.abi.json +95 -3
- package/out/ERC20BaseTest.t.sol/MockERC20WithWorld.abi.json.d.ts +95 -3
- package/out/ERC20BaseTest.t.sol/MockERC20WithWorld.json +1 -1
- package/out/ERC20BaseTest.t.sol/TestConstants.json +1 -1
- package/out/ERC20Burnable.sol/ERC20Burnable.abi.json +13 -0
- package/out/ERC20Burnable.sol/ERC20Burnable.abi.json.d.ts +13 -0
- package/out/ERC20Burnable.sol/ERC20Burnable.json +1 -1
- package/out/ERC20Burnable.t.sol/ERC20BurnableTest.json +1 -1
- package/out/ERC20Burnable.t.sol/ERC20BurnableWithInternalStoreTest.json +1 -1
- package/out/ERC20Burnable.t.sol/ERC20BurnableWithWorldTest.json +1 -1
- package/out/ERC20Burnable.t.sol/MockERC20WithInternalStoreBurnable.abi.json +13 -0
- package/out/ERC20Burnable.t.sol/MockERC20WithInternalStoreBurnable.abi.json.d.ts +13 -0
- package/out/ERC20Burnable.t.sol/MockERC20WithInternalStoreBurnable.json +1 -1
- package/out/ERC20Burnable.t.sol/MockERC20WithWorldBurnable.abi.json +95 -3
- package/out/ERC20Burnable.t.sol/MockERC20WithWorldBurnable.abi.json.d.ts +95 -3
- package/out/ERC20Burnable.t.sol/MockERC20WithWorldBurnable.json +1 -1
- package/out/ERC20Module.sol/ERC20Module.json +1 -1
- package/out/ERC20Module.sol/ERC20RegistryLib.json +1 -1
- package/out/ERC20Module.t.sol/ERC20ModuleTest.json +1 -1
- package/out/ERC20Module.t.sol/TestConstants.json +1 -1
- package/out/ERC20Pausable.sol/ERC20Pausable.abi.json +13 -0
- package/out/ERC20Pausable.sol/ERC20Pausable.abi.json.d.ts +13 -0
- package/out/ERC20Pausable.sol/ERC20Pausable.json +1 -1
- package/out/ERC20Pausable.t.sol/ERC20PausableBehaviorTest.json +1 -1
- package/out/ERC20Pausable.t.sol/ERC20PausableWithInternalStoreTest.json +1 -1
- package/out/ERC20Pausable.t.sol/ERC20PausableWithWorldTest.json +1 -1
- package/out/ERC20Pausable.t.sol/MockERC20Pausable.abi.json +13 -0
- package/out/ERC20Pausable.t.sol/MockERC20Pausable.abi.json.d.ts +13 -0
- package/out/ERC20Pausable.t.sol/MockERC20Pausable.json +1 -1
- package/out/ERC20Pausable.t.sol/MockERC20WithInternalStorePausable.abi.json +13 -0
- package/out/ERC20Pausable.t.sol/MockERC20WithInternalStorePausable.abi.json.d.ts +13 -0
- package/out/ERC20Pausable.t.sol/MockERC20WithInternalStorePausable.json +1 -1
- package/out/ERC20Pausable.t.sol/MockERC20WithWorldPausable.abi.json +95 -3
- package/out/ERC20Pausable.t.sol/MockERC20WithWorldPausable.abi.json.d.ts +95 -3
- package/out/ERC20Pausable.t.sol/MockERC20WithWorldPausable.json +1 -1
- package/out/ERC20WithInternalStore.sol/ERC20WithInternalStore.abi.json +13 -0
- package/out/ERC20WithInternalStore.sol/ERC20WithInternalStore.abi.json.d.ts +13 -0
- package/out/ERC20WithInternalStore.sol/ERC20WithInternalStore.json +1 -1
- package/out/ERC20WithWorld.sol/ERC20WithWorld.abi.json +95 -3
- package/out/ERC20WithWorld.sol/ERC20WithWorld.abi.json.d.ts +95 -3
- package/out/ERC20WithWorld.sol/ERC20WithWorld.json +1 -1
- package/out/IBaseWorld.sol/IBaseWorld.json +1 -1
- package/out/IWorldRegistrationSystem.sol/IWorldRegistrationSystem.json +1 -1
- package/out/InitModule.sol/InitModule.json +1 -1
- package/out/MUDERC20.sol/MUDERC20.abi.json +13 -0
- package/out/MUDERC20.sol/MUDERC20.abi.json.d.ts +13 -0
- package/out/MUDERC20.sol/MUDERC20.json +1 -1
- package/out/Module.sol/Module.json +1 -1
- package/out/ModuleInstallationSystem.sol/ModuleInstallationSystem.json +1 -1
- package/out/Ownable.sol/Ownable.abi.json +13 -0
- package/out/Ownable.sol/Ownable.abi.json.d.ts +13 -0
- package/out/Ownable.sol/Ownable.json +1 -1
- package/out/Pausable.sol/Pausable.abi.json +13 -0
- package/out/Pausable.sol/Pausable.abi.json.d.ts +13 -0
- package/out/Pausable.sol/Pausable.json +1 -1
- package/out/RegistrationSystem.sol/RegistrationSystem.json +1 -1
- package/out/StoreConsumer.sol/StoreConsumer.json +1 -1
- package/out/StoreRegistrationSystem.sol/StoreRegistrationSystem.json +1 -1
- package/out/System.sol/System.json +1 -1
- package/out/SystemCall.sol/SystemCall.json +1 -1
- package/out/WithStore.sol/WithStore.abi.json +13 -0
- package/out/WithStore.sol/WithStore.abi.json.d.ts +13 -0
- package/out/WithStore.sol/WithStore.json +1 -1
- package/out/WithWorld.sol/WithWorld.abi.json +95 -3
- package/out/WithWorld.sol/WithWorld.abi.json.d.ts +95 -3
- package/out/WithWorld.sol/WithWorld.json +1 -1
- package/out/World.sol/World.json +1 -1
- package/out/WorldContext.sol/WorldContextConsumer.json +1 -1
- package/out/WorldContext.sol/WorldContextConsumerLib.json +1 -1
- package/out/WorldContext.sol/WorldContextProviderLib.json +1 -1
- package/out/WorldRegistrationSystem.sol/WorldRegistrationSystem.json +1 -1
- package/out/build-info/{04cd01b00610d99132b6410373c2f462.json → 60c60a9593fdb00b3264c36836a28f39.json} +1 -1
- package/package.json +8 -8
- package/src/examples/ERC20WithWorld.sol +5 -0
- package/src/experimental/Constants.sol +7 -7
- package/src/experimental/ERC20Module.sol +9 -1
- package/dist/_esm-BQNWKNND.js +0 -10
- package/dist/ccip-YAWUVTAX.js +0 -2
- package/dist/chunk-GSBUANUZ.js +0 -30
- package/dist/chunk-LURIOADG.js +0 -2
- package/dist/chunk-TJJDXMQ6.js +0 -7
- package/dist/secp256k1-UMYSD4MC.js +0 -22
- /package/dist/{ccip-YAWUVTAX.js.map → ccip-VJWDNI4X.js.map} +0 -0
- /package/dist/{chunk-LURIOADG.js.map → chunk-PR4QN5HX.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"60c60a9593fdb00b3264c36836a28f39","source_id_to_path":{"0":"node_modules/@latticexyz/gas-report/src/GasReporter.sol","1":"node_modules/@latticexyz/schema-type/src/solidity/SchemaType.sol","2":"node_modules/@latticexyz/store-consumer/src/experimental/Context.sol","3":"node_modules/@latticexyz/store-consumer/src/experimental/StoreConsumer.sol","4":"node_modules/@latticexyz/store-consumer/src/experimental/WithStore.sol","5":"node_modules/@latticexyz/store-consumer/src/experimental/WithWorld.sol","6":"node_modules/@latticexyz/store/src/Bytes.sol","7":"node_modules/@latticexyz/store/src/EncodedLengths.sol","8":"node_modules/@latticexyz/store/src/FieldLayout.sol","9":"node_modules/@latticexyz/store/src/Hook.sol","10":"node_modules/@latticexyz/store/src/IERC165.sol","11":"node_modules/@latticexyz/store/src/IEncodedLengthsErrors.sol","12":"node_modules/@latticexyz/store/src/IFieldLayoutErrors.sol","13":"node_modules/@latticexyz/store/src/ISchemaErrors.sol","14":"node_modules/@latticexyz/store/src/ISliceErrors.sol","15":"node_modules/@latticexyz/store/src/IStore.sol","16":"node_modules/@latticexyz/store/src/IStoreErrors.sol","17":"node_modules/@latticexyz/store/src/IStoreEvents.sol","18":"node_modules/@latticexyz/store/src/IStoreHook.sol","19":"node_modules/@latticexyz/store/src/IStoreKernel.sol","20":"node_modules/@latticexyz/store/src/IStoreRead.sol","21":"node_modules/@latticexyz/store/src/IStoreRegistration.sol","22":"node_modules/@latticexyz/store/src/IStoreWrite.sol","23":"node_modules/@latticexyz/store/src/Memory.sol","24":"node_modules/@latticexyz/store/src/ResourceId.sol","25":"node_modules/@latticexyz/store/src/Schema.sol","26":"node_modules/@latticexyz/store/src/Slice.sol","27":"node_modules/@latticexyz/store/src/Storage.sol","28":"node_modules/@latticexyz/store/src/Store.sol","29":"node_modules/@latticexyz/store/src/StoreCore.sol","30":"node_modules/@latticexyz/store/src/StoreKernel.sol","31":"node_modules/@latticexyz/store/src/StoreRead.sol","32":"node_modules/@latticexyz/store/src/StoreSwitch.sol","33":"node_modules/@latticexyz/store/src/codegen/index.sol","34":"node_modules/@latticexyz/store/src/codegen/tables/Hooks.sol","35":"node_modules/@latticexyz/store/src/codegen/tables/ResourceIds.sol","36":"node_modules/@latticexyz/store/src/codegen/tables/StoreHooks.sol","37":"node_modules/@latticexyz/store/src/codegen/tables/Tables.sol","38":"node_modules/@latticexyz/store/src/constants.sol","39":"node_modules/@latticexyz/store/src/rightMask.sol","40":"node_modules/@latticexyz/store/src/storeHookTypes.sol","41":"node_modules/@latticexyz/store/src/storeResourceTypes.sol","42":"node_modules/@latticexyz/store/src/tightcoder/DecodeSlice.sol","43":"node_modules/@latticexyz/store/src/tightcoder/EncodeArray.sol","44":"node_modules/@latticexyz/store/src/tightcoder/TightCoder.sol","45":"node_modules/@latticexyz/store/src/version.sol","46":"node_modules/@latticexyz/world/src/AccessControl.sol","47":"node_modules/@latticexyz/world/src/Delegation.sol","48":"node_modules/@latticexyz/world/src/ERC165Checker.sol","49":"node_modules/@latticexyz/world/src/IDelegationControl.sol","50":"node_modules/@latticexyz/world/src/IERC165.sol","51":"node_modules/@latticexyz/world/src/IModule.sol","52":"node_modules/@latticexyz/world/src/IModuleErrors.sol","53":"node_modules/@latticexyz/world/src/ISystemHook.sol","54":"node_modules/@latticexyz/world/src/IWorldContextConsumer.sol","55":"node_modules/@latticexyz/world/src/IWorldErrors.sol","56":"node_modules/@latticexyz/world/src/IWorldEvents.sol","57":"node_modules/@latticexyz/world/src/IWorldKernel.sol","58":"node_modules/@latticexyz/world/src/Module.sol","59":"node_modules/@latticexyz/world/src/System.sol","60":"node_modules/@latticexyz/world/src/SystemCall.sol","61":"node_modules/@latticexyz/world/src/World.sol","62":"node_modules/@latticexyz/world/src/WorldContext.sol","63":"node_modules/@latticexyz/world/src/WorldResourceId.sol","64":"node_modules/@latticexyz/world/src/codegen/interfaces/IAccessManagementSystem.sol","65":"node_modules/@latticexyz/world/src/codegen/interfaces/IBalanceTransferSystem.sol","66":"node_modules/@latticexyz/world/src/codegen/interfaces/IBaseWorld.sol","67":"node_modules/@latticexyz/world/src/codegen/interfaces/IBatchCallSystem.sol","68":"node_modules/@latticexyz/world/src/codegen/interfaces/IModuleInstallationSystem.sol","69":"node_modules/@latticexyz/world/src/codegen/interfaces/IRegistrationSystem.sol","70":"node_modules/@latticexyz/world/src/codegen/interfaces/IWorldRegistrationSystem.sol","71":"node_modules/@latticexyz/world/src/codegen/tables/Balances.sol","72":"node_modules/@latticexyz/world/src/codegen/tables/FunctionSelectors.sol","73":"node_modules/@latticexyz/world/src/codegen/tables/FunctionSignatures.sol","74":"node_modules/@latticexyz/world/src/codegen/tables/InitModuleAddress.sol","75":"node_modules/@latticexyz/world/src/codegen/tables/InstalledModules.sol","76":"node_modules/@latticexyz/world/src/codegen/tables/NamespaceDelegationControl.sol","77":"node_modules/@latticexyz/world/src/codegen/tables/NamespaceOwner.sol","78":"node_modules/@latticexyz/world/src/codegen/tables/ResourceAccess.sol","79":"node_modules/@latticexyz/world/src/codegen/tables/SystemHooks.sol","80":"node_modules/@latticexyz/world/src/codegen/tables/SystemRegistry.sol","81":"node_modules/@latticexyz/world/src/codegen/tables/Systems.sol","82":"node_modules/@latticexyz/world/src/codegen/tables/UserDelegationControl.sol","83":"node_modules/@latticexyz/world/src/constants.sol","84":"node_modules/@latticexyz/world/src/modules/init/InitModule.sol","85":"node_modules/@latticexyz/world/src/modules/init/LimitedCallContext.sol","86":"node_modules/@latticexyz/world/src/modules/init/RegistrationSystem.sol","87":"node_modules/@latticexyz/world/src/modules/init/constants.sol","88":"node_modules/@latticexyz/world/src/modules/init/functionSignatures.sol","89":"node_modules/@latticexyz/world/src/modules/init/implementations/AccessManagementSystem.sol","90":"node_modules/@latticexyz/world/src/modules/init/implementations/BalanceTransferSystem.sol","91":"node_modules/@latticexyz/world/src/modules/init/implementations/BatchCallSystem.sol","92":"node_modules/@latticexyz/world/src/modules/init/implementations/ModuleInstallationSystem.sol","93":"node_modules/@latticexyz/world/src/modules/init/implementations/StoreRegistrationSystem.sol","94":"node_modules/@latticexyz/world/src/modules/init/implementations/WorldRegistrationSystem.sol","95":"node_modules/@latticexyz/world/src/modules/init/implementations/createDelegation.sol","96":"node_modules/@latticexyz/world/src/modules/init/types.sol","97":"node_modules/@latticexyz/world/src/requireInterface.sol","98":"node_modules/@latticexyz/world/src/requireNamespace.sol","99":"node_modules/@latticexyz/world/src/requireValidNamespace.sol","100":"node_modules/@latticexyz/world/src/revertWithBytes.sol","101":"node_modules/@latticexyz/world/src/systemHookTypes.sol","102":"node_modules/@latticexyz/world/src/version.sol","103":"node_modules/@latticexyz/world/src/worldResourceTypes.sol","104":"node_modules/@latticexyz/world/test/createInitModule.sol","105":"node_modules/@latticexyz/world/test/createWorld.sol","106":"node_modules/ds-test/src/test.sol","107":"node_modules/forge-std/src/Base.sol","108":"node_modules/forge-std/src/StdAssertions.sol","109":"node_modules/forge-std/src/StdChains.sol","110":"node_modules/forge-std/src/StdCheats.sol","111":"node_modules/forge-std/src/StdError.sol","112":"node_modules/forge-std/src/StdInvariant.sol","113":"node_modules/forge-std/src/StdJson.sol","114":"node_modules/forge-std/src/StdMath.sol","115":"node_modules/forge-std/src/StdStorage.sol","116":"node_modules/forge-std/src/StdStyle.sol","117":"node_modules/forge-std/src/StdUtils.sol","118":"node_modules/forge-std/src/Test.sol","119":"node_modules/forge-std/src/Vm.sol","120":"node_modules/forge-std/src/console.sol","121":"node_modules/forge-std/src/console2.sol","122":"node_modules/forge-std/src/interfaces/IMulticall3.sol","123":"node_modules/forge-std/src/safeconsole.sol","124":"src/codegen/index.sol","125":"src/codegen/tables/Allowances.sol","126":"src/codegen/tables/Balances.sol","127":"src/codegen/tables/ERC20Metadata.sol","128":"src/codegen/tables/ERC20Registry.sol","129":"src/codegen/tables/Owner.sol","130":"src/codegen/tables/Paused.sol","131":"src/codegen/tables/TotalSupply.sol","132":"src/examples/ERC20WithInternalStore.sol","133":"src/examples/ERC20WithWorld.sol","134":"src/experimental/Constants.sol","135":"src/experimental/ERC20Burnable.sol","136":"src/experimental/ERC20Module.sol","137":"src/experimental/ERC20Pausable.sol","138":"src/experimental/MUDERC20.sol","139":"src/experimental/Ownable.sol","140":"src/experimental/Pausable.sol","141":"src/interfaces/IERC20.sol","142":"src/interfaces/IERC20Errors.sol","143":"src/interfaces/IERC20Events.sol","144":"src/interfaces/IERC20Metadata.sol","145":"test/ERC20BaseTest.t.sol","146":"test/ERC20Burnable.t.sol","147":"test/ERC20Module.t.sol","148":"test/ERC20Pausable.t.sol"},"language":"Solidity"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@latticexyz/world-module-erc20",
|
|
3
|
-
"version": "2.2.18
|
|
3
|
+
"version": "2.2.18",
|
|
4
4
|
"description": "ERC20 world module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,18 +30,18 @@
|
|
|
30
30
|
"src"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@latticexyz/schema-type": "2.2.18
|
|
34
|
-
"@latticexyz/
|
|
35
|
-
"@latticexyz/store-consumer": "2.2.18
|
|
36
|
-
"@latticexyz/
|
|
33
|
+
"@latticexyz/schema-type": "2.2.18",
|
|
34
|
+
"@latticexyz/world": "2.2.18",
|
|
35
|
+
"@latticexyz/store-consumer": "2.2.18",
|
|
36
|
+
"@latticexyz/store": "2.2.18"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"ds-test": "https://github.com/dapphub/ds-test.git#e282159d5170298eb2455a6c05280ab5a73a4ef0",
|
|
40
40
|
"forge-std": "https://github.com/foundry-rs/forge-std.git#74cfb77e308dd188d2f58864aaf44963ae6b88b1",
|
|
41
41
|
"solhint": "^3.3.7",
|
|
42
|
-
"@latticexyz/
|
|
43
|
-
"@latticexyz/
|
|
44
|
-
"@latticexyz/
|
|
42
|
+
"@latticexyz/gas-report": "2.2.18",
|
|
43
|
+
"@latticexyz/abi-ts": "2.2.18",
|
|
44
|
+
"@latticexyz/cli": "2.2.18"
|
|
45
45
|
},
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
@@ -6,6 +6,7 @@ pragma solidity >=0.8.24;
|
|
|
6
6
|
import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
|
|
7
7
|
import { IBaseWorld } from "@latticexyz/world/src/codegen/interfaces/IBaseWorld.sol";
|
|
8
8
|
import { WithWorld } from "@latticexyz/store-consumer/src/experimental/WithWorld.sol";
|
|
9
|
+
import { Context } from "@latticexyz/store-consumer/src/experimental/Context.sol";
|
|
9
10
|
|
|
10
11
|
import { ERC20Pausable } from "../experimental/ERC20Pausable.sol";
|
|
11
12
|
import { ERC20Burnable } from "../experimental/ERC20Burnable.sol";
|
|
@@ -36,6 +37,10 @@ contract ERC20WithWorld is WithWorld, MUDERC20, ERC20Pausable, ERC20Burnable {
|
|
|
36
37
|
|
|
37
38
|
// The following functions are overrides required by Solidity.
|
|
38
39
|
|
|
40
|
+
function _msgSender() public view override(Context, WithWorld) returns (address sender) {
|
|
41
|
+
return WithWorld._msgSender();
|
|
42
|
+
}
|
|
43
|
+
|
|
39
44
|
function _update(address from, address to, uint256 value) internal override(MUDERC20, ERC20Pausable) {
|
|
40
45
|
super._update(from, to, value);
|
|
41
46
|
}
|
|
@@ -6,7 +6,7 @@ import { ResourceId, WorldResourceIdLib } from "@latticexyz/world/src/WorldResou
|
|
|
6
6
|
|
|
7
7
|
library ModuleConstants {
|
|
8
8
|
bytes14 internal constant NAMESPACE = "erc20-module";
|
|
9
|
-
bytes16 internal constant REGISTRY_TABLE_NAME = "
|
|
9
|
+
bytes16 internal constant REGISTRY_TABLE_NAME = "ERC20Registry";
|
|
10
10
|
|
|
11
11
|
function namespaceId() internal pure returns (ResourceId) {
|
|
12
12
|
return WorldResourceIdLib.encodeNamespace(NAMESPACE);
|
|
@@ -18,19 +18,19 @@ library ModuleConstants {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
library ERC20TableNames {
|
|
21
|
-
bytes16 internal constant TOTAL_SUPPLY = "
|
|
21
|
+
bytes16 internal constant TOTAL_SUPPLY = "TotalSupply";
|
|
22
22
|
|
|
23
|
-
bytes16 internal constant BALANCES = "
|
|
23
|
+
bytes16 internal constant BALANCES = "Balances";
|
|
24
24
|
|
|
25
|
-
bytes16 internal constant ALLOWANCES = "
|
|
25
|
+
bytes16 internal constant ALLOWANCES = "Allowances";
|
|
26
26
|
|
|
27
|
-
bytes16 internal constant METADATA = "
|
|
27
|
+
bytes16 internal constant METADATA = "Metadata";
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
library OwnableTableNames {
|
|
31
|
-
bytes16 internal constant OWNER = "
|
|
31
|
+
bytes16 internal constant OWNER = "Owner";
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
library PausableTableNames {
|
|
35
|
-
bytes16 internal constant PAUSED = "
|
|
35
|
+
bytes16 internal constant PAUSED = "Paused";
|
|
36
36
|
}
|
|
@@ -5,6 +5,7 @@ import { ResourceIds } from "@latticexyz/store/src/codegen/tables/ResourceIds.so
|
|
|
5
5
|
import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
|
|
6
6
|
|
|
7
7
|
import { Module } from "@latticexyz/world/src/Module.sol";
|
|
8
|
+
import { RESOURCE_SYSTEM } from "@latticexyz/world/src/worldResourceTypes.sol";
|
|
8
9
|
import { WorldResourceIdLib } from "@latticexyz/world/src/WorldResourceId.sol";
|
|
9
10
|
import { IBaseWorld } from "@latticexyz/world/src/codegen/interfaces/IBaseWorld.sol";
|
|
10
11
|
import { revertWithBytes } from "@latticexyz/world/src/revertWithBytes.sol";
|
|
@@ -21,9 +22,13 @@ contract ERC20Module is Module {
|
|
|
21
22
|
// TODO: we should probably check just for namespace, not for all args
|
|
22
23
|
requireNotInstalled(__self, encodedArgs);
|
|
23
24
|
|
|
24
|
-
(bytes14 namespace, string memory name, string memory symbol) = abi.decode(
|
|
25
|
+
(bytes14 namespace, bytes16 systemName, string memory name, string memory symbol) = abi.decode(
|
|
26
|
+
encodedArgs,
|
|
27
|
+
(bytes14, bytes16, string, string)
|
|
28
|
+
);
|
|
25
29
|
|
|
26
30
|
ResourceId namespaceId = WorldResourceIdLib.encodeNamespace(namespace);
|
|
31
|
+
ResourceId systemId = WorldResourceIdLib.encode(RESOURCE_SYSTEM, namespace, systemName);
|
|
27
32
|
|
|
28
33
|
// Require the namespace to not be the module's namespace
|
|
29
34
|
if (namespace == ModuleConstants.NAMESPACE) {
|
|
@@ -39,6 +44,9 @@ contract ERC20Module is Module {
|
|
|
39
44
|
// Grant access to the token so it can write to tables after transferring ownership
|
|
40
45
|
world.grantAccess(namespaceId, address(token));
|
|
41
46
|
|
|
47
|
+
// Register token as a system so its functions can be called through the world
|
|
48
|
+
world.registerSystem(systemId, token, true);
|
|
49
|
+
|
|
42
50
|
// The token should have transferred the namespace ownership to this module in its constructor
|
|
43
51
|
world.transferOwnership(namespaceId, _msgSender());
|
|
44
52
|
|
package/dist/_esm-BQNWKNND.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{a as _,b as g,c as Ur,d as K}from"./chunk-LURIOADG.js";var nt=g((li,it)=>{"use strict";var{Duplex:Ir}=_("stream");function rt(t){t.emit("close")}function Dr(){!this.destroyed&&this._writableState.finished&&this.destroy()}function st(t){this.removeListener("error",st),this.destroy(),this.listenerCount("error")===0&&this.emit("error",t)}function Wr(t,e){let r=!0,s=new Ir({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return t.on("message",function(n,o){let f=!o&&s._readableState.objectMode?n.toString():n;s.push(f)||t.pause()}),t.once("error",function(n){s.destroyed||(r=!1,s.destroy(n))}),t.once("close",function(){s.destroyed||s.push(null)}),s._destroy=function(i,n){if(t.readyState===t.CLOSED){n(i),process.nextTick(rt,s);return}let o=!1;t.once("error",function(l){o=!0,n(l)}),t.once("close",function(){o||n(i),process.nextTick(rt,s)}),r&&t.terminate()},s._final=function(i){if(t.readyState===t.CONNECTING){t.once("open",function(){s._final(i)});return}t._socket!==null&&(t._socket._writableState.finished?(i(),s._readableState.endEmitted&&s.destroy()):(t._socket.once("finish",function(){i()}),t.close()))},s._read=function(){t.isPaused&&t.resume()},s._write=function(i,n,o){if(t.readyState===t.CONNECTING){t.once("open",function(){s._write(i,n,o)});return}t.send(i,o)},s.on("end",Dr),s.on("error",st),s}it.exports=Wr});var T=g((ci,ft)=>{"use strict";var ot=["nodebuffer","arraybuffer","fragments"],at=typeof Blob<"u";at&&ot.push("blob");ft.exports={BINARY_TYPES:ot,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:at,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var wt=g((hi,bt)=>{"use strict";var ut=_("fs"),C=_("path"),dt=_("os"),_t=typeof __webpack_require__=="function"?__non_webpack_require__:_,Mr=process.config&&process.config.variables||{},Ar=!!process.env.PREBUILDS_ONLY,lt=process.versions.modules,Se=jr()?"electron":qr()?"node-webkit":"node",ve=process.env.npm_config_arch||dt.arch(),Ee=process.env.npm_config_platform||dt.platform(),pt=process.env.LIBC||(Gr(Ee)?"musl":"glibc"),be=process.env.ARM_VERSION||(ve==="arm64"?"8":Mr.arm_version)||"",mt=(process.versions.uv||"").split(".")[0];bt.exports=k;function k(t){return _t(k.resolve(t))}k.resolve=k.path=function(t){t=C.resolve(t||".");try{var e=_t(C.join(t,"package.json")).name.toUpperCase().replace(/-/g,"_");process.env[e+"_PREBUILD"]&&(t=process.env[e+"_PREBUILD"])}catch{}if(!Ar){var r=ct(C.join(t,"build/Release"),ht);if(r)return r;var s=ct(C.join(t,"build/Debug"),ht);if(s)return s}var i=f(t);if(i)return i;var n=f(C.dirname(process.execPath));if(n)return n;var o=["platform="+Ee,"arch="+ve,"runtime="+Se,"abi="+lt,"uv="+mt,be?"armv="+be:"","libc="+pt,"node="+process.versions.node,process.versions.electron?"electron="+process.versions.electron:"",typeof __webpack_require__=="function"?"webpack=true":""].filter(Boolean).join(" ");throw new Error("No native build was found for "+o+`
|
|
2
|
-
loaded from: `+t+`
|
|
3
|
-
`);function f(l){var a=we(C.join(l,"prebuilds")).map(yt),c=a.filter(gt(Ee,ve)).sort(xt)[0];if(c){var h=C.join(l,"prebuilds",c.name),d=we(h).map(St),y=d.filter(vt(Se,lt)),p=y.sort(Et(Se))[0];if(p)return C.join(h,p.file)}}};function we(t){try{return ut.readdirSync(t)}catch{return[]}}function ct(t,e){var r=we(t).filter(e);return r[0]&&C.join(t,r[0])}function ht(t){return/\.node$/.test(t)}function yt(t){var e=t.split("-");if(e.length===2){var r=e[0],s=e[1].split("+");if(r&&s.length&&s.every(Boolean))return{name:t,platform:r,architectures:s}}}function gt(t,e){return function(r){return r==null||r.platform!==t?!1:r.architectures.includes(e)}}function xt(t,e){return t.architectures.length-e.architectures.length}function St(t){var e=t.split("."),r=e.pop(),s={file:t,specificity:0};if(r==="node"){for(var i=0;i<e.length;i++){var n=e[i];if(n==="node"||n==="electron"||n==="node-webkit")s.runtime=n;else if(n==="napi")s.napi=!0;else if(n.slice(0,3)==="abi")s.abi=n.slice(3);else if(n.slice(0,2)==="uv")s.uv=n.slice(2);else if(n.slice(0,4)==="armv")s.armv=n.slice(4);else if(n==="glibc"||n==="musl")s.libc=n;else continue;s.specificity++}return s}}function vt(t,e){return function(r){return!(r==null||r.runtime&&r.runtime!==t&&!Fr(r)||r.abi&&r.abi!==e&&!r.napi||r.uv&&r.uv!==mt||r.armv&&r.armv!==be||r.libc&&r.libc!==pt)}}function Fr(t){return t.runtime==="node"&&t.napi}function Et(t){return function(e,r){return e.runtime!==r.runtime?e.runtime===t?-1:1:e.abi!==r.abi?e.abi?-1:1:e.specificity!==r.specificity?e.specificity>r.specificity?-1:1:0}}function qr(){return!!(process.versions&&process.versions.nw)}function jr(){return process.versions&&process.versions.electron||process.env.ELECTRON_RUN_AS_NODE?!0:typeof window<"u"&&window.process&&window.process.type==="renderer"}function Gr(t){return t==="linux"&&ut.existsSync("/etc/alpine-release")}k.parseTags=St;k.matchTags=vt;k.compareTags=Et;k.parseTuple=yt;k.matchTuple=gt;k.compareTuples=xt});var Te=g((di,Oe)=>{"use strict";var ke=typeof __webpack_require__=="function"?__non_webpack_require__:_;typeof ke.addon=="function"?Oe.exports=ke.addon.bind(ke):Oe.exports=wt()});var Ot=g((pi,kt)=>{"use strict";var $r=(t,e,r,s,i)=>{for(var n=0;n<i;n++)r[s+n]=t[n]^e[n&3]},Vr=(t,e)=>{let r=t.length;for(var s=0;s<r;s++)t[s]^=e[s&3]};kt.exports={mask:$r,unmask:Vr}});var Tt=g((mi,Ce)=>{"use strict";try{Ce.exports=Te()(__dirname)}catch{Ce.exports=Ot()}});var X=g((yi,ne)=>{"use strict";var{EMPTY_BUFFER:zr}=T(),Ne=Buffer[Symbol.species];function Hr(t,e){if(t.length===0)return zr;if(t.length===1)return t[0];let r=Buffer.allocUnsafe(e),s=0;for(let i=0;i<t.length;i++){let n=t[i];r.set(n,s),s+=n.length}return s<e?new Ne(r.buffer,r.byteOffset,s):r}function Ct(t,e,r,s,i){for(let n=0;n<i;n++)r[s+n]=t[n]^e[n&3]}function Nt(t,e){for(let r=0;r<t.length;r++)t[r]^=e[r&3]}function Yr(t){return t.length===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.length)}function Le(t){if(Le.readOnly=!0,Buffer.isBuffer(t))return t;let e;return t instanceof ArrayBuffer?e=new Ne(t):ArrayBuffer.isView(t)?e=new Ne(t.buffer,t.byteOffset,t.byteLength):(e=Buffer.from(t),Le.readOnly=!1),e}ne.exports={concat:Hr,mask:Ct,toArrayBuffer:Yr,toBuffer:Le,unmask:Nt};if(!process.env.WS_NO_BUFFER_UTIL)try{let t=Tt();ne.exports.mask=function(e,r,s,i,n){n<48?Ct(e,r,s,i,n):t.mask(e,r,s,i,n)},ne.exports.unmask=function(e,r){e.length<32?Nt(e,r):t.unmask(e,r)}}catch{}});var Bt=g((gi,Pt)=>{"use strict";var Lt=Symbol("kDone"),Pe=Symbol("kRun"),Be=class{constructor(e){this[Lt]=()=>{this.pending--,this[Pe]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[Pe]()}[Pe](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[Lt])}}};Pt.exports=Be});var J=g((xi,Dt)=>{"use strict";var Z=_("zlib"),Rt=X(),Kr=Bt(),{kStatusCode:Ut}=T(),Xr=Buffer[Symbol.species],Zr=Buffer.from([0,0,255,255]),fe=Symbol("permessage-deflate"),N=Symbol("total-length"),Q=Symbol("callback"),B=Symbol("buffers"),ae=Symbol("error"),oe,Re=class{constructor(e,r,s){if(this._maxPayload=s|0,this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!r,this._deflate=null,this._inflate=null,this.params=null,!oe){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;oe=new Kr(i)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[Q];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let r=this._options,s=e.find(i=>!(r.serverNoContextTakeover===!1&&i.server_no_context_takeover||i.server_max_window_bits&&(r.serverMaxWindowBits===!1||typeof r.serverMaxWindowBits=="number"&&r.serverMaxWindowBits>i.server_max_window_bits)||typeof r.clientMaxWindowBits=="number"&&!i.client_max_window_bits));if(!s)throw new Error("None of the extension offers can be accepted");return r.serverNoContextTakeover&&(s.server_no_context_takeover=!0),r.clientNoContextTakeover&&(s.client_no_context_takeover=!0),typeof r.serverMaxWindowBits=="number"&&(s.server_max_window_bits=r.serverMaxWindowBits),typeof r.clientMaxWindowBits=="number"?s.client_max_window_bits=r.clientMaxWindowBits:(s.client_max_window_bits===!0||r.clientMaxWindowBits===!1)&&delete s.client_max_window_bits,s}acceptAsClient(e){let r=e[0];if(this._options.clientNoContextTakeover===!1&&r.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!r.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(r.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&r.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return r}normalizeParams(e){return e.forEach(r=>{Object.keys(r).forEach(s=>{let i=r[s];if(i.length>1)throw new Error(`Parameter "${s}" must have only a single value`);if(i=i[0],s==="client_max_window_bits"){if(i!==!0){let n=+i;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${s}": ${i}`);i=n}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${s}": ${i}`)}else if(s==="server_max_window_bits"){let n=+i;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${s}": ${i}`);i=n}else if(s==="client_no_context_takeover"||s==="server_no_context_takeover"){if(i!==!0)throw new TypeError(`Invalid value for parameter "${s}": ${i}`)}else throw new Error(`Unknown parameter "${s}"`);r[s]=i})}),e}decompress(e,r,s){oe.add(i=>{this._decompress(e,r,(n,o)=>{i(),s(n,o)})})}compress(e,r,s){oe.add(i=>{this._compress(e,r,(n,o)=>{i(),s(n,o)})})}_decompress(e,r,s){let i=this._isServer?"client":"server";if(!this._inflate){let n=`${i}_max_window_bits`,o=typeof this.params[n]!="number"?Z.Z_DEFAULT_WINDOWBITS:this.params[n];this._inflate=Z.createInflateRaw({...this._options.zlibInflateOptions,windowBits:o}),this._inflate[fe]=this,this._inflate[N]=0,this._inflate[B]=[],this._inflate.on("error",Jr),this._inflate.on("data",It)}this._inflate[Q]=s,this._inflate.write(e),r&&this._inflate.write(Zr),this._inflate.flush(()=>{let n=this._inflate[ae];if(n){this._inflate.close(),this._inflate=null,s(n);return}let o=Rt.concat(this._inflate[B],this._inflate[N]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[N]=0,this._inflate[B]=[],r&&this.params[`${i}_no_context_takeover`]&&this._inflate.reset()),s(null,o)})}_compress(e,r,s){let i=this._isServer?"server":"client";if(!this._deflate){let n=`${i}_max_window_bits`,o=typeof this.params[n]!="number"?Z.Z_DEFAULT_WINDOWBITS:this.params[n];this._deflate=Z.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:o}),this._deflate[N]=0,this._deflate[B]=[],this._deflate.on("data",Qr)}this._deflate[Q]=s,this._deflate.write(e),this._deflate.flush(Z.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let n=Rt.concat(this._deflate[B],this._deflate[N]);r&&(n=new Xr(n.buffer,n.byteOffset,n.length-4)),this._deflate[Q]=null,this._deflate[N]=0,this._deflate[B]=[],r&&this.params[`${i}_no_context_takeover`]&&this._deflate.reset(),s(null,n)})}};Dt.exports=Re;function Qr(t){this[B].push(t),this[N]+=t.length}function It(t){if(this[N]+=t.length,this[fe]._maxPayload<1||this[N]<=this[fe]._maxPayload){this[B].push(t);return}this[ae]=new RangeError("Max payload size exceeded"),this[ae].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[ae][Ut]=1009,this.removeListener("data",It),this.reset()}function Jr(t){this[fe]._inflate=null,t[Ut]=1007,this[Q](t)}});var Mt=g((Si,Wt)=>{"use strict";function es(t){let e=t.length,r=0;for(;r<e;)if(!(t[r]&128))r++;else if((t[r]&224)===192){if(r+1===e||(t[r+1]&192)!==128||(t[r]&254)===192)return!1;r+=2}else if((t[r]&240)===224){if(r+2>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||t[r]===224&&(t[r+1]&224)===128||t[r]===237&&(t[r+1]&224)===160)return!1;r+=3}else if((t[r]&248)===240){if(r+3>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||(t[r+3]&192)!==128||t[r]===240&&(t[r+1]&240)===128||t[r]===244&&t[r+1]>143||t[r]>244)return!1;r+=4}else return!1;return!0}Wt.exports=es});var At=g((vi,Ue)=>{"use strict";try{Ue.exports=Te()(__dirname)}catch{Ue.exports=Mt()}});var q=g((Ei,le)=>{"use strict";var{isUtf8:Ft}=_("buffer"),{hasBlob:ts}=T(),rs=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function ss(t){return t>=1e3&&t<=1014&&t!==1004&&t!==1005&&t!==1006||t>=3e3&&t<=4999}function Ie(t){let e=t.length,r=0;for(;r<e;)if(!(t[r]&128))r++;else if((t[r]&224)===192){if(r+1===e||(t[r+1]&192)!==128||(t[r]&254)===192)return!1;r+=2}else if((t[r]&240)===224){if(r+2>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||t[r]===224&&(t[r+1]&224)===128||t[r]===237&&(t[r+1]&224)===160)return!1;r+=3}else if((t[r]&248)===240){if(r+3>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||(t[r+3]&192)!==128||t[r]===240&&(t[r+1]&240)===128||t[r]===244&&t[r+1]>143||t[r]>244)return!1;r+=4}else return!1;return!0}function is(t){return ts&&typeof t=="object"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&(t[Symbol.toStringTag]==="Blob"||t[Symbol.toStringTag]==="File")}le.exports={isBlob:is,isValidStatusCode:ss,isValidUTF8:Ie,tokenChars:rs};if(Ft)le.exports.isValidUTF8=function(t){return t.length<24?Ie(t):Ft(t)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let t=At();le.exports.isValidUTF8=function(e){return e.length<32?Ie(e):t(e)}}catch{}});var Fe=g((bi,Ht)=>{"use strict";var{Writable:ns}=_("stream"),qt=J(),{BINARY_TYPES:os,EMPTY_BUFFER:jt,kStatusCode:as,kWebSocket:fs}=T(),{concat:De,toArrayBuffer:ls,unmask:cs}=X(),{isValidStatusCode:hs,isValidUTF8:Gt}=q(),ce=Buffer[Symbol.species],E=0,$t=1,Vt=2,zt=3,We=4,Me=5,he=6,Ae=class extends ns{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||os[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[fs]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=E}_write(e,r,s){if(this._opcode===8&&this._state==E)return s();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(s)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let s=this._buffers[0];return this._buffers[0]=new ce(s.buffer,s.byteOffset+e,s.length-e),new ce(s.buffer,s.byteOffset,e)}let r=Buffer.allocUnsafe(e);do{let s=this._buffers[0],i=r.length-e;e>=s.length?r.set(this._buffers.shift(),i):(r.set(new Uint8Array(s.buffer,s.byteOffset,e),i),this._buffers[0]=new ce(s.buffer,s.byteOffset+e,s.length-e)),e-=s.length}while(e>0);return r}startLoop(e){this._loop=!0;do switch(this._state){case E:this.getInfo(e);break;case $t:this.getPayloadLength16(e);break;case Vt:this.getPayloadLength64(e);break;case zt:this.getMask();break;case We:this.getData(e);break;case Me:case he:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let r=this.consume(2);if(r[0]&48){let i=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(i);return}let s=(r[0]&64)===64;if(s&&!this._extensions[qt.extensionName]){let i=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(i);return}if(this._fin=(r[0]&128)===128,this._opcode=r[0]&15,this._payloadLength=r[1]&127,this._opcode===0){if(s){let i=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(i);return}if(!this._fragmented){let i=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(i);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let i=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(i);return}this._compressed=s}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let i=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(i);return}if(s){let i=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(i);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let i=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(i);return}}else{let i=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(i);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(r[1]&128)===128,this._isServer){if(!this._masked){let i=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(i);return}}else if(this._masked){let i=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(i);return}this._payloadLength===126?this._state=$t:this._payloadLength===127?this._state=Vt:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let r=this.consume(8),s=r.readUInt32BE(0);if(s>Math.pow(2,21)-1){let i=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(i);return}this._payloadLength=s*Math.pow(2,32)+r.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let r=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(r);return}this._masked?this._state=zt:this._state=We}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=We}getData(e){let r=jt;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}r=this.consume(this._payloadLength),this._masked&&this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3]&&cs(r,this._mask)}if(this._opcode>7){this.controlMessage(r,e);return}if(this._compressed){this._state=Me,this.decompress(r,e);return}r.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(r)),this.dataMessage(e)}decompress(e,r){this._extensions[qt.extensionName].decompress(e,this._fin,(i,n)=>{if(i)return r(i);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let o=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(o);return}this._fragments.push(n)}this.dataMessage(r),this._state===E&&this.startLoop(r)})}dataMessage(e){if(!this._fin){this._state=E;return}let r=this._messageLength,s=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let i;this._binaryType==="nodebuffer"?i=De(s,r):this._binaryType==="arraybuffer"?i=ls(De(s,r)):this._binaryType==="blob"?i=new Blob(s):i=s,this._allowSynchronousEvents?(this.emit("message",i,!0),this._state=E):(this._state=he,setImmediate(()=>{this.emit("message",i,!0),this._state=E,this.startLoop(e)}))}else{let i=De(s,r);if(!this._skipUTF8Validation&&!Gt(i)){let n=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(n);return}this._state===Me||this._allowSynchronousEvents?(this.emit("message",i,!1),this._state=E):(this._state=he,setImmediate(()=>{this.emit("message",i,!1),this._state=E,this.startLoop(e)}))}}controlMessage(e,r){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,jt),this.end();else{let s=e.readUInt16BE(0);if(!hs(s)){let n=this.createError(RangeError,`invalid status code ${s}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(n);return}let i=new ce(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!Gt(i)){let n=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");r(n);return}this._loop=!1,this.emit("conclude",s,i),this.end()}this._state=E;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=E):(this._state=he,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=E,this.startLoop(r)}))}createError(e,r,s,i,n){this._loop=!1,this._errored=!0;let o=new e(s?`Invalid WebSocket frame: ${r}`:r);return Error.captureStackTrace(o,this.createError),o.code=n,o[as]=i,o}};Ht.exports=Ae});var Ge=g((ki,Xt)=>{"use strict";var{Duplex:wi}=_("stream"),{randomFillSync:us}=_("crypto"),Yt=J(),{EMPTY_BUFFER:ds,kWebSocket:_s,NOOP:ps}=T(),{isBlob:j,isValidStatusCode:ms}=q(),{mask:Kt,toBuffer:U}=X(),b=Symbol("kByteLength"),ys=Buffer.alloc(4),ue=8*1024,I,G=ue,w=0,gs=1,xs=2,qe=class t{constructor(e,r,s){this._extensions=r||{},s&&(this._generateMask=s,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=w,this.onerror=ps,this[_s]=void 0}static frame(e,r){let s,i=!1,n=2,o=!1;r.mask&&(s=r.maskBuffer||ys,r.generateMask?r.generateMask(s):(G===ue&&(I===void 0&&(I=Buffer.alloc(ue)),us(I,0,ue),G=0),s[0]=I[G++],s[1]=I[G++],s[2]=I[G++],s[3]=I[G++]),o=(s[0]|s[1]|s[2]|s[3])===0,n=6);let f;typeof e=="string"?(!r.mask||o)&&r[b]!==void 0?f=r[b]:(e=Buffer.from(e),f=e.length):(f=e.length,i=r.mask&&r.readOnly&&!o);let l=f;f>=65536?(n+=8,l=127):f>125&&(n+=2,l=126);let a=Buffer.allocUnsafe(i?f+n:n);return a[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(a[0]|=64),a[1]=l,l===126?a.writeUInt16BE(f,2):l===127&&(a[2]=a[3]=0,a.writeUIntBE(f,4,6)),r.mask?(a[1]|=128,a[n-4]=s[0],a[n-3]=s[1],a[n-2]=s[2],a[n-1]=s[3],o?[a,e]:i?(Kt(e,s,a,n,f),[a]):(Kt(e,s,e,0,f),[a,e])):[a,e]}close(e,r,s,i){let n;if(e===void 0)n=ds;else{if(typeof e!="number"||!ms(e))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.length)n=Buffer.allocUnsafe(2),n.writeUInt16BE(e,0);else{let f=Buffer.byteLength(r);if(f>123)throw new RangeError("The message must not be greater than 123 bytes");n=Buffer.allocUnsafe(2+f),n.writeUInt16BE(e,0),typeof r=="string"?n.write(r,2):n.set(r,2)}}let o={[b]:n.length,fin:!0,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==w?this.enqueue([this.dispatch,n,!1,o,i]):this.sendFrame(t.frame(n,o),i)}ping(e,r,s){let i,n;if(typeof e=="string"?(i=Buffer.byteLength(e),n=!1):j(e)?(i=e.size,n=!1):(e=U(e),i=e.length,n=U.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[b]:i,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:n,rsv1:!1};j(e)?this._state!==w?this.enqueue([this.getBlobData,e,!1,o,s]):this.getBlobData(e,!1,o,s):this._state!==w?this.enqueue([this.dispatch,e,!1,o,s]):this.sendFrame(t.frame(e,o),s)}pong(e,r,s){let i,n;if(typeof e=="string"?(i=Buffer.byteLength(e),n=!1):j(e)?(i=e.size,n=!1):(e=U(e),i=e.length,n=U.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[b]:i,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:n,rsv1:!1};j(e)?this._state!==w?this.enqueue([this.getBlobData,e,!1,o,s]):this.getBlobData(e,!1,o,s):this._state!==w?this.enqueue([this.dispatch,e,!1,o,s]):this.sendFrame(t.frame(e,o),s)}send(e,r,s){let i=this._extensions[Yt.extensionName],n=r.binary?2:1,o=r.compress,f,l;typeof e=="string"?(f=Buffer.byteLength(e),l=!1):j(e)?(f=e.size,l=!1):(e=U(e),f=e.length,l=U.readOnly),this._firstFragment?(this._firstFragment=!1,o&&i&&i.params[i._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(o=f>=i._threshold),this._compress=o):(o=!1,n=0),r.fin&&(this._firstFragment=!0);let a={[b]:f,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:l,rsv1:o};j(e)?this._state!==w?this.enqueue([this.getBlobData,e,this._compress,a,s]):this.getBlobData(e,this._compress,a,s):this._state!==w?this.enqueue([this.dispatch,e,this._compress,a,s]):this.dispatch(e,this._compress,a,s)}getBlobData(e,r,s,i){this._bufferedBytes+=s[b],this._state=xs,e.arrayBuffer().then(n=>{if(this._socket.destroyed){let f=new Error("The socket was closed while the blob was being read");process.nextTick(je,this,f,i);return}this._bufferedBytes-=s[b];let o=U(n);r?this.dispatch(o,r,s,i):(this._state=w,this.sendFrame(t.frame(o,s),i),this.dequeue())}).catch(n=>{process.nextTick(Ss,this,n,i)})}dispatch(e,r,s,i){if(!r){this.sendFrame(t.frame(e,s),i);return}let n=this._extensions[Yt.extensionName];this._bufferedBytes+=s[b],this._state=gs,n.compress(e,s.fin,(o,f)=>{if(this._socket.destroyed){let l=new Error("The socket was closed while data was being compressed");je(this,l,i);return}this._bufferedBytes-=s[b],this._state=w,s.readOnly=!1,this.sendFrame(t.frame(f,s),i),this.dequeue()})}dequeue(){for(;this._state===w&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][b],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][b],this._queue.push(e)}sendFrame(e,r){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],r),this._socket.uncork()):this._socket.write(e[0],r)}};Xt.exports=qe;function je(t,e,r){typeof r=="function"&&r(e);for(let s=0;s<t._queue.length;s++){let i=t._queue[s],n=i[i.length-1];typeof n=="function"&&n(e)}}function Ss(t,e,r){je(t,e,r),t.onerror(e)}});var nr=g((Oi,ir)=>{"use strict";var{kForOnEventAttribute:ee,kListener:$e}=T(),Zt=Symbol("kCode"),Qt=Symbol("kData"),Jt=Symbol("kError"),er=Symbol("kMessage"),tr=Symbol("kReason"),$=Symbol("kTarget"),rr=Symbol("kType"),sr=Symbol("kWasClean"),L=class{constructor(e){this[$]=null,this[rr]=e}get target(){return this[$]}get type(){return this[rr]}};Object.defineProperty(L.prototype,"target",{enumerable:!0});Object.defineProperty(L.prototype,"type",{enumerable:!0});var D=class extends L{constructor(e,r={}){super(e),this[Zt]=r.code===void 0?0:r.code,this[tr]=r.reason===void 0?"":r.reason,this[sr]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[Zt]}get reason(){return this[tr]}get wasClean(){return this[sr]}};Object.defineProperty(D.prototype,"code",{enumerable:!0});Object.defineProperty(D.prototype,"reason",{enumerable:!0});Object.defineProperty(D.prototype,"wasClean",{enumerable:!0});var V=class extends L{constructor(e,r={}){super(e),this[Jt]=r.error===void 0?null:r.error,this[er]=r.message===void 0?"":r.message}get error(){return this[Jt]}get message(){return this[er]}};Object.defineProperty(V.prototype,"error",{enumerable:!0});Object.defineProperty(V.prototype,"message",{enumerable:!0});var te=class extends L{constructor(e,r={}){super(e),this[Qt]=r.data===void 0?null:r.data}get data(){return this[Qt]}};Object.defineProperty(te.prototype,"data",{enumerable:!0});var vs={addEventListener(t,e,r={}){for(let i of this.listeners(t))if(!r[ee]&&i[$e]===e&&!i[ee])return;let s;if(t==="message")s=function(n,o){let f=new te("message",{data:o?n:n.toString()});f[$]=this,de(e,this,f)};else if(t==="close")s=function(n,o){let f=new D("close",{code:n,reason:o.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});f[$]=this,de(e,this,f)};else if(t==="error")s=function(n){let o=new V("error",{error:n,message:n.message});o[$]=this,de(e,this,o)};else if(t==="open")s=function(){let n=new L("open");n[$]=this,de(e,this,n)};else return;s[ee]=!!r[ee],s[$e]=e,r.once?this.once(t,s):this.on(t,s)},removeEventListener(t,e){for(let r of this.listeners(t))if(r[$e]===e&&!r[ee]){this.removeListener(t,r);break}}};ir.exports={CloseEvent:D,ErrorEvent:V,Event:L,EventTarget:vs,MessageEvent:te};function de(t,e,r){typeof t=="object"&&t.handleEvent?t.handleEvent.call(t,r):t.call(e,r)}});var Ve=g((Ti,or)=>{"use strict";var{tokenChars:re}=q();function O(t,e,r){t[e]===void 0?t[e]=[r]:t[e].push(r)}function Es(t){let e=Object.create(null),r=Object.create(null),s=!1,i=!1,n=!1,o,f,l=-1,a=-1,c=-1,h=0;for(;h<t.length;h++)if(a=t.charCodeAt(h),o===void 0)if(c===-1&&re[a]===1)l===-1&&(l=h);else if(h!==0&&(a===32||a===9))c===-1&&l!==-1&&(c=h);else if(a===59||a===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${h}`);c===-1&&(c=h);let y=t.slice(l,c);a===44?(O(e,y,r),r=Object.create(null)):o=y,l=c=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);else if(f===void 0)if(c===-1&&re[a]===1)l===-1&&(l=h);else if(a===32||a===9)c===-1&&l!==-1&&(c=h);else if(a===59||a===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${h}`);c===-1&&(c=h),O(r,t.slice(l,c),!0),a===44&&(O(e,o,r),r=Object.create(null),o=void 0),l=c=-1}else if(a===61&&l!==-1&&c===-1)f=t.slice(l,h),l=c=-1;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(i){if(re[a]!==1)throw new SyntaxError(`Unexpected character at index ${h}`);l===-1?l=h:s||(s=!0),i=!1}else if(n)if(re[a]===1)l===-1&&(l=h);else if(a===34&&l!==-1)n=!1,c=h;else if(a===92)i=!0;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(a===34&&t.charCodeAt(h-1)===61)n=!0;else if(c===-1&&re[a]===1)l===-1&&(l=h);else if(l!==-1&&(a===32||a===9))c===-1&&(c=h);else if(a===59||a===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${h}`);c===-1&&(c=h);let y=t.slice(l,c);s&&(y=y.replace(/\\/g,""),s=!1),O(r,f,y),a===44&&(O(e,o,r),r=Object.create(null),o=void 0),f=void 0,l=c=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);if(l===-1||n||a===32||a===9)throw new SyntaxError("Unexpected end of input");c===-1&&(c=h);let d=t.slice(l,c);return o===void 0?O(e,d,r):(f===void 0?O(r,d,!0):s?O(r,f,d.replace(/\\/g,"")):O(r,f,d),O(e,o,r)),e}function bs(t){return Object.keys(t).map(e=>{let r=t[e];return Array.isArray(r)||(r=[r]),r.map(s=>[e].concat(Object.keys(s).map(i=>{let n=s[i];return Array.isArray(n)||(n=[n]),n.map(o=>o===!0?i:`${i}=${o}`).join("; ")})).join("; ")).join(", ")}).join(", ")}or.exports={format:bs,parse:Es}});var Xe=g((Li,gr)=>{"use strict";var ws=_("events"),ks=_("https"),Os=_("http"),lr=_("net"),Ts=_("tls"),{randomBytes:Cs,createHash:Ns}=_("crypto"),{Duplex:Ci,Readable:Ni}=_("stream"),{URL:ze}=_("url"),R=J(),Ls=Fe(),Ps=Ge(),{isBlob:Bs}=q(),{BINARY_TYPES:ar,EMPTY_BUFFER:_e,GUID:Rs,kForOnEventAttribute:He,kListener:Us,kStatusCode:Is,kWebSocket:x,NOOP:cr}=T(),{EventTarget:{addEventListener:Ds,removeEventListener:Ws}}=nr(),{format:Ms,parse:As}=Ve(),{toBuffer:Fs}=X(),qs=30*1e3,hr=Symbol("kAborted"),Ye=[8,13],P=["CONNECTING","OPEN","CLOSING","CLOSED"],js=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,m=class t extends ws{constructor(e,r,s){super(),this._binaryType=ar[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=_e,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=t.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,r===void 0?r=[]:Array.isArray(r)||(typeof r=="object"&&r!==null?(s=r,r=[]):r=[r]),ur(this,e,r,s)):(this._autoPong=s.autoPong,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){ar.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,r,s){let i=new Ls({allowSynchronousEvents:s.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation}),n=new Ps(e,this._extensions,s.generateMask);this._receiver=i,this._sender=n,this._socket=e,i[x]=this,n[x]=this,e[x]=this,i.on("conclude",Vs),i.on("drain",zs),i.on("error",Hs),i.on("message",Ys),i.on("ping",Ks),i.on("pong",Xs),n.onerror=Zs,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),r.length>0&&e.unshift(r),e.on("close",pr),e.on("data",me),e.on("end",mr),e.on("error",yr),this._readyState=t.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[R.extensionName]&&this._extensions[R.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,r){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){v(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===t.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=t.CLOSING,this._sender.close(e,r,!this._isServer,s=>{s||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),_r(this)}}pause(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,r,s){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(s=e,e=r=void 0):typeof r=="function"&&(s=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){Ke(this,e,s);return}r===void 0&&(r=!this._isServer),this._sender.ping(e||_e,r,s)}pong(e,r,s){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(s=e,e=r=void 0):typeof r=="function"&&(s=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){Ke(this,e,s);return}r===void 0&&(r=!this._isServer),this._sender.pong(e||_e,r,s)}resume(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,r,s){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(s=r,r={}),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){Ke(this,e,s);return}let i={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[R.extensionName]||(i.compress=!1),this._sender.send(e||_e,i,s)}terminate(){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){v(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=t.CLOSING,this._socket.destroy())}}};Object.defineProperty(m,"CONNECTING",{enumerable:!0,value:P.indexOf("CONNECTING")});Object.defineProperty(m.prototype,"CONNECTING",{enumerable:!0,value:P.indexOf("CONNECTING")});Object.defineProperty(m,"OPEN",{enumerable:!0,value:P.indexOf("OPEN")});Object.defineProperty(m.prototype,"OPEN",{enumerable:!0,value:P.indexOf("OPEN")});Object.defineProperty(m,"CLOSING",{enumerable:!0,value:P.indexOf("CLOSING")});Object.defineProperty(m.prototype,"CLOSING",{enumerable:!0,value:P.indexOf("CLOSING")});Object.defineProperty(m,"CLOSED",{enumerable:!0,value:P.indexOf("CLOSED")});Object.defineProperty(m.prototype,"CLOSED",{enumerable:!0,value:P.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(t=>{Object.defineProperty(m.prototype,t,{enumerable:!0})});["open","error","close","message"].forEach(t=>{Object.defineProperty(m.prototype,`on${t}`,{enumerable:!0,get(){for(let e of this.listeners(t))if(e[He])return e[Us];return null},set(e){for(let r of this.listeners(t))if(r[He]){this.removeListener(t,r);break}typeof e=="function"&&this.addEventListener(t,e,{[He]:!0})}})});m.prototype.addEventListener=Ds;m.prototype.removeEventListener=Ws;gr.exports=m;function ur(t,e,r,s){let i={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:Ye[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...s,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(t._autoPong=i.autoPong,!Ye.includes(i.protocolVersion))throw new RangeError(`Unsupported protocol version: ${i.protocolVersion} (supported versions: ${Ye.join(", ")})`);let n;if(e instanceof ze)n=e;else try{n=new ze(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}n.protocol==="http:"?n.protocol="ws:":n.protocol==="https:"&&(n.protocol="wss:"),t._url=n.href;let o=n.protocol==="wss:",f=n.protocol==="ws+unix:",l;if(n.protocol!=="ws:"&&!o&&!f?l=`The URL's protocol must be one of "ws:", "wss:", "http:", "https", or "ws+unix:"`:f&&!n.pathname?l="The URL's pathname is empty":n.hash&&(l="The URL contains a fragment identifier"),l){let u=new SyntaxError(l);if(t._redirects===0)throw u;pe(t,u);return}let a=o?443:80,c=Cs(16).toString("base64"),h=o?ks.request:Os.request,d=new Set,y;if(i.createConnection=i.createConnection||(o?$s:Gs),i.defaultPort=i.defaultPort||a,i.port=n.port||a,i.host=n.hostname.startsWith("[")?n.hostname.slice(1,-1):n.hostname,i.headers={...i.headers,"Sec-WebSocket-Version":i.protocolVersion,"Sec-WebSocket-Key":c,Connection:"Upgrade",Upgrade:"websocket"},i.path=n.pathname+n.search,i.timeout=i.handshakeTimeout,i.perMessageDeflate&&(y=new R(i.perMessageDeflate!==!0?i.perMessageDeflate:{},!1,i.maxPayload),i.headers["Sec-WebSocket-Extensions"]=Ms({[R.extensionName]:y.offer()})),r.length){for(let u of r){if(typeof u!="string"||!js.test(u)||d.has(u))throw new SyntaxError("An invalid or duplicated subprotocol was specified");d.add(u)}i.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(i.origin&&(i.protocolVersion<13?i.headers["Sec-WebSocket-Origin"]=i.origin:i.headers.Origin=i.origin),(n.username||n.password)&&(i.auth=`${n.username}:${n.password}`),f){let u=i.path.split(":");i.socketPath=u[0],i.path=u[1]}let p;if(i.followRedirects){if(t._redirects===0){t._originalIpc=f,t._originalSecure=o,t._originalHostOrSocketPath=f?i.socketPath:n.host;let u=s&&s.headers;if(s={...s,headers:{}},u)for(let[S,A]of Object.entries(u))s.headers[S.toLowerCase()]=A}else if(t.listenerCount("redirect")===0){let u=f?t._originalIpc?i.socketPath===t._originalHostOrSocketPath:!1:t._originalIpc?!1:n.host===t._originalHostOrSocketPath;(!u||t._originalSecure&&!o)&&(delete i.headers.authorization,delete i.headers.cookie,u||delete i.headers.host,i.auth=void 0)}i.auth&&!s.headers.authorization&&(s.headers.authorization="Basic "+Buffer.from(i.auth).toString("base64")),p=t._req=h(i),t._redirects&&t.emit("redirect",t.url,p)}else p=t._req=h(i);i.timeout&&p.on("timeout",()=>{v(t,p,"Opening handshake has timed out")}),p.on("error",u=>{p===null||p[hr]||(p=t._req=null,pe(t,u))}),p.on("response",u=>{let S=u.headers.location,A=u.statusCode;if(S&&i.followRedirects&&A>=300&&A<400){if(++t._redirects>i.maxRedirects){v(t,p,"Maximum redirects exceeded");return}p.abort();let H;try{H=new ze(S,e)}catch{let F=new SyntaxError(`Invalid URL: ${S}`);pe(t,F);return}ur(t,H,r,s)}else t.emit("unexpected-response",p,u)||v(t,p,`Unexpected server response: ${u.statusCode}`)}),p.on("upgrade",(u,S,A)=>{if(t.emit("upgrade",u),t.readyState!==m.CONNECTING)return;p=t._req=null;let H=u.headers.upgrade;if(H===void 0||H.toLowerCase()!=="websocket"){v(t,S,"Invalid Upgrade header");return}let Je=Ns("sha1").update(c+Rs).digest("base64");if(u.headers["sec-websocket-accept"]!==Je){v(t,S,"Invalid Sec-WebSocket-Accept header");return}let F=u.headers["sec-websocket-protocol"],Y;if(F!==void 0?d.size?d.has(F)||(Y="Server sent an invalid subprotocol"):Y="Server sent a subprotocol but none was requested":d.size&&(Y="Server sent no subprotocol"),Y){v(t,S,Y);return}F&&(t._protocol=F);let et=u.headers["sec-websocket-extensions"];if(et!==void 0){if(!y){v(t,S,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let ge;try{ge=As(et)}catch{v(t,S,"Invalid Sec-WebSocket-Extensions header");return}let tt=Object.keys(ge);if(tt.length!==1||tt[0]!==R.extensionName){v(t,S,"Server indicated an extension that was not requested");return}try{y.accept(ge[R.extensionName])}catch{v(t,S,"Invalid Sec-WebSocket-Extensions header");return}t._extensions[R.extensionName]=y}t.setSocket(S,A,{allowSynchronousEvents:i.allowSynchronousEvents,generateMask:i.generateMask,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation})}),i.finishRequest?i.finishRequest(p,t):p.end()}function pe(t,e){t._readyState=m.CLOSING,t._errorEmitted=!0,t.emit("error",e),t.emitClose()}function Gs(t){return t.path=t.socketPath,lr.connect(t)}function $s(t){return t.path=void 0,!t.servername&&t.servername!==""&&(t.servername=lr.isIP(t.host)?"":t.host),Ts.connect(t)}function v(t,e,r){t._readyState=m.CLOSING;let s=new Error(r);Error.captureStackTrace(s,v),e.setHeader?(e[hr]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(pe,t,s)):(e.destroy(s),e.once("error",t.emit.bind(t,"error")),e.once("close",t.emitClose.bind(t)))}function Ke(t,e,r){if(e){let s=Bs(e)?e.size:Fs(e).length;t._socket?t._sender._bufferedBytes+=s:t._bufferedAmount+=s}if(r){let s=new Error(`WebSocket is not open: readyState ${t.readyState} (${P[t.readyState]})`);process.nextTick(r,s)}}function Vs(t,e){let r=this[x];r._closeFrameReceived=!0,r._closeMessage=e,r._closeCode=t,r._socket[x]!==void 0&&(r._socket.removeListener("data",me),process.nextTick(dr,r._socket),t===1005?r.close():r.close(t,e))}function zs(){let t=this[x];t.isPaused||t._socket.resume()}function Hs(t){let e=this[x];e._socket[x]!==void 0&&(e._socket.removeListener("data",me),process.nextTick(dr,e._socket),e.close(t[Is])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t))}function fr(){this[x].emitClose()}function Ys(t,e){this[x].emit("message",t,e)}function Ks(t){let e=this[x];e._autoPong&&e.pong(t,!this._isServer,cr),e.emit("ping",t)}function Xs(t){this[x].emit("pong",t)}function dr(t){t.resume()}function Zs(t){let e=this[x];e.readyState!==m.CLOSED&&(e.readyState===m.OPEN&&(e._readyState=m.CLOSING,_r(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t)))}function _r(t){t._closeTimer=setTimeout(t._socket.destroy.bind(t._socket),qs)}function pr(){let t=this[x];this.removeListener("close",pr),this.removeListener("data",me),this.removeListener("end",mr),t._readyState=m.CLOSING;let e;!this._readableState.endEmitted&&!t._closeFrameReceived&&!t._receiver._writableState.errorEmitted&&(e=t._socket.read())!==null&&t._receiver.write(e),t._receiver.end(),this[x]=void 0,clearTimeout(t._closeTimer),t._receiver._writableState.finished||t._receiver._writableState.errorEmitted?t.emitClose():(t._receiver.on("error",fr),t._receiver.on("finish",fr))}function me(t){this[x]._receiver.write(t)||this.pause()}function mr(){let t=this[x];t._readyState=m.CLOSING,t._receiver.end(),this.end()}function yr(){let t=this[x];this.removeListener("error",yr),this.on("error",cr),t&&(t._readyState=m.CLOSING,this.destroy())}});var Sr=g((Pi,xr)=>{"use strict";var{tokenChars:Qs}=q();function Js(t){let e=new Set,r=-1,s=-1,i=0;for(i;i<t.length;i++){let o=t.charCodeAt(i);if(s===-1&&Qs[o]===1)r===-1&&(r=i);else if(i!==0&&(o===32||o===9))s===-1&&r!==-1&&(s=i);else if(o===44){if(r===-1)throw new SyntaxError(`Unexpected character at index ${i}`);s===-1&&(s=i);let f=t.slice(r,s);if(e.has(f))throw new SyntaxError(`The "${f}" subprotocol is duplicated`);e.add(f),r=s=-1}else throw new SyntaxError(`Unexpected character at index ${i}`)}if(r===-1||s!==-1)throw new SyntaxError("Unexpected end of input");let n=t.slice(r,i);if(e.has(n))throw new SyntaxError(`The "${n}" subprotocol is duplicated`);return e.add(n),e}xr.exports={parse:Js}});var Tr=g((Ri,Or)=>{"use strict";var ei=_("events"),ye=_("http"),{Duplex:Bi}=_("stream"),{createHash:ti}=_("crypto"),vr=Ve(),W=J(),ri=Sr(),si=Xe(),{GUID:ii,kWebSocket:ni}=T(),oi=/^[+/0-9A-Za-z]{22}==$/,Er=0,br=1,kr=2,Ze=class extends ei{constructor(e,r){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:si,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=ye.createServer((s,i)=>{let n=ye.STATUS_CODES[426];i.writeHead(426,{"Content-Length":n.length,"Content-Type":"text/plain"}),i.end(n)}),this._server.listen(e.port,e.host,e.backlog,r)):e.server&&(this._server=e.server),this._server){let s=this.emit.bind(this,"connection");this._removeListeners=ai(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(i,n,o)=>{this.handleUpgrade(i,n,o,s)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=Er}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===kr){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(se,this);return}if(e&&this.once("close",e),this._state!==br)if(this._state=br,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(se,this):process.nextTick(se,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{se(this)})}}shouldHandle(e){if(this.options.path){let r=e.url.indexOf("?");if((r!==-1?e.url.slice(0,r):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,r,s,i){r.on("error",wr);let n=e.headers["sec-websocket-key"],o=e.headers.upgrade,f=+e.headers["sec-websocket-version"];if(e.method!=="GET"){M(this,e,r,405,"Invalid HTTP method");return}if(o===void 0||o.toLowerCase()!=="websocket"){M(this,e,r,400,"Invalid Upgrade header");return}if(n===void 0||!oi.test(n)){M(this,e,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(f!==8&&f!==13){M(this,e,r,400,"Missing or invalid Sec-WebSocket-Version header");return}if(!this.shouldHandle(e)){ie(r,400);return}let l=e.headers["sec-websocket-protocol"],a=new Set;if(l!==void 0)try{a=ri.parse(l)}catch{M(this,e,r,400,"Invalid Sec-WebSocket-Protocol header");return}let c=e.headers["sec-websocket-extensions"],h={};if(this.options.perMessageDeflate&&c!==void 0){let d=new W(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let y=vr.parse(c);y[W.extensionName]&&(d.accept(y[W.extensionName]),h[W.extensionName]=d)}catch{M(this,e,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let d={origin:e.headers[`${f===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(d,(y,p,u,S)=>{if(!y)return ie(r,p||401,u,S);this.completeUpgrade(h,n,a,e,r,s,i)});return}if(!this.options.verifyClient(d))return ie(r,401)}this.completeUpgrade(h,n,a,e,r,s,i)}completeUpgrade(e,r,s,i,n,o,f){if(!n.readable||!n.writable)return n.destroy();if(n[ni])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Er)return ie(n,503);let a=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${ti("sha1").update(r+ii).digest("base64")}`],c=new this.options.WebSocket(null,void 0,this.options);if(s.size){let h=this.options.handleProtocols?this.options.handleProtocols(s,i):s.values().next().value;h&&(a.push(`Sec-WebSocket-Protocol: ${h}`),c._protocol=h)}if(e[W.extensionName]){let h=e[W.extensionName].params,d=vr.format({[W.extensionName]:[h]});a.push(`Sec-WebSocket-Extensions: ${d}`),c._extensions=e}this.emit("headers",a,i),n.write(a.concat(`\r
|
|
4
|
-
`).join(`\r
|
|
5
|
-
`)),n.removeListener("error",wr),c.setSocket(n,o,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(c),c.on("close",()=>{this.clients.delete(c),this._shouldEmitClose&&!this.clients.size&&process.nextTick(se,this)})),f(c,i)}};Or.exports=Ze;function ai(t,e){for(let r of Object.keys(e))t.on(r,e[r]);return function(){for(let s of Object.keys(e))t.removeListener(s,e[s])}}function se(t){t._state=kr,t.emit("close")}function wr(){this.destroy()}function ie(t,e,r,s){r=r||ye.STATUS_CODES[e],s={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(r),...s},t.once("finish",t.destroy),t.end(`HTTP/1.1 ${e} ${ye.STATUS_CODES[e]}\r
|
|
6
|
-
`+Object.keys(s).map(i=>`${i}: ${s[i]}`).join(`\r
|
|
7
|
-
`)+`\r
|
|
8
|
-
\r
|
|
9
|
-
`+r)}function M(t,e,r,s,i){if(t.listenerCount("wsClientError")){let n=new Error(i);Error.captureStackTrace(n,M),t.emit("wsClientError",n,r,e)}else ie(r,s,i)}});var Qe={};Ur(Qe,{Receiver:()=>Nr.default,Sender:()=>Lr.default,WebSocket:()=>z.default,WebSocketServer:()=>Pr.default,createWebSocketStream:()=>Cr.default,default:()=>fi});var Cr=K(nt(),1),Nr=K(Fe(),1),Lr=K(Ge(),1),z=K(Xe(),1),Pr=K(Tr(),1);var fi=z.default;function Br(){if(typeof WebSocket<"u")return WebSocket;if(typeof global.WebSocket<"u")return global.WebSocket;if(typeof window.WebSocket<"u")return window.WebSocket;if(typeof self.WebSocket<"u")return self.WebSocket;throw new Error("`WebSocket` is not supported in this environment")}var Di=(()=>{try{return Br()}catch{return z.default?z.default:Qe}})();export{Di as WebSocket};
|
|
10
|
-
//# sourceMappingURL=_esm-BQNWKNND.js.map
|
package/dist/ccip-YAWUVTAX.js
DELETED
package/dist/chunk-GSBUANUZ.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import{a as Tt,b as an,d as Bt,e as un,f as cn,i as kt,j as zt,k as pn,m as dn,n as fn,o as mn}from"./chunk-TJJDXMQ6.js";var ln="1.0.6";var x=class e extends Error{constructor(t,n={}){let r=n.cause instanceof e?n.cause.details:n.cause?.message?n.cause.message:n.details,o=n.cause instanceof e&&n.cause.docsPath||n.docsPath,i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...o?[`Docs: https://abitype.dev${o}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${ln}`].join(`
|
|
2
|
-
`);super(i),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.shortMessage=t}};function $(e,t){return e.exec(t)?.groups}var Ot=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Ct=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,Me=/^\(.+?\).*?$/;var yn=/^tuple(?<array>(\[(\d*)\])*)$/;function Se(e){let t=e.type;if(yn.test(e.type)&&"components"in e){t="(";let n=e.components.length;for(let o=0;o<n;o++){let i=e.components[o];t+=Se(i),o<n-1&&(t+=", ")}let r=$(yn,e.type);return t+=`)${r?.array??""}`,Se({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function W(e){let t="",n=e.length;for(let r=0;r<n;r++){let o=e[r];t+=Se(o),r!==n-1&&(t+=", ")}return t}function Rt(e){return e.type==="function"?`function ${e.name}(${W(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${e.outputs.length?` returns (${W(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${W(e.inputs)})`:e.type==="error"?`error ${e.name}(${W(e.inputs)})`:e.type==="constructor"?`constructor(${W(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?"fallback()":"receive() external payable"}var bn=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function hn(e){return bn.test(e)}function xn(e){return $(bn,e)}var gn=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function wn(e){return gn.test(e)}function vn(e){return $(gn,e)}var $n=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function An(e){return $n.test(e)}function Pn(e){return $($n,e)}var In=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function Ee(e){return In.test(e)}function Mn(e){return $(In,e)}var Sn=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function En(e){return Sn.test(e)}function Tn(e){return $(Sn,e)}var Gr=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function Bn(e){return Gr.test(e)}var Vr=/^receive\(\) external payable$/;function kn(e){return Vr.test(e)}var zn=new Set(["indexed"]),Te=new Set(["calldata","memory","storage"]);var Be=class extends x{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}},ke=class extends x{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}};var ze=class extends x{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}},Oe=class extends x{constructor({param:t,name:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}},Ce=class extends x{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}},Re=class extends x{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}},je=class extends x{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}};var T=class extends x{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}},Ue=class extends x{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}},Fe=class extends x{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}};var Le=class extends x{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}};var De=class extends x{constructor({current:t,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}};function On(e,t){return t?`${t}:${e}`:e}var Ne=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function Cn(e,t={}){if(An(e)){let n=Pn(e);if(!n)throw new T({signature:e,type:"function"});let r=M(n.parameters),o=[],i=r.length;for(let a=0;a<i;a++)o.push(R(r[a],{modifiers:Te,structs:t,type:"function"}));let s=[];if(n.returns){let a=M(n.returns),u=a.length;for(let p=0;p<u;p++)s.push(R(a[p],{modifiers:Te,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:s}}if(wn(e)){let n=vn(e);if(!n)throw new T({signature:e,type:"event"});let r=M(n.parameters),o=[],i=r.length;for(let s=0;s<i;s++)o.push(R(r[s],{modifiers:zn,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}if(hn(e)){let n=xn(e);if(!n)throw new T({signature:e,type:"error"});let r=M(n.parameters),o=[],i=r.length;for(let s=0;s<i;s++)o.push(R(r[s],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:o}}if(En(e)){let n=Tn(e);if(!n)throw new T({signature:e,type:"constructor"});let r=M(n.parameters),o=[],i=r.length;for(let s=0;s<i;s++)o.push(R(r[s],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:o}}if(Bn(e))return{type:"fallback"};if(kn(e))return{type:"receive",stateMutability:"payable"};throw new Ue({signature:e})}var Wr=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Zr=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Kr=/^u?int$/;function R(e,t){let n=On(e,t?.type);if(Ne.has(n))return Ne.get(n);let r=Me.test(e),o=$(r?Zr:Wr,e);if(!o)throw new ze({param:e});if(o.name&&Jr(o.name))throw new Oe({param:e,name:o.name});let i=o.name?{name:o.name}:{},s=o.modifier==="indexed"?{indexed:!0}:{},a=t?.structs??{},u,p={};if(r){u="tuple";let f=M(o.type),l=[],m=f.length;for(let b=0;b<m;b++)l.push(R(f[b],{structs:a}));p={components:l}}else if(o.type in a)u="tuple",p={components:a[o.type]};else if(Kr.test(o.type))u=`${o.type}256`;else if(u=o.type,t?.type!=="struct"&&!jt(u))throw new ke({type:u});if(o.modifier){if(!t?.modifiers?.has?.(o.modifier))throw new Ce({param:e,type:t?.type,modifier:o.modifier});if(Te.has(o.modifier)&&!Yr(u,!!o.array))throw new Re({param:e,type:t?.type,modifier:o.modifier})}let d={type:`${u}${o.array??""}`,...i,...s,...p};return Ne.set(n,d),d}function M(e,t=[],n="",r=0){let o=e.trim().length;for(let i=0;i<o;i++){let s=e[i],a=e.slice(i+1);switch(s){case",":return r===0?M(a,[...t,n.trim()]):M(a,t,`${n}${s}`,r);case"(":return M(a,t,`${n}${s}`,r+1);case")":return M(a,t,`${n}${s}`,r-1);default:return M(a,t,`${n}${s}`,r)}}if(n==="")return t;if(r!==0)throw new De({current:n,depth:r});return t.push(n.trim()),t}function jt(e){return e==="address"||e==="bool"||e==="function"||e==="string"||Ot.test(e)||Ct.test(e)}var Xr=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function Jr(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||Ot.test(e)||Ct.test(e)||Xr.test(e)}function Yr(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function Rn(e){let t={},n=e.length;for(let s=0;s<n;s++){let a=e[s];if(!Ee(a))continue;let u=Mn(a);if(!u)throw new T({signature:a,type:"struct"});let p=u.properties.split(";"),d=[],f=p.length;for(let l=0;l<f;l++){let b=p[l].trim();if(!b)continue;let g=R(b,{type:"struct"});d.push(g)}if(!d.length)throw new Fe({signature:a});t[u.name]=d}let r={},o=Object.entries(t),i=o.length;for(let s=0;s<i;s++){let[a,u]=o[s];r[a]=jn(u,t)}return r}var qr=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function jn(e,t,n=new Set){let r=[],o=e.length;for(let i=0;i<o;i++){let s=e[i];if(Me.test(s.type))r.push(s);else{let u=$(qr,s.type);if(!u?.type)throw new je({abiParameter:s});let{array:p,type:d}=u;if(d in t){if(n.has(d))throw new Le({type:d});r.push({...s,type:`tuple${p??""}`,components:jn(t[d]??[],t,new Set([...n,d]))})}else if(jt(d))r.push(s);else throw new Be({type:d})}}return r}function He(e){let t=Rn(e),n=[],r=e.length;for(let o=0;o<r;o++){let i=e[o];Ee(i)||n.push(Cn(i,t))}return n}function Z(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}var Ut=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],Un=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"},{inputs:[],name:"ResolverNotContract",type:"error"},{inputs:[{name:"returnData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{components:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"errors",type:"tuple[]"}],name:"HttpError",type:"error"}],Ds=[...Un,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]},{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],Ns=[...Un,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]},{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}];var Fn="0x82ad56cb";var Ln="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",Dn="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe";var Ft="2.21.19";var Lt={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:Ft};var c=class e extends Error{constructor(t,n={}){let r=n.cause instanceof e?n.cause.details:n.cause?.message?n.cause.message:n.details,o=n.cause instanceof e&&n.cause.docsPath||n.docsPath,i=Lt.getDocsUrl?.({...n,docsPath:o}),s=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...r?[`Details: ${r}`]:[],...Lt.version?[`Version: ${Lt.version}`]:[]].join(`
|
|
3
|
-
`);super(s,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=Ft}walk(t){return Nn(this,t)}};function Nn(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e?Nn(e.cause,t):t?null:e}var H=class extends c{constructor({blockNumber:t,chain:n,contract:r}){super(`Chain "${n.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...t&&r.blockCreated&&r.blockCreated>t?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${t}).`]:[`- The chain does not have the contract "${r.name}" configured.`]],name:"ChainDoesNotSupportContract"})}};var de=class extends c{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}};var Hn={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},_n={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function _(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new Ge(e.type);return`${e.name}(${_e(e.inputs,{includeName:t})})`}function _e(e,{includeName:t=!1}={}){return e?e.map(n=>Qr(n,{includeName:t})).join(t?", ":","):""}function Qr(e,{includeName:t}){return e.type.startsWith("tuple")?`(${_e(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function A(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function h(e){return A(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}var Ve=class extends c{constructor({docsPath:t}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
|
|
4
|
-
`),{docsPath:t,name:"AbiConstructorNotFoundError"})}},fe=class extends c{constructor({docsPath:t}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
|
|
5
|
-
`),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}};var We=class extends c{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
|
|
6
|
-
`),{metaMessages:[`Params: (${_e(n,{includeName:!0})})`,`Data: ${t} (${r} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t,this.params=n,this.size=r}},K=class extends c{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}},Ze=class extends c{constructor({expectedLength:t,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
|
|
7
|
-
`),{name:"AbiEncodingArrayLengthMismatchError"})}},Ke=class extends c{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${h(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}},Xe=class extends c{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
|
|
8
|
-
`),{name:"AbiEncodingLengthMismatchError"})}};var Je=class extends c{constructor(t,{docsPath:n}){super([`Encoded error signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
|
|
9
|
-
`),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}};var j=class extends c{constructor(t,{docsPath:n}={}){super([`Function ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
|
|
10
|
-
`),{docsPath:n,name:"AbiFunctionNotFoundError"})}},Ye=class extends c{constructor(t,{docsPath:n}){super([`Function "${t}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(`
|
|
11
|
-
`),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}};var qe=class extends c{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${_(t.abiItem)}\`, and`,`\`${n.type}\` in \`${_(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}};var Qe=class extends c{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
|
|
12
|
-
`),{docsPath:n,name:"InvalidAbiEncodingType"})}},et=class extends c{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
|
|
13
|
-
`),{docsPath:n,name:"InvalidAbiDecodingType"})}},tt=class extends c{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
|
|
14
|
-
`),{name:"InvalidArrayError"})}},Ge=class extends c{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
|
|
15
|
-
`),{name:"InvalidDefinitionTypeError"})}};var me=class extends c{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},le=class extends c{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}},ye=class extends c{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${t} ${r} long.`,{name:"InvalidBytesLengthError"})}};function G(e,t,n,{strict:r}={}){return A(e,{strict:!1})?eo(e,t,n,{strict:r}):Dt(e,t,n,{strict:r})}function Gn(e,t){if(typeof t=="number"&&t>0&&t>h(e)-1)throw new me({offset:t,position:"start",size:h(e)})}function Vn(e,t,n){if(typeof t=="number"&&typeof n=="number"&&h(e)!==n-t)throw new me({offset:n,position:"end",size:h(e)})}function Dt(e,t,n,{strict:r}={}){Gn(e,t);let o=e.slice(t,n);return r&&Vn(o,t,n),o}function eo(e,t,n,{strict:r}={}){Gn(e,t);let o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&Vn(o,t,n),o}function U(e,{dir:t,size:n=32}={}){return typeof e=="string"?B(e,{dir:t,size:n}):to(e,{dir:t,size:n})}function B(e,{dir:t,size:n=32}={}){if(n===null)return e;let r=e.replace("0x","");if(r.length>n*2)throw new le({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function to(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new le({size:e.length,targetSize:n,type:"bytes"});let r=new Uint8Array(n);for(let o=0;o<n;o++){let i=t==="right";r[i?o:n-o-1]=e[i?o:e.length-o-1]}return r}var nt=class extends c{constructor({max:t,min:n,signed:r,size:o,value:i}){super(`Number "${i}" is not in safe ${o?`${o*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}},rt=class extends c{constructor(t){super(`Bytes value "${t}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}};var ot=class extends c{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function be(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,r=0;for(let o=0;o<n.length-1&&n[t==="left"?o:n.length-o-1].toString()==="0";o++)r++;return n=t==="left"?n.slice(r):n.slice(0,n.length-r),typeof e=="string"?(n.length===1&&t==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}function v(e,{size:t}){if(h(e)>t)throw new ot({givenSize:h(e),maxSize:t})}function Nt(e,t={}){let{signed:n}=t;t.size&&v(e,{size:t.size});let r=BigInt(e);if(!n)return r;let o=(e.length-2)/2,i=(1n<<BigInt(o)*8n-1n)-1n;return r<=i?r:r-BigInt(`0x${"f".padStart(o*2,"f")}`)-1n}function Wn(e,t={}){return Number(Nt(e,t))}var no=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Zn(e,t={}){return typeof e=="number"||typeof e=="bigint"?y(e,t):typeof e=="string"?_t(e,t):typeof e=="boolean"?Ht(e,t):P(e,t)}function Ht(e,t={}){let n=`0x${Number(e)}`;return typeof t.size=="number"?(v(n,{size:t.size}),U(n,{size:t.size})):n}function P(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=no[e[o]];let r=`0x${n}`;return typeof t.size=="number"?(v(r,{size:t.size}),U(r,{dir:"right",size:t.size})):r}function y(e,t={}){let{signed:n,size:r}=t,o=BigInt(e),i;r?n?i=(1n<<BigInt(r)*8n-1n)-1n:i=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));let s=typeof i=="bigint"&&n?-i-1n:0;if(i&&o>i||o<s){let u=typeof e=="bigint"?"n":"";throw new nt({max:i?`${i}${u}`:void 0,min:`${s}${u}`,signed:n,size:r,value:`${e}${u}`})}let a=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?U(a,{size:r}):a}var ro=new TextEncoder;function _t(e,t={}){let n=ro.encode(e);return P(n,t)}var oo=new TextEncoder;function st(e,t={}){return typeof e=="number"||typeof e=="bigint"?io(e,t):typeof e=="boolean"?so(e,t):A(e)?it(e,t):Gt(e,t)}function so(e,t={}){let n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(v(n,{size:t.size}),U(n,{size:t.size})):n}var k={zero:48,nine:57,A:65,F:70,a:97,f:102};function Kn(e){if(e>=k.zero&&e<=k.nine)return e-k.zero;if(e>=k.A&&e<=k.F)return e-(k.A-10);if(e>=k.a&&e<=k.f)return e-(k.a-10)}function it(e,t={}){let n=e;t.size&&(v(n,{size:t.size}),n=U(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);let o=r.length/2,i=new Uint8Array(o);for(let s=0,a=0;s<o;s++){let u=Kn(r.charCodeAt(a++)),p=Kn(r.charCodeAt(a++));if(u===void 0||p===void 0)throw new c(`Invalid byte sequence ("${r[a-2]}${r[a-1]}" in "${r}").`);i[s]=u*16+p}return i}function io(e,t){let n=y(e,t);return it(n)}function Gt(e,t={}){let n=oo.encode(e);return typeof t.size=="number"?(v(n,{size:t.size}),U(n,{dir:"right",size:t.size})):n}var at=BigInt(4294967295),Xn=BigInt(32);function ao(e,t=!1){return t?{h:Number(e&at),l:Number(e>>Xn&at)}:{h:Number(e>>Xn&at)|0,l:Number(e&at)|0}}function Jn(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let o=0;o<e.length;o++){let{h:i,l:s}=ao(e[o],t);[n[o],r[o]]=[i,s]}return[n,r]}var Yn=(e,t,n)=>e<<n|t>>>32-n,qn=(e,t,n)=>t<<n|e>>>32-n,Qn=(e,t,n)=>t<<n-32|e>>>64-n,er=(e,t,n)=>e<<n-32|t>>>64-n;var rr=[],or=[],sr=[],uo=BigInt(0),he=BigInt(1),co=BigInt(2),po=BigInt(7),fo=BigInt(256),mo=BigInt(113);for(let e=0,t=he,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],rr.push(2*(5*r+n)),or.push((e+1)*(e+2)/2%64);let o=uo;for(let i=0;i<7;i++)t=(t<<he^(t>>po)*mo)%fo,t&co&&(o^=he<<(he<<BigInt(i))-he);sr.push(o)}var[lo,yo]=Jn(sr,!0),tr=(e,t,n)=>n>32?Qn(e,t,n):Yn(e,t,n),nr=(e,t,n)=>n>32?er(e,t,n):qn(e,t,n);function bo(e,t=24){let n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let s=0;s<10;s++)n[s]=e[s]^e[s+10]^e[s+20]^e[s+30]^e[s+40];for(let s=0;s<10;s+=2){let a=(s+8)%10,u=(s+2)%10,p=n[u],d=n[u+1],f=tr(p,d,1)^n[a],l=nr(p,d,1)^n[a+1];for(let m=0;m<50;m+=10)e[s+m]^=f,e[s+m+1]^=l}let o=e[2],i=e[3];for(let s=0;s<24;s++){let a=or[s],u=tr(o,i,a),p=nr(o,i,a),d=rr[s];o=e[d],i=e[d+1],e[d]=u,e[d+1]=p}for(let s=0;s<50;s+=10){for(let a=0;a<10;a++)n[a]=e[s+a];for(let a=0;a<10;a++)e[s+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=lo[r],e[1]^=yo[r]}n.fill(0)}var ut=class e extends dn{constructor(t,n,r,o=!1,i=24){if(super(),this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=o,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Tt(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=cn(this.state)}keccak(){kt||zt(this.state32),bo(this.state32,this.rounds),kt||zt(this.state32),this.posOut=0,this.pos=0}update(t){Bt(this);let{blockLen:n,state:r}=this;t=pn(t);let o=t.length;for(let i=0;i<o;){let s=Math.min(n-this.pos,o-i);for(let a=0;a<s;a++)r[this.pos++]^=t[i++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:n,pos:r,blockLen:o}=this;t[r]^=n,n&128&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){Bt(this,!1),an(t),this.finish();let n=this.state,{blockLen:r}=this;for(let o=0,i=t.length;o<i;){this.posOut>=r&&this.keccak();let s=Math.min(r-this.posOut,i-o);t.set(n.subarray(this.posOut,this.posOut+s),o),this.posOut+=s,o+=s}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Tt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(un(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:n,suffix:r,outputLen:o,rounds:i,enableXOF:s}=this;return t||(t=new e(n,r,o,s,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=r,t.outputLen=o,t.enableXOF=s,t.destroyed=this.destroyed,t}},F=(e,t,n)=>fn(()=>new ut(t,e,n)),Ri=F(6,144,224/8),ji=F(6,136,256/8),Ui=F(6,104,384/8),Fi=F(6,72,512/8),Li=F(1,144,224/8),ir=F(1,136,256/8),Di=F(1,104,384/8),Ni=F(1,72,512/8),ar=(e,t,n)=>mn((r={})=>new ut(t,e,r.dkLen===void 0?n:r.dkLen,!0)),Hi=ar(31,168,128/8),_i=ar(31,136,256/8);function ct(e,t){let n=t||"hex",r=ir(A(e,{strict:!1})?st(e):e);return n==="bytes"?r:Zn(r)}var ho=e=>ct(st(e));function ur(e){return ho(e)}function cr(e){let t=!0,n="",r=0,o="",i=!1;for(let s=0;s<e.length;s++){let a=e[s];if(["(",")",","].includes(a)&&(t=!0),a==="("&&r++,a===")"&&r--,!!t){if(r===0){if(a===" "&&["event","function",""].includes(o))o="";else if(o+=a,a===")"){i=!0;break}continue}if(a===" "){e[s-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=a,n+=a}}if(!i)throw new c("Unable to normalize signature.");return o}var pr=e=>{let t=typeof e=="string"?e:Rt(e);return cr(t)};function pt(e){return ur(pr(e))}var X=e=>G(pt(e),0,4);var I=class extends c{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}};var J=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){let n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){let r=this.keys().next().value;r&&this.delete(r)}return this}};var xo=/^0x[a-fA-F0-9]{40}$/,Vt=new J(8192);function w(e,t){let{strict:n=!0}=t??{},r=`${e}.${n}`;if(Vt.has(r))return Vt.get(r);let o=xo.test(e)?e.toLowerCase()===e?!0:n?dt(e)===e:!0:!1;return Vt.set(r,o),o}var Wt=new J(8192);function dt(e,t){if(Wt.has(`${e}.${t}`))return Wt.get(`${e}.${t}`);let n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),r=ct(Gt(n),"bytes"),o=(t?n.substring(`${t}0x`.length):n).split("");for(let s=0;s<40;s+=2)r[s>>1]>>4>=8&&o[s]&&(o[s]=o[s].toUpperCase()),(r[s>>1]&15)>=8&&o[s+1]&&(o[s+1]=o[s+1].toUpperCase());let i=`0x${o.join("")}`;return Wt.set(`${e}.${t}`,i),i}var xe=class extends c{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}},ft=class extends c{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}},mt=class extends c{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}};var go={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new mt({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new ft({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new xe({offset:e});let t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new xe({offset:e});let t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){let t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){let n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){let t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){let t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){let t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){let t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();let e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();let n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();let e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();let e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();let e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();let e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){let t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;let e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function dr(e,{recursiveReadLimit:t=8192}={}){let n=Object.create(go);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function fr(e,t={}){typeof t.size<"u"&&v(e,{size:t.size});let n=P(e,t);return Nt(n,t)}function mr(e,t={}){let n=e;if(typeof t.size<"u"&&(v(n,{size:t.size}),n=be(n)),n.length>1||n[0]>1)throw new rt(n);return!!n[0]}function E(e,t={}){typeof t.size<"u"&&v(e,{size:t.size});let n=P(e,t);return Wn(n,t)}function lr(e,t={}){let n=e;return typeof t.size<"u"&&(v(n,{size:t.size}),n=be(n,{dir:"right"})),new TextDecoder().decode(n)}function z(e){return typeof e[0]=="string"?ge(e):wo(e)}function wo(e){let t=0;for(let o of e)t+=o.length;let n=new Uint8Array(t),r=0;for(let o of e)n.set(o,r),r+=o.length;return n}function ge(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Y(e,t){if(e.length!==t.length)throw new Xe({expectedLength:e.length,givenLength:t.length});let n=vo({params:e,values:t}),r=Kt(n);return r.length===0?"0x":r}function vo({params:e,values:t}){let n=[];for(let r=0;r<e.length;r++)n.push(Zt({param:e[r],value:t[r]}));return n}function Zt({param:e,value:t}){let n=lt(e.type);if(n){let[r,o]=n;return Ao(t,{length:r,param:{...e,type:o}})}if(e.type==="tuple")return Eo(t,{param:e});if(e.type==="address")return $o(t);if(e.type==="bool")return Io(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){let r=e.type.startsWith("int");return Mo(t,{signed:r})}if(e.type.startsWith("bytes"))return Po(t,{param:e});if(e.type==="string")return So(t);throw new Qe(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Kt(e){let t=0;for(let i=0;i<e.length;i++){let{dynamic:s,encoded:a}=e[i];s?t+=32:t+=h(a)}let n=[],r=[],o=0;for(let i=0;i<e.length;i++){let{dynamic:s,encoded:a}=e[i];s?(n.push(y(t+o,{size:32})),r.push(a),o+=h(a)):n.push(a)}return z([...n,...r])}function $o(e){if(!w(e))throw new I({address:e});return{dynamic:!1,encoded:B(e.toLowerCase())}}function Ao(e,{length:t,param:n}){let r=t===null;if(!Array.isArray(e))throw new tt(e);if(!r&&e.length!==t)throw new Ze({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let o=!1,i=[];for(let s=0;s<e.length;s++){let a=Zt({param:n,value:e[s]});a.dynamic&&(o=!0),i.push(a)}if(r||o){let s=Kt(i);if(r){let a=y(i.length,{size:32});return{dynamic:!0,encoded:i.length>0?z([a,s]):a}}if(o)return{dynamic:!0,encoded:s}}return{dynamic:!1,encoded:z(i.map(({encoded:s})=>s))}}function Po(e,{param:t}){let[,n]=t.type.split("bytes"),r=h(e);if(!n){let o=e;return r%32!==0&&(o=B(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:z([B(y(r,{size:32})),o])}}if(r!==Number.parseInt(n))throw new Ke({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:B(e,{dir:"right"})}}function Io(e){if(typeof e!="boolean")throw new c(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:B(Ht(e))}}function Mo(e,{signed:t}){return{dynamic:!1,encoded:y(e,{size:32,signed:t})}}function So(e){let t=_t(e),n=Math.ceil(h(t)/32),r=[];for(let o=0;o<n;o++)r.push(B(G(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:z([B(y(h(t),{size:32})),...r])}}function Eo(e,{param:t}){let n=!1,r=[];for(let o=0;o<t.components.length;o++){let i=t.components[o],s=Array.isArray(e)?o:i.name,a=Zt({param:i,value:e[s]});r.push(a),a.dynamic&&(n=!0)}return{dynamic:n,encoded:n?Kt(r):z(r.map(({encoded:o})=>o))}}function lt(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function yt(e,t){let n=typeof t=="string"?it(t):t,r=dr(n);if(h(n)===0&&e.length>0)throw new K;if(h(t)&&h(t)<32)throw new We({data:typeof t=="string"?t:P(t),params:e,size:h(t)});let o=0,i=[];for(let s=0;s<e.length;++s){let a=e[s];r.setPosition(o);let[u,p]=q(r,a,{staticPosition:0});o+=p,i.push(u)}return i}function q(e,t,{staticPosition:n}){let r=lt(t.type);if(r){let[o,i]=r;return Bo(e,{...t,type:i},{length:o,staticPosition:n})}if(t.type==="tuple")return Co(e,t,{staticPosition:n});if(t.type==="address")return To(e);if(t.type==="bool")return ko(e);if(t.type.startsWith("bytes"))return zo(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Oo(e,t);if(t.type==="string")return Ro(e,{staticPosition:n});throw new et(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}var yr=32,Xt=32;function To(e){let t=e.readBytes(32);return[dt(P(Dt(t,-20))),32]}function Bo(e,t,{length:n,staticPosition:r}){if(!n){let s=E(e.readBytes(Xt)),a=r+s,u=a+yr;e.setPosition(a);let p=E(e.readBytes(yr)),d=we(t),f=0,l=[];for(let m=0;m<p;++m){e.setPosition(u+(d?m*32:f));let[b,g]=q(e,t,{staticPosition:u});f+=g,l.push(b)}return e.setPosition(r+32),[l,32]}if(we(t)){let s=E(e.readBytes(Xt)),a=r+s,u=[];for(let p=0;p<n;++p){e.setPosition(a+p*32);let[d]=q(e,t,{staticPosition:a});u.push(d)}return e.setPosition(r+32),[u,32]}let o=0,i=[];for(let s=0;s<n;++s){let[a,u]=q(e,t,{staticPosition:r+o});o+=u,i.push(a)}return[i,o]}function ko(e){return[mr(e.readBytes(32),{size:32}),32]}function zo(e,t,{staticPosition:n}){let[r,o]=t.type.split("bytes");if(!o){let s=E(e.readBytes(32));e.setPosition(n+s);let a=E(e.readBytes(32));if(a===0)return e.setPosition(n+32),["0x",32];let u=e.readBytes(a);return e.setPosition(n+32),[P(u),32]}return[P(e.readBytes(Number.parseInt(o),32)),32]}function Oo(e,t){let n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256"),o=e.readBytes(32);return[r>48?fr(o,{signed:n}):E(o,{signed:n}),32]}function Co(e,t,{staticPosition:n}){let r=t.components.length===0||t.components.some(({name:s})=>!s),o=r?[]:{},i=0;if(we(t)){let s=E(e.readBytes(Xt)),a=n+s;for(let u=0;u<t.components.length;++u){let p=t.components[u];e.setPosition(a+i);let[d,f]=q(e,p,{staticPosition:a});i+=f,o[r?u:p?.name]=d}return e.setPosition(n+32),[o,32]}for(let s=0;s<t.components.length;++s){let a=t.components[s],[u,p]=q(e,a,{staticPosition:n});o[r?s:a?.name]=u,i+=p}return[o,i]}function Ro(e,{staticPosition:t}){let n=E(e.readBytes(32)),r=t+n;e.setPosition(r);let o=E(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];let i=e.readBytes(o,32),s=lr(be(i));return e.setPosition(t+32),[s,32]}function we(e){let{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return e.components?.some(we);let n=lt(e.type);return!!(n&&we({...e,type:n[1]}))}function br(e){let{abi:t,data:n}=e,r=G(n,0,4);if(r==="0x")throw new K;let i=[...t||[],Hn,_n].find(s=>s.type==="error"&&r===X(_(s)));if(!i)throw new Je(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:i,args:"inputs"in i&&i.inputs&&i.inputs.length>0?yt(i.inputs,G(n,4)):void 0,errorName:i.name}}var Q=(e,t,n)=>JSON.stringify(e,(r,o)=>{let i=typeof o=="bigint"?o.toString():o;return typeof t=="function"?t(r,i):i},n);var hr=pt;function bt(e){let{abi:t,args:n=[],name:r}=e,o=A(r,{strict:!1}),i=t.filter(a=>o?a.type==="function"?X(a)===r:a.type==="event"?hr(a)===r:!1:"name"in a&&a.name===r);if(i.length===0)return;if(i.length===1)return i[0];let s;for(let a of i){if(!("inputs"in a))continue;if(!n||n.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==n.length)continue;if(n.every((p,d)=>{let f="inputs"in a&&a.inputs[d];return f?Jt(p,f):!1})){if(s&&"inputs"in s&&s.inputs){let p=xr(a.inputs,s.inputs,n);if(p)throw new qe({abiItem:a,type:p[0]},{abiItem:s,type:p[1]})}s=a}}return s||i[0]}function Jt(e,t){let n=typeof e,r=t.type;switch(r){case"address":return w(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((o,i)=>Jt(Object.values(e)[i],o)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(o=>Jt(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function xr(e,t,n){for(let r in e){let o=e[r],i=t[r];if(o.type==="tuple"&&i.type==="tuple"&&"components"in o&&"components"in i)return xr(o.components,i.components,n[r]);let s=[o.type,i.type];if(s.includes("address")&&s.includes("bytes20")?!0:s.includes("address")&&s.includes("string")?w(n[r],{strict:!1}):s.includes("address")&&s.includes("bytes")?w(n[r],{strict:!1}):!1)return s}}var gr={gwei:9,wei:18},wr={ether:-9,wei:9};function ht(e,t){let n=e.toString(),r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(t,"0");let[o,i]=[n.slice(0,n.length-t),n.slice(n.length-t)];return i=i.replace(/(0+)$/,""),`${r?"-":""}${o||"0"}${i?`.${i}`:""}`}function vr(e,t="wei"){return ht(e,gr[t])}function O(e,t="wei"){return ht(e,wr[t])}var xt=class extends c{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}},gt=class extends c{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}};function $r(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
|
|
16
|
-
`,"")}function Ar(e){return e.reduce((t,{address:n,...r})=>{let o=`${t} ${n}:
|
|
17
|
-
`;return r.nonce&&(o+=` nonce: ${r.nonce}
|
|
18
|
-
`),r.balance&&(o+=` balance: ${r.balance}
|
|
19
|
-
`),r.code&&(o+=` code: ${r.code}
|
|
20
|
-
`),r.state&&(o+=` state:
|
|
21
|
-
`,o+=$r(r.state)),r.stateDiff&&(o+=` stateDiff:
|
|
22
|
-
`,o+=$r(r.stateDiff)),o},` State Override:
|
|
23
|
-
`).slice(0,-1)}function Pr(e){let t=Object.entries(e).map(([r,o])=>o===void 0||o===!1?null:[r,o]).filter(Boolean),n=t.reduce((r,[o])=>Math.max(r,o.length),0);return t.map(([r,o])=>` ${`${r}:`.padEnd(n+1)} ${o}`).join(`
|
|
24
|
-
`)}var wt=class extends c{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(`
|
|
25
|
-
`),{name:"FeeConflictError"})}};var ve=e=>e;var vt=class extends c{constructor(t,{account:n,docsPath:r,chain:o,data:i,gas:s,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:p,nonce:d,to:f,value:l,stateOverride:m}){let b=n?Z(n):void 0,g=Pr({from:b?.address,to:f,value:typeof l<"u"&&`${vr(l)} ${o?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:s,gasPrice:typeof a<"u"&&`${O(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${O(u)} gwei`,maxPriorityFeePerGas:typeof p<"u"&&`${O(p)} gwei`,nonce:d});m&&(g+=`
|
|
26
|
-
${Ar(m)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",g].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}};var $t=class extends c{constructor({factory:t}){super(`Deployment for counterfactual contract call failed${t?` for factory "${t}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}},At=class extends c{constructor({data:t,message:n}){super(n||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t}};var Yt="/docs/contract/decodeFunctionResult";function Ir(e){let{abi:t,args:n,functionName:r,data:o}=e,i=t[0];if(r){let a=bt({abi:t,args:n,name:r});if(!a)throw new j(r,{docsPath:Yt});i=a}if(i.type!=="function")throw new j(void 0,{docsPath:Yt});if(!i.outputs)throw new Ye(i.name,{docsPath:Yt});let s=yt(i.outputs,o);if(s&&s.length>1)return s;if(s&&s.length===1)return s[0]}var qt="/docs/contract/encodeDeployData";function Qt(e){let{abi:t,args:n,bytecode:r}=e;if(!n||n.length===0)return r;let o=t.find(s=>"type"in s&&s.type==="constructor");if(!o)throw new Ve({docsPath:qt});if(!("inputs"in o))throw new fe({docsPath:qt});if(!o.inputs||o.inputs.length===0)throw new fe({docsPath:qt});let i=Y(o.inputs,n);return ge([r,i])}var Mr="/docs/contract/encodeFunctionData";function Sr(e){let{abi:t,args:n,functionName:r}=e,o=t[0];if(r){let i=bt({abi:t,args:n,name:r});if(!i)throw new j(r,{docsPath:Mr});o=i}if(o.type!=="function")throw new j(void 0,{docsPath:Mr});return{abi:[o],functionName:X(_(o))}}function Er(e){let{args:t}=e,{abi:n,functionName:r}=e.abi.length===1&&e.functionName?.startsWith("0x")?e:Sr(e),o=n[0],i=r,s="inputs"in o&&o.inputs?Y(o.inputs,t??[]):void 0;return ge([i,s??"0x"])}function Tr({blockNumber:e,chain:t,contract:n}){let r=t?.contracts?.[n];if(!r)throw new H({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new H({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}var C=class extends c{constructor({cause:t,message:n}={}){let r=n?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}};Object.defineProperty(C,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(C,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});var L=class extends c{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${O(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}};Object.defineProperty(L,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});var ee=class extends c{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${O(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}};Object.defineProperty(ee,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});var te=class extends c{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:t,name:"NonceTooHighError"})}};Object.defineProperty(te,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});var ne=class extends c{constructor({cause:t,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
|
|
27
|
-
`),{cause:t,name:"NonceTooLowError"})}};Object.defineProperty(ne,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});var re=class extends c{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}};Object.defineProperty(re,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});var oe=class extends c{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
|
|
28
|
-
`),{cause:t,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}};Object.defineProperty(oe,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});var se=class extends c{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:t,name:"IntrinsicGasTooHighError"})}};Object.defineProperty(se,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});var ie=class extends c{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:t,name:"IntrinsicGasTooLowError"})}};Object.defineProperty(ie,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});var ae=class extends c{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}};Object.defineProperty(ae,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});var D=class extends c{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${O(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${O(r)} gwei`:""}).`].join(`
|
|
29
|
-
`),{cause:t,name:"TipAboveFeeCapError"})}};Object.defineProperty(D,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});var ue=class extends c{constructor({cause:t}){super(`An error occurred while executing: ${t?.shortMessage}`,{cause:t,name:"UnknownNodeError"})}};var $e=class extends c{constructor({body:t,cause:n,details:r,headers:o,status:i,url:s}){super("HTTP request failed.",{cause:n,details:r,metaMessages:[i&&`Status: ${i}`,`URL: ${ve(s)}`,t&&`Request body: ${Q(t)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=t,this.headers=o,this.status=i,this.url=s}};function Br(e,t){let n=(e.details||"").toLowerCase(),r=e instanceof c?e.walk(o=>o?.code===C.code):e;return r instanceof c?new C({cause:e,message:r.details}):C.nodeMessage.test(n)?new C({cause:e,message:e.details}):L.nodeMessage.test(n)?new L({cause:e,maxFeePerGas:t?.maxFeePerGas}):ee.nodeMessage.test(n)?new ee({cause:e,maxFeePerGas:t?.maxFeePerGas}):te.nodeMessage.test(n)?new te({cause:e,nonce:t?.nonce}):ne.nodeMessage.test(n)?new ne({cause:e,nonce:t?.nonce}):re.nodeMessage.test(n)?new re({cause:e,nonce:t?.nonce}):oe.nodeMessage.test(n)?new oe({cause:e}):se.nodeMessage.test(n)?new se({cause:e,gas:t?.gas}):ie.nodeMessage.test(n)?new ie({cause:e,gas:t?.gas}):ae.nodeMessage.test(n)?new ae({cause:e}):D.nodeMessage.test(n)?new D({cause:e,maxFeePerGas:t?.maxFeePerGas,maxPriorityFeePerGas:t?.maxPriorityFeePerGas}):new ue({cause:e})}function kr(e,{docsPath:t,...n}){let r=(()=>{let o=Br(e,n);return o instanceof ue?e:o})();return new vt(r,{docsPath:t,...n})}function zr(e,{format:t}){if(!t)return{};let n={};function r(i){let s=Object.keys(i);for(let a of s)a in e&&(n[a]=e[a]),i[a]&&typeof i[a]=="object"&&!Array.isArray(i[a])&&r(i[a])}let o=t(e||{});return r(o),n}var jo={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Or(e){let t={};return typeof e.authorizationList<"u"&&(t.authorizationList=Uo(e.authorizationList)),typeof e.accessList<"u"&&(t.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(t.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?t.blobs=e.blobs.map(n=>P(n)):t.blobs=e.blobs),typeof e.data<"u"&&(t.data=e.data),typeof e.from<"u"&&(t.from=e.from),typeof e.gas<"u"&&(t.gas=y(e.gas)),typeof e.gasPrice<"u"&&(t.gasPrice=y(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(t.maxFeePerBlobGas=y(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(t.maxFeePerGas=y(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(t.maxPriorityFeePerGas=y(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(t.nonce=y(e.nonce)),typeof e.to<"u"&&(t.to=e.to),typeof e.type<"u"&&(t.type=jo[e.type]),typeof e.value<"u"&&(t.value=y(e.value)),t}function Uo(e){return e.map(t=>({address:t.contractAddress,r:t.r,s:t.s,chainId:y(t.chainId),nonce:y(t.nonce),...typeof t.yParity<"u"?{yParity:y(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:y(t.v)}:{}}))}var en=new Map;function Cr({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:o}){let i=async()=>{let d=u();s();let f=d.map(({args:l})=>l);f.length!==0&&e(f).then(l=>{o&&Array.isArray(l)&&l.sort(o);for(let m=0;m<d.length;m++){let{pendingPromise:b}=d[m];b.resolve?.([l[m],l])}}).catch(l=>{for(let m=0;m<d.length;m++){let{pendingPromise:b}=d[m];b.reject?.(l)}})},s=()=>en.delete(t),a=()=>u().map(({args:d})=>d),u=()=>en.get(t)||[],p=d=>en.set(t,[...u(),d]);return{flush:s,async schedule(d){let f={},l=new Promise((g,N)=>{f.resolve=g,f.reject=N});return n?.([...a(),d])&&i(),u().length>0?(p({args:d,pendingPromise:f}),l):(p({args:d,pendingPromise:f}),setTimeout(i,r),l)}}}function Rr(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new ye({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new ye({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function Fo(e){let{balance:t,nonce:n,state:r,stateDiff:o,code:i}=e,s={};if(i!==void 0&&(s.code=i),t!==void 0&&(s.balance=y(t)),n!==void 0&&(s.nonce=y(n)),r!==void 0&&(s.state=Rr(r)),o!==void 0){if(s.state)throw new gt;s.stateDiff=Rr(o)}return s}function jr(e){if(!e)return;let t={};for(let{address:n,...r}of e){if(!w(n,{strict:!1}))throw new I({address:n});if(t[n])throw new xt({address:n});t[n]=Fo(r)}return t}var $c=2n**(8n-1n)-1n,Ac=2n**(16n-1n)-1n,Pc=2n**(24n-1n)-1n,Ic=2n**(32n-1n)-1n,Mc=2n**(40n-1n)-1n,Sc=2n**(48n-1n)-1n,Ec=2n**(56n-1n)-1n,Tc=2n**(64n-1n)-1n,Bc=2n**(72n-1n)-1n,kc=2n**(80n-1n)-1n,zc=2n**(88n-1n)-1n,Oc=2n**(96n-1n)-1n,Cc=2n**(104n-1n)-1n,Rc=2n**(112n-1n)-1n,jc=2n**(120n-1n)-1n,Uc=2n**(128n-1n)-1n,Fc=2n**(136n-1n)-1n,Lc=2n**(144n-1n)-1n,Dc=2n**(152n-1n)-1n,Nc=2n**(160n-1n)-1n,Hc=2n**(168n-1n)-1n,_c=2n**(176n-1n)-1n,Gc=2n**(184n-1n)-1n,Vc=2n**(192n-1n)-1n,Wc=2n**(200n-1n)-1n,Zc=2n**(208n-1n)-1n,Kc=2n**(216n-1n)-1n,Xc=2n**(224n-1n)-1n,Jc=2n**(232n-1n)-1n,Yc=2n**(240n-1n)-1n,qc=2n**(248n-1n)-1n,Qc=2n**(256n-1n)-1n,ep=-(2n**(8n-1n)),tp=-(2n**(16n-1n)),np=-(2n**(24n-1n)),rp=-(2n**(32n-1n)),op=-(2n**(40n-1n)),sp=-(2n**(48n-1n)),ip=-(2n**(56n-1n)),ap=-(2n**(64n-1n)),up=-(2n**(72n-1n)),cp=-(2n**(80n-1n)),pp=-(2n**(88n-1n)),dp=-(2n**(96n-1n)),fp=-(2n**(104n-1n)),mp=-(2n**(112n-1n)),lp=-(2n**(120n-1n)),yp=-(2n**(128n-1n)),bp=-(2n**(136n-1n)),hp=-(2n**(144n-1n)),xp=-(2n**(152n-1n)),gp=-(2n**(160n-1n)),wp=-(2n**(168n-1n)),vp=-(2n**(176n-1n)),$p=-(2n**(184n-1n)),Ap=-(2n**(192n-1n)),Pp=-(2n**(200n-1n)),Ip=-(2n**(208n-1n)),Mp=-(2n**(216n-1n)),Sp=-(2n**(224n-1n)),Ep=-(2n**(232n-1n)),Tp=-(2n**(240n-1n)),Bp=-(2n**(248n-1n)),kp=-(2n**(256n-1n)),zp=2n**8n-1n,Op=2n**16n-1n,Cp=2n**24n-1n,Rp=2n**32n-1n,jp=2n**40n-1n,Up=2n**48n-1n,Fp=2n**56n-1n,Lp=2n**64n-1n,Dp=2n**72n-1n,Np=2n**80n-1n,Hp=2n**88n-1n,_p=2n**96n-1n,Gp=2n**104n-1n,Vp=2n**112n-1n,Wp=2n**120n-1n,Zp=2n**128n-1n,Kp=2n**136n-1n,Xp=2n**144n-1n,Jp=2n**152n-1n,Yp=2n**160n-1n,qp=2n**168n-1n,Qp=2n**176n-1n,ed=2n**184n-1n,td=2n**192n-1n,nd=2n**200n-1n,rd=2n**208n-1n,od=2n**216n-1n,sd=2n**224n-1n,id=2n**232n-1n,ad=2n**240n-1n,ud=2n**248n-1n,Ur=2n**256n-1n;function Fr(e){let{account:t,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:o,to:i}=e,s=t?Z(t):void 0;if(s&&!w(s.address))throw new I({address:s.address});if(i&&!w(i))throw new I({address:i});if(typeof n<"u"&&(typeof r<"u"||typeof o<"u"))throw new wt;if(r&&r>Ur)throw new L({maxFeePerGas:r});if(o&&r&&o>r)throw new D({maxFeePerGas:r,maxPriorityFeePerGas:o})}async function Lr(e,t){let{account:n=e.account,batch:r=!!e.batch?.multicall,blockNumber:o,blockTag:i="latest",accessList:s,blobs:a,code:u,data:p,factory:d,factoryData:f,gas:l,gasPrice:m,maxFeePerBlobGas:b,maxFeePerGas:g,maxPriorityFeePerGas:N,nonce:ce,to:S,value:Ae,stateOverride:Nr,...Hr}=t,tn=n?Z(n):void 0;if(u&&(d||f))throw new c("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(u&&S)throw new c("Cannot provide both `code` & `to` as parameters.");let nn=u&&p,rn=d&&f&&S&&p,on=nn||rn,_r=nn?No({code:u,data:p}):rn?Ho({data:p,factory:d,factoryData:f,to:S}):p;try{Fr(t);let V=(o?y(o):void 0)||i,pe=jr(Nr),Pe=e.chain?.formatters?.transactionRequest?.format,Ie=(Pe||Or)({...zr(Hr,{format:Pe}),from:tn?.address,accessList:s,blobs:a,data:_r,gas:l,gasPrice:m,maxFeePerBlobGas:b,maxFeePerGas:g,maxPriorityFeePerGas:N,nonce:ce,to:on?void 0:S,value:Ae});if(r&&Lo({request:Ie})&&!pe)try{return await Do(e,{...Ie,blockNumber:o,blockTag:i})}catch(Et){if(!(Et instanceof de)&&!(Et instanceof H))throw Et}let sn=await e.request({method:"eth_call",params:pe?[Ie,V,pe]:[Ie,V]});return sn==="0x"?{data:void 0}:{data:sn}}catch(St){let V=_o(St),{offchainLookup:pe,offchainLookupSignature:Pe}=await import("./ccip-YAWUVTAX.js");if(e.ccipRead!==!1&&V?.slice(0,10)===Pe&&S)return{data:await pe(e,{data:V,to:S})};throw on&&V?.slice(0,10)==="0x101bb98d"?new $t({factory:d}):kr(St,{...t,account:tn,chain:e.chain})}}function Lo({request:e}){let{data:t,to:n,...r}=e;return!(!t||t.startsWith(Fn)||!n||Object.values(r).filter(o=>typeof o<"u").length>0)}async function Do(e,t){let{batchSize:n=1024,wait:r=0}=typeof e.batch?.multicall=="object"?e.batch.multicall:{},{blockNumber:o,blockTag:i="latest",data:s,multicallAddress:a,to:u}=t,p=a;if(!p){if(!e.chain)throw new de;p=Tr({blockNumber:o,chain:e.chain,contract:"multicall3"})}let f=(o?y(o):void 0)||i,{schedule:l}=Cr({id:`${e.uid}.${f}`,wait:r,shouldSplitBatch(g){return g.reduce((ce,{data:S})=>ce+(S.length-2),0)>n*2},fn:async g=>{let N=g.map(Ae=>({allowFailure:!0,callData:Ae.data,target:Ae.to})),ce=Er({abi:Ut,args:[N],functionName:"aggregate3"}),S=await e.request({method:"eth_call",params:[{data:ce,to:p},f]});return Ir({abi:Ut,args:[N],functionName:"aggregate3",data:S||"0x"})}}),[{returnData:m,success:b}]=await l({data:s,to:u});if(!b)throw new At({data:m});return m==="0x"?{data:void 0}:{data:m}}function No(e){let{code:t,data:n}=e;return Qt({abi:He(["constructor(bytes, bytes)"]),bytecode:Ln,args:[t,n]})}function Ho(e){let{data:t,factory:n,factoryData:r,to:o}=e;return Qt({abi:He(["constructor(address, bytes, address, bytes)"]),bytecode:Dn,args:[o,t,n,r]})}function _o(e){if(!(e instanceof c))return;let t=e.walk();return typeof t?.data=="object"?t.data?.data:t.data}var Pt=class extends c{constructor({callbackSelector:t,cause:n,data:r,extraData:o,sender:i,urls:s}){super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],n.metaMessages?.length?"":[],"Offchain Gateway Call:",s&&[" Gateway URL(s):",...s.map(a=>` ${ve(a)}`)],` Sender: ${i}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}},It=class extends c{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${ve(n)}`,`Response: ${Q(t)}`],name:"OffchainLookupResponseMalformedError"})}},Mt=class extends c{constructor({sender:t,to:n}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${n}`,`OffchainLookup sender address: ${t}`],name:"OffchainLookupSenderMismatchError"})}};function Dr(e,t){if(!w(e,{strict:!1}))throw new I({address:e});if(!w(t,{strict:!1}))throw new I({address:t});return e.toLowerCase()===t.toLowerCase()}var Qd="0x556f1830",Go={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function e0(e,{blockNumber:t,blockTag:n,data:r,to:o}){let{args:i}=br({data:r,abi:[Go]}),[s,a,u,p,d]=i,{ccipRead:f}=e,l=f&&typeof f?.request=="function"?f.request:Vo;try{if(!Dr(o,s))throw new Mt({sender:s,to:o});let m=await l({data:u,sender:s,urls:a}),{data:b}=await Lr(e,{blockNumber:t,blockTag:n,data:z([p,Y([{type:"bytes"},{type:"bytes"}],[m,d])]),to:o});return b}catch(m){throw new Pt({callbackSelector:p,cause:m,data:r,extraData:d,sender:s,urls:a})}}async function Vo({data:e,sender:t,urls:n}){let r=new Error("An unknown error occurred.");for(let o=0;o<n.length;o++){let i=n[o],s=i.includes("{data}")?"GET":"POST",a=s==="POST"?{data:e,sender:t}:void 0;try{let u=await fetch(i.replace("{sender}",t).replace("{data}",e),{body:JSON.stringify(a),method:s}),p;if(u.headers.get("Content-Type")?.startsWith("application/json")?p=(await u.json()).data:p=await u.text(),!u.ok){r=new $e({body:a,details:p?.error?Q(p.error):u.statusText,headers:u.headers,status:u.status,url:i});continue}if(!A(p)){r=new It({result:p,url:i});continue}return p}catch(u){r=new $e({body:a,details:u.message,url:i})}}throw r}export{_t as a,Y as b,Qd as c,Go as d,e0 as e,Vo as f};
|
|
30
|
-
//# sourceMappingURL=chunk-GSBUANUZ.js.map
|
package/dist/chunk-LURIOADG.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var g=Object.create;var e=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(b,c)=>(typeof require<"u"?require:b)[c]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var n=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports),o=(a,b)=>{for(var c in b)e(a,c,{get:b[c],enumerable:!0})},l=(a,b,c,f)=>{if(b&&typeof b=="object"||typeof b=="function")for(let d of i(b))!k.call(a,d)&&d!==c&&e(a,d,{get:()=>b[d],enumerable:!(f=h(b,d))||f.enumerable});return a};var p=(a,b,c)=>(c=a!=null?g(j(a)):{},l(b||!a||!a.__esModule?e(c,"default",{value:a,enumerable:!0}):c,a));export{m as a,n as b,o as c,p as d};
|
|
2
|
-
//# sourceMappingURL=chunk-LURIOADG.js.map
|
package/dist/chunk-TJJDXMQ6.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import*as r from"node:crypto";var c=r&&typeof r=="object"&&"webcrypto"in r?r.webcrypto:r&&typeof r=="object"&&"randomBytes"in r?r:void 0;function s(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`positive integer expected, not ${t}`)}function y(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function f(t,...e){if(!y(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function w(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");s(t.outputLen),s(t.blockLen)}function g(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function b(t,e){f(t);let o=e.outputLen;if(t.length<o)throw new Error(`digestInto() expects output buffer of length at least ${o}`)}var L=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),E=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),_=(t,e)=>t<<32-e|t>>>e;var U=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,l=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function B(t){for(let e=0;e<t.length;e++)t[e]=l(t[e])}function d(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function a(t){return typeof t=="string"&&(t=d(t)),f(t),t}function O(...t){let e=0;for(let n=0;n<t.length;n++){let i=t[n];f(i),e+=i.length}let o=new Uint8Array(e);for(let n=0,i=0;n<t.length;n++){let u=t[n];o.set(u,i),i+=u.length}return o}var p=class{clone(){return this._cloneInto()}},k={}.toString;function j(t){let e=n=>t().update(a(n)).digest(),o=t();return e.outputLen=o.outputLen,e.blockLen=o.blockLen,e.create=()=>t(),e}function S(t){let e=(n,i)=>t(i).update(a(n)).digest(),o=t({});return e.outputLen=o.outputLen,e.blockLen=o.blockLen,e.create=n=>t(n),e}function T(t=32){if(c&&typeof c.getRandomValues=="function")return c.getRandomValues(new Uint8Array(t));if(c&&typeof c.randomBytes=="function")return c.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}export{s as a,f as b,w as c,g as d,b as e,L as f,E as g,_ as h,U as i,B as j,a as k,O as l,p as m,j as n,S as o,T as p};
|
|
2
|
-
/*! Bundled license information:
|
|
3
|
-
|
|
4
|
-
@noble/hashes/esm/utils.js:
|
|
5
|
-
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
6
|
-
*/
|
|
7
|
-
//# sourceMappingURL=chunk-TJJDXMQ6.js.map
|