@lidofinance/lsv-cli 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -0
- package/dist/abi/Dashboard.d.ts +268 -0
- package/dist/abi/Dashboard.js +2 -0
- package/dist/abi/Dashboard.js.map +1 -1
- package/dist/abi/PredepositGuarantee.d.ts +357 -88
- package/dist/abi/PredepositGuarantee.js +31 -28
- package/dist/abi/PredepositGuarantee.js.map +1 -1
- package/dist/abi/VaultViewer.d.ts +8 -0
- package/dist/abi/VaultViewer.js +10 -0
- package/dist/abi/VaultViewer.js.map +1 -1
- package/dist/command/index.js +1 -0
- package/dist/command/index.js.map +1 -1
- package/dist/configs/deployed.js +27 -8
- package/dist/configs/deployed.js.map +1 -1
- package/dist/configs/index.d.ts +4 -3
- package/dist/configs/index.js +4 -3
- package/dist/configs/index.js.map +1 -1
- package/dist/contracts/vault-viewer.js +2 -2
- package/dist/features/defi-wrapper/defi-wrapper-factory.d.ts +1 -2
- package/dist/features/defi-wrapper/defi-wrapper-factory.js +12 -9
- package/dist/features/defi-wrapper/defi-wrapper-factory.js.map +1 -1
- package/dist/features/deposits/index.d.ts +1 -0
- package/dist/features/deposits/index.js +1 -0
- package/dist/features/deposits/index.js.map +1 -1
- package/dist/features/deposits/validators.d.ts +12 -0
- package/dist/features/deposits/validators.js +31 -0
- package/dist/features/deposits/validators.js.map +1 -0
- package/dist/features/index.d.ts +1 -0
- package/dist/features/index.js +1 -0
- package/dist/features/index.js.map +1 -1
- package/dist/features/lazy-oracle.js +2 -2
- package/dist/features/lazy-oracle.js.map +1 -1
- package/dist/features/mint-burn/allowance.d.ts +7 -1
- package/dist/features/mint-burn/allowance.js +8 -9
- package/dist/features/mint-burn/allowance.js.map +1 -1
- package/dist/features/mint-burn/burn-shares.d.ts +2 -1
- package/dist/features/mint-burn/burn-shares.js +4 -3
- package/dist/features/mint-burn/burn-shares.js.map +1 -1
- package/dist/features/mint-burn/burn-steth.d.ts +2 -1
- package/dist/features/mint-burn/burn-steth.js +4 -3
- package/dist/features/mint-burn/burn-steth.js.map +1 -1
- package/dist/features/mint-burn/mint-shares.js +4 -6
- package/dist/features/mint-burn/mint-shares.js.map +1 -1
- package/dist/features/mint-burn/mint-steth.js +4 -6
- package/dist/features/mint-burn/mint-steth.js.map +1 -1
- package/dist/features/utils/connection.d.ts +2 -0
- package/dist/features/utils/connection.js +14 -0
- package/dist/features/utils/connection.js.map +1 -0
- package/dist/features/utils/index.d.ts +1 -0
- package/dist/features/utils/index.js +1 -0
- package/dist/features/utils/index.js.map +1 -1
- package/dist/features/utils/liability-shares.js +2 -1
- package/dist/features/utils/liability-shares.js.map +1 -1
- package/dist/features/utils/report-fresh.d.ts +11 -1
- package/dist/features/utils/report-fresh.js +17 -14
- package/dist/features/utils/report-fresh.js.map +1 -1
- package/dist/features/vault-factory.d.ts +13 -14
- package/dist/features/vault-factory.js +30 -8
- package/dist/features/vault-factory.js.map +1 -1
- package/dist/features/vault-operations/connect-vault.d.ts +4 -0
- package/dist/features/vault-operations/connect-vault.js +21 -0
- package/dist/features/vault-operations/connect-vault.js.map +1 -0
- package/dist/features/vault-operations/create-vault.js +6 -4
- package/dist/features/vault-operations/create-vault.js.map +1 -1
- package/dist/features/vault-operations/dashboard-by-vault.js +17 -4
- package/dist/features/vault-operations/dashboard-by-vault.js.map +1 -1
- package/dist/features/vault-operations/index.d.ts +2 -0
- package/dist/features/vault-operations/index.js +2 -0
- package/dist/features/vault-operations/index.js.map +1 -1
- package/dist/features/vault-operations/roles.d.ts +5 -0
- package/dist/features/vault-operations/roles.js +65 -0
- package/dist/features/vault-operations/roles.js.map +1 -0
- package/dist/features/vault-operations/vault-info.js +9 -3
- package/dist/features/vault-operations/vault-info.js.map +1 -1
- package/dist/features/vault-operations/vault-overview.js +5 -7
- package/dist/features/vault-operations/vault-overview.js.map +1 -1
- package/dist/features/vault-operations/vault-roles.js +1 -1
- package/dist/features/vault-operations/vault-roles.js.map +1 -1
- package/dist/features/with-report.d.ts +6 -0
- package/dist/features/with-report.js +18 -0
- package/dist/features/with-report.js.map +1 -0
- package/dist/index.js +32 -10
- package/dist/index.js.map +1 -1
- package/dist/programs/contracts/dashboard/write.js +39 -20
- package/dist/programs/contracts/dashboard/write.js.map +1 -1
- package/dist/programs/contracts/hub/write.js +5 -1
- package/dist/programs/contracts/hub/write.js.map +1 -1
- package/dist/programs/contracts/operator-grid/write.js +1 -1
- package/dist/programs/contracts/operator-grid/write.js.map +1 -1
- package/dist/programs/contracts/vault-factory/write.js +37 -23
- package/dist/programs/contracts/vault-factory/write.js.map +1 -1
- package/dist/programs/defi-wrapper/contracts/factory/write.js +12 -14
- package/dist/programs/defi-wrapper/contracts/factory/write.js.map +1 -1
- package/dist/programs/defi-wrapper/use-cases/wrapper-operations/create-pool.js +53 -16
- package/dist/programs/defi-wrapper/use-cases/wrapper-operations/create-pool.js.map +1 -1
- package/dist/programs/defi-wrapper/use-cases/wrapper-operations/read.js +2 -2
- package/dist/programs/defi-wrapper/use-cases/wrapper-operations/read.js.map +1 -1
- package/dist/programs/pdg-helpers.js +13 -9
- package/dist/programs/pdg-helpers.js.map +1 -1
- package/dist/programs/use-cases/consolidation/write.js +2 -2
- package/dist/programs/use-cases/consolidation/write.js.map +1 -1
- package/dist/programs/use-cases/report/write.js +3 -3
- package/dist/programs/use-cases/report/write.js.map +1 -1
- package/dist/programs/use-cases/vault-operations/create-vault.js +63 -27
- package/dist/programs/use-cases/vault-operations/create-vault.js.map +1 -1
- package/dist/programs/use-cases/vault-operations/write.js +122 -25
- package/dist/programs/use-cases/vault-operations/write.js.map +1 -1
- package/dist/tests/integration/deposits.test.d.ts +1 -0
- package/dist/tests/integration/deposits.test.js +67 -0
- package/dist/tests/integration/deposits.test.js.map +1 -0
- package/dist/tests/integration/globalSetup.d.ts +1 -0
- package/dist/tests/integration/globalSetup.js +55 -0
- package/dist/tests/integration/globalSetup.js.map +1 -0
- package/dist/tests/integration/helpers/index.d.ts +3 -0
- package/dist/tests/integration/helpers/index.js +4 -0
- package/dist/tests/integration/helpers/index.js.map +1 -0
- package/dist/tests/integration/helpers/test-assertions.d.ts +32 -0
- package/dist/tests/integration/helpers/test-assertions.js +92 -0
- package/dist/tests/integration/helpers/test-assertions.js.map +1 -0
- package/dist/tests/integration/helpers/test-client.d.ts +14530 -0
- package/dist/tests/integration/helpers/test-client.js +73 -0
- package/dist/tests/integration/helpers/test-client.js.map +1 -0
- package/dist/tests/integration/helpers/test-config.d.ts +14 -0
- package/dist/tests/integration/helpers/test-config.js +62 -0
- package/dist/tests/integration/helpers/test-config.js.map +1 -0
- package/dist/tests/integration/helpers/test-setup.d.ts +12 -0
- package/dist/tests/integration/helpers/test-setup.js +40 -0
- package/dist/tests/integration/helpers/test-setup.js.map +1 -0
- package/dist/tests/integration/lazy-oracle.test.d.ts +1 -0
- package/dist/tests/integration/lazy-oracle.test.js +31 -0
- package/dist/tests/integration/lazy-oracle.test.js.map +1 -0
- package/dist/tests/integration/metrics.test.d.ts +1 -0
- package/dist/tests/integration/metrics.test.js +95 -0
- package/dist/tests/integration/metrics.test.js.map +1 -0
- package/dist/tests/integration/mint-burn.test.d.ts +1 -0
- package/dist/tests/integration/mint-burn.test.js +149 -0
- package/dist/tests/integration/mint-burn.test.js.map +1 -0
- package/dist/tests/integration/operator-grid.test.d.ts +1 -0
- package/dist/tests/integration/operator-grid.test.js +41 -0
- package/dist/tests/integration/operator-grid.test.js.map +1 -0
- package/dist/tests/integration/pdg.test.d.ts +1 -0
- package/dist/tests/integration/pdg.test.js +47 -0
- package/dist/tests/integration/pdg.test.js.map +1 -0
- package/dist/tests/integration/utils.test.d.ts +1 -0
- package/dist/tests/integration/utils.test.js +70 -0
- package/dist/tests/integration/utils.test.js.map +1 -0
- package/dist/tests/integration/vault-factory.test.d.ts +1 -0
- package/dist/tests/integration/vault-factory.test.js +29 -0
- package/dist/tests/integration/vault-factory.test.js.map +1 -0
- package/dist/tests/integration/vault-hub.test.d.ts +1 -0
- package/dist/tests/integration/vault-hub.test.js +71 -0
- package/dist/tests/integration/vault-hub.test.js.map +1 -0
- package/dist/tests/integration/vault-operations.test.d.ts +1 -0
- package/dist/tests/integration/vault-operations.test.js +151 -0
- package/dist/tests/integration/vault-operations.test.js.map +1 -0
- package/dist/tests/integration/vault-roles.test.d.ts +1 -0
- package/dist/tests/integration/vault-roles.test.js +44 -0
- package/dist/tests/integration/vault-roles.test.js.map +1 -0
- package/dist/tests/integration/vault.test.d.ts +1 -0
- package/dist/tests/integration/vault.test.js +44 -0
- package/dist/tests/integration/vault.test.js.map +1 -0
- package/dist/tests/utils/arguments.test.js +85 -4
- package/dist/tests/utils/arguments.test.js.map +1 -1
- package/dist/tests/utils/bigInt.test.js +1 -1
- package/dist/tests/utils/bigInt.test.js.map +1 -1
- package/dist/tests/utils/calculate-health.test.d.ts +1 -0
- package/dist/tests/utils/calculate-health.test.js +140 -0
- package/dist/tests/utils/calculate-health.test.js.map +1 -0
- package/dist/tests/utils/calculate-overview-v2.test.d.ts +1 -0
- package/dist/tests/utils/calculate-overview-v2.test.js +181 -0
- package/dist/tests/utils/calculate-overview-v2.test.js.map +1 -0
- package/dist/tests/utils/calculate-overview.test.js +2 -1
- package/dist/tests/utils/calculate-overview.test.js.map +1 -1
- package/dist/tests/utils/csv-file.test.d.ts +1 -0
- package/dist/tests/utils/csv-file.test.js +111 -0
- package/dist/tests/utils/csv-file.test.js.map +1 -0
- package/dist/tests/utils/data-validators.test.js +1 -1
- package/dist/tests/utils/data-validators.test.js.map +1 -1
- package/dist/tests/utils/error-handler.test.js +7 -16
- package/dist/tests/utils/error-handler.test.js.map +1 -1
- package/dist/tests/utils/get-commands.test.js +1 -1
- package/dist/tests/utils/get-commands.test.js.map +1 -1
- package/dist/tests/utils/get-deposit-data-root.test.js +1 -2
- package/dist/tests/utils/get-deposit-data-root.test.js.map +1 -1
- package/dist/tests/utils/get-value.test.js +1 -1
- package/dist/tests/utils/get-value.test.js.map +1 -1
- package/dist/tests/utils/health.test.js +1 -1
- package/dist/tests/utils/health.test.js.map +1 -1
- package/dist/tests/utils/interrupt-handler.test.js +2 -5
- package/dist/tests/utils/interrupt-handler.test.js.map +1 -1
- package/dist/tests/utils/ipfs.test.js +37 -24
- package/dist/tests/utils/ipfs.test.js.map +1 -1
- package/dist/tests/utils/lido-apr.test.d.ts +1 -0
- package/dist/tests/utils/lido-apr.test.js +95 -0
- package/dist/tests/utils/lido-apr.test.js.map +1 -0
- package/dist/tests/utils/logging.test.js +135 -15
- package/dist/tests/utils/logging.test.js.map +1 -1
- package/dist/tests/utils/merkle-utils.test.d.ts +1 -0
- package/dist/tests/utils/merkle-utils.test.js +231 -0
- package/dist/tests/utils/merkle-utils.test.js.map +1 -0
- package/dist/tests/utils/rebase-rewards.test.d.ts +1 -0
- package/dist/tests/utils/rebase-rewards.test.js +114 -0
- package/dist/tests/utils/rebase-rewards.test.js.map +1 -0
- package/dist/tests/utils/resove-path.test.js +1 -1
- package/dist/tests/utils/resove-path.test.js.map +1 -1
- package/dist/tests/utils/sleep.test.js +5 -5
- package/dist/tests/utils/sleep.test.js.map +1 -1
- package/dist/tests/utils/snake-to-camel.test.d.ts +1 -0
- package/dist/tests/utils/snake-to-camel.test.js +37 -0
- package/dist/tests/utils/snake-to-camel.test.js.map +1 -0
- package/dist/tests/utils/timestamp.test.d.ts +1 -0
- package/dist/tests/utils/timestamp.test.js +51 -0
- package/dist/tests/utils/timestamp.test.js.map +1 -0
- package/dist/utils/arguments.d.ts +2 -1
- package/dist/utils/arguments.js +6 -0
- package/dist/utils/arguments.js.map +1 -1
- package/dist/utils/calculate-overview-v2.d.ts +1 -2
- package/dist/utils/calculate-overview-v2.js +3 -6
- package/dist/utils/calculate-overview-v2.js.map +1 -1
- package/dist/utils/calculate-overview.d.ts +1 -0
- package/dist/utils/calculate-overview.js +1 -0
- package/dist/utils/calculate-overview.js.map +1 -1
- package/dist/utils/commands/report.d.ts +6 -1
- package/dist/utils/commands/report.js +6 -5
- package/dist/utils/commands/report.js.map +1 -1
- package/dist/utils/consolidation/confirms.js +2 -2
- package/dist/utils/consolidation/confirms.js.map +1 -1
- package/dist/utils/consolidation/logs.js +4 -2
- package/dist/utils/consolidation/logs.js.map +1 -1
- package/dist/utils/consolidation/pubkeys.js +2 -0
- package/dist/utils/consolidation/pubkeys.js.map +1 -1
- package/dist/utils/consolidation/types.d.ts +1 -0
- package/dist/utils/consolidation/validator-info.js +2 -0
- package/dist/utils/consolidation/validator-info.js.map +1 -1
- package/dist/utils/error-handler.js +2 -9
- package/dist/utils/error-handler.js.map +1 -1
- package/dist/utils/interrupt-handler.js +8 -2
- package/dist/utils/interrupt-handler.js.map +1 -1
- package/dist/utils/logging/console.js +41 -3
- package/dist/utils/logging/console.js.map +1 -1
- package/dist/utils/prompts/mint-burn/confirm-mint.js +1 -0
- package/dist/utils/prompts/mint-burn/confirm-mint.js.map +1 -1
- package/dist/utils/prompts/operations.js +4 -1
- package/dist/utils/prompts/operations.js.map +1 -1
- package/dist/utils/proof/create-proof.d.ts +5 -0
- package/dist/utils/proof/create-proof.js +5 -0
- package/dist/utils/proof/create-proof.js.map +1 -1
- package/dist/utils/transactions/tx-private-key.d.ts +4 -0
- package/dist/utils/transactions/tx-private-key.js +52 -24
- package/dist/utils/transactions/tx-private-key.js.map +1 -1
- package/dist/utils/transactions/tx-wc.d.ts +1 -0
- package/dist/utils/transactions/tx-wc.js +10 -19
- package/dist/utils/transactions/tx-wc.js.map +1 -1
- package/dist/utils/transactions/types.d.ts +1 -0
- package/dist/utils/transactions/utils.d.ts +3 -0
- package/dist/utils/transactions/utils.js +33 -0
- package/dist/utils/transactions/utils.js.map +1 -0
- package/dist/utils/wallet-connect.js +3 -1
- package/dist/utils/wallet-connect.js.map +1 -1
- package/dist/version/index.js +1 -1
- package/dist/vitest.config.d.ts +2 -0
- package/dist/vitest.config.js +29 -0
- package/dist/vitest.config.js.map +1 -0
- package/dist/vitest.integration.config.d.ts +2 -0
- package/dist/vitest.integration.config.js +39 -0
- package/dist/vitest.integration.config.js.map +1 -0
- package/package.json +14 -9
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { formatEther } from 'viem';
|
|
2
|
-
import { printError, showSpinner, logResult } from '../utils/index.js';
|
|
2
|
+
import { printError, showSpinner, logResult, formatTimestamp } from '../utils/index.js';
|
|
3
3
|
import { getLazyOracleContract } from '../contracts/index.js';
|
|
4
4
|
export const getLazyOracleBaseInfo = async () => {
|
|
5
5
|
const hideSpinner = showSpinner();
|
|
@@ -25,7 +25,7 @@ export const getLazyOracleBaseInfo = async () => {
|
|
|
25
25
|
MAX_QUARANTINE_PERIOD: `${MAX_QUARANTINE_PERIOD} (${Number(MAX_QUARANTINE_PERIOD) / 3600} hours)`,
|
|
26
26
|
MAX_REWARD_RATIO,
|
|
27
27
|
MAX_LIDO_FEE_RATE_PER_SECOND,
|
|
28
|
-
latestReportTimestamp: `${latestReportTimestamp} (${
|
|
28
|
+
latestReportTimestamp: `${latestReportTimestamp} (${formatTimestamp(Number(latestReportTimestamp))})`,
|
|
29
29
|
quarantinePeriod: `${quarantinePeriod} (${Number(quarantinePeriod) / 3600} hours)`,
|
|
30
30
|
maxRewardRatioBP: `${maxRewardRatioBP} (${Number(maxRewardRatioBP) / 100} %)`,
|
|
31
31
|
maxLidoFeeRatePerSecond: `${maxLidoFeeRatePerSecond} (${formatEther(maxLidoFeeRatePerSecond)} ETH/s)`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy-oracle.js","sourceRoot":"","sources":["../../features/lazy-oracle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"lazy-oracle.js","sourceRoot":"","sources":["../../features/lazy-oracle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,M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YACZ,kBAAkB;YAClB,yBAAyB;YACzB,qBAAqB,EAAE,GAAG,qBAAqB,KAAK,MAAM,CAAC,qBAAqB,CAAC,GAAG,IAAI,SAAS;YACjG,gBAAgB;YAChB,4BAA4B;YAC5B,qBAAqB,EAAE,GAAG,qBAAqB,KAAK,eAAe,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,GAAG;YACrG,gBAAgB,EAAE,GAAG,gBAAgB,KAAK,MAAM,CAAC,gBAAgB,CAAC,GAAG,IAAI,SAAS;YAClF,gBAAgB,EAAE,GAAG,gBAAgB,KAAK,MAAM,CAAC,gBAAgB,CAAC,GAAG,GAAG,KAAK;YAC7E,uBAAuB,EAAE,GAAG,uBAAuB,KAAK,WAAW,CAAC,uBAAuB,CAAC,SAAS;SACtG,CAAC;QAEF,SAAS,CAAC;YACR,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;SAClE,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,WAAW,EAAE,CAAC;QACd,UAAU,CAAC,GAAG,EAAE,8BAA8B,CAAC,CAAC;IAClD,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
import { Hex, TransactionReceipt } from 'viem';
|
|
1
2
|
import { DashboardContract } from '../../contracts/index.js';
|
|
2
|
-
|
|
3
|
+
import { PopulatedTx } from '../../utils/index.js';
|
|
4
|
+
export declare const checkAllowance: (contract: DashboardContract, amount: bigint, token: "steth" | "wsteth" | "shares", populateTx?: boolean) => Promise<{
|
|
5
|
+
receipt?: TransactionReceipt;
|
|
6
|
+
tx?: Hex;
|
|
7
|
+
data?: PopulatedTx;
|
|
8
|
+
} | void>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { formatEther } from 'viem';
|
|
2
2
|
import { getStethContract, getWstethContract, } from '../../contracts/index.js';
|
|
3
3
|
import { getAccount } from '../../providers/index.js';
|
|
4
|
-
import {
|
|
5
|
-
export const checkAllowance = async (contract, amount, token) => {
|
|
4
|
+
import { callReadMethodSilent, callWriteMethodWithReceipt, confirmOperation, logInfo, } from '../../utils/index.js';
|
|
5
|
+
export const checkAllowance = async (contract, amount, token, populateTx) => {
|
|
6
6
|
const accountAddress = (await getAccount()).address;
|
|
7
7
|
const isShares = token === 'shares';
|
|
8
8
|
let currentAmount = amount;
|
|
9
9
|
if (token === 'steth' || isShares) {
|
|
10
10
|
const stethContract = await getStethContract();
|
|
11
|
-
const allowance = await
|
|
11
|
+
const allowance = await callReadMethodSilent(stethContract, 'allowance', [
|
|
12
12
|
accountAddress,
|
|
13
13
|
contract.address,
|
|
14
14
|
]);
|
|
@@ -20,28 +20,27 @@ export const checkAllowance = async (contract, amount, token) => {
|
|
|
20
20
|
const confirm = await confirmOperation(`Do you want to set allowance for ${formatEther(amount)} ${token} (${formatEther(currentAmount)} stETH) to ${contract.address} (Dashboard contract)? Current allowance: ${formatEther(allowance)} stETH`);
|
|
21
21
|
if (!confirm)
|
|
22
22
|
throw new Error('Allowance not set');
|
|
23
|
-
await callWriteMethodWithReceipt({
|
|
23
|
+
return await callWriteMethodWithReceipt({
|
|
24
24
|
contract: stethContract,
|
|
25
25
|
methodName: 'approve',
|
|
26
26
|
payload: [contract.address, currentAmount],
|
|
27
|
+
populateTx,
|
|
27
28
|
});
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
else {
|
|
31
32
|
const wstethContract = await getWstethContract();
|
|
32
|
-
const wstethAllowance = await
|
|
33
|
-
accountAddress,
|
|
34
|
-
accountAddress,
|
|
35
|
-
]);
|
|
33
|
+
const wstethAllowance = await callReadMethodSilent(wstethContract, 'allowance', [accountAddress, contract.address]);
|
|
36
34
|
if (wstethAllowance < amount) {
|
|
37
35
|
logInfo('Insufficient allowance');
|
|
38
36
|
const confirm = await confirmOperation(`Do you want to set allowance for ${formatEther(amount)} ${token} to ${contract.address} (Dashboard contract)? Current allowance: ${formatEther(wstethAllowance)} wstETH`);
|
|
39
37
|
if (!confirm)
|
|
40
38
|
throw new Error('Allowance not set');
|
|
41
|
-
await callWriteMethodWithReceipt({
|
|
39
|
+
return await callWriteMethodWithReceipt({
|
|
42
40
|
contract: wstethContract,
|
|
43
41
|
methodName: 'approve',
|
|
44
42
|
payload: [contract.address, amount],
|
|
43
|
+
populateTx,
|
|
45
44
|
});
|
|
46
45
|
}
|
|
47
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"allowance.js","sourceRoot":"","sources":["../../../features/mint-burn/allowance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"allowance.js","sourceRoot":"","sources":["../../../features/mint-burn/allowance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA2B,MAAM,MAAM,CAAC;AAE5D,OAAO,EACL,gBAAgB,EAEhB,iBAAiB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,gBAAgB,EAChB,OAAO,GAER,MAAM,OAAO,CAAC;AAEf,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EACjC,QAA2B,EAC3B,MAAc,EACd,KAAoC,EACpC,UAAoB,EAKZ,EAAE;IACV,MAAM,cAAc,GAAG,CAAC,MAAM,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC;IACpD,MAAM,QAAQ,GAAG,KAAK,KAAK,QAAQ,CAAC;IACpC,IAAI,aAAa,GAAG,MAAM,CAAC;IAE3B,IAAI,KAAK,KAAK,OAAO,IAAI,QAAQ,EAAE,CAAC;QAClC,MAAM,aAAa,GAAG,MAAM,gBAAgB,EAAE,CAAC;QAE/C,MAAM,SAAS,GAAG,MAAM,oBAAoB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MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;YAEnD,OAAO,MAAM,0BAA0B,CAAC;gBACtC,QAAQ,EAAE,cAAc;gBACxB,UAAU,EAAE,SAAS;gBACrB,OAAO,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;gBACnC,UAAU;aACX,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { Address } from 'viem';
|
|
2
2
|
import { DashboardContract } from '../../contracts/index.js';
|
|
3
|
-
|
|
3
|
+
import { PopulatedTx } from '../../utils/index.js';
|
|
4
|
+
export declare const burnShares: (contract: DashboardContract, amountOfShares: bigint, vault: Address, method: "burnShares" | "burnWstETH", populatedAllowance?: PopulatedTx) => Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { fetchAndCalculateVaultHealthWithNewValue, showSpinner, confirmBurn,
|
|
1
|
+
import { fetchAndCalculateVaultHealthWithNewValue, showSpinner, confirmBurn, callWriteMethodWithCalls, } from '../../utils/index.js';
|
|
2
2
|
import { checkLiabilityShares } from '../index.js';
|
|
3
|
-
export const burnShares = async (contract, amountOfShares, vault, method) => {
|
|
3
|
+
export const burnShares = async (contract, amountOfShares, vault, method, populatedAllowance) => {
|
|
4
4
|
const type = method === 'burnShares' ? 'shares' : 'wstETH';
|
|
5
5
|
const isLiabilitySharesOk = await checkLiabilityShares(contract, amountOfShares);
|
|
6
6
|
if (!isLiabilitySharesOk)
|
|
@@ -24,10 +24,11 @@ export const burnShares = async (contract, amountOfShares, vault, method) => {
|
|
|
24
24
|
});
|
|
25
25
|
if (!confirm)
|
|
26
26
|
return;
|
|
27
|
-
await
|
|
27
|
+
await callWriteMethodWithCalls({
|
|
28
28
|
contract,
|
|
29
29
|
methodName: method,
|
|
30
30
|
payload: [amountOfShares],
|
|
31
|
+
calls: [...(populatedAllowance ? [populatedAllowance] : [])],
|
|
31
32
|
});
|
|
32
33
|
};
|
|
33
34
|
//# sourceMappingURL=burn-shares.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"burn-shares.js","sourceRoot":"","sources":["../../../features/mint-burn/burn-shares.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,wCAAwC,EACxC,WAAW,EACX,WAAW,
|
|
1
|
+
{"version":3,"file":"burn-shares.js","sourceRoot":"","sources":["../../../features/mint-burn/burn-shares.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,wCAAwC,EACxC,WAAW,EACX,WAAW,EAEX,wBAAwB,GACzB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,EAC7B,QAA2B,EAC3B,cAAsB,EACtB,KAAc,EACd,MAAmC,EACnC,kBAAgC,EAChC,EAAE;IACF,MAAM,IAAI,GAAG,MAAM,KAAK,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;IAE3D,MAAM,mBAAmB,GAAG,MAAM,oBAAoB,CACpD,QAAQ,EACR,cAAc,CACf,CAAC;IACF,IAAI,CAAC,mBAAmB;QAAE,OAAO;IAEjC,MAAM,WAAW,GAAG,WAAW,EAAE,CAAC;IAClC,MAAM,EACJ,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,4BAA4B,EAC5B,eAAe,EACf,eAAe,EACf,yBAAyB,GAC1B,GAAG,MAAM,wCAAwC,CAChD,QAAQ,EACR,cAAc,EACd,MAAM,CACP,CAAC;IACF,WAAW,EAAE,CAAC;IAEd,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC;QAChC,YAAY,EAAE,KAAK;QACnB,YAAY,EAAE,cAAc;QAC5B,sBAAsB,EAAE,eAAe;QACvC,kBAAkB,EAAE,kBAAkB;QACtC,4BAA4B,EAAE,4BAA4B;QAC1D,sBAAsB,EAAE,eAAe;QACvC,gCAAgC,EAAE,yBAAyB;QAC3D,cAAc,EAAE,cAAc,CAAC,WAAW;QAC1C,kBAAkB,EAAE,kBAAkB,CAAC,WAAW;QAClD,YAAY,EAAE,cAAc,CAAC,SAAS;QACtC,gBAAgB,EAAE,kBAAkB,CAAC,SAAS;QAC9C,IAAI;KACL,CAAC,CAAC;IACH,IAAI,CAAC,OAAO;QAAE,OAAO;IAErB,MAAM,wBAAwB,CAAC;QAC7B,QAAQ;QACR,UAAU,EAAE,MAAM;QAClB,OAAO,EAAE,CAAC,cAAc,CAAC;QACzB,KAAK,EAAE,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;KAC7D,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { Address } from 'viem';
|
|
2
2
|
import { DashboardContract } from '../../contracts/index.js';
|
|
3
|
-
|
|
3
|
+
import { PopulatedTx } from '../../utils/index.js';
|
|
4
|
+
export declare const burnSteth: (contract: DashboardContract, amountOfSteth: bigint, vault: Address, populatedAllowance?: PopulatedTx) => Promise<void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getStethContract } from '../../contracts/index.js';
|
|
2
|
-
import { fetchAndCalculateVaultHealthWithNewValue, showSpinner, confirmBurn,
|
|
2
|
+
import { fetchAndCalculateVaultHealthWithNewValue, showSpinner, confirmBurn, callReadMethodSilent, callWriteMethodWithCalls, } from '../../utils/index.js';
|
|
3
3
|
import { checkLiabilityShares } from '../index.js';
|
|
4
|
-
export const burnSteth = async (contract, amountOfSteth, vault) => {
|
|
4
|
+
export const burnSteth = async (contract, amountOfSteth, vault, populatedAllowance) => {
|
|
5
5
|
const stethContract = await getStethContract();
|
|
6
6
|
const amountOfShares = await callReadMethodSilent(stethContract, 'getSharesByPooledEth', [amountOfSteth]);
|
|
7
7
|
const isLiabilitySharesOk = await checkLiabilityShares(contract, amountOfShares);
|
|
@@ -26,10 +26,11 @@ export const burnSteth = async (contract, amountOfSteth, vault) => {
|
|
|
26
26
|
});
|
|
27
27
|
if (!confirm)
|
|
28
28
|
return;
|
|
29
|
-
await
|
|
29
|
+
await callWriteMethodWithCalls({
|
|
30
30
|
contract,
|
|
31
31
|
methodName: 'burnStETH',
|
|
32
32
|
payload: [amountOfSteth],
|
|
33
|
+
calls: [...(populatedAllowance ? [populatedAllowance] : [])],
|
|
33
34
|
});
|
|
34
35
|
};
|
|
35
36
|
//# sourceMappingURL=burn-steth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"burn-steth.js","sourceRoot":"","sources":["../../../features/mint-burn/burn-steth.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqB,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EACL,wCAAwC,EACxC,WAAW,EACX,WAAW,EACX,
|
|
1
|
+
{"version":3,"file":"burn-steth.js","sourceRoot":"","sources":["../../../features/mint-burn/burn-steth.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqB,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EACL,wCAAwC,EACxC,WAAW,EACX,WAAW,EACX,oBAAoB,EAEpB,wBAAwB,GACzB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAC5B,QAA2B,EAC3B,aAAqB,EACrB,KAAc,EACd,kBAAgC,EAChC,EAAE;IACF,MAAM,aAAa,GAAG,MAAM,gBAAgB,EAAE,CAAC;IAC/C,MAAM,cAAc,GAAG,MAAM,oBAAoB,CAC/C,aAAa,EACb,sBAAsB,EACtB,CAAC,aAAa,CAAC,CAChB,CAAC;IAEF,MAAM,mBAAmB,GAAG,MAAM,oBAAoB,CACpD,QAAQ,EACR,cAAc,CACf,CAAC;IACF,IAAI,CAAC,mBAAmB;QAAE,OAAO;IAEjC,MAAM,WAAW,GAAG,WAAW,EAAE,CAAC;IAClC,MAAM,EACJ,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,4BAA4B,EAC5B,eAAe,EACf,eAAe,EACf,yBAAyB,GAC1B,GAAG,MAAM,wCAAwC,CAChD,QAAQ,EACR,cAAc,EACd,MAAM,CACP,CAAC;IACF,WAAW,EAAE,CAAC;IAEd,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC;QAChC,YAAY,EAAE,KAAK;QACnB,YAAY,EAAE,aAAa;QAC3B,sBAAsB,EAAE,eAAe;QACvC,kBAAkB,EAAE,kBAAkB;QACtC,4BAA4B,EAAE,4BAA4B;QAC1D,sBAAsB,EAAE,eAAe;QACvC,gCAAgC,EAAE,yBAAyB;QAC3D,cAAc,EAAE,cAAc,CAAC,WAAW;QAC1C,kBAAkB,EAAE,kBAAkB,CAAC,WAAW;QAClD,YAAY,EAAE,cAAc,CAAC,SAAS;QACtC,gBAAgB,EAAE,kBAAkB,CAAC,SAAS;QAC9C,IAAI,EAAE,OAAO;KACd,CAAC,CAAC;IACH,IAAI,CAAC,OAAO;QAAE,OAAO;IAErB,MAAM,wBAAwB,CAAC;QAC7B,QAAQ;QACR,UAAU,EAAE,WAAW;QACvB,OAAO,EAAE,CAAC,aAAa,CAAC;QACxB,KAAK,EAAE,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;KAC7D,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { fetchAndCalculateVaultHealthWithNewValue, showSpinner, confirmMint,
|
|
2
|
-
import {
|
|
1
|
+
import { fetchAndCalculateVaultHealthWithNewValue, showSpinner, confirmMint, } from '../../utils/index.js';
|
|
2
|
+
import { callWriteMethodsWithReportFresh, checkMintingCapacity, } from '../index.js';
|
|
3
3
|
export const mintShares = async (contract, recipient, amountOfShares, vault, method) => {
|
|
4
4
|
const type = method === 'mintShares' ? 'shares' : 'wstETH';
|
|
5
|
-
const isReportFresh = await checkIsReportFresh(vault);
|
|
6
|
-
if (!isReportFresh)
|
|
7
|
-
return;
|
|
8
5
|
const isMintingCapacityOk = await checkMintingCapacity(contract, amountOfShares);
|
|
9
6
|
if (!isMintingCapacityOk)
|
|
10
7
|
return;
|
|
@@ -28,7 +25,8 @@ export const mintShares = async (contract, recipient, amountOfShares, vault, met
|
|
|
28
25
|
});
|
|
29
26
|
if (!confirm)
|
|
30
27
|
return;
|
|
31
|
-
await
|
|
28
|
+
await callWriteMethodsWithReportFresh({
|
|
29
|
+
vault,
|
|
32
30
|
contract,
|
|
33
31
|
methodName: method,
|
|
34
32
|
payload: [recipient, amountOfShares],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mint-shares.js","sourceRoot":"","sources":["../../../features/mint-burn/mint-shares.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,wCAAwC,EACxC,WAAW,EACX,WAAW,
|
|
1
|
+
{"version":3,"file":"mint-shares.js","sourceRoot":"","sources":["../../../features/mint-burn/mint-shares.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,wCAAwC,EACxC,WAAW,EACX,WAAW,GACZ,MAAM,OAAO,CAAC;AACf,OAAO,EACL,+BAA+B,EAC/B,oBAAoB,GACrB,MAAM,UAAU,CAAC;AAElB,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,EAC7B,QAA2B,EAC3B,SAAkB,EAClB,cAAsB,EACtB,KAAc,EACd,MAAmC,EACnC,EAAE;IACF,MAAM,IAAI,GAAG,MAAM,KAAK,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;IAE3D,MAAM,mBAAmB,GAAG,MAAM,oBAAoB,CACpD,QAAQ,EACR,cAAc,CACf,CAAC;IACF,IAAI,CAAC,mBAAmB;QAAE,OAAO;IAEjC,MAAM,WAAW,GAAG,WAAW,EAAE,CAAC;IAClC,MAAM,EACJ,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,4BAA4B,EAC5B,eAAe,EACf,yBAAyB,EACzB,eAAe,GAChB,GAAG,MAAM,wCAAwC,CAChD,QAAQ,EACR,cAAc,EACd,MAAM,CACP,CAAC;IACF,WAAW,EAAE,CAAC;IAEd,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC;QAChC,YAAY,EAAE,KAAK;QACnB,SAAS;QACT,YAAY,EAAE,cAAc;QAC5B,sBAAsB,EAAE,eAAe;QACvC,kBAAkB,EAAE,kBAAkB;QACtC,4BAA4B,EAAE,4BAA4B;QAC1D,sBAAsB,EAAE,eAAe;QACvC,gCAAgC,EAAE,yBAAyB;QAC3D,cAAc,EAAE,cAAc,CAAC,WAAW;QAC1C,kBAAkB,EAAE,kBAAkB,CAAC,WAAW;QAClD,YAAY,EAAE,cAAc,CAAC,SAAS;QACtC,gBAAgB,EAAE,kBAAkB,CAAC,SAAS;QAC9C,IAAI;KACL,CAAC,CAAC;IACH,IAAI,CAAC,OAAO;QAAE,OAAO;IAErB,MAAM,+BAA+B,CAAC;QACpC,KAAK;QACL,QAAQ;QACR,UAAU,EAAE,MAAM;QAClB,OAAO,EAAE,CAAC,SAAS,EAAE,cAAc,CAAC;KACrC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { getStethContract } from '../../contracts/index.js';
|
|
2
|
-
import { fetchAndCalculateVaultHealthWithNewValue, showSpinner, confirmMint,
|
|
3
|
-
import {
|
|
2
|
+
import { fetchAndCalculateVaultHealthWithNewValue, showSpinner, confirmMint, callReadMethodSilent, } from '../../utils/index.js';
|
|
3
|
+
import { callWriteMethodsWithReportFresh, checkMintingCapacity, } from '../index.js';
|
|
4
4
|
export const mintSteth = async (contract, recipient, amountOfSteth, vault) => {
|
|
5
5
|
const stethContract = await getStethContract();
|
|
6
6
|
const amountOfShares = await callReadMethodSilent(stethContract, 'getSharesByPooledEth', [amountOfSteth]);
|
|
7
|
-
const isReportFresh = await checkIsReportFresh(vault);
|
|
8
|
-
if (!isReportFresh)
|
|
9
|
-
return;
|
|
10
7
|
const isMintingCapacityOk = await checkMintingCapacity(contract, amountOfShares);
|
|
11
8
|
if (!isMintingCapacityOk)
|
|
12
9
|
return;
|
|
@@ -30,7 +27,8 @@ export const mintSteth = async (contract, recipient, amountOfSteth, vault) => {
|
|
|
30
27
|
});
|
|
31
28
|
if (!confirm)
|
|
32
29
|
return;
|
|
33
|
-
await
|
|
30
|
+
await callWriteMethodsWithReportFresh({
|
|
31
|
+
vault,
|
|
34
32
|
contract,
|
|
35
33
|
methodName: 'mintStETH',
|
|
36
34
|
payload: [recipient, amountOfSteth],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mint-steth.js","sourceRoot":"","sources":["../../../features/mint-burn/mint-steth.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqB,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EACL,wCAAwC,EACxC,WAAW,EACX,WAAW,EACX,
|
|
1
|
+
{"version":3,"file":"mint-steth.js","sourceRoot":"","sources":["../../../features/mint-burn/mint-steth.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqB,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EACL,wCAAwC,EACxC,WAAW,EACX,WAAW,EACX,oBAAoB,GACrB,MAAM,OAAO,CAAC;AACf,OAAO,EACL,+BAA+B,EAC/B,oBAAoB,GACrB,MAAM,UAAU,CAAC;AAElB,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAC5B,QAA2B,EAC3B,SAAkB,EAClB,aAAqB,EACrB,KAAc,EACd,EAAE;IACF,MAAM,aAAa,GAAG,MAAM,gBAAgB,EAAE,CAAC;IAC/C,MAAM,cAAc,GAAG,MAAM,oBAAoB,CAC/C,aAAa,EACb,sBAAsB,EACtB,CAAC,aAAa,CAAC,CAChB,CAAC;IAEF,MAAM,mBAAmB,GAAG,MAAM,oBAAoB,CACpD,QAAQ,EACR,cAAc,CACf,CAAC;IACF,IAAI,CAAC,mBAAmB;QAAE,OAAO;IAEjC,MAAM,WAAW,GAAG,WAAW,EAAE,CAAC;IAClC,MAAM,EACJ,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,4BAA4B,EAC5B,eAAe,EACf,yBAAyB,EACzB,eAAe,GAChB,GAAG,MAAM,wCAAwC,CAChD,QAAQ,EACR,cAAc,EACd,MAAM,CACP,CAAC;IACF,WAAW,EAAE,CAAC;IAEd,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC;QAChC,YAAY,EAAE,KAAK;QACnB,SAAS;QACT,YAAY,EAAE,cAAc;QAC5B,sBAAsB,EAAE,eAAe;QACvC,kBAAkB,EAAE,kBAAkB;QACtC,4BAA4B,EAAE,4BAA4B;QAC1D,sBAAsB,EAAE,eAAe;QACvC,gCAAgC,EAAE,yBAAyB;QAC3D,cAAc,EAAE,cAAc,CAAC,WAAW;QAC1C,kBAAkB,EAAE,kBAAkB,CAAC,WAAW;QAClD,YAAY,EAAE,cAAc,CAAC,SAAS;QACtC,gBAAgB,EAAE,kBAAkB,CAAC,SAAS;QAC9C,IAAI,EAAE,OAAO;KACd,CAAC,CAAC;IACH,IAAI,CAAC,OAAO;QAAE,OAAO;IAErB,MAAM,+BAA+B,CAAC;QACpC,KAAK;QACL,QAAQ;QACR,UAAU,EAAE,WAAW;QACvB,OAAO,EAAE,CAAC,SAAS,EAAE,aAAa,CAAC;KACpC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { getVaultHubContract } from '../../contracts/index.js';
|
|
2
|
+
import { callReadMethodSilent, logInfo } from '../../utils/index.js';
|
|
3
|
+
export const checkIsDisconnected = async (vault) => {
|
|
4
|
+
const vaultHubContract = await getVaultHubContract();
|
|
5
|
+
const connection = await callReadMethodSilent(vaultHubContract, 'vaultConnection', [vault]);
|
|
6
|
+
const isDisconnected = connection.owner === '0x0000000000000000000000000000000000000000' ||
|
|
7
|
+
connection.vaultIndex === 0n;
|
|
8
|
+
if (isDisconnected) {
|
|
9
|
+
logInfo('⚠️ The vault is not connected to VaultHub ⚠️');
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
return false;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=connection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../../features/utils/connection.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEtD,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EAAE,KAAc,EAAE,EAAE;IAC1D,MAAM,gBAAgB,GAAG,MAAM,mBAAmB,EAAE,CAAC;IACrD,MAAM,UAAU,GAAG,MAAM,oBAAoB,CAC3C,gBAAgB,EAChB,iBAAiB,EACjB,CAAC,KAAK,CAAC,CACR,CAAC;IAEF,MAAM,cAAc,GAClB,UAAU,CAAC,KAAK,KAAK,4CAA4C;QACjE,UAAU,CAAC,UAAU,KAAK,EAAE,CAAC;IAE/B,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,CAAC,gDAAgD,CAAC,CAAC;QAC1D,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../features/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../features/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { formatEther } from 'viem';
|
|
1
2
|
import { callReadMethodSilent, logError } from '../../utils/index.js';
|
|
2
3
|
export const checkLiabilityShares = async (contract, amountOfShares) => {
|
|
3
4
|
const liabilityShares = await callReadMethodSilent(contract, 'liabilityShares');
|
|
4
5
|
if (amountOfShares > liabilityShares) {
|
|
5
|
-
logError(
|
|
6
|
+
logError(`Cannot burn more shares than the liability shares (Liability shares: ${formatEther(liabilityShares)}, Amount of shares to burn: ${formatEther(amountOfShares)})`);
|
|
6
7
|
return false;
|
|
7
8
|
}
|
|
8
9
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"liability-shares.js","sourceRoot":"","sources":["../../../features/utils/liability-shares.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"liability-shares.js","sourceRoot":"","sources":["../../../features/utils/liability-shares.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEvD,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EACvC,QAA2B,EAC3B,cAAsB,EACtB,EAAE;IACF,MAAM,eAAe,GAAG,MAAM,oBAAoB,CAChD,QAAQ,EACR,iBAAiB,CAClB,CAAC;IAEF,IAAI,cAAc,GAAG,eAAe,EAAE,CAAC;QACrC,QAAQ,CACN,wEAAwE,WAAW,CAAC,eAAe,CAAC,+BAA+B,WAAW,CAAC,cAAc,CAAC,GAAG,CAClK,CAAC;QACF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
import { Address } from 'viem';
|
|
2
|
-
|
|
2
|
+
import { PopulatedTx } from '../../utils/index.js';
|
|
3
|
+
export declare const checkIsReportFreshThrowError: ({ vault, }: {
|
|
4
|
+
vault: Address;
|
|
5
|
+
}) => Promise<void>;
|
|
6
|
+
export declare const checkIsReportFresh: ({ vault, populateTx, }: {
|
|
7
|
+
vault: Address;
|
|
8
|
+
populateTx?: boolean;
|
|
9
|
+
}) => Promise<{
|
|
10
|
+
isFresh: boolean;
|
|
11
|
+
data?: PopulatedTx;
|
|
12
|
+
}>;
|
|
3
13
|
export declare const reportFreshWarning: (vault: Address) => Promise<boolean>;
|
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
import { getVaultHubContract } from '../../contracts/index.js';
|
|
2
|
-
import { callReadMethodSilent, confirmOperation, submitReport, logInfo, } from '../../utils/index.js';
|
|
3
|
-
|
|
2
|
+
import { callReadMethodSilent, confirmOperation, submitReport, logInfo, logError, } from '../../utils/index.js';
|
|
3
|
+
import { checkIsDisconnected } from './connection.js';
|
|
4
|
+
export const checkIsReportFreshThrowError = async ({ vault, }) => {
|
|
4
5
|
const vaultHubContract = await getVaultHubContract();
|
|
5
|
-
const
|
|
6
|
-
const isDisconnected = connection.owner === '0x0000000000000000000000000000000000000000' ||
|
|
7
|
-
connection.vaultIndex === 0n;
|
|
6
|
+
const isDisconnected = await checkIsDisconnected(vault);
|
|
8
7
|
if (isDisconnected) {
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
logError('The vault is disconnected');
|
|
9
|
+
throw new Error(`The vault ${vault} is disconnected`);
|
|
10
|
+
}
|
|
11
|
+
const isReportFresh = await callReadMethodSilent(vaultHubContract, 'isReportFresh', [vault]);
|
|
12
|
+
if (!isReportFresh) {
|
|
13
|
+
logError('The report is not fresh. Submit a fresh report to update the vault data by command: report w submit');
|
|
14
|
+
throw new Error(`The report for vault ${vault} is not fresh`);
|
|
11
15
|
}
|
|
12
|
-
return false;
|
|
13
16
|
};
|
|
14
|
-
export const checkIsReportFresh = async (vault) => {
|
|
17
|
+
export const checkIsReportFresh = async ({ vault, populateTx = false, }) => {
|
|
15
18
|
const vaultHubContract = await getVaultHubContract();
|
|
16
19
|
const isDisconnected = await checkIsDisconnected(vault);
|
|
17
20
|
if (isDisconnected)
|
|
18
|
-
return true;
|
|
21
|
+
return { isFresh: true, data: undefined };
|
|
19
22
|
const isReportFresh = await callReadMethodSilent(vaultHubContract, 'isReportFresh', [vault]);
|
|
20
23
|
if (!isReportFresh) {
|
|
21
24
|
logInfo('The report is not fresh');
|
|
22
25
|
const confirm = await confirmOperation('Do you want to submit a fresh report?');
|
|
23
26
|
if (!confirm)
|
|
24
|
-
return false;
|
|
25
|
-
const
|
|
26
|
-
return
|
|
27
|
+
return { isFresh: false, data: undefined };
|
|
28
|
+
const result = await submitReport({ vault, populateTx });
|
|
29
|
+
return result;
|
|
27
30
|
}
|
|
28
31
|
logInfo('The report is fresh');
|
|
29
|
-
return
|
|
32
|
+
return { isFresh: true, data: undefined };
|
|
30
33
|
};
|
|
31
34
|
export const reportFreshWarning = async (vault) => {
|
|
32
35
|
const vaultHubContract = await getVaultHubContract();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report-fresh.js","sourceRoot":"","sources":["../../../features/utils/report-fresh.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACZ,OAAO,
|
|
1
|
+
{"version":3,"file":"report-fresh.js","sourceRoot":"","sources":["../../../features/utils/report-fresh.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EACL,oBAAoB,EACpB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AAC;IACd,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import { Address } from 'viem';
|
|
1
|
+
import { Address, Hex, TransactionReceipt } from 'viem';
|
|
2
2
|
import { RoleAssignment, VaultWithDashboard } from '../types/index.js';
|
|
3
|
+
export type CreateVaultResult = {
|
|
4
|
+
vault: Address;
|
|
5
|
+
dashboard: Address;
|
|
6
|
+
owner: Address;
|
|
7
|
+
nodeOperator: Address;
|
|
8
|
+
nodeOperatorManager: readonly Address[];
|
|
9
|
+
tx: Hex;
|
|
10
|
+
blockNumber: bigint;
|
|
11
|
+
};
|
|
12
|
+
export declare const isCreateVaultResult: (result: Pick<CreateVaultResult, "tx"> | CreateVaultResult | undefined) => result is CreateVaultResult;
|
|
3
13
|
export declare const prepareCreateVaultPayload: (args: {
|
|
4
14
|
defaultAdmin: Address;
|
|
5
15
|
nodeOperator: Address;
|
|
@@ -13,17 +23,6 @@ export declare const prepareCreateVaultPayload: (args: {
|
|
|
13
23
|
list: number[];
|
|
14
24
|
otherRoles: RoleAssignment[];
|
|
15
25
|
} | undefined;
|
|
16
|
-
export declare const createVault: (payload: VaultWithDashboard, otherRoles?: RoleAssignment[], methodName?: "createVaultWithDashboard" | "createVaultWithDashboardWithoutConnectingToVaultHub") => Promise<
|
|
17
|
-
|
|
18
|
-
vault?: undefined;
|
|
19
|
-
dashboard?: undefined;
|
|
20
|
-
owner?: undefined;
|
|
21
|
-
blockNumber?: undefined;
|
|
22
|
-
} | {
|
|
23
|
-
vault: `0x${string}` | undefined;
|
|
24
|
-
dashboard: `0x${string}` | undefined;
|
|
25
|
-
owner: `0x${string}` | undefined;
|
|
26
|
-
tx: `0x${string}` | undefined;
|
|
27
|
-
blockNumber: bigint;
|
|
28
|
-
} | undefined>;
|
|
26
|
+
export declare const createVault: (payload: VaultWithDashboard, otherRoles?: RoleAssignment[], methodName?: "createVaultWithDashboard" | "createVaultWithDashboardWithoutConnectingToVaultHub") => Promise<Pick<CreateVaultResult, "tx"> | CreateVaultResult | undefined>;
|
|
27
|
+
export declare const getCreateVaultEventData: (receipt: TransactionReceipt, tx: Hex) => Promise<CreateVaultResult>;
|
|
29
28
|
export declare const getVaultFactoryInfo: () => Promise<void>;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { parseEventLogs, parseEther } from 'viem';
|
|
2
|
-
import { getVaultFactoryContract } from '../contracts/index.js';
|
|
1
|
+
import { parseEventLogs, parseEther, } from 'viem';
|
|
2
|
+
import { getDashboardContract, getStakingVaultContract, getVaultFactoryContract, } from '../contracts/index.js';
|
|
3
3
|
import { VaultFactoryAbi } from '../abi/index.js';
|
|
4
|
-
import { callWriteMethodWithReceipt, logResult, printError, showSpinner, logError, transformAddressesToArray, validateAddressesMap, validateAddressMap, logInfo, } from '../utils/index.js';
|
|
4
|
+
import { callWriteMethodWithReceipt, logResult, printError, showSpinner, logError, transformAddressesToArray, validateAddressesMap, validateAddressMap, logInfo, callReadMethodSilent, } from '../utils/index.js';
|
|
5
5
|
import { program } from '../command/index.js';
|
|
6
|
+
export const isCreateVaultResult = (result) => {
|
|
7
|
+
return result !== undefined && 'vault' in result;
|
|
8
|
+
};
|
|
6
9
|
export const prepareCreateVaultPayload = (args) => {
|
|
7
10
|
const { defaultAdmin, nodeOperator, nodeOperatorManager, nodeOperatorFeeRate, confirmExpiry, quantity, roles, } = args;
|
|
8
11
|
const qnt = parseInt(quantity);
|
|
@@ -53,17 +56,22 @@ export const createVault = async (payload, otherRoles = [], methodName = 'create
|
|
|
53
56
|
],
|
|
54
57
|
value: isNeedValue ? parseEther('1') : undefined,
|
|
55
58
|
});
|
|
56
|
-
if (!result)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
if (!result) {
|
|
60
|
+
throw new Error('Transaction failed');
|
|
61
|
+
}
|
|
62
|
+
if (program.opts().populateTx && result.tx) {
|
|
59
63
|
return { tx: result.tx };
|
|
60
64
|
}
|
|
61
65
|
const { receipt, tx } = result;
|
|
62
66
|
// Gnosis safe case
|
|
63
|
-
if (!receipt) {
|
|
64
|
-
logInfo('Transaction has been sent');
|
|
67
|
+
if (!receipt || !tx) {
|
|
68
|
+
logInfo('Transaction has been sent. Use "vault-operations write create-vault log-creating-vault-data" command to get the Vault data after the transaction is signed and executed');
|
|
65
69
|
return;
|
|
66
70
|
}
|
|
71
|
+
const eventData = await getCreateVaultEventData(receipt, tx);
|
|
72
|
+
return eventData;
|
|
73
|
+
};
|
|
74
|
+
export const getCreateVaultEventData = async (receipt, tx) => {
|
|
67
75
|
const events = parseEventLogs({
|
|
68
76
|
abi: VaultFactoryAbi,
|
|
69
77
|
logs: receipt.logs,
|
|
@@ -73,10 +81,22 @@ export const createVault = async (payload, otherRoles = [], methodName = 'create
|
|
|
73
81
|
const dashboardEvent = events.find((event) => event.eventName === 'DashboardCreated');
|
|
74
82
|
const dashboard = dashboardEvent?.args.dashboard;
|
|
75
83
|
const owner = dashboardEvent?.args.admin;
|
|
84
|
+
if (!vault || !dashboard || !owner) {
|
|
85
|
+
throw new Error('Vault, dashboard or owner not found');
|
|
86
|
+
}
|
|
87
|
+
const dashboardContract = await getDashboardContract(dashboard);
|
|
88
|
+
const vaultContract = await getStakingVaultContract(vault);
|
|
89
|
+
const [nodeOperator, nodeOperatorManagerRole] = await Promise.all([
|
|
90
|
+
callReadMethodSilent(vaultContract, 'nodeOperator'),
|
|
91
|
+
callReadMethodSilent(dashboardContract, 'NODE_OPERATOR_MANAGER_ROLE'),
|
|
92
|
+
]);
|
|
93
|
+
const nodeOperatorManager = await callReadMethodSilent(dashboardContract, 'getRoleMembers', [nodeOperatorManagerRole]);
|
|
76
94
|
return {
|
|
77
95
|
vault,
|
|
78
96
|
dashboard,
|
|
79
97
|
owner,
|
|
98
|
+
nodeOperator,
|
|
99
|
+
nodeOperatorManager,
|
|
80
100
|
tx,
|
|
81
101
|
blockNumber: receipt.blockNumber,
|
|
82
102
|
};
|
|
@@ -87,7 +107,9 @@ export const getVaultFactoryInfo = async () => {
|
|
|
87
107
|
try {
|
|
88
108
|
const BEACON = await contract.read.BEACON();
|
|
89
109
|
const LIDO_LOCATOR = await contract.read.LIDO_LOCATOR();
|
|
110
|
+
const CONTRACT_ADDRESS = contract.address;
|
|
90
111
|
const payload = {
|
|
112
|
+
CONTRACT_ADDRESS,
|
|
91
113
|
BEACON,
|
|
92
114
|
LIDO_LOCATOR,
|
|
93
115
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vault-factory.js","sourceRoot":"","sources":["../../features/vault-factory.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"vault-factory.js","sourceRoot":"","sources":["../../features/vault-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,UAAU,GAGX,MAAM,MAAM,CAAC;AAGd,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EACL,0BAA0B,EAC1B,SAAS,EACT,UAAU,EACV,WAAW,EACX,QAAQ,EACR,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,EAClB,OAAO,EACP,oBAAoB,GACrB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAYlC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,MAAqE,EACxC,EAAE;IAC/B,OAAO,MAAM,KAAK,SAAS,IAAI,OAAO,IAAI,MAAM,CAAC;AACnD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,IAQzC,EAAE,EAAE;IACH,MAAM,EACJ,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,QAAQ,EACR,KAAK,GACN,GAAG,IAAI,CAAC;IAET,MAAM,GAAG,GAAG,QAAQ,CAAC,Q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GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;QACxD,MAAM,gBAAgB,GAAG,QAAQ,CAAC,OAAO,CAAC;QAE1C,MAAM,OAAO,GAAG;YACd,gBAAgB;YAChB,MAAM;YACN,YAAY;SACb,CAAC;QAEF,WAAW,EAAE,CAAC;QAEd,SAAS,CAAC;YACR,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;SAClE,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,WAAW,EAAE,CAAC;QACd,UAAU,CAAC,GAAG,EAAE,8BAA8B,CAAC,CAAC;IAClD,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { formatEther } from 'viem';
|
|
2
|
+
import { callReadMethodSilent, confirmOperation, logInfo } from '../../utils/index.js';
|
|
3
|
+
import { getStakingVaultContract, getVaultHubContract } from '../../contracts/index.js';
|
|
4
|
+
export const checkVaultAvailableBalance = async (vault) => {
|
|
5
|
+
const vaultHub = await getVaultHubContract();
|
|
6
|
+
const connectDeposit = await callReadMethodSilent(vaultHub, 'CONNECT_DEPOSIT');
|
|
7
|
+
const vaultContract = await getStakingVaultContract(vault);
|
|
8
|
+
const availableBalance = await callReadMethodSilent(vaultContract, 'availableBalance');
|
|
9
|
+
if (availableBalance < connectDeposit) {
|
|
10
|
+
logInfo(`⚠️ Vault available balance is less than connect deposit:
|
|
11
|
+
Available balance: ${formatEther(availableBalance)} ETH
|
|
12
|
+
Connect deposit: ${formatEther(connectDeposit)} ETH`);
|
|
13
|
+
const confirm = await confirmOperation(`Do you want to fund the vault with ${formatEther(connectDeposit)} ETH?`);
|
|
14
|
+
if (!confirm) {
|
|
15
|
+
throw new Error('Vault available balance is less than connect deposit');
|
|
16
|
+
}
|
|
17
|
+
return { isFundConfirmed: true };
|
|
18
|
+
}
|
|
19
|
+
return { isFundConfirmed: false };
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=connect-vault.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect-vault.js","sourceRoot":"","sources":["../../../features/vault-operations/connect-vault.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,WAAW,EAAE,MAAM,MAAM,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEzE,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,EAC7C,KAAc,EACyB,EAAE;IACzC,MAAM,QAAQ,GAAG,MAAM,mBAAmB,EAAE,CAAC;IAC7C,MAAM,cAAc,GAAG,MAAM,oBAAoB,CAC/C,QAAQ,EACR,iBAAiB,CAClB,CAAC;IAEF,MAAM,aAAa,GAAG,MAAM,uBAAuB,CAAC,KAAK,CAAC,CAAC;IAC3D,MAAM,gBAAgB,GAAG,MAAM,oBAAoB,CACjD,aAAa,EACb,kBAAkB,CACnB,CAAC;IAEF,IAAI,gBAAgB,GAAG,cAAc,EAAE,CAAC;QACtC,OAAO,CACL;6BACuB,WAAW,CAAC,gBAAgB,CAAC;2BAC/B,WAAW,CAAC,cAAc,CAAC,MAAM,CACvD,CAAC;QACF,MAAM,OAAO,GAAG,MAAM,gBAAgB,CACpC,sCAAsC,WAAW,CAAC,cAAc,CAAC,OAAO,CACzE,CAAC;QACF,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;QAC1E,CAAC;QAED,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;IACnC,CAAC;IAED,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC;AACpC,CAAC,CAAC"}
|
|
@@ -4,8 +4,10 @@ import { numberPrompt, selectPrompt } from '../../utils/index.js';
|
|
|
4
4
|
const MIN_CONFIRM_EXPIRY = 24 * 60 * 60; // 24 hours
|
|
5
5
|
const MIN_CONFIRM_EXPIRY_TESTNET = 1 * 60 * 60; // 1 hour
|
|
6
6
|
const MAX_CONFIRM_EXPIRY = 24 * 60 * 60 * 30; // 30 days
|
|
7
|
-
const validateConfirmExpiry = (confirmExpiry) => {
|
|
8
|
-
const minInHours =
|
|
7
|
+
const validateConfirmExpiry = (confirmExpiry, isTestnet = false) => {
|
|
8
|
+
const minInHours = isTestnet
|
|
9
|
+
? MIN_CONFIRM_EXPIRY_TESTNET / 3600
|
|
10
|
+
: MIN_CONFIRM_EXPIRY / 3600;
|
|
9
11
|
const maxInHours = MAX_CONFIRM_EXPIRY / 3600;
|
|
10
12
|
if (confirmExpiry < minInHours)
|
|
11
13
|
throw new Error(`Confirm expiry must be greater than ${minInHours} hours. Current value: ${confirmExpiry} hours (${confirmExpiry * 3600} seconds)`);
|
|
@@ -36,10 +38,10 @@ export const getConfirmExpiry = async ({ confirmExpiry, }) => {
|
|
|
36
38
|
const confirmExpiryValue = await numberPrompt(`Enter the confirm expiry (in hours) (min: ${minConfirmExpiry / 3600} hours, max: ${MAX_CONFIRM_EXPIRY / 3600} hours)`, 'value');
|
|
37
39
|
if (!confirmExpiryValue.value)
|
|
38
40
|
throw new Error('Invalid confirm expiry');
|
|
39
|
-
validateConfirmExpiry(confirmExpiryValue.value);
|
|
41
|
+
validateConfirmExpiry(confirmExpiryValue.value, isTestnet);
|
|
40
42
|
return confirmExpiryValue.value * 3600;
|
|
41
43
|
}
|
|
42
|
-
validateConfirmExpiry(confirmExpiry / 3600);
|
|
44
|
+
validateConfirmExpiry(confirmExpiry / 3600, isTestnet);
|
|
43
45
|
return confirmExpiry;
|
|
44
46
|
};
|
|
45
47
|
export const getNodeOperatorFeeRate = async (nodeOperatorFeeRate) => {
|