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

Add entrypoints #538

Merged
merged 3 commits into from
Nov 19, 2024
Merged

Add entrypoints #538

merged 3 commits into from
Nov 19, 2024

Conversation

danielailie
Copy link
Contributor

No description provided.

@danielailie danielailie self-assigned this Nov 18, 2024
chainId = "1";
}

export class LocalnetEntrypointConfig implements EntrypointConfig {
Copy link
Contributor

Choose a reason for hiding this comment

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

🚀

private networkProvider: ApiNetworkProvider | ProxyNetworkProvider;
private chainId: string;

constructor(networkProviderUrl: string, networkProviderKind: string, chainId: string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe using the "options" pattern? 💭

return verifier.verify(txComputer.computeBytesForVerifying(transaction), transaction.signature);
}

async signMessage(message: Message, account: IAccount): Promise<void> {
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 they will be soon moved to account: multiversx/mx-sdk-specs#94

chainId: string;
}

export class TestnetEntrypointConfig implements EntrypointConfig {
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 it would be easier to have constructors on these classes in case somebody wants to change one of the fields (e.g. networkProviderUrl) without having to access the fields after the initialization.

this.timeout(30000);
const abi = await loadAbiRegistry("src/testdata/adder.abi.json");
const sender = Account.newFromPem(alicePem.pemFileText);
const accountAddress = new Address(sender.address.bech32());
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 there's no need to convert the address to bech32 then back to Address. Can simply be sender.address.


const transaction = await controller.createTransactionForDeploy(
sender,
BigInt(sender.getNonceThenIncrement().valueOf()),
Copy link
Contributor

Choose a reason for hiding this comment

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

we should switch to bigint for the nonce instead of INonce. valueOf also returns a number which can lead to errors in the future. can be done in the next PR.

},
);

assert.equal((await relayedTransaction).chainID, "D");
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe also assert on the data and gasLimit fields.

andreibancioiu
andreibancioiu previously approved these changes Nov 19, 2024
assert.equal((await relayedTransaction).chainID, "D");
assert.equal(relayedTransaction.chainID, "D");
assert.deepEqual(transaction.data, Buffer.from("hello"));
assert.equal(relayedTransaction.gasLimit, 0n);
Copy link
Contributor

Choose a reason for hiding this comment

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

The gasLimit of the relayed transaction should not be 0, the issue is here.
And I meant to assert on the data field of the relayed transaction.

@danielailie danielailie merged commit f377ac6 into feat/next Nov 19, 2024
4 checks passed
@danielailie danielailie deleted the TOOL-366-add-entrypoints branch November 19, 2024 09:07
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.

3 participants