@pufferfinance/puffer-sdk 1.20.2 → 1.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"addresses.js","sources":["../../lib/contracts/addresses.ts"],"sourcesContent":["import { Chain } from '../chains/constants';\n\n// Source of truth:\n// https://github.com/PufferFinance/Deployments-and-ACL/tree/main/docs/deployments\nexport const CONTRACT_ADDRESSES = {\n // Casting to number so the consumer can use chain ids. Also not using\n // a generic type for the variable so the consumer knows which\n // contracts can be accessed.\n [Chain.Mainnet as number]: {\n PufferVault: '0xD9A442856C234a39a81a089C06451EBAa4306a72',\n PufferDepositor: '0x4aa799c5dfc01ee7d790e3bf1a7c2257ce1dceff',\n PufferL2Depositor: '0x3436E0B85cd929929F5802e792CFE282166E0259',\n PufLocker: '0x48e8dE138C246c14248C94d2D616a2F9eb4590D2',\n L1RewardManager: '0x157788cc028Ac6405bD406f2D1e0A8A22b3cf17b',\n // L2RewardManager is not deployed to mainnet but base.\n L2RewardManager: '0x0000000000000000000000000000000000000000',\n PufferWithdrawalManager: '0xDdA0483184E75a5579ef9635ED14BacCf9d50283',\n NucleusAtomicQueue: '0x228c44bb4885c6633f4b6c83f14622f37d5112e5',\n CarrotStaker: '0x99c599227c65132822f0290d9e5b4b0430d6c0d6',\n Distributor: '0x3Ef3D8bA38EBe18DB133cEc108f4D14CE00Dd9Ae',\n ValidatorTicket: '0x7D26AD6F6BA9D6bA1de0218Ae5e20CD3a273a55A',\n PufferOracleV2: '0x0BE2aE0edbeBb517541DF217EF0074FC9a9e994f',\n PufferProtocol: '0xf7b6B32492c2e13799D921E84202450131bd238B',\n },\n [Chain.Holesky as number]: {\n PufferVault: '0x9196830bB4c05504E0A8475A0aD566AceEB6BeC9',\n PufferDepositor: '0x824AC05aeb86A0aD770b8acDe0906d2d4a6c4A8c',\n PufferL2Depositor: '0x0af6998e4828ad8ef8f79a9288d0a861890f791d',\n PufLocker: '0xa58983ad0899a452b7420bc57228e329d7ba92b6',\n L1RewardManager: '0x10f970bcb84B82B82a65eBCbF45F26dD26D69F12',\n L2RewardManager: '0x58C046794f69A8830b0BE737022a45b4acd01dE5',\n PufferWithdrawalManager: '0x5A3E1069B66800c0ecbc91bd81b1AE4D1804DBc4',\n ValidatorTicket: '0xB028194785178a94Fe608994A4d5AD84c285A640',\n PufferOracleV2: '0x8e043ed3f06720615685d4978770cd5c8fe90fe3',\n PufferProtocol: '0xE00c79408B9De5BaD2FDEbB1688997a68eC988CD',\n },\n [Chain.Base as number]: {\n L2RewardManager: '0xF9Dd335bF363b2E4ecFe3c94A86EBD7Dd3Dcf0e7',\n },\n};\n"],"names":["CONTRACT_ADDRESSES","Chain"],"mappings":";AAIO,MAAMA,IAAqB;AAAA;AAAA;AAAA;AAAA,EAIhC,CAACC,EAAM,OAAiB,GAAG;AAAA,IACzB,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,WAAW;AAAA,IACX,iBAAiB;AAAA;AAAA,IAEjB,iBAAiB;AAAA,IACjB,yBAAyB;AAAA,IACzB,oBAAoB;AAAA,IACpB,cAAc;AAAA,IACd,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,EAClB;AAAA,EACA,CAACA,EAAM,OAAiB,GAAG;AAAA,IACzB,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,WAAW;AAAA,IACX,iBAAiB;AAAA,IACjB,iBAAiB;AAAA,IACjB,yBAAyB;AAAA,IACzB,iBAAiB;AAAA,IACjB,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,EAClB;AAAA,EACA,CAACA,EAAM,IAAc,GAAG;AAAA,IACtB,iBAAiB;AAAA,EAAA;AAErB;"}
1
+ {"version":3,"file":"addresses.js","sources":["../../lib/contracts/addresses.ts"],"sourcesContent":["import { Chain } from '../chains/constants';\n\n// Source of truth:\n// https://github.com/PufferFinance/Deployments-and-ACL/tree/main/docs/deployments\nexport const CONTRACT_ADDRESSES = {\n // Casting to number so the consumer can use chain ids. Also not using\n // a generic type for the variable so the consumer knows which\n // contracts can be accessed.\n [Chain.Mainnet as number]: {\n PufferVault: '0xD9A442856C234a39a81a089C06451EBAa4306a72',\n PufferDepositor: '0x4aa799c5dfc01ee7d790e3bf1a7c2257ce1dceff',\n PufferL2Depositor: '0x3436E0B85cd929929F5802e792CFE282166E0259',\n PufLocker: '0x48e8dE138C246c14248C94d2D616a2F9eb4590D2',\n L1RewardManager: '0x157788cc028Ac6405bD406f2D1e0A8A22b3cf17b',\n // L2RewardManager is not deployed to mainnet but base.\n L2RewardManager: '0x0000000000000000000000000000000000000000',\n PufferWithdrawalManager: '0xDdA0483184E75a5579ef9635ED14BacCf9d50283',\n NucleusAtomicQueue: '0x228c44bb4885c6633f4b6c83f14622f37d5112e5',\n CarrotStaker: '0x99c599227c65132822f0290d9e5b4b0430d6c0d6',\n Distributor: '0x3Ef3D8bA38EBe18DB133cEc108f4D14CE00Dd9Ae',\n ValidatorTicket: '0x7D26AD6F6BA9D6bA1de0218Ae5e20CD3a273a55A',\n PufferOracleV2: '0x0BE2aE0edbeBb517541DF217EF0074FC9a9e994f',\n PufferProtocol: '0xf7b6B32492c2e13799D921E84202450131bd238B',\n GuardianModule: '0x628b183F248a142A598AA2dcCCD6f7E480a7CcF2',\n },\n [Chain.Holesky as number]: {\n PufferVault: '0x9196830bB4c05504E0A8475A0aD566AceEB6BeC9',\n PufferDepositor: '0x824AC05aeb86A0aD770b8acDe0906d2d4a6c4A8c',\n PufferL2Depositor: '0x0af6998e4828ad8ef8f79a9288d0a861890f791d',\n PufLocker: '0xa58983ad0899a452b7420bc57228e329d7ba92b6',\n L1RewardManager: '0x10f970bcb84B82B82a65eBCbF45F26dD26D69F12',\n L2RewardManager: '0x58C046794f69A8830b0BE737022a45b4acd01dE5',\n PufferWithdrawalManager: '0x5A3E1069B66800c0ecbc91bd81b1AE4D1804DBc4',\n ValidatorTicket: '0xB028194785178a94Fe608994A4d5AD84c285A640',\n PufferOracleV2: '0x8e043ed3f06720615685d4978770cd5c8fe90fe3',\n PufferProtocol: '0xE00c79408B9De5BaD2FDEbB1688997a68eC988CD',\n GuardianModule: '0x0910310130d1c062def8b807528bdac80203bc66',\n },\n [Chain.Base as number]: {\n L2RewardManager: '0xF9Dd335bF363b2E4ecFe3c94A86EBD7Dd3Dcf0e7',\n },\n};\n"],"names":["CONTRACT_ADDRESSES","Chain"],"mappings":";AAIO,MAAMA,IAAqB;AAAA;AAAA;AAAA;AAAA,EAIhC,CAACC,EAAM,OAAiB,GAAG;AAAA,IACzB,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,WAAW;AAAA,IACX,iBAAiB;AAAA;AAAA,IAEjB,iBAAiB;AAAA,IACjB,yBAAyB;AAAA,IACzB,oBAAoB;AAAA,IACpB,cAAc;AAAA,IACd,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,EAClB;AAAA,EACA,CAACA,EAAM,OAAiB,GAAG;AAAA,IACzB,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,WAAW;AAAA,IACX,iBAAiB;AAAA,IACjB,iBAAiB;AAAA,IACjB,yBAAyB;AAAA,IACzB,iBAAiB;AAAA,IACjB,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,EAClB;AAAA,EACA,CAACA,EAAM,IAAc,GAAG;AAAA,IACtB,iBAAiB;AAAA,EAAA;AAErB;"}
@@ -0,0 +1,2 @@
1
+ "use strict";var i=Object.defineProperty;var s=(r,e,t)=>e in r?i(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var n=(r,e,t)=>s(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../../constants-BI6T6ZbJ.cjs"),u=require("../addresses.cjs"),c=require("../abis/mainnet/GuardianModule.cjs"),o=require("../../getContract-CPwqa1sR.cjs");class l{constructor(e,t,a){n(this,"viemChain");this.chain=e,this.walletClient=t,this.publicClient=a,this.viemChain=d.VIEM_CHAINS[e]}getContract(){const e=u.CONTRACT_ADDRESSES[this.chain].GuardianModule,t=c.GuardianModule,a={public:this.publicClient,wallet:this.walletClient};return o.getContract({address:e,abi:t,client:a})}getEjectionThreshold(){return this.getContract().read.getEjectionThreshold()}getGuardians(){return this.getContract().read.getGuardians()}getGuardiansEnclaveAddress(e){return this.getContract().read.getGuardiansEnclaveAddress([e])}getGuardiansEnclaveAddresses(){return this.getContract().read.getGuardiansEnclaveAddresses()}getGuardiansEnclavePubkeys(){return this.getContract().read.getGuardiansEnclavePubkeys()}validateGuardiansEnclaveSignatures(e,t){return this.getContract().read.validateGuardiansEnclaveSignatures([e,t])}getMrenclave(){return this.getContract().read.getMrenclave()}getMrsigner(){return this.getContract().read.getMrsigner()}getThreshold(){return this.getContract().read.getThreshold()}isConsumingScheduledOp(){return this.getContract().read.isConsumingScheduledOp()}isGuardian(e){return this.getContract().read.isGuardian([e])}removeGuardian(e,t){return this.getContract().write.removeGuardian([e],{account:t,chain:this.viemChain})}}exports.GuardianModuleHandler=l;
2
+ //# sourceMappingURL=guardian-module-handler.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guardian-module-handler.cjs","sources":["../../../lib/contracts/handlers/guardian-module-handler.ts"],"sourcesContent":["import {\n Address,\n getContract,\n GetContractReturnType,\n Hash,\n PublicClient,\n Chain as ViemChain,\n WalletClient,\n} from 'viem';\nimport { Chain, VIEM_CHAINS } from '../../chains/constants';\nimport { CONTRACT_ADDRESSES } from '../addresses';\nimport { GuardianModule } from '../abis/mainnet/GuardianModule';\n\n/**\n * Handler for the `GuardianModule` contract exposing methods to\n * interact with the contract.\n */\nexport class GuardianModuleHandler {\n private viemChain: ViemChain;\n\n /**\n * Create the handler for the `PufLocker` contract exposing methods to\n * interact with the contract.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = CONTRACT_ADDRESSES[this.chain].GuardianModule as Address;\n const abi = GuardianModule;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the ejection threshold.\n *\n * @returns The ejection threshold.\n */\n public getEjectionThreshold() {\n return this.getContract().read.getEjectionThreshold();\n }\n\n /**\n * Get the guardians.\n *\n * @returns The guardians.\n */\n public getGuardians() {\n return this.getContract().read.getGuardians();\n }\n\n /**\n * Get the enclave address for a guardian.\n *\n * @param guardian The guardian address.\n * @returns The enclave address.\n */\n public getGuardiansEnclaveAddress(guardian: Address) {\n return this.getContract().read.getGuardiansEnclaveAddress([guardian]);\n }\n\n /**\n * Get the enclave addresses for all guardians.\n *\n * @returns The enclave addresses.\n */\n public getGuardiansEnclaveAddresses() {\n return this.getContract().read.getGuardiansEnclaveAddresses();\n }\n\n /**\n * Get the enclave pubkeys for all guardians.\n *\n * @returns The enclave pubkeys.\n */\n public getGuardiansEnclavePubkeys() {\n return this.getContract().read.getGuardiansEnclavePubkeys();\n }\n\n /**\n * Validate the enclave signatures for a signed message.\n *\n * @param enclaveSignatures The enclave signatures.\n * @param signedMessageHash The signed message hash.\n * @returns The validation result.\n */\n public validateGuardiansEnclaveSignatures(\n enclaveSignatures: Address[],\n signedMessageHash: Hash,\n ) {\n return this.getContract().read.validateGuardiansEnclaveSignatures([\n enclaveSignatures,\n signedMessageHash,\n ]);\n }\n\n /**\n * Get the mrenclave.\n *\n * @returns The mrenclave.\n */\n public getMrenclave() {\n return this.getContract().read.getMrenclave();\n }\n\n /**\n * Get the mrsigner.\n *\n * @returns The mrsigner.\n */\n public getMrsigner() {\n return this.getContract().read.getMrsigner();\n }\n\n /**\n * Get the threshold.\n *\n * @returns The threshold.\n */\n public getThreshold() {\n return this.getContract().read.getThreshold();\n }\n\n /**\n * Check if the guardian module is consuming scheduled operations.\n *\n * @returns True if the guardian module is consuming scheduled operations,\n * false otherwise.\n */\n public isConsumingScheduledOp() {\n return this.getContract().read.isConsumingScheduledOp();\n }\n\n /**\n * Check if an account is a guardian.\n *\n * @param account The account address.\n * @returns True if the account is a guardian, false otherwise.\n */\n public isGuardian(account: Address) {\n return this.getContract().read.isGuardian([account]);\n }\n\n /**\n * Remove a guardian.\n *\n * @param guardian The guardian address.\n * @param account The account address to make the transaction with.\n * @returns The transaction receipt.\n */\n public removeGuardian(guardian: Address, account: Address) {\n return this.getContract().write.removeGuardian([guardian], {\n account,\n chain: this.viemChain,\n });\n }\n}\n"],"names":["GuardianModuleHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","CONTRACT_ADDRESSES","abi","GuardianModule","client","getContract","guardian","enclaveSignatures","signedMessageHash","account"],"mappings":"8ZAiBO,MAAMA,CAAsB,CAajC,YACUC,EACAC,EACAC,EACR,CAhBMC,EAAA,kBAaE,KAAA,MAAAH,EACA,KAAA,aAAAC,EACA,KAAA,aAAAC,EAEH,KAAA,UAAYE,cAAYJ,CAAK,CAAA,CAS7B,aAAc,CACnB,MAAMK,EAAUC,EAAA,mBAAmB,KAAK,KAAK,EAAE,eACzCC,EAAMC,EAAA,eACNC,EAAS,CAAE,OAAQ,KAAK,aAAc,OAAQ,KAAK,YAAa,EAEtE,OAAOC,EAAY,YAAA,CAAE,QAAAL,EAAS,IAAAE,EAAK,OAAAE,EAAQ,CAAA,CAYtC,sBAAuB,CAC5B,OAAO,KAAK,cAAc,KAAK,qBAAqB,CAAA,CAQ/C,cAAe,CACpB,OAAO,KAAK,cAAc,KAAK,aAAa,CAAA,CASvC,2BAA2BE,EAAmB,CACnD,OAAO,KAAK,YAAY,EAAE,KAAK,2BAA2B,CAACA,CAAQ,CAAC,CAAA,CAQ/D,8BAA+B,CACpC,OAAO,KAAK,cAAc,KAAK,6BAA6B,CAAA,CAQvD,4BAA6B,CAClC,OAAO,KAAK,cAAc,KAAK,2BAA2B,CAAA,CAUrD,mCACLC,EACAC,EACA,CACA,OAAO,KAAK,cAAc,KAAK,mCAAmC,CAChED,EACAC,CAAA,CACD,CAAA,CAQI,cAAe,CACpB,OAAO,KAAK,cAAc,KAAK,aAAa,CAAA,CAQvC,aAAc,CACnB,OAAO,KAAK,cAAc,KAAK,YAAY,CAAA,CAQtC,cAAe,CACpB,OAAO,KAAK,cAAc,KAAK,aAAa,CAAA,CASvC,wBAAyB,CAC9B,OAAO,KAAK,cAAc,KAAK,uBAAuB,CAAA,CASjD,WAAWC,EAAkB,CAClC,OAAO,KAAK,YAAY,EAAE,KAAK,WAAW,CAACA,CAAO,CAAC,CAAA,CAU9C,eAAeH,EAAmBG,EAAkB,CACzD,OAAO,KAAK,YAAY,EAAE,MAAM,eAAe,CAACH,CAAQ,EAAG,CACzD,QAAAG,EACA,MAAO,KAAK,SAAA,CACb,CAAA,CAEL"}