UNPKG

@lidofinance/lido-ethereum-sdk

Version:

<div style="display: flex;" align="center"> <h1 align="center">Lido Ethereum SDK</h1> </div>

174 lines 11.2 kB
"use strict"; var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { var useValue = arguments.length > 2; for (var i = 0; i < initializers.length; i++) { value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); } return useValue ? value : void 0; }; var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); var _, done = false; for (var i = decorators.length - 1; i >= 0; i--) { var context = {}; for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; for (var p in contextIn.access) context.access[p] = contextIn.access[p]; context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); if (kind === "accessor") { if (result === void 0) continue; if (result === null || typeof result !== "object") throw new TypeError("Object expected"); if (_ = accept(result.get)) descriptor.get = _; if (_ = accept(result.set)) descriptor.set = _; if (_ = accept(result.init)) initializers.unshift(_); } else if (_ = accept(result)) { if (kind === "field") initializers.unshift(_); else descriptor[key] = _; } } if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.LidoSDKVaultContracts = void 0; const viem_1 = require("viem"); const index_js_1 = require("./abi/index.js"); const index_js_2 = require("../common/decorators/index.js"); const bus_module_js_1 = require("./bus-module.js"); const index_js_3 = require("../common/index.js"); let LidoSDKVaultContracts = (() => { var _a; let _classSuper = bus_module_js_1.BusModule; let _instanceExtraInitializers = []; let _getContractVault_decorators; let _getContractVaultDashboard_decorators; let _getContractVaultHub_decorators; let _getContractVaultFactory_decorators; let _getContractVaultViewer_decorators; let _getContractLazyOracle_decorators; let _getContractPredepositGuarantee_decorators; let _getContractOperatorGrid_decorators; return _a = class LidoSDKVaultContracts extends _classSuper { async getContractVault(address) { return (0, index_js_3.getEncodableContract)((0, viem_1.getContract)({ address, abi: index_js_1.StakingVaultAbi, client: this.bus.core.keyedClient, })); } async getContractVaultDashboard(address) { return (0, index_js_3.getEncodableContract)((0, viem_1.getContract)({ address, abi: index_js_1.DashboardAbi, client: this.bus.core.keyedClient, })); } async getContractVaultHub() { const address = await this.bus.core .getContractLidoLocator() .read.vaultHub(); return (0, index_js_3.getEncodableContract)((0, viem_1.getContract)({ address, abi: index_js_1.VaultHubAbi, client: this.bus.core.keyedClient, })); } async getContractVaultFactory() { const address = await this.bus.core .getContractLidoLocator() .read.vaultFactory(); return (0, index_js_3.getEncodableContract)((0, viem_1.getContract)({ address, abi: index_js_1.VaultFactoryAbi, client: this.bus.core.keyedClient, })); } async getContractVaultViewer() { const address = this.bus.core.getVaultViewerAddress(); return (0, index_js_3.getEncodableContract)((0, viem_1.getContract)({ address, abi: index_js_1.VaultViewerAbi, client: this.bus.core.keyedClient, })); } async getContractLazyOracle() { const address = await this.bus.core .getContractLidoLocator() .read.lazyOracle(); return (0, index_js_3.getEncodableContract)((0, viem_1.getContract)({ address, abi: index_js_1.LazyOracleAbi, client: this.bus.core.keyedClient, })); } async getContractPredepositGuarantee() { const address = await this.bus.core .getContractLidoLocator() .read.predepositGuarantee(); return (0, index_js_3.getEncodableContract)((0, viem_1.getContract)({ address, abi: index_js_1.PredepositGuaranteeAbi, client: this.bus.core.keyedClient, })); } async getContractOperatorGrid() { const address = await this.bus.core .getContractLidoLocator() .read.operatorGrid(); return (0, index_js_3.getEncodableContract)((0, viem_1.getContract)({ address, abi: index_js_1.OperatorGridAbi, client: this.bus.core.keyedClient, })); } constructor() { super(...arguments); __runInitializers(this, _instanceExtraInitializers); } }, (() => { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0; _getContractVault_decorators = [(0, index_js_2.Logger)('Contracts:'), (0, index_js_2.Cache)(30 * 60 * 1000, ['bus.core.chain.id', 'address'])]; _getContractVaultDashboard_decorators = [(0, index_js_2.Logger)('Contracts:'), (0, index_js_2.Cache)(30 * 60 * 1000, ['bus.core.chain.id', 'address'])]; _getContractVaultHub_decorators = [(0, index_js_2.Logger)('Contracts:'), (0, index_js_2.Cache)(30 * 60 * 1000, ['bus.core.chain.id'])]; _getContractVaultFactory_decorators = [(0, index_js_2.Logger)('Contracts:'), (0, index_js_2.Cache)(30 * 60 * 1000, ['bus.core.chain.id'])]; _getContractVaultViewer_decorators = [(0, index_js_2.Logger)('Contracts:'), (0, index_js_2.Cache)(30 * 60 * 1000, ['bus.core.chain.id'])]; _getContractLazyOracle_decorators = [(0, index_js_2.Logger)('Contracts:'), (0, index_js_2.Cache)(30 * 60 * 1000, ['bus.core.chain.id'])]; _getContractPredepositGuarantee_decorators = [(0, index_js_2.Logger)('Contracts:'), (0, index_js_2.Cache)(30 * 60 * 1000, ['bus.core.chain.id'])]; _getContractOperatorGrid_decorators = [(0, index_js_2.Logger)('Contracts:'), (0, index_js_2.Cache)(30 * 60 * 1000, ['bus.core.chain.id'])]; __esDecorate(_a, null, _getContractVault_decorators, { kind: "method", name: "getContractVault", static: false, private: false, access: { has: obj => "getContractVault" in obj, get: obj => obj.getContractVault }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_a, null, _getContractVaultDashboard_decorators, { kind: "method", name: "getContractVaultDashboard", static: false, private: false, access: { has: obj => "getContractVaultDashboard" in obj, get: obj => obj.getContractVaultDashboard }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_a, null, _getContractVaultHub_decorators, { kind: "method", name: "getContractVaultHub", static: false, private: false, access: { has: obj => "getContractVaultHub" in obj, get: obj => obj.getContractVaultHub }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_a, null, _getContractVaultFactory_decorators, { kind: "method", name: "getContractVaultFactory", static: false, private: false, access: { has: obj => "getContractVaultFactory" in obj, get: obj => obj.getContractVaultFactory }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_a, null, _getContractVaultViewer_decorators, { kind: "method", name: "getContractVaultViewer", static: false, private: false, access: { has: obj => "getContractVaultViewer" in obj, get: obj => obj.getContractVaultViewer }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_a, null, _getContractLazyOracle_decorators, { kind: "method", name: "getContractLazyOracle", static: false, private: false, access: { has: obj => "getContractLazyOracle" in obj, get: obj => obj.getContractLazyOracle }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_a, null, _getContractPredepositGuarantee_decorators, { kind: "method", name: "getContractPredepositGuarantee", static: false, private: false, access: { has: obj => "getContractPredepositGuarantee" in obj, get: obj => obj.getContractPredepositGuarantee }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_a, null, _getContractOperatorGrid_decorators, { kind: "method", name: "getContractOperatorGrid", static: false, private: false, access: { has: obj => "getContractOperatorGrid" in obj, get: obj => obj.getContractOperatorGrid }, metadata: _metadata }, null, _instanceExtraInitializers); if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); })(), Object.defineProperty(_a, "VAULT_CREATED_SIGNATURE", { enumerable: true, configurable: true, writable: true, value: (0, viem_1.toEventHash)((0, viem_1.getAbiItem)({ abi: index_js_1.VaultCreatedEventAbi, name: 'VaultCreated', })) }), Object.defineProperty(_a, "DASHBOARD_CREATED_SIGNATURE", { enumerable: true, configurable: true, writable: true, value: (0, viem_1.toEventHash)((0, viem_1.getAbiItem)({ abi: index_js_1.DashboardCreatedEventAbi, name: 'DashboardCreated', })) }), _a; })(); exports.LidoSDKVaultContracts = LidoSDKVaultContracts; //# sourceMappingURL=vault-contracts.js.map