@pufferfinance/puffer-sdk 1.30.2 → 1.31.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 (155) 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 +42 -42
  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.js +2 -2
  7. package/dist/ccip-DLz1DupU.cjs +2 -0
  8. package/dist/ccip-DLz1DupU.cjs.map +1 -0
  9. package/dist/ccip-oHxlHOaH.js +158 -0
  10. package/dist/ccip-oHxlHOaH.js.map +1 -0
  11. package/dist/chains/constants.cjs +1 -1
  12. package/dist/chains/constants.d.ts +2 -1
  13. package/dist/chains/constants.js +1 -1
  14. package/dist/constants-C-rrOSfg.js +3837 -0
  15. package/dist/constants-C-rrOSfg.js.map +1 -0
  16. package/dist/constants-PXB3A4Yl.cjs +38 -0
  17. package/dist/constants-PXB3A4Yl.cjs.map +1 -0
  18. package/dist/contracts/abis/mainnet/Teller.cjs +1 -1
  19. package/dist/contracts/abis/mainnet/Teller.cjs.map +1 -1
  20. package/dist/contracts/abis/mainnet/Teller.d.ts +234 -18
  21. package/dist/contracts/abis/mainnet/Teller.js +165 -13
  22. package/dist/contracts/abis/mainnet/Teller.js.map +1 -1
  23. package/dist/contracts/addresses.cjs +1 -1
  24. package/dist/contracts/addresses.js +1 -1
  25. package/dist/contracts/handlers/carrot-staking-handler.cjs +1 -1
  26. package/dist/contracts/handlers/carrot-staking-handler.d.ts +1549 -5281
  27. package/dist/contracts/handlers/carrot-staking-handler.js +2 -2
  28. package/dist/contracts/handlers/carrot-vesting-handler.cjs +1 -1
  29. package/dist/contracts/handlers/carrot-vesting-handler.d.ts +1549 -5281
  30. package/dist/contracts/handlers/carrot-vesting-handler.js +2 -2
  31. package/dist/contracts/handlers/concrete-vault-handler.cjs +1 -1
  32. package/dist/contracts/handlers/concrete-vault-handler.d.ts +1549 -5281
  33. package/dist/contracts/handlers/concrete-vault-handler.js +2 -2
  34. package/dist/contracts/handlers/distributor-handler.cjs +1 -1
  35. package/dist/contracts/handlers/distributor-handler.d.ts +1549 -5281
  36. package/dist/contracts/handlers/distributor-handler.js +2 -2
  37. package/dist/contracts/handlers/erc20-permit-handler.cjs +1 -1
  38. package/dist/contracts/handlers/erc20-permit-handler.cjs.map +1 -1
  39. package/dist/contracts/handlers/erc20-permit-handler.d.ts +1549 -5281
  40. package/dist/contracts/handlers/erc20-permit-handler.js +3 -3
  41. package/dist/contracts/handlers/erc20-permit-handler.js.map +1 -1
  42. package/dist/contracts/handlers/gauge-registry-handler.cjs +1 -1
  43. package/dist/contracts/handlers/gauge-registry-handler.d.ts +1549 -5281
  44. package/dist/contracts/handlers/gauge-registry-handler.js +2 -2
  45. package/dist/contracts/handlers/guardian-module-handler.cjs +1 -1
  46. package/dist/contracts/handlers/guardian-module-handler.d.ts +1549 -5281
  47. package/dist/contracts/handlers/guardian-module-handler.js +2 -2
  48. package/dist/contracts/handlers/institutional-access-manager-handler.cjs +1 -1
  49. package/dist/contracts/handlers/institutional-access-manager-handler.cjs.map +1 -1
  50. package/dist/contracts/handlers/institutional-access-manager-handler.d.ts +1549 -5281
  51. package/dist/contracts/handlers/institutional-access-manager-handler.js +48 -49
  52. package/dist/contracts/handlers/institutional-access-manager-handler.js.map +1 -1
  53. package/dist/contracts/handlers/institutional-vault-handler.cjs +1 -1
  54. package/dist/contracts/handlers/institutional-vault-handler.d.ts +1549 -5281
  55. package/dist/contracts/handlers/institutional-vault-handler.js +2 -2
  56. package/dist/contracts/handlers/l1-reward-manager-handler.cjs +1 -1
  57. package/dist/contracts/handlers/l1-reward-manager-handler.d.ts +1549 -5281
  58. package/dist/contracts/handlers/l1-reward-manager-handler.js +2 -2
  59. package/dist/contracts/handlers/l2-reward-manager-handler.cjs +1 -1
  60. package/dist/contracts/handlers/l2-reward-manager-handler.d.ts +1549 -5281
  61. package/dist/contracts/handlers/l2-reward-manager-handler.js +2 -2
  62. package/dist/contracts/handlers/lagoon-vault-handler.cjs +1 -1
  63. package/dist/contracts/handlers/lagoon-vault-handler.d.ts +1549 -5281
  64. package/dist/contracts/handlers/lagoon-vault-handler.js +2 -2
  65. package/dist/contracts/handlers/mtw-carrot-handler.cjs +1 -1
  66. package/dist/contracts/handlers/mtw-carrot-handler.d.ts +1549 -5281
  67. package/dist/contracts/handlers/mtw-carrot-handler.js +2 -2
  68. package/dist/contracts/handlers/non-restaking-withdrawal-credentials-handler.cjs +1 -1
  69. package/dist/contracts/handlers/non-restaking-withdrawal-credentials-handler.d.ts +1549 -5281
  70. package/dist/contracts/handlers/non-restaking-withdrawal-credentials-handler.js +2 -2
  71. package/dist/contracts/handlers/nucleus-accountant-handler.cjs +1 -1
  72. package/dist/contracts/handlers/nucleus-accountant-handler.d.ts +1549 -5281
  73. package/dist/contracts/handlers/nucleus-accountant-handler.js +1 -1
  74. package/dist/contracts/handlers/nucleus-atomic-queue-handler.cjs +1 -1
  75. package/dist/contracts/handlers/nucleus-atomic-queue-handler.d.ts +1549 -5281
  76. package/dist/contracts/handlers/nucleus-atomic-queue-handler.js +2 -2
  77. package/dist/contracts/handlers/nucleus-boring-vault-handler.cjs +1 -1
  78. package/dist/contracts/handlers/nucleus-boring-vault-handler.d.ts +1549 -5281
  79. package/dist/contracts/handlers/nucleus-boring-vault-handler.js +2 -2
  80. package/dist/contracts/handlers/nucleus-teller-handler.cjs +1 -1
  81. package/dist/contracts/handlers/nucleus-teller-handler.cjs.map +1 -1
  82. package/dist/contracts/handlers/nucleus-teller-handler.d.ts +1820 -5316
  83. package/dist/contracts/handlers/nucleus-teller-handler.js +63 -48
  84. package/dist/contracts/handlers/nucleus-teller-handler.js.map +1 -1
  85. package/dist/contracts/handlers/puf-locker-handler.cjs +1 -1
  86. package/dist/contracts/handlers/puf-locker-handler.d.ts +1549 -5281
  87. package/dist/contracts/handlers/puf-locker-handler.js +2 -2
  88. package/dist/contracts/handlers/puffer-depositor-handler.cjs +1 -1
  89. package/dist/contracts/handlers/puffer-depositor-handler.d.ts +1549 -5281
  90. package/dist/contracts/handlers/puffer-depositor-handler.js +2 -2
  91. package/dist/contracts/handlers/puffer-l2-depositor-handler.cjs +1 -1
  92. package/dist/contracts/handlers/puffer-l2-depositor-handler.d.ts +1549 -5281
  93. package/dist/contracts/handlers/puffer-l2-depositor-handler.js +2 -2
  94. package/dist/contracts/handlers/puffer-oracle-v2-handler.cjs +1 -1
  95. package/dist/contracts/handlers/puffer-oracle-v2-handler.d.ts +1549 -5281
  96. package/dist/contracts/handlers/puffer-oracle-v2-handler.js +2 -2
  97. package/dist/contracts/handlers/puffer-protocol-handler.cjs +1 -1
  98. package/dist/contracts/handlers/puffer-protocol-handler.d.ts +1549 -5281
  99. package/dist/contracts/handlers/puffer-protocol-handler.js +2 -2
  100. package/dist/contracts/handlers/puffer-vault-handler.cjs +1 -1
  101. package/dist/contracts/handlers/puffer-vault-handler.d.ts +1549 -5281
  102. package/dist/contracts/handlers/puffer-vault-handler.js +2 -2
  103. package/dist/contracts/handlers/puffer-withdrawal-manager-handler.cjs +1 -1
  104. package/dist/contracts/handlers/puffer-withdrawal-manager-handler.d.ts +1549 -5281
  105. package/dist/contracts/handlers/puffer-withdrawal-manager-handler.js +2 -2
  106. package/dist/contracts/handlers/validator-ticket-handler.cjs +1 -1
  107. package/dist/contracts/handlers/validator-ticket-handler.d.ts +1549 -5281
  108. package/dist/contracts/handlers/validator-ticket-handler.js +2 -2
  109. package/dist/contracts/handlers/vl-puffer-handler.cjs +1 -1
  110. package/dist/contracts/handlers/vl-puffer-handler.d.ts +1549 -5281
  111. package/dist/contracts/handlers/vl-puffer-handler.js +2 -2
  112. package/dist/contracts/tokens.cjs +1 -1
  113. package/dist/contracts/tokens.js +1 -1
  114. package/dist/contracts/vaults-addresses.cjs +1 -1
  115. package/dist/contracts/vaults-addresses.js +1 -1
  116. package/dist/{getContract-Cgkj3G1g.cjs → getContract-BL-M-dQc.cjs} +2 -2
  117. package/dist/{getContract-Cgkj3G1g.cjs.map → getContract-BL-M-dQc.cjs.map} +1 -1
  118. package/dist/{getContract-Dxh0At3n.js → getContract-BVdsHXdp.js} +11 -11
  119. package/dist/{getContract-Dxh0At3n.js.map → getContract-BVdsHXdp.js.map} +1 -1
  120. package/dist/http-BtVgpo6v.cjs +5 -0
  121. package/dist/http-BtVgpo6v.cjs.map +1 -0
  122. package/dist/{http-Clq2Hoy9.js → http-CJGQ2e7o.js} +1687 -1533
  123. package/dist/http-CJGQ2e7o.js.map +1 -0
  124. package/dist/{localBatchGatewayRequest-Dm7yXllz.js → localBatchGatewayRequest-BchhbxQ2.js} +18 -18
  125. package/dist/{localBatchGatewayRequest-Dm7yXllz.js.map → localBatchGatewayRequest-BchhbxQ2.js.map} +1 -1
  126. package/dist/{localBatchGatewayRequest-CuvkLo7E.cjs → localBatchGatewayRequest-Bz0YuhIJ.cjs} +2 -2
  127. package/dist/{localBatchGatewayRequest-CuvkLo7E.cjs.map → localBatchGatewayRequest-Bz0YuhIJ.cjs.map} +1 -1
  128. package/dist/main.cjs +1 -1
  129. package/dist/main.js +1 -1
  130. package/dist/{secp256k1-BbMQ_WWG.js → secp256k1-Bm3EstvG.js} +62 -62
  131. package/dist/{secp256k1-BbMQ_WWG.js.map → secp256k1-Bm3EstvG.js.map} +1 -1
  132. package/dist/{secp256k1-DrUar53F.cjs → secp256k1-cRXUqGNw.cjs} +2 -2
  133. package/dist/{secp256k1-DrUar53F.cjs.map → secp256k1-cRXUqGNw.cjs.map} +1 -1
  134. package/dist/utils/version.cjs +1 -1
  135. package/dist/utils/version.js +1 -1
  136. package/dist/writeContract-D9xqoPDa.js +3527 -0
  137. package/dist/writeContract-D9xqoPDa.js.map +1 -0
  138. package/dist/writeContract-Gli_t0c1.cjs +6 -0
  139. package/dist/writeContract-Gli_t0c1.cjs.map +1 -0
  140. package/package.json +13 -13
  141. package/dist/ccip-BTVr5-VZ.js +0 -150
  142. package/dist/ccip-BTVr5-VZ.js.map +0 -1
  143. package/dist/ccip-DNgt9tzv.cjs +0 -2
  144. package/dist/ccip-DNgt9tzv.cjs.map +0 -1
  145. package/dist/constants-CUYeD71n.js +0 -2491
  146. package/dist/constants-CUYeD71n.js.map +0 -1
  147. package/dist/constants-Dhpa19or.cjs +0 -8
  148. package/dist/constants-Dhpa19or.cjs.map +0 -1
  149. package/dist/http-C-TIpf-V.cjs +0 -5
  150. package/dist/http-C-TIpf-V.cjs.map +0 -1
  151. package/dist/http-Clq2Hoy9.js.map +0 -1
  152. package/dist/writeContract-Bq8HaVjW.js +0 -4618
  153. package/dist/writeContract-Bq8HaVjW.js.map +0 -1
  154. package/dist/writeContract-PoCaxmyT.cjs +0 -36
  155. package/dist/writeContract-PoCaxmyT.cjs.map +0 -1
@@ -1,10 +1,10 @@
1
- import { V as C } from "../../constants-CUYeD71n.js";
1
+ import { V as C } from "../../constants-C-rrOSfg.js";
2
2
  import { VAULTS_ADDRESSES as p } from "../vaults-addresses.js";
3
- import { UnifiToken as g, TOKENS_ADDRESSES as u } from "../tokens.js";
4
- import { ERC20PermitHandler as P } from "./erc20-permit-handler.js";
5
- import { Teller as k } from "../abis/mainnet/Teller.js";
6
- import { g as T } from "../../getContract-Dxh0At3n.js";
7
- class N {
3
+ import { UnifiToken as g, TOKENS_ADDRESSES as d } from "../tokens.js";
4
+ import { ERC20PermitHandler as k } from "./erc20-permit-handler.js";
5
+ import { Teller as w } from "../abis/mainnet/Teller.js";
6
+ import { g as P } from "../../getContract-BVdsHXdp.js";
7
+ class H {
8
8
  /**
9
9
  * Create the handler for processing tokens.
10
10
  *
@@ -14,10 +14,10 @@ class N {
14
14
  * @param publicClient The public client to use for public
15
15
  * interactions.
16
16
  */
17
- constructor(t, e, i) {
18
- this.chain = t, this.walletClient = e, this.publicClient = i, this.viemChain = C[t], this.erc20PermitHandler = new P(
19
- t,
17
+ constructor(e, t, i) {
18
+ this.chain = e, this.walletClient = t, this.publicClient = i, this.viemChain = C[e], this.erc20PermitHandler = new k(
20
19
  e,
20
+ t,
21
21
  i
22
22
  ), this.token = g.unifiETH;
23
23
  }
@@ -31,8 +31,8 @@ class N {
31
31
  * @param token UniFi token to use for the handler.
32
32
  * @returns The handler.
33
33
  */
34
- withToken(t) {
35
- return this.token = t, this;
34
+ withToken(e) {
35
+ return this.token = e, this;
36
36
  }
37
37
  /**
38
38
  * Get the contract. This is a method because the typings are complex
@@ -41,8 +41,8 @@ class N {
41
41
  * @returns The viem contract.
42
42
  */
43
43
  getContract() {
44
- const t = p[this.token][this.chain].NucleusTeller, e = k, i = { public: this.publicClient, wallet: this.walletClient };
45
- return T({ address: t, abi: e, client: i });
44
+ const e = p[this.token][this.chain].NucleusTeller, t = w, i = { public: this.publicClient, wallet: this.walletClient };
45
+ return P({ address: e, abi: t, client: i });
46
46
  }
47
47
  /**
48
48
  * Get the address of the `Accountant` contract.
@@ -74,8 +74,8 @@ class N {
74
74
  * @param walletAddress Address of the wallet.
75
75
  * @returns The share unlock time.
76
76
  */
77
- shareUnlockTime(t) {
78
- return this.getContract().read.shareUnlockTime([t]);
77
+ shareUnlockTime(e) {
78
+ return this.getContract().read.shareUnlockTime([e]);
79
79
  }
80
80
  /**
81
81
  * Get the paused state of the contract.
@@ -103,48 +103,48 @@ class N {
103
103
  * `estimate: () => Promise<bigint>` - Gas estimate of the
104
104
  * transaction.
105
105
  */
106
- async deposit(t) {
106
+ async deposit(e) {
107
107
  const {
108
- token: e,
108
+ token: t,
109
109
  unifiToken: i,
110
- account: r,
111
- amount: s,
110
+ account: s,
111
+ amount: a,
112
112
  minimumMint: n,
113
- isPreapproved: o = !1
114
- } = t, a = u[e][this.chain];
115
- if (o)
113
+ isPreapproved: r = !1
114
+ } = e, o = d[t][this.chain];
115
+ if (r)
116
116
  return {
117
117
  transact: () => this.getContract().write.deposit(
118
- [a, s, n],
118
+ [o, a, n],
119
119
  {
120
- account: r,
120
+ account: s,
121
121
  chain: this.viemChain
122
122
  }
123
123
  ),
124
124
  estimate: () => this.getContract().estimateGas.deposit(
125
- [a, s, n],
126
- { account: r }
125
+ [o, a, n],
126
+ { account: s }
127
127
  )
128
128
  };
129
- const { r: c, s: h, v: m, deadline: l } = await this.erc20PermitHandler.withToken(e).getPermitData(
130
- r,
129
+ const { r: c, s: h, v: m, deadline: l } = await this.erc20PermitHandler.withToken(t).getPermitData(
130
+ s,
131
131
  // The UniFi token contract is the spender.
132
- u[i][this.chain],
133
- s
134
- ), d = [
132
+ d[i][this.chain],
133
+ a
134
+ ), u = [
135
+ o,
135
136
  a,
136
- s,
137
137
  n,
138
138
  l,
139
139
  m,
140
140
  c,
141
141
  h
142
142
  ];
143
- return { transact: () => this.getContract().write.depositWithPermit(d, {
144
- account: r,
143
+ return { transact: () => this.getContract().write.depositWithPermit(u, {
144
+ account: s,
145
145
  chain: this.viemChain
146
- }), estimate: () => this.getContract().estimateGas.depositWithPermit(d, {
147
- account: r
146
+ }), estimate: () => this.getContract().estimateGas.depositWithPermit(u, {
147
+ account: s
148
148
  }) };
149
149
  }
150
150
  /**
@@ -165,23 +165,38 @@ class N {
165
165
  * `estimate: () => Promise<bigint>` - Gas estimate of the
166
166
  * transaction.
167
167
  */
168
- depositWithPermit(t) {
169
- const { account: e, depositAsset: i, amount: r, minimumMint: s, deadline: n, v: o, r: a, s: c } = t;
168
+ depositWithPermit(e) {
169
+ const { account: t, depositAsset: i, amount: s, minimumMint: a, deadline: n, v: r, r: o, s: c } = e;
170
170
  return { transact: () => this.getContract().write.depositWithPermit(
171
- [i, r, s, n, o, a, c],
172
- {
173
- account: e,
174
- chain: this.viemChain
175
- }
171
+ [i, s, a, n, r, o, c],
172
+ { account: t, chain: this.viemChain }
176
173
  ), estimate: () => this.getContract().estimateGas.depositWithPermit(
177
- [i, r, s, n, o, a, c],
178
- {
179
- account: e
180
- }
174
+ [i, s, a, n, r, o, c],
175
+ { account: t }
176
+ ) };
177
+ }
178
+ async bulkWithdraw(e) {
179
+ const { account: t, withdrawAsset: i, shareAmount: s, minimumAssets: a } = e;
180
+ return { transact: () => this.getContract().write.bulkWithdraw(
181
+ [i, s, a, t],
182
+ { account: t, chain: this.viemChain }
183
+ ), estimate: () => this.getContract().estimateGas.bulkWithdraw(
184
+ [i, s, a, t],
185
+ { account: t }
186
+ ) };
187
+ }
188
+ async bulkDeposit(e) {
189
+ const { account: t, depositAsset: i, depositAmount: s, minimumMint: a } = e;
190
+ return { transact: () => this.getContract().write.bulkDeposit(
191
+ [i, s, a, t],
192
+ { account: t, chain: this.viemChain }
193
+ ), estimate: () => this.getContract().estimateGas.bulkDeposit(
194
+ [i, s, a, t],
195
+ { account: t }
181
196
  ) };
182
197
  }
183
198
  }
184
199
  export {
185
- N as NucleusTellerHandler
200
+ H as NucleusTellerHandler
186
201
  };
187
202
  //# sourceMappingURL=nucleus-teller-handler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nucleus-teller-handler.js","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 { VAULTS_ADDRESSES } from '../vaults-addresses';\nimport { Token, TOKENS_ADDRESSES, UnifiToken } from '../tokens';\nimport { ERC20PermitHandler } from './erc20-permit-handler';\nimport { Teller } from '../abis/mainnet/Teller';\nimport { PermitData } from '../common/lib/types';\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 = PermitData & {\n account: Address;\n depositAsset: Address;\n minimumMint: bigint;\n};\n\n/**\n * Handler for the `Teller` contract from nucleus.\n */\nexport class NucleusTellerHandler {\n private viemChain: ViemChain;\n private erc20PermitHandler: ERC20PermitHandler;\n private token: UnifiToken;\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 this.token = UnifiToken.unifiETH;\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: UnifiToken) {\n this.token = token;\n return this;\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 = VAULTS_ADDRESSES[this.token][this.chain]\n .NucleusTeller as Address;\n const abi = 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 .getPermitData(\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 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 { account, depositAsset, amount, minimumMint, deadline, v, r, s } =\n params;\n\n const transact = () =>\n this.getContract().write.depositWithPermit(\n [depositAsset, amount, minimumMint, deadline, v, r, s],\n {\n account,\n chain: this.viemChain,\n },\n );\n const estimate = () =>\n this.getContract().estimateGas.depositWithPermit(\n [depositAsset, amount, minimumMint, deadline, v, r, s],\n {\n account,\n },\n );\n\n return { transact, estimate };\n }\n}\n"],"names":["NucleusTellerHandler","chain","walletClient","publicClient","VIEM_CHAINS","ERC20PermitHandler","UnifiToken","token","address","VAULTS_ADDRESSES","abi","Teller","client","getContract","walletAddress","params","unifiToken","account","amount","minimumMint","isPreapproved","tokenAddress","TOKENS_ADDRESSES","r","s","v","deadline","depositArgs","depositAsset"],"mappings":";;;;;;AAgCO,MAAMA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAchC,YACUC,GACAC,GACAC,GACR;AAHQ,SAAA,QAAAF,GACA,KAAA,eAAAC,GACA,KAAA,eAAAC,GAER,KAAK,YAAYC,EAAYH,CAAK,GAClC,KAAK,qBAAqB,IAAII;AAAA,MAC5BJ;AAAA,MACAC;AAAA,MACAC;AAAA,IAAA,GAEF,KAAK,QAAQG,EAAW;AAAA,EAC1B;AAAA,EAzBQ;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgCD,UAAUC,GAAmB;AAClC,gBAAK,QAAQA,GACN;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,cAAc;AACnB,UAAMC,IAAUC,EAAiB,KAAK,KAAK,EAAE,KAAK,KAAK,EACpD,eACGC,IAAMC,GACNC,IAAS,EAAE,QAAQ,KAAK,cAAc,QAAQ,KAAK,aAAA;AAEzD,WAAOC,EAAY,EAAE,SAAAL,GAAS,KAAAE,GAAK,QAAAE,GAAQ;AAAA,EAK7C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,aAAa;AAClB,WAA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,UAAUnB,CAAK,EACf;AAAA,MACCU;AAAA;AAAA,MAEAK,EAAiBN,CAAU,EAAE,KAAK,KAAK;AAAA,MACvCE;AAAA,IAAA,GAGES,IAAqB;AAAA,MACzBN;AAAA,MACAH;AAAA,MACAC;AAAA,MACAO;AAAA,MACAD;AAAA,MACAF;AAAA,MACAC;AAAA,IAAA;AAaF,WAAO,EAAE,UAVQ,MACf,KAAK,cAAc,MAAM,kBAAkBG,GAAa;AAAA,MACtD,SAAAV;AAAA,MACA,OAAO,KAAK;AAAA,IAAA,CACb,GAMgB,UALF,MACf,KAAK,cAAc,YAAY,kBAAkBU,GAAa;AAAA,MAC5D,SAAAV;AAAA,IAAA,CACD,EAEgB;AAAA,EACrB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBO,kBAAkBF,GAAiC;AACxD,UAAM,EAAE,SAAAE,GAAS,cAAAW,GAAc,QAAAV,GAAQ,aAAAC,GAAa,UAAAO,GAAU,GAAAD,GAAG,GAAAF,GAAG,GAAAC,EAAA,IAClET;AAkBF,WAAO,EAAE,UAhBQ,MACf,KAAK,YAAA,EAAc,MAAM;AAAA,MACvB,CAACa,GAAcV,GAAQC,GAAaO,GAAUD,GAAGF,GAAGC,CAAC;AAAA,MACrD;AAAA,QACE,SAAAP;AAAA,QACA,OAAO,KAAK;AAAA,MAAA;AAAA,IACd,GAUe,UARF,MACf,KAAK,YAAA,EAAc,YAAY;AAAA,MAC7B,CAACW,GAAcV,GAAQC,GAAaO,GAAUD,GAAGF,GAAGC,CAAC;AAAA,MACrD;AAAA,QACE,SAAAP;AAAA,MAAA;AAAA,IACF,EAGe;AAAA,EACrB;AACF;"}
1
+ {"version":3,"file":"nucleus-teller-handler.js","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 { VAULTS_ADDRESSES } from '../vaults-addresses';\nimport { Token, TOKENS_ADDRESSES, UnifiToken } from '../tokens';\nimport { ERC20PermitHandler } from './erc20-permit-handler';\nimport { Teller } from '../abis/mainnet/Teller';\nimport { PermitData } from '../common/lib/types';\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 = PermitData & {\n account: Address;\n depositAsset: Address;\n minimumMint: bigint;\n};\n\nexport type BulkDepositParams = {\n account: Address;\n depositAsset: Address;\n depositAmount: bigint;\n minimumMint: bigint;\n};\n\nexport type BulkWithdrawParams = {\n account: Address;\n withdrawAsset: Address;\n shareAmount: bigint;\n minimumAssets: bigint;\n};\n\n/**\n * Handler for the `Teller` contract from nucleus.\n */\nexport class NucleusTellerHandler {\n private viemChain: ViemChain;\n private erc20PermitHandler: ERC20PermitHandler;\n private token: UnifiToken;\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 this.token = UnifiToken.unifiETH;\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: UnifiToken) {\n this.token = token;\n return this;\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 = VAULTS_ADDRESSES[this.token][this.chain]\n .NucleusTeller as Address;\n const abi = 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 .getPermitData(\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 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 { account, depositAsset, amount, minimumMint, deadline, v, r, s } =\n params;\n\n const transact = () =>\n this.getContract().write.depositWithPermit(\n [depositAsset, amount, minimumMint, deadline, v, r, s],\n { account, chain: this.viemChain },\n );\n const estimate = () =>\n this.getContract().estimateGas.depositWithPermit(\n [depositAsset, amount, minimumMint, deadline, v, r, s],\n { account },\n );\n\n return { transact, estimate };\n }\n\n public async bulkWithdraw(params: BulkWithdrawParams) {\n const { account, withdrawAsset, shareAmount, minimumAssets } = params;\n\n const transact = () =>\n this.getContract().write.bulkWithdraw(\n [withdrawAsset, shareAmount, minimumAssets, account],\n { account, chain: this.viemChain },\n );\n const estimate = () =>\n this.getContract().estimateGas.bulkWithdraw(\n [withdrawAsset, shareAmount, minimumAssets, account],\n { account },\n );\n\n return { transact, estimate };\n }\n\n public async bulkDeposit(params: BulkDepositParams) {\n const { account, depositAsset, depositAmount, minimumMint } = params;\n\n const transact = () =>\n this.getContract().write.bulkDeposit(\n [depositAsset, depositAmount, minimumMint, account],\n { account, chain: this.viemChain },\n );\n const estimate = () =>\n this.getContract().estimateGas.bulkDeposit(\n [depositAsset, depositAmount, minimumMint, account],\n { account },\n );\n\n return { transact, estimate };\n }\n}\n"],"names":["NucleusTellerHandler","chain","walletClient","publicClient","VIEM_CHAINS","ERC20PermitHandler","UnifiToken","token","address","VAULTS_ADDRESSES","abi","Teller","client","getContract","walletAddress","params","unifiToken","account","amount","minimumMint","isPreapproved","tokenAddress","TOKENS_ADDRESSES","r","s","v","deadline","depositArgs","depositAsset","withdrawAsset","shareAmount","minimumAssets","depositAmount"],"mappings":";;;;;;AA8CO,MAAMA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAchC,YACUC,GACAC,GACAC,GACR;AAHQ,SAAA,QAAAF,GACA,KAAA,eAAAC,GACA,KAAA,eAAAC,GAER,KAAK,YAAYC,EAAYH,CAAK,GAClC,KAAK,qBAAqB,IAAII;AAAA,MAC5BJ;AAAA,MACAC;AAAA,MACAC;AAAA,IAAA,GAEF,KAAK,QAAQG,EAAW;AAAA,EAC1B;AAAA,EAzBQ;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgCD,UAAUC,GAAmB;AAClC,gBAAK,QAAQA,GACN;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,cAAc;AACnB,UAAMC,IAAUC,EAAiB,KAAK,KAAK,EAAE,KAAK,KAAK,EACpD,eACGC,IAAMC,GACNC,IAAS,EAAE,QAAQ,KAAK,cAAc,QAAQ,KAAK,aAAA;AAEzD,WAAOC,EAAY,EAAE,SAAAL,GAAS,KAAAE,GAAK,QAAAE,GAAQ;AAAA,EAK7C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,aAAa;AAClB,WAAO,KAAK,cAAc,KAAK,WAAA;AAAA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AAaC,GAAed,CAAO;AAAA,MACnD,EAAE,SAAAA,GAAS,OAAO,KAAK,UAAA;AAAA,IAAU,GAQlB,UANF,MACf,KAAK,YAAA,EAAc,YAAY;AAAA,MAC7B,CAACY,GAAeC,GAAaC,GAAed,CAAO;AAAA,MACnD,EAAE,SAAAA,EAAA;AAAA,IAAQ,EAGK;AAAA,EACrB;AAAA,EAEA,MAAa,YAAYF,GAA2B;AAClD,UAAM,EAAE,SAAAE,GAAS,cAAAW,GAAc,eAAAI,GAAe,aAAAb,MAAgBJ;AAa9D,WAAO,EAAE,UAXQ,MACf,KAAK,YAAA,EAAc,MAAM;AAAA,MACvB,CAACa,GAAcI,GAAeb,GAAaF,CAAO;AAAA,MAClD,EAAE,SAAAA,GAAS,OAAO,KAAK,UAAA;AAAA,IAAU,GAQlB,UANF,MACf,KAAK,YAAA,EAAc,YAAY;AAAA,MAC7B,CAACW,GAAcI,GAAeb,GAAaF,CAAO;AAAA,MAClD,EAAE,SAAAA,EAAA;AAAA,IAAQ,EAGK;AAAA,EACrB;AACF;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../constants-Dhpa19or.cjs"),u=require("../addresses.cjs"),a=require("../tokens.cjs"),l=require("./erc20-permit-handler.cjs"),S=require("../abis/mainnet/PufLocker.cjs"),C=require("../../getContract-Cgkj3G1g.cjs");class g{constructor(e,t,i){this.chain=e,this.walletClient=t,this.publicClient=i,this.viemChain=n.VIEM_CHAINS[e],this.erc20PermitHandler=new l.ERC20PermitHandler(e,t,i)}viemChain;erc20PermitHandler;getContract(){const e=u.CONTRACT_ADDRESSES[this.chain].PufLocker,t=S.PufLocker,i={public:this.publicClient,wallet:this.walletClient};return C.getContract({address:e,abi:t,client:i})}getAllDeposits(e,t){return this.getContract().read.getAllDeposits([a.TOKENS_ADDRESSES[e][this.chain],t])}getDeposits(e,t,i,r){return this.getContract().read.getDeposits([t,a.TOKENS_ADDRESSES[e][this.chain],i,r])}getLockPeriods(){return this.getContract().read.getLockPeriods()}async deposit(e){const{token:t,account:i,recipient:r,value:s,lockPeriod:c,isPreapproved:o=!1}=e;let h={r:n.padHex("0x",{size:32}),s:n.padHex("0x",{size:32}),v:0,deadline:0n,amount:s};o||(h=await this.erc20PermitHandler.withToken(t).getPermitData(i,u.CONTRACT_ADDRESSES[this.chain].PufLocker,s));const d=[a.TOKENS_ADDRESSES[t][this.chain],r,c,h];return{transact:()=>this.getContract().write.deposit(d,{account:i,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.deposit(d,{account:i})}}withdraw(e,t,i,r){const s=[a.TOKENS_ADDRESSES[e][this.chain],r,i];return{transact:()=>this.getContract().write.withdraw(s,{account:t,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.withdraw(s,{account:t})}}}exports.PufLockerHandler=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../constants-PXB3A4Yl.cjs"),u=require("../addresses.cjs"),a=require("../tokens.cjs"),l=require("./erc20-permit-handler.cjs"),S=require("../abis/mainnet/PufLocker.cjs"),C=require("../../getContract-BL-M-dQc.cjs");class g{constructor(e,t,i){this.chain=e,this.walletClient=t,this.publicClient=i,this.viemChain=n.VIEM_CHAINS[e],this.erc20PermitHandler=new l.ERC20PermitHandler(e,t,i)}viemChain;erc20PermitHandler;getContract(){const e=u.CONTRACT_ADDRESSES[this.chain].PufLocker,t=S.PufLocker,i={public:this.publicClient,wallet:this.walletClient};return C.getContract({address:e,abi:t,client:i})}getAllDeposits(e,t){return this.getContract().read.getAllDeposits([a.TOKENS_ADDRESSES[e][this.chain],t])}getDeposits(e,t,i,r){return this.getContract().read.getDeposits([t,a.TOKENS_ADDRESSES[e][this.chain],i,r])}getLockPeriods(){return this.getContract().read.getLockPeriods()}async deposit(e){const{token:t,account:i,recipient:r,value:s,lockPeriod:c,isPreapproved:o=!1}=e;let h={r:n.padHex("0x",{size:32}),s:n.padHex("0x",{size:32}),v:0,deadline:0n,amount:s};o||(h=await this.erc20PermitHandler.withToken(t).getPermitData(i,u.CONTRACT_ADDRESSES[this.chain].PufLocker,s));const d=[a.TOKENS_ADDRESSES[t][this.chain],r,c,h];return{transact:()=>this.getContract().write.deposit(d,{account:i,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.deposit(d,{account:i})}}withdraw(e,t,i,r){const s=[a.TOKENS_ADDRESSES[e][this.chain],r,i];return{transact:()=>this.getContract().write.withdraw(s,{account:t,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.withdraw(s,{account:t})}}}exports.PufLockerHandler=g;
2
2
  //# sourceMappingURL=puf-locker-handler.cjs.map