@broxus/js-bridge-essentials
Version:
Bridge JavaScript Essentials library
31 lines (30 loc) • 1.72 kB
JavaScript
import { getFullContractState } from '@broxus/js-core';
import { tonNativeProxyV1Contract } from '../../models/ton-native-proxy/contracts';
export class TonNativeProxyV1Utils {
static async getConfiguration(connection, proxyAddress, cachedState) {
const state = cachedState ?? await getFullContractState(connection, proxyAddress);
return tonNativeProxyV1Contract(connection, proxyAddress)
.methods.getConfiguration({ answerId: 0 })
.call({ cachedState: state, responsible: true });
}
static async getTonEvmConfiguration(connection, proxyAddress, cachedState) {
const result = await TonNativeProxyV1Utils.getConfiguration(connection, proxyAddress, cachedState);
return result.value0.tvmConfiguration;
}
static async getDexMiddleware(connection, proxyAddress, cachedState) {
const state = cachedState ?? await getFullContractState(connection, proxyAddress);
const result = await tonNativeProxyV1Contract(connection, proxyAddress)
.methods.dex_middleware()
.call({ cachedState: state });
return result.dex_middleware;
}
static decodeEvent(connection, eventConfigurationAddress, args) {
return tonNativeProxyV1Contract(connection, eventConfigurationAddress).decodeEvent(args);
}
static decodeTransaction(connection, eventConfigurationAddress, args) {
return tonNativeProxyV1Contract(connection, eventConfigurationAddress).decodeTransaction(args);
}
static decodeTransactionEvents(connection, eventConfigurationAddress, transaction) {
return tonNativeProxyV1Contract(connection, eventConfigurationAddress).decodeTransactionEvents({ transaction });
}
}