@pufferfinance/puffer-sdk 1.24.5 → 1.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/api/puffer-client.cjs +1 -1
  2. package/dist/api/puffer-client.cjs.map +1 -1
  3. package/dist/api/puffer-client.d.ts +3 -0
  4. package/dist/api/puffer-client.js +26 -19
  5. package/dist/api/puffer-client.js.map +1 -1
  6. package/dist/contracts/abis/mainnet/ConcreteMultiStrategyVault.cjs +1 -1
  7. package/dist/contracts/abis/mainnet/ConcreteMultiStrategyVault.cjs.map +1 -1
  8. package/dist/contracts/abis/mainnet/ConcreteMultiStrategyVault.d.ts +36 -0
  9. package/dist/contracts/abis/mainnet/ConcreteMultiStrategyVault.js +18 -0
  10. package/dist/contracts/abis/mainnet/ConcreteMultiStrategyVault.js.map +1 -1
  11. package/dist/contracts/abis/mainnet/LagoonVault.cjs +2 -0
  12. package/dist/contracts/abis/mainnet/LagoonVault.cjs.map +1 -0
  13. package/dist/contracts/abis/mainnet/LagoonVault.d.ts +731 -0
  14. package/dist/contracts/abis/mainnet/LagoonVault.js +438 -0
  15. package/dist/contracts/abis/mainnet/LagoonVault.js.map +1 -0
  16. package/dist/contracts/handlers/concrete-vault-handler.cjs +1 -1
  17. package/dist/contracts/handlers/concrete-vault-handler.cjs.map +1 -1
  18. package/dist/contracts/handlers/concrete-vault-handler.d.ts +49 -3
  19. package/dist/contracts/handlers/concrete-vault-handler.js +25 -7
  20. package/dist/contracts/handlers/concrete-vault-handler.js.map +1 -1
  21. package/dist/contracts/handlers/institutional-vault-handler.cjs +1 -1
  22. package/dist/contracts/handlers/institutional-vault-handler.cjs.map +1 -1
  23. package/dist/contracts/handlers/institutional-vault-handler.d.ts +2 -1
  24. package/dist/contracts/handlers/institutional-vault-handler.js +7 -2
  25. package/dist/contracts/handlers/institutional-vault-handler.js.map +1 -1
  26. package/dist/contracts/handlers/lagoon-vault-handler.cjs +2 -0
  27. package/dist/contracts/handlers/lagoon-vault-handler.cjs.map +1 -0
  28. package/dist/contracts/handlers/lagoon-vault-handler.d.ts +15446 -0
  29. package/dist/contracts/handlers/lagoon-vault-handler.js +233 -0
  30. package/dist/contracts/handlers/lagoon-vault-handler.js.map +1 -0
  31. package/dist/contracts/tokens.cjs +1 -1
  32. package/dist/contracts/tokens.cjs.map +1 -1
  33. package/dist/contracts/tokens.d.ts +1 -0
  34. package/dist/contracts/tokens.js +11 -5
  35. package/dist/contracts/tokens.js.map +1 -1
  36. package/dist/contracts/vaults-addresses.cjs +1 -1
  37. package/dist/contracts/vaults-addresses.cjs.map +1 -1
  38. package/dist/contracts/vaults-addresses.d.ts +8 -0
  39. package/dist/contracts/vaults-addresses.js +16 -8
  40. package/dist/contracts/vaults-addresses.js.map +1 -1
  41. package/dist/utils/version.cjs +1 -1
  42. package/dist/utils/version.js +1 -1
  43. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
- var n = Object.defineProperty;
2
- var o = (i, t, e) => t in i ? n(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
- var a = (i, t, e) => o(i, typeof t != "symbol" ? t + "" : t, e);
1
+ var a = Object.defineProperty;
2
+ var o = (i, t, e) => t in i ? a(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
+ var n = (i, t, e) => o(i, typeof t != "symbol" ? t + "" : t, e);
4
4
  import { V as c } from "../../constants-BweLzNUt.js";
5
5
  import { ConcreteMultiStrategyVault as h } from "../abis/mainnet/ConcreteMultiStrategyVault.js";
6
6
  import { Token as l } from "../tokens.js";
@@ -17,8 +17,8 @@ class v {
17
17
  * interactions.
18
18
  */
19
19
  constructor(t, e, r) {
20
- a(this, "viemChain");
21
- a(this, "token");
20
+ n(this, "viemChain");
21
+ n(this, "token");
22
22
  this.chain = t, this.walletClient = e, this.publicClient = r, this.viemChain = c[t], this.token = l.ctTACpufETH;
23
23
  }
24
24
  /**
@@ -93,9 +93,9 @@ class v {
93
93
  });
94
94
  }
95
95
  /**
96
- * Withdraw an amount of the token.
96
+ * Withdraw the given amount of assets (pufETH) to the receiver.
97
97
  *
98
- * @param amount The amount to withdraw.
98
+ * @param assets The amount of assets (pufETH) to withdraw.
99
99
  * @returns The transaction.
100
100
  */
101
101
  withdraw(t) {
@@ -104,6 +104,24 @@ class v {
104
104
  chain: this.viemChain
105
105
  });
106
106
  }
107
+ /**
108
+ * Redeem the given amount of shares (ctTACpufETH) so the receiver
109
+ * gets the assets (pufETH).
110
+ *
111
+ * @param shares The amount of shares (ctTACpufETH) to redeem.
112
+ * @param receiver The optional receiver of the assets.
113
+ * @param owner The optional owner of the shares.
114
+ * @returns The transaction.
115
+ */
116
+ redeem(t, e, r) {
117
+ return e && r ? this.getContract().write.redeem([t, e, r], {
118
+ account: this.walletClient.account,
119
+ chain: this.viemChain
120
+ }) : this.getContract().write.redeem([t], {
121
+ account: this.walletClient.account,
122
+ chain: this.viemChain
123
+ });
124
+ }
107
125
  /**
108
126
  * Provides a preview of the number of shares that would be minted for a given deposit amount, after fees.
109
127
  *
@@ -1 +1 @@
1
- {"version":3,"file":"concrete-vault-handler.js","sources":["../../../lib/contracts/handlers/concrete-vault-handler.ts"],"sourcesContent":["import {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n Account,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { ConcreteMultiStrategyVault } from '../abis/mainnet/ConcreteMultiStrategyVault';\nimport { Token } from '../tokens';\nimport { VAULTS_ADDRESSES } from '../vaults-addresses';\n\ntype VaultAddresses = typeof VAULTS_ADDRESSES;\ntype PufETHVault = VaultAddresses[Token.ctTACpufETH][Chain.Mainnet];\n\n/**\n * Handler for the `ConcreteMultStrategyVault` contract for a given token (pufETH) exposing\n * methods to interact with the contract.\n */\nexport class ConcreteVaultHandler {\n private viemChain: ViemChain;\n private token: Token.ctTACpufETH;\n\n /**\n * Create the handler for processing UniFi tokens.\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 this.token = Token.ctTACpufETH;\n }\n\n /**\n * Set the UniFi token to use for executing transactions on the\n * contract.\n *\n * @param token UniFi token to use for the handler.\n * @returns The handler.\n */\n public withToken(token: Token.ctTACpufETH) {\n this.token = token;\n return this;\n }\n\n /**\n * Get the contract.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = (VAULTS_ADDRESSES[this.token][this.chain] as PufETHVault)\n .ConcreteMultiStrategyVault as Address;\n const abi = ConcreteMultiStrategyVault;\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 * Approve a spender to spend the token.\n *\n * @param spender The spender of the token.\n * @param amount The amount to approve.\n * @returns The transaction.\n */\n public approve(spender: Address, amount: bigint) {\n return this.getContract().write.approve([spender, amount], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Get the allowance of the owner for the spender.\n *\n * @param owner The owner of the allowance.\n * @param spender The spender of the allowance.\n * @returns The allowance.\n */\n public getAllowance(owner: Address, spender: Address) {\n return this.getContract().read.allowance([owner, spender]);\n }\n\n /**\n * Get the balance for the address.\n *\n * @param address The address to get the balance of.\n * @returns The balance.\n */\n public getBalance(address: Address) {\n return this.getContract().read.balanceOf([address]);\n }\n\n /**\n * Get the total supply of the token.\n *\n * @returns The total supply.\n */\n public getTotalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Deposit an amount of the token.\n *\n * @param amount The amount to deposit.\n * @returns The transaction.\n */\n public deposit(amount: bigint) {\n return this.getContract().write.deposit([amount], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Withdraw an amount of the token.\n *\n * @param amount The amount to withdraw.\n * @returns The transaction.\n */\n public withdraw(amount: bigint) {\n return this.getContract().write.withdraw([amount], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Provides a preview of the number of shares that would be minted for a given deposit amount, after fees.\n *\n * @param amount The amount to deposit.\n * @returns The preview.\n */\n public previewDeposit(amount: bigint) {\n return this.getContract().read.previewDeposit([amount]);\n }\n\n /**\n * Provides a preview of the number of shares that would be burned for a given withdrawal amount, after fees.\n *\n * @param amount The amount to withdraw.\n * @returns The preview.\n */\n public previewWithdraw(amount: bigint) {\n return this.getContract().read.previewWithdraw([amount]);\n }\n\n /**\n * Provides a preview of the amount of assets that would be redeemed\n * for a specific number of shares, after withdrawal fees. Subtracts\n * the withdrawal fee from the share amount to determine the net\n * shares for asset conversion.\n *\n * @param amount The amount to redeem.\n * @returns The preview.\n */\n public previewRedeem(amount: bigint) {\n return this.getContract().read.previewRedeem([amount]);\n }\n}\n"],"names":["ConcreteVaultHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","Token","token","address","VAULTS_ADDRESSES","abi","ConcreteMultiStrategyVault","client","getContract","spender","amount","owner"],"mappings":";;;;;;;;AAoBO,MAAMA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAahC,YACUC,GACAC,GACAC,GACR;AAhBM,IAAAC,EAAA;AACA,IAAAA,EAAA;AAYE,SAAA,QAAAH,GACA,KAAA,eAAAC,GACA,KAAA,eAAAC,GAEH,KAAA,YAAYE,EAAYJ,CAAK,GAClC,KAAK,QAAQK,EAAM;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUd,UAAUC,GAA0B;AACzC,gBAAK,QAAQA,GACN;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQF,cAAc;AACnB,UAAMC,IAAWC,EAAiB,KAAK,KAAK,EAAE,KAAK,KAA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AeA,GAAgB;AACpC,WAAO,KAAK,YAAY,EAAE,KAAK,eAAe,CAACA,CAAM,CAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASjD,gBAAgBA,GAAgB;AACrC,WAAO,KAAK,YAAY,EAAE,KAAK,gBAAgB,CAACA,CAAM,CAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYlD,cAAcA,GAAgB;AACnC,WAAO,KAAK,YAAY,EAAE,KAAK,cAAc,CAACA,CAAM,CAAC;AAAA,EAAA;AAEzD;"}
1
+ {"version":3,"file":"concrete-vault-handler.js","sources":["../../../lib/contracts/handlers/concrete-vault-handler.ts"],"sourcesContent":["import {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n Account,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { ConcreteMultiStrategyVault } from '../abis/mainnet/ConcreteMultiStrategyVault';\nimport { Token } from '../tokens';\nimport { VAULTS_ADDRESSES } from '../vaults-addresses';\n\ntype VaultAddresses = typeof VAULTS_ADDRESSES;\ntype PufETHVault = VaultAddresses[Token.ctTACpufETH][Chain.Mainnet];\n\n/**\n * Handler for the `ConcreteMultStrategyVault` contract for a given token (pufETH) exposing\n * methods to interact with the contract.\n */\nexport class ConcreteVaultHandler {\n private viemChain: ViemChain;\n private token: Token.ctTACpufETH;\n\n /**\n * Create the handler for processing UniFi tokens.\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 this.token = Token.ctTACpufETH;\n }\n\n /**\n * Set the UniFi token to use for executing transactions on the\n * contract.\n *\n * @param token UniFi token to use for the handler.\n * @returns The handler.\n */\n public withToken(token: Token.ctTACpufETH) {\n this.token = token;\n return this;\n }\n\n /**\n * Get the contract.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = (VAULTS_ADDRESSES[this.token][this.chain] as PufETHVault)\n .ConcreteMultiStrategyVault as Address;\n const abi = ConcreteMultiStrategyVault;\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 * Approve a spender to spend the token.\n *\n * @param spender The spender of the token.\n * @param amount The amount to approve.\n * @returns The transaction.\n */\n public approve(spender: Address, amount: bigint) {\n return this.getContract().write.approve([spender, amount], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Get the allowance of the owner for the spender.\n *\n * @param owner The owner of the allowance.\n * @param spender The spender of the allowance.\n * @returns The allowance.\n */\n public getAllowance(owner: Address, spender: Address) {\n return this.getContract().read.allowance([owner, spender]);\n }\n\n /**\n * Get the balance for the address.\n *\n * @param address The address to get the balance of.\n * @returns The balance.\n */\n public getBalance(address: Address) {\n return this.getContract().read.balanceOf([address]);\n }\n\n /**\n * Get the total supply of the token.\n *\n * @returns The total supply.\n */\n public getTotalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Deposit an amount of the token.\n *\n * @param amount The amount to deposit.\n * @returns The transaction.\n */\n public deposit(amount: bigint) {\n return this.getContract().write.deposit([amount], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Withdraw the given amount of assets (pufETH) to the receiver.\n *\n * @param assets The amount of assets (pufETH) to withdraw.\n * @returns The transaction.\n */\n public withdraw(assets: bigint) {\n return this.getContract().write.withdraw([assets], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Redeem the given amount of shares (ctTACpufETH) so the receiver\n * gets the assets (pufETH).\n *\n * @param shares The amount of shares (ctTACpufETH) to redeem.\n * @param receiver The optional receiver of the assets.\n * @param owner The optional owner of the shares.\n * @returns The transaction.\n */\n public redeem(shares: bigint, receiver?: Address, owner?: Address) {\n if (receiver && owner) {\n return this.getContract().write.redeem([shares, receiver, owner], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n return this.getContract().write.redeem([shares], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Provides a preview of the number of shares that would be minted for a given deposit amount, after fees.\n *\n * @param amount The amount to deposit.\n * @returns The preview.\n */\n public previewDeposit(amount: bigint) {\n return this.getContract().read.previewDeposit([amount]);\n }\n\n /**\n * Provides a preview of the number of shares that would be burned for a given withdrawal amount, after fees.\n *\n * @param amount The amount to withdraw.\n * @returns The preview.\n */\n public previewWithdraw(amount: bigint) {\n return this.getContract().read.previewWithdraw([amount]);\n }\n\n /**\n * Provides a preview of the amount of assets that would be redeemed\n * for a specific number of shares, after withdrawal fees. Subtracts\n * the withdrawal fee from the share amount to determine the net\n * shares for asset conversion.\n *\n * @param amount The amount to redeem.\n * @returns The preview.\n */\n public previewRedeem(amount: bigint) {\n return this.getContract().read.previewRedeem([amount]);\n }\n}\n"],"names":["ConcreteVaultHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","Token","token","address","VAULTS_ADDRESSES","abi","ConcreteMultiStrategyVault","client","getContract","spender","amount","owner","assets","shares","receiver"],"mappings":";;;;;;;;AAoBO,MAAMA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAahC,YACUC,GACAC,GACAC,GACR;AAhBM,IAAAC,EAAA;AACA,IAAAA,EAAA;AAYE,SAAA,QAAAH,GACA,KAAA,eAAAC,GACA,KAAA,eAAAC,GAEH,KAAA,YAAYE,EAAYJ,CAAK,GAClC,KAAK,QAAQK,EAAM;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUd,UAAUC,GAA0B;AACzC,gBAAK,QAAQA,GACN;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA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K;AAAA,IAAA,CACb;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYI,OAAOC,GAAgBC,GAAoBH,GAAiB;AACjE,WAAIG,KAAYH,IACP,KAAK,cAAc,MAAM,OAAO,CAACE,GAAQC,GAAUH,CAAK,GAAG;AAAA,MAChE,SAAS,KAAK,aAAa;AAAA,MAC3B,OAAO,KAAK;AAAA,IAAA,CACb,IAGI,KAAK,YAAY,EAAE,MAAM,OAAO,CAACE,CAAM,GAAG;AAAA,MAC/C,SAAS,KAAK,aAAa;AAAA,MAC3B,OAAO,KAAK;AAAA,IAAA,CACb;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASI,eAAeH,GAAgB;AACpC,WAAO,KAAK,YAAY,EAAE,KAAK,eAAe,CAACA,CAAM,CAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASjD,gBAAgBA,GAAgB;AACrC,WAAO,KAAK,YAAY,EAAE,KAAK,gBAAgB,CAACA,CAAM,CAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYlD,cAAcA,GAAgB;AACnC,WAAO,KAAK,YAAY,EAAE,KAAK,cAAc,CAACA,CAAM,CAAC;AAAA,EAAA;AAEzD;"}
@@ -1,2 +1,2 @@
1
- "use strict";var s=Object.defineProperty;var o=(r,t,e)=>t in r?s(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var n=(r,t,e)=>o(r,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../abis/mainnet/InstitutionalVault.cjs"),h=require("../../constants-JN89aXws.cjs"),l=require("../../errors/validation-errors.cjs"),u=require("../../getContract-F-fd_vf7.cjs");class d{constructor(t,e,a){n(this,"viemChain");n(this,"address");this.walletClient=e,this.publicClient=a,this.viemChain=h.VIEM_CHAINS[t]}withAddress(t){return this.address=t,this}getAddress(){return this.address}getContract(){if(!this.address)throw new l.InvalidContractAddressError("No address specified for the contract",{fixMessage:"Set the contract address in the handler by using the setAddress method"});const t=c.InstitutionalVault,e={public:this.publicClient,wallet:this.walletClient};return u.getContract({address:this.address,abi:t,client:e})}getBeaconDepositContract(){return this.getContract().read.BEACON_DEPOSIT_CONTRACT()}getEigenDelegationManager(){return this.getContract().read.EIGEN_DELEGATION_MANAGER()}getEigenPodManager(){return this.getContract().read.EIGEN_POD_MANAGER()}getEigenPod(){return this.getContract().read.getEigenPod()}allowance(t,e){return this.getContract().read.allowance([t,e])}approve(t,e){return this.getContract().write.approve([t,e],{account:this.walletClient.account,chain:this.viemChain})}asset(){return this.getContract().read.asset()}authority(){return this.getContract().read.authority()}balanceOf(t){return this.getContract().read.balanceOf([t])}decimals(){return this.getContract().read.decimals()}completeQueuedWithdrawals(t,e){return this.getContract().write.completeQueuedWithdrawals([t,e],{account:this.walletClient.account,chain:this.viemChain})}convertToAssets(t){return this.getContract().read.convertToAssets([t])}convertToShares(t){return this.getContract().read.convertToShares([t])}deposit(t,e){return this.getContract().write.deposit([t,e],{account:this.walletClient.account,chain:this.viemChain})}depositETH(t,e){return this.getContract().write.depositETH([t],{account:this.walletClient.account,chain:this.viemChain,value:e})}getNonRestakedValidatorETH(){return this.getContract().read.getNonRestakedValidatorETH()}getRestakedValidatorETH(){return this.getContract().read.getRestakedValidatorETH()}getWithdrawalCredentials(){return this.getContract().read.getWithdrawalCredentials()}maxDeposit(t){return this.getContract().read.maxDeposit([t])}maxMint(t){return this.getContract().read.maxMint([t])}maxRedeem(t){return this.getContract().read.maxRedeem([t])}maxWithdraw(t){return this.getContract().read.maxWithdraw([t])}mint(t,e){return this.getContract().write.mint([t,e],{account:this.walletClient.account,chain:this.viemChain})}name(){return this.getContract().read.name()}previewDeposit(t){return this.getContract().read.previewDeposit([t])}previewMint(t){return this.getContract().read.previewMint([t])}previewRedeem(t){return this.getContract().read.previewRedeem([t])}previewWithdraw(t){return this.getContract().read.previewWithdraw([t])}queueWithdrawals(t){return this.getContract().write.queueWithdrawals([t],{account:this.walletClient.account,chain:this.viemChain})}redeem(t,e,a){return this.getContract().write.redeem([t,e,a],{account:this.walletClient.account,chain:this.viemChain})}setValidatorsETH(t,e){return this.getContract().write.setValidatorsETH([t,e],{account:this.walletClient.account,chain:this.viemChain})}startNonRestakingValidators(t,e,a,i){return this.getContract().write.startNonRestakingValidators([t,e,a,i],{account:this.walletClient.account,chain:this.viemChain})}startRestakingValidators(t,e,a,i){return this.getContract().write.startRestakingValidators([t,e,a,i],{account:this.walletClient.account,chain:this.viemChain})}withdraw(t,e,a){return this.getContract().write.withdraw([t,e,a],{account:this.walletClient.account,chain:this.viemChain})}symbol(){return this.getContract().read.symbol()}totalAssets(){return this.getContract().read.totalAssets()}totalSupply(){return this.getContract().read.totalSupply()}transfer(t,e){return this.getContract().write.transfer([t,e],{account:this.walletClient.account,chain:this.viemChain})}transferFrom(t,e,a){return this.getContract().write.transferFrom([t,e,a],{account:this.walletClient.account,chain:this.viemChain})}customExternalCall(t,e,a){return this.getContract().write.customExternalCall([t,e,a],{account:this.walletClient.account,chain:this.viemChain})}requestEigenPodConsolidation(t,e){return this.getContract().write.requestEigenPodConsolidation([t,e],{account:this.walletClient.account,chain:this.viemChain})}}exports.InstitutionalVaultHandler=d;
1
+ "use strict";var s=Object.defineProperty;var o=(r,t,e)=>t in r?s(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var n=(r,t,e)=>o(r,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../abis/mainnet/InstitutionalVault.cjs"),h=require("../../constants-JN89aXws.cjs"),l=require("../../errors/validation-errors.cjs"),u=require("../../getContract-F-fd_vf7.cjs");class d{constructor(t,e,a){n(this,"viemChain");n(this,"address");this.walletClient=e,this.publicClient=a,this.viemChain=h.VIEM_CHAINS[t]}withAddress(t){return this.address=t,this}getAddress(){return this.address}getContract(){if(!this.address)throw new l.InvalidContractAddressError("No address specified for the contract",{fixMessage:"Set the contract address in the handler by using the setAddress method"});const t=c.InstitutionalVault,e={public:this.publicClient,wallet:this.walletClient};return u.getContract({address:this.address,abi:t,client:e})}getBeaconDepositContract(){return this.getContract().read.BEACON_DEPOSIT_CONTRACT()}getEigenDelegationManager(){return this.getContract().read.EIGEN_DELEGATION_MANAGER()}getEigenPodManager(){return this.getContract().read.EIGEN_POD_MANAGER()}getEigenPod(){return this.getContract().read.getEigenPod()}allowance(t,e){return this.getContract().read.allowance([t,e])}approve(t,e){return this.getContract().write.approve([t,e],{account:this.walletClient.account,chain:this.viemChain})}asset(){return this.getContract().read.asset()}authority(){return this.getContract().read.authority()}balanceOf(t){return this.getContract().read.balanceOf([t])}decimals(){return this.getContract().read.decimals()}completeQueuedWithdrawals(t,e){return this.getContract().write.completeQueuedWithdrawals([t,e],{account:this.walletClient.account,chain:this.viemChain})}convertToAssets(t){return this.getContract().read.convertToAssets([t])}convertToShares(t){return this.getContract().read.convertToShares([t])}deposit(t,e){return this.getContract().write.deposit([t,e],{account:this.walletClient.account,chain:this.viemChain})}depositETH(t,e){return this.getContract().write.depositETH([t],{account:this.walletClient.account,chain:this.viemChain,value:e})}getNonRestakedValidatorETH(){return this.getContract().read.getNonRestakedValidatorETH()}getRestakedValidatorETH(){return this.getContract().read.getRestakedValidatorETH()}getWithdrawalCredentials(){return this.getContract().read.getWithdrawalCredentials()}maxDeposit(t){return this.getContract().read.maxDeposit([t])}maxMint(t){return this.getContract().read.maxMint([t])}maxRedeem(t){return this.getContract().read.maxRedeem([t])}maxWithdraw(t){return this.getContract().read.maxWithdraw([t])}mint(t,e){return this.getContract().write.mint([t,e],{account:this.walletClient.account,chain:this.viemChain})}name(){return this.getContract().read.name()}previewDeposit(t){return this.getContract().read.previewDeposit([t])}previewMint(t){return this.getContract().read.previewMint([t])}previewRedeem(t){return this.getContract().read.previewRedeem([t])}previewWithdraw(t){return this.getContract().read.previewWithdraw([t])}queueWithdrawals(t){return this.getContract().write.queueWithdrawals([t],{account:this.walletClient.account,chain:this.viemChain})}redeem(t,e,a){return this.getContract().write.redeem([t,e,a],{account:this.walletClient.account,chain:this.viemChain})}setValidatorsETH(t,e){return this.getContract().write.setValidatorsETH([t,e],{account:this.walletClient.account,chain:this.viemChain})}startNonRestakingValidators(t,e,a,i){return this.getContract().write.startNonRestakingValidators([t,e,a,i],{account:this.walletClient.account,chain:this.viemChain})}startRestakingValidators(t,e,a,i){return this.getContract().write.startRestakingValidators([t,e,a,i],{account:this.walletClient.account,chain:this.viemChain})}withdraw(t,e,a){return this.getContract().write.withdraw([t,e,a],{account:this.walletClient.account,chain:this.viemChain})}symbol(){return this.getContract().read.symbol()}totalAssets(){return this.getContract().read.totalAssets()}totalSupply(){return this.getContract().read.totalSupply()}transfer(t,e){return this.getContract().write.transfer([t,e],{account:this.walletClient.account,chain:this.viemChain})}transferFrom(t,e,a){return this.getContract().write.transferFrom([t,e,a],{account:this.walletClient.account,chain:this.viemChain})}customExternalCall(t,e,a){return this.getContract().write.customExternalCall([t,e,a],{account:this.walletClient.account,chain:this.viemChain})}requestEigenPodConsolidation(t,e,a){return this.getContract().write.requestEigenPodConsolidation([t,e],{account:this.walletClient.account,chain:this.viemChain,value:a})}}exports.InstitutionalVaultHandler=d;
2
2
  //# sourceMappingURL=institutional-vault-handler.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"institutional-vault-handler.cjs","sources":["../../../lib/contracts/handlers/institutional-vault-handler.ts"],"sourcesContent":["import {\n Chain as ViemChain,\n WalletClient,\n PublicClient,\n getContract,\n GetContractReturnType,\n Address,\n Hex,\n} from 'viem';\nimport { InstitutionalVault } from '../abis/mainnet/InstitutionalVault';\nimport { Chain, VIEM_CHAINS } from '../../chains/constants';\nimport { InvalidContractAddressError } from '../../errors/validation-errors';\n\nexport type QueuedWithdrawal = {\n staker: Address;\n delegatedTo: Address;\n withdrawer: Address;\n nonce: bigint;\n startBlock: number;\n strategies: Address[];\n scaledShares: bigint[];\n};\n\n/**\n * Handler for the `InstitutionalVault` contract exposing methods to\n * interact with the contract.\n */\nexport class InstitutionalVaultHandler {\n private viemChain: ViemChain;\n private address?: Address;\n\n /**\n * Create the handler for the `InstitutionalVault` contract exposing\n * methods to 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 chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n }\n\n /**\n * Set the address of the contract for this handler.\n *\n * @param address The address of the contract.\n * @returns The handler.\n */\n public withAddress(address: Address) {\n this.address = address;\n\n return this;\n }\n\n /**\n * Get the address of the contract for this handler.\n *\n * @returns The address of the contract.\n */\n public getAddress() {\n return this.address;\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 if (!this.address) {\n throw new InvalidContractAddressError(\n `No address specified for the contract`,\n {\n fixMessage: `Set the contract address in the handler by using the setAddress method`,\n },\n );\n }\n\n const abi = InstitutionalVault;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({\n address: this.address,\n abi,\n client,\n }) as GetContractReturnType<typeof abi, typeof client, Address>;\n }\n\n /**\n * Get the beacon deposit contract address.\n *\n * @returns The beacon deposit contract address.\n */\n public getBeaconDepositContract() {\n return this.getContract().read.BEACON_DEPOSIT_CONTRACT();\n }\n\n /**\n * Get the eigen delegation manager contract address.\n *\n * @returns The eigen delegation manager.\n */\n public getEigenDelegationManager() {\n return this.getContract().read.EIGEN_DELEGATION_MANAGER();\n }\n\n /**\n * Get the eigen pod manager contract address.\n *\n * @returns The eigen pod manager contract address.\n */\n public getEigenPodManager() {\n return this.getContract().read.EIGEN_POD_MANAGER();\n }\n\n /**\n * Get the eigen pod address.\n *\n * @returns The eigen pod address.\n */\n public getEigenPod() {\n return this.getContract().read.getEigenPod();\n }\n\n /**\n * Get the allowance for the spender to spend the owner's tokens.\n *\n * @param owner The owner of the tokens.\n * @param spender The spender of the tokens.\n * @returns The allowance of the owner for the spender.\n */\n public allowance(owner: Address, spender: Address) {\n return this.getContract().read.allowance([owner, spender]);\n }\n\n /**\n * Approve the spender to spend the owner's tokens.\n *\n * @param spender The spender of the tokens.\n * @param amount The amount of tokens to approve.\n */\n public approve(spender: Address, amount: bigint) {\n return this.getContract().write.approve([spender, amount], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Get the asset of the vault.\n *\n * @returns The asset of the vault.\n */\n public asset() {\n return this.getContract().read.asset();\n }\n\n /**\n * Get the authority of the vault.\n *\n * @returns The authority of the vault.\n */\n public authority() {\n return this.getContract().read.authority();\n }\n\n /**\n * Get the balance of the address.\n *\n * @param address The address to get the balance of.\n * @returns The balance of the address.\n */\n public balanceOf(address: Address) {\n return this.getContract().read.balanceOf([address]);\n }\n\n /**\n * Get the number of decimals of the token.\n *\n * @returns The number of decimals of the token.\n */\n public decimals() {\n return this.getContract().read.decimals();\n }\n\n /**\n * Complete the queued withdrawals.\n *\n * @param withdrawals The withdrawals to complete.\n * @param receiveAsTokens Whether to receive the assets as tokens.\n */\n public completeQueuedWithdrawals(\n withdrawals: QueuedWithdrawal[],\n receiveAsTokens: boolean[],\n ) {\n return this.getContract().write.completeQueuedWithdrawals(\n [withdrawals, receiveAsTokens],\n {\n account: this.walletClient.account!,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Convert shares to assets.\n *\n * @param shares The number of shares to convert.\n * @returns The number of assets.\n */\n public convertToAssets(shares: bigint) {\n return this.getContract().read.convertToAssets([shares]);\n }\n\n /**\n * Convert assets to shares.\n *\n * @param assets The number of assets to convert.\n * @returns The number of shares.\n */\n public convertToShares(assets: bigint) {\n return this.getContract().read.convertToShares([assets]);\n }\n\n /**\n * Deposit assets into the vault.\n *\n * @param assets The number of assets to deposit.\n * @param receiver The address to receive the shares.\n */\n public deposit(assets: bigint, receiver: Address) {\n return this.getContract().write.deposit([assets, receiver], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Deposit ETH into the vault.\n *\n * @param receiver The address to receive the shares.\n * @param value The amount of ETH to deposit.\n */\n public depositETH(receiver: Address, value: bigint) {\n return this.getContract().write.depositETH([receiver], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n value,\n });\n }\n\n /**\n * Get the non-restaked validator ETH.\n *\n * @returns The non-restaked validator ETH.\n */\n public getNonRestakedValidatorETH() {\n return this.getContract().read.getNonRestakedValidatorETH();\n }\n\n /**\n * Get the restaked validator ETH.\n *\n * @returns The restaked validator ETH.\n */\n public getRestakedValidatorETH() {\n return this.getContract().read.getRestakedValidatorETH();\n }\n\n /**\n * Get the withdrawal credentials.\n *\n * @returns The withdrawal credentials.\n */\n public getWithdrawalCredentials() {\n return this.getContract().read.getWithdrawalCredentials();\n }\n\n /**\n * Get the maximum deposit amount for the address.\n *\n * @param address The address to get the maximum deposit amount for.\n * @returns The maximum deposit amount for the address.\n */\n public maxDeposit(address: Address) {\n return this.getContract().read.maxDeposit([address]);\n }\n\n /**\n * Get the maximum mint amount for the address.\n *\n * @param address The address to get the maximum mint amount for.\n * @returns The maximum mint amount for the address.\n */\n public maxMint(address: Address) {\n return this.getContract().read.maxMint([address]);\n }\n\n /**\n * Get the maximum redeem amount for the address.\n *\n * @param address The address to get the maximum redeem amount for.\n * @returns The maximum redeem amount for the address.\n */\n public maxRedeem(address: Address) {\n return this.getContract().read.maxRedeem([address]);\n }\n\n /**\n * Get the maximum withdraw amount for the address.\n *\n * @param address The address to get the maximum withdraw amount for.\n * @returns The maximum withdraw amount for the address.\n */\n public maxWithdraw(address: Address) {\n return this.getContract().read.maxWithdraw([address]);\n }\n\n /**\n * Mint shares to the receiver.\n *\n * @param shares The number of shares to mint.\n * @param receiver The address to receive the shares.\n */\n public mint(shares: bigint, receiver: Address) {\n return this.getContract().write.mint([shares, receiver], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Get the name of the contract.\n *\n * @returns The name of the contract.\n */\n public name() {\n return this.getContract().read.name();\n }\n\n /**\n * Preview the deposit amount for the assets.\n *\n * @param assets The number of assets to deposit.\n * @returns The number of shares to receive.\n */\n public previewDeposit(assets: bigint) {\n return this.getContract().read.previewDeposit([assets]);\n }\n\n /**\n * Preview the mint amount for the shares.\n *\n * @param shares The number of shares to mint.\n * @returns The number of assets to receive.\n */\n public previewMint(shares: bigint) {\n return this.getContract().read.previewMint([shares]);\n }\n\n /**\n * Preview the redeem amount for the shares.\n *\n * @param shares The number of shares to redeem.\n * @returns The number of assets to receive.\n */\n public previewRedeem(shares: bigint) {\n return this.getContract().read.previewRedeem([shares]);\n }\n\n /**\n * Preview the withdraw amount for the shares.\n *\n * @param shares The number of shares to withdraw.\n * @returns The number of assets to receive.\n */\n public previewWithdraw(shares: bigint) {\n return this.getContract().read.previewWithdraw([shares]);\n }\n\n /**\n * Queue the withdrawals.\n *\n * @param shares The number of shares to withdraw.\n */\n public queueWithdrawals(shares: bigint) {\n return this.getContract().write.queueWithdrawals([shares], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Redeem the shares to the receiver.\n *\n * @param shares The number of shares to redeem.\n * @param receiver The address to receive the assets.\n * @param owner The owner of the shares.\n */\n public redeem(shares: bigint, receiver: Address, owner: Address) {\n return this.getContract().write.redeem([shares, receiver, owner], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Set the validators ETH.\n *\n * @param restakedValidatorsETH The amount of restaked validator ETH.\n * @param nonRestakedValidatorsETH The amount of non-restaked validator ETH.\n */\n public setValidatorsETH(\n restakedValidatorsETH: bigint,\n nonRestakedValidatorsETH: bigint,\n ) {\n return this.getContract().write.setValidatorsETH(\n [restakedValidatorsETH, nonRestakedValidatorsETH],\n {\n account: this.walletClient.account!,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Start the non-restaking validators.\n *\n * @param pubKeys The public keys of the validators.\n * @param signatures The signatures of the validators.\n * @param amountsInGwei The amounts of the validators.\n * @param depositDataRoots The deposit data roots of the validators.\n */\n public startNonRestakingValidators(\n pubKeys: Address[],\n signatures: Address[],\n amountsInGwei: bigint[],\n depositDataRoots: Address[],\n ) {\n return this.getContract().write.startNonRestakingValidators(\n [pubKeys, signatures, amountsInGwei, depositDataRoots],\n {\n account: this.walletClient.account!,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Start the restaking validators.\n *\n * @param pubKeys The public keys of the validators.\n * @param signatures The signatures of the validators.\n * @param amountsInGwei The amounts of the validators.\n * @param depositDataRoots The deposit data roots of the validators.\n */\n public startRestakingValidators(\n pubKeys: Address[],\n signatures: Address[],\n amountsInGwei: bigint[],\n depositDataRoots: Address[],\n ) {\n return this.getContract().write.startRestakingValidators(\n [pubKeys, signatures, amountsInGwei, depositDataRoots],\n {\n account: this.walletClient.account!,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Withdraw the assets to the receiver.\n *\n * @param assets The number of assets to withdraw.\n * @param receiver The address to receive the assets.\n * @param owner The owner of the assets.\n */\n public withdraw(assets: bigint, receiver: Address, owner: Address) {\n return this.getContract().write.withdraw([assets, receiver, owner], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Get the symbol of the contract.\n *\n * @returns The symbol of the contract.\n */\n public symbol() {\n return this.getContract().read.symbol();\n }\n\n /**\n * Get the total assets of the vault.\n *\n * @returns The total assets of the vault.\n */\n public totalAssets() {\n return this.getContract().read.totalAssets();\n }\n\n /**\n * Get the total supply of the vault.\n *\n * @returns The total supply of the vault.\n */\n public totalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Transfer the value to the to address.\n *\n * @param to The address to transfer the value to.\n * @param value The amount of value to transfer.\n */\n public transfer(to: Address, value: bigint) {\n return this.getContract().write.transfer([to, value], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Transfer the value from the from address to the to address.\n *\n * @param from The address to transfer the value from.\n * @param to The address to transfer the value to.\n * @param value The amount of value to transfer.\n */\n public transferFrom(from: Address, to: Address, value: bigint) {\n return this.getContract().write.transferFrom([from, to, value], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Call a custom external function.\n *\n * @param target The target contract address.\n * @param data The calldata to send a transaction to the target contract.\n * @param value The amount of value to send to the target contract.\n */\n public customExternalCall(target: Address, data: Hex, value: bigint) {\n return this.getContract().write.customExternalCall([target, data, value], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Request EigenPod consolidation.\n *\n * @param srcPubkeys The source public keys.\n * @param targetPubkeys The target public keys.\n */\n public requestEigenPodConsolidation(\n srcPubkeys: Address[],\n targetPubkeys: Address[],\n ) {\n return this.getContract().write.requestEigenPodConsolidation(\n [srcPubkeys, targetPubkeys],\n { account: this.walletClient.account!, chain: this.viemChain },\n );\n }\n}\n"],"names":["InstitutionalVaultHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","InvalidContractAddressError","abi","InstitutionalVault","client","getContract","owner","spender","amount","withdrawals","receiveAsTokens","shares","assets","receiver","value","restakedValidatorsETH","nonRestakedValidatorsETH","pubKeys","signatures","amountsInGwei","depositDataRoots","to","from","target","data","srcPubkeys","targetPubkeys"],"mappings":"obA2BO,MAAMA,CAA0B,CAcrC,YACEC,EACQC,EACAC,EACR,CAjBMC,EAAA,kBACAA,EAAA,gBAcE,KAAA,aAAAF,EACA,KAAA,aAAAC,EAEH,KAAA,UAAYE,cAAYJ,CAAK,CAAA,CAS7B,YAAYK,EAAkB,CACnC,YAAK,QAAUA,EAER,IAAA,CAQF,YAAa,CAClB,OAAO,KAAK,OAAA,CASP,aAAc,CACf,GAAA,CAAC,KAAK,QACR,MAAM,IAAIC,EAAA,4BACR,wCACA,CACE,WAAY,wEAAA,CAEhB,EAGF,MAAMC,EAAMC,EA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Y,CAAA,CAQtC,aAAc,CACnB,OAAO,KAAK,cAAc,KAAK,YAAY,CAAA,CAStC,SAASe,EAAaP,EAAe,CACnC,OAAA,KAAK,cAAc,MAAM,SAAS,CAACO,EAAIP,CAAK,EAAG,CACpD,QAAS,KAAK,aAAa,QAC3B,MAAO,KAAK,SAAA,CACb,CAAA,CAUI,aAAaQ,EAAeD,EAAaP,EAAe,CACtD,OAAA,KAAK,cAAc,MAAM,aAAa,CAACQ,EAAMD,EAAIP,CAAK,EAAG,CAC9D,QAAS,KAAK,aAAa,QAC3B,MAAO,KAAK,SAAA,CACb,CAAA,CAUI,mBAAmBS,EAAiBC,EAAWV,EAAe,CAC5D,OAAA,KAAK,cAAc,MAAM,mBAAmB,CAACS,EAAQC,EAAMV,CAAK,EAAG,CACxE,QAAS,KAAK,aAAa,QAC3B,MAAO,KAAK,SAAA,CACb,CAAA,CASI,6BACLW,EACAC,EACA,CACO,OAAA,KAAK,cAAc,MAAM,6BAC9B,CAACD,EAAYC,CAAa,EAC1B,CAAE,QAAS,KAAK,aAAa,QAAU,MAAO,KAAK,SAAU,CAC/D,CAAA,CAEJ"}
1
+ {"version":3,"file":"institutional-vault-handler.cjs","sources":["../../../lib/contracts/handlers/institutional-vault-handler.ts"],"sourcesContent":["import {\n Chain as ViemChain,\n WalletClient,\n PublicClient,\n getContract,\n GetContractReturnType,\n Address,\n Hex,\n} from 'viem';\nimport { InstitutionalVault } from '../abis/mainnet/InstitutionalVault';\nimport { Chain, VIEM_CHAINS } from '../../chains/constants';\nimport { InvalidContractAddressError } from '../../errors/validation-errors';\n\nexport type QueuedWithdrawal = {\n staker: Address;\n delegatedTo: Address;\n withdrawer: Address;\n nonce: bigint;\n startBlock: number;\n strategies: Address[];\n scaledShares: bigint[];\n};\n\n/**\n * Handler for the `InstitutionalVault` contract exposing methods to\n * interact with the contract.\n */\nexport class InstitutionalVaultHandler {\n private viemChain: ViemChain;\n private address?: Address;\n\n /**\n * Create the handler for the `InstitutionalVault` contract exposing\n * methods to 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 chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n }\n\n /**\n * Set the address of the contract for this handler.\n *\n * @param address The address of the contract.\n * @returns The handler.\n */\n public withAddress(address: Address) {\n this.address = address;\n\n return this;\n }\n\n /**\n * Get the address of the contract for this handler.\n *\n * @returns The address of the contract.\n */\n public getAddress() {\n return this.address;\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 if (!this.address) {\n throw new InvalidContractAddressError(\n `No address specified for the contract`,\n {\n fixMessage: `Set the contract address in the handler by using the setAddress method`,\n },\n );\n }\n\n const abi = InstitutionalVault;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({\n address: this.address,\n abi,\n client,\n }) as GetContractReturnType<typeof abi, typeof client, Address>;\n }\n\n /**\n * Get the beacon deposit contract address.\n *\n * @returns The beacon deposit contract address.\n */\n public getBeaconDepositContract() {\n return this.getContract().read.BEACON_DEPOSIT_CONTRACT();\n }\n\n /**\n * Get the eigen delegation manager contract address.\n *\n * @returns The eigen delegation manager.\n */\n public getEigenDelegationManager() {\n return this.getContract().read.EIGEN_DELEGATION_MANAGER();\n }\n\n /**\n * Get the eigen pod manager contract address.\n *\n * @returns The eigen pod manager contract address.\n */\n public getEigenPodManager() {\n return this.getContract().read.EIGEN_POD_MANAGER();\n }\n\n /**\n * Get the eigen pod address.\n *\n * @returns The eigen pod address.\n */\n public getEigenPod() {\n return this.getContract().read.getEigenPod();\n }\n\n /**\n * Get the allowance for the spender to spend the owner's tokens.\n *\n * @param owner The owner of the tokens.\n * @param spender The spender of the tokens.\n * @returns The allowance of the owner for the spender.\n */\n public allowance(owner: Address, spender: Address) {\n return this.getContract().read.allowance([owner, spender]);\n }\n\n /**\n * Approve the spender to spend the owner's tokens.\n *\n * @param spender The spender of the tokens.\n * @param amount The amount of tokens to approve.\n */\n public approve(spender: Address, amount: bigint) {\n return this.getContract().write.approve([spender, amount], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Get the asset of the vault.\n *\n * @returns The asset of the vault.\n */\n public asset() {\n return this.getContract().read.asset();\n }\n\n /**\n * Get the authority of the vault.\n *\n * @returns The authority of the vault.\n */\n public authority() {\n return this.getContract().read.authority();\n }\n\n /**\n * Get the balance of the address.\n *\n * @param address The address to get the balance of.\n * @returns The balance of the address.\n */\n public balanceOf(address: Address) {\n return this.getContract().read.balanceOf([address]);\n }\n\n /**\n * Get the number of decimals of the token.\n *\n * @returns The number of decimals of the token.\n */\n public decimals() {\n return this.getContract().read.decimals();\n }\n\n /**\n * Complete the queued withdrawals.\n *\n * @param withdrawals The withdrawals to complete.\n * @param receiveAsTokens Whether to receive the assets as tokens.\n */\n public completeQueuedWithdrawals(\n withdrawals: QueuedWithdrawal[],\n receiveAsTokens: boolean[],\n ) {\n return this.getContract().write.completeQueuedWithdrawals(\n [withdrawals, receiveAsTokens],\n {\n account: this.walletClient.account!,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Convert shares to assets.\n *\n * @param shares The number of shares to convert.\n * @returns The number of assets.\n */\n public convertToAssets(shares: bigint) {\n return this.getContract().read.convertToAssets([shares]);\n }\n\n /**\n * Convert assets to shares.\n *\n * @param assets The number of assets to convert.\n * @returns The number of shares.\n */\n public convertToShares(assets: bigint) {\n return this.getContract().read.convertToShares([assets]);\n }\n\n /**\n * Deposit assets into the vault.\n *\n * @param assets The number of assets to deposit.\n * @param receiver The address to receive the shares.\n */\n public deposit(assets: bigint, receiver: Address) {\n return this.getContract().write.deposit([assets, receiver], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Deposit ETH into the vault.\n *\n * @param receiver The address to receive the shares.\n * @param value The amount of ETH to deposit.\n */\n public depositETH(receiver: Address, value: bigint) {\n return this.getContract().write.depositETH([receiver], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n value,\n });\n }\n\n /**\n * Get the non-restaked validator ETH.\n *\n * @returns The non-restaked validator ETH.\n */\n public getNonRestakedValidatorETH() {\n return this.getContract().read.getNonRestakedValidatorETH();\n }\n\n /**\n * Get the restaked validator ETH.\n *\n * @returns The restaked validator ETH.\n */\n public getRestakedValidatorETH() {\n return this.getContract().read.getRestakedValidatorETH();\n }\n\n /**\n * Get the withdrawal credentials.\n *\n * @returns The withdrawal credentials.\n */\n public getWithdrawalCredentials() {\n return this.getContract().read.getWithdrawalCredentials();\n }\n\n /**\n * Get the maximum deposit amount for the address.\n *\n * @param address The address to get the maximum deposit amount for.\n * @returns The maximum deposit amount for the address.\n */\n public maxDeposit(address: Address) {\n return this.getContract().read.maxDeposit([address]);\n }\n\n /**\n * Get the maximum mint amount for the address.\n *\n * @param address The address to get the maximum mint amount for.\n * @returns The maximum mint amount for the address.\n */\n public maxMint(address: Address) {\n return this.getContract().read.maxMint([address]);\n }\n\n /**\n * Get the maximum redeem amount for the address.\n *\n * @param address The address to get the maximum redeem amount for.\n * @returns The maximum redeem amount for the address.\n */\n public maxRedeem(address: Address) {\n return this.getContract().read.maxRedeem([address]);\n }\n\n /**\n * Get the maximum withdraw amount for the address.\n *\n * @param address The address to get the maximum withdraw amount for.\n * @returns The maximum withdraw amount for the address.\n */\n public maxWithdraw(address: Address) {\n return this.getContract().read.maxWithdraw([address]);\n }\n\n /**\n * Mint shares to the receiver.\n *\n * @param shares The number of shares to mint.\n * @param receiver The address to receive the shares.\n */\n public mint(shares: bigint, receiver: Address) {\n return this.getContract().write.mint([shares, receiver], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Get the name of the contract.\n *\n * @returns The name of the contract.\n */\n public name() {\n return this.getContract().read.name();\n }\n\n /**\n * Preview the deposit amount for the assets.\n *\n * @param assets The number of assets to deposit.\n * @returns The number of shares to receive.\n */\n public previewDeposit(assets: bigint) {\n return this.getContract().read.previewDeposit([assets]);\n }\n\n /**\n * Preview the mint amount for the shares.\n *\n * @param shares The number of shares to mint.\n * @returns The number of assets to receive.\n */\n public previewMint(shares: bigint) {\n return this.getContract().read.previewMint([shares]);\n }\n\n /**\n * Preview the redeem amount for the shares.\n *\n * @param shares The number of shares to redeem.\n * @returns The number of assets to receive.\n */\n public previewRedeem(shares: bigint) {\n return this.getContract().read.previewRedeem([shares]);\n }\n\n /**\n * Preview the withdraw amount for the shares.\n *\n * @param shares The number of shares to withdraw.\n * @returns The number of assets to receive.\n */\n public previewWithdraw(shares: bigint) {\n return this.getContract().read.previewWithdraw([shares]);\n }\n\n /**\n * Queue the withdrawals.\n *\n * @param shares The number of shares to withdraw.\n */\n public queueWithdrawals(shares: bigint) {\n return this.getContract().write.queueWithdrawals([shares], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Redeem the shares to the receiver.\n *\n * @param shares The number of shares to redeem.\n * @param receiver The address to receive the assets.\n * @param owner The owner of the shares.\n */\n public redeem(shares: bigint, receiver: Address, owner: Address) {\n return this.getContract().write.redeem([shares, receiver, owner], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Set the validators ETH.\n *\n * @param restakedValidatorsETH The amount of restaked validator ETH.\n * @param nonRestakedValidatorsETH The amount of non-restaked validator ETH.\n */\n public setValidatorsETH(\n restakedValidatorsETH: bigint,\n nonRestakedValidatorsETH: bigint,\n ) {\n return this.getContract().write.setValidatorsETH(\n [restakedValidatorsETH, nonRestakedValidatorsETH],\n {\n account: this.walletClient.account!,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Start the non-restaking validators.\n *\n * @param pubKeys The public keys of the validators.\n * @param signatures The signatures of the validators.\n * @param amountsInGwei The amounts of the validators.\n * @param depositDataRoots The deposit data roots of the validators.\n */\n public startNonRestakingValidators(\n pubKeys: Address[],\n signatures: Address[],\n amountsInGwei: bigint[],\n depositDataRoots: Address[],\n ) {\n return this.getContract().write.startNonRestakingValidators(\n [pubKeys, signatures, amountsInGwei, depositDataRoots],\n {\n account: this.walletClient.account!,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Start the restaking validators.\n *\n * @param pubKeys The public keys of the validators.\n * @param signatures The signatures of the validators.\n * @param amountsInGwei The amounts of the validators.\n * @param depositDataRoots The deposit data roots of the validators.\n */\n public startRestakingValidators(\n pubKeys: Address[],\n signatures: Address[],\n amountsInGwei: bigint[],\n depositDataRoots: Address[],\n ) {\n return this.getContract().write.startRestakingValidators(\n [pubKeys, signatures, amountsInGwei, depositDataRoots],\n {\n account: this.walletClient.account!,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Withdraw the assets to the receiver.\n *\n * @param assets The number of assets to withdraw.\n * @param receiver The address to receive the assets.\n * @param owner The owner of the assets.\n */\n public withdraw(assets: bigint, receiver: Address, owner: Address) {\n return this.getContract().write.withdraw([assets, receiver, owner], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Get the symbol of the contract.\n *\n * @returns The symbol of the contract.\n */\n public symbol() {\n return this.getContract().read.symbol();\n }\n\n /**\n * Get the total assets of the vault.\n *\n * @returns The total assets of the vault.\n */\n public totalAssets() {\n return this.getContract().read.totalAssets();\n }\n\n /**\n * Get the total supply of the vault.\n *\n * @returns The total supply of the vault.\n */\n public totalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Transfer the value to the to address.\n *\n * @param to The address to transfer the value to.\n * @param value The amount of value to transfer.\n */\n public transfer(to: Address, value: bigint) {\n return this.getContract().write.transfer([to, value], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Transfer the value from the from address to the to address.\n *\n * @param from The address to transfer the value from.\n * @param to The address to transfer the value to.\n * @param value The amount of value to transfer.\n */\n public transferFrom(from: Address, to: Address, value: bigint) {\n return this.getContract().write.transferFrom([from, to, value], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Call a custom external function.\n *\n * @param target The target contract address.\n * @param data The calldata to send a transaction to the target contract.\n * @param value The amount of value to send to the target contract.\n */\n public customExternalCall(target: Address, data: Hex, value: bigint) {\n return this.getContract().write.customExternalCall([target, data, value], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Request EigenPod consolidation.\n *\n * @param srcPubkeys The source public keys.\n * @param targetPubkeys The target public keys.\n * @param value The amount to send to the target contract (small quantity of GWei)\n */\n public requestEigenPodConsolidation(\n srcPubkeys: Address[],\n targetPubkeys: Address[],\n value: bigint,\n ) {\n return this.getContract().write.requestEigenPodConsolidation(\n [srcPubkeys, targetPubkeys],\n {\n account: this.walletClient.account!,\n chain: this.viemChain,\n value,\n },\n );\n }\n}\n"],"names":["InstitutionalVaultHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","InvalidContractAddressError","abi","InstitutionalVault","client","getContract","owner","spender","amount","withdrawals","receiveAsTokens","shares","assets","receiver","value","restakedValidatorsETH","nonRestakedValidatorsETH","pubKeys","signatures","amountsInGwei","depositDataRoots","to","from","target","data","srcPubkeys","targetPubkeys"],"mappings":"obA2BO,MAAMA,CAA0B,CAcrC,YACEC,EACQC,EACAC,EACR,CAjBMC,EAAA,kBACAA,EAAA,gBAcE,KAAA,aAAAF,EACA,KAAA,aAAAC,EAEH,KAAA,UAAYE,cAAYJ,CAAK,CAAA,CAS7B,YAAYK,EAAkB,CACnC,YAAK,QAAUA,EAER,IAAA,CAQF,YAAa,CAClB,OAAO,KAAK,OAAA,CASP,aAAc,CACf,GAAA,CAAC,KAAK,QACR,MAAM,IAAIC,EAAA,4BACR,wCACA,CACE,WAAY,wEAAA,CAEhB,EAGF,MAAMC,EAAMC,EAAA,mBACNC,EAAS,CAAE,OAAQ,KAAK,aAAc,OAAQ,KAAK,YAAa,EAEtE,OAAOC,cAAY,CACjB,QAAS,KAAK,QACd,IAAAH,EACA,OAAAE,CAAA,C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EAAIP,CAAK,EAAG,CACpD,QAAS,KAAK,aAAa,QAC3B,MAAO,KAAK,SAAA,CACb,CAAA,CAUI,aAAaQ,EAAeD,EAAaP,EAAe,CACtD,OAAA,KAAK,cAAc,MAAM,aAAa,CAACQ,EAAMD,EAAIP,CAAK,EAAG,CAC9D,QAAS,KAAK,aAAa,QAC3B,MAAO,KAAK,SAAA,CACb,CAAA,CAUI,mBAAmBS,EAAiBC,EAAWV,EAAe,CAC5D,OAAA,KAAK,cAAc,MAAM,mBAAmB,CAACS,EAAQC,EAAMV,CAAK,EAAG,CACxE,QAAS,KAAK,aAAa,QAC3B,MAAO,KAAK,SAAA,CACb,CAAA,CAUI,6BACLW,EACAC,EACAZ,EACA,CACO,OAAA,KAAK,cAAc,MAAM,6BAC9B,CAACW,EAAYC,CAAa,EAC1B,CACE,QAAS,KAAK,aAAa,QAC3B,MAAO,KAAK,UACZ,MAAAZ,CAAA,CAEJ,CAAA,CAEJ"}
@@ -15572,6 +15572,7 @@ export declare class InstitutionalVaultHandler {
15572
15572
  *
15573
15573
  * @param srcPubkeys The source public keys.
15574
15574
  * @param targetPubkeys The target public keys.
15575
+ * @param value The amount to send to the target contract (small quantity of GWei)
15575
15576
  */
15576
- requestEigenPodConsolidation(srcPubkeys: Address[], targetPubkeys: Address[]): Promise<`0x${string}`>;
15577
+ requestEigenPodConsolidation(srcPubkeys: Address[], targetPubkeys: Address[], value: bigint): Promise<`0x${string}`>;
15577
15578
  }
@@ -473,11 +473,16 @@ class p {
473
473
  *
474
474
  * @param srcPubkeys The source public keys.
475
475
  * @param targetPubkeys The target public keys.
476
+ * @param value The amount to send to the target contract (small quantity of GWei)
476
477
  */
477
- requestEigenPodConsolidation(t, e) {
478
+ requestEigenPodConsolidation(t, e, a) {
478
479
  return this.getContract().write.requestEigenPodConsolidation(
479
480
  [t, e],
480
- { account: this.walletClient.account, chain: this.viemChain }
481
+ {
482
+ account: this.walletClient.account,
483
+ chain: this.viemChain,
484
+ value: a
485
+ }
481
486
  );
482
487
  }
483
488
  }
@@ -1 +1 @@
1
- {"version":3,"file":"institutional-vault-handler.js","sources":["../../../lib/contracts/handlers/institutional-vault-handler.ts"],"sourcesContent":["import {\n Chain as ViemChain,\n WalletClient,\n PublicClient,\n getContract,\n GetContractReturnType,\n Address,\n Hex,\n} from 'viem';\nimport { InstitutionalVault } from '../abis/mainnet/InstitutionalVault';\nimport { Chain, VIEM_CHAINS } from '../../chains/constants';\nimport { InvalidContractAddressError } from '../../errors/validation-errors';\n\nexport type QueuedWithdrawal = {\n staker: Address;\n delegatedTo: Address;\n withdrawer: Address;\n nonce: bigint;\n startBlock: number;\n strategies: Address[];\n scaledShares: bigint[];\n};\n\n/**\n * Handler for the `InstitutionalVault` contract exposing methods to\n * interact with the contract.\n */\nexport class InstitutionalVaultHandler {\n private viemChain: ViemChain;\n private address?: Address;\n\n /**\n * Create the handler for the `InstitutionalVault` contract exposing\n * methods to 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 chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n }\n\n /**\n * Set the address of the contract for this handler.\n *\n * @param address The address of the contract.\n * @returns The handler.\n */\n public withAddress(address: Address) {\n this.address = address;\n\n return this;\n }\n\n /**\n * Get the address of the contract for this handler.\n *\n * @returns The address of the contract.\n */\n public getAddress() {\n return this.address;\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 if (!this.address) {\n throw new InvalidContractAddressError(\n `No address specified for the contract`,\n {\n fixMessage: `Set the contract address in the handler by using the setAddress method`,\n },\n );\n }\n\n const abi = InstitutionalVault;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({\n address: this.address,\n abi,\n client,\n }) as GetContractReturnType<typeof abi, typeof client, Address>;\n }\n\n /**\n * Get the beacon deposit contract address.\n *\n * @returns The beacon deposit contract address.\n */\n public getBeaconDepositContract() {\n return this.getContract().read.BEACON_DEPOSIT_CONTRACT();\n }\n\n /**\n * Get the eigen delegation manager contract address.\n *\n * @returns The eigen delegation manager.\n */\n public getEigenDelegationManager() {\n return this.getContract().read.EIGEN_DELEGATION_MANAGER();\n }\n\n /**\n * Get the eigen pod manager contract address.\n *\n * @returns The eigen pod manager contract address.\n */\n public getEigenPodManager() {\n return this.getContract().read.EIGEN_POD_MANAGER();\n }\n\n /**\n * Get the eigen pod address.\n *\n * @returns The eigen pod address.\n */\n public getEigenPod() {\n return this.getContract().read.getEigenPod();\n }\n\n /**\n * Get the allowance for the spender to spend the owner's tokens.\n *\n * @param owner The owner of the tokens.\n * @param spender The spender of the tokens.\n * @returns The allowance of the owner for the spender.\n */\n public allowance(owner: Address, spender: Address) {\n return this.getContract().read.allowance([owner, spender]);\n }\n\n /**\n * Approve the spender to spend the owner's tokens.\n *\n * @param spender The spender of the tokens.\n * @param amount The amount of tokens to approve.\n */\n public approve(spender: Address, amount: bigint) {\n return this.getContract().write.approve([spender, amount], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Get the asset of the vault.\n *\n * @returns The asset of the vault.\n */\n public asset() {\n return this.getContract().read.asset();\n }\n\n /**\n * Get the authority of the vault.\n *\n * @returns The authority of the vault.\n */\n public authority() {\n return this.getContract().read.authority();\n }\n\n /**\n * Get the balance of the address.\n *\n * @param address The address to get the balance of.\n * @returns The balance of the address.\n */\n public balanceOf(address: Address) {\n return this.getContract().read.balanceOf([address]);\n }\n\n /**\n * Get the number of decimals of the token.\n *\n * @returns The number of decimals of the token.\n */\n public decimals() {\n return this.getContract().read.decimals();\n }\n\n /**\n * Complete the queued withdrawals.\n *\n * @param withdrawals The withdrawals to complete.\n * @param receiveAsTokens Whether to receive the assets as tokens.\n */\n public completeQueuedWithdrawals(\n withdrawals: QueuedWithdrawal[],\n receiveAsTokens: boolean[],\n ) {\n return this.getContract().write.completeQueuedWithdrawals(\n [withdrawals, receiveAsTokens],\n {\n account: this.walletClient.account!,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Convert shares to assets.\n *\n * @param shares The number of shares to convert.\n * @returns The number of assets.\n */\n public convertToAssets(shares: bigint) {\n return this.getContract().read.convertToAssets([shares]);\n }\n\n /**\n * Convert assets to shares.\n *\n * @param assets The number of assets to convert.\n * @returns The number of shares.\n */\n public convertToShares(assets: bigint) {\n return this.getContract().read.convertToShares([assets]);\n }\n\n /**\n * Deposit assets into the vault.\n *\n * @param assets The number of assets to deposit.\n * @param receiver The address to receive the shares.\n */\n public deposit(assets: bigint, receiver: Address) {\n return this.getContract().write.deposit([assets, receiver], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Deposit ETH into the vault.\n *\n * @param receiver The address to receive the shares.\n * @param value The amount of ETH to deposit.\n */\n public depositETH(receiver: Address, value: bigint) {\n return this.getContract().write.depositETH([receiver], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n value,\n });\n }\n\n /**\n * Get the non-restaked validator ETH.\n *\n * @returns The non-restaked validator ETH.\n */\n public getNonRestakedValidatorETH() {\n return this.getContract().read.getNonRestakedValidatorETH();\n }\n\n /**\n * Get the restaked validator ETH.\n *\n * @returns The restaked validator ETH.\n */\n public getRestakedValidatorETH() {\n return this.getContract().read.getRestakedValidatorETH();\n }\n\n /**\n * Get the withdrawal credentials.\n *\n * @returns The withdrawal credentials.\n */\n public getWithdrawalCredentials() {\n return this.getContract().read.getWithdrawalCredentials();\n }\n\n /**\n * Get the maximum deposit amount for the address.\n *\n * @param address The address to get the maximum deposit amount for.\n * @returns The maximum deposit amount for the address.\n */\n public maxDeposit(address: Address) {\n return this.getContract().read.maxDeposit([address]);\n }\n\n /**\n * Get the maximum mint amount for the address.\n *\n * @param address The address to get the maximum mint amount for.\n * @returns The maximum mint amount for the address.\n */\n public maxMint(address: Address) {\n return this.getContract().read.maxMint([address]);\n }\n\n /**\n * Get the maximum redeem amount for the address.\n *\n * @param address The address to get the maximum redeem amount for.\n * @returns The maximum redeem amount for the address.\n */\n public maxRedeem(address: Address) {\n return this.getContract().read.maxRedeem([address]);\n }\n\n /**\n * Get the maximum withdraw amount for the address.\n *\n * @param address The address to get the maximum withdraw amount for.\n * @returns The maximum withdraw amount for the address.\n */\n public maxWithdraw(address: Address) {\n return this.getContract().read.maxWithdraw([address]);\n }\n\n /**\n * Mint shares to the receiver.\n *\n * @param shares The number of shares to mint.\n * @param receiver The address to receive the shares.\n */\n public mint(shares: bigint, receiver: Address) {\n return this.getContract().write.mint([shares, receiver], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Get the name of the contract.\n *\n * @returns The name of the contract.\n */\n public name() {\n return this.getContract().read.name();\n }\n\n /**\n * Preview the deposit amount for the assets.\n *\n * @param assets The number of assets to deposit.\n * @returns The number of shares to receive.\n */\n public previewDeposit(assets: bigint) {\n return this.getContract().read.previewDeposit([assets]);\n }\n\n /**\n * Preview the mint amount for the shares.\n *\n * @param shares The number of shares to mint.\n * @returns The number of assets to receive.\n */\n public previewMint(shares: bigint) {\n return this.getContract().read.previewMint([shares]);\n }\n\n /**\n * Preview the redeem amount for the shares.\n *\n * @param shares The number of shares to redeem.\n * @returns The number of assets to receive.\n */\n public previewRedeem(shares: bigint) {\n return this.getContract().read.previewRedeem([shares]);\n }\n\n /**\n * Preview the withdraw amount for the shares.\n *\n * @param shares The number of shares to withdraw.\n * @returns The number of assets to receive.\n */\n public previewWithdraw(shares: bigint) {\n return this.getContract().read.previewWithdraw([shares]);\n }\n\n /**\n * Queue the withdrawals.\n *\n * @param shares The number of shares to withdraw.\n */\n public queueWithdrawals(shares: bigint) {\n return this.getContract().write.queueWithdrawals([shares], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Redeem the shares to the receiver.\n *\n * @param shares The number of shares to redeem.\n * @param receiver The address to receive the assets.\n * @param owner The owner of the shares.\n */\n public redeem(shares: bigint, receiver: Address, owner: Address) {\n return this.getContract().write.redeem([shares, receiver, owner], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Set the validators ETH.\n *\n * @param restakedValidatorsETH The amount of restaked validator ETH.\n * @param nonRestakedValidatorsETH The amount of non-restaked validator ETH.\n */\n public setValidatorsETH(\n restakedValidatorsETH: bigint,\n nonRestakedValidatorsETH: bigint,\n ) {\n return this.getContract().write.setValidatorsETH(\n [restakedValidatorsETH, nonRestakedValidatorsETH],\n {\n account: this.walletClient.account!,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Start the non-restaking validators.\n *\n * @param pubKeys The public keys of the validators.\n * @param signatures The signatures of the validators.\n * @param amountsInGwei The amounts of the validators.\n * @param depositDataRoots The deposit data roots of the validators.\n */\n public startNonRestakingValidators(\n pubKeys: Address[],\n signatures: Address[],\n amountsInGwei: bigint[],\n depositDataRoots: Address[],\n ) {\n return this.getContract().write.startNonRestakingValidators(\n [pubKeys, signatures, amountsInGwei, depositDataRoots],\n {\n account: this.walletClient.account!,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Start the restaking validators.\n *\n * @param pubKeys The public keys of the validators.\n * @param signatures The signatures of the validators.\n * @param amountsInGwei The amounts of the validators.\n * @param depositDataRoots The deposit data roots of the validators.\n */\n public startRestakingValidators(\n pubKeys: Address[],\n signatures: Address[],\n amountsInGwei: bigint[],\n depositDataRoots: Address[],\n ) {\n return this.getContract().write.startRestakingValidators(\n [pubKeys, signatures, amountsInGwei, depositDataRoots],\n {\n account: this.walletClient.account!,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Withdraw the assets to the receiver.\n *\n * @param assets The number of assets to withdraw.\n * @param receiver The address to receive the assets.\n * @param owner The owner of the assets.\n */\n public withdraw(assets: bigint, receiver: Address, owner: Address) {\n return this.getContract().write.withdraw([assets, receiver, owner], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Get the symbol of the contract.\n *\n * @returns The symbol of the contract.\n */\n public symbol() {\n return this.getContract().read.symbol();\n }\n\n /**\n * Get the total assets of the vault.\n *\n * @returns The total assets of the vault.\n */\n public totalAssets() {\n return this.getContract().read.totalAssets();\n }\n\n /**\n * Get the total supply of the vault.\n *\n * @returns The total supply of the vault.\n */\n public totalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Transfer the value to the to address.\n *\n * @param to The address to transfer the value to.\n * @param value The amount of value to transfer.\n */\n public transfer(to: Address, value: bigint) {\n return this.getContract().write.transfer([to, value], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Transfer the value from the from address to the to address.\n *\n * @param from The address to transfer the value from.\n * @param to The address to transfer the value to.\n * @param value The amount of value to transfer.\n */\n public transferFrom(from: Address, to: Address, value: bigint) {\n return this.getContract().write.transferFrom([from, to, value], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Call a custom external function.\n *\n * @param target The target contract address.\n * @param data The calldata to send a transaction to the target contract.\n * @param value The amount of value to send to the target contract.\n */\n public customExternalCall(target: Address, data: Hex, value: bigint) {\n return this.getContract().write.customExternalCall([target, data, value], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Request EigenPod consolidation.\n *\n * @param srcPubkeys The source public keys.\n * @param targetPubkeys The target public keys.\n */\n public requestEigenPodConsolidation(\n srcPubkeys: Address[],\n targetPubkeys: Address[],\n ) {\n return this.getContract().write.requestEigenPodConsolidation(\n [srcPubkeys, targetPubkeys],\n { account: this.walletClient.account!, chain: this.viemChain },\n );\n }\n}\n"],"names":["InstitutionalVaultHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","InvalidContractAddressError","abi","InstitutionalVault","client","getContract","owner","spender","amount","withdrawals","receiveAsTokens","shares","assets","receiver","value","restakedValidatorsETH","nonRestakedValidatorsETH","pubKeys","signatures","amountsInGwei","depositDataRoots","to","from","target","data","srcPubkeys","target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ts"],"sourcesContent":["import {\n Chain as ViemChain,\n WalletClient,\n PublicClient,\n getContract,\n GetContractReturnType,\n Address,\n Hex,\n} from 'viem';\nimport { InstitutionalVault } from '../abis/mainnet/InstitutionalVault';\nimport { Chain, VIEM_CHAINS } from '../../chains/constants';\nimport { InvalidContractAddressError } from '../../errors/validation-errors';\n\nexport type QueuedWithdrawal = {\n staker: Address;\n delegatedTo: Address;\n withdrawer: Address;\n nonce: bigint;\n startBlock: number;\n strategies: Address[];\n scaledShares: bigint[];\n};\n\n/**\n * Handler for the `InstitutionalVault` contract exposing methods to\n * interact with the contract.\n */\nexport class InstitutionalVaultHandler {\n private viemChain: ViemChain;\n private address?: Address;\n\n /**\n * Create the handler for the `InstitutionalVault` contract exposing\n * methods to 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 chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n }\n\n /**\n * Set the address of the contract for this handler.\n *\n * @param address The address of the contract.\n * @returns The handler.\n */\n public withAddress(address: Address) {\n this.address = address;\n\n return this;\n }\n\n /**\n * Get the address of the contract for this handler.\n *\n * @returns The address of the contract.\n */\n public getAddress() {\n return this.address;\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 if (!this.address) {\n throw new InvalidContractAddressError(\n `No address specified for the contract`,\n {\n fixMessage: `Set the contract address in the handler by using the setAddress method`,\n },\n );\n }\n\n const abi = InstitutionalVault;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({\n address: this.address,\n abi,\n client,\n }) as GetContractReturnType<typeof abi, typeof client, Address>;\n }\n\n /**\n * Get the beacon deposit contract address.\n *\n * @returns The beacon deposit contract address.\n */\n public getBeaconDepositContract() {\n return this.getContract().read.BEACON_DEPOSIT_CONTRACT();\n }\n\n /**\n * Get the eigen delegation manager contract address.\n *\n * @returns The eigen delegation manager.\n */\n public getEigenDelegationManager() {\n return this.getContract().read.EIGEN_DELEGATION_MANAGER();\n }\n\n /**\n * Get the eigen pod manager contract address.\n *\n * @returns The eigen pod manager contract address.\n */\n public getEigenPodManager() {\n return this.getContract().read.EIGEN_POD_MANAGER();\n }\n\n /**\n * Get the eigen pod address.\n *\n * @returns The eigen pod address.\n */\n public getEigenPod() {\n return this.getContract().read.getEigenPod();\n }\n\n /**\n * Get the allowance for the spender to spend the owner's tokens.\n *\n * @param owner The owner of the tokens.\n * @param spender The spender of the tokens.\n * @returns The allowance of the owner for the spender.\n */\n public allowance(owner: Address, spender: Address) {\n return this.getContract().read.allowance([owner, spender]);\n }\n\n /**\n * Approve the spender to spend the owner's tokens.\n *\n * @param spender The spender of the tokens.\n * @param amount The amount of tokens to approve.\n */\n public approve(spender: Address, amount: bigint) {\n return this.getContract().write.approve([spender, amount], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Get the asset of the vault.\n *\n * @returns The asset of the vault.\n */\n public asset() {\n return this.getContract().read.asset();\n }\n\n /**\n * Get the authority of the vault.\n *\n * @returns The authority of the vault.\n */\n public authority() {\n return this.getContract().read.authority();\n }\n\n /**\n * Get the balance of the address.\n *\n * @param address The address to get the balance of.\n * @returns The balance of the address.\n */\n public balanceOf(address: Address) {\n return this.getContract().read.balanceOf([address]);\n }\n\n /**\n * Get the number of decimals of the token.\n *\n * @returns The number of decimals of the token.\n */\n public decimals() {\n return this.getContract().read.decimals();\n }\n\n /**\n * Complete the queued withdrawals.\n *\n * @param withdrawals The withdrawals to complete.\n * @param receiveAsTokens Whether to receive the assets as tokens.\n */\n public completeQueuedWithdrawals(\n withdrawals: QueuedWithdrawal[],\n receiveAsTokens: boolean[],\n ) {\n return this.getContract().write.completeQueuedWithdrawals(\n [withdrawals, receiveAsTokens],\n {\n account: this.walletClient.account!,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Convert shares to assets.\n *\n * @param shares The number of shares to convert.\n * @returns The number of assets.\n */\n public convertToAssets(shares: bigint) {\n return this.getContract().read.convertToAssets([shares]);\n }\n\n /**\n * Convert assets to shares.\n *\n * @param assets The number of assets to convert.\n * @returns The number of shares.\n */\n public convertToShares(assets: bigint) {\n return this.getContract().read.convertToShares([assets]);\n }\n\n /**\n * Deposit assets into the vault.\n *\n * @param assets The number of assets to deposit.\n * @param receiver The address to receive the shares.\n */\n public deposit(assets: bigint, receiver: Address) {\n return this.getContract().write.deposit([assets, receiver], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Deposit ETH into the vault.\n *\n * @param receiver The address to receive the shares.\n * @param value The amount of ETH to deposit.\n */\n public depositETH(receiver: Address, value: bigint) {\n return this.getContract().write.depositETH([receiver], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n value,\n });\n }\n\n /**\n * Get the non-restaked validator ETH.\n *\n * @returns The non-restaked validator ETH.\n */\n public getNonRestakedValidatorETH() {\n return this.getContract().read.getNonRestakedValidatorETH();\n }\n\n /**\n * Get the restaked validator ETH.\n *\n * @returns The restaked validator ETH.\n */\n public getRestakedValidatorETH() {\n return this.getContract().read.getRestakedValidatorETH();\n }\n\n /**\n * Get the withdrawal credentials.\n *\n * @returns The withdrawal credentials.\n */\n public getWithdrawalCredentials() {\n return this.getContract().read.getWithdrawalCredentials();\n }\n\n /**\n * Get the maximum deposit amount for the address.\n *\n * @param address The address to get the maximum deposit amount for.\n * @returns The maximum deposit amount for the address.\n */\n public maxDeposit(address: Address) {\n return this.getContract().read.maxDeposit([address]);\n }\n\n /**\n * Get the maximum mint amount for the address.\n *\n * @param address The address to get the maximum mint amount for.\n * @returns The maximum mint amount for the address.\n */\n public maxMint(address: Address) {\n return this.getContract().read.maxMint([address]);\n }\n\n /**\n * Get the maximum redeem amount for the address.\n *\n * @param address The address to get the maximum redeem amount for.\n * @returns The maximum redeem amount for the address.\n */\n public maxRedeem(address: Address) {\n return this.getContract().read.maxRedeem([address]);\n }\n\n /**\n * Get the maximum withdraw amount for the address.\n *\n * @param address The address to get the maximum withdraw amount for.\n * @returns The maximum withdraw amount for the address.\n */\n public maxWithdraw(address: Address) {\n return this.getContract().read.maxWithdraw([address]);\n }\n\n /**\n * Mint shares to the receiver.\n *\n * @param shares The number of shares to mint.\n * @param receiver The address to receive the shares.\n */\n public mint(shares: bigint, receiver: Address) {\n return this.getContract().write.mint([shares, receiver], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Get the name of the contract.\n *\n * @returns The name of the contract.\n */\n public name() {\n return this.getContract().read.name();\n }\n\n /**\n * Preview the deposit amount for the assets.\n *\n * @param assets The number of assets to deposit.\n * @returns The number of shares to receive.\n */\n public previewDeposit(assets: bigint) {\n return this.getContract().read.previewDeposit([assets]);\n }\n\n /**\n * Preview the mint amount for the shares.\n *\n * @param shares The number of shares to mint.\n * @returns The number of assets to receive.\n */\n public previewMint(shares: bigint) {\n return this.getContract().read.previewMint([shares]);\n }\n\n /**\n * Preview the redeem amount for the shares.\n *\n * @param shares The number of shares to redeem.\n * @returns The number of assets to receive.\n */\n public previewRedeem(shares: bigint) {\n return this.getContract().read.previewRedeem([shares]);\n }\n\n /**\n * Preview the withdraw amount for the shares.\n *\n * @param shares The number of shares to withdraw.\n * @returns The number of assets to receive.\n */\n public previewWithdraw(shares: bigint) {\n return this.getContract().read.previewWithdraw([shares]);\n }\n\n /**\n * Queue the withdrawals.\n *\n * @param shares The number of shares to withdraw.\n */\n public queueWithdrawals(shares: bigint) {\n return this.getContract().write.queueWithdrawals([shares], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Redeem the shares to the receiver.\n *\n * @param shares The number of shares to redeem.\n * @param receiver The address to receive the assets.\n * @param owner The owner of the shares.\n */\n public redeem(shares: bigint, receiver: Address, owner: Address) {\n return this.getContract().write.redeem([shares, receiver, owner], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Set the validators ETH.\n *\n * @param restakedValidatorsETH The amount of restaked validator ETH.\n * @param nonRestakedValidatorsETH The amount of non-restaked validator ETH.\n */\n public setValidatorsETH(\n restakedValidatorsETH: bigint,\n nonRestakedValidatorsETH: bigint,\n ) {\n return this.getContract().write.setValidatorsETH(\n [restakedValidatorsETH, nonRestakedValidatorsETH],\n {\n account: this.walletClient.account!,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Start the non-restaking validators.\n *\n * @param pubKeys The public keys of the validators.\n * @param signatures The signatures of the validators.\n * @param amountsInGwei The amounts of the validators.\n * @param depositDataRoots The deposit data roots of the validators.\n */\n public startNonRestakingValidators(\n pubKeys: Address[],\n signatures: Address[],\n amountsInGwei: bigint[],\n depositDataRoots: Address[],\n ) {\n return this.getContract().write.startNonRestakingValidators(\n [pubKeys, signatures, amountsInGwei, depositDataRoots],\n {\n account: this.walletClient.account!,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Start the restaking validators.\n *\n * @param pubKeys The public keys of the validators.\n * @param signatures The signatures of the validators.\n * @param amountsInGwei The amounts of the validators.\n * @param depositDataRoots The deposit data roots of the validators.\n */\n public startRestakingValidators(\n pubKeys: Address[],\n signatures: Address[],\n amountsInGwei: bigint[],\n depositDataRoots: Address[],\n ) {\n return this.getContract().write.startRestakingValidators(\n [pubKeys, signatures, amountsInGwei, depositDataRoots],\n {\n account: this.walletClient.account!,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Withdraw the assets to the receiver.\n *\n * @param assets The number of assets to withdraw.\n * @param receiver The address to receive the assets.\n * @param owner The owner of the assets.\n */\n public withdraw(assets: bigint, receiver: Address, owner: Address) {\n return this.getContract().write.withdraw([assets, receiver, owner], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Get the symbol of the contract.\n *\n * @returns The symbol of the contract.\n */\n public symbol() {\n return this.getContract().read.symbol();\n }\n\n /**\n * Get the total assets of the vault.\n *\n * @returns The total assets of the vault.\n */\n public totalAssets() {\n return this.getContract().read.totalAssets();\n }\n\n /**\n * Get the total supply of the vault.\n *\n * @returns The total supply of the vault.\n */\n public totalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Transfer the value to the to address.\n *\n * @param to The address to transfer the value to.\n * @param value The amount of value to transfer.\n */\n public transfer(to: Address, value: bigint) {\n return this.getContract().write.transfer([to, value], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Transfer the value from the from address to the to address.\n *\n * @param from The address to transfer the value from.\n * @param to The address to transfer the value to.\n * @param value The amount of value to transfer.\n */\n public transferFrom(from: Address, to: Address, value: bigint) {\n return this.getContract().write.transferFrom([from, to, value], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Call a custom external function.\n *\n * @param target The target contract address.\n * @param data The calldata to send a transaction to the target contract.\n * @param value The amount of value to send to the target contract.\n */\n public customExternalCall(target: Address, data: Hex, value: bigint) {\n return this.getContract().write.customExternalCall([target, data, value], {\n account: this.walletClient.account!,\n chain: this.viemChain,\n });\n }\n\n /**\n * Request EigenPod consolidation.\n *\n * @param srcPubkeys The source public keys.\n * @param targetPubkeys The target public keys.\n * @param value The amount to send to the target contract (small quantity of GWei)\n */\n public requestEigenPodConsolidation(\n srcPubkeys: Address[],\n targetPubkeys: Address[],\n value: bigint,\n ) {\n return this.getContract().write.requestEigenPodConsolidation(\n [srcPubkeys, targetPubkeys],\n {\n account: this.walletClient.account!,\n chain: this.viemChain,\n value,\n },\n );\n }\n}\n"],"names":["InstitutionalVaultHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","InvalidContractAddressError","abi","InstitutionalVault","client","getContract","owner","spender","amount","withdrawals","receiveAsTokens","shares","assets","receiver","value","restakedValidatorsETH","nonRestakedValidatorsETH","pubKeys","signatures","amountsInGwei","depositDataRoots","to","from","target","data","srcPubkeys","targetPubkeys"],"mappings":";;;;;;;AA2BO,MAAMA,EAA0B;AAAA;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r(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e;var n=(a,t,e)=>s(a,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../constants-JN89aXws.cjs"),o=require("../abis/mainnet/LagoonVault.cjs"),l=require("../tokens.cjs"),h=require("../vaults-addresses.cjs"),u=require("../../getContract-F-fd_vf7.cjs");class C{constructor(t,e,i){n(this,"viemChain");this.chain=t,this.walletClient=e,this.publicClient=i,this.viemChain=c.VIEM_CHAINS[t]}getContract(){const t=h.VAULTS_ADDRESSES[l.Token.tacpufETH][this.chain].LagoonVault,e=o.LagoonVault,i={public:this.publicClient,wallet:this.walletClient};return u.getContract({address:t,abi:e,client:i})}approve(t,e){return this.getContract().write.approve([t,e],{account:this.walletClient.account,chain:this.viemChain})}getAllowance(t,e){return this.getContract().read.allowance([t,e])}getBalance(t){return this.getContract().read.balanceOf([t])}getTotalSupply(){return this.getContract().read.totalSupply()}isTotalAssetsValid(){return this.getContract().read.isTotalAssetsValid()}symbol(){return this.getContract().read.symbol()}deposit(t,e,i){return i?this.getContract().write.deposit([t,e,i],{account:this.walletClient.account,chain:this.viemChain}):this.getContract().write.deposit([t,e],{account:this.walletClient.account,chain:this.viemChain})}syncDeposit(t,e,i=e){return this.getContract().write.syncDeposit([t,e,i],{account:this.walletClient.account,chain:this.viemChain})}requestDeposit(t,e,i=e){return this.getContract().write.requestDeposit([t,e,i],{account:this.walletClient.account,chain:this.viemChain,value:t})}withdraw(t,e,i=e){return this.getContract().write.withdraw([t,e,i],{account:this.walletClient.account,chain:this.viemChain})}redeem(t,e,i=e){return this.getContract().write.redeem([t,e,i],{account:this.walletClient.account,chain:this.viemChain})}requestRedeem(t,e,i=e){return this.getContract().write.requestRedeem([t,e,i],{account:this.walletClient.account,chain:this.viemChain})}previewDeposit(t){return this.getContract().read.previewDeposit([t])}previewWithdraw(t){return this.getContract().read.previewWithdraw([t])}previewRedeem(t){return this.getContract().read.previewRedeem([t])}}exports.LagoonVaultHandler=C;
2
+ //# sourceMappingURL=lagoon-vault-handler.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lagoon-vault-handler.cjs","sources":["../../../lib/contracts/handlers/lagoon-vault-handler.ts"],"sourcesContent":["import {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n Account,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { LagoonVault } from '../abis/mainnet/LagoonVault';\nimport { Token } from '../tokens';\nimport { VAULTS_ADDRESSES } from '../vaults-addresses';\n\n/**\n * Handler for the `LagoonVault` contract exposing methods to interact\n * with the contract.\n */\nexport class LagoonVaultHandler {\n private viemChain: ViemChain;\n\n /**\n * Create the handler for processing Lagoon vault.\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.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = VAULTS_ADDRESSES[Token.tacpufETH][this.chain]\n .LagoonVault as Address;\n const abi = LagoonVault;\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 * Approve a spender to spend the token.\n *\n * @param spender The spender of the token.\n * @param amount The amount to approve.\n * @returns The transaction.\n */\n public approve(spender: Address, amount: bigint) {\n return this.getContract().write.approve([spender, amount], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Get the allowance of the owner for the spender.\n *\n * @param owner The owner of the allowance.\n * @param spender The spender of the allowance.\n * @returns The allowance.\n */\n public getAllowance(owner: Address, spender: Address) {\n return this.getContract().read.allowance([owner, spender]);\n }\n\n /**\n * Get the balance for the address.\n *\n * @param address The address to get the balance of.\n * @returns The balance.\n */\n public getBalance(address: Address) {\n return this.getContract().read.balanceOf([address]);\n }\n\n /**\n * Get the total supply of the token.\n *\n * @returns The total supply.\n */\n public getTotalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Check if the total assets are valid. Used for checking if\n * synchronous deposit is possible.\n *\n * @returns True if the total assets are valid, false otherwise.\n */\n public isTotalAssetsValid() {\n return this.getContract().read.isTotalAssetsValid();\n }\n\n /**\n * Get the symbol of the token. (tacpufETH)\n *\n * @returns The symbol.\n */\n public symbol() {\n return this.getContract().read.symbol();\n }\n\n /**\n * Deposit an amount of the assets (pufETH) to the vault to get shares\n * (tacpufETH).\n *\n * @param amount The amount to deposit.\n * @param receiver The receiver of the tacpufETH.\n * @param controller The optional controller of the deposit. Set to\n * the receiver if not sure.\n * @returns The transaction.\n */\n public deposit(amount: bigint, receiver: Address, controller?: Address) {\n if (controller) {\n return this.getContract().write.deposit([amount, receiver, controller], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n return this.getContract().write.deposit([amount, receiver], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Synchronously deposit an amount of the assets (pufETH) to the vault\n * to get shares (tacpufETH). This is only possible if `isTotalAssetsValid`\n * is true.\n *\n * @param amount The amount to deposit.\n * @param receiver The receiver of the tacpufETH.\n * @param referral The referral of the deposit. Falls back to the\n * receiver if not provided.\n * @returns The transaction.\n */\n public syncDeposit(\n amount: bigint,\n receiver: Address,\n referral: Address = receiver,\n ) {\n return this.getContract().write.syncDeposit([amount, receiver, referral], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Request an asynchronous deposit of an amount of the assets (pufETH)\n * to the vault to get shares (tacpufETH). This should be used if\n * `isTotalAssetsValid` is false.\n *\n * @param amount The amount to deposit.\n * @param receiver The receiver of the tacpufETH.\n * @param controller The optional controller of the deposit. Falls back\n * to the receiver if not provided.\n * @returns The transaction.\n */\n public requestDeposit(\n amount: bigint,\n receiver: Address,\n controller: Address = receiver,\n ) {\n return this.getContract().write.requestDeposit(\n [amount, receiver, controller],\n {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n value: amount,\n },\n );\n }\n\n /**\n * Withdraw an amount of the shares (pufETH) so the receiver\n * gets the assets (pufETH).\n *\n * @param assets The amount of assets (pufETH) to withdraw.\n * @param receiver The receiver of the assets.\n * @param controller The controller of the withdrawal. Falls back to\n * the receiver if not provided.\n * @returns The transaction.\n */\n public withdraw(\n assets: bigint,\n receiver: Address,\n controller: Address = receiver,\n ) {\n return this.getContract().write.withdraw([assets, receiver, controller], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Redeem an amount of the shares (tacpufETH) so the receiver\n * gets the assets (pufETH).\n *\n * @param shares The amount of shares (tacpufETH) to redeem.\n * @param receiver The receiver of the assets.\n * @param controller The controller of the withdrawal. Falls back to\n * the receiver if not provided.\n * @returns The transaction.\n */\n public redeem(\n shares: bigint,\n receiver: Address,\n controller: Address = receiver,\n ) {\n return this.getContract().write.redeem([shares, receiver, controller], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Request an asynchronous redeem of an amount of the shares (tacpufETH)\n * so the receiver gets the assets (pufETH).\n *\n * @param shares The amount of shares (tacpufETH) to redeem.\n * @param receiver The receiver of the assets.\n * @param controller The controller of the redemption. Falls back to\n * the receiver if not provided.\n * @returns The transaction.\n */\n public requestRedeem(\n shares: bigint,\n receiver: Address,\n controller: Address = receiver,\n ) {\n return this.getContract().write.requestRedeem(\n [shares, receiver, controller],\n {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Provides a preview of the number of shares that would be minted for\n * a given deposit amount, after fees.\n *\n * @param amount The amount to deposit.\n * @returns The preview.\n */\n public previewDeposit(amount: bigint) {\n return this.getContract().read.previewDeposit([amount]);\n }\n\n /**\n * Provides a preview of the number of shares (tacpufETH) that would be\n * burned for the given amount of assets (pufETH).\n *\n * @param assets The amount of assets (pufETH) to withdraw.\n * @returns The preview.\n */\n public previewWithdraw(assets: bigint) {\n return this.getContract().read.previewWithdraw([assets]);\n }\n\n /**\n * Provides a preview of the amount of assets (pufETH) that would be redeemed\n * for the given shares (tacpufETH), after withdrawal fees. Subtracts\n * the withdrawal fee from the share amount to determine the net\n * shares for asset conversion.\n *\n * @param shares The amount of shares (tacpufETH) to redeem.\n * @returns The preview.\n */\n public previewRedeem(shares: bigint) {\n return this.getContract().read.previewRedeem([shares]);\n }\n}\n"],"names":["LagoonVaultHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","VAULTS_ADDRESSES","Token","abi","LagoonVault","client","getContract","spender","amount","owner","receiver","controller","referral","assets","shares"],"mappings":"6bAiBO,MAAMA,CAAmB,CAY9B,YACUC,EACAC,EACAC,EACR,CAfMC,EAAA,kBAYE,KAAA,MAAAH,EACA,KAAA,aAAAC,EACA,KAAA,aAAAC,EAEH,KAAA,UAAYE,cAAYJ,CAAK,CAAA,CAQ7B,aAAc,CACnB,MAAMK,EAAUC,EAAAA,iBAAiBC,EAAA,MAAM,SAAS,EAAE,KAAK,KAAK,EACzD,YACGC,EAAMC,EAAA,YACNC,EAAS,CAAE,OAAQ,KAAK,aAAc,OAAQ,KAAK,YAAa,EAEtE,OAAOC,EAAY,YAAA,CAAE,QAAAN,EAAS,IAAAG,EAAK,OAAAE,EAAQ,CAAA,CActC,QAAQE,EAAkBC,EAAgB,CACxC,OAAA,KAAK,cAAc,MAAM,QAAQ,CAACD,EAASC,CAAM,EAAG,CACzD,QAAS,KAAK,aAAa,QAC3B,MAAO,KAAK,SAAA,CACb,CAAA,CAUI,aAAaC,EAAgBF,EAAkB,CAC7C,OAAA,KAAK,cAAc,KAAK,UAAU,CAACE,EAAOF,CAAO,CAAC,CAAA,CASpD,WAAWP,EAAkB,CAClC,OAAO,KAAK,YAAY,EAAE,KAAK,UAAU,CAACA,CAAO,CAAC,CAAA,CAQ7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