Skip to content

Commit

Permalink
Add core folder
Browse files Browse the repository at this point in the history
  • Loading branch information
danielailie committed Jan 29, 2025
1 parent 21f3f0b commit 5cc582f
Show file tree
Hide file tree
Showing 157 changed files with 371 additions and 395 deletions.
2 changes: 1 addition & 1 deletion src/abi/argSerializer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ARGUMENTS_SEPARATOR } from "../constants";
import { ARGUMENTS_SEPARATOR } from "../core/constants";
import { BinaryCodec } from "./codec";
import { Type, TypedValue, U32Type, U32Value } from "./typesystem";
import { OptionalType, OptionalValue } from "./typesystem/algebraic";
Expand Down
2 changes: 1 addition & 1 deletion src/abi/argumentErrorContext.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ErrInvalidArgument } from "../errors";
import { ErrInvalidArgument } from "../core/errors";
import { EndpointParameterDefinition, Type } from "./typesystem";

export class ArgumentErrorContext {
Expand Down
2 changes: 1 addition & 1 deletion src/abi/codec/address.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Address } from "../../address";
import { Address } from "../../core/address";
import { AddressValue } from "../typesystem";

export class AddressBinaryCodec {
Expand Down
13 changes: 8 additions & 5 deletions src/abi/codec/binary.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import BigNumber from "bignumber.js";
import { assert } from "chai";
import { Address } from "../../address";
import * as errors from "../../errors";
import { Address } from "../../core/address";
import * as errors from "../../core/errors";
import {
AddressType,
AddressValue,
Expand All @@ -13,10 +13,16 @@ import {
BigUIntValue,
BooleanType,
BooleanValue,
BytesType,
BytesValue,
EnumType,
EnumValue,
EnumVariantDefinition,
ExplicitEnumType,
ExplicitEnumValue,
ExplicitEnumVariantDefinition,
Field,
FieldDefinition,
I16Type,
I16Value,
I32Type,
Expand Down Expand Up @@ -45,9 +51,6 @@ import {
U8Type,
U8Value,
} from "../typesystem";
import { BytesType, BytesValue } from "../typesystem/bytes";
import { ExplicitEnumType, ExplicitEnumValue, ExplicitEnumVariantDefinition } from "../typesystem/explicit-enum";
import { FieldDefinition } from "../typesystem/fields";
import { BinaryCodec, BinaryCodecConstraints } from "./binary";
import { isMsbOne } from "./utils";

Expand Down
4 changes: 2 additions & 2 deletions src/abi/codec/binary.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as errors from "../../errors";
import { guardTrue } from "../../utils";
import * as errors from "../../core/errors";
import { guardTrue } from "../../core/utils";
import {
ArrayVec,
ArrayVecType,
Expand Down
2 changes: 1 addition & 1 deletion src/abi/codec/boolean.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as errors from "../../errors";
import * as errors from "../../core/errors";
import { BooleanValue } from "../typesystem";

/**
Expand Down
2 changes: 1 addition & 1 deletion src/abi/codec/option.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as errors from "../../errors";
import * as errors from "../../core/errors";
import { OptionValue, Type } from "../typesystem";
import { BinaryCodec } from "./binary";

Expand Down
2 changes: 1 addition & 1 deletion src/abi/codec/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import BigNumber from "bignumber.js";
import { numberToPaddedHex } from "../../utils.codec";
import { numberToPaddedHex } from "../../core/utils.codec";

/**
* Returns whether the most significant bit of a given byte (within a buffer) is 1.
Expand Down
2 changes: 1 addition & 1 deletion src/abi/function.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as errors from "../errors";
import * as errors from "../core/errors";

/**
* A function of a Smart Contract, as an abstraction.
Expand Down
8 changes: 4 additions & 4 deletions src/abi/interaction.local.net.spec.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import BigNumber from "bignumber.js";
import { assert } from "chai";
import { promises } from "fs";
import { Transaction } from "../core/transaction";
import { TransactionComputer } from "../core/transactionComputer";
import { TransactionsFactoryConfig } from "../core/transactionsFactoryConfig";
import { TransactionWatcher } from "../core/transactionWatcher";
import {
SmartContractController,
SmartContractTransactionsFactory,
SmartContractTransactionsOutcomeParser,
} from "../smartContracts";
import { loadAbiRegistry, loadTestWallets, prepareDeployment, TestWallet } from "../testutils";
import { createLocalnetProvider } from "../testutils/networkProviders";
import { Transaction } from "../transaction";
import { TransactionComputer } from "../transactionComputer";
import { TransactionsFactoryConfig } from "../transactionsFactoryConfig";
import { TransactionWatcher } from "../transactionWatcher";
import { Interaction } from "./interaction";
import { SmartContract } from "./smartContract";
import { ManagedDecimalValue } from "./typesystem";
Expand Down
10 changes: 5 additions & 5 deletions src/abi/interaction.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import BigNumber from "bignumber.js";
import { assert } from "chai";
import { Address } from "../address";
import { SmartContractQueryResponse } from "../smartContractQuery";
import { Address } from "../core/address";
import { SmartContractQueryResponse } from "../core/smartContractQuery";
import { Token, TokenTransfer } from "../core/tokens";
import { Transaction } from "../core/transaction";
import { TransactionComputer } from "../core/transactionComputer";
import { SmartContractController } from "../smartContracts";
import {
loadAbiRegistry,
Expand All @@ -10,9 +13,6 @@ import {
setupUnitTestWatcherTimeouts,
TestWallet,
} from "../testutils";
import { Token, TokenTransfer } from "../tokens";
import { Transaction } from "../transaction";
import { TransactionComputer } from "../transactionComputer";
import { ContractFunction } from "./function";
import { Interaction } from "./interaction";
import { SmartContract } from "./smartContract";
Expand Down
12 changes: 6 additions & 6 deletions src/abi/interaction.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Account } from "../accounts";
import { Address } from "../address";
import { Compatibility } from "../compatibility";
import { TRANSACTION_VERSION_DEFAULT } from "../constants";
import { Address } from "../core/address";
import { Compatibility } from "../core/compatibility";
import { TRANSACTION_VERSION_DEFAULT } from "../core/constants";
import { TokenTransfer } from "../core/tokens";
import { Transaction } from "../core/transaction";
import { TransactionsFactoryConfig } from "../core/transactionsFactoryConfig";
import { SmartContractTransactionsFactory } from "../smartContracts";
import { TokenTransfer } from "../tokens";
import { Transaction } from "../transaction";
import { TransactionsFactoryConfig } from "../transactionsFactoryConfig";
import { ContractFunction } from "./function";
import { CallArguments } from "./interface";
import { Query } from "./query";
Expand Down
4 changes: 2 additions & 2 deletions src/abi/interface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Address } from "../address";
import { Transaction } from "../transaction";
import { Address } from "../core/address";
import { Transaction } from "../core/transaction";
import { ReturnCode } from "./returnCode";
import { TypedValue } from "./typesystem";

Expand Down
6 changes: 3 additions & 3 deletions src/abi/nativeSerializer.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import BigNumber from "bignumber.js";
import { assert } from "chai";
import { Address } from "../address";
import { ErrInvalidArgument } from "../errors";
import { Address, ErrInvalidArgument } from "../core";
import { NativeSerializer } from "./nativeSerializer";
import {
AbiRegistry,
Expand All @@ -10,6 +9,8 @@ import {
BigUIntType,
BooleanType,
BooleanValue,
BytesType,
BytesValue,
CompositeType,
CompositeValue,
EndpointDefinition,
Expand All @@ -34,7 +35,6 @@ import {
VariadicType,
VariadicValue,
} from "./typesystem";
import { BytesType, BytesValue } from "./typesystem/bytes";

describe("test native serializer", () => {
it("should perform type inference", async () => {
Expand Down
6 changes: 3 additions & 3 deletions src/abi/nativeSerializer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable @typescript-eslint/no-namespace */
import BigNumber from "bignumber.js";
import { Address } from "../address";
import { ErrInvalidArgument } from "../errors";
import { numberToPaddedHex } from "../utils.codec";
import { Address } from "../core/address";
import { ErrInvalidArgument } from "../core/errors";
import { numberToPaddedHex } from "../core/utils.codec";
import { ArgumentErrorContext } from "./argumentErrorContext";
import {
AddressType,
Expand Down
2 changes: 1 addition & 1 deletion src/abi/query.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import BigNumber from "bignumber.js";
import { assert } from "chai";
import { Address } from "../address";
import { Address } from "../core/address";
import { ContractFunction } from "./function";
import { Query } from "./query";
import { BigUIntValue, U32Value } from "./typesystem";
Expand Down
2 changes: 1 addition & 1 deletion src/abi/query.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Address } from "../address";
import { Address } from "../core/address";
import { ArgSerializer } from "./argSerializer";
import { IContractFunction } from "./interface";
import { TypedValue } from "./typesystem";
Expand Down
8 changes: 4 additions & 4 deletions src/abi/smartContract.local.net.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { assert } from "chai";
import { promises } from "fs";
import { Logger } from "../logger";
import { Logger } from "../core/logger";
import { TransactionComputer } from "../core/transactionComputer";
import { TransactionsFactoryConfig } from "../core/transactionsFactoryConfig";
import { TransactionWatcher } from "../core/transactionWatcher";
import {
SmartContractController,
SmartContractTransactionsFactory,
Expand All @@ -9,9 +12,6 @@ import {
import { stringifyBigIntJSON } from "../testutils";
import { createLocalnetProvider } from "../testutils/networkProviders";
import { loadTestWallets, TestWallet } from "../testutils/wallets";
import { TransactionComputer } from "../transactionComputer";
import { TransactionsFactoryConfig } from "../transactionsFactoryConfig";
import { TransactionWatcher } from "../transactionWatcher";
import { decodeUnsignedNumber } from "./codec";
import { SmartContract } from "./smartContract";
import {
Expand Down
8 changes: 4 additions & 4 deletions src/abi/smartContract.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { assert } from "chai";
import { Address } from "../address";
import { Address } from "../core/address";
import { TransactionComputer } from "../core/transactionComputer";
import { TransactionStatus } from "../core/transactionStatus";
import { TransactionWatcher } from "../core/transactionWatcher";
import {
loadTestWallets,
MarkCompleted,
Expand All @@ -8,9 +11,6 @@ import {
TestWallet,
Wait,
} from "../testutils";
import { TransactionComputer } from "../transactionComputer";
import { TransactionStatus } from "../transactionStatus";
import { TransactionWatcher } from "../transactionWatcher";
import { Code } from "./code";
import { ContractFunction } from "./function";
import { SmartContract } from "./smartContract";
Expand Down
14 changes: 7 additions & 7 deletions src/abi/smartContract.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Address, AddressComputer } from "../address";
import { Compatibility } from "../compatibility";
import { TRANSACTION_MIN_GAS_PRICE } from "../constants";
import { ErrContractHasNoAddress } from "../errors";
import { Transaction } from "../transaction";
import { TransactionsFactoryConfig } from "../transactionsFactoryConfig";
import { guardValueIsSet } from "../utils";
import { Address, AddressComputer } from "../core/address";
import { Compatibility } from "../core/compatibility";
import { TRANSACTION_MIN_GAS_PRICE } from "../core/constants";
import { ErrContractHasNoAddress } from "../core/errors";
import { Transaction } from "../core/transaction";
import { TransactionsFactoryConfig } from "../core/transactionsFactoryConfig";
import { guardValueIsSet } from "../core/utils";
import { SmartContractTransactionsFactory } from "./../smartContracts/smartContractTransactionsFactory";
import { CodeMetadata } from "./codeMetadata";
import { ContractFunction } from "./function";
Expand Down
6 changes: 3 additions & 3 deletions src/abi/smartContractResults.local.net.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { assert } from "chai";
import { promises } from "fs";
import { TransactionComputer } from "../core/transactionComputer";
import { TransactionsFactoryConfig } from "../core/transactionsFactoryConfig";
import { TransactionWatcher } from "../core/transactionWatcher";
import { SmartContractTransactionsFactory, SmartContractTransactionsOutcomeParser } from "../smartContracts";
import { loadTestWallets, prepareDeployment, TestWallet } from "../testutils";
import { createLocalnetProvider } from "../testutils/networkProviders";
import { TransactionComputer } from "../transactionComputer";
import { TransactionsFactoryConfig } from "../transactionsFactoryConfig";
import { TransactionWatcher } from "../transactionWatcher";
import { ContractFunction } from "./function";
import { SmartContract } from "./smartContract";

Expand Down
4 changes: 2 additions & 2 deletions src/abi/typesystem/abiRegistry.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as errors from "../../errors";
import { guardValueIsSetWithMessage } from "../../utils";
import * as errors from "../../core/errors";
import { guardValueIsSetWithMessage } from "../../core/utils";
import { EndpointDefinition, EndpointParameterDefinition } from "./endpoint";
import { EnumType } from "./enum";
import { EventDefinition, EventTopicDefinition } from "./event";
Expand Down
2 changes: 1 addition & 1 deletion src/abi/typesystem/address.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Address } from "../../address";
import { Address } from "../../core/address";
import { PrimitiveType, PrimitiveValue } from "./types";

export class AddressType extends PrimitiveType {
Expand Down
2 changes: 1 addition & 1 deletion src/abi/typesystem/algebraic.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { guardValueIsSet } from "../../utils";
import { guardValueIsSet } from "../../core/utils";
import { NullType, Type, TypeCardinality, TypedValue } from "./types";

/**
Expand Down
2 changes: 1 addition & 1 deletion src/abi/typesystem/composite.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { guardLength } from "../../utils";
import { guardLength } from "../../core/utils";
import { Type, TypeCardinality, TypedValue } from "./types";

export class CompositeType extends Type {
Expand Down
8 changes: 4 additions & 4 deletions src/abi/typesystem/enum.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as errors from "../../errors";
import BigNumber from "bignumber.js";
import { assert } from "chai";
import { U8Type, U8Value } from "./numerical";
import { Field, FieldDefinition } from "./fields";
import * as errors from "../../core/errors";
import { EnumType, EnumValue, EnumVariantDefinition } from "./enum";
import { Field, FieldDefinition } from "./fields";
import { U8Type, U8Value } from "./numerical";
import { StringType, StringValue } from "./string";
import BigNumber from "bignumber.js";

describe("test enums", () => {
it("should get fields", () => {
Expand Down
4 changes: 2 additions & 2 deletions src/abi/typesystem/enum.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ErrMissingFieldOnEnum } from "../../errors";
import { guardTrue, guardValueIsSet } from "../../utils";
import { ErrMissingFieldOnEnum } from "../../core/errors";
import { guardTrue, guardValueIsSet } from "../../core/utils";
import { Field, FieldDefinition, Fields } from "./fields";
import { CustomType, TypedValue } from "./types";

Expand Down
2 changes: 1 addition & 1 deletion src/abi/typesystem/explicit-enum.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { guardValueIsSet } from "../../utils";
import { guardValueIsSet } from "../../core/utils";
import { CustomType, TypedValue } from "./types";

export class ExplicitEnumType extends CustomType {
Expand Down
6 changes: 3 additions & 3 deletions src/abi/typesystem/factory.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { assert } from "chai";
import { TokenIdentifierType } from "./tokenIdentifier";
import { Address } from "../../address";
import { Address } from "../../core/address";
import { AddressType } from "./address";
import { createListOfAddresses, createListOfTokenIdentifiers } from "./factory";
import { ListType } from "./generic";
import { AddressType } from "./address";
import { TokenIdentifierType } from "./tokenIdentifier";

describe("test factory", () => {
it("should create lists of addresses", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/abi/typesystem/factory.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Address } from "../../address";
import { Address } from "../../core/address";
import { AddressValue } from "./address";
import { List } from "./generic";
import { TokenIdentifierValue } from "./tokenIdentifier";
Expand Down
2 changes: 1 addition & 1 deletion src/abi/typesystem/fields.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as errors from "../../errors";
import * as errors from "../../core/errors";
import { TypeExpressionParser } from "./typeExpressionParser";
import { Type, TypedValue } from "./types";

Expand Down
4 changes: 2 additions & 2 deletions src/abi/typesystem/generic.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { guardValueIsSet } from "../../utils";
import { guardValueIsSet } from "../../core/utils";
import { CollectionOfTypedValues } from "./collections";
import { Type, TypedValue, NullType, TypePlaceholder } from "./types";
import { NullType, Type, TypedValue, TypePlaceholder } from "./types";

// TODO: Move to a new file, "genericOption.ts"
export class OptionType extends Type {
Expand Down
2 changes: 1 addition & 1 deletion src/abi/typesystem/genericArray.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { guardLength, guardTrue } from "../../utils";
import { guardLength, guardTrue } from "../../core/utils";
import { CollectionOfTypedValues } from "./collections";
import { Type, TypedValue } from "./types";

Expand Down
2 changes: 1 addition & 1 deletion src/abi/typesystem/matchers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as errors from "../../errors";
import * as errors from "../../core/errors";
import { AddressType, AddressValue } from "./address";
import { BooleanType, BooleanValue } from "./boolean";
import { BytesType, BytesValue } from "./bytes";
Expand Down
2 changes: 1 addition & 1 deletion src/abi/typesystem/numerical.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import BigNumber from "bignumber.js";
import * as errors from "../../errors";
import * as errors from "../../core/errors";
import { PrimitiveType, PrimitiveValue } from "./types";

export class NumericalType extends PrimitiveType {
Expand Down
Loading

0 comments on commit 5cc582f

Please sign in to comment.