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

[Tests] Transaction submission test suite. The initial attempt at testing all authenticators, payloads and argument types #34

Merged
merged 8 commits into from
Oct 14, 2023
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
2 changes: 1 addition & 1 deletion src/bcs/serializable/move-structs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ export class MoveObject extends Serializable implements TransactionArgument {
if (value instanceof AccountAddress) {
this.value = value;
} else {
this.value = AccountAddress.fromHexInput({ input: value });
this.value = AccountAddress.fromHexInputRelaxed({ input: value });
Copy link
Collaborator

Choose a reason for hiding this comment

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

interesting... curios why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because I was getting objects from the API, it returned it with no leading 0, meaning I needed to sanitize my input. I then realized I don't see in any case why someone wouldn't want the "relaxed" version when using it as input.

You generally would only use a MoveObject to serialize an entry function argument, so the end serialization result is the same regardless of whether or not you input a 0x0... or 0x..., so fromHexInputRelaxed makes more sense to me than having people run into errors 1/16 times because they didn't expect the address they passed in to to fail the parsing test

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this changing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would like to use relaxed if we can, I was running into a bunch of errors because of it- basically what we were talking about with daniel

I was just putting it here as a fix so I didn't have to fix every instance of an object in the test suite (I wrote it down as feedback/things to think about in the doc), but yea, the issue was I was getting errors from addresses I was getting from the API on chain

}
}

Expand Down
4 changes: 3 additions & 1 deletion src/transactions/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
TransactionPayloadScript,
} from "./instances";
import { TypeTag } from "./typeTag/typeTag";
import { MoveObject, MoveOption, MoveVector } from "../bcs/serializable/move-structs";
import { MoveObject, MoveOption, MoveString, MoveVector } from "../bcs/serializable/move-structs";
import { Bool, U128, U16, U256, U32, U64, U8 } from "../bcs/serializable/move-primitives";
import { FixedBytes } from "../bcs/serializable/fixed-bytes";

Expand All @@ -31,6 +31,7 @@ export type EntryFunctionArgumentTypes =
| MoveVector<EntryFunctionArgumentTypes>
| MoveOption<EntryFunctionArgumentTypes>
| AccountAddress
| MoveString
| FixedBytes;
export type ScriptFunctionArgumentTypes =
| Bool
Expand All @@ -44,6 +45,7 @@ export type ScriptFunctionArgumentTypes =
| MoveObject
| MoveVector<U8>
| AccountAddress
| MoveString
| FixedBytes;

/**
Expand Down
Loading
Loading