@broxus/js-bridge-essentials
Version:
Bridge JavaScript Essentials library
22 lines (21 loc) • 1.14 kB
JavaScript
import { getFullContractState } from '@broxus/js-core';
import { tonNativeProxyContract } from '../../models/ton-native-proxy/contracts';
export class TonNativeProxyUtils {
static async getConfiguration(connection, proxyAddress, cachedState) {
const state = cachedState ?? await getFullContractState(connection, proxyAddress);
return tonNativeProxyContract(connection, proxyAddress)
.methods.getConfiguration({ answerId: 0 })
.call({ cachedState: state, responsible: true });
}
static async getTonEvmConfiguration(connection, proxyAddress, cachedState) {
const result = await TonNativeProxyUtils.getConfiguration(connection, proxyAddress, cachedState);
return result.value0.everscaleConfiguration;
}
static async getDexMiddleware(connection, proxyAddress, cachedState) {
const state = cachedState ?? await getFullContractState(connection, proxyAddress);
const result = await tonNativeProxyContract(connection, proxyAddress)
.methods.dex_middleware()
.call({ cachedState: state });
return result.dex_middleware;
}
}