Skip to content

Commit

Permalink
Merge pull request #531 from multiversx/TOOL-349-move-smart-contracts…
Browse files Browse the repository at this point in the history
…-folder-to-abi-folder-based-on-the-new-structure

Move smartcontract folder content to abi
  • Loading branch information
danielailie authored Nov 13, 2024
2 parents 670a1b0 + 681ae55 commit 404b714
Show file tree
Hide file tree
Showing 119 changed files with 54 additions and 74 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import BigNumber from "bignumber.js";
import { assert } from "chai";
import { promises } from "fs";
import { QueryRunnerAdapter } from "../adapters/queryRunnerAdapter";
import { SmartContractQueriesController } from "../smartContractQueriesController";
import { loadAbiRegistry, loadTestWallets, prepareDeployment, TestWallet } from "../testutils";
import { ContractController } from "../testutils/contractController";
import { createLocalnetProvider } from "../testutils/networkProviders";
import { Transaction } from "../transaction";
import { TransactionComputer } from "../transactionComputer";
import { TransactionsFactoryConfig } from "../transactionsFactories";
import { SmartContractTransactionsFactory } from "../transactionsFactories/smartContractTransactionsFactory";
import { TransactionWatcher } from "../transactionWatcher";
import { Interaction } from "./interaction";
import { ResultsParser } from "./resultsParser";
import { ReturnCode } from "./returnCode";
import { SmartContract } from "./smartContract";
import { TransactionsFactoryConfig } from "../transactionsFactories/transactionsFactoryConfig";
import { SmartContractTransactionsFactory } from "../transactionsFactories/smartContractTransactionsFactory";
import { promises } from "fs";
import { ResultsParser } from "./resultsParser";
import { TransactionWatcher } from "../transactionWatcher";
import { SmartContractQueriesController } from "../smartContractQueriesController";
import { QueryRunnerAdapter } from "../adapters/queryRunnerAdapter";
import { ManagedDecimalSignedValue, ManagedDecimalValue } from "./typesystem";

describe("test smart contract interactor", function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ContractQueryResponse } from "../networkProviders";
import BigNumber from "bignumber.js";
import { assert } from "chai";
import { Address } from "../address";
import { ContractQueryResponse } from "../networkProviders";
import {
loadAbiRegistry,
loadTestWallets,
Expand All @@ -16,8 +16,7 @@ import { ContractFunction } from "./function";
import { Interaction } from "./interaction";
import { ReturnCode } from "./returnCode";
import { SmartContract } from "./smartContract";
import { BigUIntValue, OptionalValue, OptionValue, TokenIdentifierValue, U32Value } from "./typesystem";
import { BytesValue } from "./typesystem/bytes";
import { BigUIntValue, BytesValue, OptionalValue, OptionValue, TokenIdentifierValue, U32Value } from "./typesystem";

describe("test smart contract interactor", function () {
let dummyAddress = new Address("erd1qqqqqqqqqqqqqpgqak8zt22wl2ph4tswtyc39namqx6ysa2sd8ss4xmlj3");
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import { SmartContract } from "./smartContract";
import {
BigUIntType,
BigUIntValue,
BytesValue,
OptionalType,
OptionalValue,
OptionValue,
TokenIdentifierValue,
U32Value,
} from "./typesystem";
import { BytesValue } from "./typesystem/bytes";

describe("integration tests: test checker within interactor", function () {
let dummyAddress = new Address("erd1qqqqqqqqqqqqqpgqak8zt22wl2ph4tswtyc39namqx6ysa2sd8ss4xmlj3");
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,22 @@ import { prepareDeployment } from "../testutils";
import { createLocalnetProvider } from "../testutils/networkProviders";
import { loadTestWallets, TestWallet } from "../testutils/wallets";
import { TransactionComputer } from "../transactionComputer";
import { TransactionsFactoryConfig } from "../transactionsFactories";
import { SmartContractTransactionsFactory } from "../transactionsFactories/smartContractTransactionsFactory";
import { TransactionsFactoryConfig } from "../transactionsFactories/transactionsFactoryConfig";
import { TransactionWatcher } from "../transactionWatcher";
import { decodeUnsignedNumber } from "./codec";
import { ContractFunction } from "./function";
import { ResultsParser } from "./resultsParser";
import { SmartContract } from "./smartContract";
import { AddressValue, BigUIntValue, OptionalValue, OptionValue, TokenIdentifierValue, U32Value } from "./typesystem";
import { BytesValue } from "./typesystem/bytes";
import {
AddressValue,
BigUIntValue,
BytesValue,
OptionalValue,
OptionValue,
TokenIdentifierValue,
U32Value,
} from "./typesystem";

describe("test on local testnet", function () {
let alice: TestWallet, bob: TestWallet, carol: TestWallet;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export * from "./codeMetadata";
export * from "./composite";
export * from "./endpoint";
export * from "./enum";
export * from "./event";
export * from "./explicit-enum";
export * from "./factory";
export * from "./fields";
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/converters/transactionsConverter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ResultsParser } from "../abi";
import { IPlainTransactionObject, ITransaction } from "../interface";
import { IContractResultItem, ITransactionEvent, ITransactionOnNetwork } from "../interfaceOfNetwork";
import { ResultsParser } from "../smartcontracts";
import { Transaction } from "../transaction";
import {
SmartContractCallOutcome,
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

require("./globals");

export * from "./abi";
export * from "./account";
export * from "./adapters";
export * from "./address";
Expand All @@ -19,19 +20,18 @@ export * from "./interfaceOfNetwork";
export * from "./logger";
export * from "./message";
export * from "./networkParams";
export * from "./networkProviders";
export * from "./relayedTransactionV1Builder";
export * from "./relayedTransactionV2Builder";
export * from "./signableMessage";
export * from "./smartContractQueriesController";
export * from "./smartcontracts";
export * from "./tokenOperations";
export * from "./tokens";
export * from "./transaction";
export * from "./transactionComputer";
export * from "./transactionPayload";
export * from "./transactionWatcher";
export * from "./transactionsFactories";
export * from "./transactionsOutcomeParsers";
export * from "./transactionWatcher";
export * from "./utils";
export * from "./networkProviders";
export * from "./wallet";
2 changes: 1 addition & 1 deletion src/proto/serializer.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import BigNumber from "bignumber.js";
import { bigIntToBuffer } from "../abi/codec/utils";
import { Address } from "../address";
import { TRANSACTION_OPTIONS_DEFAULT, TRANSACTION_OPTIONS_TX_GUARDED } from "../constants";
import * as errors from "../errors";
import { ITransaction, ITransactionValue } from "../interface";
import { bigIntToBuffer } from "../smartcontracts/codec/utils";
import { Transaction } from "../transaction";

/**
Expand Down
2 changes: 1 addition & 1 deletion src/relayedTransactionV2Builder.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AddressValue, ArgSerializer, BytesValue, U64Value } from "./abi";
import { ErrGasLimitShouldBe0ForInnerTransaction, ErrInvalidRelayedV2BuilderArguments } from "./errors";
import { IAddress, IGasLimit, INonce } from "./interface";
import { INetworkConfig } from "./interfaceOfNetwork";
import { AddressValue, ArgSerializer, BytesValue, U64Value } from "./smartcontracts";
import { Transaction } from "./transaction";
import { TransactionPayload } from "./transactionPayload";

Expand Down
6 changes: 3 additions & 3 deletions src/smartContractQueriesController.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ContractQueryResponse } from "./networkProviders";
import BigNumber from "bignumber.js";
import { assert } from "chai";
import { AbiRegistry, BigUIntValue, BooleanValue, BytesValue, Tuple, U16Value, U64Value } from "./abi";
import { QueryRunnerAdapter } from "./adapters/queryRunnerAdapter";
import { ContractQueryResponse } from "./networkProviders";
import { SmartContractQueriesController } from "./smartContractQueriesController";
import { SmartContractQueryResponse } from "./smartContractQuery";
import { AbiRegistry, BigUIntValue, BooleanValue, BytesValue, Tuple, U16Value, U64Value } from "./smartcontracts";
import { bigIntToBuffer } from "./smartcontracts/codec/utils";
import { MockNetworkProvider, loadAbiRegistry } from "./testutils";
import { bigIntToBuffer } from "./tokenOperations/codec";

describe("test smart contract queries controller", () => {
describe("createQuery", () => {
Expand Down
3 changes: 1 addition & 2 deletions src/smartContractQueriesController.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { ArgSerializer, ContractFunction, EndpointDefinition, isTyped, NativeSerializer, ResultsParser } from "./abi";
import { Err, ErrSmartContractQuery } from "./errors";
import { IContractQueryResponse } from "./interfaceOfNetwork";
import { SmartContractQuery, SmartContractQueryResponse } from "./smartContractQuery";
import { ArgSerializer, ContractFunction, EndpointDefinition, NativeSerializer, ResultsParser } from "./smartcontracts";
import { isTyped } from "./smartcontracts/typesystem";

interface IAbi {
getEndpoint(name: string | ContractFunction): EndpointDefinition;
Expand Down
4 changes: 1 addition & 3 deletions src/testutils/contractController.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { Interaction, ResultsParser, TypedOutcomeBundle, UntypedOutcomeBundle } from "../abi";
import { ITransactionOnNetwork } from "../interfaceOfNetwork";
import { Logger } from "../logger";
import { Interaction } from "../smartcontracts/interaction";
import { TypedOutcomeBundle, UntypedOutcomeBundle } from "../smartcontracts/interface";
import { ResultsParser } from "../smartcontracts/resultsParser";
import { Transaction } from "../transaction";
import { TransactionWatcher } from "../transactionWatcher";
import { INetworkProvider } from "./networkProviders";
Expand Down
4 changes: 2 additions & 2 deletions src/testutils/mockNetworkProvider.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ContractResultItem, ContractResults, TransactionOnNetwork, TransactionStatus } from "../networkProviders";
import { Query } from "../abi/query";
import { Address } from "../address";
import { AsyncTimer } from "../asyncTimer";
import * as errors from "../errors";
Expand All @@ -11,7 +11,7 @@ import {
ITransactionOnNetwork,
ITransactionStatus,
} from "../interfaceOfNetwork";
import { Query } from "../smartcontracts/query";
import { ContractResultItem, ContractResults, TransactionOnNetwork, TransactionStatus } from "../networkProviders";
import { Transaction, TransactionHash } from "../transaction";
import { createAccountBalance } from "./utils";

Expand Down
4 changes: 1 addition & 3 deletions src/testutils/utils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import BigNumber from "bignumber.js";
import * as fs from "fs";
import { PathLike } from "fs";
import { AbiRegistry, Code, SmartContract, TypedValue } from "../abi";
import { IChainID, IGasLimit } from "../interface";
import { Code } from "../smartcontracts/code";
import { SmartContract } from "../smartcontracts/smartContract";
import { AbiRegistry, TypedValue } from "../smartcontracts/typesystem";
import { Transaction } from "../transaction";
import { TransactionWatcher } from "../transactionWatcher";
import { getAxios } from "../utils";
Expand Down
4 changes: 2 additions & 2 deletions src/tokenOperations/codec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import BigNumber from "bignumber.js";
import * as contractsCodecUtils from "../smartcontracts/codec/utils";
import * as contractsCodecUtils from "../abi/codec/utils";
import * as codecUtils from "../utils.codec";

export function stringToBuffer(value: string): Buffer {
Expand All @@ -22,7 +22,7 @@ export function bigIntToBuffer(value: BigNumber.Value): Buffer {
return contractsCodecUtils.bigIntToBuffer(value);
}

export { utf8ToHex, bigIntToHex, addressToHex } from "../utils.codec";
export { addressToHex, bigIntToHex, utf8ToHex } from "../utils.codec";

export function bufferToHex(value: Buffer) {
const hex = value.toString("hex");
Expand Down
3 changes: 1 addition & 2 deletions src/tokenTransferBuilders.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { AddressValue, ArgSerializer, BigUIntValue, BytesValue, TypedValue, U16Value, U64Value } from "./abi";
import { Address } from "./address";
import { IAddress, ITokenTransfer } from "./interface";
import { ArgSerializer } from "./smartcontracts/argSerializer";
import { AddressValue, BigUIntValue, BytesValue, TypedValue, U16Value, U64Value } from "./smartcontracts/typesystem";
import { TokenTransfer } from "./tokens";
import { TransactionPayload } from "./transactionPayload";

Expand Down
2 changes: 1 addition & 1 deletion src/transactionsFactories/delegationTransactionsFactory.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ArgSerializer, BigUIntValue, BytesValue, StringValue } from "../abi";
import { Address } from "../address";
import { DELEGATION_MANAGER_SC_ADDRESS_HEX } from "../constants";
import { Err } from "../errors";
import { IAddress } from "../interface";
import { ArgSerializer, BigUIntValue, BytesValue, StringValue } from "../smartcontracts";
import { Transaction } from "../transaction";
import { TransactionBuilder } from "./transactionBuilder";

Expand Down
2 changes: 1 addition & 1 deletion src/transactionsFactories/relayedTransactionsFactory.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import BigNumber from "bignumber.js";
import { AddressValue, ArgSerializer, BytesValue, U64Value } from "../abi";
import { Address } from "../address";
import { ErrInvalidInnerTransaction } from "../errors";
import { IAddress, ITransaction } from "../interface";
import { AddressValue, ArgSerializer, BytesValue, U64Value } from "../smartcontracts";
import { Transaction } from "../transaction";

const JSONbig = require("json-bigint");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { assert } from "chai";
import { AbiRegistry, Code, U32Value } from "../abi";
import { Address } from "../address";
import { Err } from "../errors";
import { U32Value } from "../smartcontracts";
import { Code } from "../smartcontracts/code";
import { AbiRegistry } from "../smartcontracts/typesystem/abiRegistry";
import { loadAbiRegistry, loadContractCode } from "../testutils/utils";
import { Token, TokenTransfer } from "../tokens";
import { SmartContractTransactionsFactory } from "./smartContractTransactionsFactory";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { ArgSerializer, CodeMetadata, ContractFunction, EndpointDefinition, isTyped, NativeSerializer } from "../abi";
import { Address } from "../address";
import { CONTRACT_DEPLOY_ADDRESS_HEX, VM_TYPE_WASM_VM } from "../constants";
import { Err } from "../errors";
import { IAddress } from "../interface";
import { Logger } from "../logger";
import { ArgSerializer, CodeMetadata, ContractFunction, EndpointDefinition } from "../smartcontracts";
import { NativeSerializer } from "../smartcontracts/nativeSerializer";
import { isTyped } from "../smartcontracts/typesystem";
import { TokenComputer, TokenTransfer } from "../tokens";
import { Transaction } from "../transaction";
import { byteArrayToHex, utf8ToHex } from "../utils.codec";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { AddressValue, ArgSerializer, BigUIntValue, BytesValue, StringValue } from "../abi";
import { Address } from "../address";
import { ESDT_CONTRACT_ADDRESS_HEX } from "../constants";
import { ErrBadUsage } from "../errors";
import { IAddress } from "../interface";
import { Logger } from "../logger";
import { AddressValue, ArgSerializer, BigUIntValue, BytesValue, StringValue } from "../smartcontracts";
import { Transaction } from "../transaction";
import { TransactionBuilder } from "./transactionBuilder";

Expand Down
3 changes: 1 addition & 2 deletions src/transactionsFactories/tokenTransfersDataBuilder.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { AddressValue, ArgSerializer, BigUIntValue, TokenIdentifierValue, TypedValue, U32Value } from "../abi";
import { IAddress } from "../interface";
import { ArgSerializer } from "../smartcontracts/argSerializer";
import { AddressValue, BigUIntValue, TokenIdentifierValue, TypedValue, U32Value } from "../smartcontracts/typesystem";
import { TokenComputer, TokenTransfer } from "../tokens";

export class TokenTransfersDataBuilder {
Expand Down
10 changes: 1 addition & 9 deletions src/transactionsFactories/transferTransactionsFactory.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { AddressValue, ArgSerializer, BigUIntValue, BytesValue, TypedValue, U16Value, U64Value } from "../abi";
import { EGLD_IDENTIFIER_FOR_MULTI_ESDTNFT_TRANSFER } from "../constants";
import { Err, ErrBadUsage } from "../errors";
import {
Expand All @@ -10,15 +11,6 @@ import {
ITransactionPayload,
ITransactionValue,
} from "../interface";
import {
AddressValue,
ArgSerializer,
BigUIntValue,
BytesValue,
TypedValue,
U16Value,
U64Value,
} from "../smartcontracts";
import { TokenComputer, TokenTransfer } from "../tokens";
import { Transaction } from "../transaction";
import { TransactionPayload } from "../transactionPayload";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import { ArgSerializer, EndpointDefinition, ResultsParser, ReturnCode, Type, UntypedOutcomeBundle } from "../abi";
import { Address } from "../address";
import { ARGUMENTS_SEPARATOR } from "../constants";
import { Err } from "../errors";
import { IContractResultItem, ITransactionEvent, ITransactionOnNetwork } from "../interfaceOfNetwork";
import {
ArgSerializer,
EndpointDefinition,
ResultsParser,
ReturnCode,
Type,
UntypedOutcomeBundle,
} from "../smartcontracts";
import { SmartContractCallOutcome, TransactionOutcome, findEventsByIdentifier } from "./resources";

enum Events {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { bufferToBigInt } from "../abi/codec/utils";
import { Address } from "../address";
import { TransactionsConverter } from "../converters/transactionsConverter";
import { ErrParseTransactionOutcome } from "../errors";
import { ITransactionOnNetwork } from "../interfaceOfNetwork";
import { bufferToBigInt } from "../smartcontracts/codec/utils";
import { TransactionEvent, TransactionOutcome, findEventsByIdentifier } from "./resources";

export class TokenManagementTransactionsOutcomeParser {
Expand Down
10 changes: 5 additions & 5 deletions src/transactionsOutcomeParsers/transactionEventsParser.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import BigNumber from "bignumber.js";
import { assert } from "chai";
import { AbiRegistry } from "../abi";
import { Address } from "../address";
import { TransactionsConverter } from "../converters/transactionsConverter";
import {
ContractResultItem,
ContractResults,
Expand All @@ -7,11 +12,6 @@ import {
TransactionLogsOnNetwork,
TransactionOnNetwork,
} from "../networkProviders";
import BigNumber from "bignumber.js";
import { assert } from "chai";
import { Address } from "../address";
import { TransactionsConverter } from "../converters/transactionsConverter";
import { AbiRegistry } from "../smartcontracts";
import { loadAbiRegistry } from "../testutils";
import { TransactionEvent, findEventsByFirstTopic } from "./resources";
import { TransactionEventsParser } from "./transactionEventsParser";
Expand Down
3 changes: 1 addition & 2 deletions src/transactionsOutcomeParsers/transactionEventsParser.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ResultsParser } from "../smartcontracts";
import { EventDefinition } from "../smartcontracts/typesystem/event";
import { EventDefinition, ResultsParser } from "../abi";
import { TransactionEvent } from "./resources";

interface IAbi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils.codec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import BigNumber from "bignumber.js";
import * as contractsCodecUtils from "./abi/codec/utils";
import { Address } from "./address";
import { IAddress } from "./interface";
import * as contractsCodecUtils from "./smartcontracts/codec/utils";

export function numberToPaddedHex(value: bigint | number | BigNumber.Value) {
let hexableNumber: { toString(radix?: number): string };
Expand Down

0 comments on commit 404b714

Please sign in to comment.