@elrondnetwork/erdjs
Advanced tools
Comparing version 12.0.0-alpha.0 to 12.0.0-alpha.1
@@ -115,3 +115,3 @@ /** | ||
/** | ||
* Signals an issue related to waiting for a specific {@link TransactionStatus}. | ||
* Signals an issue related to waiting for a specific transaction status. | ||
*/ | ||
@@ -191,2 +191,8 @@ export declare class ErrExpectedTransactionStatusNotReached extends Err { | ||
/** | ||
* Signals invalid arguments when using the relayed v1 builder | ||
*/ | ||
export declare class ErrInvalidRelayedV1BuilderArguments extends Err { | ||
constructor(); | ||
} | ||
/** | ||
* Signals invalid arguments when using the relayed v2 builder | ||
@@ -193,0 +199,0 @@ */ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ErrGasLimitShouldBe0ForInnerTransaction = exports.ErrInvalidRelayedV2BuilderArguments = exports.ErrNotImplemented = exports.ErrContractInteraction = exports.ErrCodec = exports.ErrCannotParseContractResults = exports.ErrMissingFieldOnEnum = exports.ErrMissingFieldOnStruct = exports.ErrTypeInferenceSystemRequiresRegularJavascriptObjects = exports.ErrTypingSystem = exports.ErrMock = exports.ErrContractHasNoAddress = exports.ErrContract = exports.ErrExpectedTransactionEventsNotFound = exports.ErrExpectedTransactionStatusNotReached = exports.ErrTransactionWatcherTimeout = exports.ErrAsyncTimerAborted = exports.ErrAsyncTimerAlreadyRunning = exports.ErrInvalidFunctionName = exports.ErrSignatureCannotCreate = exports.ErrTransactionOptionsInvalid = exports.ErrTransactionVersionInvalid = exports.ErrNonceInvalid = exports.ErrNotEnoughGas = exports.ErrAddressEmpty = exports.ErrAddressBadHrp = exports.ErrAddressCannotCreate = exports.ErrUnexpectedCondition = exports.ErrInvariantFailed = exports.ErrBadType = exports.ErrUnsupportedOperation = exports.ErrInvalidArgument = exports.Err = void 0; | ||
exports.ErrGasLimitShouldBe0ForInnerTransaction = exports.ErrInvalidRelayedV2BuilderArguments = exports.ErrInvalidRelayedV1BuilderArguments = exports.ErrNotImplemented = exports.ErrContractInteraction = exports.ErrCodec = exports.ErrCannotParseContractResults = exports.ErrMissingFieldOnEnum = exports.ErrMissingFieldOnStruct = exports.ErrTypeInferenceSystemRequiresRegularJavascriptObjects = exports.ErrTypingSystem = exports.ErrMock = exports.ErrContractHasNoAddress = exports.ErrContract = exports.ErrExpectedTransactionEventsNotFound = exports.ErrExpectedTransactionStatusNotReached = exports.ErrTransactionWatcherTimeout = exports.ErrAsyncTimerAborted = exports.ErrAsyncTimerAlreadyRunning = exports.ErrInvalidFunctionName = exports.ErrSignatureCannotCreate = exports.ErrTransactionOptionsInvalid = exports.ErrTransactionVersionInvalid = exports.ErrNonceInvalid = exports.ErrNotEnoughGas = exports.ErrAddressEmpty = exports.ErrAddressBadHrp = exports.ErrAddressCannotCreate = exports.ErrUnexpectedCondition = exports.ErrInvariantFailed = exports.ErrBadType = exports.ErrUnsupportedOperation = exports.ErrInvalidArgument = exports.Err = void 0; | ||
/** | ||
@@ -184,3 +184,3 @@ * The base class for `erdjs` exceptions (errors). | ||
/** | ||
* Signals an issue related to waiting for a specific {@link TransactionStatus}. | ||
* Signals an issue related to waiting for a specific transaction status. | ||
*/ | ||
@@ -306,2 +306,11 @@ class ErrExpectedTransactionStatusNotReached extends Err { | ||
/** | ||
* Signals invalid arguments when using the relayed v1 builder | ||
*/ | ||
class ErrInvalidRelayedV1BuilderArguments extends Err { | ||
constructor() { | ||
super("invalid arguments for relayed v1 builder"); | ||
} | ||
} | ||
exports.ErrInvalidRelayedV1BuilderArguments = ErrInvalidRelayedV1BuilderArguments; | ||
/** | ||
* Signals invalid arguments when using the relayed v2 builder | ||
@@ -308,0 +317,0 @@ */ |
@@ -19,2 +19,3 @@ export * from "./interface"; | ||
export * from "./smartcontracts"; | ||
export * from "./relayedTransactionV1Builder"; | ||
export * from "./relayedTransactionV2Builder"; |
@@ -32,3 +32,4 @@ "use strict"; | ||
__exportStar(require("./smartcontracts"), exports); | ||
__exportStar(require("./relayedTransactionV1Builder"), exports); | ||
__exportStar(require("./relayedTransactionV2Builder"), exports); | ||
//# sourceMappingURL=index.js.map |
import { Transaction } from "./transaction"; | ||
import { IGasLimit } from "./interface"; | ||
import { IAddress, IGasLimit, INonce } from "./interface"; | ||
import { INetworkConfig } from "./interfaceOfNetwork"; | ||
@@ -7,2 +7,4 @@ export declare class RelayedTransactionV2Builder { | ||
innerTransactionGasLimit: IGasLimit | undefined; | ||
relayerAddress: IAddress | undefined; | ||
relayerNonce: INonce | undefined; | ||
netConfig: INetworkConfig | undefined; | ||
@@ -30,4 +32,17 @@ /** | ||
/** | ||
* Tries to build the relayed v2 transaction based on the previously set fields | ||
* Sets the address of the relayer (the one that will actually pay the fee) | ||
* | ||
* @param relayerAddress | ||
*/ | ||
setRelayerAddress(relayerAddress: IAddress): RelayedTransactionV2Builder; | ||
/** | ||
* (optional) Sets the nonce of the relayer | ||
* | ||
* @param relayerNonce | ||
*/ | ||
setRelayerNonce(relayerNonce: INonce): RelayedTransactionV2Builder; | ||
/** | ||
* Tries to build the relayed v2 transaction based on the previously set fields. | ||
* It returns a transaction that isn't signed | ||
* | ||
* @throws ErrInvalidRelayedV2BuilderArguments | ||
@@ -34,0 +49,0 @@ * @throws ErrGasLimitShouldBe0ForInnerTransaction |
@@ -39,4 +39,23 @@ "use strict"; | ||
/** | ||
* Tries to build the relayed v2 transaction based on the previously set fields | ||
* Sets the address of the relayer (the one that will actually pay the fee) | ||
* | ||
* @param relayerAddress | ||
*/ | ||
setRelayerAddress(relayerAddress) { | ||
this.relayerAddress = relayerAddress; | ||
return this; | ||
} | ||
/** | ||
* (optional) Sets the nonce of the relayer | ||
* | ||
* @param relayerNonce | ||
*/ | ||
setRelayerNonce(relayerNonce) { | ||
this.relayerNonce = relayerNonce; | ||
return this; | ||
} | ||
/** | ||
* Tries to build the relayed v2 transaction based on the previously set fields. | ||
* It returns a transaction that isn't signed | ||
* | ||
* @throws ErrInvalidRelayedV2BuilderArguments | ||
@@ -47,3 +66,3 @@ * @throws ErrGasLimitShouldBe0ForInnerTransaction | ||
build() { | ||
if (!this.innerTransaction || !this.innerTransactionGasLimit || !this.netConfig || !this.innerTransaction.getSignature()) { | ||
if (!this.innerTransaction || !this.innerTransactionGasLimit || !this.relayerAddress || !this.netConfig || !this.innerTransaction.getSignature()) { | ||
throw new errors_1.ErrInvalidRelayedV2BuilderArguments(); | ||
@@ -63,4 +82,4 @@ } | ||
.build(); | ||
return new transaction_1.Transaction({ | ||
sender: this.innerTransaction.getSender(), | ||
let relayedTransaction = new transaction_1.Transaction({ | ||
sender: this.relayerAddress, | ||
receiver: this.innerTransaction.getSender(), | ||
@@ -72,2 +91,6 @@ value: 0, | ||
}); | ||
if (this.relayerNonce) { | ||
relayedTransaction.setNonce(this.relayerNonce); | ||
} | ||
return relayedTransaction; | ||
} | ||
@@ -74,0 +97,0 @@ } |
{ | ||
"name": "@elrondnetwork/erdjs", | ||
"version": "12.0.0-alpha.0", | ||
"version": "12.0.0-alpha.1", | ||
"description": "Smart Contracts interaction framework", | ||
@@ -5,0 +5,0 @@ "main": "out/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
626968
285
10745