Skip to content

Commit

Permalink
Merge pull request #1001 from multiversx/development
Browse files Browse the repository at this point in the history
v2.26.1
  • Loading branch information
CiprianDraghici authored Dec 21, 2023
2 parents 50bf94c + 6a7af41 commit 520e1c5
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 47 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [[v2.26.1]](https://github.com/multiversx/mx-sdk-dapp/pull/1001)] - 2023-12-21

- [Remove sdk-network-providers from the dependencies](https://github.com/multiversx/mx-sdk-dapp/pull/1000)

## [[v2.26.0]](https://github.com/multiversx/mx-sdk-dapp/pull/998)] - 2023-12-20

- [Prevent logout action when not logged in or provider not initialized](https://github.com/multiversx/mx-sdk-dapp/pull/997)
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@multiversx/sdk-dapp",
"version": "2.26.0",
"version": "2.26.1",
"description": "A library to hold the main logic for a dapp on the MultiversX blockchain",
"author": "MultiversX",
"license": "GPL-3.0-or-later",
Expand Down Expand Up @@ -147,7 +147,6 @@
"@multiversx/sdk-extension-provider": "3.0.0",
"@multiversx/sdk-hw-provider": "6.4.0",
"@multiversx/sdk-native-auth-client": "1.0.6",
"@multiversx/sdk-network-providers": "2.2.0",
"@multiversx/sdk-opera-provider": "1.0.0-alpha.1",
"@multiversx/sdk-wallet": "4.2.0",
"@multiversx/sdk-wallet-connect-provider": "4.0.4",
Expand Down
83 changes: 83 additions & 0 deletions src/models/TransactionStatus.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/**
* An abstraction for handling and interpreting the "status" field of a transaction.
*/
export class TransactionStatus {
/**
* The raw status, as fetched from the Network.
*/
readonly status: string;

/**
* Creates a new TransactionStatus object.
*/
constructor(status: string) {
this.status = (status || '').toLowerCase();
}

/**
* Creates an unknown status.
*/
static createUnknown(): TransactionStatus {
return new TransactionStatus('unknown');
}

/**
* Returns whether the transaction is pending (e.g. in mempool).
*/
isPending(): boolean {
return this.status == 'received' || this.status == 'pending';
}

/**
* Returns whether the transaction has been executed (not necessarily with success).
*/
isExecuted(): boolean {
return this.isSuccessful() || this.isFailed() || this.isInvalid();
}

/**
* Returns whether the transaction has been executed successfully.
*/
isSuccessful(): boolean {
return (
this.status == 'executed' ||
this.status == 'success' ||
this.status == 'successful'
);
}

/**
* Returns whether the transaction has been executed, but with a failure.
*/
isFailed(): boolean {
return (
this.status == 'fail' ||
this.status == 'failed' ||
this.status == 'unsuccessful' ||
this.isInvalid()
);
}

/**
* Returns whether the transaction has been executed, but marked as invalid (e.g. due to "insufficient funds").
*/
isInvalid(): boolean {
return this.status == 'invalid';
}

toString(): string {
return this.status;
}

valueOf(): string {
return this.status;
}

equals(other: TransactionStatus) {
if (!other) {
return false;
}

return this.status == other.status;
}
}
2 changes: 1 addition & 1 deletion src/services/transactions/getTransactionsDetails.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TransactionStatus } from '@multiversx/sdk-network-providers';
import { getTransactionByHashPromise } from 'apiCalls';
import { TransactionStatus } from 'models/TransactionStatus';
import { ServerTransactionType } from 'types';
import { delayWithPromise } from 'utils/delayWithPromise';

Expand Down
13 changes: 6 additions & 7 deletions src/utils/operations/calculateFeeLimit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
Address,
TokenPayment
} from '@multiversx/sdk-core';
import { NetworkConfig } from '@multiversx/sdk-network-providers';
import BigNumber from 'bignumber.js';
import {
EXTRA_GAS_LIMIT_GUARDED_TX,
Expand Down Expand Up @@ -62,13 +61,13 @@ export function calculateFeeLimit({
version: new TransactionVersion(1)
});

const networkConfig = new NetworkConfig();
networkConfig.MinGasLimit = parseInt(minGasLimit);
networkConfig.GasPerDataByte = parseInt(gasPerDataByte);
networkConfig.GasPriceModifier = parseFloat(gasPriceModifier);

try {
const bNfee = transaction.computeFee(networkConfig);
const bNfee = transaction.computeFee({
GasPerDataByte: parseInt(gasPerDataByte),
MinGasLimit: parseInt(minGasLimit),
GasPriceModifier: parseFloat(gasPriceModifier),
ChainID: chainId
});
return bNfee.toString(10);
} catch (err) {
console.error(err);
Expand Down
47 changes: 10 additions & 37 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1964,17 +1964,6 @@
dependencies:
axios "^1.6.2"

"@multiversx/sdk-network-providers@2.2.0":
version "2.2.0"
resolved "https://registry.yarnpkg.com/@multiversx/sdk-network-providers/-/sdk-network-providers-2.2.0.tgz#2b8d5fbbc848dbeba38950db2f02340908dfcfd3"
integrity sha512-2n/+7Ap6S9rJGTiX38GCZ2TmY9zQ1U7o1DwnWpHNRJRxArSN/xzLrbcSKy8InMyc+4A+VHf5pV0Pk8NdPV6++w==
dependencies:
axios "1.6.1"
bech32 "1.1.4"
bignumber.js "9.0.1"
buffer "6.0.3"
json-bigint "1.0.0"

"@multiversx/sdk-opera-provider@1.0.0-alpha.1":
version "1.0.0-alpha.1"
resolved "https://registry.yarnpkg.com/@multiversx/sdk-opera-provider/-/sdk-opera-provider-1.0.0-alpha.1.tgz#2beebd5423fdc2e667b33660f17cbff325449097"
Expand Down Expand Up @@ -3885,9 +3874,9 @@
"@types/estree" "*"

"@types/eslint@*":
version "8.44.9"
resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-8.44.9.tgz#5799663009645637bd1c45b2e1a7c8f4caf89534"
integrity sha512-6yBxcvwnnYoYT1Uk2d+jvIfsuP4mb2EdIxFnrPABj5a/838qe5bGkNLFOiipX4ULQ7XVQvTxOh7jO+BTAiqsEw==
version "8.56.0"
resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-8.56.0.tgz#e28d045b8e530a33c9cbcfbf02332df0d1380a2c"
integrity sha512-FlsN0p4FhuYRjIxpbdXovvHQhtlG05O1GG/RNWvdAxTboR438IOTwmrY/vLA+Xfgg06BTkP045M3vpFwTMv1dg==
dependencies:
"@types/estree" "*"
"@types/json-schema" "*"
Expand Down Expand Up @@ -5387,15 +5376,6 @@ axios-mock-adapter@1.21.2:
fast-deep-equal "^3.1.3"
is-buffer "^2.0.5"

axios@1.6.1:
version "1.6.1"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.1.tgz#76550d644bf0a2d469a01f9244db6753208397d7"
integrity sha512-vfBmhDpKafglh0EldBEbVuoe7DyAavGSLWhuSm5ZSEKQnHhBf0xAAwybbNH1IkrJNGnS/VG4I5yxig1pCEXE4g==
dependencies:
follow-redirects "^1.15.0"
form-data "^4.0.0"
proxy-from-env "^1.1.0"

axios@1.6.2, axios@^1.6.2:
version "1.6.2"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.2.tgz#de67d42c755b571d3e698df1b6504cde9b0ee9f2"
Expand Down Expand Up @@ -5627,7 +5607,7 @@ bignumber.js@9.0.1:
resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.0.1.tgz#8d7ba124c882bfd8e43260c67475518d0689e4e5"
integrity sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA==

bignumber.js@9.x, bignumber.js@^9.0.0:
bignumber.js@9.x:
version "9.1.2"
resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.2.tgz#b7c4242259c008903b13707983b5f4bbd31eda0c"
integrity sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==
Expand Down Expand Up @@ -7318,9 +7298,9 @@ ee-first@1.1.1:
integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==

electron-to-chromium@^1.4.601:
version "1.4.614"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.614.tgz#2fe789d61fa09cb875569f37c309d0c2701f91c0"
integrity sha512-X4ze/9Sc3QWs6h92yerwqv7aB/uU8vCjZcrMjA8N9R1pjMFRe44dLsck5FzLilOYvcXuDn93B+bpGYyufc70gQ==
version "1.4.615"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.615.tgz#b1c41839962d2e4e63dca05519da9040e34848c2"
integrity sha512-/bKPPcgZVUziECqDc+0HkT87+0zhaWSZHNXqF8FLd2lQcptpmUFwoCSWjCdOng9Gdq+afKArPdEg/0ZW461Eng==

element-resize-detector@^1.2.2:
version "1.2.4"
Expand Down Expand Up @@ -8408,9 +8388,9 @@ fast-redact@^3.0.0:
integrity sha512-6T5V1QK1u4oF+ATxs1lWUmlEk6P2T9HqJG3e2DnHOdVgZy2rFJBoEnrIedcTXlkAHU/zKC+7KETJ+KGGKwxgMQ==

fastq@^1.6.0:
version "1.15.0"
resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.15.0.tgz#d04d07c6a2a68fe4599fea8d2e103a937fae6b3a"
integrity sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==
version "1.16.0"
resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.16.0.tgz#83b9a9375692db77a822df081edb6a9cf6839320"
integrity sha512-ifCoaXsDrsdkWTtiNJX5uzHDsrck5TzfKKDcuFFTIrrc/BS076qgEIfoIy1VeZqViznfKiysPYTh/QeHtnIsYA==
dependencies:
reusify "^1.0.4"

Expand Down Expand Up @@ -10882,13 +10862,6 @@ jsesc@~0.5.0:
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d"
integrity sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==

json-bigint@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/json-bigint/-/json-bigint-1.0.0.tgz#ae547823ac0cad8398667f8cd9ef4730f5b01ff1"
integrity sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==
dependencies:
bignumber.js "^9.0.0"

json-buffer@3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13"
Expand Down

0 comments on commit 520e1c5

Please sign in to comment.