Skip to content

Commit

Permalink
SERVICES-2626: make chainID optional in TransactionOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
mad2sm0key committed Sep 27, 2024
1 parent 01a06e3 commit 6d70798
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/modules/common/transaction.options.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { TokenTransfer } from '@multiversx/sdk-core';

export class TransactionOptions {
chainID: string;
chainID?: string;
function: string;
gasLimit: number;
sender: string;
Expand Down
19 changes: 1 addition & 18 deletions src/modules/staking/services/staking.transactions.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '@multiversx/sdk-core';
import { Injectable } from '@nestjs/common';
import { BigNumber } from 'bignumber.js';
import { mxConfig, gasConfig, constantsConfig } from 'src/config';
import { gasConfig, constantsConfig } from 'src/config';
import { InputTokenModel } from 'src/models/inputToken.model';
import { TransactionModel } from 'src/models/transaction.model';
import { MXProxyService } from 'src/services/multiversx-communication/mx.proxy.service';
Expand Down Expand Up @@ -45,7 +45,6 @@ export class StakingTransactionService {
stakeAddress,
new TransactionOptions({
sender: sender,
chainID: mxConfig.chainID,
gasLimit: gasLimit,
function: 'stakeFarm',
tokenTransfers: payments.map(
Expand All @@ -71,7 +70,6 @@ export class StakingTransactionService {
stakeAddress,
new TransactionOptions({
sender: sender,
chainID: mxConfig.chainID,
gasLimit: gasConfig.stake.unstakeFarm,
function: 'unstakeFarm',
tokenTransfers: [
Expand All @@ -96,7 +94,6 @@ export class StakingTransactionService {
stakeAddress,
new TransactionOptions({
sender: sender,
chainID: mxConfig.chainID,
gasLimit: gasConfig.stake.unbondFarm,
function: 'unbondFarm',
tokenTransfers: [
Expand All @@ -121,7 +118,6 @@ export class StakingTransactionService {
stakeAddress,
new TransactionOptions({
sender: sender,
chainID: mxConfig.chainID,
gasLimit: gasConfig.stake.claimRewards,
function: 'claimRewards',
tokenTransfers: [
Expand All @@ -147,7 +143,6 @@ export class StakingTransactionService {
stakeAddress,
new TransactionOptions({
sender: sender,
chainID: mxConfig.chainID,
gasLimit: gasConfig.stake.claimRewardsWithNewValue,
function: 'claimRewardsWithNewValue',
arguments: [new BigUIntValue(new BigNumber(newValue))],
Expand All @@ -173,7 +168,6 @@ export class StakingTransactionService {
stakeAddress,
new TransactionOptions({
sender: sender,
chainID: mxConfig.chainID,
gasLimit: gasConfig.stake.compoundRewards,
function: 'compoundRewards',
tokenTransfers: [
Expand All @@ -197,7 +191,6 @@ export class StakingTransactionService {
stakeAddress,
new TransactionOptions({
sender: sender,
chainID: mxConfig.chainID,
gasLimit: gasConfig.stake.claimBoostedRewards,
function: 'claimBoostedRewards',
}),
Expand Down Expand Up @@ -257,7 +250,6 @@ export class StakingTransactionService {
stakeAddress,
new TransactionOptions({
sender: sender,
chainID: mxConfig.chainID,
gasLimit: gasConfig.stake.admin.topUpRewards,
function: 'topUpRewards',
tokenTransfers: [
Expand All @@ -281,7 +273,6 @@ export class StakingTransactionService {
stakeAddress,
new TransactionOptions({
sender: sender,
chainID: mxConfig.chainID,
gasLimit: gasConfig.stake.mergeTokens,
function: 'mergeFarmTokens',
tokenTransfers: payments.map(
Expand All @@ -308,7 +299,6 @@ export class StakingTransactionService {
stakeAddress,
new TransactionOptions({
sender: sender,
chainID: mxConfig.chainID,
gasLimit: gasConfig.stake.admin.whitelist,
function: whitelist
? 'addSCAddressToWhitelist'
Expand All @@ -327,7 +317,6 @@ export class StakingTransactionService {
stakeAddress,
new TransactionOptions({
sender: sender,
chainID: mxConfig.chainID,
gasLimit: gasConfig.stake.admin.setState,
function: state ? 'resume' : 'pause',
}),
Expand All @@ -343,7 +332,6 @@ export class StakingTransactionService {
stakeAddress,
new TransactionOptions({
sender: sender,
chainID: mxConfig.chainID,
gasLimit: gasConfig.stake.admin.setLocalRolesFarmToken,
function: 'setBurnRoleForAddress',
arguments: [new AddressValue(Address.newFromBech32(address))],
Expand All @@ -362,7 +350,6 @@ export class StakingTransactionService {
stakeAddress,
new TransactionOptions({
sender: sender,
chainID: mxConfig.chainID,
gasLimit: gasConfig.stake.admin.registerFarmToken,
function: 'registerFarmToken',
arguments: [
Expand All @@ -383,7 +370,6 @@ export class StakingTransactionService {
stakeAddress,
new TransactionOptions({
sender: sender,
chainID: mxConfig.chainID,
gasLimit: gasConfig.stake.admin.setPerBlockRewardAmount,
function: 'setPerBlockRewardAmount',
arguments: [new BigUIntValue(new BigNumber(perBlockAmount))],
Expand All @@ -400,7 +386,6 @@ export class StakingTransactionService {
stakeAddress,
new TransactionOptions({
sender: sender,
chainID: mxConfig.chainID,
gasLimit: gasConfig.stake.admin.setMaxApr,
function: 'setMaxApr',
arguments: [new BigUIntValue(new BigNumber(maxApr))],
Expand All @@ -417,7 +402,6 @@ export class StakingTransactionService {
stakeAddress,
new TransactionOptions({
sender: sender,
chainID: mxConfig.chainID,
gasLimit: gasConfig.stake.admin.setMinUnbondEpochs,
function: 'setMinUnbondEpochs',
arguments: [new U64Value(new BigNumber(minUnboundEpoch))],
Expand All @@ -434,7 +418,6 @@ export class StakingTransactionService {
stakeAddress,
new TransactionOptions({
sender: sender,
chainID: mxConfig.chainID,
gasLimit: gasConfig.stake.admin.setRewardsState,
function: rewards ? 'startProduceRewards' : 'endProduceRewards',
}),
Expand Down
2 changes: 1 addition & 1 deletion src/services/multiversx-communication/mx.proxy.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ export class MXProxyService {
const factory = await this.getSmartContractTransactionFactory(
contractAbiPath,
contractInterface,
options.chainID,
options.chainID ?? mxConfig.chainID,
);

return factory
Expand Down

0 comments on commit 6d70798

Please sign in to comment.