Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge "legacy" transfer transactions factory in NextTransferTransactionsFactory #405

Merged
merged 3 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ export * from "./tokens";
export * from "./transaction";
export * from "./transactionPayload";
export * from "./transactionWatcher";
export * from "./transferTransactionsFactory";
export * from "./utils";
export * from "./transactionComputer";
4 changes: 2 additions & 2 deletions src/tokenOperations/tokenOperationsFactory.test.net.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { INetworkProvider, createTestnetProvider } from "../testutils/networkPro
import { TokenTransfer } from "../tokenTransfer";
import { Transaction } from "../transaction";
import { TransactionWatcher } from "../transactionWatcher";
import { TransferTransactionsFactory } from "../transferTransactionsFactory";
import { TransferTransactionsFactory } from "../transactionsFactories/transferTransactionsFactory";
import { TokenOperationsFactory } from "./tokenOperationsFactory";
import { TokenOperationsFactoryConfig } from "./tokenOperationsFactoryConfig";
import { TokenOperationsOutcomeParser } from "./tokenOperationsOutcomeParser";
Expand Down Expand Up @@ -675,7 +675,7 @@ describe("test factory on testnet", function () {
async function processTransaction(
wallet: TestWallet,
transaction: Transaction,
tag: string
tag: string,
): Promise<ITransactionOnNetwork> {
wallet.account.incrementNonce();
transaction.applySignature(await wallet.signer.sign(transaction.serializeForSigning()));
Expand Down
4 changes: 2 additions & 2 deletions src/transaction.local.net.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Transaction } from "./transaction";
import { TransactionPayload } from "./transactionPayload";
import { TransactionWatcher } from "./transactionWatcher";
import { TransactionsFactoryConfig } from "./transactionsFactories/transactionsFactoryConfig";
import { NextTransferTransactionsFactory } from "./transactionsFactories/transferTransactionsFactory";
import { TransferTransactionsFactory } from "./transactionsFactories/transferTransactionsFactory";
import { TokenComputer } from "./tokens";
import { TransactionComputer } from "./transactionComputer";

Expand Down Expand Up @@ -153,7 +153,7 @@ describe("test transaction", function () {
const network = await provider.getNetworkConfig();

const config = new TransactionsFactoryConfig({ chainID: network.ChainID });
const factory = new NextTransferTransactionsFactory({ config: config, tokenComputer: new TokenComputer() });
const factory = new TransferTransactionsFactory({ config: config, tokenComputer: new TokenComputer() });

await alice.sync(provider);
await bob.sync(provider);
Expand Down
16 changes: 8 additions & 8 deletions src/transactionsFactories/transferTransactionsFactory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { Address } from "../address";
import { ErrBadUsage } from "../errors";
import { NextTokenTransfer, Token, TokenComputer } from "../tokens";
import { TransactionsFactoryConfig } from "./transactionsFactoryConfig";
import { NextTransferTransactionsFactory } from "./transferTransactionsFactory";
import { TransferTransactionsFactory } from "./transferTransactionsFactory";

describe("test transfer transcations factory", function () {
const config = new TransactionsFactoryConfig({ chainID: "D" });
const nextTransferFactory = new NextTransferTransactionsFactory({
const transferFactory = new TransferTransactionsFactory({
config: config,
tokenComputer: new TokenComputer(),
});
Expand All @@ -20,7 +20,7 @@ describe("test transfer transcations factory", function () {

assert.throw(
() => {
nextTransferFactory.createTransactionForESDTTokenTransfer({
transferFactory.createTransactionForESDTTokenTransfer({
sender: alice,
receiver: bob,
tokenTransfers: transfers,
Expand All @@ -32,7 +32,7 @@ describe("test transfer transcations factory", function () {
});

it("should create 'Transaction' for native token transfer without data", async () => {
const transaction = nextTransferFactory.createTransactionForNativeTokenTransfer({
const transaction = transferFactory.createTransactionForNativeTokenTransfer({
sender: alice,
receiver: bob,
nativeAmount: 1000000000000000000n,
Expand All @@ -46,7 +46,7 @@ describe("test transfer transcations factory", function () {
});

it("should create 'Transaction' for native token transfer with data", async () => {
const transaction = nextTransferFactory.createTransactionForNativeTokenTransfer({
const transaction = transferFactory.createTransactionForNativeTokenTransfer({
sender: alice,
receiver: bob,
nativeAmount: 1000000000000000000n,
Expand All @@ -64,7 +64,7 @@ describe("test transfer transcations factory", function () {
const fooToken = new Token("FOO-123456", 0n);
const transfer = new NextTokenTransfer(fooToken, 1000000n);

const transaction = nextTransferFactory.createTransactionForESDTTokenTransfer({
const transaction = transferFactory.createTransactionForESDTTokenTransfer({
sender: alice,
receiver: bob,
tokenTransfers: [transfer],
Expand All @@ -81,7 +81,7 @@ describe("test transfer transcations factory", function () {
const nft = new Token("NFT-123456", 10n);
const transfer = new NextTokenTransfer(nft, 1n);

const transaction = nextTransferFactory.createTransactionForESDTTokenTransfer({
const transaction = transferFactory.createTransactionForESDTTokenTransfer({
sender: alice,
receiver: bob,
tokenTransfers: [transfer],
Expand All @@ -104,7 +104,7 @@ describe("test transfer transcations factory", function () {
const secondNft = new Token("TEST-987654", 1n);
const secondTransfer = new NextTokenTransfer(secondNft, 1n);

const transaction = nextTransferFactory.createTransactionForESDTTokenTransfer({
const transaction = transferFactory.createTransactionForESDTTokenTransfer({
sender: alice,
receiver: bob,
tokenTransfers: [firstTransfer, secondTransfer],
Expand Down
Loading
Loading