Skip to content

Conversation

@danielailie
Copy link
Contributor

No description provided.

@danielailie danielailie self-assigned this Jan 15, 2025
});

it("counter: should deploy, then simulate transactions using SmartContractTransactionsFactory", async function () {
it.only("counter: should deploy, then simulate transactions using SmartContractTransactionsFactory", async function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop only.

import { TransactionStatus } from "../transactionStatus";
import { ApiNetworkProvider } from "./apiNetworkProvider";

describe.only("ApiNetworkProvider Tests", function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should drop only.


it("should simulate transactions", async function () {
this.timeout(20000);
const JSONbig = require("json-bigint")({ constructorAction: "ignore" });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe have the import and a wrapper over jsonBig.parse() within test utils?

}

static fromSimulateResponse(originalTx: Transaction, response: any): TransactionOnNetwork {
console.log(response);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logging artifact.

throw new ErrMock("Transaction not found");
}

async getTransactionStatus(txHash: string): Promise<TransactionStatus> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completely removed? Maybe we should still keep it & add it in the specs?

https://github.com/multiversx/mx-sdk-specs/blob/main/network-providers/interface.md

import { TransactionStatus } from "../transactionStatus";
import { ProxyNetworkProvider } from "./proxyNetworkProvider";

describe.only("ProxyNetworkProvider Tests", function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only should be removed.

}

static fromHttpResponse(payload: any): AccountStorage {
let result = new AccountStorage();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can also be const.

* Fetches a block by nonce or by hash.
*/
getNetworkStakeStatistics(): Promise<NetworkStake>;
getBlock(blockArgs: GetBlockArguments): Promise<BlockOnNetwork>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is removed from the interface in sdk-py, and implemented differently in API provider and proxy provider. How should we proceed?

}
}

export class GetBlockArguments {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is removed from sdk-py. Does it make sense to drop it here, as well, and also in specs?

* The gas required by the Network to process a byte of the transaction data.
*/
public GasPerDataByte: number;
public GasPerDataByte: bigint;
Copy link
Contributor

@andreibancioiu andreibancioiu Jan 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These use a different capitalization. Maybe rename them for consistency (even if that leads to a small breaking change)?

andreibancioiu
andreibancioiu previously approved these changes Jan 21, 2025
const response = await this.doPostGeneric(url, transaction);
const data = response["data"] ?? {};
return TransactionOnNetwork.fromSimulateResponse(transaction, data["result"] ?? {});
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add empty line

});
return await awaiter.awaitOnCondition(transactionHash, condition);
}
async awaitTransactionCompleted(transactionHash: string, options?: AwaitingOptions): Promise<TransactionOnNetwork> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add empty line

Comment on lines 181 to 183
async getGuardianData(address: Address): Promise<GuardianData> {
return await this.backingProxyNetworkProvider.getGuardianData(address);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not in the specs, right?

Comment on lines 215 to 224
async getMexPairs(pagination?: IPagination): Promise<PairOnNetwork[]> {
let url = `mex/pairs`;
if (pagination) {
url = `${url}?from=${pagination.from}&size=${pagination.size}`;
}

const response: any[] = await this.doGetGeneric(url);

return response.map((item) => PairOnNetwork.fromApiHttpResponse(item));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is very old and unused I'd say :)

const deployTxHash = await provider.sendTransaction(deployTransaction);
const callTxHash = await provider.sendTransaction(smartContractCallTransaction);

console.log({ deployTxHash, callTxHash });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be removed

export class BlockCoordinates {
nonce: bigint = 0n;
hash: string = "";
rootHash?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this optional?

address: Address = Address.empty();
key: string = "";
value: string = "";
constructor(init?: Partial<AccountStorageEntry>) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add empty line

patienceInMilliseconds: number = DEFAULT_ACCOUNT_AWAITING_PATIENCE_IN_MILLISECONDS;
}

export class TransactionCostEstimationResponse {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is called TransactionCostResponse in the specs.

token: Token = new Token({ identifier: "" });
amount: bigint = 0n;
block_coordinates?: BlockCoordinates;
constructor(init?: Partial<TokenAmountOnNetwork>) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add empty line.

export function importJsonBig(value: string): string {
return Buffer.from(value, "base64").toString("hex");
}
export const stringifyBigIntJSON = (jsonString: any): any => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add empty line

@danielailie danielailie merged commit 628d09b into feat/next Jan 21, 2025
4 checks passed
@danielailie danielailie deleted the TOOL-411-synchronize-network-providers branch January 21, 2025 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants