UNPKG

@broxus/js-bridge-essentials

Version:

Bridge JavaScript Essentials library

43 lines (42 loc) 2.44 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NativeProxyV6Utils = void 0; const js_core_1 = require("@broxus/js-core"); const contracts_1 = require("../../models/native-proxy/contracts"); class NativeProxyV6Utils { static async getConfiguration(connection, proxyAddress, cachedState) { const state = cachedState ?? await (0, js_core_1.getFullContractState)(connection, proxyAddress); return (0, contracts_1.nativeProxyV6Contract)(connection, proxyAddress) .methods.getConfiguration({ answerId: 0 }) .call({ cachedState: state, responsible: true }); } static async getTvmEvmConfiguration(connection, proxyAddress, cachedState) { const result = await NativeProxyV6Utils.getConfiguration(connection, proxyAddress, cachedState); return result.value0.everscaleConfiguration; } static async getSolTvmConfiguration(connection, proxyAddress, cachedState) { const result = await NativeProxyV6Utils.getConfiguration(connection, proxyAddress, cachedState); return result.value1.solanaConfiguration; } static async getTvmSolConfiguration(connection, proxyAddress, cachedState) { const result = await NativeProxyV6Utils.getConfiguration(connection, proxyAddress, cachedState); return result.value1.everscaleConfiguration; } static async getDexMiddleware(connection, proxyAddress, cachedState) { const state = cachedState ?? await (0, js_core_1.getFullContractState)(connection, proxyAddress); const result = await (0, contracts_1.nativeProxyV6Contract)(connection, proxyAddress) .methods.dex_middleware() .call({ cachedState: state }); return result.dex_middleware; } static decodeEvent(connection, eventConfigurationAddress, args) { return (0, contracts_1.nativeProxyV6Contract)(connection, eventConfigurationAddress).decodeEvent(args); } static decodeTransaction(connection, eventConfigurationAddress, args) { return (0, contracts_1.nativeProxyV6Contract)(connection, eventConfigurationAddress).decodeTransaction(args); } static decodeTransactionEvents(connection, eventConfigurationAddress, transaction) { return (0, contracts_1.nativeProxyV6Contract)(connection, eventConfigurationAddress).decodeTransactionEvents({ transaction }); } } exports.NativeProxyV6Utils = NativeProxyV6Utils;