Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a048653
Merge pull request #649 from multiversx/feat/next
danielailie Jul 29, 2025
c2b9149
Bump version
danielailie Jul 29, 2025
382e6ba
Merge pull request #650 from multiversx/BumpVersion
danielailie Jul 29, 2025
c9518f3
throw error when estimating gas for failed tx
popenta Jul 31, 2025
d23fe6c
Allow passing network options from Entrypoint to Network Provider
BubuMVX Aug 5, 2025
45242a8
Cookbook: adjust section on relayed transactions.
andreibancioiu Aug 7, 2025
eec19ba
Merge pull request #653 from multiversx/cookbook-08-07
andreibancioiu Aug 7, 2025
45bf412
Rename networkProviderOptions to networkProviderConfig in NetworkEntr…
BubuMVX Aug 11, 2025
0966d5a
Use immutable approach for network provider config in NetworkEntrypoint
BubuMVX Aug 11, 2025
e57fe27
Merge branch 'main' of https://github.com/BubuMVX/mx-sdk-js-core into…
BubuMVX Aug 11, 2025
0098f8b
Rename networkProviderOptions to networkProviderConfig for consistency
BubuMVX Aug 13, 2025
33be03d
Merge branch 'main' into throw-error-gas-estimation
popenta Aug 18, 2025
5a8d4e2
Merge pull request #651 from multiversx/throw-error-gas-estimation
popenta Aug 18, 2025
a16aff8
add missing exports
michavie Aug 27, 2025
d0cc0c4
Merge branch 'main' into feat/entrypoint-network-provider-options
popenta Aug 28, 2025
cdacb0a
Merge pull request #654 from michavie/missing-exports
popenta Aug 28, 2025
08658b2
Merge branch 'main' into feat/entrypoint-network-provider-options
popenta Aug 28, 2025
7ed8a6b
Merge pull request #652 from BubuMVX/feat/entrypoint-network-provider…
popenta Aug 28, 2025
4ee5d81
bump version
popenta Aug 28, 2025
7605472
bump version to v15.1.0
popenta Aug 28, 2025
1f89253
Merge pull request #655 from multiversx/bump-version-v15-0-2
popenta Aug 28, 2025
1d3e7d5
run npm audit fix
popenta Sep 1, 2025
a8b357a
Merge pull request #656 from multiversx/npm-audit-fix-01-09
popenta Sep 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions cookbook/cookbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -2402,18 +2402,16 @@ After the `10-epoch unbonding period` is complete, we can proceed with withdrawi
```

### Relayed transactions
We are currently on the `third iteration (V3)` of relayed transactions. V1 and V2 will soon be deactivated, so we will focus on V3.
We are currently on the third iteration (V3) of relayed transactions. V1 and V2 will be deactivated soon, so we'll focus on V3.

For V3, two new fields have been added to transactions:
- relayer
- relayerSignature
For V3, two new fields have been added on transactions: `relayer` and `relayerSignature`.

Signing Process:
1. The relayer must be set before the sender signs the transaction.
2. Once the sender has signed, the relayer can also sign the transaction and broadcast it.
Note that:
1. the sender and the relayer can sign the transaction in any order.
2. before any of the sender or relayer can sign the transaction, the `relayer` field must be set.
3. relayed transactions require an additional `50,000` of gas.
4. the sender and the relayer must be in the same network shard.

**Important Consideration**:
Relayed V3 transactions require an additional `50,000` gas.
Let’s see how to create a relayed transaction:

```js
Expand Down
22 changes: 10 additions & 12 deletions cookbook/relayed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@ import { Account, Address, DevnetEntrypoint, Transaction } from "../src"; // md-
// md-start
(async () => {
// ### Relayed transactions
// We are currently on the `third iteration (V3)` of relayed transactions. V1 and V2 will soon be deactivated, so we will focus on V3.

// For V3, two new fields have been added to transactions:
// - relayer
// - relayerSignature

// Signing Process:
// 1. The relayer must be set before the sender signs the transaction.
// 2. Once the sender has signed, the relayer can also sign the transaction and broadcast it.

// **Important Consideration**:
// Relayed V3 transactions require an additional `50,000` gas.
// We are currently on the third iteration (V3) of relayed transactions. V1 and V2 will be deactivated soon, so we'll focus on V3.
//
// For V3, two new fields have been added on transactions: `relayer` and `relayerSignature`.
//
// Note that:
// 1. the sender and the relayer can sign the transaction in any order.
// 2. before any of the sender or relayer can sign the transaction, the `relayer` field must be set.
// 3. relayed transactions require an additional `50,000` of gas.
// 4. the sender and the relayer must be in the same network shard.
//
// Let’s see how to create a relayed transaction:

// ```js
Expand Down
70 changes: 42 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@multiversx/sdk-core",
"version": "15.0.0-beta.0",
"version": "15.1.1",
"description": "MultiversX SDK for JavaScript and TypeScript",
"author": "MultiversX",
"homepage": "https://multiversx.com",
Expand Down
8 changes: 7 additions & 1 deletion src/core/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,12 @@ export class ExpectedAccountConditionNotReachedError extends Err {
*/
export class ErrGasLimitCannotBeEstimated extends Err {
public constructor(error: Error) {
super(`Failed to estimate gas limit: ${error}`, error);
super(`Failed to estimate gas limit: [${error}]`, error);
}
}

export class ErrEstimateTransactionCost extends Err {
public constructor(message: string) {
super(message);
}
}
2 changes: 2 additions & 0 deletions src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export * from "./message";
export * from "./networkParams";
export * from "./smartContractQuery";
export * from "./tokens";
export * from "./tokenTransfersDataBuilder";
export * from "./transaction";
export * from "./transactionComputer";
export * from "./transactionEvents";
Expand All @@ -20,4 +21,5 @@ export * from "./transactionOnNetwork";
export * from "./transactionsFactoryConfig";
export * from "./transactionStatus";
export * from "./transactionWatcher";
export * from "./utils.codec";
export * from "./utils";
22 changes: 15 additions & 7 deletions src/entrypoints/entrypoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { GasLimitEstimator } from "../gasEstimator";
import { GovernanceController, GovernanceTransactionsFactory } from "../governance";
import { MultisigTransactionsFactory } from "../multisig";
import { MultisigController } from "../multisig/multisigController";
import { ApiNetworkProvider, ProxyNetworkProvider } from "../networkProviders";
import { ApiNetworkProvider, NetworkProviderConfig, ProxyNetworkProvider } from "../networkProviders";
import { INetworkProvider } from "../networkProviders/interface";
import { SmartContractTransactionsFactory } from "../smartContracts";
import { SmartContractController } from "../smartContracts/smartContractController";
Expand All @@ -34,19 +34,21 @@ export class NetworkEntrypoint {
constructor(options: {
networkProviderUrl: string;
networkProviderKind: string;
networkProviderConfig?: NetworkProviderConfig;
chainId: string;
clientName?: string;
withGasLimitEstimator?: boolean;
gasLimitMultiplier?: number;
}) {
const networkProviderConfig: NetworkProviderConfig = {
...(options.networkProviderConfig ?? {}),
...(options.clientName && { clientName: options.clientName }),
};

if (options.networkProviderKind === "proxy") {
this.networkProvider = new ProxyNetworkProvider(options.networkProviderUrl, {
clientName: options.clientName,
});
this.networkProvider = new ProxyNetworkProvider(options.networkProviderUrl, networkProviderConfig);
} else if (options.networkProviderKind === "api") {
this.networkProvider = new ApiNetworkProvider(options.networkProviderUrl, {
clientName: options.clientName,
});
this.networkProvider = new ApiNetworkProvider(options.networkProviderUrl, networkProviderConfig);
} else {
throw new ErrInvalidNetworkProviderKind();
}
Expand Down Expand Up @@ -267,12 +269,14 @@ export class TestnetEntrypoint extends NetworkEntrypoint {
clientName?: string;
withGasLimitEstimator?: boolean;
gasLimitMultiplier?: number;
networkProviderConfig?: NetworkProviderConfig;
}) {
const entrypointConfig = new TestnetEntrypointConfig();
options = options || {};
super({
networkProviderUrl: options.url || entrypointConfig.networkProviderUrl,
networkProviderKind: options.kind || entrypointConfig.networkProviderKind,
networkProviderConfig: options.networkProviderConfig,
chainId: entrypointConfig.chainId,
clientName: options.clientName,
withGasLimitEstimator: options.withGasLimitEstimator,
Expand All @@ -288,12 +292,14 @@ export class DevnetEntrypoint extends NetworkEntrypoint {
clientName?: string;
withGasLimitEstimator?: boolean;
gasLimitMultiplier?: number;
networkProviderConfig?: NetworkProviderConfig;
}) {
const entrypointConfig = new DevnetEntrypointConfig();
options = options || {};
super({
networkProviderUrl: options.url || entrypointConfig.networkProviderUrl,
networkProviderKind: options.kind || entrypointConfig.networkProviderKind,
networkProviderConfig: options.networkProviderConfig,
chainId: entrypointConfig.chainId,
clientName: options.clientName,
withGasLimitEstimator: options.withGasLimitEstimator,
Expand All @@ -309,12 +315,14 @@ export class MainnetEntrypoint extends NetworkEntrypoint {
clientName?: string;
withGasLimitEstimator?: boolean;
gasLimitMultiplier?: number;
networkProviderConfig?: NetworkProviderConfig;
}) {
const entrypointConfig = new MainnetEntrypointConfig();
options = options || {};
super({
networkProviderUrl: options.url || entrypointConfig.networkProviderUrl,
networkProviderKind: options.kind || entrypointConfig.networkProviderKind,
networkProviderConfig: options.networkProviderConfig,
chainId: entrypointConfig.chainId,
clientName: options.clientName,
withGasLimitEstimator: options.withGasLimitEstimator,
Expand Down
5 changes: 5 additions & 0 deletions src/networkProviders/proxyNetworkProvider.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
Address,
ErrContractQuery,
ErrEstimateTransactionCost,
ErrNetworkProvider,
getAxios,
prepareTransactionForBroadcasting,
Expand Down Expand Up @@ -148,6 +149,10 @@ export class ProxyNetworkProvider implements INetworkProvider {

const transaction = prepareTransactionForBroadcasting(copiedTx);
const response = await this.doPostGeneric("transaction/cost", transaction);
const returnMessage: string = response.returnMessage;
if (returnMessage) {
throw new ErrEstimateTransactionCost(returnMessage);
}
return TransactionCostResponse.fromHttpResponse(response);
}

Expand Down
Loading