Skip to content

Commit

Permalink
Fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
runtian-zhou committed Jan 31, 2025
1 parent 7f61c14 commit 9674c3f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 22 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
All notable changes to the Aptos TypeScript SDK will be captured in this file. This changelog is written by hand for now. It adheres to the format set out by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

# Unreleased
- [`Breaking`] Revert new `scriptComposer` api in transactionSubmission api to allow SDK callers to invoke multiple Move functions inside a same transaction and compose the calls dynamically.
- [`Breaking`] Add new new `scriptComposer` api in transactionSubmission api to allow SDK callers to invoke multiple Move functions inside a same transaction and compose the calls dynamically.

# 1.33.2 (2025-01-22)

Expand Down
2 changes: 1 addition & 1 deletion src/transactions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ export * from "./transactionBuilder";
export * from "./typeTag";
export * from "./typeTag/parser";
export * from "./types";
export * from "./script-composer";
export * from "./scriptComposer";
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ export class AptosScriptComposer {

// Load the calling type arguments into the loader.
if (input.typeArguments !== undefined) {
for (const typeTag of input.typeArguments) {
// eslint-disable-next-line no-await-in-loop
await this.builder.load_type_tag(nodeUrl, typeTag.toString());
}
await Promise.all(input.typeArguments.map((typeTag) => this.builder.load_type_tag(nodeUrl, typeTag.toString())));
}
const typeArguments = standardizeTypeTags(input.typeArguments);
const functionAbi = await fetchMoveFunctionAbi(moduleAddress, moduleName, functionName, this.config);
Expand Down
28 changes: 12 additions & 16 deletions tests/e2e/transaction/transactionSubmission.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ import {
TransactionPayloadEntryFunction,
Bool,
MoveString,
AptosScriptComposer,
TransactionPayloadScript,
generateRawTransaction,
SimpleTransaction,
CallArgument,
} from "../../../src";
import { MAX_U64_BIG_INT } from "../../../src/bcs/consts";
Expand Down Expand Up @@ -67,22 +63,22 @@ describe("transaction submission", () => {

expect(response.signature?.type).toBe("single_sender");
});
test("with batch payload", async () => {
const builder = new AptosScriptComposer(aptos.config);
await builder.init();
await builder.addBatchedCalls({
function: `${contractPublisherAccount.accountAddress}::transfer::transfer`,
functionArguments: [CallArgument.new_signer(0), 1, receiverAccounts[0].accountAddress],
});
const bytes = builder.build();
const transaction = await generateRawTransaction({
aptosConfig: aptos.config,
test("simple batch payload", async () => {

const transaction = await aptos.transaction.build.scriptComposer({
sender: singleSignerED25519SenderAccount.accountAddress,
payload: TransactionPayloadScript.load(new Deserializer(bytes)),
builder: async(builder) => {
await builder.addBatchedCalls({
function: `${contractPublisherAccount.accountAddress}::transfer::transfer`,
functionArguments: [CallArgument.new_signer(0), 1, receiverAccounts[0].accountAddress],
});
return builder;
}
});

const response = await aptos.signAndSubmitTransaction({
signer: singleSignerED25519SenderAccount,
transaction: new SimpleTransaction(transaction),
transaction,
});

await aptos.waitForTransaction({
Expand Down

0 comments on commit 9674c3f

Please sign in to comment.