@pufferfinance/puffer-sdk 1.8.1 → 1.9.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 (197) hide show
  1. package/dist/api/puffer-client-helpers.cjs +1 -1
  2. package/dist/api/puffer-client-helpers.cjs.map +1 -1
  3. package/dist/api/puffer-client-helpers.js +82 -81
  4. package/dist/api/puffer-client-helpers.js.map +1 -1
  5. package/dist/api/puffer-client.cjs +1 -1
  6. package/dist/api/puffer-client.cjs.map +1 -1
  7. package/dist/api/puffer-client.d.ts +3 -0
  8. package/dist/api/puffer-client.js +56 -49
  9. package/dist/api/puffer-client.js.map +1 -1
  10. package/dist/ccip-BO_b9tFc.cjs +2 -0
  11. package/dist/ccip-BO_b9tFc.cjs.map +1 -0
  12. package/dist/ccip-DLDO0_x2.js +148 -0
  13. package/dist/ccip-DLDO0_x2.js.map +1 -0
  14. package/dist/chains/constants.cjs +1 -1
  15. package/dist/chains/constants.js +1 -1
  16. package/dist/constants-BjRNQpT2.js +1997 -0
  17. package/dist/constants-BjRNQpT2.js.map +1 -0
  18. package/dist/constants-DA2xUb9r.cjs +9 -0
  19. package/dist/constants-DA2xUb9r.cjs.map +1 -0
  20. package/dist/contracts/abis/holesky/PufferDepositor.cjs.map +1 -1
  21. package/dist/contracts/abis/holesky/PufferDepositor.js.map +1 -1
  22. package/dist/contracts/abis/holesky/PufferVaultV2.cjs.map +1 -1
  23. package/dist/contracts/abis/holesky/PufferVaultV2.js.map +1 -1
  24. package/dist/contracts/abis/l1-reward-manager-abis.cjs +1 -1
  25. package/dist/contracts/abis/l1-reward-manager-abis.cjs.map +1 -1
  26. package/dist/contracts/abis/l1-reward-manager-abis.js +1 -1
  27. package/dist/contracts/abis/l2-reward-manager-abis.cjs +1 -1
  28. package/dist/contracts/abis/l2-reward-manager-abis.cjs.map +1 -1
  29. package/dist/contracts/abis/l2-reward-manager-abis.js +1 -1
  30. package/dist/contracts/abis/mainnet/Accountant.cjs.map +1 -1
  31. package/dist/contracts/abis/mainnet/Accountant.js.map +1 -1
  32. package/dist/contracts/abis/mainnet/AtomicQueue.cjs +2 -0
  33. package/dist/contracts/abis/mainnet/AtomicQueue.cjs.map +1 -0
  34. package/dist/contracts/abis/mainnet/AtomicQueue.d.ts +328 -0
  35. package/dist/contracts/abis/mainnet/AtomicQueue.js +237 -0
  36. package/dist/contracts/abis/mainnet/AtomicQueue.js.map +1 -0
  37. package/dist/contracts/abis/mainnet/BoringVault.cjs.map +1 -1
  38. package/dist/contracts/abis/mainnet/BoringVault.js.map +1 -1
  39. package/dist/contracts/abis/mainnet/ERC20Permit.cjs.map +1 -1
  40. package/dist/contracts/abis/mainnet/ERC20Permit.js.map +1 -1
  41. package/dist/contracts/abis/mainnet/L1RewardManager.cjs.map +1 -1
  42. package/dist/contracts/abis/mainnet/L1RewardManager.js.map +1 -1
  43. package/dist/contracts/abis/mainnet/L2RewardManager.cjs.map +1 -1
  44. package/dist/contracts/abis/mainnet/L2RewardManager.js.map +1 -1
  45. package/dist/contracts/abis/mainnet/PufLocker.cjs.map +1 -1
  46. package/dist/contracts/abis/mainnet/PufLocker.js.map +1 -1
  47. package/dist/contracts/abis/mainnet/PufferDepositor.cjs.map +1 -1
  48. package/dist/contracts/abis/mainnet/PufferDepositor.js.map +1 -1
  49. package/dist/contracts/abis/mainnet/PufferL2Depositor.cjs.map +1 -1
  50. package/dist/contracts/abis/mainnet/PufferL2Depositor.js.map +1 -1
  51. package/dist/contracts/abis/mainnet/PufferVaultV2.cjs.map +1 -1
  52. package/dist/contracts/abis/mainnet/PufferVaultV2.js.map +1 -1
  53. package/dist/contracts/abis/mainnet/PufferWithdrawalManager.cjs.map +1 -1
  54. package/dist/contracts/abis/mainnet/PufferWithdrawalManager.js.map +1 -1
  55. package/dist/contracts/abis/mainnet/Teller.cjs.map +1 -1
  56. package/dist/contracts/abis/mainnet/Teller.js.map +1 -1
  57. package/dist/contracts/abis/nucleus-accountant-abis.cjs +1 -1
  58. package/dist/contracts/abis/nucleus-accountant-abis.cjs.map +1 -1
  59. package/dist/contracts/abis/nucleus-accountant-abis.js +1 -1
  60. package/dist/contracts/abis/nucleus-atomic-queue-abis.cjs +2 -0
  61. package/dist/contracts/abis/nucleus-atomic-queue-abis.cjs.map +1 -0
  62. package/dist/contracts/abis/nucleus-atomic-queue-abis.d.ts +332 -0
  63. package/dist/contracts/abis/nucleus-atomic-queue-abis.js +9 -0
  64. package/dist/contracts/abis/nucleus-atomic-queue-abis.js.map +1 -0
  65. package/dist/contracts/abis/nucleus-boring-vault-abis.cjs +1 -1
  66. package/dist/contracts/abis/nucleus-boring-vault-abis.cjs.map +1 -1
  67. package/dist/contracts/abis/nucleus-boring-vault-abis.js +1 -1
  68. package/dist/contracts/abis/nucleus-teller-abis.cjs +1 -1
  69. package/dist/contracts/abis/nucleus-teller-abis.cjs.map +1 -1
  70. package/dist/contracts/abis/nucleus-teller-abis.js +1 -1
  71. package/dist/contracts/abis/puf-locker-abis.cjs +1 -1
  72. package/dist/contracts/abis/puf-locker-abis.cjs.map +1 -1
  73. package/dist/contracts/abis/puf-locker-abis.js +1 -1
  74. package/dist/contracts/abis/puffer-depositor-abis.cjs +1 -1
  75. package/dist/contracts/abis/puffer-depositor-abis.cjs.map +1 -1
  76. package/dist/contracts/abis/puffer-depositor-abis.js +1 -1
  77. package/dist/contracts/abis/puffer-depositor-abis.js.map +1 -1
  78. package/dist/contracts/abis/puffer-vault-abis.cjs +1 -1
  79. package/dist/contracts/abis/puffer-vault-abis.cjs.map +1 -1
  80. package/dist/contracts/abis/puffer-vault-abis.js +1 -1
  81. package/dist/contracts/abis/puffer-vault-abis.js.map +1 -1
  82. package/dist/contracts/abis/puffer-withdrawal-manager-abis.cjs +1 -1
  83. package/dist/contracts/abis/puffer-withdrawal-manager-abis.cjs.map +1 -1
  84. package/dist/contracts/abis/puffer-withdrawal-manager-abis.js +1 -1
  85. package/dist/contracts/addresses.cjs +1 -1
  86. package/dist/contracts/addresses.cjs.map +1 -1
  87. package/dist/contracts/addresses.d.ts +14 -0
  88. package/dist/contracts/addresses.js +3 -2
  89. package/dist/contracts/addresses.js.map +1 -1
  90. package/dist/contracts/handlers/erc20-permit-handler.cjs +1 -1
  91. package/dist/contracts/handlers/erc20-permit-handler.cjs.map +1 -1
  92. package/dist/contracts/handlers/erc20-permit-handler.d.ts +11128 -2714
  93. package/dist/contracts/handlers/erc20-permit-handler.js +3 -3
  94. package/dist/contracts/handlers/erc20-permit-handler.js.map +1 -1
  95. package/dist/contracts/handlers/l1-reward-manager-handler.cjs +1 -1
  96. package/dist/contracts/handlers/l1-reward-manager-handler.cjs.map +1 -1
  97. package/dist/contracts/handlers/l1-reward-manager-handler.d.ts +11128 -2714
  98. package/dist/contracts/handlers/l1-reward-manager-handler.js +2 -2
  99. package/dist/contracts/handlers/l1-reward-manager-handler.js.map +1 -1
  100. package/dist/contracts/handlers/l2-reward-manager-handler.cjs +1 -1
  101. package/dist/contracts/handlers/l2-reward-manager-handler.cjs.map +1 -1
  102. package/dist/contracts/handlers/l2-reward-manager-handler.d.ts +11128 -2714
  103. package/dist/contracts/handlers/l2-reward-manager-handler.js +2 -2
  104. package/dist/contracts/handlers/l2-reward-manager-handler.js.map +1 -1
  105. package/dist/contracts/handlers/nucleus-accountant-handler.cjs +1 -1
  106. package/dist/contracts/handlers/nucleus-accountant-handler.cjs.map +1 -1
  107. package/dist/contracts/handlers/nucleus-accountant-handler.d.ts +11128 -2714
  108. package/dist/contracts/handlers/nucleus-accountant-handler.js +1 -1
  109. package/dist/contracts/handlers/nucleus-accountant-handler.js.map +1 -1
  110. package/dist/contracts/handlers/nucleus-atomic-queue-handler.cjs +2 -0
  111. package/dist/contracts/handlers/nucleus-atomic-queue-handler.cjs.map +1 -0
  112. package/dist/contracts/handlers/nucleus-atomic-queue-handler.d.ts +14923 -0
  113. package/dist/contracts/handlers/nucleus-atomic-queue-handler.js +89 -0
  114. package/dist/contracts/handlers/nucleus-atomic-queue-handler.js.map +1 -0
  115. package/dist/contracts/handlers/nucleus-boring-vault-handler.cjs +1 -1
  116. package/dist/contracts/handlers/nucleus-boring-vault-handler.cjs.map +1 -1
  117. package/dist/contracts/handlers/nucleus-boring-vault-handler.d.ts +11128 -2714
  118. package/dist/contracts/handlers/nucleus-boring-vault-handler.js +2 -2
  119. package/dist/contracts/handlers/nucleus-boring-vault-handler.js.map +1 -1
  120. package/dist/contracts/handlers/nucleus-teller-handler.cjs +1 -1
  121. package/dist/contracts/handlers/nucleus-teller-handler.cjs.map +1 -1
  122. package/dist/contracts/handlers/nucleus-teller-handler.d.ts +11128 -2714
  123. package/dist/contracts/handlers/nucleus-teller-handler.js +2 -2
  124. package/dist/contracts/handlers/nucleus-teller-handler.js.map +1 -1
  125. package/dist/contracts/handlers/puf-locker-handler.cjs +1 -1
  126. package/dist/contracts/handlers/puf-locker-handler.cjs.map +1 -1
  127. package/dist/contracts/handlers/puf-locker-handler.d.ts +11128 -2714
  128. package/dist/contracts/handlers/puf-locker-handler.js +2 -2
  129. package/dist/contracts/handlers/puf-locker-handler.js.map +1 -1
  130. package/dist/contracts/handlers/puffer-depositor-handler.cjs +1 -1
  131. package/dist/contracts/handlers/puffer-depositor-handler.cjs.map +1 -1
  132. package/dist/contracts/handlers/puffer-depositor-handler.d.ts +11128 -2714
  133. package/dist/contracts/handlers/puffer-depositor-handler.js +2 -2
  134. package/dist/contracts/handlers/puffer-depositor-handler.js.map +1 -1
  135. package/dist/contracts/handlers/puffer-l2-depositor-handler.cjs +1 -1
  136. package/dist/contracts/handlers/puffer-l2-depositor-handler.cjs.map +1 -1
  137. package/dist/contracts/handlers/puffer-l2-depositor-handler.d.ts +11128 -2714
  138. package/dist/contracts/handlers/puffer-l2-depositor-handler.js +2 -2
  139. package/dist/contracts/handlers/puffer-l2-depositor-handler.js.map +1 -1
  140. package/dist/contracts/handlers/puffer-vault-handler.cjs +1 -1
  141. package/dist/contracts/handlers/puffer-vault-handler.cjs.map +1 -1
  142. package/dist/contracts/handlers/puffer-vault-handler.d.ts +11128 -2714
  143. package/dist/contracts/handlers/puffer-vault-handler.js +2 -2
  144. package/dist/contracts/handlers/puffer-vault-handler.js.map +1 -1
  145. package/dist/contracts/handlers/puffer-withdrawal-manager-handler.cjs +1 -1
  146. package/dist/contracts/handlers/puffer-withdrawal-manager-handler.cjs.map +1 -1
  147. package/dist/contracts/handlers/puffer-withdrawal-manager-handler.d.ts +11128 -2714
  148. package/dist/contracts/handlers/puffer-withdrawal-manager-handler.js +2 -2
  149. package/dist/contracts/handlers/puffer-withdrawal-manager-handler.js.map +1 -1
  150. package/dist/contracts/tokens.cjs +1 -1
  151. package/dist/contracts/tokens.cjs.map +1 -1
  152. package/dist/contracts/tokens.js +1 -1
  153. package/dist/contracts/tokens.js.map +1 -1
  154. package/dist/createWalletClient-BuLYysrp.cjs +4 -0
  155. package/dist/createWalletClient-BuLYysrp.cjs.map +1 -0
  156. package/dist/createWalletClient-DNcW-ENe.js +2028 -0
  157. package/dist/createWalletClient-DNcW-ENe.js.map +1 -0
  158. package/dist/errors/base-error.cjs.map +1 -1
  159. package/dist/errors/base-error.js.map +1 -1
  160. package/dist/{getContract-MrPLx6gp.cjs → getContract-3QbyfZBF.cjs} +2 -2
  161. package/dist/getContract-3QbyfZBF.cjs.map +1 -0
  162. package/dist/{getContract-B3Spz0SO.js → getContract-CezEyDf-.js} +2 -2
  163. package/dist/{getContract-MrPLx6gp.cjs.map → getContract-CezEyDf-.js.map} +1 -1
  164. package/dist/main.cjs +1 -1
  165. package/dist/main.js +1 -1
  166. package/dist/secp256k1-3OC5y4qp.js +1579 -0
  167. package/dist/secp256k1-3OC5y4qp.js.map +1 -0
  168. package/dist/secp256k1-bcahnPX9.cjs +2 -0
  169. package/dist/secp256k1-bcahnPX9.cjs.map +1 -0
  170. package/dist/utils/version.cjs +1 -1
  171. package/dist/utils/version.js +1 -1
  172. package/dist/writeContract-ChuHpJLC.js +3799 -0
  173. package/dist/writeContract-ChuHpJLC.js.map +1 -0
  174. package/dist/writeContract-D97dSJQe.cjs +32 -0
  175. package/dist/writeContract-D97dSJQe.cjs.map +1 -0
  176. package/package.json +13 -13
  177. package/dist/ccip-D4klNwCt.js +0 -159
  178. package/dist/ccip-D4klNwCt.js.map +0 -1
  179. package/dist/ccip-DLDqFodf.cjs +0 -2
  180. package/dist/ccip-DLDqFodf.cjs.map +0 -1
  181. package/dist/constants-BvU-JhfL.cjs +0 -9
  182. package/dist/constants-BvU-JhfL.cjs.map +0 -1
  183. package/dist/constants-rWWWhxR_.js +0 -2099
  184. package/dist/constants-rWWWhxR_.js.map +0 -1
  185. package/dist/createWalletClient-Bmopj8MM.cjs +0 -4
  186. package/dist/createWalletClient-Bmopj8MM.cjs.map +0 -1
  187. package/dist/createWalletClient-DKcpswHR.js +0 -2007
  188. package/dist/createWalletClient-DKcpswHR.js.map +0 -1
  189. package/dist/getContract-B3Spz0SO.js.map +0 -1
  190. package/dist/secp256k1-BLbXMlpX.js +0 -1172
  191. package/dist/secp256k1-BLbXMlpX.js.map +0 -1
  192. package/dist/secp256k1-CFnFaJ0H.cjs +0 -2
  193. package/dist/secp256k1-CFnFaJ0H.cjs.map +0 -1
  194. package/dist/writeContract-BBHpAss8.cjs +0 -32
  195. package/dist/writeContract-BBHpAss8.cjs.map +0 -1
  196. package/dist/writeContract-RluxM31W.js +0 -3833
  197. package/dist/writeContract-RluxM31W.js.map +0 -1
@@ -1,10 +1,10 @@
1
1
  var u = Object.defineProperty;
2
2
  var m = (n, t, a) => t in n ? u(n, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : n[t] = a;
3
3
  var l = (n, t, a) => m(n, typeof t != "symbol" ? t + "" : t, a);
4
- import { V as C } from "../../constants-rWWWhxR_.js";
4
+ import { V as C } from "../../constants-BjRNQpT2.js";
5
5
  import { NUCLEUS_BORING_VAULT_ABIS as p } from "../abis/nucleus-boring-vault-abis.js";
6
6
  import { CONTRACT_ADDRESSES as g } from "../addresses.js";
7
- import { g as f } from "../../getContract-B3Spz0SO.js";
7
+ import { g as f } from "../../getContract-CezEyDf-.js";
8
8
  class _ {
9
9
  /**
10
10
  * Create the handler for processing UniFi tokens.
@@ -1 +1 @@
1
- {"version":3,"file":"nucleus-boring-vault-handler.js","sources":["../../../lib/contracts/handlers/nucleus-boring-vault-handler.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { NUCLEUS_BORING_VAULT_ABIS } from '../abis/nucleus-boring-vault-abis';\nimport { CONTRACT_ADDRESSES } from '../addresses';\n\nexport type PermitParams = {\n account: Address;\n owner: Address;\n spender: Address;\n value: bigint;\n deadline: bigint;\n v: number;\n r: Address;\n s: Address;\n};\n\n/**\n * Handler for the `BoringVault` contract for a given token exposing\n * methods to interact with the contract.\n */\nexport class NucleusBoringVaultHandler {\n private viemChain: ViemChain;\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 }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = CONTRACT_ADDRESSES[this.chain]\n .NucleusBoringVault as Address;\n const abi = NUCLEUS_BORING_VAULT_ABIS[this.chain].BoringVault;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the allowance for the given owner and spender.\n *\n * @param owner Address of the owner.\n * @param spender Address of the spender.\n * @returns Allowance for the given owner and spender.\n */\n public getAllowance(owner: Address, spender: Address) {\n return this.getContract().read.allowance([owner, spender]);\n }\n\n /**\n * Get the total supply of the token.\n *\n * @returns Total supply of the token.\n */\n public getTotalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Check the token balance of the wallet.\n *\n * @param walletAddress Wallet address to check the balance of.\n * @returns Token balance in wei.\n */\n public balanceOf(walletAddress: Address) {\n return this.getContract().read.balanceOf([walletAddress]);\n }\n\n /**\n * Get the total supply of the token.\n *\n * @returns Total supply of the token.\n */\n public totalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Approve transaction for the spender to spend the owner's tokens.\n *\n * @param walletAddress Address of the caller of the transaction.\n * @param spenderAddress Address of the spender.\n * @param value Value to approve for the spender.\n * @returns Hash of the transaction.\n */\n public approve(\n walletAddress: Address,\n spenderAddress: Address,\n value: bigint,\n ) {\n return this.getContract().write.approve([spenderAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n }\n\n /**\n * Transfer tokens from the owner's wallet to the given address.\n *\n * @param walletAddress Address of the owner's wallet.\n * @param toAddress Address to transfer the tokens to.\n * @param value Value to transfer.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public transfer(walletAddress: Address, toAddress: Address, value: bigint) {\n const transact = () =>\n this.getContract().write.transfer([toAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n const estimate = () =>\n this.getContract().estimateGas.transfer([toAddress, value], {\n account: walletAddress,\n });\n\n return { transact, estimate };\n }\n\n /**\n * Transfer tokens from the given address to another address.\n *\n * @param walletAddress Address of the caller of the transaction.\n * @param fromAddress Address to transfer the tokens from.\n * @param toAddress Address to transfer the tokens to.\n * @param value Value to transfer.\n * @returns `transact: () => Promise<Address>` - Used to\n * make the transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public transferFrom(\n walletAddress: Address,\n fromAddress: Address,\n toAddress: Address,\n value: bigint,\n ) {\n const transact = () =>\n this.getContract().write.transferFrom([fromAddress, toAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n const estimate = () =>\n this.getContract().estimateGas.transferFrom(\n [fromAddress, toAddress, value],\n { account: walletAddress },\n );\n\n return { transact, estimate };\n }\n\n /**\n * Get permit to be able to use the token.\n *\n * @param params Permit parameters.\n * @param params.account Address of the caller of the transaction.\n * @param params.owner Address of the owner.\n * @param params.spender Address of the spender.\n * @param params.value Value to approve for the spender.\n * @param params.deadline Deadline for the permit.\n * @param params.v v value of the permit.\n * @param params.r r value of the permit.\n * @param params.s s value of the permit.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public permit(params: PermitParams) {\n const { account, owner, spender, value, deadline, v, r, s } = params;\n const transact = () =>\n this.getContract().write.permit(\n [owner, spender, value, deadline, v, r, s],\n { account, chain: this.viemChain },\n );\n const estimate = () =>\n this.getContract().estimateGas.permit(\n [owner, spender, value, deadline, v, r, s],\n { account },\n );\n\n return { transact, estimate };\n }\n}\n"],"names":["NucleusBoringVaultHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","CONTRACT_ADDRESSES","abi","NUCLEUS_BORING_VAULT_ABIS","client","getContract","owner","spender","walletAddress","spenderAddress","value","toAddress","fromAddress","params","account","deadline","v","r","s"],"mappings":";;;;;;;AA4BO,MAAMA,EAA0B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYrC,YACUC,GACAC,GACAC,GACR;AAfM,IAAAC,EAAA;AAYE,SAAA,QAAAH,GACA,KAAA,eAAAC,GACA,KAAA,eAAAC,GAEH,KAAA,YAAYE,EAAYJ,CAAK;AAAA,EACpC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,cAAc;AACnB,UAAMK,IAAUC,EAAmB,KAAK,KAAK,EAC1C,oBACGC,IAAMC,EAA0B,KAAK,KAAK,EAAE,aAC5CC,IAAS,E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AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAeO,aACLA,GACAI,GACAD,GACAD,GACA;AAYO,WAAA,EAAE,UAXQ,MACf,KAAK,cAAc,MAAM,aAAa,CAACE,GAAaD,GAAWD,CAAK,GAAG;AAAA,MACrE,SAASF;AAAA,MACT,OAAO,KAAK;AAAA,IAAA,CACb,GAOgB,UANF,MACf,KAAK,cAAc,YAAY;AAAA,MAC7B,CAACI,GAAaD,GAAWD,CAAK;AAAA,MAC9B,EAAE,SAASF,EAAc;AAAA,IAAA;EAI/B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBO,OAAOK,GAAsB;AAC5B,UAAA,EAAE,SAAAC,GAAS,OAAAR,GAAO,SAAAC,GAAS,OAAAG,GAAO,UAAAK,GAAU,GAAAC,GAAG,GAAAC,GAAG,GAAAC,EAAM,IAAAL;AAYvD,WAAA,EAAE,UAXQ,MACf,KAAK,cAAc,MAAM;AAAA,MACvB,CAACP,GAAOC,GAASG,GAAOK,GAAUC,GAAGC,GAAGC,CAAC;AAAA,MACzC,EAAE,SAAAJ,GAAS,OAAO,KAAK,UAAU;AAAA,IAAA,GAQlB,UANF,MACf,KAAK,cAAc,YAAY;AAAA,MAC7B,CAACR,GAAOC,GAASG,GAAOK,GAAUC,GAAGC,GAAGC,CAAC;AAAA,MACzC,EAAE,SAAAJ,EAAQ;AAAA,IAAA;EAIhB;AACF;"}
1
+ {"version":3,"file":"nucleus-boring-vault-handler.js","sources":["../../../lib/contracts/handlers/nucleus-boring-vault-handler.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { NUCLEUS_BORING_VAULT_ABIS } from '../abis/nucleus-boring-vault-abis';\nimport { CONTRACT_ADDRESSES } from '../addresses';\n\nexport type PermitParams = {\n account: Address;\n owner: Address;\n spender: Address;\n value: bigint;\n deadline: bigint;\n v: number;\n r: Address;\n s: Address;\n};\n\n/**\n * Handler for the `BoringVault` contract for a given token exposing\n * methods to interact with the contract.\n */\nexport class NucleusBoringVaultHandler {\n private viemChain: ViemChain;\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 }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = CONTRACT_ADDRESSES[this.chain]\n .NucleusBoringVault as Address;\n const abi = NUCLEUS_BORING_VAULT_ABIS[this.chain].BoringVault;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the allowance for the given owner and spender.\n *\n * @param owner Address of the owner.\n * @param spender Address of the spender.\n * @returns Allowance for the given owner and spender.\n */\n public getAllowance(owner: Address, spender: Address) {\n return this.getContract().read.allowance([owner, spender]);\n }\n\n /**\n * Get the total supply of the token.\n *\n * @returns Total supply of the token.\n */\n public getTotalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Check the token balance of the wallet.\n *\n * @param walletAddress Wallet address to check the balance of.\n * @returns Token balance in wei.\n */\n public balanceOf(walletAddress: Address) {\n return this.getContract().read.balanceOf([walletAddress]);\n }\n\n /**\n * Get the total supply of the token.\n *\n * @returns Total supply of the token.\n */\n public totalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Approve transaction for the spender to spend the owner's tokens.\n *\n * @param walletAddress Address of the caller of the transaction.\n * @param spenderAddress Address of the spender.\n * @param value Value to approve for the spender.\n * @returns Hash of the transaction.\n */\n public approve(\n walletAddress: Address,\n spenderAddress: Address,\n value: bigint,\n ) {\n return this.getContract().write.approve([spenderAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n }\n\n /**\n * Transfer tokens from the owner's wallet to the given address.\n *\n * @param walletAddress Address of the owner's wallet.\n * @param toAddress Address to transfer the tokens to.\n * @param value Value to transfer.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public transfer(walletAddress: Address, toAddress: Address, value: bigint) {\n const transact = () =>\n this.getContract().write.transfer([toAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n const estimate = () =>\n this.getContract().estimateGas.transfer([toAddress, value], {\n account: walletAddress,\n });\n\n return { transact, estimate };\n }\n\n /**\n * Transfer tokens from the given address to another address.\n *\n * @param walletAddress Address of the caller of the transaction.\n * @param fromAddress Address to transfer the tokens from.\n * @param toAddress Address to transfer the tokens to.\n * @param value Value to transfer.\n * @returns `transact: () => Promise<Address>` - Used to\n * make the transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public transferFrom(\n walletAddress: Address,\n fromAddress: Address,\n toAddress: Address,\n value: bigint,\n ) {\n const transact = () =>\n this.getContract().write.transferFrom([fromAddress, toAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n const estimate = () =>\n this.getContract().estimateGas.transferFrom(\n [fromAddress, toAddress, value],\n { account: walletAddress },\n );\n\n return { transact, estimate };\n }\n\n /**\n * Get permit to be able to use the token.\n *\n * @param params Permit parameters.\n * @param params.account Address of the caller of the transaction.\n * @param params.owner Address of the owner.\n * @param params.spender Address of the spender.\n * @param params.value Value to approve for the spender.\n * @param params.deadline Deadline for the permit.\n * @param params.v v value of the permit.\n * @param params.r r value of the permit.\n * @param params.s s value of the permit.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public permit(params: PermitParams) {\n const { account, owner, spender, value, deadline, v, r, s } = params;\n const transact = () =>\n this.getContract().write.permit(\n [owner, spender, value, deadline, v, r, s],\n { account, chain: this.viemChain },\n );\n const estimate = () =>\n this.getContract().estimateGas.permit(\n [owner, spender, value, deadline, v, r, s],\n { account },\n );\n\n return { transact, estimate };\n }\n}\n"],"names":["NucleusBoringVaultHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","CONTRACT_ADDRESSES","abi","NUCLEUS_BORING_VAULT_ABIS","client","getContract","owner","spender","walletAddress","spenderAddress","value","toAddress","fromAddress","params","account","deadline","v","r","s"],"mappings":";;;;;;;AA4BO,MAAMA,EAA0B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYrC,YACUC,GACAC,GACAC,GACR;AAfM,IAAAC,EAAA;AAYE,SAAA,QAAAH,GACA,KAAA,eAAAC,GACA,KAAA,eAAAC,GAEH,KAAA,YAAYE,EAAYJ,CAAK;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS7B,cAAc;AACnB,UAAMK,IAAUC,EAAmB,KAAK,KAAK,EAC1C,oBACGC,IAAMC,EAA0B,KAAK,KAAK,EAAE,aAC5CC,IAAS,EAAE,QAAQ,KAAK,cAAc,QAAQ,KAAK,aAAa;AAEtE,WAAOC,EAAY,EAAE,SAAAL,GAAS,KAAAE,GAAK,QAAAE,GAAQ;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EActC,aAAaE,GAAgBC,GAAkB;AAC7C,WAAA,KAAK,cAAc,KAAK,UAAU,CAACD,GAAOC,CAAO,CAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQpD,iBAAiB;AACtB,WAAO,KAAK,cAAc,KAAK,YAAY;AAAA,EAA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AA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBvB,OAAOK,GAAsB;AAC5B,UAAA,EAAE,SAAAC,GAAS,OAAAR,GAAO,SAAAC,GAAS,OAAAG,GAAO,UAAAK,GAAU,GAAAC,GAAG,GAAAC,GAAG,GAAAC,EAAA,IAAML;AAYvD,WAAA,EAAE,UAXQ,MACf,KAAK,cAAc,MAAM;AAAA,MACvB,CAACP,GAAOC,GAASG,GAAOK,GAAUC,GAAGC,GAAGC,CAAC;AAAA,MACzC,EAAE,SAAAJ,GAAS,OAAO,KAAK,UAAU;AAAA,IACnC,GAOiB,UANF,MACf,KAAK,cAAc,YAAY;AAAA,MAC7B,CAACR,GAAOC,GAASG,GAAOK,GAAUC,GAAGC,GAAGC,CAAC;AAAA,MACzC,EAAE,SAAAJ,EAAQ;AAAA,IACZ,EAE0B;AAAA,EAAA;AAEhC;"}
@@ -1,2 +1,2 @@
1
- "use strict";var P=Object.defineProperty;var S=(n,t,e)=>t in n?P(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var u=(n,t,e)=>S(n,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("../../constants-BvU-JhfL.cjs"),T=require("../addresses.cjs"),E=require("../abis/nucleus-teller-abis.cjs"),C=require("../tokens.cjs"),_=require("./erc20-permit-handler.cjs"),v=require("../../getContract-MrPLx6gp.cjs");class A{constructor(t,e,i){u(this,"viemChain");u(this,"erc20PermitHandler");this.chain=t,this.walletClient=e,this.publicClient=i,this.viemChain=p.VIEM_CHAINS[t],this.erc20PermitHandler=new _.ERC20PermitHandler(t,e,i)}getContract(){const t=T.CONTRACT_ADDRESSES[this.chain].NucleusTeller,e=E.NUCLEUS_TELLER_ABIS[this.chain].Teller,i={public:this.publicClient,wallet:this.walletClient};return v.getContract({address:t,abi:e,client:i})}accountant(){return this.getContract().read.accountant()}vault(){return this.getContract().read.vault()}shareLockPeriod(){return this.getContract().read.shareLockPeriod()}shareUnlockTime(t){return this.getContract().read.shareUnlockTime([t])}isPaused(){return this.getContract().read.isPaused()}async deposit(t){const{token:e,unifiToken:i,account:s,amount:r,minimumMint:a,isPreapproved:o=!1}=t,c=C.TOKENS_ADDRESSES[e][this.chain];if(o)return{transact:()=>this.getContract().write.deposit([c,r,a],{account:s,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.deposit([c,r,a],{account:s})};const{r:h,s:l,v:d,deadline:g}=await this.erc20PermitHandler.withToken(e).getPermitSignature(s,C.TOKENS_ADDRESSES[i][this.chain],r),m=[c,r,a,g,Number(d),h,l];return{transact:()=>this.getContract().write.depositWithPermit(m,{account:s,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.depositWithPermit(m,{account:s})}}depositWithPermit(t){const{account:e,depositAsset:i,depositAmount:s,minimumMint:r,deadline:a,v:o,r:c,s:h}=t;return{transact:()=>this.getContract().write.depositWithPermit([i,s,r,a,o,c,h],{account:e,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.depositWithPermit([i,s,r,a,o,c,h],{account:e})}}}exports.NucleusTellerHandler=A;
1
+ "use strict";var P=Object.defineProperty;var S=(n,t,e)=>t in n?P(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var u=(n,t,e)=>S(n,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("../../constants-DA2xUb9r.cjs"),T=require("../addresses.cjs"),E=require("../abis/nucleus-teller-abis.cjs"),C=require("../tokens.cjs"),_=require("./erc20-permit-handler.cjs"),v=require("../../getContract-3QbyfZBF.cjs");class A{constructor(t,e,i){u(this,"viemChain");u(this,"erc20PermitHandler");this.chain=t,this.walletClient=e,this.publicClient=i,this.viemChain=p.VIEM_CHAINS[t],this.erc20PermitHandler=new _.ERC20PermitHandler(t,e,i)}getContract(){const t=T.CONTRACT_ADDRESSES[this.chain].NucleusTeller,e=E.NUCLEUS_TELLER_ABIS[this.chain].Teller,i={public:this.publicClient,wallet:this.walletClient};return v.getContract({address:t,abi:e,client:i})}accountant(){return this.getContract().read.accountant()}vault(){return this.getContract().read.vault()}shareLockPeriod(){return this.getContract().read.shareLockPeriod()}shareUnlockTime(t){return this.getContract().read.shareUnlockTime([t])}isPaused(){return this.getContract().read.isPaused()}async deposit(t){const{token:e,unifiToken:i,account:s,amount:r,minimumMint:a,isPreapproved:o=!1}=t,c=C.TOKENS_ADDRESSES[e][this.chain];if(o)return{transact:()=>this.getContract().write.deposit([c,r,a],{account:s,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.deposit([c,r,a],{account:s})};const{r:h,s:l,v:d,deadline:g}=await this.erc20PermitHandler.withToken(e).getPermitSignature(s,C.TOKENS_ADDRESSES[i][this.chain],r),m=[c,r,a,g,Number(d),h,l];return{transact:()=>this.getContract().write.depositWithPermit(m,{account:s,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.depositWithPermit(m,{account:s})}}depositWithPermit(t){const{account:e,depositAsset:i,depositAmount:s,minimumMint:r,deadline:a,v:o,r:c,s:h}=t;return{transact:()=>this.getContract().write.depositWithPermit([i,s,r,a,o,c,h],{account:e,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.depositWithPermit([i,s,r,a,o,c,h],{account:e})}}}exports.NucleusTellerHandler=A;
2
2
  //# sourceMappingURL=nucleus-teller-handler.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"nucleus-teller-handler.cjs","sources":["../../../lib/contracts/handlers/nucleus-teller-handler.ts"],"sourcesContent":["import {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { CONTRACT_ADDRESSES } from '../addresses';\nimport { NUCLEUS_TELLER_ABIS } from '../abis/nucleus-teller-abis';\nimport { Token, TOKENS_ADDRESSES, UnifiToken } from '../tokens';\nimport { ERC20PermitHandler } from './erc20-permit-handler';\n\nexport type DepositParams = {\n account: Address;\n token: Token;\n unifiToken: UnifiToken;\n amount: bigint;\n minimumMint: bigint;\n isPreapproved?: boolean;\n};\n\nexport type DepositWithPermitParams = {\n account: Address;\n depositAsset: Address;\n depositAmount: bigint;\n minimumMint: bigint;\n deadline: bigint;\n v: number;\n r: Address;\n s: Address;\n};\n\n/**\n * Handler for the `Teller` contract from nucleus.\n */\nexport class NucleusTellerHandler {\n private viemChain: ViemChain;\n private erc20PermitHandler: ERC20PermitHandler;\n\n /**\n * Create the handler for processing 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.erc20PermitHandler = new ERC20PermitHandler(\n chain,\n walletClient,\n publicClient,\n );\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = CONTRACT_ADDRESSES[this.chain].NucleusTeller as Address;\n const abi = NUCLEUS_TELLER_ABIS[this.chain].Teller;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the address of the `Accountant` contract.\n *\n * @returns The address of the `Accountant` contract.\n */\n public accountant() {\n return this.getContract().read.accountant();\n }\n\n /**\n * Get the address of the `BoringVault` contract.\n *\n * @returns The address of the `BoringVault` contract.\n */\n public vault() {\n return this.getContract().read.vault();\n }\n\n /**\n * Get the share lock period.\n *\n * @returns The share lock period.\n */\n public shareLockPeriod() {\n return this.getContract().read.shareLockPeriod();\n }\n\n /**\n * Get the share unlock time for the given wallet address.\n *\n * @param walletAddress Address of the wallet.\n * @returns The share unlock time.\n */\n public shareUnlockTime(walletAddress: Address) {\n return this.getContract().read.shareUnlockTime([walletAddress]);\n }\n\n /**\n * Get the paused state of the contract.\n *\n * @returns The paused state of the contract.\n */\n public isPaused() {\n return this.getContract().read.isPaused();\n }\n\n /**\n * Deposit the given token for staking. This doesn't make the\n * transaction but returns two methods namely `transact` and\n * `estimate`.\n *\n * @param params Deposit parameters.\n * @param params.account Address of the caller of the transaction.\n * @param params.token Token to deposit.\n * @param params.unifiToken UniFi token to get in return of the deposit.\n * @param params.amount Amount of the token to deposit.\n * @param params.minimumMint Minimum amount of shares to mint.\n * @param params.isPreapproved Whether the token is preapproved.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public async deposit(params: DepositParams) {\n const {\n token,\n unifiToken,\n account,\n amount,\n minimumMint,\n isPreapproved = false,\n } = params;\n const tokenAddress = TOKENS_ADDRESSES[token][this.chain];\n\n if (isPreapproved) {\n return {\n transact: () =>\n this.getContract().write.deposit(\n [tokenAddress, amount, minimumMint],\n {\n account,\n chain: this.viemChain,\n },\n ),\n estimate: () =>\n this.getContract().estimateGas.deposit(\n [tokenAddress, amount, minimumMint],\n { account },\n ),\n };\n }\n\n const { r, s, v, deadline } = await this.erc20PermitHandler\n .withToken(token)\n .getPermitSignature(\n account,\n // The UniFi token contract is the spender.\n TOKENS_ADDRESSES[unifiToken][this.chain],\n amount,\n );\n\n const depositArgs = <const>[\n tokenAddress,\n amount,\n minimumMint,\n deadline,\n Number(v),\n r,\n s,\n ];\n\n const transact = () =>\n this.getContract().write.depositWithPermit(depositArgs, {\n account,\n chain: this.viemChain,\n });\n const estimate = () =>\n this.getContract().estimateGas.depositWithPermit(depositArgs, {\n account,\n });\n\n return { transact, estimate };\n }\n\n /**\n * Deposit an asset/token for staking with a permit.\n *\n * @param params Permit parameters.\n * @param params.account Address of the caller of the transaction.\n * @param params.depositAsset Address of the asset/token to deposit.\n * @param params.depositAmount Amount of the asset/token to deposit.\n * @param params.minimumMint Minimum amount of shares to mint.\n * @param params.deadline Deadline for the permit.\n * @param params.v v value of the permit.\n * @param params.r r value of the permit.\n * @param params.s s value of the permit.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public depositWithPermit(params: DepositWithPermitParams) {\n const {\n account,\n depositAsset,\n depositAmount,\n minimumMint,\n deadline,\n v,\n r,\n s,\n } = params;\n\n const transact = () =>\n this.getContract().write.depositWithPermit(\n [depositAsset, depositAmount, minimumMint, deadline, v, r, s],\n {\n account,\n chain: this.viemChain,\n },\n );\n const estimate = () =>\n this.getContract().estimateGas.depositWithPermit(\n [depositAsset, depositAmount, minimumMint, deadline, v, r, s],\n {\n account,\n },\n );\n\n return { transact, estimate };\n }\n}\n"],"names":["NucleusTellerHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","ERC20PermitHandler","address","CONTRACT_ADDRESSES","abi","NUCLEUS_TELLER_ABIS","client","getContract","walletAddress","params","token","unifiToken","account","amount","minimumMint","isPreapproved","tokenAddress","TOKENS_ADDRESSES","r","s","v","deadline","depositArgs","depositAsset","depositAmount"],"mappings":"8dAoCO,MAAMA,CAAqB,CAahC,YACUC,EACAC,EACAC,EACR,CAhBMC,EAAA,kBACAA,EAAA,2BAYE,KAAA,MAAAH,EACA,KAAA,aAAAC,EACA,KAAA,aAAAC,EAEH,KAAA,UAAYE,cAAYJ,CAAK,EAClC,KAAK,mBAAqB,IAAIK,EAAA,mBAC5BL,EACAC,EACAC,CAAA,CAEJ,CAQO,aAAc,CACnB,MAAMI,EAAUC,EAAA,mBAAmB,KAAK,KAAK,EAAE,cACzCC,EAAMC,EAAA,oBAAoB,KAAK,KAAK,EAAE,OACtCC,EAAS,CAAE,OAAQ,KAAK,aAAc,OAAQ,KAAK,cAEzD,OAAOC,EAAY,YAAA,CAAE,QAAAL,EAAS,IAAAE,EAAK,OAAAE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D,EAGL,CAoBO,kBAAkBH,EAAiC,CAClD,KAAA,CACJ,QAAAG,EACA,aAAAW,EACA,cAAAC,EACA,YAAAV,EACA,SAAAO,EACA,EAAAD,EACA,EAAAF,EACA,EAAAC,CACE,EAAAV,EAkBG,MAAA,CAAE,SAhBQ,IACf,KAAK,cAAc,MAAM,kBACvB,CAACc,EAAcC,EAAeV,EAAaO,EAAUD,EAAGF,EAAGC,CAAC,EAC5D,CACE,QAAAP,EACA,MAAO,KAAK,SACd,CAAA,EAUe,SARF,IACf,KAAK,cAAc,YAAY,kBAC7B,CAACW,EAAcC,EAAeV,EAAaO,EAAUD,EAAGF,EAAGC,CAAC,EAC5D,CACE,QAAAP,CACF,CAAA,EAIN,CACF"}
1
+ {"version":3,"file":"nucleus-teller-handler.cjs","sources":["../../../lib/contracts/handlers/nucleus-teller-handler.ts"],"sourcesContent":["import {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { CONTRACT_ADDRESSES } from '../addresses';\nimport { NUCLEUS_TELLER_ABIS } from '../abis/nucleus-teller-abis';\nimport { Token, TOKENS_ADDRESSES, UnifiToken } from '../tokens';\nimport { ERC20PermitHandler } from './erc20-permit-handler';\n\nexport type DepositParams = {\n account: Address;\n token: Token;\n unifiToken: UnifiToken;\n amount: bigint;\n minimumMint: bigint;\n isPreapproved?: boolean;\n};\n\nexport type DepositWithPermitParams = {\n account: Address;\n depositAsset: Address;\n depositAmount: bigint;\n minimumMint: bigint;\n deadline: bigint;\n v: number;\n r: Address;\n s: Address;\n};\n\n/**\n * Handler for the `Teller` contract from nucleus.\n */\nexport class NucleusTellerHandler {\n private viemChain: ViemChain;\n private erc20PermitHandler: ERC20PermitHandler;\n\n /**\n * Create the handler for processing 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.erc20PermitHandler = new ERC20PermitHandler(\n chain,\n walletClient,\n publicClient,\n );\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = CONTRACT_ADDRESSES[this.chain].NucleusTeller as Address;\n const abi = NUCLEUS_TELLER_ABIS[this.chain].Teller;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the address of the `Accountant` contract.\n *\n * @returns The address of the `Accountant` contract.\n */\n public accountant() {\n return this.getContract().read.accountant();\n }\n\n /**\n * Get the address of the `BoringVault` contract.\n *\n * @returns The address of the `BoringVault` contract.\n */\n public vault() {\n return this.getContract().read.vault();\n }\n\n /**\n * Get the share lock period.\n *\n * @returns The share lock period.\n */\n public shareLockPeriod() {\n return this.getContract().read.shareLockPeriod();\n }\n\n /**\n * Get the share unlock time for the given wallet address.\n *\n * @param walletAddress Address of the wallet.\n * @returns The share unlock time.\n */\n public shareUnlockTime(walletAddress: Address) {\n return this.getContract().read.shareUnlockTime([walletAddress]);\n }\n\n /**\n * Get the paused state of the contract.\n *\n * @returns The paused state of the contract.\n */\n public isPaused() {\n return this.getContract().read.isPaused();\n }\n\n /**\n * Deposit the given token for staking. This doesn't make the\n * transaction but returns two methods namely `transact` and\n * `estimate`.\n *\n * @param params Deposit parameters.\n * @param params.account Address of the caller of the transaction.\n * @param params.token Token to deposit.\n * @param params.unifiToken UniFi token to get in return of the deposit.\n * @param params.amount Amount of the token to deposit.\n * @param params.minimumMint Minimum amount of shares to mint.\n * @param params.isPreapproved Whether the token is preapproved.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public async deposit(params: DepositParams) {\n const {\n token,\n unifiToken,\n account,\n amount,\n minimumMint,\n isPreapproved = false,\n } = params;\n const tokenAddress = TOKENS_ADDRESSES[token][this.chain];\n\n if (isPreapproved) {\n return {\n transact: () =>\n this.getContract().write.deposit(\n [tokenAddress, amount, minimumMint],\n {\n account,\n chain: this.viemChain,\n },\n ),\n estimate: () =>\n this.getContract().estimateGas.deposit(\n [tokenAddress, amount, minimumMint],\n { account },\n ),\n };\n }\n\n const { r, s, v, deadline } = await this.erc20PermitHandler\n .withToken(token)\n .getPermitSignature(\n account,\n // The UniFi token contract is the spender.\n TOKENS_ADDRESSES[unifiToken][this.chain],\n amount,\n );\n\n const depositArgs = <const>[\n tokenAddress,\n amount,\n minimumMint,\n deadline,\n Number(v),\n r,\n s,\n ];\n\n const transact = () =>\n this.getContract().write.depositWithPermit(depositArgs, {\n account,\n chain: this.viemChain,\n });\n const estimate = () =>\n this.getContract().estimateGas.depositWithPermit(depositArgs, {\n account,\n });\n\n return { transact, estimate };\n }\n\n /**\n * Deposit an asset/token for staking with a permit.\n *\n * @param params Permit parameters.\n * @param params.account Address of the caller of the transaction.\n * @param params.depositAsset Address of the asset/token to deposit.\n * @param params.depositAmount Amount of the asset/token to deposit.\n * @param params.minimumMint Minimum amount of shares to mint.\n * @param params.deadline Deadline for the permit.\n * @param params.v v value of the permit.\n * @param params.r r value of the permit.\n * @param params.s s value of the permit.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public depositWithPermit(params: DepositWithPermitParams) {\n const {\n account,\n depositAsset,\n depositAmount,\n minimumMint,\n deadline,\n v,\n r,\n s,\n } = params;\n\n const transact = () =>\n this.getContract().write.depositWithPermit(\n [depositAsset, depositAmount, minimumMint, deadline, v, r, s],\n {\n account,\n chain: this.viemChain,\n },\n );\n const estimate = () =>\n this.getContract().estimateGas.depositWithPermit(\n [depositAsset, depositAmount, minimumMint, deadline, v, r, s],\n {\n account,\n },\n );\n\n return { transact, estimate };\n }\n}\n"],"names":["NucleusTellerHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","ERC20PermitHandler","address","CONTRACT_ADDRESSES","abi","NUCLEUS_TELLER_ABIS","client","getContract","walletAddress","params","token","unifiToken","account","amount","minimumMint","isPreapproved","tokenAddress","TOKENS_ADDRESSES","r","s","v","deadline","depositArgs","depositAsset","depositAmount"],"mappings":"8dAoCO,MAAMA,CAAqB,CAahC,YACUC,EACAC,EACAC,EACR,CAhBMC,EAAA,kBACAA,EAAA,2BAYE,KAAA,MAAAH,EACA,KAAA,aAAAC,EACA,KAAA,aAAAC,EAEH,KAAA,UAAYE,cAAYJ,CAAK,EAClC,KAAK,mBAAqB,IAAIK,EAAA,mBAC5BL,EACAC,EACAC,CACF,CAAA,CASK,aAAc,CACnB,MAAMI,EAAUC,EAAA,mBAAmB,KAAK,KAAK,EAAE,cACzCC,EAAMC,EAAA,oBAAoB,KAAK,KAAK,EAAE,OACtCC,EAAS,CAAE,OAAQ,KAAK,aAAc,OAAQ,KAAK,YAAa,EAEtE,OAAOC,EAAY,YAAA,CAAE,QAAAL,EAAS,IAAAE,EAAK,OAAAE,EAAQ,CAAA,CAYtC,YAAa,CAClB,OAAO,KAAK,cAAc,KAAK,WAAW,CAAA,CAQrC,OAAQ,CACb,OAAO,KAAK,cAAc,KAAK,MAAM,CAAA,CAQhC,iBAAkB,CACvB,OAAO,KAAK,cAAc,KAAK,gBAAgB,CAAA,CAS1C,gBAAgBE,EAAwB,CAC7C,OAAO,KAAK,YAAY,EAAE,KAAK,gBAAgB,CAACA,CAAa,CAAC,CAAA,CAQzD,UAAW,CAChB,OAAO,KAAK,cAAc,KAAK,SAAS,CAAA,CAqB1C,MAAa,QAAQC,EAAuB,CACpC,KAAA,CACJ,MAAAC,EACA,WAAAC,EACA,QAAAC,EACA,OAAAC,EACA,YAAAC,EACA,cAAAC,EAAgB,EAAA,EACdN,EACEO,EAAeC,EAAA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