@pufferfinance/puffer-sdk 1.28.1 → 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.map +1 -1
- 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 +96 -6599
- package/dist/contracts/handlers/carrot-vesting-handler.js +19 -22
- 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 { mtwCARROT as C } from "../abis/mainnet/mtwCARROT.js";
|
|
7
|
-
import { g } from "../../getContract-DEPNMZxg.js";
|
|
8
|
-
class p {
|
|
1
|
+
import { V as a } from "../../constants-CuIEh_ZS.js";
|
|
2
|
+
import { TOKENS_ADDRESSES as n, Token as c } from "../tokens.js";
|
|
3
|
+
import { mtwCARROT as s } from "../abis/mainnet/mtwCARROT.js";
|
|
4
|
+
import { g as o } from "../../getContract-DQN7VDBo.js";
|
|
5
|
+
class m {
|
|
9
6
|
/**
|
|
10
7
|
* Create the handler for the `mtwCARROT` token contract exposing
|
|
11
8
|
* methods to interact with the contract.
|
|
@@ -17,9 +14,9 @@ class p {
|
|
|
17
14
|
* interactions.
|
|
18
15
|
*/
|
|
19
16
|
constructor(t, e, r) {
|
|
20
|
-
|
|
21
|
-
this.chain = t, this.walletClient = e, this.publicClient = r, this.viemChain = o[t];
|
|
17
|
+
this.chain = t, this.walletClient = e, this.publicClient = r, this.viemChain = a[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 p {
|
|
|
27
24
|
* @returns The viem contract.
|
|
28
25
|
*/
|
|
29
26
|
getContract() {
|
|
30
|
-
const t =
|
|
31
|
-
return
|
|
27
|
+
const t = n[c.mtwCARROT][this.chain], e = s, r = { public: this.publicClient, wallet: this.walletClient };
|
|
28
|
+
return o({ address: t, abi: e, client: r });
|
|
32
29
|
}
|
|
33
30
|
/**
|
|
34
31
|
* Retrieve the balance of a given address.
|
|
@@ -199,9 +196,9 @@ class p {
|
|
|
199
196
|
* @param amountToRecover The amount of tokens to recover.
|
|
200
197
|
* @returns A promise that resolves to the transaction hash.
|
|
201
198
|
*/
|
|
202
|
-
recoverERC20(t, e, r,
|
|
199
|
+
recoverERC20(t, e, r, i) {
|
|
203
200
|
return this.getContract().write.recoverERC20(
|
|
204
|
-
[e, r,
|
|
201
|
+
[e, r, i],
|
|
205
202
|
{
|
|
206
203
|
account: t,
|
|
207
204
|
chain: this.viemChain
|
|
@@ -224,6 +221,6 @@ class p {
|
|
|
224
221
|
}
|
|
225
222
|
}
|
|
226
223
|
export {
|
|
227
|
-
|
|
224
|
+
m as MtwCarrotHandler
|
|
228
225
|
};
|
|
229
226
|
//# sourceMappingURL=mtw-carrot-handler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mtw-carrot-handler.js","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":"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"}
|
|
1
|
+
{"version":3,"file":"mtw-carrot-handler.js","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":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../vaults-addresses.cjs"),r=require("../tokens.cjs"),c=require("../abis/mainnet/Accountant.cjs"),i=require("../../getContract-D4_SEfqa.cjs");class o{constructor(t,e,n){this.chain=t,this.walletClient=e,this.publicClient=n,this.token=r.UnifiToken.unifiETH}token;withToken(t){return this.token=t,this}getContract(){const t=a.VAULTS_ADDRESSES[this.token][this.chain].NucleusAccountant,e=c.Accountant,n={public:this.publicClient,wallet:this.walletClient};return i.getContract({address:t,abi:e,client:n})}async rateProviderData(t){const[e,n]=await this.getContract().read.rateProviderData([t]);return{isPeggedToBase:e,rateProvider:n}}vault(){return this.getContract().read.vault()}getRate(){return this.getContract().read.getRate()}getRateSafe(){return this.getContract().read.getRateSafe()}getRateInQuote(t){return this.getContract().read.getRateInQuote([t])}getRateInQuoteSafe(t){return this.getContract().read.getRateInQuoteSafe([t])}}exports.NucleusAccountantHandler=o;
|
|
2
2
|
//# sourceMappingURL=nucleus-accountant-handler.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nucleus-accountant-handler.cjs","sources":["../../../lib/contracts/handlers/nucleus-accountant-handler.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain } from '../../chains/constants';\nimport { VAULTS_ADDRESSES } from '../vaults-addresses';\nimport { UnifiToken } from '../tokens';\nimport { Accountant } from '../abis/mainnet/Accountant';\n\n/**\n * Handler for the `Accountant` contract from nucleus.\n */\nexport class NucleusAccountantHandler {\n private token: UnifiToken;\n\n /**\n * Create the handler for processing tokens.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.token = UnifiToken.unifiETH;\n }\n\n /**\n * Set the UniFi token to use for executing transactions on the\n * contract.\n *\n * @param token UniFi token to use for the handler.\n * @returns The handler.\n */\n public withToken(token: UnifiToken) {\n this.token = token;\n return this;\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = VAULTS_ADDRESSES[this.token][this.chain]\n .NucleusAccountant as Address;\n const abi = Accountant;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the rate provider data for the given token address.\n *\n * @param tokenAddress Address of the token.\n * @returns Rate provider data for the given token address.\n */\n public async rateProviderData(tokenAddress: Address) {\n const [isPeggedToBase, rateProvider] =\n await this.getContract().read.rateProviderData([tokenAddress]);\n\n return { isPeggedToBase, rateProvider };\n }\n\n /**\n * Get the vault for the given token address.\n *\n * @returns Vault for the given token address.\n */\n public vault() {\n return this.getContract().read.vault();\n }\n\n /**\n * Get the rate for the given token address.\n *\n * @returns Rate for the given token address.\n */\n public getRate() {\n return this.getContract().read.getRate();\n }\n\n /**\n * Get the rate for the given token address for safe.\n *\n * @returns Rate for the given token address for safe.\n */\n public getRateSafe() {\n return this.getContract().read.getRateSafe();\n }\n\n /**\n * Get the rate from the given quote address.\n *\n * @returns Rate for the given quote address.\n */\n public getRateInQuote(quoteAddress: Address) {\n return this.getContract().read.getRateInQuote([quoteAddress]);\n }\n\n /**\n * Get the rate from the given quote address for safe.\n *\n * @returns Rate for the given quote address for safe.\n */\n public getRateInQuoteSafe(quoteAddress: Address) {\n return this.getContract().read.getRateInQuoteSafe([quoteAddress]);\n }\n}\n"],"names":["NucleusAccountantHandler","chain","walletClient","publicClient","
|
|
1
|
+
{"version":3,"file":"nucleus-accountant-handler.cjs","sources":["../../../lib/contracts/handlers/nucleus-accountant-handler.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain } from '../../chains/constants';\nimport { VAULTS_ADDRESSES } from '../vaults-addresses';\nimport { UnifiToken } from '../tokens';\nimport { Accountant } from '../abis/mainnet/Accountant';\n\n/**\n * Handler for the `Accountant` contract from nucleus.\n */\nexport class NucleusAccountantHandler {\n private token: UnifiToken;\n\n /**\n * Create the handler for processing tokens.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.token = UnifiToken.unifiETH;\n }\n\n /**\n * Set the UniFi token to use for executing transactions on the\n * contract.\n *\n * @param token UniFi token to use for the handler.\n * @returns The handler.\n */\n public withToken(token: UnifiToken) {\n this.token = token;\n return this;\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = VAULTS_ADDRESSES[this.token][this.chain]\n .NucleusAccountant as Address;\n const abi = Accountant;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the rate provider data for the given token address.\n *\n * @param tokenAddress Address of the token.\n * @returns Rate provider data for the given token address.\n */\n public async rateProviderData(tokenAddress: Address) {\n const [isPeggedToBase, rateProvider] =\n await this.getContract().read.rateProviderData([tokenAddress]);\n\n return { isPeggedToBase, rateProvider };\n }\n\n /**\n * Get the vault for the given token address.\n *\n * @returns Vault for the given token address.\n */\n public vault() {\n return this.getContract().read.vault();\n }\n\n /**\n * Get the rate for the given token address.\n *\n * @returns Rate for the given token address.\n */\n public getRate() {\n return this.getContract().read.getRate();\n }\n\n /**\n * Get the rate for the given token address for safe.\n *\n * @returns Rate for the given token address for safe.\n */\n public getRateSafe() {\n return this.getContract().read.getRateSafe();\n }\n\n /**\n * Get the rate from the given quote address.\n *\n * @returns Rate for the given quote address.\n */\n public getRateInQuote(quoteAddress: Address) {\n return this.getContract().read.getRateInQuote([quoteAddress]);\n }\n\n /**\n * Get the rate from the given quote address for safe.\n *\n * @returns Rate for the given quote address for safe.\n */\n public getRateInQuoteSafe(quoteAddress: Address) {\n return this.getContract().read.getRateInQuoteSafe([quoteAddress]);\n }\n}\n"],"names":["NucleusAccountantHandler","chain","walletClient","publicClient","UnifiToken","token","address","VAULTS_ADDRESSES","abi","Accountant","client","getContract","tokenAddress","isPeggedToBase","rateProvider","quoteAddress"],"mappings":"8OAiBO,MAAMA,CAAyB,CAYpC,YACUC,EACAC,EACAC,EACR,CAHQ,KAAA,MAAAF,EACA,KAAA,aAAAC,EACA,KAAA,aAAAC,EAER,KAAK,MAAQC,EAAAA,WAAW,QAC1B,CAjBQ,MA0BD,UAAUC,EAAmB,CAClC,YAAK,MAAQA,EACN,IACT,CAQO,aAAc,CACnB,MAAMC,EAAUC,EAAAA,iBAAiB,KAAK,KAAK,EAAE,KAAK,KAAK,EACpD,kBACGC,EAAMC,EAAAA,WACNC,EAAS,CAAE,OAAQ,KAAK,aAAc,OAAQ,KAAK,YAAA,EAEzD,OAAOC,EAAAA,YAAY,CAAE,QAAAL,EAAS,IAAAE,EAAK,OAAAE,EAAQ,CAK7C,CAQA,MAAa,iBAAiBE,EAAuB,CACnD,KAAM,CAACC,EAAgBC,CAAY,EACjC,MAAM,KAAK,YAAA,EAAc,KAAK,iBAAiB,CAACF,CAAY,CAAC,EAE/D,MAAO,CAAE,eAAAC,EAAgB,aAAAC,CAAA,CAC3B,CAOO,OAAQ,CACb,OAAO,KAAK,cAAc,KAAK,MAAA,CACjC,CAOO,SAAU,CACf,OAAO,KAAK,cAAc,KAAK,QAAA,CACjC,CAOO,aAAc,CACnB,OAAO,KAAK,cAAc,KAAK,YAAA,CACjC,CAOO,eAAeC,EAAuB,CAC3C,OAAO,KAAK,YAAA,EAAc,KAAK,eAAe,CAACA,CAAY,CAAC,CAC9D,CAOO,mBAAmBA,EAAuB,CAC/C,OAAO,KAAK,YAAA,EAAc,KAAK,mBAAmB,CAACA,CAAY,CAAC,CAClE,CACF"}
|