Skip to content
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
26 changes: 13 additions & 13 deletions src/abi/interaction.local.net.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ describe("test smart contract interactor", function () {
it("should interact with 'answer' (local testnet) using the SmartContractTransactionsFactory", async function () {
this.timeout(80000);

let abiRegistry = await loadAbiRegistry("src/testdata/answer.abi.json");
let abi = await loadAbiRegistry("src/testdata/answer.abi.json");

let network = await provider.getNetworkConfig();

const config = new TransactionsFactoryConfig({ chainID: network.chainID });
const factory = new SmartContractTransactionsFactory({
config: config,
abi: abiRegistry,
abi: abi,
});

const bytecode = await promises.readFile("src/testdata/answer.wasm");
Expand Down Expand Up @@ -62,7 +62,7 @@ describe("test smart contract interactor", function () {
const queryController = new SmartContractController({
chainID: "localnet",
networkProvider: provider,
abi: abiRegistry,
abi: abi,
});
let transactionOnNetwork = await transactionCompletionAwaiter.awaitCompleted(deployTxHash);
let response = queryController.parseDeploy(transactionOnNetwork);
Expand Down Expand Up @@ -112,12 +112,12 @@ describe("test smart contract interactor", function () {
it("should interact with 'basic-features' (local testnet)", async function () {
this.timeout(140000);

let abiRegistry = await loadAbiRegistry("src/testdata/basic-features.abi.json");
let contract = new SmartContract({ abi: abiRegistry });
let abi = await loadAbiRegistry("src/testdata/basic-features.abi.json");
let contract = new SmartContract({ abi: abi });
let controller = new SmartContractController({
chainID: "localnet",
networkProvider: provider,
abi: abiRegistry,
abi: abi,
});

let network = await provider.getNetworkConfig();
Expand Down Expand Up @@ -251,16 +251,16 @@ describe("test smart contract interactor", function () {
it("should interact with 'counter' (local testnet) using the SmartContractTransactionsFactory", async function () {
this.timeout(120000);

let abiRegistry = await loadAbiRegistry("src/testdata/counter.abi.json");
let abi = await loadAbiRegistry("src/testdata/counter.abi.json");

let network = await provider.getNetworkConfig();

const config = new TransactionsFactoryConfig({ chainID: network.chainID });
const factory = new SmartContractTransactionsFactory({
config: config,
abi: abiRegistry,
abi: abi,
});
const parser = new SmartContractTransactionsOutcomeParser({ abi: abiRegistry });
const parser = new SmartContractTransactionsOutcomeParser({ abi: abi });

const bytecode = await promises.readFile("src/testdata/counter.wasm");
alice.nonce = (await provider.getAccount(alice.address)).nonce;
Expand Down Expand Up @@ -290,7 +290,7 @@ describe("test smart contract interactor", function () {
const queryController = new SmartContractController({
chainID: "localnet",
networkProvider: provider,
abi: abiRegistry,
abi: abi,
});

let incrementTransaction = factory.createTransactionForExecute(alice.address, {
Expand Down Expand Up @@ -339,16 +339,16 @@ describe("test smart contract interactor", function () {
it("should interact with 'lottery-esdt' (local testnet) using the SmartContractTransactionsFactory", async function () {
this.timeout(140000);

let abiRegistry = await loadAbiRegistry("src/testdata/lottery-esdt.abi.json");
let parser = new SmartContractTransactionsOutcomeParser({ abi: abiRegistry });
let abi = await loadAbiRegistry("src/testdata/lottery-esdt.abi.json");
let parser = new SmartContractTransactionsOutcomeParser({ abi: abi });
alice.nonce = (await provider.getAccount(alice.address)).nonce;

let network = await provider.getNetworkConfig();

const config = new TransactionsFactoryConfig({ chainID: network.chainID });
const factory = new SmartContractTransactionsFactory({
config: config,
abi: abiRegistry,
abi: abi,
});

const bytecode = await promises.readFile("src/testdata/lottery-esdt.wasm");
Expand Down
12 changes: 6 additions & 6 deletions src/abi/interaction.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,9 @@ describe("test smart contract interactor", function () {

it("should interact with 'answer'", async function () {
this.timeout(30000);
let abiRegistry = await loadAbiRegistry("src/testdata/answer.abi.json");
let contract = new SmartContract({ address: dummyAddress, abi: abiRegistry });
let controller = new SmartContractController({ chainID: "D", networkProvider: provider, abi: abiRegistry });
let abi = await loadAbiRegistry("src/testdata/answer.abi.json");
let contract = new SmartContract({ address: dummyAddress, abi: abi });
let controller = new SmartContractController({ chainID: "D", networkProvider: provider, abi: abi });

let interaction = <Interaction>contract.methods.getUltimateAnswer().withGasLimit(543210n).withChainID("T");

Expand Down Expand Up @@ -338,9 +338,9 @@ describe("test smart contract interactor", function () {

it("should interact with 'lottery-esdt'", async function () {
this.timeout(30000);
let abiRegistry = await loadAbiRegistry("src/testdata/lottery-esdt.abi.json");
let contract = new SmartContract({ address: dummyAddress, abi: abiRegistry });
let controller = new SmartContractController({ chainID: "D", networkProvider: provider, abi: abiRegistry });
let abi = await loadAbiRegistry("src/testdata/lottery-esdt.abi.json");
let contract = new SmartContract({ address: dummyAddress, abi: abi });
let controller = new SmartContractController({ chainID: "D", networkProvider: provider, abi: abi });

let startInteraction = <Interaction>(
contract.methodsExplicit
Expand Down
32 changes: 16 additions & 16 deletions src/abi/nativeSerializer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { assert } from "chai";
import { Address, ErrInvalidArgument } from "../core";
import { NativeSerializer } from "./nativeSerializer";
import {
AbiRegistry,
Abi,
AddressType,
AddressValue,
BigUIntType,
Expand Down Expand Up @@ -172,7 +172,7 @@ describe("test native serializer", () => {
});

it("should handle optionals in a strict manner (but it does not)", async () => {
const endpoint = AbiRegistry.create({
const endpoint = Abi.create({
endpoints: [
{
name: "foo",
Expand Down Expand Up @@ -222,7 +222,7 @@ describe("test native serializer", () => {
});

it("should accept a mix between typed values and regular JavaScript objects (variadic, optionals)", async () => {
const endpoint = AbiRegistry.create({
const endpoint = Abi.create({
endpoints: [
{
name: "foo",
Expand Down Expand Up @@ -271,7 +271,7 @@ describe("test native serializer", () => {
});

it("should accept a mix between typed values and regular JavaScript objects (composite, optionals)", async () => {
const endpoint = AbiRegistry.create({
const endpoint = Abi.create({
endpoints: [
{
name: "foo",
Expand Down Expand Up @@ -331,7 +331,7 @@ describe("test native serializer", () => {
});

it("should accept a mix between typed values and regular JavaScript objects (tuples)", async () => {
const endpoint = AbiRegistry.create({
const endpoint = Abi.create({
endpoints: [
{
name: "foo",
Expand Down Expand Up @@ -404,7 +404,7 @@ describe("test native serializer", () => {
});

it("should accept managed decimals with constants and variable decimals", async () => {
const endpoint = AbiRegistry.create({
const endpoint = Abi.create({
endpoints: [
{
name: "foo",
Expand Down Expand Up @@ -445,7 +445,7 @@ describe("test native serializer", () => {
});

it("should accept no value for variadic types", async () => {
const endpoint = AbiRegistry.create({
const endpoint = Abi.create({
endpoints: [
{
name: "foo",
Expand Down Expand Up @@ -474,7 +474,7 @@ describe("test native serializer", () => {
});

it("should accept null or undefined for option types and optionals", async () => {
const endpoint = AbiRegistry.create({
const endpoint = Abi.create({
endpoints: [
{
name: "foo",
Expand Down Expand Up @@ -502,7 +502,7 @@ describe("test native serializer", () => {
});

it("should perform type inference (enums)", async () => {
const abiRegistry = AbiRegistry.create({
const abi = Abi.create({
endpoints: [
{
name: "foo",
Expand Down Expand Up @@ -573,8 +573,8 @@ describe("test native serializer", () => {
},
});

const endpoint = abiRegistry.getEndpoint("foo");
const enumType = abiRegistry.getEnum("MyEnum");
const endpoint = abi.getEndpoint("foo");
const enumType = abi.getEnum("MyEnum");

// Simple enum by discriminant
const p0 = 0;
Expand Down Expand Up @@ -604,7 +604,7 @@ describe("test native serializer", () => {
});

it("should perform type inference (explicit-enums)", async () => {
const abiRegistry = AbiRegistry.create({
const abi = Abi.create({
endpoints: [
{
name: "foo",
Expand Down Expand Up @@ -633,8 +633,8 @@ describe("test native serializer", () => {
},
});

const endpoint = abiRegistry.getEndpoint("foo");
const enumType = abiRegistry.getExplicitEnum("OperationCompletionStatus");
const endpoint = abi.getEndpoint("foo");
const enumType = abi.getExplicitEnum("OperationCompletionStatus");
const enumString = "completed";

const typedValues = NativeSerializer.nativeToTypedValues([enumString], endpoint);
Expand All @@ -644,7 +644,7 @@ describe("test native serializer", () => {
});

it("should getArgumentsCardinality", async () => {
const abi = AbiRegistry.create({
const abi = Abi.create({
endpoints: [
{
name: "a",
Expand Down Expand Up @@ -708,7 +708,7 @@ describe("test native serializer", () => {
});

it("should accept a mixed of values for boolen type", async () => {
const endpoint = AbiRegistry.create({
const endpoint = Abi.create({
endpoints: [
{
name: "foo",
Expand Down
6 changes: 3 additions & 3 deletions src/abi/smartContract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { getTestWalletsPath, MarkCompleted, MockNetworkProvider, Wait } from "..
import { Code } from "./code";
import { ContractFunction } from "./function";
import { SmartContract } from "./smartContract";
import { AbiRegistry, OptionalValue, U32Value, U8Value, VariadicValue } from "./typesystem";
import { Abi, OptionalValue, U32Value, U8Value, VariadicValue } from "./typesystem";
import { BytesValue } from "./typesystem/bytes";

describe("test contract", () => {
Expand Down Expand Up @@ -202,7 +202,7 @@ describe("test contract", () => {
// These parameters are exotic and, generally speaking, can be avoided in contracts:
// https://docs.multiversx.com/developers/data/multi-values/

const abi = AbiRegistry.create({
const abi = Abi.create({
endpoints: [
{
name: "foo",
Expand Down Expand Up @@ -271,7 +271,7 @@ describe("test contract", () => {
});

it("v13 should be stricter than v12 on variadic<type> parameters (since NativeSerializer is used under the hood)", async () => {
const abi = AbiRegistry.create({
const abi = Abi.create({
endpoints: [
{
name: "foo",
Expand Down
Loading
Loading