diff --git a/src/transactionIntent.ts b/src/draftTransaction.ts similarity index 94% rename from src/transactionIntent.ts rename to src/draftTransaction.ts index 43cb9e36..5470c44e 100644 --- a/src/transactionIntent.ts +++ b/src/draftTransaction.ts @@ -1,6 +1,6 @@ import { BigNumber } from "bignumber.js"; -export class TransactionIntent { +export class DraftTransaction { public sender: string; public receiver: string; public gasLimit: BigNumber.Value; diff --git a/src/transactionIntentsFactories/delegationTransactionIntentsFactory.spec.ts b/src/transactionsFactories/delegationTransactionsFactory.spec.ts similarity index 82% rename from src/transactionIntentsFactories/delegationTransactionIntentsFactory.spec.ts rename to src/transactionsFactories/delegationTransactionsFactory.spec.ts index 34bd7df4..8ebd661c 100644 --- a/src/transactionIntentsFactories/delegationTransactionIntentsFactory.spec.ts +++ b/src/transactionsFactories/delegationTransactionsFactory.spec.ts @@ -1,22 +1,22 @@ import BigNumber from "bignumber.js"; import { Address } from "../address"; -import { DelegationTransactionIntentsFactory } from "./delegationTransactionIntentsFactory"; +import { DelegationTransactionsFactory } from "./delegationTransactionsFactory"; import { assert } from "chai"; import { DELEGATION_MANAGER_SC_ADDRESS } from "../constants"; import { ValidatorPublicKey } from "@multiversx/sdk-wallet-next"; import { TransactionIntentsFactoryConfig } from "./transactionIntentsFactoryConfig"; -describe("test delegation intents factory", function () { +describe("test delegation transactions factory", function () { const config = new TransactionIntentsFactoryConfig("D"); - const delegationFactory = new DelegationTransactionIntentsFactory(config); + const delegationFactory = new DelegationTransactionsFactory(config); - it("should create intent for new delegation contract", async function () { + it("should create draft transaction for new delegation contract", async function () { const sender = Address.fromBech32("erd18s6a06ktr2v6fgxv4ffhauxvptssnaqlds45qgsrucemlwc8rawq553rt2"); const delagationCap = "5000000000000000000000"; const serviceFee = 10; const value = new BigNumber("1250000000000000000000"); - const intent = delegationFactory.createTransactionIntentForNewDelegationContract({ + const intent = delegationFactory.createTransactionForNewDelegationContract({ sender: sender, totalDelegationCap: delagationCap, serviceFee: serviceFee, @@ -31,7 +31,7 @@ describe("test delegation intents factory", function () { assert.equal(intent.value, value); }); - it("should create intent for adding nodes", async function () { + it("should create draft transaction for adding nodes", async function () { const sender = Address.fromBech32("erd18s6a06ktr2v6fgxv4ffhauxvptssnaqlds45qgsrucemlwc8rawq553rt2"); const delegationContract = Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqtllllls002zgc"); const publicKey = new ValidatorPublicKey(Buffer.from("e7beaa95b3877f47348df4dd1cb578a4f7cabf7a20bfeefe5cdd263878ff132b765e04fef6f40c93512b666c47ed7719b8902f6c922c04247989b7137e837cc81a62e54712471c97a2ddab75aa9c2f58f813ed4c0fa722bde0ab718bff382208", "hex")); @@ -40,7 +40,7 @@ describe("test delegation intents factory", function () { getSignature: () => Buffer.from("81109fa1c8d3dc7b6c2d6e65206cc0bc1a83c9b2d1eb91a601d66ad32def430827d5eb52917bd2b0d04ce195738db216", "hex") } - const intent = delegationFactory.createTransactionIntentForAddingNodes({ + const intent = delegationFactory.createTransactionForAddingNodes({ sender: sender, delegationContract: delegationContract, publicKeys: [publicKey], @@ -54,7 +54,7 @@ describe("test delegation intents factory", function () { assert.equal(intent.value, 0); }); - it("should create intent for removing nodes", async function () { + it("should create draft transaction for removing nodes", async function () { const sender = Address.fromBech32("erd18s6a06ktr2v6fgxv4ffhauxvptssnaqlds45qgsrucemlwc8rawq553rt2"); const delegationContract = Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqtllllls002zgc"); @@ -64,7 +64,7 @@ describe("test delegation intents factory", function () { } }; - const intent = delegationFactory.createTransactionIntentForRemovingNodes({ + const intent = delegationFactory.createTransactionForRemovingNodes({ sender: sender, delegationContract: delegationContract, publicKeys: [publicKey] @@ -77,7 +77,7 @@ describe("test delegation intents factory", function () { assert.equal(intent.value, 0); }); - it("should create intent for staking nodes", async function () { + it("should create draft transaction for staking nodes", async function () { const sender = Address.fromBech32("erd18s6a06ktr2v6fgxv4ffhauxvptssnaqlds45qgsrucemlwc8rawq553rt2"); const delegationContract = Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqtllllls002zgc"); @@ -87,7 +87,7 @@ describe("test delegation intents factory", function () { } }; - const intent = delegationFactory.createTransactionIntentForStakingNodes({ + const intent = delegationFactory.createTransactionForStakingNodes({ sender: sender, delegationContract: delegationContract, publicKeys: [publicKey] @@ -100,7 +100,7 @@ describe("test delegation intents factory", function () { assert.equal(intent.value, 0); }); - it("should create intent for unbonding nodes", async function () { + it("should create draft transaction for unbonding nodes", async function () { const sender = Address.fromBech32("erd18s6a06ktr2v6fgxv4ffhauxvptssnaqlds45qgsrucemlwc8rawq553rt2"); const delegationContract = Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqtllllls002zgc"); @@ -110,7 +110,7 @@ describe("test delegation intents factory", function () { } }; - const intent = delegationFactory.createTransactionIntentForUnbondingNodes({ + const intent = delegationFactory.createTransactionForUnbondingNodes({ sender: sender, delegationContract: delegationContract, publicKeys: [publicKey] @@ -124,7 +124,7 @@ describe("test delegation intents factory", function () { assert.equal(intent.gasLimit.valueOf(), 12080000); }); - it("should create intent for unstaking nodes", async function () { + it("should create draft transaction for unstaking nodes", async function () { const sender = Address.fromBech32("erd18s6a06ktr2v6fgxv4ffhauxvptssnaqlds45qgsrucemlwc8rawq553rt2"); const delegationContract = Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqtllllls002zgc"); @@ -134,7 +134,7 @@ describe("test delegation intents factory", function () { } }; - const intent = delegationFactory.createTransactionIntentForUnstakingNodes({ + const intent = delegationFactory.createTransactionForUnstakingNodes({ sender: sender, delegationContract: delegationContract, publicKeys: [publicKey] @@ -148,7 +148,7 @@ describe("test delegation intents factory", function () { assert.equal(intent.gasLimit.valueOf(), 12081500); }); - it("should create intent for unjailing nodes", async function () { + it("should create draft transaction for unjailing nodes", async function () { const sender = Address.fromBech32("erd18s6a06ktr2v6fgxv4ffhauxvptssnaqlds45qgsrucemlwc8rawq553rt2"); const delegationContract = Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqtllllls002zgc"); @@ -158,7 +158,7 @@ describe("test delegation intents factory", function () { } }; - const intent = delegationFactory.createTransactionIntentForUnjailingNodes({ + const intent = delegationFactory.createTransactionForUnjailingNodes({ sender: sender, delegationContract: delegationContract, publicKeys: [publicKey] @@ -171,12 +171,12 @@ describe("test delegation intents factory", function () { assert.equal(intent.value, 0); }); - it("should create intent for changing service fee", async function () { + it("should create draft transaction for changing service fee", async function () { const sender = Address.fromBech32("erd18s6a06ktr2v6fgxv4ffhauxvptssnaqlds45qgsrucemlwc8rawq553rt2"); const delegationContract = Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqtllllls002zgc"); const serviceFee = new BigNumber(10); - const intent = delegationFactory.createTransactionIntentForChangingServiceFee({ + const intent = delegationFactory.createTransactionForChangingServiceFee({ sender: sender, delegationContract: delegationContract, serviceFee: serviceFee @@ -189,12 +189,12 @@ describe("test delegation intents factory", function () { assert.equal(intent.value, 0); }); - it("should create intent for changing delegation cap", async function () { + it("should create draft transaction for changing delegation cap", async function () { const sender = Address.fromBech32("erd18s6a06ktr2v6fgxv4ffhauxvptssnaqlds45qgsrucemlwc8rawq553rt2"); const delegationContract = Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqtllllls002zgc"); const delegationCap = new BigNumber("5000000000000000000000"); - const intent = delegationFactory.createTransactionIntentForModifyingDelegationCap({ + const intent = delegationFactory.createTransactionForModifyingDelegationCap({ sender: sender, delegationContract: delegationContract, delegationCap: delegationCap @@ -207,11 +207,11 @@ describe("test delegation intents factory", function () { assert.equal(intent.value, 0); }); - it("should create intent for setting automatic activation", async function () { + it("should create draft transaction for setting automatic activation", async function () { const sender = Address.fromBech32("erd18s6a06ktr2v6fgxv4ffhauxvptssnaqlds45qgsrucemlwc8rawq553rt2"); const delegationContract = Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqtllllls002zgc"); - const intent = delegationFactory.createTransactionIntentForSettingAutomaticActivation({ + const intent = delegationFactory.createTransactionForSettingAutomaticActivation({ sender: sender, delegationContract: delegationContract }); @@ -223,11 +223,11 @@ describe("test delegation intents factory", function () { assert.equal(intent.value, 0); }); - it("should create intent for unsetting automatic activation", async function () { + it("should create draft transaction for unsetting automatic activation", async function () { const sender = Address.fromBech32("erd18s6a06ktr2v6fgxv4ffhauxvptssnaqlds45qgsrucemlwc8rawq553rt2"); const delegationContract = Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqtllllls002zgc"); - const intent = delegationFactory.createTransactionIntentForUnsettingAutomaticActivation({ + const intent = delegationFactory.createTransactionForUnsettingAutomaticActivation({ sender: sender, delegationContract: delegationContract }); @@ -239,11 +239,11 @@ describe("test delegation intents factory", function () { assert.equal(intent.value, 0); }); - it("should create intent for setting cap check on redelegate rewards", async function () { + it("should create draft transaction for setting cap check on redelegate rewards", async function () { const sender = Address.fromBech32("erd18s6a06ktr2v6fgxv4ffhauxvptssnaqlds45qgsrucemlwc8rawq553rt2"); const delegationContract = Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqtllllls002zgc"); - const intent = delegationFactory.createTransactionIntentForSettingCapCheckOnRedelegateRewards({ + const intent = delegationFactory.createTransactionForSettingCapCheckOnRedelegateRewards({ sender: sender, delegationContract: delegationContract }); @@ -255,11 +255,11 @@ describe("test delegation intents factory", function () { assert.equal(intent.value, 0); }); - it("should create intent for unsetting cap check on redelegate rewards", async function () { + it("should create draft transaction for unsetting cap check on redelegate rewards", async function () { const sender = Address.fromBech32("erd18s6a06ktr2v6fgxv4ffhauxvptssnaqlds45qgsrucemlwc8rawq553rt2"); const delegationContract = Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqtllllls002zgc"); - const intent = delegationFactory.createTransactionIntentForUnsettingCapCheckOnRedelegateRewards({ + const intent = delegationFactory.createTransactionForUnsettingCapCheckOnRedelegateRewards({ sender: sender, delegationContract: delegationContract }); @@ -271,11 +271,11 @@ describe("test delegation intents factory", function () { assert.equal(intent.value, 0); }); - it("should create intent for setting metadata", async function () { + it("should create draft transaction for setting metadata", async function () { const sender = Address.fromBech32("erd18s6a06ktr2v6fgxv4ffhauxvptssnaqlds45qgsrucemlwc8rawq553rt2"); const delegationContract = Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqtllllls002zgc"); - const intent = delegationFactory.createTransactionIntentForSettingMetadata({ + const intent = delegationFactory.createTransactionForSettingMetadata({ sender: sender, delegationContract: delegationContract, name: "name", diff --git a/src/transactionIntentsFactories/delegationTransactionIntentsFactory.ts b/src/transactionsFactories/delegationTransactionsFactory.ts similarity index 83% rename from src/transactionIntentsFactories/delegationTransactionIntentsFactory.ts rename to src/transactionsFactories/delegationTransactionsFactory.ts index 1a8cc5be..b7d164e1 100644 --- a/src/transactionIntentsFactories/delegationTransactionIntentsFactory.ts +++ b/src/transactionsFactories/delegationTransactionsFactory.ts @@ -1,8 +1,8 @@ import { IAddress } from "../interface"; import { BigNumber } from "bignumber.js"; import { numberToPaddedHex, byteArrayToHex, utf8ToHex } from "../utils.codec"; -import { TransactionIntent } from "../transactionIntent"; -import { TransactionIntentBuilder } from "./transactionIntentBuilder"; +import { DraftTransaction } from "../draftTransaction"; +import { DraftTransactionBuilder } from "./draftTransactionBuilder"; import { Address } from "../address"; import { DELEGATION_MANAGER_SC_ADDRESS } from "../constants"; import { Err } from "../errors"; @@ -24,19 +24,19 @@ interface IValidatorPublicKey { hex(): string; } -export class DelegationTransactionIntentsFactory { +export class DelegationTransactionsFactory { private readonly config: Config; constructor(config: Config) { this.config = config; } - createTransactionIntentForNewDelegationContract(options: { + createTransactionForNewDelegationContract(options: { sender: IAddress, totalDelegationCap: BigNumber.Value, serviceFee: BigNumber.Value, value: BigNumber.Value - }): TransactionIntent { + }): DraftTransaction { const dataParts = [ "createNewDelegationContract", numberToPaddedHex(options.totalDelegationCap.toString()), @@ -45,7 +45,7 @@ export class DelegationTransactionIntentsFactory { const executionGasLimit = new BigNumber(this.config.gasLimitCreateDelegationContract).plus(this.config.additionalGasLimitForDelegationOperations); - return new TransactionIntentBuilder({ + return new DraftTransactionBuilder({ config: this.config, sender: options.sender, receiver: Address.fromBech32(DELEGATION_MANAGER_SC_ADDRESS), @@ -56,12 +56,12 @@ export class DelegationTransactionIntentsFactory { }).build(); } - createTransactionIntentForAddingNodes(options: { + createTransactionForAddingNodes(options: { sender: IAddress, delegationContract: IAddress, publicKeys: IValidatorPublicKey[], signedMessages: Uint8Array[] - }): TransactionIntent { + }): DraftTransaction { if (options.publicKeys.length !== options.signedMessages.length) { throw new Err("The number of public keys should match the number of signed messages"); } @@ -73,7 +73,7 @@ export class DelegationTransactionIntentsFactory { dataParts.push(...[options.publicKeys[i].hex(), byteArrayToHex(options.signedMessages[i])]); } - return new TransactionIntentBuilder({ + return new DraftTransactionBuilder({ config: this.config, sender: options.sender, receiver: options.delegationContract, @@ -83,11 +83,11 @@ export class DelegationTransactionIntentsFactory { }).build(); } - createTransactionIntentForRemovingNodes(options: { + createTransactionForRemovingNodes(options: { sender: IAddress, delegationContract: IAddress, publicKeys: IValidatorPublicKey[] - }): TransactionIntent { + }): DraftTransaction { const dataParts = ["removeNodes"]; for (const key of options.publicKeys) { @@ -96,7 +96,7 @@ export class DelegationTransactionIntentsFactory { const numNodes = options.publicKeys.length; - return new TransactionIntentBuilder({ + return new DraftTransactionBuilder({ config: this.config, sender: options.sender, receiver: options.delegationContract, @@ -106,11 +106,11 @@ export class DelegationTransactionIntentsFactory { }).build(); } - createTransactionIntentForStakingNodes(options: { + createTransactionForStakingNodes(options: { sender: IAddress, delegationContract: IAddress, publicKeys: IValidatorPublicKey[] - }): TransactionIntent { + }): DraftTransaction { let dataParts = ["stakeNodes"]; for (const key of options.publicKeys) { @@ -123,7 +123,7 @@ export class DelegationTransactionIntentsFactory { this.config.gasLimitDelegationOperations ); - return new TransactionIntentBuilder({ + return new DraftTransactionBuilder({ config: this.config, sender: options.sender, receiver: options.delegationContract, @@ -133,11 +133,11 @@ export class DelegationTransactionIntentsFactory { }).build(); } - createTransactionIntentForUnbondingNodes(options: { + createTransactionForUnbondingNodes(options: { sender: IAddress, delegationContract: IAddress, publicKeys: IValidatorPublicKey[] - }): TransactionIntent { + }): DraftTransaction { let dataParts = ["unBondNodes"]; for (const key of options.publicKeys) { @@ -150,7 +150,7 @@ export class DelegationTransactionIntentsFactory { this.config.gasLimitUnbond ).plus(this.config.gasLimitDelegationOperations); - return new TransactionIntentBuilder({ + return new DraftTransactionBuilder({ config: this.config, sender: options.sender, receiver: options.delegationContract, @@ -160,11 +160,11 @@ export class DelegationTransactionIntentsFactory { }).build(); } - createTransactionIntentForUnstakingNodes(options: { + createTransactionForUnstakingNodes(options: { sender: IAddress, delegationContract: IAddress, publicKeys: IValidatorPublicKey[] - }): TransactionIntent { + }): DraftTransaction { let dataParts = ["unStakeNodes"]; for (const key of options.publicKeys) { @@ -177,7 +177,7 @@ export class DelegationTransactionIntentsFactory { this.config.gasLimitUnstake ).plus(this.config.gasLimitDelegationOperations); - return new TransactionIntentBuilder({ + return new DraftTransactionBuilder({ config: this.config, sender: options.sender, receiver: options.delegationContract, @@ -187,11 +187,11 @@ export class DelegationTransactionIntentsFactory { }).build(); } - createTransactionIntentForUnjailingNodes(options: { + createTransactionForUnjailingNodes(options: { sender: IAddress, delegationContract: IAddress, publicKeys: IValidatorPublicKey[] - }): TransactionIntent { + }): DraftTransaction { const dataParts = ["unJailNodes"]; for (const key of options.publicKeys) { @@ -200,7 +200,7 @@ export class DelegationTransactionIntentsFactory { const numNodes = options.publicKeys.length; - return new TransactionIntentBuilder({ + return new DraftTransactionBuilder({ config: this.config, sender: options.sender, receiver: options.delegationContract, @@ -210,17 +210,17 @@ export class DelegationTransactionIntentsFactory { }).build(); } - createTransactionIntentForChangingServiceFee(options: { + createTransactionForChangingServiceFee(options: { sender: IAddress, delegationContract: IAddress, serviceFee: BigNumber.Value - }): TransactionIntent { + }): DraftTransaction { const dataParts = [ "changeServiceFee", numberToPaddedHex(options.serviceFee) ]; - return new TransactionIntentBuilder({ + return new DraftTransactionBuilder({ config: this.config, sender: options.sender, receiver: options.delegationContract, @@ -230,17 +230,17 @@ export class DelegationTransactionIntentsFactory { }).build(); } - createTransactionIntentForModifyingDelegationCap(options: { + createTransactionForModifyingDelegationCap(options: { sender: IAddress, delegationContract: IAddress, delegationCap: BigNumber.Value - }): TransactionIntent { + }): DraftTransaction { const dataParts = [ "modifyTotalDelegationCap", numberToPaddedHex(options.delegationCap) ]; - return new TransactionIntentBuilder({ + return new DraftTransactionBuilder({ config: this.config, sender: options.sender, receiver: options.delegationContract, @@ -250,16 +250,16 @@ export class DelegationTransactionIntentsFactory { }).build(); } - createTransactionIntentForSettingAutomaticActivation(options: { + createTransactionForSettingAutomaticActivation(options: { sender: IAddress, delegationContract: IAddress - }): TransactionIntent { + }): DraftTransaction { const dataParts = [ "setAutomaticActivation", utf8ToHex("true") ]; - return new TransactionIntentBuilder({ + return new DraftTransactionBuilder({ config: this.config, sender: options.sender, receiver: options.delegationContract, @@ -269,16 +269,16 @@ export class DelegationTransactionIntentsFactory { }).build(); } - createTransactionIntentForUnsettingAutomaticActivation(options: { + createTransactionForUnsettingAutomaticActivation(options: { sender: IAddress, delegationContract: IAddress - }): TransactionIntent { + }): DraftTransaction { const dataParts = [ "setAutomaticActivation", utf8ToHex("false") ]; - return new TransactionIntentBuilder({ + return new DraftTransactionBuilder({ config: this.config, sender: options.sender, receiver: options.delegationContract, @@ -288,16 +288,16 @@ export class DelegationTransactionIntentsFactory { }).build(); } - createTransactionIntentForSettingCapCheckOnRedelegateRewards(options: { + createTransactionForSettingCapCheckOnRedelegateRewards(options: { sender: IAddress, delegationContract: IAddress - }): TransactionIntent { + }): DraftTransaction { const dataParts = [ "setCheckCapOnReDelegateRewards", utf8ToHex("true") ]; - return new TransactionIntentBuilder({ + return new DraftTransactionBuilder({ config: this.config, sender: options.sender, receiver: options.delegationContract, @@ -307,16 +307,16 @@ export class DelegationTransactionIntentsFactory { }).build(); } - createTransactionIntentForUnsettingCapCheckOnRedelegateRewards(options: { + createTransactionForUnsettingCapCheckOnRedelegateRewards(options: { sender: IAddress, delegationContract: IAddress - }): TransactionIntent { + }): DraftTransaction { const dataParts = [ "setCheckCapOnReDelegateRewards", utf8ToHex("false") ]; - return new TransactionIntentBuilder({ + return new DraftTransactionBuilder({ config: this.config, sender: options.sender, receiver: options.delegationContract, @@ -326,13 +326,13 @@ export class DelegationTransactionIntentsFactory { }).build(); } - createTransactionIntentForSettingMetadata(options: { + createTransactionForSettingMetadata(options: { sender: IAddress, delegationContract: IAddress, name: string, website: string, identifier: string - }): TransactionIntent { + }): DraftTransaction { const dataParts = [ "setMetaData", utf8ToHex(options.name), @@ -340,7 +340,7 @@ export class DelegationTransactionIntentsFactory { utf8ToHex(options.identifier) ]; - return new TransactionIntentBuilder({ + return new DraftTransactionBuilder({ config: this.config, sender: options.sender, receiver: options.delegationContract, diff --git a/src/transactionIntentsFactories/transactionIntentBuilder.ts b/src/transactionsFactories/draftTransactionBuilder.ts similarity index 92% rename from src/transactionIntentsFactories/transactionIntentBuilder.ts rename to src/transactionsFactories/draftTransactionBuilder.ts index 00076017..8fee4d77 100644 --- a/src/transactionIntentsFactories/transactionIntentBuilder.ts +++ b/src/transactionsFactories/draftTransactionBuilder.ts @@ -2,14 +2,14 @@ import { BigNumber } from "bignumber.js"; import { IAddress, ITransactionPayload } from "../interface"; import { ARGUMENTS_SEPARATOR } from "../constants"; import { TransactionPayload } from "../transactionPayload"; -import { TransactionIntent } from "../transactionIntent"; +import { DraftTransaction } from "../draftTransaction"; interface Config { minGasLimit: BigNumber.Value; gasLimitPerByte: BigNumber.Value; } -export class TransactionIntentBuilder { +export class DraftTransactionBuilder { private config: Config; private sender: IAddress; private receiver: IAddress; @@ -51,11 +51,11 @@ export class TransactionIntentBuilder { return new TransactionPayload(data); } - build(): TransactionIntent { + build(): DraftTransaction { const data = this.buildTransactionPayload() const gasLimit = this.computeGasLimit(data); - return new TransactionIntent({ + return new DraftTransaction({ sender: this.sender.bech32(), receiver: this.receiver.bech32(), gasLimit: gasLimit, diff --git a/src/transactionIntentsFactories/smartContractTransactionIntentsFactory.spec.ts b/src/transactionsFactories/smartContractTransactionIntentsFactory.spec.ts similarity index 100% rename from src/transactionIntentsFactories/smartContractTransactionIntentsFactory.spec.ts rename to src/transactionsFactories/smartContractTransactionIntentsFactory.spec.ts diff --git a/src/transactionIntentsFactories/smartContractTransactionIntentsFactory.ts b/src/transactionsFactories/smartContractTransactionIntentsFactory.ts similarity index 97% rename from src/transactionIntentsFactories/smartContractTransactionIntentsFactory.ts rename to src/transactionsFactories/smartContractTransactionIntentsFactory.ts index 82e69e7c..907efc9b 100644 --- a/src/transactionIntentsFactories/smartContractTransactionIntentsFactory.ts +++ b/src/transactionsFactories/smartContractTransactionIntentsFactory.ts @@ -1,13 +1,13 @@ import { BigNumber } from "bignumber.js"; import { IAddress } from "../interface"; -import { TransactionIntent } from "../transactionIntent"; +import { DraftTransaction } from "../draftTransaction"; import { AbiRegistry, ArgSerializer, CodeMetadata, ContractFunction, EndpointDefinition } from "../smartcontracts"; import { byteArrayToHex } from "../utils.codec"; import { CONTRACT_DEPLOY_ADDRESS, VM_TYPE_WASM_VM } from "../constants"; import { NativeSerializer } from "../smartcontracts/nativeSerializer"; import { Err } from "../errors"; import { Address } from "../address"; -import { TransactionIntentBuilder } from "./transactionIntentBuilder"; +import { TransactionIntentBuilder } from "./draftTransactionBuilder"; interface Config { chainID: string; diff --git a/src/transactionIntentsFactories/tokenManagementTransactionIntentsFactory.spec.ts b/src/transactionsFactories/tokenManagementTransactionIntentsFactory.spec.ts similarity index 100% rename from src/transactionIntentsFactories/tokenManagementTransactionIntentsFactory.spec.ts rename to src/transactionsFactories/tokenManagementTransactionIntentsFactory.spec.ts diff --git a/src/transactionIntentsFactories/tokenManagementTransactionIntentsFactory.ts b/src/transactionsFactories/tokenManagementTransactionIntentsFactory.ts similarity index 99% rename from src/transactionIntentsFactories/tokenManagementTransactionIntentsFactory.ts rename to src/transactionsFactories/tokenManagementTransactionIntentsFactory.ts index 5c603202..527014bd 100644 --- a/src/transactionIntentsFactories/tokenManagementTransactionIntentsFactory.ts +++ b/src/transactionsFactories/tokenManagementTransactionIntentsFactory.ts @@ -1,6 +1,6 @@ import BigNumber from "bignumber.js"; -import { TransactionIntent } from "../transactionIntent"; -import { TransactionIntentBuilder } from "./transactionIntentBuilder"; +import { DraftTransaction } from "../draftTransaction"; +import { TransactionIntentBuilder } from "./draftTransactionBuilder"; import { IAddress } from "../interface"; import { utf8ToHex, bigIntToHex, addressToHex, byteArrayToHex } from "../utils.codec"; import { ESDT_CONTRACT_ADDRESS } from "../constants"; diff --git a/src/transactionIntentsFactories/transactionIntentsFactoryConfig.ts b/src/transactionsFactories/transactionIntentsFactoryConfig.ts similarity index 100% rename from src/transactionIntentsFactories/transactionIntentsFactoryConfig.ts rename to src/transactionsFactories/transactionIntentsFactoryConfig.ts