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

Open
wants to merge 1 commit into
base: feat/next
Choose a base branch
from
Open

Add entrypoints #538

wants to merge 1 commit into from

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.

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