@pufferfinance/puffer-sdk 1.28.1 → 1.28.3
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.
- package/dist/api/puffer-client-helpers.cjs +1 -1
- package/dist/api/puffer-client-helpers.cjs.map +1 -1
- package/dist/api/puffer-client-helpers.js +7 -7
- package/dist/api/puffer-client-helpers.js.map +1 -1
- package/dist/api/puffer-client.cjs +1 -1
- package/dist/api/puffer-client.cjs.map +1 -1
- package/dist/api/puffer-client.js +119 -122
- package/dist/api/puffer-client.js.map +1 -1
- package/dist/ccip-78YM988s.js +150 -0
- package/dist/{ccip-C76-YhQK.js.map → ccip-78YM988s.js.map} +1 -1
- package/dist/ccip-LIGR3N1A.cjs +2 -0
- package/dist/{ccip-CEodLZ4s.cjs.map → ccip-LIGR3N1A.cjs.map} +1 -1
- package/dist/chains/constants.cjs +1 -1
- package/dist/chains/constants.js +1 -1
- package/dist/constants-6kuRTsbU.cjs +9 -0
- package/dist/{constants-CxSgz27h.cjs.map → constants-6kuRTsbU.cjs.map} +1 -1
- package/dist/{constants-C9YZ6Ewc.js → constants-CuIEh_ZS.js} +605 -656
- package/dist/{constants-C9YZ6Ewc.js.map → constants-CuIEh_ZS.js.map} +1 -1
- package/dist/contracts/abis/mainnet/Accountant.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/Accountant.js.map +1 -1
- package/dist/contracts/abis/mainnet/AtomicQueue.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/AtomicQueue.js.map +1 -1
- package/dist/contracts/abis/mainnet/BoringVault.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/BoringVault.js.map +1 -1
- package/dist/contracts/abis/mainnet/CarrotStaker.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/CarrotStaker.js.map +1 -1
- package/dist/contracts/abis/mainnet/CarrotVesting.cjs +1 -1
- package/dist/contracts/abis/mainnet/CarrotVesting.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/CarrotVesting.d.ts +84 -92
- package/dist/contracts/abis/mainnet/CarrotVesting.js +56 -62
- package/dist/contracts/abis/mainnet/CarrotVesting.js.map +1 -1
- package/dist/contracts/abis/mainnet/ConcreteMultiStrategyVault.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/ConcreteMultiStrategyVault.js.map +1 -1
- package/dist/contracts/abis/mainnet/Distributor.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/Distributor.js.map +1 -1
- package/dist/contracts/abis/mainnet/ERC20Permit.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/ERC20Permit.js.map +1 -1
- package/dist/contracts/abis/mainnet/GaugeRegistry.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/GaugeRegistry.js.map +1 -1
- package/dist/contracts/abis/mainnet/GuardianModule.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/GuardianModule.js.map +1 -1
- package/dist/contracts/abis/mainnet/InstitutionalAccessManager.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/InstitutionalAccessManager.js.map +1 -1
- package/dist/contracts/abis/mainnet/InstitutionalVault.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/InstitutionalVault.js.map +1 -1
- package/dist/contracts/abis/mainnet/L1RewardManager.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/L1RewardManager.js.map +1 -1
- package/dist/contracts/abis/mainnet/L2RewardManager.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/L2RewardManager.js.map +1 -1
- package/dist/contracts/abis/mainnet/LagoonVault.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/LagoonVault.js.map +1 -1
- package/dist/contracts/abis/mainnet/PufLocker.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/PufLocker.js.map +1 -1
- package/dist/contracts/abis/mainnet/PufferDepositor.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/PufferDepositor.js.map +1 -1
- package/dist/contracts/abis/mainnet/PufferL2Depositor.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/PufferL2Depositor.js.map +1 -1
- package/dist/contracts/abis/mainnet/PufferOracleV2.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/PufferOracleV2.js.map +1 -1
- package/dist/contracts/abis/mainnet/PufferProtocol.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/PufferProtocol.js.map +1 -1
- package/dist/contracts/abis/mainnet/PufferVaultV5.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/PufferVaultV5.js.map +1 -1
- package/dist/contracts/abis/mainnet/PufferWithdrawalManager.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/PufferWithdrawalManager.js.map +1 -1
- package/dist/contracts/abis/mainnet/Teller.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/Teller.js.map +1 -1
- package/dist/contracts/abis/mainnet/ValidatorTicket.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/ValidatorTicket.js.map +1 -1
- package/dist/contracts/abis/mainnet/mtwCARROT.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/mtwCARROT.js.map +1 -1
- package/dist/contracts/abis/mainnet/vlPUFFER.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/vlPUFFER.js.map +1 -1
- package/dist/contracts/addresses.cjs +1 -1
- package/dist/contracts/addresses.cjs.map +1 -1
- package/dist/contracts/addresses.js +5 -5
- package/dist/contracts/addresses.js.map +1 -1
- package/dist/contracts/handlers/carrot-staking-handler.cjs +1 -1
- package/dist/contracts/handlers/carrot-staking-handler.cjs.map +1 -1
- package/dist/contracts/handlers/carrot-staking-handler.d.ts +96 -6599
- package/dist/contracts/handlers/carrot-staking-handler.js +13 -16
- package/dist/contracts/handlers/carrot-staking-handler.js.map +1 -1
- package/dist/contracts/handlers/carrot-vesting-handler.cjs +1 -1
- package/dist/contracts/handlers/carrot-vesting-handler.cjs.map +1 -1
- package/dist/contracts/handlers/carrot-vesting-handler.d.ts +102 -6605
- package/dist/contracts/handlers/carrot-vesting-handler.js +25 -39
- package/dist/contracts/handlers/carrot-vesting-handler.js.map +1 -1
- package/dist/contracts/handlers/concrete-vault-handler.cjs +1 -1
- package/dist/contracts/handlers/concrete-vault-handler.cjs.map +1 -1
- package/dist/contracts/handlers/concrete-vault-handler.d.ts +96 -6599
- package/dist/contracts/handlers/concrete-vault-handler.js +15 -18
- package/dist/contracts/handlers/concrete-vault-handler.js.map +1 -1
- package/dist/contracts/handlers/distributor-handler.cjs +1 -1
- package/dist/contracts/handlers/distributor-handler.cjs.map +1 -1
- package/dist/contracts/handlers/distributor-handler.d.ts +96 -6599
- package/dist/contracts/handlers/distributor-handler.js +15 -18
- package/dist/contracts/handlers/distributor-handler.js.map +1 -1
- package/dist/contracts/handlers/erc20-permit-handler.cjs +1 -1
- package/dist/contracts/handlers/erc20-permit-handler.cjs.map +1 -1
- package/dist/contracts/handlers/erc20-permit-handler.d.ts +96 -6599
- package/dist/contracts/handlers/erc20-permit-handler.js +34 -38
- package/dist/contracts/handlers/erc20-permit-handler.js.map +1 -1
- package/dist/contracts/handlers/gauge-registry-handler.cjs +1 -1
- package/dist/contracts/handlers/gauge-registry-handler.cjs.map +1 -1
- package/dist/contracts/handlers/gauge-registry-handler.d.ts +96 -6599
- package/dist/contracts/handlers/gauge-registry-handler.js +11 -14
- package/dist/contracts/handlers/gauge-registry-handler.js.map +1 -1
- package/dist/contracts/handlers/guardian-module-handler.cjs +1 -1
- package/dist/contracts/handlers/guardian-module-handler.cjs.map +1 -1
- package/dist/contracts/handlers/guardian-module-handler.d.ts +96 -6599
- package/dist/contracts/handlers/guardian-module-handler.js +11 -14
- package/dist/contracts/handlers/guardian-module-handler.js.map +1 -1
- package/dist/contracts/handlers/institutional-access-manager-handler.cjs +1 -1
- package/dist/contracts/handlers/institutional-access-manager-handler.cjs.map +1 -1
- package/dist/contracts/handlers/institutional-access-manager-handler.d.ts +96 -6599
- package/dist/contracts/handlers/institutional-access-manager-handler.js +45 -50
- package/dist/contracts/handlers/institutional-access-manager-handler.js.map +1 -1
- package/dist/contracts/handlers/institutional-vault-handler.cjs +1 -1
- package/dist/contracts/handlers/institutional-vault-handler.cjs.map +1 -1
- package/dist/contracts/handlers/institutional-vault-handler.d.ts +96 -6599
- package/dist/contracts/handlers/institutional-vault-handler.js +16 -19
- package/dist/contracts/handlers/institutional-vault-handler.js.map +1 -1
- package/dist/contracts/handlers/l1-reward-manager-handler.cjs +1 -1
- package/dist/contracts/handlers/l1-reward-manager-handler.cjs.map +1 -1
- package/dist/contracts/handlers/l1-reward-manager-handler.d.ts +96 -6599
- package/dist/contracts/handlers/l1-reward-manager-handler.js +14 -17
- package/dist/contracts/handlers/l1-reward-manager-handler.js.map +1 -1
- package/dist/contracts/handlers/l2-reward-manager-handler.cjs +1 -1
- package/dist/contracts/handlers/l2-reward-manager-handler.cjs.map +1 -1
- package/dist/contracts/handlers/l2-reward-manager-handler.d.ts +96 -6599
- package/dist/contracts/handlers/l2-reward-manager-handler.js +13 -16
- package/dist/contracts/handlers/l2-reward-manager-handler.js.map +1 -1
- package/dist/contracts/handlers/lagoon-vault-handler.cjs +1 -1
- package/dist/contracts/handlers/lagoon-vault-handler.cjs.map +1 -1
- package/dist/contracts/handlers/lagoon-vault-handler.d.ts +96 -6599
- package/dist/contracts/handlers/lagoon-vault-handler.js +11 -14
- package/dist/contracts/handlers/lagoon-vault-handler.js.map +1 -1
- package/dist/contracts/handlers/mtw-carrot-handler.cjs +1 -1
- package/dist/contracts/handlers/mtw-carrot-handler.cjs.map +1 -1
- package/dist/contracts/handlers/mtw-carrot-handler.d.ts +96 -6599
- package/dist/contracts/handlers/mtw-carrot-handler.js +12 -15
- package/dist/contracts/handlers/mtw-carrot-handler.js.map +1 -1
- package/dist/contracts/handlers/nucleus-accountant-handler.cjs +1 -1
- package/dist/contracts/handlers/nucleus-accountant-handler.cjs.map +1 -1
- package/dist/contracts/handlers/nucleus-accountant-handler.d.ts +96 -6599
- package/dist/contracts/handlers/nucleus-accountant-handler.js +13 -16
- package/dist/contracts/handlers/nucleus-accountant-handler.js.map +1 -1
- package/dist/contracts/handlers/nucleus-atomic-queue-handler.cjs +1 -1
- package/dist/contracts/handlers/nucleus-atomic-queue-handler.cjs.map +1 -1
- package/dist/contracts/handlers/nucleus-atomic-queue-handler.d.ts +96 -6599
- package/dist/contracts/handlers/nucleus-atomic-queue-handler.js +14 -17
- package/dist/contracts/handlers/nucleus-atomic-queue-handler.js.map +1 -1
- package/dist/contracts/handlers/nucleus-boring-vault-handler.cjs +1 -1
- package/dist/contracts/handlers/nucleus-boring-vault-handler.cjs.map +1 -1
- package/dist/contracts/handlers/nucleus-boring-vault-handler.d.ts +96 -6599
- package/dist/contracts/handlers/nucleus-boring-vault-handler.js +18 -21
- package/dist/contracts/handlers/nucleus-boring-vault-handler.js.map +1 -1
- package/dist/contracts/handlers/nucleus-teller-handler.cjs +1 -1
- package/dist/contracts/handlers/nucleus-teller-handler.cjs.map +1 -1
- package/dist/contracts/handlers/nucleus-teller-handler.d.ts +96 -6599
- package/dist/contracts/handlers/nucleus-teller-handler.js +35 -38
- package/dist/contracts/handlers/nucleus-teller-handler.js.map +1 -1
- package/dist/contracts/handlers/puf-locker-handler.cjs +1 -1
- package/dist/contracts/handlers/puf-locker-handler.cjs.map +1 -1
- package/dist/contracts/handlers/puf-locker-handler.d.ts +96 -6599
- package/dist/contracts/handlers/puf-locker-handler.js +51 -54
- package/dist/contracts/handlers/puf-locker-handler.js.map +1 -1
- package/dist/contracts/handlers/puffer-depositor-handler.cjs +1 -1
- package/dist/contracts/handlers/puffer-depositor-handler.cjs.map +1 -1
- package/dist/contracts/handlers/puffer-depositor-handler.d.ts +96 -6599
- package/dist/contracts/handlers/puffer-depositor-handler.js +28 -31
- package/dist/contracts/handlers/puffer-depositor-handler.js.map +1 -1
- package/dist/contracts/handlers/puffer-l2-depositor-handler.cjs +1 -1
- package/dist/contracts/handlers/puffer-l2-depositor-handler.cjs.map +1 -1
- package/dist/contracts/handlers/puffer-l2-depositor-handler.d.ts +96 -6599
- package/dist/contracts/handlers/puffer-l2-depositor-handler.js +42 -45
- package/dist/contracts/handlers/puffer-l2-depositor-handler.js.map +1 -1
- package/dist/contracts/handlers/puffer-oracle-v2-handler.cjs +1 -1
- package/dist/contracts/handlers/puffer-oracle-v2-handler.cjs.map +1 -1
- package/dist/contracts/handlers/puffer-oracle-v2-handler.d.ts +96 -6599
- package/dist/contracts/handlers/puffer-oracle-v2-handler.js +13 -16
- package/dist/contracts/handlers/puffer-oracle-v2-handler.js.map +1 -1
- package/dist/contracts/handlers/puffer-protocol-handler.cjs +1 -1
- package/dist/contracts/handlers/puffer-protocol-handler.cjs.map +1 -1
- package/dist/contracts/handlers/puffer-protocol-handler.d.ts +96 -6599
- package/dist/contracts/handlers/puffer-protocol-handler.js +12 -15
- package/dist/contracts/handlers/puffer-protocol-handler.js.map +1 -1
- package/dist/contracts/handlers/puffer-vault-handler.cjs +1 -1
- package/dist/contracts/handlers/puffer-vault-handler.cjs.map +1 -1
- package/dist/contracts/handlers/puffer-vault-handler.d.ts +96 -6599
- package/dist/contracts/handlers/puffer-vault-handler.js +12 -15
- package/dist/contracts/handlers/puffer-vault-handler.js.map +1 -1
- package/dist/contracts/handlers/puffer-withdrawal-manager-handler.cjs +1 -1
- package/dist/contracts/handlers/puffer-withdrawal-manager-handler.cjs.map +1 -1
- package/dist/contracts/handlers/puffer-withdrawal-manager-handler.d.ts +96 -6599
- package/dist/contracts/handlers/puffer-withdrawal-manager-handler.js +15 -18
- package/dist/contracts/handlers/puffer-withdrawal-manager-handler.js.map +1 -1
- package/dist/contracts/handlers/validator-ticket-handler.cjs +1 -1
- package/dist/contracts/handlers/validator-ticket-handler.cjs.map +1 -1
- package/dist/contracts/handlers/validator-ticket-handler.d.ts +96 -6599
- package/dist/contracts/handlers/validator-ticket-handler.js +12 -15
- package/dist/contracts/handlers/validator-ticket-handler.js.map +1 -1
- package/dist/contracts/handlers/vl-puffer-handler.cjs +1 -1
- package/dist/contracts/handlers/vl-puffer-handler.cjs.map +1 -1
- package/dist/contracts/handlers/vl-puffer-handler.d.ts +96 -6599
- package/dist/contracts/handlers/vl-puffer-handler.js +19 -22
- package/dist/contracts/handlers/vl-puffer-handler.js.map +1 -1
- package/dist/contracts/tokens.cjs +1 -1
- package/dist/contracts/tokens.cjs.map +1 -1
- package/dist/contracts/tokens.js +1 -1
- package/dist/contracts/tokens.js.map +1 -1
- package/dist/contracts/vaults-addresses.cjs +1 -1
- package/dist/contracts/vaults-addresses.cjs.map +1 -1
- package/dist/contracts/vaults-addresses.js +1 -1
- package/dist/contracts/vaults-addresses.js.map +1 -1
- package/dist/errors/base-error.cjs.map +1 -1
- package/dist/errors/base-error.js.map +1 -1
- package/dist/{getContract-DUA3M2pm.cjs → getContract-D4_SEfqa.cjs} +2 -2
- package/dist/{getContract-DUA3M2pm.cjs.map → getContract-D4_SEfqa.cjs.map} +1 -1
- package/dist/{getContract-DEPNMZxg.js → getContract-DQN7VDBo.js} +2 -2
- package/dist/{getContract-DEPNMZxg.js.map → getContract-DQN7VDBo.js.map} +1 -1
- package/dist/http-CajzXkt4.js +4005 -0
- package/dist/http-CajzXkt4.js.map +1 -0
- package/dist/http-qhIDc8Dn.cjs +5 -0
- package/dist/http-qhIDc8Dn.cjs.map +1 -0
- package/dist/{localBatchGatewayRequest-CKLnLqib.cjs → localBatchGatewayRequest-C7zYTS2c.cjs} +2 -2
- package/dist/{localBatchGatewayRequest-CKLnLqib.cjs.map → localBatchGatewayRequest-C7zYTS2c.cjs.map} +1 -1
- package/dist/{localBatchGatewayRequest-C0QtijkB.js → localBatchGatewayRequest-DtOvBmA9.js} +3 -3
- package/dist/{localBatchGatewayRequest-C0QtijkB.js.map → localBatchGatewayRequest-DtOvBmA9.js.map} +1 -1
- package/dist/main.cjs +1 -1
- package/dist/main.js +1 -1
- package/dist/secp256k1-CMP_u7qb.cjs +2 -0
- package/dist/secp256k1-CMP_u7qb.cjs.map +1 -0
- package/dist/secp256k1-DCMgMsfV.js +1297 -0
- package/dist/secp256k1-DCMgMsfV.js.map +1 -0
- package/dist/utils/time.cjs.map +1 -1
- package/dist/utils/time.js.map +1 -1
- package/dist/utils/version.cjs +1 -1
- package/dist/utils/version.js +1 -1
- package/dist/writeContract-BnmmOPwy.cjs +36 -0
- package/dist/writeContract-BnmmOPwy.cjs.map +1 -0
- package/dist/{writeContract-DkC9wV5p.js → writeContract-DYAfDrRz.js} +1788 -1712
- package/dist/writeContract-DYAfDrRz.js.map +1 -0
- package/package.json +8 -8
- package/dist/ccip-C76-YhQK.js +0 -152
- package/dist/ccip-CEodLZ4s.cjs +0 -2
- package/dist/constants-CxSgz27h.cjs +0 -9
- package/dist/createWalletClient-Cct6ojqI.cjs +0 -5
- package/dist/createWalletClient-Cct6ojqI.cjs.map +0 -1
- package/dist/createWalletClient-DAuQCrLq.js +0 -3262
- package/dist/createWalletClient-DAuQCrLq.js.map +0 -1
- package/dist/secp256k1-ClOw2ksU.js +0 -1291
- package/dist/secp256k1-ClOw2ksU.js.map +0 -1
- package/dist/secp256k1-YUzyTLhP.cjs +0 -2
- package/dist/secp256k1-YUzyTLhP.cjs.map +0 -1
- package/dist/writeContract-BfAYISeL.cjs +0 -36
- package/dist/writeContract-BfAYISeL.cjs.map +0 -1
- package/dist/writeContract-DkC9wV5p.js.map +0 -1
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import { PufferVaultV5 as u } from "../abis/mainnet/PufferVaultV5.js";
|
|
7
|
-
import { g as C } from "../../getContract-DEPNMZxg.js";
|
|
8
|
-
class E {
|
|
1
|
+
import { V as s } from "../../constants-CuIEh_ZS.js";
|
|
2
|
+
import { CONTRACT_ADDRESSES as c } from "../addresses.js";
|
|
3
|
+
import { PufferVaultV5 as r } from "../abis/mainnet/PufferVaultV5.js";
|
|
4
|
+
import { g as o } from "../../getContract-DQN7VDBo.js";
|
|
5
|
+
class p {
|
|
9
6
|
/**
|
|
10
7
|
* Create the handler for the `PufferVaultV2` contract exposing
|
|
11
8
|
* methods to interact with the contract.
|
|
@@ -17,9 +14,9 @@ class E {
|
|
|
17
14
|
* interactions.
|
|
18
15
|
*/
|
|
19
16
|
constructor(t, a, e) {
|
|
20
|
-
|
|
21
|
-
this.chain = t, this.walletClient = a, this.publicClient = e, this.viemChain = h[t];
|
|
17
|
+
this.chain = t, this.walletClient = a, this.publicClient = e, this.viemChain = s[t];
|
|
22
18
|
}
|
|
19
|
+
viemChain;
|
|
23
20
|
/**
|
|
24
21
|
* Get the contract. This is a method because the typings are complex
|
|
25
22
|
* and lost when trying to make it a member.
|
|
@@ -27,8 +24,8 @@ class E {
|
|
|
27
24
|
* @returns The viem contract.
|
|
28
25
|
*/
|
|
29
26
|
getContract() {
|
|
30
|
-
const t =
|
|
31
|
-
return
|
|
27
|
+
const t = c[this.chain].PufferVault, a = r, e = { public: this.publicClient, wallet: this.walletClient };
|
|
28
|
+
return o({ address: t, abi: a, client: e });
|
|
32
29
|
}
|
|
33
30
|
/**
|
|
34
31
|
* Deposit tokens(e.g. WETH) in exchange for pufETH. This doesn't make the
|
|
@@ -63,10 +60,10 @@ class E {
|
|
|
63
60
|
* transaction.
|
|
64
61
|
*/
|
|
65
62
|
depositETH(t) {
|
|
66
|
-
return { transact: async (
|
|
63
|
+
return { transact: async (i) => await this.getContract().write.depositETH([t], {
|
|
67
64
|
account: t,
|
|
68
65
|
chain: this.viemChain,
|
|
69
|
-
value:
|
|
66
|
+
value: i
|
|
70
67
|
}), estimate: async () => await this.getContract().estimateGas.depositETH([t], {
|
|
71
68
|
account: t
|
|
72
69
|
}) };
|
|
@@ -226,6 +223,6 @@ class E {
|
|
|
226
223
|
}
|
|
227
224
|
}
|
|
228
225
|
export {
|
|
229
|
-
|
|
226
|
+
p as PufferVaultHandler
|
|
230
227
|
};
|
|
231
228
|
//# sourceMappingURL=puffer-vault-handler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"puffer-vault-handler.js","sources":["../../../lib/contracts/handlers/puffer-vault-handler.ts"],"sourcesContent":["import {\n Address,\n GetContractReturnType,\n PublicClient,\n WalletClient,\n getContract,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { CONTRACT_ADDRESSES } from '../addresses';\nimport { PufferVaultV5 } from '../abis/mainnet/PufferVaultV5';\n\n/**\n * Handler for the `PufferVaultV2` contract exposing methods to interact\n * with the contract.\n */\nexport class PufferVaultHandler {\n private viemChain: ViemChain;\n\n /**\n * Create the handler for the `PufferVaultV2` 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 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].PufferVault as Address;\n const abi = PufferVaultV5;\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 * Deposit tokens(e.g. WETH) in exchange for pufETH. This doesn't make the\n * transaction but returns two methods namely `transact` and\n * `estimate`.\n *\n * @param walletAddress Wallet address to get the tokens from.\n * @param value Value of tokens to deposit.\n * @returns `transact: (value: bigint) => Promise<Address>` -\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public deposit(walletAddress: Address, value: bigint) {\n const transact = async () =>\n await this.getContract().write.deposit([value, walletAddress], {\n account: walletAddress,\n chain: this.viemChain,\n });\n\n const estimate = async () =>\n await this.getContract().estimateGas.deposit([value, walletAddress], {\n account: walletAddress,\n });\n\n return { transact, estimate };\n }\n\n /**\n * Deposit ETH in exchange for pufETH. This doesn't make the\n * transaction but returns two methods namely `transact` and\n * `estimate`.\n *\n * @param walletAddress Wallet address to get the ETH from.\n * @returns `transact: (value: bigint) => 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 depositETH(walletAddress: Address) {\n const transact = async (value: bigint) =>\n await this.getContract().write.depositETH([walletAddress], {\n account: walletAddress,\n chain: this.viemChain,\n value,\n });\n\n const estimate = async () =>\n await this.getContract().estimateGas.depositETH([walletAddress], {\n account: walletAddress,\n });\n\n return { transact, estimate };\n }\n\n /**\n * Check the pufETH balance of the wallet.\n *\n * @param walletAddress Wallet address to check the balance of.\n * @returns pufETH balance in wei.\n */\n public async balanceOf(walletAddress: Address) {\n return await this.getContract().read.balanceOf([walletAddress]);\n }\n\n /**\n * Get the rate of pufETH compared to ETH.\n *\n * @returns Rate of pufETH compared to 1 ETH.\n */\n public async getPufETHRate() {\n const oneWei = BigInt(1e18);\n return await this.getContract().read.previewDeposit([oneWei]);\n }\n\n /**\n * Get the allowance for the given owner and spender.\n *\n * @param ownerAddress Address of the owner.\n * @param spenderAddress Address of the spender.\n * @returns Allowance for the given owner and spender.\n */\n public async getAllowance(ownerAddress: Address, spenderAddress: Address) {\n return await this.getContract().read.allowance([\n ownerAddress,\n spenderAddress,\n ]);\n }\n\n /**\n * Withdraw pufETH to the given wallet address. This doesn't make the\n * transaction but returns two methods namely `transact` and\n * `estimate`.\n *\n * @param ownerAddress Address of the owner.\n * @param walletAddress Address of the receiver.\n * @param value Value of pufETH to withdraw.\n * @returns `transact: (value: bigint) => 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 withdraw(\n ownerAddress: Address,\n walletAddress: Address,\n value: bigint,\n ) {\n const transact = async () =>\n await this.getContract().write.withdraw(\n [value, walletAddress, ownerAddress],\n {\n account: walletAddress,\n chain: this.viemChain,\n },\n );\n\n const estimate = async () =>\n await this.getContract().estimateGas.withdraw(\n [value, walletAddress, ownerAddress],\n {\n account: walletAddress,\n },\n );\n\n return { transact, estimate };\n }\n\n /**\n * Preview the amount of WETH that can be redeemed for the given\n * amount of pufETH using the `.redeem()` method.\n *\n * @param value Value of pufETH to redeem.\n * @returns Preview of the amount of WETH that can be redeemed.\n */\n public previewRedeem(value: bigint) {\n return this.getContract().read.previewRedeem([value]);\n }\n\n /**\n * Calculates the maximum amount of pufETH shares that can be redeemed\n * by the owner.\n *\n * @param ownerAddress Address of the owner's wallet.\n * @returns Maximum amount of pufETH shares that can be redeemed.\n */\n public maxRedeem(ownerAddress: Address) {\n return this.getContract().read.maxRedeem([ownerAddress]);\n }\n\n /**\n * Returns how many basis points of a fee there are when exiting. For\n * example, a 1% fee would mean 1% of the user's requested pufETH is\n * burned (which increases the value for all pufETH holders) before\n * the ETH is redeemed. i.e., you get 1% less ETH back. i.e., you get\n * 1% less ETH back.\n *\n * @returns Basis points of the exit fee.\n */\n public getExitFeeBasisPoints() {\n return this.getContract().read.getExitFeeBasisPoints();\n }\n\n /**\n * Returns how many treasury basis points of a fee there are when\n * exiting. For example, a 1% fee would mean 1% of the user's\n * requested pufETH is burned (which increases the value for all\n * pufETH holders) before the ETH is redeemed.\n *\n * @returns Basis points of the exit fee.\n */\n public getTreasuryExitFeeBasisPoints() {\n return this.getContract().read.getTreasuryExitFeeBasisPoints();\n }\n\n /**\n * Returns how many basis points of a fee there are in total when\n * exiting. For example, a 1% fee would mean 1% of the user's\n * requested pufETH is burned (which increases the value for all\n * pufETH holders) before the ETH is redeemed. i.e., you get 1% less\n * ETH back.\n *\n * @returns Basis points of the exit fee.\n */\n public getTotalExitFeeBasisPoints() {\n return this.getContract().read.getTotalExitFeeBasisPoints();\n }\n\n /**\n * Redeems pufETH shares in exchange for WETH assets from the vault.\n * In the process, the pufETH shares of the owner are burned. This\n * doesn't make the transaction but returns two methods namely\n * `transact` and `estimate`.\n *\n * @param ownerAddress Address of the owner of pufETH.\n * @param receiverAddress Address of the receiver of WETH.\n * @param shares Amount of pufETH shares to redeem.\n * @returns `transact: (value: bigint) => 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 redeem(\n ownerAddress: Address,\n receiverAddress: Address,\n shares: bigint,\n ) {\n const transact = async () =>\n await this.getContract().write.redeem(\n [shares, receiverAddress, ownerAddress],\n {\n account: ownerAddress,\n chain: this.viemChain,\n },\n );\n\n const estimate = async () =>\n await this.getContract().estimateGas.redeem(\n [shares, receiverAddress, ownerAddress],\n {\n account: ownerAddress,\n },\n );\n\n return { transact, estimate };\n }\n\n /**\n * Gives exchange rate of pufETH relative to WETH.\n * This does not include any fees, as compared to previewRedeem method.\n *\n * @param amount Amount of pufETH to convert.\n * @returns Amount of equivalent WETH.\n */\n public convertToAssets(amount: bigint) {\n return this.getContract().read.convertToAssets([amount]);\n }\n}\n"],"names":["PufferVaultHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","CONTRACT_ADDRESSES","abi","PufferVaultV5","client","getContract","walletAddress","value","oneWei","ownerAddress","spenderAddress","receiverAddress","shares","amount"],"mappings":";;;;;;;AAeO,MAAMA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAa9B,YACUC,GACAC,GACAC,GACR;AAhBM,IAAAC,EAAA;AAaE,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,EAAE,aACzCC,IAAMC,GACNC,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;AAAA;AAAA;AAAA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UAjBQ,YACf,MAAM,KAAK,cAAc,MAAM;AAAA,MAC7B,CAACA,GAAQD,GAAiBF,CAAY;AAAA,MACtC;AAAA,QACE,SAASA;AAAA,QACT,OAAO,KAAK;AAAA,MAAA;AAAA,IAEhB,GAUiB,UARF,YACf,MAAM,KAAK,cAAc,YAAY;AAAA,MACnC,CAACG,GAAQD,GAAiBF,CAAY;AAAA,MACtC;AAAA,QACE,SAASA;AAAA,MAAA;AAAA,IAEb,EAE0B;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUvB,gBAAgBI,GAAgB;AACrC,WAAO,KAAK,YAAY,EAAE,KAAK,gBAAgB,CAACA,CAAM,CAAC;AAAA,EAAA;AAE3D;"}
|
|
1
|
+
{"version":3,"file":"puffer-vault-handler.js","sources":["../../../lib/contracts/handlers/puffer-vault-handler.ts"],"sourcesContent":["import {\n Address,\n GetContractReturnType,\n PublicClient,\n WalletClient,\n getContract,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { CONTRACT_ADDRESSES } from '../addresses';\nimport { PufferVaultV5 } from '../abis/mainnet/PufferVaultV5';\n\n/**\n * Handler for the `PufferVaultV2` contract exposing methods to interact\n * with the contract.\n */\nexport class PufferVaultHandler {\n private viemChain: ViemChain;\n\n /**\n * Create the handler for the `PufferVaultV2` 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 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].PufferVault as Address;\n const abi = PufferVaultV5;\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 * Deposit tokens(e.g. WETH) in exchange for pufETH. This doesn't make the\n * transaction but returns two methods namely `transact` and\n * `estimate`.\n *\n * @param walletAddress Wallet address to get the tokens from.\n * @param value Value of tokens to deposit.\n * @returns `transact: (value: bigint) => Promise<Address>` -\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public deposit(walletAddress: Address, value: bigint) {\n const transact = async () =>\n await this.getContract().write.deposit([value, walletAddress], {\n account: walletAddress,\n chain: this.viemChain,\n });\n\n const estimate = async () =>\n await this.getContract().estimateGas.deposit([value, walletAddress], {\n account: walletAddress,\n });\n\n return { transact, estimate };\n }\n\n /**\n * Deposit ETH in exchange for pufETH. This doesn't make the\n * transaction but returns two methods namely `transact` and\n * `estimate`.\n *\n * @param walletAddress Wallet address to get the ETH from.\n * @returns `transact: (value: bigint) => 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 depositETH(walletAddress: Address) {\n const transact = async (value: bigint) =>\n await this.getContract().write.depositETH([walletAddress], {\n account: walletAddress,\n chain: this.viemChain,\n value,\n });\n\n const estimate = async () =>\n await this.getContract().estimateGas.depositETH([walletAddress], {\n account: walletAddress,\n });\n\n return { transact, estimate };\n }\n\n /**\n * Check the pufETH balance of the wallet.\n *\n * @param walletAddress Wallet address to check the balance of.\n * @returns pufETH balance in wei.\n */\n public async balanceOf(walletAddress: Address) {\n return await this.getContract().read.balanceOf([walletAddress]);\n }\n\n /**\n * Get the rate of pufETH compared to ETH.\n *\n * @returns Rate of pufETH compared to 1 ETH.\n */\n public async getPufETHRate() {\n const oneWei = BigInt(1e18);\n return await this.getContract().read.previewDeposit([oneWei]);\n }\n\n /**\n * Get the allowance for the given owner and spender.\n *\n * @param ownerAddress Address of the owner.\n * @param spenderAddress Address of the spender.\n * @returns Allowance for the given owner and spender.\n */\n public async getAllowance(ownerAddress: Address, spenderAddress: Address) {\n return await this.getContract().read.allowance([\n ownerAddress,\n spenderAddress,\n ]);\n }\n\n /**\n * Withdraw pufETH to the given wallet address. This doesn't make the\n * transaction but returns two methods namely `transact` and\n * `estimate`.\n *\n * @param ownerAddress Address of the owner.\n * @param walletAddress Address of the receiver.\n * @param value Value of pufETH to withdraw.\n * @returns `transact: (value: bigint) => 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 withdraw(\n ownerAddress: Address,\n walletAddress: Address,\n value: bigint,\n ) {\n const transact = async () =>\n await this.getContract().write.withdraw(\n [value, walletAddress, ownerAddress],\n {\n account: walletAddress,\n chain: this.viemChain,\n },\n );\n\n const estimate = async () =>\n await this.getContract().estimateGas.withdraw(\n [value, walletAddress, ownerAddress],\n {\n account: walletAddress,\n },\n );\n\n return { transact, estimate };\n }\n\n /**\n * Preview the amount of WETH that can be redeemed for the given\n * amount of pufETH using the `.redeem()` method.\n *\n * @param value Value of pufETH to redeem.\n * @returns Preview of the amount of WETH that can be redeemed.\n */\n public previewRedeem(value: bigint) {\n return this.getContract().read.previewRedeem([value]);\n }\n\n /**\n * Calculates the maximum amount of pufETH shares that can be redeemed\n * by the owner.\n *\n * @param ownerAddress Address of the owner's wallet.\n * @returns Maximum amount of pufETH shares that can be redeemed.\n */\n public maxRedeem(ownerAddress: Address) {\n return this.getContract().read.maxRedeem([ownerAddress]);\n }\n\n /**\n * Returns how many basis points of a fee there are when exiting. For\n * example, a 1% fee would mean 1% of the user's requested pufETH is\n * burned (which increases the value for all pufETH holders) before\n * the ETH is redeemed. i.e., you get 1% less ETH back. i.e., you get\n * 1% less ETH back.\n *\n * @returns Basis points of the exit fee.\n */\n public getExitFeeBasisPoints() {\n return this.getContract().read.getExitFeeBasisPoints();\n }\n\n /**\n * Returns how many treasury basis points of a fee there are when\n * exiting. For example, a 1% fee would mean 1% of the user's\n * requested pufETH is burned (which increases the value for all\n * pufETH holders) before the ETH is redeemed.\n *\n * @returns Basis points of the exit fee.\n */\n public getTreasuryExitFeeBasisPoints() {\n return this.getContract().read.getTreasuryExitFeeBasisPoints();\n }\n\n /**\n * Returns how many basis points of a fee there are in total when\n * exiting. For example, a 1% fee would mean 1% of the user's\n * requested pufETH is burned (which increases the value for all\n * pufETH holders) before the ETH is redeemed. i.e., you get 1% less\n * ETH back.\n *\n * @returns Basis points of the exit fee.\n */\n public getTotalExitFeeBasisPoints() {\n return this.getContract().read.getTotalExitFeeBasisPoints();\n }\n\n /**\n * Redeems pufETH shares in exchange for WETH assets from the vault.\n * In the process, the pufETH shares of the owner are burned. This\n * doesn't make the transaction but returns two methods namely\n * `transact` and `estimate`.\n *\n * @param ownerAddress Address of the owner of pufETH.\n * @param receiverAddress Address of the receiver of WETH.\n * @param shares Amount of pufETH shares to redeem.\n * @returns `transact: (value: bigint) => 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 redeem(\n ownerAddress: Address,\n receiverAddress: Address,\n shares: bigint,\n ) {\n const transact = async () =>\n await this.getContract().write.redeem(\n [shares, receiverAddress, ownerAddress],\n {\n account: ownerAddress,\n chain: this.viemChain,\n },\n );\n\n const estimate = async () =>\n await this.getContract().estimateGas.redeem(\n [shares, receiverAddress, ownerAddress],\n {\n account: ownerAddress,\n },\n );\n\n return { transact, estimate };\n }\n\n /**\n * Gives exchange rate of pufETH relative to WETH.\n * This does not include any fees, as compared to previewRedeem method.\n *\n * @param amount Amount of pufETH to convert.\n * @returns Amount of equivalent WETH.\n */\n public convertToAssets(amount: bigint) {\n return this.getContract().read.convertToAssets([amount]);\n }\n}\n"],"names":["PufferVaultHandler","chain","walletClient","publicClient","VIEM_CHAINS","address","CONTRACT_ADDRESSES","abi","PufferVaultV5","client","getContract","walletAddress","value","oneWei","ownerAddress","spenderAddress","receiverAddress","shares","amount"],"mappings":";;;;AAeO,MAAMA,EAAmB;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AAA,EACzD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWO,wBAAwB;AAC7B,WAAO,KAAK,cAAc,KAAK,sBAAA;AAAA,EACjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUO,gCAAgC;AACrC,WAAO,KAAK,cAAc,KAAK,8BAAA;AAAA,EACjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWO,6BAA6B;AAClC,WAAO,KAAK,cAAc,KAAK,2BAAA;AAAA,EACjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBO,OACLA,GACAE,GACAC,GACA;AAkBA,WAAO,EAAE,UAjBQ,YACf,MAAM,KAAK,YAAA,EAAc,MAAM;AAAA,MAC7B,CAACA,GAAQD,GAAiBF,CAAY;AAAA,MACtC;AAAA,QACE,SAASA;AAAA,QACT,OAAO,KAAK;AAAA,MAAA;AAAA,IACd,GAWe,UARF,YACf,MAAM,KAAK,YAAA,EAAc,YAAY;AAAA,MACnC,CAACG,GAAQD,GAAiBF,CAAY;AAAA,MACtC;AAAA,QACE,SAASA;AAAA,MAAA;AAAA,IACX,EAGe;AAAA,EACrB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASO,gBAAgBI,GAAgB;AACrC,WAAO,KAAK,YAAA,EAAc,KAAK,gBAAgB,CAACA,CAAM,CAAC;AAAA,EACzD;AACF;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../addresses.cjs"),n=require("../../constants-6kuRTsbU.cjs"),c=require("./erc20-permit-handler.cjs"),s=require("../tokens.cjs"),h=require("../abis/mainnet/PufferWithdrawalManager.cjs"),o=require("../../getContract-D4_SEfqa.cjs");class u{constructor(t,a,e){this.chain=t,this.walletClient=a,this.publicClient=e,this.viemChain=n.VIEM_CHAINS[t],this.erc20PermitHandler=new c.ERC20PermitHandler(t,a,e)}viemChain;erc20PermitHandler;getContract(){const t=r.CONTRACT_ADDRESSES[this.chain].PufferWithdrawalManager,a=h.PufferWithdrawalManager,e={public:this.publicClient,wallet:this.walletClient};return o.getContract({address:t,abi:a,client:e})}async requestWithdrawal(t,a){return{transact:async()=>await this.getContract().write.requestWithdrawal([a,t],{account:t,chain:this.viemChain}),estimate:async()=>await this.getContract().estimateGas.requestWithdrawal([a,t],{account:t})}}async requestWithdrawalWithPermit(t,a){const e=await this.erc20PermitHandler.withToken(s.Token.pufETH).getPermitData(t,r.CONTRACT_ADDRESSES[this.chain].PufferWithdrawalManager,a);return{transact:async()=>await this.getContract().write.requestWithdrawalWithPermit([e,t],{account:t,chain:this.viemChain}),estimate:async()=>await this.getContract().estimateGas.requestWithdrawalWithPermit([e,t],{account:t})}}async completeQueuedWithdrawal(t,a){return{transact:async()=>await this.getContract().write.completeQueuedWithdrawal([a],{account:t,chain:this.viemChain}),estimate:async()=>await this.getContract().estimateGas.completeQueuedWithdrawal([a],{account:t})}}async getWithdrawal(t){return await this.getContract().read.getWithdrawal([t])}}exports.PufferWithdrawalManagerHandler=u;
|
|
2
2
|
//# sourceMappingURL=puffer-withdrawal-manager-handler.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"puffer-withdrawal-manager-handler.cjs","sources":["../../../lib/contracts/handlers/puffer-withdrawal-manager-handler.ts"],"sourcesContent":["import {\n Address,\n getContract,\n GetContractReturnType,\n PublicClient,\n WalletClient,\n} from 'viem';\nimport { CONTRACT_ADDRESSES } from '../addresses';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { ERC20PermitHandler } from './erc20-permit-handler';\nimport { Token } from '../tokens';\nimport { PufferWithdrawalManager } from '../abis/mainnet/PufferWithdrawalManager';\n\n/**\n * Handler for the `PufferWithdrawalsManager` contract exposing methods to\n * interact with the contract.\n */\nexport class PufferWithdrawalManagerHandler {\n private viemChain: ViemChain;\n private erc20PermitHandler: ERC20PermitHandler;\n\n /**\n * Create the handler for the `PufferWithdrawalsManager` 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 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.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = CONTRACT_ADDRESSES[this.chain]\n .PufferWithdrawalManager as Address;\n const abi = PufferWithdrawalManager;\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 * Request a withdrawal of the given amount to the given address, with a permit.\n *\n * @param walletAddress The account address to request the withdrawal for.\n * @param amount The pufETH amount to request the withdrawal for.\n * @returns The transaction hash of the withdrawal.\n */\n public async requestWithdrawal(walletAddress: Address, amount: bigint) {\n const transact = async () =>\n await this.getContract().write.requestWithdrawal(\n [amount, walletAddress],\n {\n account: walletAddress,\n chain: this.viemChain,\n },\n );\n\n const estimate = async () =>\n await this.getContract().estimateGas.requestWithdrawal(\n [amount, walletAddress],\n { account: walletAddress },\n );\n\n return { transact, estimate };\n }\n\n /**\n * Request a withdrawal of the given amount to the given address.\n *\n * @param walletAddress The account address to request the withdrawal for.\n * @param amount The pufETHamount to request the withdrawal for.\n * @returns The transaction hash of the withdrawal.\n */\n public async requestWithdrawalWithPermit(\n walletAddress: Address,\n amount: bigint,\n ) {\n const permitData = await this.erc20PermitHandler\n .withToken(Token.pufETH)\n .getPermitData(\n walletAddress,\n CONTRACT_ADDRESSES[this.chain].PufferWithdrawalManager as Address,\n amount,\n );\n\n const transact = async () =>\n await this.getContract().write.requestWithdrawalWithPermit(\n [permitData, walletAddress],\n {\n account: walletAddress,\n chain: this.viemChain,\n },\n );\n\n const estimate = async () =>\n await this.getContract().estimateGas.requestWithdrawalWithPermit(\n [permitData, walletAddress],\n { account: walletAddress },\n );\n\n return { transact, estimate };\n }\n\n /**\n * Complete a withdrawal from the queue.\n *\n * @param withdrawalIdx The index of the withdrawal to complete.\n * @returns The transaction hash of the withdrawal.\n */\n public async completeQueuedWithdrawal(\n walletAddress: Address,\n withdrawalIdx: bigint,\n ) {\n const transact = async () =>\n await this.getContract().write.completeQueuedWithdrawal([withdrawalIdx], {\n account: walletAddress,\n chain: this.viemChain,\n });\n\n const estimate = async () =>\n await this.getContract().estimateGas.completeQueuedWithdrawal(\n [withdrawalIdx],\n { account: walletAddress },\n );\n\n return { transact, estimate };\n }\n\n /**\n * Get the withdrawal at the given index.\n *\n * @param withdrawalIdx The index of the withdrawal to get.\n * @returns The withdrawal at the given index.\n */\n public async getWithdrawal(withdrawalIdx: bigint) {\n return await this.getContract().read.getWithdrawal([withdrawalIdx]);\n }\n}\n"],"names":["PufferWithdrawalManagerHandler","chain","walletClient","publicClient","
|
|
1
|
+
{"version":3,"file":"puffer-withdrawal-manager-handler.cjs","sources":["../../../lib/contracts/handlers/puffer-withdrawal-manager-handler.ts"],"sourcesContent":["import {\n Address,\n getContract,\n GetContractReturnType,\n PublicClient,\n WalletClient,\n} from 'viem';\nimport { CONTRACT_ADDRESSES } from '../addresses';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { ERC20PermitHandler } from './erc20-permit-handler';\nimport { Token } from '../tokens';\nimport { PufferWithdrawalManager } from '../abis/mainnet/PufferWithdrawalManager';\n\n/**\n * Handler for the `PufferWithdrawalsManager` contract exposing methods to\n * interact with the contract.\n */\nexport class PufferWithdrawalManagerHandler {\n private viemChain: ViemChain;\n private erc20PermitHandler: ERC20PermitHandler;\n\n /**\n * Create the handler for the `PufferWithdrawalsManager` 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 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.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = CONTRACT_ADDRESSES[this.chain]\n .PufferWithdrawalManager as Address;\n const abi = PufferWithdrawalManager;\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 * Request a withdrawal of the given amount to the given address, with a permit.\n *\n * @param walletAddress The account address to request the withdrawal for.\n * @param amount The pufETH amount to request the withdrawal for.\n * @returns The transaction hash of the withdrawal.\n */\n public async requestWithdrawal(walletAddress: Address, amount: bigint) {\n const transact = async () =>\n await this.getContract().write.requestWithdrawal(\n [amount, walletAddress],\n {\n account: walletAddress,\n chain: this.viemChain,\n },\n );\n\n const estimate = async () =>\n await this.getContract().estimateGas.requestWithdrawal(\n [amount, walletAddress],\n { account: walletAddress },\n );\n\n return { transact, estimate };\n }\n\n /**\n * Request a withdrawal of the given amount to the given address.\n *\n * @param walletAddress The account address to request the withdrawal for.\n * @param amount The pufETHamount to request the withdrawal for.\n * @returns The transaction hash of the withdrawal.\n */\n public async requestWithdrawalWithPermit(\n walletAddress: Address,\n amount: bigint,\n ) {\n const permitData = await this.erc20PermitHandler\n .withToken(Token.pufETH)\n .getPermitData(\n walletAddress,\n CONTRACT_ADDRESSES[this.chain].PufferWithdrawalManager as Address,\n amount,\n );\n\n const transact = async () =>\n await this.getContract().write.requestWithdrawalWithPermit(\n [permitData, walletAddress],\n {\n account: walletAddress,\n chain: this.viemChain,\n },\n );\n\n const estimate = async () =>\n await this.getContract().estimateGas.requestWithdrawalWithPermit(\n [permitData, walletAddress],\n { account: walletAddress },\n );\n\n return { transact, estimate };\n }\n\n /**\n * Complete a withdrawal from the queue.\n *\n * @param withdrawalIdx The index of the withdrawal to complete.\n * @returns The transaction hash of the withdrawal.\n */\n public async completeQueuedWithdrawal(\n walletAddress: Address,\n withdrawalIdx: bigint,\n ) {\n const transact = async () =>\n await this.getContract().write.completeQueuedWithdrawal([withdrawalIdx], {\n account: walletAddress,\n chain: this.viemChain,\n });\n\n const estimate = async () =>\n await this.getContract().estimateGas.completeQueuedWithdrawal(\n [withdrawalIdx],\n { account: walletAddress },\n );\n\n return { transact, estimate };\n }\n\n /**\n * Get the withdrawal at the given index.\n *\n * @param withdrawalIdx The index of the withdrawal to get.\n * @returns The withdrawal at the given index.\n */\n public async getWithdrawal(withdrawalIdx: bigint) {\n return await this.getContract().read.getWithdrawal([withdrawalIdx]);\n }\n}\n"],"names":["PufferWithdrawalManagerHandler","chain","walletClient","publicClient","VIEM_CHAINS","ERC20PermitHandler","address","CONTRACT_ADDRESSES","abi","PufferWithdrawalManager","client","getContract","walletAddress","amount","permitData","Token","withdrawalIdx"],"mappings":"sUAiBO,MAAMA,CAA+B,CAc1C,YACUC,EACAC,EACAC,EACR,CAHQ,KAAA,MAAAF,EACA,KAAA,aAAAC,EACA,KAAA,aAAAC,EAER,KAAK,UAAYC,EAAAA,YAAYH,CAAK,EAClC,KAAK,mBAAqB,IAAII,EAAAA,mBAC5BJ,EACAC,EACAC,CAAA,CAEJ,CAxBQ,UACA,mBA8BD,aAAc,CACnB,MAAMG,EAAUC,EAAAA,mBAAmB,KAAK,KAAK,EAC1C,wBACGC,EAAMC,EAAAA,wBACNC,EAAS,CAAE,OAAQ,KAAK,aAAc,OAAQ,KAAK,YAAA,EAEzD,OAAOC,EAAAA,YAAY,CAAE,QAAAL,EAAS,IAAAE,EAAK,OAAAE,EAAQ,CAK7C,CASA,M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