Skip to content

Commit 4d28ff3

Browse files
authored
Merge pull request #670 from multiversx/fixes-and-bump-version-15-2-1
Small fixes and bump version
2 parents c776a76 + b02af07 commit 4d28ff3

File tree

4 files changed

+32
-32
lines changed

4 files changed

+32
-32
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@multiversx/sdk-core",
3-
"version": "15.2.0",
3+
"version": "15.2.1",
44
"description": "MultiversX SDK for JavaScript and TypeScript",
55
"author": "MultiversX",
66
"homepage": "https://multiversx.com",

src/core/baseController.ts

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,11 @@ export type BaseControllerInput = {
1212
};
1313

1414
export class BaseController {
15-
private gasLimitEstimator?: IGasLimitEstimator;
15+
readonly gasLimitEstimator?: IGasLimitEstimator;
1616
constructor(options?: { gasLimitEstimator?: IGasLimitEstimator }) {
1717
this.gasLimitEstimator = options?.gasLimitEstimator;
1818
}
1919

20-
protected async setTransactionGasOptions(
21-
transaction: Transaction,
22-
options: { gasLimit?: bigint; gasPrice?: bigint },
23-
) {
24-
if (options.gasPrice) {
25-
transaction.gasPrice = options.gasPrice;
26-
}
27-
28-
if (options.gasLimit) {
29-
transaction.gasLimit = options.gasLimit;
30-
return;
31-
} else {
32-
this.addExtraGasLimitIfRequired(transaction);
33-
}
34-
35-
if (this.gasLimitEstimator) {
36-
transaction.gasLimit = await this.gasLimitEstimator.estimateGasLimit({ transaction });
37-
}
38-
}
39-
4020
protected addExtraGasLimitIfRequired(transaction: Transaction): void {
4121
if (transaction.guardian && !transaction.guardian.isEmpty()) {
4222
transaction.gasLimit += BigInt(EXTRA_GAS_LIMIT_FOR_GUARDED_TRANSACTIONS);
@@ -47,13 +27,6 @@ export class BaseController {
4727
}
4828
}
4929

50-
protected setVersionAndOptionsForGuardian(transaction: Transaction): void {
51-
if (transaction.guardian && !transaction.guardian.isEmpty()) {
52-
const txComputer = new TransactionComputer();
53-
txComputer.applyGuardian(transaction, transaction.guardian);
54-
}
55-
}
56-
5730
protected async setupAndSignTransaction(
5831
transaction: Transaction,
5932
options: BaseControllerInput,
@@ -67,4 +40,31 @@ export class BaseController {
6740
await this.setTransactionGasOptions(transaction, options);
6841
transaction.signature = await sender.signTransaction(transaction);
6942
}
43+
44+
protected setVersionAndOptionsForGuardian(transaction: Transaction): void {
45+
if (transaction.guardian && !transaction.guardian.isEmpty()) {
46+
const txComputer = new TransactionComputer();
47+
txComputer.applyGuardian(transaction, transaction.guardian);
48+
}
49+
}
50+
51+
protected async setTransactionGasOptions(
52+
transaction: Transaction,
53+
options: { gasLimit?: bigint; gasPrice?: bigint },
54+
) {
55+
if (options.gasPrice) {
56+
transaction.gasPrice = options.gasPrice;
57+
}
58+
59+
if (options.gasLimit) {
60+
transaction.gasLimit = options.gasLimit;
61+
return;
62+
}
63+
64+
this.addExtraGasLimitIfRequired(transaction);
65+
66+
if (this.gasLimitEstimator) {
67+
transaction.gasLimit = await this.gasLimitEstimator.estimateGasLimit({ transaction });
68+
}
69+
}
7070
}

src/transfers/transfersController.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe("test transfers controller", function () {
1919
grace = await Account.newFromPem(path.join(walletsPath, "grace.pem"));
2020
});
2121

22-
it("should send relayed with ho native balance", async function () {
22+
it("should send relayed with no native balance", async function () {
2323
sender.nonce = await entrypoint.recallAccountNonce(sender.address);
2424
const token = new Token({ identifier: "USDC-350c4e" });
2525
const transfer = new TokenTransfer({ token: token, amount: 7n });

0 commit comments

Comments
 (0)