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 internal transaction submission file #11

Merged
merged 2 commits into from
Oct 11, 2023
Merged

Add internal transaction submission file #11

merged 2 commits into from
Oct 11, 2023

Conversation

0xmaayan
Copy link
Collaborator

@0xmaayan 0xmaayan commented Oct 11, 2023

Description

Just realized that previous PR was not completely full as we need to have those pure functions internally that handles the logic.
This PR conforms to the sdk design in a way that everything in api/ folder is a user facing interface functions and those in internal/ folder are responsible on the actual logic.
more info https://github.com/aptos-labs/aptos-ts-sdk/pull/11/files#diff-a5a44d0986e0254ae62cd623aeaac609a288c9b2eabe5c741fd5b4a4f350a3ddR2

Test Plan

pnpm jest

@0xmaayan 0xmaayan requested a review from a team as a code owner October 11, 2023 02:37
Copy link
Contributor

@heliuchuan heliuchuan left a comment

Choose a reason for hiding this comment

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

We should remove the dupe func docs in internal and have /api be source of truth?

export async function generateTransaction(args: GenerateFeePayerRawTransactionArgs): Promise<FeePayerTransaction>;
export async function generateTransaction(args: GenerateMultiAgentRawTransactionArgs): Promise<MultiAgentTransaction>;
export async function generateTransaction(args: GenerateRawTransactionArgs): Promise<AnyRawTransaction>;
export async function buildTransaction(args: GenerateSingleSignerRawTransactionArgs): Promise<SingleSignerTransaction>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Much better name!

@@ -180,12 +185,10 @@ export async function generateRawTransaction(args: {
* When we call our `generateTransaction` function with the relevant type properties,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* When we call our `generateTransaction` function with the relevant type properties,
* When we call our `buildTransaction` function with the relevant type properties,

Copy link
Contributor

@xbtmatt xbtmatt left a comment

Choose a reason for hiding this comment

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

Agree with @heliuchuan on consolidating the docs to one section although we can do it later and I think you have a better idea of the intended structure here

lgtm, buildTransaction is definitely a much better name!

Copy link
Collaborator

@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 fix the E2E transaction submission test I had to disable?

Comment on lines +62 to +67
export async function generateTransaction(
args: { aptosConfig: AptosConfig } & GenerateTransactionInput,
): Promise<AnyRawTransaction> {
const { aptosConfig, sender, data, options, secondarySignerAddresses, feePayerAddress } = args;
const payload = await generateTransactionPayload(data);
const rawTransaction = await buildTransaction({
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is different than buildTransaction, or should it also be named buildTransaction?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is different. buildTransaction is a transaction_builder function, generateTransaction is a transaction_submission function

@0xmaayan
Copy link
Collaborator Author

Can we fix the E2E transaction submission test I had to disable?

the whole e2e transaction submission tests will get changed

@0xmaayan 0xmaayan merged commit 335a60f into main Oct 11, 2023
5 checks passed
@0xmaayan 0xmaayan deleted the fix_ts_flow branch October 11, 2023 16:01
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