UNPKG

@broxus/js-bridge-essentials

Version:

Bridge JavaScript Essentials library

39 lines (38 loc) 2.19 kB
import { getFullContractState } from '@broxus/js-core'; import { nativeProxyV6Contract } from '../../models/native-proxy/contracts'; export class NativeProxyV6Utils { static async getConfiguration(connection, proxyAddress, cachedState) { const state = cachedState ?? await getFullContractState(connection, proxyAddress); return 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 getFullContractState(connection, proxyAddress); const result = await nativeProxyV6Contract(connection, proxyAddress) .methods.dex_middleware() .call({ cachedState: state }); return result.dex_middleware; } static decodeEvent(connection, eventConfigurationAddress, args) { return nativeProxyV6Contract(connection, eventConfigurationAddress).decodeEvent(args); } static decodeTransaction(connection, eventConfigurationAddress, args) { return nativeProxyV6Contract(connection, eventConfigurationAddress).decodeTransaction(args); } static decodeTransactionEvents(connection, eventConfigurationAddress, transaction) { return nativeProxyV6Contract(connection, eventConfigurationAddress).decodeTransactionEvents({ transaction }); } }