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

[Rename] Change arguments in the transaction builder to functionArguments, change references in docs #105

Merged
merged 4 commits into from
Oct 23, 2023

Conversation

xbtmatt
Copy link
Contributor

@xbtmatt xbtmatt commented Oct 20, 2023

Description

Because arguments is a reserved keyword in typescript, when you try to use the spread operator with it in strict mode, it doesn't let you.

For example:

const transactionBuilder = async(args: {
    aptos: Aptos,
    sender: Account,
    moduleFunction: string,
    arguments: Array<EntryFunctionArgumentTypes>,
    typeArguments?: TypeTag[],
}): Promise<UserTransactionResponse> => {
    const { aptos, sender, moduleFunction, arguments, typeArguments } = args;
    // ..

The compiler won't let you destructure args because arguments is reserved. You could of course do arguments: functionArguments, but perhaps we should just avoid the reserved keyword entirely to avoid issues

I've also changed each instance of type_arguments in the docs to typeArguments

I also made sure not to change arguments to functionArguments in API calls where the JSON structure is required

Test Plan

pnpm jest

@xbtmatt xbtmatt marked this pull request as ready for review October 20, 2023 06:53
Copy link
Contributor

@gregnazario gregnazario left a comment

Choose a reason for hiding this comment

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

Can we add a CHANGELOG?

Copy link
Contributor

@0xmigo 0xmigo left a comment

Choose a reason for hiding this comment

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

LGTM

@xbtmatt xbtmatt merged commit ddbd8b1 into main Oct 23, 2023
4 checks passed
@xbtmatt xbtmatt deleted the rename-arguments branch October 23, 2023 18: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.

3 participants