diff --git a/README.md b/README.md index 3817ef63bf..9984acab2b 100644 --- a/README.md +++ b/README.md @@ -56,27 +56,31 @@ yarn add @lit-protocol/lit-node-client If you're a tech-savvy user and wish to utilize only specific submodules that our main module relies upon, you can find individual packages listed below. This way, you can import only the necessary packages that cater to your specific use case:: -| Package | Category | Download | -| -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [@lit-protocol/access-control-conditions](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/access-control-conditions) | ![access-control-conditions](https://img.shields.io/badge/-universal-8A6496 'access-control-conditions') | | -| [@lit-protocol/auth](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/auth) | ![auth](https://img.shields.io/badge/-universal-8A6496 'auth') | | -| [@lit-protocol/auth-helpers](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/auth-helpers) | ![auth-helpers](https://img.shields.io/badge/-universal-8A6496 'auth-helpers') | | -| [@lit-protocol/constants](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/constants) | ![constants](https://img.shields.io/badge/-universal-8A6496 'constants') | | -| [@lit-protocol/contracts-sdk](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/contracts-sdk) | ![contracts-sdk](https://img.shields.io/badge/-universal-8A6496 'contracts-sdk') | | -| [@lit-protocol/core](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/core) | ![core](https://img.shields.io/badge/-universal-8A6496 'core') | | -| [@lit-protocol/crypto](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/crypto) | ![crypto](https://img.shields.io/badge/-universal-8A6496 'crypto') | | -| [@lit-protocol/event-listener](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/event-listener) | ![event-listener](https://img.shields.io/badge/-universal-8A6496 'event-listener') | | -| [@lit-protocol/networks](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/networks) | ![networks](https://img.shields.io/badge/-universal-8A6496 'networks') | | -| [@lit-protocol/pkp-base](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/pkp-base) | ![pkp-base](https://img.shields.io/badge/-universal-8A6496 'pkp-base') | | -| [@lit-protocol/pkp-cosmos](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/pkp-cosmos) | ![pkp-cosmos](https://img.shields.io/badge/-universal-8A6496 'pkp-cosmos') | | -| [@lit-protocol/pkp-ethers](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/pkp-ethers) | ![pkp-ethers](https://img.shields.io/badge/-universal-8A6496 'pkp-ethers') | | -| [@lit-protocol/pkp-sui](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/pkp-sui) | ![pkp-sui](https://img.shields.io/badge/-universal-8A6496 'pkp-sui') | | -| [@lit-protocol/pkp-walletconnect](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/pkp-walletconnect) | ![pkp-walletconnect](https://img.shields.io/badge/-universal-8A6496 'pkp-walletconnect') | | -| [@lit-protocol/types](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/types) | ![types](https://img.shields.io/badge/-universal-8A6496 'types') | | -| [@lit-protocol/wasm](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/wasm) | ![wasm](https://img.shields.io/badge/-universal-8A6496 'wasm') | | -| [@lit-protocol/wrapped-keys](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/wrapped-keys) | ![wrapped-keys](https://img.shields.io/badge/-universal-8A6496 'wrapped-keys') | | -| [@lit-protocol/wrapped-keys-lit-actions](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/wrapped-keys-lit-actions) | ![wrapped-keys-lit-actions](https://img.shields.io/badge/-universal-8A6496 'wrapped-keys-lit-actions') | | -| [@lit-protocol/misc-browser](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/misc-browser) | ![misc-browser](https://img.shields.io/badge/-browser-E98869 'misc-browser') | | +| Package | Category | Download | +| ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [@lit-protocol/access-control-conditions](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/access-control-conditions) | ![access-control-conditions](https://img.shields.io/badge/-universal-8A6496 'access-control-conditions') | | +| [@lit-protocol/access-control-conditions-schemas](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/access-control-conditions-schemas) | ![access-control-conditions-schemas](https://img.shields.io/badge/-universal-8A6496 'access-control-conditions-schemas') | | +| [@lit-protocol/auth](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/auth) | ![auth](https://img.shields.io/badge/-universal-8A6496 'auth') | | +| [@lit-protocol/auth-helpers](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/auth-helpers) | ![auth-helpers](https://img.shields.io/badge/-universal-8A6496 'auth-helpers') | | +| [@lit-protocol/constants](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/constants) | ![constants](https://img.shields.io/badge/-universal-8A6496 'constants') | | +| [@lit-protocol/contracts-sdk](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/contracts-sdk) | ![contracts-sdk](https://img.shields.io/badge/-universal-8A6496 'contracts-sdk') | | +| [@lit-protocol/core](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/core) | ![core](https://img.shields.io/badge/-universal-8A6496 'core') | | +| [@lit-protocol/crypto](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/crypto) | ![crypto](https://img.shields.io/badge/-universal-8A6496 'crypto') | | +| [@lit-protocol/event-listener](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/event-listener) | ![event-listener](https://img.shields.io/badge/-universal-8A6496 'event-listener') | | +| [@lit-protocol/lit-client](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/lit-client) | ![lit-client](https://img.shields.io/badge/-universal-8A6496 'lit-client') | | +| [@lit-protocol/logger](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/logger) | ![logger](https://img.shields.io/badge/-universal-8A6496 'logger') | | +| [@lit-protocol/networks](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/networks) | ![networks](https://img.shields.io/badge/-universal-8A6496 'networks') | | +| [@lit-protocol/pkp-base](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/pkp-base) | ![pkp-base](https://img.shields.io/badge/-universal-8A6496 'pkp-base') | | +| [@lit-protocol/pkp-cosmos](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/pkp-cosmos) | ![pkp-cosmos](https://img.shields.io/badge/-universal-8A6496 'pkp-cosmos') | | +| [@lit-protocol/pkp-ethers](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/pkp-ethers) | ![pkp-ethers](https://img.shields.io/badge/-universal-8A6496 'pkp-ethers') | | +| [@lit-protocol/pkp-sui](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/pkp-sui) | ![pkp-sui](https://img.shields.io/badge/-universal-8A6496 'pkp-sui') | | +| [@lit-protocol/pkp-walletconnect](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/pkp-walletconnect) | ![pkp-walletconnect](https://img.shields.io/badge/-universal-8A6496 'pkp-walletconnect') | | +| [@lit-protocol/schemas](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/schemas) | ![schemas](https://img.shields.io/badge/-universal-8A6496 'schemas') | | +| [@lit-protocol/types](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/types) | ![types](https://img.shields.io/badge/-universal-8A6496 'types') | | +| [@lit-protocol/wasm](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/wasm) | ![wasm](https://img.shields.io/badge/-universal-8A6496 'wasm') | | +| [@lit-protocol/wrapped-keys](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/wrapped-keys) | ![wrapped-keys](https://img.shields.io/badge/-universal-8A6496 'wrapped-keys') | | +| [@lit-protocol/wrapped-keys-lit-actions](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/wrapped-keys-lit-actions) | ![wrapped-keys-lit-actions](https://img.shields.io/badge/-universal-8A6496 'wrapped-keys-lit-actions') | | +| [@lit-protocol/misc-browser](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/misc-browser) | ![misc-browser](https://img.shields.io/badge/-browser-E98869 'misc-browser') | | diff --git a/local-tests/setup/networkContext.json b/local-tests/setup/networkContext.json index 4c1edd6f7f..82da5e588a 100644 --- a/local-tests/setup/networkContext.json +++ b/local-tests/setup/networkContext.json @@ -2895,6 +2895,19 @@ "name": "Transfer", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newTrustedForwarder", + "type": "address" + } + ], + "name": "TrustedForwarderSet", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -3168,6 +3181,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "getTrustedForwarder", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "initialize", @@ -3433,6 +3459,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "forwarder", + "type": "address" + } + ], + "name": "setTrustedForwarder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -4286,6 +4325,19 @@ "name": "RootHashUpdated", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newTrustedForwarder", + "type": "address" + } + ], + "name": "TrustedForwarderSet", + "type": "event" + }, { "inputs": [ { @@ -4687,6 +4739,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "getTrustedForwarder", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -4945,6 +5010,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "forwarder", + "type": "address" + } + ], + "name": "setTrustedForwarder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -5545,6 +5623,19 @@ "name": "ToggleEvent", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newTrustedForwarder", + "type": "address" + } + ], + "name": "TrustedForwarderSet", + "type": "event" + }, { "inputs": [ { @@ -5814,6 +5905,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "getTrustedForwarder", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -5948,6 +6052,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "forwarder", + "type": "address" + } + ], + "name": "setTrustedForwarder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -6375,11 +6492,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "CallerNotOwner", - "type": "error" - }, { "inputs": [ { @@ -6404,6 +6516,25 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "getCurrentRealmIdForStakerAddress", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -6423,6 +6554,38 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "getShawdowRealmIdForStakerAddress", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getUnassignedStakerAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "getUnassignedValidators", @@ -6471,18 +6634,43 @@ }, { "internalType": "uint256", - "name": "commission", + "name": "commissionRate", "type": "uint256" }, { "internalType": "uint256", - "name": "commissionRate", + "name": "lastRewardEpoch", "type": "uint256" }, { "internalType": "uint256", - "name": "lastRewardEpoch", + "name": "lastRealmId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "delegatedStakeAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "delegatedStakeWeight", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardEpochClaimedFixedCostRewards", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardEpochClaimedCommission", "type": "uint256" + }, + { + "internalType": "address", + "name": "operatorAddress", + "type": "address" } ], "internalType": "struct LibStakingStorage.Validator[]", @@ -6588,6 +6776,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "numRealms", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -6642,18 +6843,43 @@ }, { "internalType": "uint256", - "name": "commission", + "name": "commissionRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardEpoch", "type": "uint256" }, { "internalType": "uint256", - "name": "commissionRate", + "name": "lastRealmId", "type": "uint256" }, { "internalType": "uint256", - "name": "lastRewardEpoch", + "name": "delegatedStakeAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "delegatedStakeWeight", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardEpochClaimedFixedCostRewards", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardEpochClaimedCommission", "type": "uint256" + }, + { + "internalType": "address", + "name": "operatorAddress", + "type": "address" } ], "internalType": "struct LibStakingStorage.Validator", @@ -6664,11 +6890,31 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, { "inputs": [], "name": "CallerNotOwnerOrDevopsAdmin", "type": "error" }, + { + "inputs": [], + "name": "CannotStakeZero", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidNewSharePrice", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidSlashPercentage", + "type": "error" + }, { "inputs": [ { @@ -6680,6 +6926,22 @@ "name": "MustBeInNextValidatorSetLockedOrReadyForNextEpochState", "type": "error" }, + { + "inputs": [ + { + "internalType": "address", + "name": "validator", + "type": "address" + }, + { + "internalType": "address[]", + "name": "validatorsInNextEpoch", + "type": "address[]" + } + ], + "name": "ValidatorIsNotInNextEpoch", + "type": "error" + }, { "anonymous": false, "inputs": [ @@ -7012,19 +7274,51 @@ { "indexed": false, "internalType": "address", - "name": "newStakingTokenAddress", + "name": "newResolverContractAddress", "type": "address" } ], - "name": "StakingTokenSet", + "name": "ResolverContractAddressSet", "type": "event" }, { "anonymous": false, "inputs": [ { - "indexed": false, - "internalType": "enum LibStakingStorage.States", + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Staked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newStakingTokenAddress", + "type": "address" + } + ], + "name": "StakingTokenSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum LibStakingStorage.States", "name": "newState", "type": "uint8" } @@ -7032,6 +7326,32 @@ "name": "StateChanged", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "ValidatorBanned", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "ValidatorKickedFromNextEpoch", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -7045,6 +7365,32 @@ "name": "ValidatorRejoinedNextEpoch", "type": "event" }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "addPermittedStaker", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "addRealm", + "outputs": [ + { + "internalType": "uint256", + "name": "realmId", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -7110,14 +7456,37 @@ { "inputs": [ { - "internalType": "address", - "name": "validatorStakerAddress", - "type": "address" + "internalType": "uint256", + "name": "source_realmId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "target_realmId", + "type": "uint256" }, + { + "internalType": "address[]", + "name": "target_validators", + "type": "address[]" + } + ], + "name": "adminSetupShadowSplicing", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ { "internalType": "uint256", - "name": "amountToPenalize", + "name": "percentage", "type": "uint256" + }, + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" } ], "name": "adminSlashValidator", @@ -7148,6 +7517,24 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "realmId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "decreaseRewardPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -7174,6 +7561,50 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "realmId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "increaseRewardPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "removePermittedStaker", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "realmId", + "type": "uint256" + } + ], + "name": "removeRealm", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -7317,6 +7748,16 @@ "internalType": "uint256", "name": "minSelfStakeTimelock", "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minValidatorCountToClampMinimumThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minThresholdToClampAt", + "type": "uint256" } ], "internalType": "struct LibStakingStorage.GlobalConfig", @@ -7329,6 +7770,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -7458,6 +7912,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "bool", + "name": "permittedStakersOn", + "type": "bool" + } + ], + "name": "setPermittedStakersOn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -7496,6 +7963,11 @@ "internalType": "bool", "name": "rpcHealthcheckEnabled", "type": "bool" + }, + { + "internalType": "uint256", + "name": "minEpochForRewards", + "type": "uint256" } ], "internalType": "struct LibStakingStorage.RealmConfig", @@ -7508,6 +7980,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newTotalSupply", + "type": "uint256" + } + ], + "name": "setTokenTotalSupplyStandIn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [], "name": "CallerNotContract", @@ -7523,11 +8008,6 @@ "name": "CannotModifyUnfrozen", "type": "error" }, - { - "inputs": [], - "name": "CannotStakeZero", - "type": "error" - }, { "inputs": [], "name": "CannotWithdrawFrozen", @@ -7560,11 +8040,6 @@ "name": "InsufficientSelfStake", "type": "error" }, - { - "inputs": [], - "name": "InvalidNewSharePrice", - "type": "error" - }, { "inputs": [], "name": "InvalidRatio", @@ -7675,6 +8150,11 @@ "name": "TimeLockNotMet", "type": "error" }, + { + "inputs": [], + "name": "TooSoonToWithdraw", + "type": "error" + }, { "inputs": [ { @@ -7692,11 +8172,29 @@ { "indexed": false, "internalType": "address", - "name": "newResolverContractAddress", + "name": "stakerAddress", "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "rewards", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fromEpoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "toEpoch", + "type": "uint256" } ], - "name": "ResolverContractAddressSet", + "name": "FixedCostRewardsClaimed", "type": "event" }, { @@ -7809,19 +8307,44 @@ "anonymous": false, "inputs": [ { - "indexed": true, + "indexed": false, "internalType": "address", - "name": "staker", + "name": "newTrustedForwarder", + "type": "address" + } + ], + "name": "TrustedForwarderSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "stakerAddress", "type": "address" }, { "indexed": false, "internalType": "uint256", - "name": "amount", + "name": "rewards", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fromEpoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "toEpoch", "type": "uint256" } ], - "name": "Staked", + "name": "ValidatorCommissionClaimed", "type": "event" }, { @@ -7856,37 +8379,6 @@ "name": "Withdrawn", "type": "event" }, - { - "inputs": [ - { - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "addPermittedStaker", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "percentage", - "type": "uint256" - }, - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "adminSlashValidator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -7925,6 +8417,24 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "realmId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxNumberOfEpochsToClaim", + "type": "uint256" + } + ], + "name": "claimFixedCostRewards", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -7941,6 +8451,11 @@ "internalType": "uint256", "name": "stakeRecordId", "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxNumberOfEpochsToClaim", + "type": "uint256" } ], "name": "claimStakeRewards", @@ -7949,7 +8464,18 @@ "type": "function" }, { - "inputs": [], + "inputs": [ + { + "internalType": "uint256", + "name": "realmId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxNumberOfEpochsToClaim", + "type": "uint256" + } + ], "name": "claimValidatorCommission", "outputs": [], "stateMutability": "nonpayable", @@ -8023,7 +8549,17 @@ }, { "internalType": "uint256", - "name": "totalRewards", + "name": "totalStakeRewards", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "validatorFixedCostRewards", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "validatorCommission", "type": "uint256" }, { @@ -8065,6 +8601,100 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "rewardEpochNumber", + "type": "uint256" + } + ], + "name": "getRewardEpochView", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "epochEnd", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalStakeWeight", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalStakeRewards", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "validatorFixedCostRewards", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "validatorCommission", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "slope", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "slopeIncrease", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "validatorSharePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stakeAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "validatorSharePriceAtLastUpdate", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "initial", + "type": "bool" + } + ], + "internalType": "struct LibStakingStorage.RewardEpoch", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTrustedForwarder", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -8079,7 +8709,7 @@ }, { "internalType": "uint256", - "name": "amount", + "name": "additionalAmount", "type": "uint256" } ], @@ -8090,11 +8720,6 @@ }, { "inputs": [ - { - "internalType": "uint256", - "name": "realmId", - "type": "uint256" - }, { "internalType": "address", "name": "stakerAddress", @@ -8107,7 +8732,7 @@ }, { "internalType": "uint256", - "name": "newTimeLock", + "name": "additionalTimeLock", "type": "uint256" } ], @@ -8127,6 +8752,11 @@ "internalType": "uint256", "name": "rewardEpochNumber", "type": "uint256" + }, + { + "internalType": "bool", + "name": "isInitial", + "type": "bool" } ], "name": "initializeRewardEpoch", @@ -8143,7 +8773,7 @@ }, { "internalType": "address", - "name": "userStakerAddress", + "name": "operatorAddressToMigrateFrom", "type": "address" }, { @@ -8153,7 +8783,7 @@ }, { "internalType": "address", - "name": "newStakerAddress", + "name": "operatorAddressToMigrateTo", "type": "address" } ], @@ -8166,55 +8796,11 @@ "inputs": [ { "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "removePermittedStaker", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "setContractResolver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "permittedStakersOn", - "type": "bool" - } - ], - "name": "setPermittedStakersOn", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", + "name": "forwarder", "type": "address" - }, - { - "internalType": "uint256", - "name": "rate", - "type": "uint256" } ], - "name": "setValidatorComissionRate", + "name": "setTrustedForwarder", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -8223,23 +8809,12 @@ "inputs": [ { "internalType": "uint256", - "name": "percentage", - "type": "uint256" - }, - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "slashValidator", - "outputs": [ - { - "internalType": "uint256", - "name": "", + "name": "rate", "type": "uint256" } ], + "name": "setValidatorCommissionRate", + "outputs": [], "stateMutability": "nonpayable", "type": "function" }, @@ -8307,25 +8882,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "realmId", - "type": "uint256" - } - ], - "name": "updateRewardEpoch", - "outputs": [ - { - "internalType": "uint256", - "name": "currentRewardEpoch", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -8419,6 +8975,11 @@ "name": "CouldNotMapNodeAddressToStakerAddress", "type": "error" }, + { + "inputs": [], + "name": "InvalidAttestedAddress", + "type": "error" + }, { "inputs": [ { @@ -8575,6 +9136,11 @@ "name": "SignaledReadyForWrongEpochNumber", "type": "error" }, + { + "inputs": [], + "name": "StakerAddressMismatch", + "type": "error" + }, { "inputs": [ { @@ -8602,6 +9168,17 @@ "name": "TryingToWithdrawMoreThanStaked", "type": "error" }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "ValidatorAlreadyInNextValidatorSet", + "type": "error" + }, { "inputs": [ { @@ -8622,16 +9199,11 @@ "inputs": [ { "internalType": "address", - "name": "validator", + "name": "staker", "type": "address" - }, - { - "internalType": "address[]", - "name": "validatorsInNextEpoch", - "type": "address[]" } ], - "name": "ValidatorIsNotInNextEpoch", + "name": "ValidatorNotInNextEpoch", "type": "error" }, { @@ -8852,25 +9424,6 @@ "name": "RewardsDurationUpdated", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amountBurned", - "type": "uint256" - } - ], - "name": "ValidatorKickedFromNextEpoch", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -9000,39 +9553,27 @@ "internalType": "uint256", "name": "realmId", "type": "uint256" - }, - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, + } + ], + "name": "requestToJoin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ { "internalType": "uint256", - "name": "senderPubKey", + "name": "realmId", "type": "uint256" }, { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" + "internalType": "address", + "name": "stakerAddress", + "type": "address" } ], - "name": "requestToJoin", + "name": "requestToJoinAsAdmin", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -9044,35 +9585,28 @@ "name": "realmId", "type": "uint256" }, - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, { "internalType": "address", "name": "stakerAddress", "type": "address" - }, + } + ], + "name": "requestToJoinAsForShadowSplicing", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ { "internalType": "uint256", - "name": "senderPubKey", + "name": "realmId", "type": "uint256" }, { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" + "internalType": "address", + "name": "stakerAddress", + "type": "address" } ], "name": "requestToJoinAsNode", @@ -9119,7 +9653,7 @@ }, { "internalType": "address", - "name": "nodeAddress", + "name": "operatorAddress", "type": "address" }, { @@ -9172,36 +9706,6 @@ "internalType": "uint256", "name": "amount", "type": "uint256" - }, - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" } ], "name": "stakeAndJoin", @@ -9482,11 +9986,6 @@ "name": "NodeAddressNotFoundForStaker", "type": "error" }, - { - "inputs": [], - "name": "StakeNotFound", - "type": "error" - }, { "inputs": [ { @@ -9502,14 +10001,14 @@ "type": "uint256" }, { - "internalType": "uint256", - "name": "rewards", - "type": "uint256" + "internalType": "address[]", + "name": "validatorsInCurrentEpoch", + "type": "address[]" }, { - "internalType": "bool", - "name": "isStarted", - "type": "bool" + "internalType": "uint256", + "name": "actualEpochLength", + "type": "uint256" } ], "internalType": "struct LibStakingStorage.RewardEpochGlobalStats", @@ -9517,7 +10016,7 @@ "type": "tuple" } ], - "name": "calculateRewardsPerEpoch", + "name": "calculateRewardsPerDay", "outputs": [ { "internalType": "uint256", @@ -9692,27 +10191,27 @@ }, { "internalType": "uint256", - "name": "endTime", + "name": "nextRewardEpochNumber", "type": "uint256" }, { "internalType": "uint256", - "name": "retries", + "name": "endTime", "type": "uint256" }, { "internalType": "uint256", - "name": "timeout", + "name": "retries", "type": "uint256" }, { "internalType": "uint256", - "name": "startTime", + "name": "timeout", "type": "uint256" }, { "internalType": "uint256", - "name": "lastEpochStart", + "name": "startTime", "type": "uint256" } ], @@ -9797,18 +10296,43 @@ }, { "internalType": "uint256", - "name": "commission", + "name": "commissionRate", "type": "uint256" }, { "internalType": "uint256", - "name": "commissionRate", + "name": "lastRewardEpoch", "type": "uint256" }, { "internalType": "uint256", - "name": "lastRewardEpoch", + "name": "lastRealmId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "delegatedStakeAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "delegatedStakeWeight", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardEpochClaimedFixedCostRewards", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardEpochClaimedCommission", "type": "uint256" + }, + { + "internalType": "address", + "name": "operatorAddress", + "type": "address" } ], "internalType": "struct LibStakingStorage.Validator[]", @@ -9848,27 +10372,27 @@ }, { "internalType": "uint256", - "name": "endTime", + "name": "nextRewardEpochNumber", "type": "uint256" }, { "internalType": "uint256", - "name": "retries", + "name": "endTime", "type": "uint256" }, { "internalType": "uint256", - "name": "timeout", + "name": "retries", "type": "uint256" }, { "internalType": "uint256", - "name": "startTime", + "name": "timeout", "type": "uint256" }, { "internalType": "uint256", - "name": "lastEpochStart", + "name": "startTime", "type": "uint256" } ], @@ -9905,38 +10429,63 @@ }, { "internalType": "uint256", - "name": "reward", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastActiveEpoch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "commissionRate", "type": "uint256" }, { "internalType": "uint256", - "name": "senderPubKey", + "name": "lastRewardEpoch", "type": "uint256" }, { "internalType": "uint256", - "name": "receiverPubKey", + "name": "lastRealmId", "type": "uint256" }, { "internalType": "uint256", - "name": "lastActiveEpoch", + "name": "delegatedStakeAmount", "type": "uint256" }, { "internalType": "uint256", - "name": "commission", + "name": "delegatedStakeWeight", "type": "uint256" }, { "internalType": "uint256", - "name": "commissionRate", + "name": "lastRewardEpochClaimedFixedCostRewards", "type": "uint256" }, { "internalType": "uint256", - "name": "lastRewardEpoch", + "name": "lastRewardEpochClaimedCommission", "type": "uint256" + }, + { + "internalType": "address", + "name": "operatorAddress", + "type": "address" } ], "internalType": "struct LibStakingStorage.Validator[]", @@ -9966,6 +10515,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "getAllValidators", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "getKeyTypes", @@ -9998,6 +10560,82 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "getLastStakeRecord", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "unfreezeStart", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timeLock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardEpochClaimed", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "initialSharePrice", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "loaded", + "type": "bool" + }, + { + "internalType": "bool", + "name": "frozen", + "type": "bool" + }, + { + "internalType": "address", + "name": "attributionAddress", + "type": "address" + } + ], + "internalType": "struct LibStakingStorage.StakeRecord", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "getLitCirc", @@ -10008,7 +10646,25 @@ "type": "uint256" } ], - "stateMutability": "pure", + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getLowestRewardEpochNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", "type": "function" }, { @@ -10092,6 +10748,25 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "realmId", + "type": "uint256" + } + ], + "name": "getNonShadowValidators", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -10115,14 +10790,14 @@ "type": "uint256" }, { - "internalType": "uint256", - "name": "rewards", - "type": "uint256" + "internalType": "address[]", + "name": "validatorsInCurrentEpoch", + "type": "address[]" }, { - "internalType": "bool", - "name": "isStarted", - "type": "bool" + "internalType": "uint256", + "name": "actualEpochLength", + "type": "uint256" } ], "internalType": "struct LibStakingStorage.RewardEpochGlobalStats", @@ -10152,6 +10827,25 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "realmId", + "type": "uint256" + } + ], + "name": "getShadowValidators", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -10201,7 +10895,7 @@ }, { "internalType": "uint256", - "name": "rewardEpochCheckpoint", + "name": "lastRewardEpochClaimed", "type": "uint256" }, { @@ -10218,6 +10912,11 @@ "internalType": "bool", "name": "frozen", "type": "bool" + }, + { + "internalType": "address", + "name": "attributionAddress", + "type": "address" } ], "internalType": "struct LibStakingStorage.StakeRecord", @@ -10296,7 +10995,7 @@ }, { "internalType": "uint256", - "name": "rewardEpochCheckpoint", + "name": "lastRewardEpochClaimed", "type": "uint256" }, { @@ -10313,6 +11012,11 @@ "internalType": "bool", "name": "frozen", "type": "bool" + }, + { + "internalType": "address", + "name": "attributionAddress", + "type": "address" } ], "internalType": "struct LibStakingStorage.StakeRecord[]", @@ -10331,56 +11035,14 @@ "type": "address" }, { - "components": [ - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "unfreezeStart", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "timeLock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastUpdateTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rewardEpochCheckpoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "initialSharePrice", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "loaded", - "type": "bool" - }, - { - "internalType": "bool", - "name": "frozen", - "type": "bool" - } - ], - "internalType": "struct LibStakingStorage.StakeRecord", - "name": "stakeRecord", - "type": "tuple" + "internalType": "uint256", + "name": "recordId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "userStakerAddress", + "type": "address" }, { "internalType": "uint256", @@ -10435,7 +11097,7 @@ }, { "internalType": "uint256", - "name": "rewardEpochCheckpoint", + "name": "lastRewardEpochClaimed", "type": "uint256" }, { @@ -10452,6 +11114,11 @@ "internalType": "bool", "name": "frozen", "type": "bool" + }, + { + "internalType": "address", + "name": "attributionAddress", + "type": "address" } ], "internalType": "struct LibStakingStorage.StakeRecord", @@ -10537,7 +11204,7 @@ }, { "internalType": "uint256", - "name": "rewardEpochCheckpoint", + "name": "lastRewardEpochClaimed", "type": "uint256" }, { @@ -10554,6 +11221,11 @@ "internalType": "bool", "name": "frozen", "type": "bool" + }, + { + "internalType": "address", + "name": "attributionAddress", + "type": "address" } ], "internalType": "struct LibStakingStorage.StakeRecord", @@ -10760,18 +11432,43 @@ }, { "internalType": "uint256", - "name": "commission", + "name": "commissionRate", "type": "uint256" }, { "internalType": "uint256", - "name": "commissionRate", + "name": "lastRewardEpoch", "type": "uint256" }, { "internalType": "uint256", - "name": "lastRewardEpoch", + "name": "lastRealmId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "delegatedStakeAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "delegatedStakeWeight", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardEpochClaimedFixedCostRewards", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardEpochClaimedCommission", "type": "uint256" + }, + { + "internalType": "address", + "name": "operatorAddress", + "type": "address" } ], "internalType": "struct LibStakingStorage.Validator[]", @@ -10836,18 +11533,43 @@ }, { "internalType": "uint256", - "name": "commission", + "name": "commissionRate", "type": "uint256" }, { "internalType": "uint256", - "name": "commissionRate", + "name": "lastRewardEpoch", "type": "uint256" }, { "internalType": "uint256", - "name": "lastRewardEpoch", + "name": "lastRealmId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "delegatedStakeAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "delegatedStakeWeight", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardEpochClaimedFixedCostRewards", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardEpochClaimedCommission", "type": "uint256" + }, + { + "internalType": "address", + "name": "operatorAddress", + "type": "address" } ], "internalType": "struct LibStakingStorage.Validator[]", @@ -10912,18 +11634,43 @@ }, { "internalType": "uint256", - "name": "commission", + "name": "commissionRate", "type": "uint256" }, { "internalType": "uint256", - "name": "commissionRate", + "name": "lastRewardEpoch", "type": "uint256" }, { "internalType": "uint256", - "name": "lastRewardEpoch", + "name": "lastRealmId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "delegatedStakeAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "delegatedStakeWeight", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardEpochClaimedFixedCostRewards", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardEpochClaimedCommission", "type": "uint256" + }, + { + "internalType": "address", + "name": "operatorAddress", + "type": "address" } ], "internalType": "struct LibStakingStorage.Validator[]", @@ -11078,6 +11825,16 @@ "internalType": "uint256", "name": "minSelfStakeTimelock", "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minValidatorCountToClampMinimumThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minThresholdToClampAt", + "type": "uint256" } ], "internalType": "struct LibStakingStorage.GlobalConfig", @@ -11088,6 +11845,30 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "realmId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "isActiveShadowValidator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -11349,6 +12130,25 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "operatorAddress", + "type": "address" + } + ], + "name": "operatorAddressToStakerAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -11438,6 +12238,11 @@ "internalType": "bool", "name": "rpcHealthcheckEnabled", "type": "bool" + }, + { + "internalType": "uint256", + "name": "minEpochForRewards", + "type": "uint256" } ], "internalType": "struct LibStakingStorage.RealmConfig", @@ -11493,10 +12298,20 @@ }, { "inputs": [ + { + "internalType": "uint256", + "name": "realmId", + "type": "uint256" + }, { "internalType": "address", "name": "stakerAddress", "type": "address" + }, + { + "internalType": "bool", + "name": "stakerInCurrentValidatorSet", + "type": "bool" } ], "name": "validatorSelfStakeWillExpire", @@ -11564,18 +12379,43 @@ }, { "internalType": "uint256", - "name": "commission", + "name": "commissionRate", "type": "uint256" }, { "internalType": "uint256", - "name": "commissionRate", + "name": "lastRewardEpoch", "type": "uint256" }, { "internalType": "uint256", - "name": "lastRewardEpoch", + "name": "lastRealmId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "delegatedStakeAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "delegatedStakeWeight", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardEpochClaimedFixedCostRewards", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardEpochClaimedCommission", "type": "uint256" + }, + { + "internalType": "address", + "name": "operatorAddress", + "type": "address" } ], "internalType": "struct LibStakingStorage.Validator", @@ -11799,6 +12639,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "FORWARDER_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "HD_KEY_DERIVER_CONTRACT", @@ -12697,6 +13550,19 @@ "name": "MaxNetworkPriceSet", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newTrustedForwarder", + "type": "address" + } + ], + "name": "TrustedForwarderSet", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -12741,6 +13607,41 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "getNodeCapacityConfig", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "pkpSignMaxConcurrency", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "encSignMaxConcurrency", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "litActionMaxConcurrency", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "globalMaxCapacity", + "type": "uint256" + } + ], + "internalType": "struct LibPriceFeedStorage.NodeCapacityConfig", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -12812,18 +13713,43 @@ }, { "internalType": "uint256", - "name": "commission", + "name": "commissionRate", "type": "uint256" }, { "internalType": "uint256", - "name": "commissionRate", + "name": "lastRewardEpoch", "type": "uint256" }, { "internalType": "uint256", - "name": "lastRewardEpoch", + "name": "lastRealmId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "delegatedStakeAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "delegatedStakeWeight", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardEpochClaimedFixedCostRewards", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardEpochClaimedCommission", "type": "uint256" + }, + { + "internalType": "address", + "name": "operatorAddress", + "type": "address" } ], "internalType": "struct LibStakingStorage.Validator", @@ -12857,6 +13783,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "getTrustedForwarder", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -12976,7 +13915,60 @@ "type": "uint256[]" } ], - "name": "setBaseNetworkPrices", + "name": "setBaseNetworkPrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newPrice", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "productIds", + "type": "uint256[]" + } + ], + "name": "setMaxNetworkPrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "pkpSignMaxConcurrency", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "encSignMaxConcurrency", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "litActionMaxConcurrency", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "globalMaxCapacity", + "type": "uint256" + } + ], + "internalType": "struct LibPriceFeedStorage.NodeCapacityConfig", + "name": "config", + "type": "tuple" + } + ], + "name": "setNodeCapacityConfig", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -12984,17 +13976,12 @@ { "inputs": [ { - "internalType": "uint256", - "name": "newPrice", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "productIds", - "type": "uint256[]" + "internalType": "address", + "name": "forwarder", + "type": "address" } ], - "name": "setMaxNetworkPrices", + "name": "setTrustedForwarder", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -13657,6 +14644,19 @@ "name": "RewardWithdrawRequest", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newTrustedForwarder", + "type": "address" + } + ], + "name": "TrustedForwarderSet", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -13820,6 +14820,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "getTrustedForwarder", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -13992,6 +15005,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "forwarder", + "type": "address" + } + ], + "name": "setTrustedForwarder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -14059,5 +15085,227 @@ } ], "name": "Ledger" + }, + "Forwarder": { + "address": "0xAA292E8611aDF267e563f334Ee42320aC96D0463", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidShortString", + "type": "error" + }, + { + "inputs": [], + "name": "SignatureDoesNotMatch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "str", + "type": "string" + } + ], + "name": "StringTooLong", + "type": "error" + }, + { + "inputs": [], + "name": "TransactionRevertedSilently", + "type": "error" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "gas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct Forwarder.ForwardRequest", + "name": "req", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "execute", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + } + ], + "name": "getNonce", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "gas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct Forwarder.ForwardRequest", + "name": "req", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "name": "Forwarder" } } diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/PKPPermissionsManager.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/PKPPermissionsManager.ts index 28b2d8420c..e1ae4136e8 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/PKPPermissionsManager.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/PKPPermissionsManager.ts @@ -26,7 +26,7 @@ * ``` */ -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; +import { DatilContext } from '../../../../../types'; import { PkpIdentifierRaw } from '../../rawContractApis/permissions/utils/resolvePkpTokenId'; // Import all handler functions @@ -46,7 +46,7 @@ import { isPermittedAddressByIdentifier } from './handlers/isPermittedAddressByI import { removePermittedActionByIdentifier } from './handlers/removePermittedActionByIdentifier'; import { removePermittedAddressByIdentifier } from './handlers/removePermittedAddressByIdentifier'; -import { logger } from 'utils/logger'; +import { logger } from '@lit-protocol/logger'; import { ScopeString } from '../../../schemas/shared/ScopeSchema'; import { LitTxVoid } from '../../types'; import { AuthMethod } from '../../rawContractApis/permissions/read/getPermittedAuthMethods'; diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedActionByIdentifier.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedActionByIdentifier.ts index 6bf0d805e4..f5473e4209 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedActionByIdentifier.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedActionByIdentifier.ts @@ -1,10 +1,10 @@ -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; +import { DatilContext } from '../../../../../../types'; import { PkpIdentifierRaw, resolvePkpTokenId, } from '../../../rawContractApis/permissions/utils/resolvePkpTokenId'; import { addPermittedAction } from '../../../rawContractApis/permissions/write/addPermittedAction'; -import { isIpfsCidV0 } from 'services/lit/utils/z-validate'; +import { isIpfsCidV0 } from '../../../../../../../shared/utils/z-validate'; import { z } from 'zod'; import { LitTxVoid } from '../../../types'; import { ScopeStringSchema } from '../../../../schemas/shared/ScopeSchema'; diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedAddressByIdentifier.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedAddressByIdentifier.ts index 055d06a3eb..2e4a563eef 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedAddressByIdentifier.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedAddressByIdentifier.ts @@ -1,4 +1,4 @@ -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; +import { DatilContext } from '../../../../../../types'; import { PkpIdentifierRaw, resolvePkpTokenId, diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPKPsByAddress.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPKPsByAddress.ts index bd9d896931..8269065363 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPKPsByAddress.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPKPsByAddress.ts @@ -1,6 +1,6 @@ // import { datilDevNetworkContext } from "services/lit/LitNetwork/vDatil/datil-dev/networkContext"; -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; -import { logger } from 'utils/logger'; +import { DatilContext } from '../../../../../../types'; +import { logger } from '@lit-protocol/logger'; import { getAddress } from 'viem'; import { z } from 'zod'; import { getPubkeyByTokenId } from '../../../rawContractApis/pkp/read/getPubkeyByTokenId'; diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermissionsContext.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermissionsContext.ts index 5e2ef28270..95e2ace42b 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermissionsContext.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermissionsContext.ts @@ -1,5 +1,5 @@ -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; -import { logger } from 'utils/logger'; +import { DatilContext } from '../../../../../../types'; +import { logger } from '@lit-protocol/logger'; import { getPermittedActions } from '../../../rawContractApis/permissions/read/getPermittedActions'; import { getPermittedAddresses } from '../../../rawContractApis/permissions/read/getPermittedAddresses'; import { @@ -71,32 +71,32 @@ export async function getPermissionsContext( } // Example usage -if (import.meta.main) { - // const networkCtx = datilDevNetworkContext; - // async function example() { - // // Can use any of these identifiers: - // const ctx = await getPermissionsContext( - // { - // tokenId: - // "76136736151863037541847315168980811654782785653773679312890341037699996601290", - // }, - // networkCtx - // ); - // // Check current permissions - // const isActionAllowed = ctx.isActionPermitted("0x1234..." as `0x${string}`); - // const isAddressAllowed = ctx.isAddressPermitted( - // "0x5678..." as `0x${string}` - // ); - // const isAuthMethodAllowed = ctx.isAuthMethodPermitted( - // 1, // AuthMethodType.EthWallet - // "0x1234567890abcdef1234567890abcdef12345678" - // ); - // console.log("Action permitted:", isActionAllowed); - // console.log("Address permitted:", isAddressAllowed); - // console.log("Auth method permitted:", isAuthMethodAllowed); - // console.log("All permitted actions:", ctx.actions); - // console.log("All permitted addresses:", ctx.addresses); - // console.log("All permitted auth methods:", ctx.authMethods); - // } - // example().catch(console.error); -} +// if (import.meta.main) { +// // const networkCtx = datilDevNetworkContext; +// // async function example() { +// // // Can use any of these identifiers: +// // const ctx = await getPermissionsContext( +// // { +// // tokenId: +// // "76136736151863037541847315168980811654782785653773679312890341037699996601290", +// // }, +// // networkCtx +// // ); +// // // Check current permissions +// // const isActionAllowed = ctx.isActionPermitted("0x1234..." as `0x${string}`); +// // const isAddressAllowed = ctx.isAddressPermitted( +// // "0x5678..." as `0x${string}` +// // ); +// // const isAuthMethodAllowed = ctx.isAuthMethodPermitted( +// // 1, // AuthMethodType.EthWallet +// // "0x1234567890abcdef1234567890abcdef12345678" +// // ); +// // console.log("Action permitted:", isActionAllowed); +// // console.log("Address permitted:", isAddressAllowed); +// // console.log("Auth method permitted:", isAuthMethodAllowed); +// // console.log("All permitted actions:", ctx.actions); +// // console.log("All permitted addresses:", ctx.addresses); +// // console.log("All permitted auth methods:", ctx.authMethods); +// // } +// // example().catch(console.error); +// } diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedActionsByIdentifier.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedActionsByIdentifier.ts index e32ba20b26..adbdc66645 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedActionsByIdentifier.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedActionsByIdentifier.ts @@ -1,5 +1,5 @@ -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; -import { logger } from 'utils/logger'; +import { DatilContext } from '../../../../../../types'; +import { logger } from '@lit-protocol/logger'; import { getPermittedActions } from '../../../rawContractApis/permissions/read/getPermittedActions'; import { PkpIdentifierRaw, diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAddressesByIdentifier.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAddressesByIdentifier.ts index 3102c65571..69f984e541 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAddressesByIdentifier.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAddressesByIdentifier.ts @@ -1,5 +1,5 @@ -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; -import { logger } from 'utils/logger'; +import { DatilContext } from '../../../../../../types'; +import { logger } from '@lit-protocol/logger'; import { getPermittedAddresses } from '../../../rawContractApis/permissions/read/getPermittedAddresses'; import { PkpIdentifierRaw, diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAuthMethodScopesByIdentifier.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAuthMethodScopesByIdentifier.ts index 8e286cd48f..1bde128aa7 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAuthMethodScopesByIdentifier.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAuthMethodScopesByIdentifier.ts @@ -1,11 +1,11 @@ -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; -import { logger } from 'utils/logger'; +import { DatilContext } from '../../../../../../types'; +import { logger } from '@lit-protocol/logger'; import { getPermittedAuthMethodScopes } from '../../../rawContractApis/permissions/read/getPermittedAuthMethodScopes'; import { PkpIdentifierRaw, resolvePkpTokenId, } from '../../../rawContractApis/permissions/utils/resolvePkpTokenId'; -import { datilDevNetworkContext } from 'services/lit/LitNetwork/vDatil/datil-dev/networkContext'; +import { datilDevNetworkContext } from '../../../../../../datil-dev/networkContext'; /** * Get permitted scopes for a specific authentication method of a PKP token using various identifier types @@ -41,22 +41,22 @@ export async function getPermittedAuthMethodScopesByIdentifier( ); } -// Example usage when running as main -if (import.meta.main) { - const networkCtx = datilDevNetworkContext; +// // Example usage when running as main +// if (import.meta.main) { +// const networkCtx = datilDevNetworkContext; - const res = await getPermittedAuthMethodScopesByIdentifier( - { - identifier: { - // tokenId: "76136736151863037541847315168980811654782785653773679312890341037699996601290", - // pubkey: "0x000", - address: '0xef3eE1bD838aF5B36482FAe8a6Fc394C68d5Fa9F', - }, - authMethodType: 1, - authMethodId: '0x1234567890abcdef1234567890abcdef12345678', - scopeId: 0, - }, - networkCtx - ); - console.log('permittedAuthMethodScopes', res); -} +// const res = await getPermittedAuthMethodScopesByIdentifier( +// { +// identifier: { +// // tokenId: "76136736151863037541847315168980811654782785653773679312890341037699996601290", +// // pubkey: "0x000", +// address: '0xef3eE1bD838aF5B36482FAe8a6Fc394C68d5Fa9F', +// }, +// authMethodType: 1, +// authMethodId: '0x1234567890abcdef1234567890abcdef12345678', +// scopeId: 0, +// }, +// networkCtx +// ); +// console.log('permittedAuthMethodScopes', res); +// } diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAuthMethodsByIdentifier.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAuthMethodsByIdentifier.ts index 110f641400..72e81f6bfc 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAuthMethodsByIdentifier.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAuthMethodsByIdentifier.ts @@ -1,5 +1,5 @@ -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; -import { logger } from 'utils/logger'; +import { DatilContext } from '../../../../../../types'; +import { logger } from '@lit-protocol/logger'; import { AuthMethod, getPermittedAuthMethods, @@ -8,7 +8,7 @@ import { PkpIdentifierRaw, resolvePkpTokenId, } from '../../../rawContractApis/permissions/utils/resolvePkpTokenId'; -import { datilDevNetworkContext } from 'services/lit/LitNetwork/vDatil/datil-dev/networkContext'; +import { datilDevNetworkContext } from '../../../../../../datil-dev/networkContext'; /** * Get permitted authentication methods for a PKP token using various identifier types @@ -29,17 +29,17 @@ export async function getPermittedAuthMethodsByIdentifier( ); } -// Example usage when running as main -if (import.meta.main) { - const networkCtx = datilDevNetworkContext; +// // Example usage when running as main +// if (import.meta.main) { +// const networkCtx = datilDevNetworkContext; - const res = await getPermittedAuthMethodsByIdentifier( - { - // tokenId: "76136736151863037541847315168980811654782785653773679312890341037699996601290", - // pubkey: "0x000", - address: '0xef3eE1bD838aF5B36482FAe8a6Fc394C68d5Fa9F', - }, - networkCtx - ); - console.log('permittedAuthMethods', res); -} +// const res = await getPermittedAuthMethodsByIdentifier( +// { +// // tokenId: "76136736151863037541847315168980811654782785653773679312890341037699996601290", +// // pubkey: "0x000", +// address: '0xef3eE1bD838aF5B36482FAe8a6Fc394C68d5Fa9F', +// }, +// networkCtx +// ); +// console.log('permittedAuthMethods', res); +// } diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/isPermittedActionByIdentifier.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/isPermittedActionByIdentifier.ts index d7d01e27d0..4cab86e0e7 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/isPermittedActionByIdentifier.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/isPermittedActionByIdentifier.ts @@ -1,7 +1,7 @@ // import { datilDevNetworkContext } from "services/lit/LitNetwork/vDatil/datil-dev/networkContext"; -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; -import { isIpfsCidV0 } from 'services/lit/utils/z-validate'; -import { logger } from 'utils/logger'; +import { DatilContext } from '../../../../../../types'; +import { isIpfsCidV0 } from '../../../../../../../shared/utils/z-validate'; +import { logger } from '@lit-protocol/logger'; import { z } from 'zod'; import { isPermittedAction } from '../../../rawContractApis/permissions/read/isPermittedAction'; import { diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/isPermittedAddressByIdentifier.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/isPermittedAddressByIdentifier.ts index 6111ae22c1..5abd2889b1 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/isPermittedAddressByIdentifier.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/isPermittedAddressByIdentifier.ts @@ -1,6 +1,6 @@ // import { datilDevNetworkContext } from "services/lit/LitNetwork/vDatil/datil-dev/networkContext"; -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; -import { logger } from 'utils/logger'; +import { DatilContext } from '../../../../../../types'; +import { logger } from '@lit-protocol/logger'; import { z } from 'zod'; import { isPermittedAddress } from '../../../rawContractApis/permissions/read/isPermittedAddress'; import { diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedActionByIdentifier.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedActionByIdentifier.ts index cb122b08a0..6b7a2d930f 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedActionByIdentifier.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedActionByIdentifier.ts @@ -1,6 +1,6 @@ // import { datilDevNetworkContext } from "services/lit/LitNetwork/vDatil/datil-dev/networkContext"; -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; -import { isIpfsCidV0 } from 'services/lit/utils/z-validate'; +import { DatilContext } from '../../../../../../types'; +import { isIpfsCidV0 } from '../../../../../../../shared/utils/z-validate'; import { z } from 'zod'; import { PkpIdentifierRaw, diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedAddressByIdentifier.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedAddressByIdentifier.ts index b5e4c06fe9..8ba03ed390 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedAddressByIdentifier.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedAddressByIdentifier.ts @@ -1,5 +1,5 @@ // import { datilDevNetworkContext } from "services/lit/LitNetwork/vDatil/datil-dev/networkContext"; -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; +import { DatilContext } from '../../../../../../types'; import { PkpIdentifierRaw, resolvePkpTokenId, diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/connection/getConnectionInfo.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/connection/getConnectionInfo.ts index 94310d5874..4344a1ac1c 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/connection/getConnectionInfo.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/connection/getConnectionInfo.ts @@ -1,7 +1,6 @@ -import { getActiveUnkickedValidatorStructsAndCounts } from 'services/lit/LitNetwork/vDatil/common/LitChainClient/apis/rawContractApis/staking/getActiveUnkickedValidatorStructsAndCounts'; -import { GetActiveUnkickedValidatorStructsAndCountsTransformed } from 'services/lit/LitNetwork/vDatil/common/LitChainClient/schemas/GetActiveUnkickedValidatorStructsAndCountsSchema'; -import { datilDevNetworkContext } from 'services/lit/LitNetwork/vDatil/datil-dev/networkContext'; -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; +import { DatilContext } from '../../../../../types'; +import { GetActiveUnkickedValidatorStructsAndCountsTransformed } from '../../../schemas/GetActiveUnkickedValidatorStructsAndCountsSchema'; +import { getActiveUnkickedValidatorStructsAndCounts } from '../../rawContractApis/staking/getActiveUnkickedValidatorStructsAndCounts'; /** * Interface representing the structure of connection information @@ -88,12 +87,12 @@ export async function getConnectionInfo({ * * Usage: bun run src/services/lit/LitNetwork/vDatil/common/LitChainClient/apis/highLevelApis/connection/getConnectionInfo.ts */ -if (import.meta.main) { - // Use the development network context for testing - const results = await getConnectionInfo({ - networkCtx: datilDevNetworkContext, - }); +// if (import.meta.main) { +// // Use the development network context for testing +// const results = await getConnectionInfo({ +// networkCtx: datilDevNetworkContext, +// }); - console.log('Connection Info Results:'); - console.log(JSON.stringify(results, null, 2)); -} +// console.log('Connection Info Results:'); +// console.log(JSON.stringify(results, null, 2)); +// } diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/mintPKP/mintPKP.spec.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/mintPKP/mintPKP.spec.ts index 888f332b20..31c4e842f3 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/mintPKP/mintPKP.spec.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/mintPKP/mintPKP.spec.ts @@ -68,10 +68,10 @@ describe('mintPKP', () => { (log) => log.eventName === 'PermittedAuthMethodAdded' ); - expect(permittedAuthMethodScopeAddedEvent?.args.id).toBe( + expect(permittedAuthMethodScopeAddedEvent?.args['id']).toBe( '0x4cb822e6f51d9723f22b9374c4ef7d41ae2b1a5463738516aeb117ff387ba51a' ); - expect(permittedAuthMethodAddedEvent?.args.id).toBe( + expect(permittedAuthMethodAddedEvent?.args['id']).toBe( '0x4cb822e6f51d9723f22b9374c4ef7d41ae2b1a5463738516aeb117ff387ba51a' ); }); diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/mintPKP/mintPKP.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/mintPKP/mintPKP.ts index 2fdbcf962a..fc94f84fae 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/mintPKP/mintPKP.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/highLevelApis/mintPKP/mintPKP.ts @@ -1,6 +1,6 @@ import { Hex } from 'viem'; -import { logger } from '../../../../../../../../../utils/logger'; -import { getAuthIdByAuthMethod } from '../../../../../../../LitAuthManager/authUtils'; +import { logger } from '@lit-protocol/logger'; +import { getAuthIdByAuthMethod } from '@lit-protocol/auth'; import { DatilContext } from '../../../../../types'; import { PKPData } from '../../../schemas/shared/PKPDataSchema'; import { mintNextAndAddAuthMethods } from '../../rawContractApis/pkp/write/mintNextAndAddAuthMethods'; diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/index.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/index.ts index 4a6de6567b..c17c7f13e2 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/index.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/index.ts @@ -16,6 +16,11 @@ import { createLitContracts } from './utils/createLitContracts'; import { mintPKP } from './highLevelApis/mintPKP/mintPKP'; import { PKPPermissionsManager } from './highLevelApis/PKPPermissionsManager'; +// Define type for utils to avoid TypeScript serialization error +type UtilsType = { + createLitContracts: typeof createLitContracts; +}; + // ==================== Exports ==================== // ========== Treeshakable ========== // Individual exports allow better tree-shaking @@ -71,6 +76,6 @@ export const api = { PKPPermissionsManager, }; -export const utils = { +export const utils: UtilsType = { createLitContracts, }; diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/read/getPermittedActions.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/read/getPermittedActions.ts index ed11ffea20..2a9ed87295 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/read/getPermittedActions.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/read/getPermittedActions.ts @@ -1,7 +1,7 @@ // import { datilDevNetworkContext } from "services/lit/LitNetwork/vDatil/datil-dev/networkContext"; -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; -import { toBigInt } from 'services/lit/utils/z-transformers'; -import { logger } from 'utils/logger'; +import { DatilContext } from '../../../../../../types'; +import { toBigInt } from '../../../../../../../shared/utils/z-transformers'; +import { logger } from '@lit-protocol/logger'; import { z } from 'zod'; import { createLitContracts } from '../../../utils/createLitContracts'; @@ -10,6 +10,9 @@ const getPermittedActionsSchema = z.object({ }); type GetPermittedActionsRequest = z.input; +type ValidatedGetPermittedActionsRequest = z.output< + typeof getPermittedActionsSchema +>; /** * Get permitted actions for a PKP token @@ -21,7 +24,8 @@ export async function getPermittedActions( request: GetPermittedActionsRequest, networkCtx: DatilContext ): Promise { - const validatedRequest = getPermittedActionsSchema.parse(request); + const validatedRequest: ValidatedGetPermittedActionsRequest = + getPermittedActionsSchema.parse(request); logger.debug({ validatedRequest }); const { pkpPermissionsContract } = createLitContracts(networkCtx); diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAddresses.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAddresses.ts index 992e9fdd32..8067c4c014 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAddresses.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAddresses.ts @@ -1,7 +1,7 @@ // import { datilDevNetworkContext } from "services/lit/LitNetwork/vDatil/datil-dev/networkContext"; -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; -import { toBigInt } from 'services/lit/utils/z-transformers'; -import { logger } from 'utils/logger'; +import { DatilContext } from '../../../../../../types'; +import { toBigInt } from '../../../../../../../shared/utils/z-transformers'; +import { logger } from '@lit-protocol/logger'; import { z } from 'zod'; import { createLitContracts } from '../../../utils/createLitContracts'; @@ -10,6 +10,9 @@ const getPermittedAddressesSchema = z.object({ }); type GetPermittedAddressesRequest = z.input; +type ValidatedGetPermittedAddressesRequest = z.output< + typeof getPermittedAddressesSchema +>; /** * Get permitted addresses for a PKP token @@ -21,7 +24,8 @@ export async function getPermittedAddresses( request: GetPermittedAddressesRequest, networkCtx: DatilContext ): Promise { - const validatedRequest = getPermittedAddressesSchema.parse(request); + const validatedRequest: ValidatedGetPermittedAddressesRequest = + getPermittedAddressesSchema.parse(request); logger.debug({ validatedRequest }); const { pkpPermissionsContract } = createLitContracts(networkCtx); diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAuthMethodScopes.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAuthMethodScopes.ts index 81d76a2e5e..b14b44fbd1 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAuthMethodScopes.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAuthMethodScopes.ts @@ -1,10 +1,10 @@ // import { datilDevNetworkContext } from "services/lit/LitNetwork/vDatil/datil-dev/networkContext"; -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; -import { toBigInt } from 'services/lit/utils/z-transformers'; -import { logger } from 'utils/logger'; +import { DatilContext } from '../../../../../../types'; +import { toBigInt } from '../../../../../../../shared/utils/z-transformers'; +import { logger } from '@lit-protocol/logger'; import { z } from 'zod'; import { createLitContracts } from '../../../utils/createLitContracts'; -import { datilDevNetworkContext } from 'services/lit/LitNetwork/vDatil/datil-dev/networkContext'; +import { datilDevNetworkContext } from '../../../../../../datil-dev/networkContext'; const getPermittedAuthMethodScopesSchema = z.object({ tokenId: toBigInt, @@ -16,6 +16,9 @@ const getPermittedAuthMethodScopesSchema = z.object({ type GetPermittedAuthMethodScopesRequest = z.input< typeof getPermittedAuthMethodScopesSchema >; +type ValidatedGetPermittedAuthMethodScopesRequest = z.output< + typeof getPermittedAuthMethodScopesSchema +>; /** * Get permitted scopes for a specific authentication method of a PKP token @@ -27,7 +30,8 @@ export async function getPermittedAuthMethodScopes( request: GetPermittedAuthMethodScopesRequest, networkCtx: DatilContext ): Promise { - const validatedRequest = getPermittedAuthMethodScopesSchema.parse(request); + const validatedRequest: ValidatedGetPermittedAuthMethodScopesRequest = + getPermittedAuthMethodScopesSchema.parse(request); logger.debug({ validatedRequest }); const { pkpPermissionsContract } = createLitContracts(networkCtx); @@ -43,19 +47,19 @@ export async function getPermittedAuthMethodScopes( return res; } -// Example usage when running as main -if (import.meta.main) { - const networkCtx = datilDevNetworkContext; +// // Example usage when running as main +// if (import.meta.main) { +// const networkCtx = datilDevNetworkContext; - const res = await getPermittedAuthMethodScopes( - { - tokenId: - '76136736151863037541847315168980811654782785653773679312890341037699996601290', - authMethodType: 1, - authMethodId: '0x1234567890abcdef1234567890abcdef12345678', - // scopeId: 0, - }, - networkCtx - ); - console.log('permittedAuthMethodScopes', res); -} +// const res = await getPermittedAuthMethodScopes( +// { +// tokenId: +// '76136736151863037541847315168980811654782785653773679312890341037699996601290', +// authMethodType: 1, +// authMethodId: '0x1234567890abcdef1234567890abcdef12345678', +// // scopeId: 0, +// }, +// networkCtx +// ); +// console.log('permittedAuthMethodScopes', res); +// } diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAuthMethods.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAuthMethods.ts index 2a4faa5447..5753aac05c 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAuthMethods.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAuthMethods.ts @@ -1,10 +1,10 @@ // import { datilDevNetworkContext } from "services/lit/LitNetwork/vDatil/datil-dev/networkContext"; -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; -import { toBigInt } from 'services/lit/utils/z-transformers'; -import { logger } from 'utils/logger'; +import { DatilContext } from '../../../../../../types'; +import { toBigInt } from '../../../../../../../shared/utils/z-transformers'; +import { logger } from '@lit-protocol/logger'; import { z } from 'zod'; import { createLitContracts } from '../../../utils/createLitContracts'; -import { datilDevNetworkContext } from 'services/lit/LitNetwork/vDatil/datil-dev/networkContext'; +import { datilDevNetworkContext } from '../../../../../../datil-dev/networkContext'; const getPermittedAuthMethodsSchema = z.object({ tokenId: toBigInt, @@ -13,6 +13,9 @@ const getPermittedAuthMethodsSchema = z.object({ type GetPermittedAuthMethodsRequest = z.input< typeof getPermittedAuthMethodsSchema >; +type ValidatedGetPermittedAuthMethodsRequest = z.output< + typeof getPermittedAuthMethodsSchema +>; // Define the auth method return type export interface AuthMethod { @@ -31,7 +34,8 @@ export async function getPermittedAuthMethods( request: GetPermittedAuthMethodsRequest, networkCtx: DatilContext ): Promise { - const validatedRequest = getPermittedAuthMethodsSchema.parse(request); + const validatedRequest: ValidatedGetPermittedAuthMethodsRequest = + getPermittedAuthMethodsSchema.parse(request); logger.debug({ validatedRequest }); const { pkpPermissionsContract } = createLitContracts(networkCtx); @@ -42,16 +46,16 @@ export async function getPermittedAuthMethods( return res; } -// Example usage when running as main -if (import.meta.main) { - const networkCtx = datilDevNetworkContext; - - const res = await getPermittedAuthMethods( - { - tokenId: - '76136736151863037541847315168980811654782785653773679312890341037699996601290', - }, - networkCtx - ); - console.log('permittedAuthMethods', res); -} +// // Example usage when running as main +// if (import.meta.main) { +// const networkCtx = datilDevNetworkContext; + +// const res = await getPermittedAuthMethods( +// { +// tokenId: +// '76136736151863037541847315168980811654782785653773679312890341037699996601290', +// }, +// networkCtx +// ); +// console.log('permittedAuthMethods', res); +// } diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/read/isPermittedAction.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/read/isPermittedAction.ts index 109a3b3b1f..86617dad2d 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/read/isPermittedAction.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/read/isPermittedAction.ts @@ -1,9 +1,9 @@ // import { datilDevNetworkContext } from "services/lit/LitNetwork/vDatil/datil-dev/networkContext"; -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; -import { ipfsCidV0ToHex } from 'services/lit/utils/transformers/ipfsCidV0ToHex'; -import { toBigInt } from 'services/lit/utils/z-transformers'; -import { isIpfsCidV0 } from 'services/lit/utils/z-validate'; -import { logger } from 'utils/logger'; +import { DatilContext } from '../../../../../../types'; +import { ipfsCidV0ToHex } from '../../../../../../../shared/utils/transformers/ipfsCidV0ToHex'; +import { toBigInt } from '../../../../../../../shared/utils/z-transformers'; +import { isIpfsCidV0 } from '../../../../../../../shared/utils/z-validate'; +import { logger } from '@lit-protocol/logger'; import { z } from 'zod'; import { createLitContracts } from '../../../utils/createLitContracts'; @@ -20,6 +20,9 @@ const isPermittedActionSchema = z }); type IsPermittedActionRequest = z.input; +type ValidatedIsPermittedActionRequest = z.output< + typeof isPermittedActionSchema +>; /** * Checks if an action is permitted for a PKP token @@ -31,7 +34,8 @@ export async function isPermittedAction( request: IsPermittedActionRequest, networkCtx: DatilContext ): Promise { - const validatedRequest = isPermittedActionSchema.parse(request); + const validatedRequest: ValidatedIsPermittedActionRequest = + isPermittedActionSchema.parse(request); logger.debug({ validatedRequest }); const { pkpPermissionsContract } = createLitContracts(networkCtx); diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/read/isPermittedAddress.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/read/isPermittedAddress.ts index d67c4ee830..8839ae3b09 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/read/isPermittedAddress.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/read/isPermittedAddress.ts @@ -1,7 +1,7 @@ // import { datilDevNetworkContext } from "services/lit/LitNetwork/vDatil/datil-dev/networkContext"; -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; -import { toBigInt } from 'services/lit/utils/z-transformers'; -import { logger } from 'utils/logger'; +import { DatilContext } from '../../../../../../types'; +import { toBigInt } from '../../../../../../../shared/utils/z-transformers'; +import { logger } from '@lit-protocol/logger'; import { z } from 'zod'; import { createLitContracts } from '../../../utils/createLitContracts'; @@ -14,6 +14,9 @@ const isPermittedAddressSchema = z.object({ }); type IsPermittedAddressRequest = z.input; +type ValidatedIsPermittedAddressRequest = z.output< + typeof isPermittedAddressSchema +>; /** * Checks if an address is permitted for a PKP token @@ -25,7 +28,8 @@ export async function isPermittedAddress( request: IsPermittedAddressRequest, networkCtx: DatilContext ): Promise { - const validatedRequest = isPermittedAddressSchema.parse(request); + const validatedRequest: ValidatedIsPermittedAddressRequest = + isPermittedAddressSchema.parse(request); logger.debug({ validatedRequest }); const { pkpPermissionsContract } = createLitContracts(networkCtx); diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/utils/resolvePkpTokenId.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/utils/resolvePkpTokenId.ts index c70241cac9..f6a6f23bbe 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/utils/resolvePkpTokenId.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/utils/resolvePkpTokenId.ts @@ -3,10 +3,10 @@ * This module provides a consistent way to obtain PKP token IDs regardless of the input format. */ -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; -import { toBigInt } from 'services/lit/utils/z-transformers'; -import { isEthAddress } from 'services/lit/utils/z-validate'; -import { logger } from 'utils/logger'; +import { DatilContext } from '../../../../../../types'; +import { toBigInt } from '../../../../../../../shared/utils/z-transformers'; +import { isEthAddress } from '../../../../../../../shared/utils/z-validate'; +import { logger } from '@lit-protocol/logger'; import { z } from 'zod'; import { createLitContracts } from '../../../utils/createLitContracts'; import { pubkeyToTokenId } from './pubkeyToTokenId'; diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAction.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAction.ts index 1e9d176f27..2bc6b59fdf 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAction.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAction.ts @@ -1,9 +1,9 @@ // import { datilDevNetworkContext } from "services/lit/LitNetwork/vDatil/datil-dev/networkContext"; -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; -import { ipfsCidV0ToHex } from 'services/lit/utils/transformers/ipfsCidV0ToHex'; -import { toBigInt } from 'services/lit/utils/z-transformers'; -import { isIpfsCidV0 } from 'services/lit/utils/z-validate'; -import { logger } from 'utils/logger'; +import { DatilContext } from '../../../../../../types'; +import { ipfsCidV0ToHex } from '../../../../../../../shared/utils/transformers/ipfsCidV0ToHex'; +import { toBigInt } from '../../../../../../../shared/utils/z-transformers'; +import { isIpfsCidV0 } from '../../../../../../../shared/utils/z-validate'; +import { logger } from '@lit-protocol/logger'; import { z } from 'zod'; import { ScopeSchemaRaw } from '../../../../schemas/shared/ScopeSchema'; import { LitTxVoid } from '../../../types'; @@ -25,12 +25,16 @@ const addPermittedActionSchema = z }); type AddPermittedActionRequest = z.input; +type ValidatedAddPermittedActionRequest = z.output< + typeof addPermittedActionSchema +>; export async function addPermittedAction( request: AddPermittedActionRequest, networkCtx: DatilContext ): Promise { - const validatedRequest = addPermittedActionSchema.parse(request); + const validatedRequest: ValidatedAddPermittedActionRequest = + addPermittedActionSchema.parse(request); logger.debug({ validatedRequest }); const { pkpPermissionsContract, pkpNftContract, publicClient, walletClient } = diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAddress.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAddress.ts index eee860afb0..52d0e1985e 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAddress.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAddress.ts @@ -1,7 +1,7 @@ // import { datilDevNetworkContext } from "services/lit/LitNetwork/vDatil/datil-dev/networkContext"; -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; -import { toBigInt } from 'services/lit/utils/z-transformers'; -import { logger } from 'utils/logger'; +import { DatilContext } from '../../../../../../types'; +import { toBigInt } from '../../../../../../../shared/utils/z-transformers'; +import { logger } from '@lit-protocol/logger'; import { z } from 'zod'; import { ScopeSchemaRaw } from '../../../../schemas/shared/ScopeSchema'; import { LitTxVoid } from '../../../types'; @@ -19,6 +19,9 @@ const addPermittedAddressSchema = z.object({ }); type AddPermittedAddressRequest = z.input; +type ValidatedAddPermittedAddressRequest = z.output< + typeof addPermittedAddressSchema +>; /** * Adds a permitted address to a PKP token @@ -30,7 +33,8 @@ export async function addPermittedAddress( request: AddPermittedAddressRequest, networkCtx: DatilContext ): Promise { - const validatedRequest = addPermittedAddressSchema.parse(request); + const validatedRequest: ValidatedAddPermittedAddressRequest = + addPermittedAddressSchema.parse(request); logger.debug({ validatedRequest }); const { pkpPermissionsContract, pkpNftContract, publicClient, walletClient } = diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAction.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAction.ts index 5649f8f16f..e93cdf6ebc 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAction.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAction.ts @@ -1,9 +1,9 @@ // import { datilDevNetworkContext } from "services/lit/LitNetwork/vDatil/datil-dev/networkContext"; -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; -import { ipfsCidV0ToHex } from 'services/lit/utils/transformers/ipfsCidV0ToHex'; -import { toBigInt } from 'services/lit/utils/z-transformers'; -import { isIpfsCidV0 } from 'services/lit/utils/z-validate'; -import { logger } from 'utils/logger'; +import { DatilContext } from '../../../../../../types'; +import { ipfsCidV0ToHex } from '../../../../../../../shared/utils/transformers/ipfsCidV0ToHex'; +import { toBigInt } from '../../../../../../../shared/utils/z-transformers'; +import { isIpfsCidV0 } from '../../../../../../../shared/utils/z-validate'; +import { logger } from '@lit-protocol/logger'; import { z } from 'zod'; import { LitTxVoid } from '../../../types'; import { callWithAdjustedOverrides } from '../../../utils/callWithAdjustedOverrides'; @@ -23,6 +23,9 @@ const removePermittedActionSchema = z }); type RemovePermittedActionRequest = z.input; +type ValidatedRemovePermittedActionRequest = z.output< + typeof removePermittedActionSchema +>; /** * Removes a permitted action from a PKP token @@ -34,7 +37,8 @@ export async function removePermittedAction( request: RemovePermittedActionRequest, networkCtx: DatilContext ): Promise { - const validatedRequest = removePermittedActionSchema.parse(request); + const validatedRequest: ValidatedRemovePermittedActionRequest = + removePermittedActionSchema.parse(request); logger.debug({ validatedRequest }); const { pkpPermissionsContract, pkpNftContract, publicClient, walletClient } = diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAddress.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAddress.ts index 547a04c9aa..3c789d8c52 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAddress.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAddress.ts @@ -1,7 +1,7 @@ // import { datilDevNetworkContext } from "services/lit/LitNetwork/vDatil/datil-dev/networkContext"; -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; -import { toBigInt } from 'services/lit/utils/z-transformers'; -import { logger } from 'utils/logger'; +import { DatilContext } from '../../../../../../types'; +import { toBigInt } from '../../../../../../../shared/utils/z-transformers'; +import { logger } from '@lit-protocol/logger'; import { z } from 'zod'; import { LitTxVoid } from '../../../types'; import { callWithAdjustedOverrides } from '../../../utils/callWithAdjustedOverrides'; @@ -19,6 +19,9 @@ const removePermittedAddressSchema = z.object({ type RemovePermittedAddressRequest = z.input< typeof removePermittedAddressSchema >; +type ValidatedRemovePermittedAddressRequest = z.output< + typeof removePermittedAddressSchema +>; /** * Removes a permitted address from a PKP token @@ -30,7 +33,8 @@ export async function removePermittedAddress( request: RemovePermittedAddressRequest, networkCtx: DatilContext ): Promise { - const validatedRequest = removePermittedAddressSchema.parse(request); + const validatedRequest: ValidatedRemovePermittedAddressRequest = + removePermittedAddressSchema.parse(request); logger.debug({ validatedRequest }); const { pkpPermissionsContract, pkpNftContract, publicClient, walletClient } = diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/pkp/read/getPubkeyByTokenId.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/pkp/read/getPubkeyByTokenId.ts index a0fe4945e6..b6b77801e6 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/pkp/read/getPubkeyByTokenId.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/pkp/read/getPubkeyByTokenId.ts @@ -1,5 +1,5 @@ -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; -import { logger } from 'utils/logger'; +import { DatilContext } from '../../../../../../types'; +import { logger } from '@lit-protocol/logger'; import { z } from 'zod'; import { createLitContracts } from '../../../utils/createLitContracts'; diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/pkp/read/tokenOfOwnerByIndex.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/pkp/read/tokenOfOwnerByIndex.ts index 796ea6beda..37a6dee042 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/pkp/read/tokenOfOwnerByIndex.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/pkp/read/tokenOfOwnerByIndex.ts @@ -1,6 +1,6 @@ // import { datilDevNetworkContext } from "services/lit/LitNetwork/vDatil/datil-dev/networkContext"; -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; -import { logger } from 'utils/logger'; +import { DatilContext } from '../../../../../../types'; +import { logger } from '@lit-protocol/logger'; import { z } from 'zod'; import { createLitContracts } from '../../../utils/createLitContracts'; diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/pkp/write/claimAndMint.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/pkp/write/claimAndMint.ts index 89fc796274..f760511183 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/pkp/write/claimAndMint.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/pkp/write/claimAndMint.ts @@ -1,4 +1,4 @@ -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; +import { DatilContext } from '../../../../../../../VDatil/types'; import { ClaimAndMintRaw, ClaimAndMintSchema, @@ -32,6 +32,8 @@ export async function claimAndMint( 'claimAndMint', [ECDSA_SECP256K1, derivedKeyId, signatures, stakingContract.address], { + account: walletClient.account!, + chain: walletClient.chain!, value: mintCost, } ); diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/pkp/write/claimAndMintNextAndAddAuthMethodsWithTypes.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/pkp/write/claimAndMintNextAndAddAuthMethodsWithTypes.ts index 2a68e960d4..b20a8e69cf 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/pkp/write/claimAndMintNextAndAddAuthMethodsWithTypes.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/pkp/write/claimAndMintNextAndAddAuthMethodsWithTypes.ts @@ -1,4 +1,4 @@ -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; +import { DatilContext } from '../../../../../../../VDatil/types'; import { ClaimRequestRaw, ClaimRequestSchema, @@ -29,7 +29,7 @@ export async function claimAndMintNextAndAddAuthMethodsWithTypes( networkCtx: DatilContext ): Promise> { const validatedRequest = ClaimRequestSchema.parse(request); - const { pkpHelperContract, pkpNftContract, publicClient } = + const { pkpHelperContract, pkpNftContract, publicClient, walletClient } = createLitContracts(networkCtx); // Get mint cost @@ -66,6 +66,8 @@ export async function claimAndMintNextAndAddAuthMethodsWithTypes( 'claimAndMintNextAndAddAuthMethodsWithTypes', [claimMaterial, authMethodData], { + account: walletClient.account!, + chain: walletClient.chain!, value: mintCost, } ); diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/pkp/write/mintNextAndAddAuthMethods.spec.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/pkp/write/mintNextAndAddAuthMethods.spec.ts index cfea96ce4b..20624fad20 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/pkp/write/mintNextAndAddAuthMethods.spec.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/pkp/write/mintNextAndAddAuthMethods.spec.ts @@ -33,7 +33,7 @@ describe('LitChainClient', () => { expect(tx.hash).toBeDefined(); expect(tx.decodedLogs.length).toBeGreaterThan(0); expect(tx.data.tokenId).toBeDefined(); - expect(tx.data.pubkey).toStartWith('0x'); - expect(tx.data.ethAddress).toStartWith('0x'); + expect(tx.data.pubkey).toMatch(/^0x/); + expect(tx.data.ethAddress).toMatch(/^0x/); }); }); diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/pkp/write/mintNextAndAddAuthMethods.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/pkp/write/mintNextAndAddAuthMethods.ts index 04d4b87c9f..528fe594be 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/pkp/write/mintNextAndAddAuthMethods.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/rawContractApis/pkp/write/mintNextAndAddAuthMethods.ts @@ -1,4 +1,4 @@ -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; +import { DatilContext } from '../../../../../../types'; import { MintRequestRaw, MintRequestSchema, @@ -50,6 +50,8 @@ export async function mintNextAndAddAuthMethods( validatedRequest.sendPkpToItself, ], { + account: walletClient.account!, + chain: walletClient.chain!, value: mintCost, } ); diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/utils/createLitContracts.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/utils/createLitContracts.ts index dacc76fdec..5a81b9e338 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/utils/createLitContracts.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/utils/createLitContracts.ts @@ -1,5 +1,5 @@ import { chronicleYellowstone } from '../../../../../shared/chains/yellowstone.ts'; -import { DatilContext } from '../../../../../vDatil/types'; +import { DatilContext } from '../../../../../VDatil/types'; import { createPublicClient, createWalletClient, @@ -7,6 +7,7 @@ import { http, PublicClient, WalletClient, + Hex, } from 'viem'; import { privateKeyToAccount } from 'viem/accounts'; @@ -14,6 +15,91 @@ interface CreateLitContractsOptions { publicClient?: PublicClient; } +// ============================================================================================================================================= +// ❗️ These types are required to fix the following error +// ERROR: The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed.ts(7056) +// If you could fix this WITHOUT breaking this code apart, or without setting the tsconfig's "declaration" to false, please do fix this. 🙏 +// ============================================================================================================================================= + +// Import the network context to get the contract data type +import { datilDevNetworkContext } from '../../../../../VDatil/datil-dev/networkContext'; + +// Extract just the ContractData type, and you can use this type for variables that will eventually hold contract data +let futureContractData = datilDevNetworkContext.chainConfig.contractData; + +const pkpNftContractType = getContract({ + address: undefined as unknown as Hex, + abi: [ + futureContractData.PKPNFT.methods.claimAndMint, + futureContractData.PKPNFT.methods.mintCost, + futureContractData.PKPNFT.methods.tokenOfOwnerByIndex, + ], + client: { + public: undefined as unknown as PublicClient, + wallet: undefined as unknown as WalletClient, + }, +}); + +const pkpHelperContractType = getContract({ + address: undefined as unknown as Hex, + abi: [ + futureContractData.PKPHelper.methods + .claimAndMintNextAndAddAuthMethodsWithTypes, + futureContractData.PKPHelper.methods.mintNextAndAddAuthMethods, + ], + client: { + public: undefined as unknown as PublicClient, + wallet: undefined as unknown as WalletClient, + }, +}); + +const stakingContractType = getContract({ + address: undefined as unknown as Hex, + abi: [ + futureContractData.Staking.methods + .getActiveUnkickedValidatorStructsAndCounts, + ], + client: { + public: undefined as unknown as PublicClient, + wallet: undefined as unknown as WalletClient, + }, +}); + +const pkpPermissionsContractType = getContract({ + address: undefined as unknown as Hex, + abi: [ + futureContractData.PKPPermissions.methods.addPermittedAction, + futureContractData.PKPPermissions.methods.addPermittedAddress, + futureContractData.PKPPermissions.methods.getPermittedActions, + futureContractData.PKPPermissions.methods.getPermittedAddresses, + futureContractData.PKPPermissions.methods.getPermittedAuthMethods, + futureContractData.PKPPermissions.methods.getPermittedAuthMethodScopes, + futureContractData.PKPPermissions.methods.removePermittedAction, + futureContractData.PKPPermissions.methods.removePermittedAddress, + futureContractData.PKPPermissions.methods.isPermittedAction, + futureContractData.PKPPermissions.methods.isPermittedAddress, + ], + client: { + public: undefined as unknown as PublicClient, + wallet: undefined as unknown as WalletClient, + }, +}); + +const pubkeyRouterContractType = getContract({ + address: undefined as unknown as Hex, + abi: [ + futureContractData.PubkeyRouter.methods.deriveEthAddressFromPubkey, + futureContractData.PubkeyRouter.methods.ethAddressToPkpId, + futureContractData.PubkeyRouter.methods.getEthAddress, + futureContractData.PubkeyRouter.methods.getPubkey, + ], + client: { + public: undefined as unknown as PublicClient, + wallet: undefined as unknown as WalletClient, + }, +}); +// Hacky fix ends + export const createLitContracts = ( networkCtx: DatilContext, opts?: CreateLitContractsOptions @@ -113,12 +199,15 @@ export const createLitContracts = ( // ---------- End of all your contracts ---------- return { - pkpNftContract, - pkpHelperContract, - stakingContract, - pkpPermissionsContract, + pkpNftContract: pkpNftContract as unknown as typeof pkpNftContractType, + pkpHelperContract: + pkpHelperContract as unknown as typeof pkpHelperContractType, + stakingContract: stakingContract as unknown as typeof stakingContractType, + pkpPermissionsContract: + pkpPermissionsContract as unknown as typeof pkpPermissionsContractType, publicClient, walletClient, - pubkeyRouterContract, + pubkeyRouterContract: + pubkeyRouterContract as unknown as typeof pubkeyRouterContractType, }; }; diff --git a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/utils/decodeLogs.ts b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/utils/decodeLogs.ts index 38dd17a6d4..e4e4ea9920 100644 --- a/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/utils/decodeLogs.ts +++ b/packages/networks/src/lib/networks/VDatil/common/LitChainClient/apis/utils/decodeLogs.ts @@ -1,6 +1,5 @@ -import { DatilContext } from 'services/lit/LitNetwork/vDatil/types'; +import { DatilContext } from '../../../../../VDatil/types'; import { decodeEventLog, Log } from 'viem'; -import { LIT_CONTRACT_NAME } from '../../_config'; import { createLitContracts } from './createLitContracts'; export type DecodedLog = { diff --git a/packages/networks/src/lib/networks/shared/logger.ts b/packages/networks/src/lib/networks/shared/logger.ts index 93a8eb8160..4e0d8715da 100644 --- a/packages/networks/src/lib/networks/shared/logger.ts +++ b/packages/networks/src/lib/networks/shared/logger.ts @@ -9,4 +9,4 @@ const baseLogger = pino({ }, }); -export const logger = pinoCaller(baseLogger); +export const logger = pinoCaller(baseLogger as any);