Skip to content

Commit

Permalink
Fix deps, re-export CallArgument
Browse files Browse the repository at this point in the history
  • Loading branch information
runtian-zhou committed Nov 5, 2024
1 parent 65c3d96 commit aeb56b3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
10 changes: 6 additions & 4 deletions src/api/transactionSubmission/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
import { MultiAgentTransaction } from "../../transactions/instances/multiAgentTransaction";
import { SimpleTransaction } from "../../transactions/instances/simpleTransaction";
import { AptosConfig } from "../aptosConfig";
import { singleSignerED25519 } from "../../../tests/unit/helper";
import { Deserializer } from "../../bcs";

/**
Expand Down Expand Up @@ -105,6 +104,9 @@ export class Build {
* Build a transaction from a series of Move calls.
*
* This function allows you to create a transaction with a list of Move calls.
*
* Right now we only tested this logic with single signer and we will add support
* for mutli agent transactions if needed.
*
* @param args.sender - The sender account address.
* @param args.builder - The closure to construct the list of calls.
Expand Down Expand Up @@ -156,20 +158,20 @@ export class Build {
* runExample().catch(console.error);
* ```
*/
async script_composer(args: {
async scriptComposer(args: {
sender: AccountAddressInput;
builder: (builder: AptosScriptComposer) => Promise<AptosScriptComposer>;
options?: InputGenerateTransactionOptions;
withFeePayer?: boolean;
}): Promise<SimpleTransaction> {
const builder = await args.builder(new AptosScriptComposer(this.config));
const bytes = builder.build();
const raw_txn = await generateRawTransaction({
const rawTxn = await generateRawTransaction({
aptosConfig: this.config,
payload: TransactionPayloadScript.load(new Deserializer(bytes)),
...args,
});
return new SimpleTransaction(raw_txn);
return new SimpleTransaction(rawTxn);
}

/**
Expand Down
10 changes: 5 additions & 5 deletions src/transactions/script-composer/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright © Aptos Foundation
// SPDX-License-Identifier: Apache-2.0

import { CallArgument, TransactionComposer, initSync, create_wasm } from "@wgb5445/aptos-intent-npm";
import { TransactionComposer, initSync, create_wasm } from "@wgb5445/aptos-intent-npm";
import { AptosApiType } from "../../utils";
import { AptosConfig } from "../../api";
import { AptosConfig } from "../../api/aptosConfig";
import {
EntryFunctionArgumentTypes,
FunctionABI,
Expand All @@ -12,11 +12,10 @@ import {
} from "../types";
import { convertArgument, fetchMoveFunctionAbi, getFunctionParts, standardizeTypeTags } from "../transactionBuilder";
import { TypeTag } from "../typeTag";

let wasm = null;
import { CallArgument } from "../../types";

(async () => {
wasm = initSync(await create_wasm());
initSync(await create_wasm());
})();

function convertCallArgument(
Expand Down Expand Up @@ -67,6 +66,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());
}
}
Expand Down
1 change: 1 addition & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from "./indexer";
export * from "./error";
export * from "./types";
export { CallArgument } from "@wgb5445/aptos-intent-npm"
5 changes: 3 additions & 2 deletions tests/e2e/transaction/transactionSubmission.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright © Aptos Foundation
// SPDX-License-Identifier: Apache-2.0

import { CallArgument } from "@wgb5445/aptos-intent-npm";
//import { CallArgument } from "@wgb5445/aptos-intent-npm";
import {
Account,
U64,
Expand All @@ -17,6 +17,7 @@ import {
TransactionPayloadScript,
generateRawTransaction,
SimpleTransaction,
CallArgument,
} from "../../../src";
import { MAX_U64_BIG_INT } from "../../../src/bcs/consts";
import { longTestTimeout } from "../../unit/helper";
Expand Down Expand Up @@ -90,7 +91,7 @@ describe("transaction submission", () => {
expect(response.signature?.type).toBe("single_sender");
});
test.only("with batch withdraw payload", async () => {
const transaction = await aptos.transaction.build.script_composer({
const transaction = await aptos.transaction.build.scriptComposer({
sender: singleSignerED25519SenderAccount.accountAddress,
builder: async (builder) => {
const coin = await builder.addBatchedCalls({
Expand Down

0 comments on commit aeb56b3

Please sign in to comment.