@pufferfinance/puffer-sdk 1.28.0 → 1.28.2
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 +98 -82
- package/dist/contracts/abis/mainnet/CarrotVesting.js +64 -50
- 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 +4 -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 +98 -6600
- package/dist/contracts/handlers/carrot-vesting-handler.js +21 -23
- 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,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import { VAULTS_ADDRESSES as l } from "../vaults-addresses.js";
|
|
8
|
-
import { g as u } from "../../getContract-DEPNMZxg.js";
|
|
9
|
-
class v {
|
|
1
|
+
import { V as a } from "../../constants-CuIEh_ZS.js";
|
|
2
|
+
import { LagoonVault as n } from "../abis/mainnet/LagoonVault.js";
|
|
3
|
+
import { Token as r } from "../tokens.js";
|
|
4
|
+
import { VAULTS_ADDRESSES as s } from "../vaults-addresses.js";
|
|
5
|
+
import { g as c } from "../../getContract-DQN7VDBo.js";
|
|
6
|
+
class m {
|
|
10
7
|
/**
|
|
11
8
|
* Create the handler for processing Lagoon vault.
|
|
12
9
|
*
|
|
@@ -17,17 +14,17 @@ class v {
|
|
|
17
14
|
* interactions.
|
|
18
15
|
*/
|
|
19
16
|
constructor(t, e, i) {
|
|
20
|
-
|
|
21
|
-
this.chain = t, this.walletClient = e, this.publicClient = i, this.viemChain = c[t];
|
|
17
|
+
this.chain = t, this.walletClient = e, this.publicClient = i, this.viemChain = a[t];
|
|
22
18
|
}
|
|
19
|
+
viemChain;
|
|
23
20
|
/**
|
|
24
21
|
* Get the contract.
|
|
25
22
|
*
|
|
26
23
|
* @returns The viem contract.
|
|
27
24
|
*/
|
|
28
25
|
getContract() {
|
|
29
|
-
const t =
|
|
30
|
-
return
|
|
26
|
+
const t = s[r.tacpufETH][this.chain].LagoonVault, e = n, i = { public: this.publicClient, wallet: this.walletClient };
|
|
27
|
+
return c({ address: t, abi: e, client: i });
|
|
31
28
|
}
|
|
32
29
|
/**
|
|
33
30
|
* Approve a spender to spend the token.
|
|
@@ -329,6 +326,6 @@ class v {
|
|
|
329
326
|
}
|
|
330
327
|
}
|
|
331
328
|
export {
|
|
332
|
-
|
|
329
|
+
m as LagoonVaultHandler
|
|
333
330
|
};
|
|
334
331
|
//# sourceMappingURL=lagoon-vault-handler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lagoon-vault-handler.js","sources":["../../../lib/contracts/handlers/lagoon-vault-handler.ts"],"sourcesContent":["import {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n Account,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { LagoonVault } from '../abis/mainnet/LagoonVault';\nimport { Token } from '../tokens';\nimport { VAULTS_ADDRESSES } from '../vaults-addresses';\n\n/**\n * Handler for the `LagoonVault` contract exposing methods to interact\n * with the contract.\n */\nexport class LagoonVaultHandler {\n private viemChain: ViemChain;\n\n /**\n * Create the handler for processing Lagoon vault.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n }\n\n /**\n * Get the contract.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = VAULTS_ADDRESSES[Token.tacpufETH][this.chain]\n .LagoonVault as Address;\n const abi = LagoonVault;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Approve a spender to spend the token.\n *\n * @param spender The spender of the token.\n * @param amount The amount to approve.\n * @returns The transaction.\n */\n public approve(spender: Address, amount: bigint) {\n return this.getContract().write.approve([spender, amount], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Get the allowance of the owner for the spender.\n *\n * @param owner The owner of the allowance.\n * @param spender The spender of the allowance.\n * @returns The allowance.\n */\n public getAllowance(owner: Address, spender: Address) {\n return this.getContract().read.allowance([owner, spender]);\n }\n\n /**\n * Get the balance for the address.\n *\n * @param address The address to get the balance of.\n * @returns The balance.\n */\n public getBalance(address: Address) {\n return this.getContract().read.balanceOf([address]);\n }\n\n /**\n * Get the total supply of the token.\n *\n * @returns The total supply.\n */\n public getTotalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Check if the total assets are valid. Used for checking if\n * synchronous deposit is possible.\n *\n * @returns True if the total assets are valid, false otherwise.\n */\n public isTotalAssetsValid() {\n return this.getContract().read.isTotalAssetsValid();\n }\n\n /**\n * Get the symbol of the token. (tacpufETH)\n *\n * @returns The symbol.\n */\n public symbol() {\n return this.getContract().read.symbol();\n }\n\n /**\n * Deposit an amount of the assets (pufETH) to the vault to get shares\n * (tacpufETH).\n *\n * @param amount The amount to deposit.\n * @param receiver The receiver of the tacpufETH.\n * @param controller The optional controller of the deposit. Set to\n * the receiver if not sure.\n * @returns The transaction.\n */\n public deposit(amount: bigint, receiver: Address, controller?: Address) {\n if (controller) {\n return this.getContract().write.deposit([amount, receiver, controller], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n return this.getContract().write.deposit([amount, receiver], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Synchronously deposit an amount of the assets (pufETH) to the vault\n * to get shares (tacpufETH). This is only possible if `isTotalAssetsValid`\n * is true.\n *\n * @param amount The amount to deposit.\n * @param receiver The receiver of the tacpufETH.\n * @param referral The referral of the deposit. Falls back to the\n * receiver if not provided.\n * @returns The transaction.\n */\n public syncDeposit(\n amount: bigint,\n receiver: Address,\n referral: Address = receiver,\n ) {\n return this.getContract().write.syncDeposit([amount, receiver, referral], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Request an asynchronous deposit of an amount of the assets (pufETH)\n * to the vault to get shares (tacpufETH). This should be used if\n * `isTotalAssetsValid` is false.\n *\n * @param amount The amount to deposit.\n * @param receiver The receiver of the tacpufETH.\n * @param controller The optional controller of the deposit. Falls back\n * to the receiver if not provided.\n * @returns The transaction.\n */\n public requestDeposit(\n amount: bigint,\n receiver: Address,\n controller: Address = receiver,\n ) {\n return this.getContract().write.requestDeposit(\n [amount, receiver, controller],\n {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n value: amount,\n },\n );\n }\n\n /**\n * Get the pending deposit request for the request id and controller.\n *\n * @param requestId The request id. Use `0` as wild card.\n * @param controller The controller. Usually the depositor or user who\n * initiated the deposit.\n * @returns The pending deposit request.\n */\n public pendingDepositRequest(requestId: bigint = 0n, controller: Address) {\n return this.getContract().read.pendingDepositRequest([\n requestId,\n controller,\n ]);\n }\n\n /**\n * Withdraw an amount of the shares (pufETH) so the receiver\n * gets the assets (pufETH).\n *\n * @param assets The amount of assets (pufETH) to withdraw.\n * @param receiver The receiver of the assets.\n * @param controller The controller of the withdrawal. Falls back to\n * the receiver if not provided.\n * @returns The transaction.\n */\n public withdraw(\n assets: bigint,\n receiver: Address,\n controller: Address = receiver,\n ) {\n return this.getContract().write.withdraw([assets, receiver, controller], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Redeem an amount of the shares (tacpufETH) so the receiver\n * gets the assets (pufETH).\n *\n * @param shares The amount of shares (tacpufETH) to redeem.\n * @param receiver The receiver of the assets.\n * @param controller The controller of the withdrawal. Falls back to\n * the receiver if not provided.\n * @returns The transaction.\n */\n public redeem(\n shares: bigint,\n receiver: Address,\n controller: Address = receiver,\n ) {\n return this.getContract().write.redeem([shares, receiver, controller], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Request an asynchronous redeem of an amount of the shares (tacpufETH)\n * so the receiver gets the assets (pufETH).\n *\n * @param shares The amount of shares (tacpufETH) to redeem.\n * @param receiver The receiver of the assets.\n * @param controller The controller of the redemption. Falls back to\n * the receiver if not provided.\n * @returns The transaction.\n */\n public requestRedeem(\n shares: bigint,\n receiver: Address,\n controller: Address = receiver,\n ) {\n return this.getContract().write.requestRedeem(\n [shares, receiver, controller],\n {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Get the pending redeem request for the request id and controller.\n *\n * @param requestId The request id. Use `0` as wild card.\n * @param controller The controller. Usually the redeemer or user who\n * initiated the redeem.\n * @returns The pending redeem request.\n */\n public pendingRedeemRequest(requestId: bigint = 0n, controller: Address) {\n return this.getContract().read.pendingRedeemRequest([\n requestId,\n controller,\n ]);\n }\n\n /**\n * Provides a preview of the number of shares that would be minted for\n * a given deposit amount, after fees.\n *\n * @param amount The amount to deposit.\n * @returns The preview.\n */\n public previewDeposit(amount: bigint) {\n return this.getContract().read.previewDeposit([amount]);\n }\n\n /**\n * Provides a preview of the number of shares (tacpufETH) that would be\n * burned for the given amount of assets (pufETH).\n *\n * @param assets The amount of assets (pufETH) to withdraw.\n * @returns The preview.\n */\n public previewWithdraw(assets: bigint) {\n return this.getContract().read.previewWithdraw([assets]);\n }\n\n /**\n * Provides a preview of the amount of assets (pufETH) that would be redeemed\n * for the given shares (tacpufETH), after withdrawal fees. Subtracts\n * the withdrawal fee from the share amount to determine the net\n * shares for asset conversion.\n *\n * @param shares The amount of shares (tacpufETH) to redeem.\n * @returns The preview.\n */\n public previewRedeem(shares: bigint) {\n return this.getContract().read.previewRedeem([shares]);\n }\n\n /**\n * Convert an amount of the shares (tacpufETH) to the assets (pufETH).\n *\n * @param shares The amount of shares (tacpufETH) to convert.\n * @param requestId An optional request id for the conversion.\n * @returns The amount of assets (pufETH).\n */\n public convertToAssets(shares: bigint, requestId?: bigint) {\n if (requestId) {\n return this.getContract().read.convertToAssets([shares, requestId]);\n }\n\n return this.getContract().read.convertToAssets([shares]);\n }\n\n /**\n * Convert an amount of the assets (pufETH) to the shares (tacpufETH).\n *\n * @param assets The amount of assets (pufETH) to convert.\n * @param requestId An optional request id for the conversion.\n * @returns The amount of shares (tacpufETH).\n */\n public convertToShares(assets: bigint, requestId?: bigint) {\n if (requestId) {\n return this.getContract().read.convertToShares([assets, requestId]);\n }\n\n return this.getContract().read.convertToShares([assets]);\n }\n\n /**\n * Get the claimable deposit request for the request id and controller.\n *\n * @param requestId The request id. Use `0` as wild card.\n * @param controller The controller. Usually the depositor or user who\n * initiated the deposit.\n * @returns The claimable deposit request.\n */\n public claimableDepositRequest(requestId: bigint = 0n, controller: Address) {\n return this.getContract().read.claimableDepositRequest([\n requestId,\n controller,\n ]);\n }\n\n /**\n * Get the claimable redeem request for the request id and controller.\n *\n * @param requestId The request id. Use `0` as wild card.\n * @param controller The controller. Usually the redeemer or user who\n * initiated the redeem.\n * @returns The claimable redeem request.\n */\n public claimableRedeemRequest(requestId: bigint = 0n, controller: Address) {\n return this.getContract().read.claimableRedeemRequest([\n requestId,\n controller,\n ]);\n }\n\n /**\n * Claim shares and request a redeem of an amount of the shares (tacpufETH)\n * so the receiver gets the assets (pufETH).\n *\n * @param shares The amount of shares (tacpufETH) to claim.\n * @returns The transaction.\n */\n public claimSharesAndRequestRedeem(shares: bigint) {\n return this.getContract().write.claimSharesAndRequestRedeem([shares], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Claim shares on behalf of multiple controllers.\n *\n * @param controllers The controllers to claim shares on behalf of.\n * @returns The transaction.\n */\n public claimSharesOnBehalf(controllers: Address[]) {\n return this.getContract().write.claimSharesOnBehalf([controllers], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n}\n"],"names":["LagoonVaultHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","VAULTS_ADDRESSES","Token","abi","LagoonVault","client","getContract","spender","amount","owner","receiver","controller","referral","requestId","assets","shares","controllers"],"mappings":";;;;;;;;AAiBO,MAAMA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAY9B,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,EAQ7B,cAAc;AACnB,UAAMK,IAAUC,EAAiBC,EAAM,SAAS,EAAE,KAAK,KAAK,EACzD,aACGC,IAAMC,GACNC,IAAS,EAAE,QAAQ,KAAK,cAAc,QAAQ,KAAK,aAAa;AAEtE,WAAOC,EAAY,EAAE,SAAAN,GAAS,KAAAG,GAAK,QAAAE,GAAQ;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EActC,QAAQE,GAAkBC,GAAgB;AACxC,WAAA,KAAK,cAAc,MAAM,QAAQ,CAACD,GAASC,CAAM,GAAG;AAAA,MACzD,SAAS,KAAK,aAAa;AAAA,MAC3B,OAAO,KAAK;AAAA,IAAA,CACb;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,E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AAA,MACAF;AAAA,IAAA,CACD;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWI,uBAAuBE,IAAoB,IAAIF,GAAqB;AACzE,WAAO,KAAK,cAAc,KAAK,uBAAuB;AAAA,MACpDE;AAAA,MACAF;AAAA,IAAA,CACD;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUI,4BAA4BI,GAAgB;AACjD,WAAO,KAAK,YAAY,EAAE,MAAM,4BAA4B,CAACA,CAAM,GAAG;AAAA,MACpE,SAAS,KAAK,aAAa;AAAA,MAC3B,OAAO,KAAK;AAAA,IAAA,CACb;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASI,oBAAoBC,GAAwB;AACjD,WAAO,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAACA,CAAW,GAAG;AAAA,MACjE,SAAS,KAAK,aAAa;AAAA,MAC3B,OAAO,KAAK;AAAA,IAAA,CACb;AAAA,EAAA;AAEL;"}
|
|
1
|
+
{"version":3,"file":"lagoon-vault-handler.js","sources":["../../../lib/contracts/handlers/lagoon-vault-handler.ts"],"sourcesContent":["import {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n Account,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { LagoonVault } from '../abis/mainnet/LagoonVault';\nimport { Token } from '../tokens';\nimport { VAULTS_ADDRESSES } from '../vaults-addresses';\n\n/**\n * Handler for the `LagoonVault` contract exposing methods to interact\n * with the contract.\n */\nexport class LagoonVaultHandler {\n private viemChain: ViemChain;\n\n /**\n * Create the handler for processing Lagoon vault.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n }\n\n /**\n * Get the contract.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = VAULTS_ADDRESSES[Token.tacpufETH][this.chain]\n .LagoonVault as Address;\n const abi = LagoonVault;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Approve a spender to spend the token.\n *\n * @param spender The spender of the token.\n * @param amount The amount to approve.\n * @returns The transaction.\n */\n public approve(spender: Address, amount: bigint) {\n return this.getContract().write.approve([spender, amount], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Get the allowance of the owner for the spender.\n *\n * @param owner The owner of the allowance.\n * @param spender The spender of the allowance.\n * @returns The allowance.\n */\n public getAllowance(owner: Address, spender: Address) {\n return this.getContract().read.allowance([owner, spender]);\n }\n\n /**\n * Get the balance for the address.\n *\n * @param address The address to get the balance of.\n * @returns The balance.\n */\n public getBalance(address: Address) {\n return this.getContract().read.balanceOf([address]);\n }\n\n /**\n * Get the total supply of the token.\n *\n * @returns The total supply.\n */\n public getTotalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Check if the total assets are valid. Used for checking if\n * synchronous deposit is possible.\n *\n * @returns True if the total assets are valid, false otherwise.\n */\n public isTotalAssetsValid() {\n return this.getContract().read.isTotalAssetsValid();\n }\n\n /**\n * Get the symbol of the token. (tacpufETH)\n *\n * @returns The symbol.\n */\n public symbol() {\n return this.getContract().read.symbol();\n }\n\n /**\n * Deposit an amount of the assets (pufETH) to the vault to get shares\n * (tacpufETH).\n *\n * @param amount The amount to deposit.\n * @param receiver The receiver of the tacpufETH.\n * @param controller The optional controller of the deposit. Set to\n * the receiver if not sure.\n * @returns The transaction.\n */\n public deposit(amount: bigint, receiver: Address, controller?: Address) {\n if (controller) {\n return this.getContract().write.deposit([amount, receiver, controller], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n return this.getContract().write.deposit([amount, receiver], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Synchronously deposit an amount of the assets (pufETH) to the vault\n * to get shares (tacpufETH). This is only possible if `isTotalAssetsValid`\n * is true.\n *\n * @param amount The amount to deposit.\n * @param receiver The receiver of the tacpufETH.\n * @param referral The referral of the deposit. Falls back to the\n * receiver if not provided.\n * @returns The transaction.\n */\n public syncDeposit(\n amount: bigint,\n receiver: Address,\n referral: Address = receiver,\n ) {\n return this.getContract().write.syncDeposit([amount, receiver, referral], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Request an asynchronous deposit of an amount of the assets (pufETH)\n * to the vault to get shares (tacpufETH). This should be used if\n * `isTotalAssetsValid` is false.\n *\n * @param amount The amount to deposit.\n * @param receiver The receiver of the tacpufETH.\n * @param controller The optional controller of the deposit. Falls back\n * to the receiver if not provided.\n * @returns The transaction.\n */\n public requestDeposit(\n amount: bigint,\n receiver: Address,\n controller: Address = receiver,\n ) {\n return this.getContract().write.requestDeposit(\n [amount, receiver, controller],\n {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n value: amount,\n },\n );\n }\n\n /**\n * Get the pending deposit request for the request id and controller.\n *\n * @param requestId The request id. Use `0` as wild card.\n * @param controller The controller. Usually the depositor or user who\n * initiated the deposit.\n * @returns The pending deposit request.\n */\n public pendingDepositRequest(requestId: bigint = 0n, controller: Address) {\n return this.getContract().read.pendingDepositRequest([\n requestId,\n controller,\n ]);\n }\n\n /**\n * Withdraw an amount of the shares (pufETH) so the receiver\n * gets the assets (pufETH).\n *\n * @param assets The amount of assets (pufETH) to withdraw.\n * @param receiver The receiver of the assets.\n * @param controller The controller of the withdrawal. Falls back to\n * the receiver if not provided.\n * @returns The transaction.\n */\n public withdraw(\n assets: bigint,\n receiver: Address,\n controller: Address = receiver,\n ) {\n return this.getContract().write.withdraw([assets, receiver, controller], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Redeem an amount of the shares (tacpufETH) so the receiver\n * gets the assets (pufETH).\n *\n * @param shares The amount of shares (tacpufETH) to redeem.\n * @param receiver The receiver of the assets.\n * @param controller The controller of the withdrawal. Falls back to\n * the receiver if not provided.\n * @returns The transaction.\n */\n public redeem(\n shares: bigint,\n receiver: Address,\n controller: Address = receiver,\n ) {\n return this.getContract().write.redeem([shares, receiver, controller], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Request an asynchronous redeem of an amount of the shares (tacpufETH)\n * so the receiver gets the assets (pufETH).\n *\n * @param shares The amount of shares (tacpufETH) to redeem.\n * @param receiver The receiver of the assets.\n * @param controller The controller of the redemption. Falls back to\n * the receiver if not provided.\n * @returns The transaction.\n */\n public requestRedeem(\n shares: bigint,\n receiver: Address,\n controller: Address = receiver,\n ) {\n return this.getContract().write.requestRedeem(\n [shares, receiver, controller],\n {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Get the pending redeem request for the request id and controller.\n *\n * @param requestId The request id. Use `0` as wild card.\n * @param controller The controller. Usually the redeemer or user who\n * initiated the redeem.\n * @returns The pending redeem request.\n */\n public pendingRedeemRequest(requestId: bigint = 0n, controller: Address) {\n return this.getContract().read.pendingRedeemRequest([\n requestId,\n controller,\n ]);\n }\n\n /**\n * Provides a preview of the number of shares that would be minted for\n * a given deposit amount, after fees.\n *\n * @param amount The amount to deposit.\n * @returns The preview.\n */\n public previewDeposit(amount: bigint) {\n return this.getContract().read.previewDeposit([amount]);\n }\n\n /**\n * Provides a preview of the number of shares (tacpufETH) that would be\n * burned for the given amount of assets (pufETH).\n *\n * @param assets The amount of assets (pufETH) to withdraw.\n * @returns The preview.\n */\n public previewWithdraw(assets: bigint) {\n return this.getContract().read.previewWithdraw([assets]);\n }\n\n /**\n * Provides a preview of the amount of assets (pufETH) that would be redeemed\n * for the given shares (tacpufETH), after withdrawal fees. Subtracts\n * the withdrawal fee from the share amount to determine the net\n * shares for asset conversion.\n *\n * @param shares The amount of shares (tacpufETH) to redeem.\n * @returns The preview.\n */\n public previewRedeem(shares: bigint) {\n return this.getContract().read.previewRedeem([shares]);\n }\n\n /**\n * Convert an amount of the shares (tacpufETH) to the assets (pufETH).\n *\n * @param shares The amount of shares (tacpufETH) to convert.\n * @param requestId An optional request id for the conversion.\n * @returns The amount of assets (pufETH).\n */\n public convertToAssets(shares: bigint, requestId?: bigint) {\n if (requestId) {\n return this.getContract().read.convertToAssets([shares, requestId]);\n }\n\n return this.getContract().read.convertToAssets([shares]);\n }\n\n /**\n * Convert an amount of the assets (pufETH) to the shares (tacpufETH).\n *\n * @param assets The amount of assets (pufETH) to convert.\n * @param requestId An optional request id for the conversion.\n * @returns The amount of shares (tacpufETH).\n */\n public convertToShares(assets: bigint, requestId?: bigint) {\n if (requestId) {\n return this.getContract().read.convertToShares([assets, requestId]);\n }\n\n return this.getContract().read.convertToShares([assets]);\n }\n\n /**\n * Get the claimable deposit request for the request id and controller.\n *\n * @param requestId The request id. Use `0` as wild card.\n * @param controller The controller. Usually the depositor or user who\n * initiated the deposit.\n * @returns The claimable deposit request.\n */\n public claimableDepositRequest(requestId: bigint = 0n, controller: Address) {\n return this.getContract().read.claimableDepositRequest([\n requestId,\n controller,\n ]);\n }\n\n /**\n * Get the claimable redeem request for the request id and controller.\n *\n * @param requestId The request id. Use `0` as wild card.\n * @param controller The controller. Usually the redeemer or user who\n * initiated the redeem.\n * @returns The claimable redeem request.\n */\n public claimableRedeemRequest(requestId: bigint = 0n, controller: Address) {\n return this.getContract().read.claimableRedeemRequest([\n requestId,\n controller,\n ]);\n }\n\n /**\n * Claim shares and request a redeem of an amount of the shares (tacpufETH)\n * so the receiver gets the assets (pufETH).\n *\n * @param shares The amount of shares (tacpufETH) to claim.\n * @returns The transaction.\n */\n public claimSharesAndRequestRedeem(shares: bigint) {\n return this.getContract().write.claimSharesAndRequestRedeem([shares], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Claim shares on behalf of multiple controllers.\n *\n * @param controllers The controllers to claim shares on behalf of.\n * @returns The transaction.\n */\n public claimSharesOnBehalf(controllers: Address[]) {\n return this.getContract().write.claimSharesOnBehalf([controllers], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n}\n"],"names":["LagoonVaultHandler","chain","walletClient","publicClient","VIEM_CHAINS","address","VAULTS_ADDRESSES","Token","abi","LagoonVault","client","getContract","spender","amount","owner","receiver","controller","referral","requestId","assets","shares","controllers"],"mappings":";;;;;AAiBO,MAAMA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAY9B,YACUC,GACAC,GACAC,GACR;AAHQ,SAAA,QAAAF,GACA,KAAA,eAAAC,GACA,KAAA,eAAAC,GAER,KAAK,YAAYC,EAAYH,CAAK;AAAA,EACpC;AAAA,EAjBQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAwBD,cAAc;AACnB,UAAMI,IAAUC,EAAiBC,EAAM,SAAS,EAAE,KAAK,KAAK,EACzD,aACGC,IAAMC,GACNC,IAAS,EAAE,QAAQ,KAAK,cAAc,QAAQ,KAAK,aAAA;AAEzD,WAAOC,EAAY,EAAE,SAAAN,GAAS,KAAAG,GAAK,QAAAE,GAAQ;AAAA,EAK7C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASO,QAAQE,GAAkBC,GAAgB;AAC/C,WAAO,KAAK,cAAc,MAAM,QAAQ,CAACD,GAASC,CAAM,GAAG;AAAA,MACzD,SAAS,KAAK,aAAa;AAAA,MAC3B,OAAO,KAAK;AAAA,IAAA,CACb;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASO,aAAaC,GAAgBF,GAAkB;AACpD,WAAO,KAAK,cAAc,KAAK,UAAU,CAACE,GAAOF,CAAO,CAAC;AAAA,EAC3D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,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AAA,MACpDE;AAAA,MACAF;AAAA,IAAA,CACD;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASO,4BAA4BI,GAAgB;AACjD,WAAO,KAAK,YAAA,EAAc,MAAM,4BAA4B,CAACA,CAAM,GAAG;AAAA,MACpE,SAAS,KAAK,aAAa;AAAA,MAC3B,OAAO,KAAK;AAAA,IAAA,CACb;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,oBAAoBC,GAAwB;AACjD,WAAO,KAAK,YAAA,EAAc,MAAM,oBAAoB,CAACA,CAAW,GAAG;AAAA,MACjE,SAAS,KAAK,aAAa;AAAA,MAC3B,OAAO,KAAK;AAAA,IAAA,CACb;AAAA,EACH;AACF;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../constants-6kuRTsbU.cjs"),n=require("../tokens.cjs"),c=require("../abis/mainnet/mtwCARROT.cjs"),s=require("../../getContract-D4_SEfqa.cjs");class o{constructor(t,e,r){this.chain=t,this.walletClient=e,this.publicClient=r,this.viemChain=a.VIEM_CHAINS[t]}viemChain;getContract(){const t=n.TOKENS_ADDRESSES[n.Token.mtwCARROT][this.chain],e=c.mtwCARROT,r={public:this.publicClient,wallet:this.walletClient};return s.getContract({address:t,abi:e,client:r})}balanceOf(t){return this.getContract().read.balanceOf([t])}allowance(t,e){return this.getContract().read.allowance([t,e])}claimable(t,e){return e!==void 0?this.getContract().read.claimable([t,e]):this.getContract().read.claimable([t])}cliffDuration(){return this.getContract().read.cliffDuration()}async getUserVestings(t){const[e,r]=await this.getContract().read.getUserVestings([t]);return{allVestings:e,nextClaimIndex:r}}isTokenWrapper(){return this.getContract().read.isTokenWrapper()}symbol(){return this.getContract().read.symbol()}token(){return this.getContract().read.token()}underlying(){return this.getContract().read.underlying()}vestingData(t){return this.getContract().read.vestingData([t])}approve(t,e,r){return this.getContract().write.approve([e,r],{account:t,chain:this.viemChain})}claim(t,e,r){return r!==void 0?this.getContract().write.claim([e,r],{account:t,chain:this.viemChain}):this.getContract().write.claim([e],{account:t,chain:this.viemChain})}decreaseAllowance(t,e,r){return this.getContract().write.decreaseAllowance([e,r],{account:t,chain:this.viemChain})}increaseAllowance(t,e,r){return this.getContract().write.increaseAllowance([e,r],{account:t,chain:this.viemChain})}recoverERC20(t,e,r,i){return this.getContract().write.recoverERC20([e,r,i],{account:t,chain:this.viemChain})}transfer(t,e,r){return this.getContract().write.transfer([e,r],{account:t,chain:this.viemChain})}}exports.MtwCarrotHandler=o;
|
|
2
2
|
//# sourceMappingURL=mtw-carrot-handler.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mtw-carrot-handler.cjs","sources":["../../../lib/contracts/handlers/mtw-carrot-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 { TOKENS_ADDRESSES, Token } from '../tokens';\nimport { mtwCARROT } from '../abis/mainnet/mtwCARROT';\n\n/**\n * Handler for the `mtwCARROT` token contract.\n */\nexport class MtwCarrotHandler {\n private viemChain: ViemChain;\n\n /**\n * Create the handler for the `mtwCARROT` token 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 = TOKENS_ADDRESSES[Token.mtwCARROT][this.chain];\n const abi = mtwCARROT;\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 * Retrieve the balance of a given address.\n *\n * @param address The address to query the balance for.\n * @returns The balance of the specified address.\n */\n public balanceOf(address: Address) {\n return this.getContract().read.balanceOf([address]);\n }\n\n /**\n * Retrieve the allowance a spender has from an owner.\n *\n * @param owner The address of the token owner.\n * @param spender The address of the spender.\n * @returns The amount the spender is allowed to use on behalf of the owner.\n */\n public allowance(owner: Address, spender: Address) {\n return this.getContract().read.allowance([owner, spender]);\n }\n\n // TODO: Not able to test overloads using `eth-testing`.\n /* istanbul ignore next */\n /**\n * Retrieve the claimable amount for a user, optionally at a specific index.\n *\n * @param user The user's address.\n * @param maxClaimIn, '0x123'dex The maximum index to check for claimable amount (optional).\n * @returns The claimable amount for the user.\n */\n public claimable(user: Address, maxClaimIndex?: bigint): Promise<bigint> {\n if (maxClaimIndex !== undefined) {\n return this.getContract().read.claimable([user, maxClaimIndex]);\n }\n\n return this.getContract().read.claimable([user]);\n }\n\n /**\n * Retrieve the cliff duration of the vesting schedule.\n *\n * @returns The cliff duration in seconds.\n */\n public cliffDuration() {\n return this.getContract().read.cliffDuration();\n }\n\n /**\n * Retrieve all vesting schedules associated with a user.\n *\n * @param user The address of the user.\n * @returns An array of vesting schedules.\n */\n public async getUserVestings(user: Address) {\n const [allVestings, nextClaimIndex] =\n await this.getContract().read.getUserVestings([user]);\n\n return {\n allVestings,\n nextClaimIndex,\n };\n }\n\n /**\n * Check if the contract is a token wrapper.\n *\n * @returns True if the contract is a token wrapper, false otherwise.\n */\n public isTokenWrapper() {\n return this.getContract().read.isTokenWrapper();\n }\n\n /**\n * Retrieve the symbol of the token.\n *\n * @returns The token symbol.\n */\n public symbol() {\n return this.getContract().read.symbol();\n }\n\n /**\n * Retrieve the token address this contract wraps or represents.\n *\n * @returns The address of the token.\n */\n public token() {\n return this.getContract().read.token();\n }\n\n /**\n * Retrieve the underlying asset for the token.\n *\n * @returns The address of the underlying asset.\n */\n public underlying() {\n return this.getContract().read.underlying();\n }\n\n /**\n * Retrieve vesting data for a given address.\n *\n * @param address The address to query vesting data for.\n * @returns Next claim index.\n */\n public vestingData(address: Address) {\n return this.getContract().read.vestingData([address]);\n }\n\n /**\n * Approve a spender to use a specific amount of the owner's tokens.\n *\n * @param ownerAddress Address of the caller of the transaction.\n * @param spenderAddress Address of the spender.\n * @param amount Value to approve for the spender.\n * @returns A promise that resolves to the transaction hash.\n */\n public approve(\n ownerAddress: Address,\n spenderAddress: Address,\n amount: bigint,\n ) {\n return this.getContract().write.approve([spenderAddress, amount], {\n account: ownerAddress,\n chain: this.viemChain,\n });\n }\n\n // TODO: Not able to test overloads using `eth-testing`.\n /* istanbul ignore next */\n /**\n * Claim tokens for a user.\n *\n * @param account Address of the caller of the transaction.\n * @param user The user's address.\n * @param maxClaimIndex The maximum index to check for claimable amount (optional).\n * @returns A promise that resolves to the transaction hash.\n */\n public claim(account: Address, user: Address, maxClaimIndex?: bigint) {\n if (maxClaimIndex !== undefined) {\n return this.getContract().write.claim([user, maxClaimIndex], {\n account,\n chain: this.viemChain,\n });\n }\n\n return this.getContract().write.claim([user], {\n account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Decrease the allowance for a spender.\n *\n * @param ownerAddress Address of the caller of the transaction.\n * @param spenderAddress Address of the spender.\n * @param subtractedValue The amount by which the allowance is to be decreased.\n * @returns A promise that resolves to the transaction hash.\n */\n public decreaseAllowance(\n ownerAddress: Address,\n spenderAddress: Address,\n subtractedValue: bigint,\n ) {\n return this.getContract().write.decreaseAllowance(\n [spenderAddress, subtractedValue],\n {\n account: ownerAddress,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Increase the allowance for a spender.\n *\n * @param ownerAddress Address of the caller of the transaction.\n * @param spenderAddress Address of the spender.\n * @param addedValue The amount by which the allowance is to be increased.\n * @returns A promise that resolves to the transaction hash.\n */\n public increaseAllowance(\n ownerAddress: Address,\n spenderAddress: Address,\n addedValue: bigint,\n ) {\n return this.getContract().write.increaseAllowance(\n [spenderAddress, addedValue],\n {\n account: ownerAddress,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Recover ERC20 tokens sent to this contract.\n *\n * @param account Address of the caller of the transaction.\n * @param tokenAddress The address of the token to recover.\n * @param to The address to which the tokens should be sent.\n * @param amountToRecover The amount of tokens to recover.\n * @returns A promise that resolves to the transaction hash.\n */\n public recoverERC20(\n account: Address,\n tokenAddress: Address,\n to: Address,\n amountToRecover: bigint,\n ) {\n return this.getContract().write.recoverERC20(\n [tokenAddress, to, amountToRecover],\n {\n account,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Transfer tokens to another address.\n *\n * @param ownerAddress Address of the caller of the transaction.\n * @param to The address to transfer tokens to.\n * @param amount The amount of tokens to transfer.\n * @returns A promise that resolves to the transaction hash.\n */\n public transfer(ownerAddress: Address, to: Address, amount: bigint) {\n return this.getContract().write.transfer([to, amount], {\n account: ownerAddress,\n chain: this.viemChain,\n });\n }\n}\n"],"names":["MtwCarrotHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","TOKENS_ADDRESSES","Token","abi","mtwCARROT","client","getContract","owner","spender","user","maxClaimIndex","allVestings","nextClaimIndex","ownerAddress","spenderAddress","amount","account","subtractedValue","addedValue","tokenAddress","to","amountToRecover"],"mappings":"sZAcO,MAAMA,CAAiB,CAa5B,YACUC,EACAC,EACAC,EACR,CAhBMC,EAAA,kBAaE,KAAA,MAAAH,EACA,KAAA,aAAAC,EACA,KAAA,aAAAC,EAEH,KAAA,UAAYE,cAAYJ,CAAK,CAAA,CAS7B,aAAc,CACnB,MAAMK,EAAUC,EAAAA,iBAAiBC,EAAAA,MAAM,SAAS,EAAE,KAAK,KAAK,EACtDC,EAAMC,EAAA,UACNC,EAAS,CAAE,OAAQ,KAAK,aAAc,OAAQ,KAAK,YAAa,EAEtE,OAAOC,EAAY,YAAA,CAAE,QAAAN,EAAS,IAAAG,EAAK,OAAAE,EAAQ,CAAA,CAatC,UAAUL,EAAkB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A,MAAO,KAAK,SAAA,CACb,CAAA,CAWI,kBACLH,EACAC,EACAG,EACA,CACO,OAAA,KAAK,cAAc,MAAM,kBAC9B,CAACH,EAAgBG,CAAe,EAChC,CACE,QAASJ,EACT,MAAO,KAAK,SAAA,CAEhB,CAAA,CAWK,kBACLA,EACAC,EACAI,EACA,CACO,OAAA,KAAK,cAAc,MAAM,kBAC9B,CAACJ,EAAgBI,CAAU,EAC3B,CACE,QAASL,EACT,MAAO,KAAK,SAAA,CAEhB,CAAA,CAYK,aACLG,EACAG,EACAC,EACAC,EACA,CACO,OAAA,KAAK,cAAc,MAAM,aAC9B,CAACF,EAAcC,EAAIC,CAAe,EAClC,CACE,QAAAL,EACA,MAAO,KAAK,SAAA,CAEhB,CAAA,CAWK,SAASH,EAAuBO,EAAaL,EAAgB,CAC3D,OAAA,KAAK,cAAc,MAAM,SAAS,CAACK,EAAIL,CAAM,EAAG,CACrD,QAASF,EACT,MAAO,KAAK,SAAA,CACb,CAAA,CAEL"}
|
|
1
|
+
{"version":3,"file":"mtw-carrot-handler.cjs","sources":["../../../lib/contracts/handlers/mtw-carrot-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 { TOKENS_ADDRESSES, Token } from '../tokens';\nimport { mtwCARROT } from '../abis/mainnet/mtwCARROT';\n\n/**\n * Handler for the `mtwCARROT` token contract.\n */\nexport class MtwCarrotHandler {\n private viemChain: ViemChain;\n\n /**\n * Create the handler for the `mtwCARROT` token 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 = TOKENS_ADDRESSES[Token.mtwCARROT][this.chain];\n const abi = mtwCARROT;\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 * Retrieve the balance of a given address.\n *\n * @param address The address to query the balance for.\n * @returns The balance of the specified address.\n */\n public balanceOf(address: Address) {\n return this.getContract().read.balanceOf([address]);\n }\n\n /**\n * Retrieve the allowance a spender has from an owner.\n *\n * @param owner The address of the token owner.\n * @param spender The address of the spender.\n * @returns The amount the spender is allowed to use on behalf of the owner.\n */\n public allowance(owner: Address, spender: Address) {\n return this.getContract().read.allowance([owner, spender]);\n }\n\n // TODO: Not able to test overloads using `eth-testing`.\n /* istanbul ignore next */\n /**\n * Retrieve the claimable amount for a user, optionally at a specific index.\n *\n * @param user The user's address.\n * @param maxClaimIn, '0x123'dex The maximum index to check for claimable amount (optional).\n * @returns The claimable amount for the user.\n */\n public claimable(user: Address, maxClaimIndex?: bigint): Promise<bigint> {\n if (maxClaimIndex !== undefined) {\n return this.getContract().read.claimable([user, maxClaimIndex]);\n }\n\n return this.getContract().read.claimable([user]);\n }\n\n /**\n * Retrieve the cliff duration of the vesting schedule.\n *\n * @returns The cliff duration in seconds.\n */\n public cliffDuration() {\n return this.getContract().read.cliffDuration();\n }\n\n /**\n * Retrieve all vesting schedules associated with a user.\n *\n * @param user The address of the user.\n * @returns An array of vesting schedules.\n */\n public async getUserVestings(user: Address) {\n const [allVestings, nextClaimIndex] =\n await this.getContract().read.getUserVestings([user]);\n\n return {\n allVestings,\n nextClaimIndex,\n };\n }\n\n /**\n * Check if the contract is a token wrapper.\n *\n * @returns True if the contract is a token wrapper, false otherwise.\n */\n public isTokenWrapper() {\n return this.getContract().read.isTokenWrapper();\n }\n\n /**\n * Retrieve the symbol of the token.\n *\n * @returns The token symbol.\n */\n public symbol() {\n return this.getContract().read.symbol();\n }\n\n /**\n * Retrieve the token address this contract wraps or represents.\n *\n * @returns The address of the token.\n */\n public token() {\n return this.getContract().read.token();\n }\n\n /**\n * Retrieve the underlying asset for the token.\n *\n * @returns The address of the underlying asset.\n */\n public underlying() {\n return this.getContract().read.underlying();\n }\n\n /**\n * Retrieve vesting data for a given address.\n *\n * @param address The address to query vesting data for.\n * @returns Next claim index.\n */\n public vestingData(address: Address) {\n return this.getContract().read.vestingData([address]);\n }\n\n /**\n * Approve a spender to use a specific amount of the owner's tokens.\n *\n * @param ownerAddress Address of the caller of the transaction.\n * @param spenderAddress Address of the spender.\n * @param amount Value to approve for the spender.\n * @returns A promise that resolves to the transaction hash.\n */\n public approve(\n ownerAddress: Address,\n spenderAddress: Address,\n amount: bigint,\n ) {\n return this.getContract().write.approve([spenderAddress, amount], {\n account: ownerAddress,\n chain: this.viemChain,\n });\n }\n\n // TODO: Not able to test overloads using `eth-testing`.\n /* istanbul ignore next */\n /**\n * Claim tokens for a user.\n *\n * @param account Address of the caller of the transaction.\n * @param user The user's address.\n * @param maxClaimIndex The maximum index to check for claimable amount (optional).\n * @returns A promise that resolves to the transaction hash.\n */\n public claim(account: Address, user: Address, maxClaimIndex?: bigint) {\n if (maxClaimIndex !== undefined) {\n return this.getContract().write.claim([user, maxClaimIndex], {\n account,\n chain: this.viemChain,\n });\n }\n\n return this.getContract().write.claim([user], {\n account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Decrease the allowance for a spender.\n *\n * @param ownerAddress Address of the caller of the transaction.\n * @param spenderAddress Address of the spender.\n * @param subtractedValue The amount by which the allowance is to be decreased.\n * @returns A promise that resolves to the transaction hash.\n */\n public decreaseAllowance(\n ownerAddress: Address,\n spenderAddress: Address,\n subtractedValue: bigint,\n ) {\n return this.getContract().write.decreaseAllowance(\n [spenderAddress, subtractedValue],\n {\n account: ownerAddress,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Increase the allowance for a spender.\n *\n * @param ownerAddress Address of the caller of the transaction.\n * @param spenderAddress Address of the spender.\n * @param addedValue The amount by which the allowance is to be increased.\n * @returns A promise that resolves to the transaction hash.\n */\n public increaseAllowance(\n ownerAddress: Address,\n spenderAddress: Address,\n addedValue: bigint,\n ) {\n return this.getContract().write.increaseAllowance(\n [spenderAddress, addedValue],\n {\n account: ownerAddress,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Recover ERC20 tokens sent to this contract.\n *\n * @param account Address of the caller of the transaction.\n * @param tokenAddress The address of the token to recover.\n * @param to The address to which the tokens should be sent.\n * @param amountToRecover The amount of tokens to recover.\n * @returns A promise that resolves to the transaction hash.\n */\n public recoverERC20(\n account: Address,\n tokenAddress: Address,\n to: Address,\n amountToRecover: bigint,\n ) {\n return this.getContract().write.recoverERC20(\n [tokenAddress, to, amountToRecover],\n {\n account,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Transfer tokens to another address.\n *\n * @param ownerAddress Address of the caller of the transaction.\n * @param to The address to transfer tokens to.\n * @param amount The amount of tokens to transfer.\n * @returns A promise that resolves to the transaction hash.\n */\n public transfer(ownerAddress: Address, to: Address, amount: bigint) {\n return this.getContract().write.transfer([to, amount], {\n account: ownerAddress,\n chain: this.viemChain,\n });\n }\n}\n"],"names":["MtwCarrotHandler","chain","walletClient","publicClient","VIEM_CHAINS","address","TOKENS_ADDRESSES","Token","abi","mtwCARROT","client","getContract","owner","spender","user","maxClaimIndex","allVestings","nextClaimIndex","ownerAddress","spenderAddress","amount","account","subtractedValue","addedValue","tokenAddress","to","amountToRecover"],"mappings":"kPAcO,MAAMA,CAAiB,CAa5B,YACUC,EACAC,EACAC,EACR,CAHQ,KAAA,MAAAF,EACA,KAAA,aAAAC,EACA,KAAA,aAAAC,EAER,KAAK,UAAYC,EAAAA,YAAYH,CAAK,CACpC,CAlBQ,UA0BD,aAAc,CACnB,MAAMI,EAAUC,EAAAA,iBAAiBC,EAAAA,MAAM,SAAS,EAAE,KAAK,KAAK,EACtDC,EAAMC,EAAAA,UACNC,EAAS,CAA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