diff --git a/CHANGELOG.md b/CHANGELOG.md index df80aa0e3..f0f49806a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to the Aptos TypeScript SDK will be captured in this file. T - Rename custom request header to `aptos-typescript-sdk` - [`Breaking`] Rename `token` to `digitalAsset` and add digital asset built in transaction generation functions - [`Breaking`] change transaction submission builder flow namespace to be under a `transaction` namespace +- [`Breaking`] Rename `SingleSignerTransaction` type to `SimpleTransaction` ## 0.0.8 (2023-11-29) diff --git a/examples/typescript/external_signing.ts b/examples/typescript/external_signing.ts index 3bf0a01a5..e42893074 100644 --- a/examples/typescript/external_signing.ts +++ b/examples/typescript/external_signing.ts @@ -151,7 +151,7 @@ const example = async () => { if (hotBalance !== HOT_INITIAL_BALANCE) throw new Error("Hot's balance is incorrect"); // Transfer between users - const singleSignerTransaction = await aptos.transaction.build.simple({ + const simpleTransaction = await aptos.transaction.build.simple({ sender: cold.address(), data: { function: "0x1::coin::transfer", @@ -162,7 +162,7 @@ const example = async () => { // Send the transaction to external signer to sign const serializer = new Serializer(); - singleSignerTransaction.rawTransaction.serialize(serializer); + simpleTransaction.rawTransaction.serialize(serializer); const rawTransactionBytes = serializer.toUint8Array(); // We're going to pretend that the network call is just an external function call @@ -176,7 +176,7 @@ const example = async () => { // Combine the transaction and send console.log("\n=== Transfer transaction ===\n"); const committedTxn = await aptos.transaction.submit.simple({ - transaction: singleSignerTransaction, + transaction: simpleTransaction, senderAuthenticator: authenticator, }); diff --git a/src/api/ans.ts b/src/api/ans.ts index d541f611a..87803747e 100644 --- a/src/api/ans.ts +++ b/src/api/ans.ts @@ -23,7 +23,7 @@ import { GetDomainSubdomainsArgs, } from "../internal/ans"; import { GetANSNameResponse, MoveAddressType } from "../types"; -import { InputGenerateTransactionOptions, SingleSignerTransaction } from "../transactions/types"; +import { InputGenerateTransactionOptions, SimpleTransaction } from "../transactions/types"; import { AptosConfig } from "./aptosConfig"; /** @@ -98,14 +98,14 @@ export class ANS { * @param args.name - A string of the name: test.aptos.apt, test.apt, test, test.aptos, etc. * @param args.address - A AccountAddressInput of the address to set the domain or subdomain to * - * @returns SingleSignerTransaction + * @returns SimpleTransaction */ async setTargetAddress(args: { sender: Account; name: string; address: AccountAddressInput; options?: InputGenerateTransactionOptions; - }): Promise { + }): Promise { return setTargetAddress({ aptosConfig: this.config, ...args }); } @@ -141,13 +141,13 @@ export class ANS { * @param args.sender - The sender account * @param args.name - A string of the name: test, test.apt, test.aptos, test.aptos.apt, etc. * - * @returns SingleSignerTransaction + * @returns SimpleTransaction */ async setPrimaryName(args: { sender: Account; name?: string; options?: InputGenerateTransactionOptions; - }): Promise { + }): Promise { return setPrimaryName({ aptosConfig: this.config, ...args }); } @@ -184,9 +184,9 @@ export class ANS { * @param args.toAddress optional - The address to send the domain name to. If not provided, * the transaction will be sent to the router. * - * @returns SingleSignerTransaction + * @returns SimpleTransaction */ - async registerName(args: Omit): Promise { + async registerName(args: Omit): Promise { return registerName({ aptosConfig: this.config, ...args }); } @@ -205,14 +205,14 @@ export class ANS { * Subdomains cannot be renewed. * @param args.years - The number of years to renew the name. Currently only one year is permitted. * - * @returns SingleSignerTransaction + * @returns SimpleTransaction */ async renewDomain(args: { sender: Account; name: string; years?: 1; options?: InputGenerateTransactionOptions; - }): Promise { + }): Promise { return renewDomain({ aptosConfig: this.config, ...args }); } diff --git a/src/api/coin.ts b/src/api/coin.ts index 2a184aaf6..49317a4a9 100644 --- a/src/api/coin.ts +++ b/src/api/coin.ts @@ -3,7 +3,7 @@ import { Account, AccountAddressInput } from "../core"; import { transferCoinTransaction } from "../internal/coin"; -import { SingleSignerTransaction, InputGenerateTransactionOptions } from "../transactions/types"; +import { SimpleTransaction, InputGenerateTransactionOptions } from "../transactions/types"; import { AnyNumber, MoveStructId } from "../types"; import { AptosConfig } from "./aptosConfig"; @@ -21,7 +21,7 @@ export class Coin { * @param args.amount The amount to transfer * @param args.coinType optional. The coin struct type to transfer. Defaults to 0x1::aptos_coin::AptosCoin * - * @returns SingleSignerTransaction + * @returns SimpleTransaction */ async transferCoinTransaction(args: { sender: Account; @@ -29,7 +29,7 @@ export class Coin { amount: AnyNumber; coinType?: MoveStructId; options?: InputGenerateTransactionOptions; - }): Promise { + }): Promise { return transferCoinTransaction({ aptosConfig: this.config, ...args }); } } diff --git a/src/api/digitalAsset.ts b/src/api/digitalAsset.ts index df36d74aa..c225a6c86 100644 --- a/src/api/digitalAsset.ts +++ b/src/api/digitalAsset.ts @@ -15,7 +15,7 @@ import { TokenStandardArg, } from "../types"; import { Account, AccountAddress, AccountAddressInput } from "../core"; -import { InputGenerateTransactionOptions, SingleSignerTransaction } from "../transactions/types"; +import { InputGenerateTransactionOptions, SimpleTransaction } from "../transactions/types"; import { addDigitalAssetPropertyTransaction, addDigitalAssetTypedPropertyTransaction, @@ -213,7 +213,7 @@ export class DigitalAsset { * @param args.royaltyDenominator the denominator of the royalty to be paid to the creator * when a digital asset is transferred - defaults 1 * - * @returns A SingleSignerTransaction that when submitted will create the collection. + * @returns A SimpleTransaction that when submitted will create the collection. */ async createCollectionTransaction( args: { @@ -223,7 +223,7 @@ export class DigitalAsset { uri: string; options?: InputGenerateTransactionOptions; } & CreateCollectionOptions, - ): Promise { + ): Promise { return createCollectionTransaction({ aptosConfig: this.config, ...args }); } @@ -236,7 +236,7 @@ export class DigitalAsset { * @param args.name the name of the digital asset * @param args.uri the URI to additional info about the digital asset * - * @returns A SingleSignerTransaction that can be simulated or submitted to chain + * @returns A SimpleTransaction that can be simulated or submitted to chain */ async mintDigitalAssetTransaction(args: { creator: Account; @@ -248,7 +248,7 @@ export class DigitalAsset { propertyTypes?: Array; propertyValues?: Array; options?: InputGenerateTransactionOptions; - }): Promise { + }): Promise { return mintDigitalAssetTransaction({ aptosConfig: this.config, ...args }); } @@ -263,7 +263,7 @@ export class DigitalAsset { * @param args.recipient The recipient account address * @param args.digitalAssetType optional. The digital asset type, default to "0x4::token::Token" * - * @returns A SingleSignerTransaction that can be simulated or submitted to chain + * @returns A SimpleTransaction that can be simulated or submitted to chain */ async transferDigitalAssetTransaction(args: { sender: Account; @@ -271,7 +271,7 @@ export class DigitalAsset { recipient: AccountAddress; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; - }): Promise { + }): Promise { return transferDigitalAssetTransaction({ aptosConfig: this.config, ...args }); } @@ -288,7 +288,7 @@ export class DigitalAsset { * @param args.propertyTypes The type of property values * @param args.propertyValues The property values to be stored on-chain * - * @returns A SingleSignerTransaction that can be simulated or submitted to chain + * @returns A SimpleTransaction that can be simulated or submitted to chain */ async mintSoulBoundTransaction(args: { account: Account; @@ -301,7 +301,7 @@ export class DigitalAsset { propertyTypes?: Array; propertyValues?: Array; options?: InputGenerateTransactionOptions; - }): Promise { + }): Promise { return mintSoulBoundTransaction({ aptosConfig: this.config, ...args }); } @@ -311,7 +311,7 @@ export class DigitalAsset { * @param args.creator The creator account * @param args.digitalAssetAddress The digital asset address * - * @returns A SingleSignerTransaction that can be simulated or submitted to chain + * @returns A SimpleTransaction that can be simulated or submitted to chain */ async burnDigitalAssetTransaction(args: { creator: Account; @@ -328,7 +328,7 @@ export class DigitalAsset { * @param args.creator The creator account * @param args.digitalAssetAddress The digital asset address * - * @returns A SingleSignerTransaction that can be simulated or submitted to chain + * @returns A SimpleTransaction that can be simulated or submitted to chain */ async freezeDigitalAssetTransaferTransaction(args: { creator: Account; @@ -345,7 +345,7 @@ export class DigitalAsset { * @param args.creator The creator account * @param args.digitalAssetAddress The digital asset address * - * @returns A SingleSignerTransaction that can be simulated or submitted to chain + * @returns A SimpleTransaction that can be simulated or submitted to chain */ async unfreezeDigitalAssetTransaferTransaction(args: { creator: Account; @@ -363,7 +363,7 @@ export class DigitalAsset { * @param args.description The digital asset description * @param args.digitalAssetAddress The digital asset address * - * @returns A SingleSignerTransaction that can be simulated or submitted to chain + * @returns A SimpleTransaction that can be simulated or submitted to chain */ async setDigitalAssetDescriptionTransaction(args: { creator: Account; @@ -382,7 +382,7 @@ export class DigitalAsset { * @param args.name The digital asset name * @param args.digitalAssetAddress The digital asset address * - * @returns A SingleSignerTransaction that can be simulated or submitted to chain + * @returns A SimpleTransaction that can be simulated or submitted to chain */ async setDigitalAssetNameTransaction(args: { creator: Account; @@ -401,7 +401,7 @@ export class DigitalAsset { * @param args.uri The digital asset uri * @param args.digitalAssetAddress The digital asset address * - * @returns A SingleSignerTransaction that can be simulated or submitted to chain + * @returns A SimpleTransaction that can be simulated or submitted to chain */ async setDigitalAssetURITransaction(args: { creator: Account; @@ -422,7 +422,7 @@ export class DigitalAsset { * @param args.propertyType The type of property value * @param args.propertyValue The property value to be stored on-chain * - * @returns A SingleSignerTransaction that can be simulated or submitted to chain + * @returns A SimpleTransaction that can be simulated or submitted to chain */ async addDigitalAssetPropertyTransaction(args: { creator: Account; @@ -445,7 +445,7 @@ export class DigitalAsset { * @param args.propertyType The type of property value * @param args.propertyValue The property value to be stored on-chain * - * @returns A SingleSignerTransaction that can be simulated or submitted to chain + * @returns A SimpleTransaction that can be simulated or submitted to chain */ async removeDigitalAssetPropertyTransaction(args: { creator: Account; @@ -468,7 +468,7 @@ export class DigitalAsset { * @param args.propertyType The type of property value * @param args.propertyValue The property value to be stored on-chain * - * @returns A SingleSignerTransaction that can be simulated or submitted to chain + * @returns A SimpleTransaction that can be simulated or submitted to chain */ async updateDigitalAssetPropertyTransaction(args: { creator: Account; @@ -491,7 +491,7 @@ export class DigitalAsset { * @param args.propertyType The type of property value * @param args.propertyValue The property value to be stored on-chain * - * @returns A SingleSignerTransaction that can be simulated or submitted to chain + * @returns A SimpleTransaction that can be simulated or submitted to chain */ async addDigitalAssetTypedPropertyTransaction(args: { creator: Account; @@ -514,7 +514,7 @@ export class DigitalAsset { * @param args.propertyType The type of property value * @param args.propertyValue The property value to be stored on-chain * - * @returns A SingleSignerTransaction that can be simulated or submitted to chain + * @returns A SimpleTransaction that can be simulated or submitted to chain */ async updateDigitalAssetTypedPropertyTransaction(args: { creator: Account; diff --git a/src/api/fungibleAsset.ts b/src/api/fungibleAsset.ts index 17d5d6a99..5c4db9b05 100644 --- a/src/api/fungibleAsset.ts +++ b/src/api/fungibleAsset.ts @@ -24,7 +24,7 @@ import { ProcessorType } from "../utils/const"; import { AptosConfig } from "./aptosConfig"; import { waitForIndexerOnVersion } from "./utils"; import { Account, AccountAddress } from "../core"; -import { InputGenerateTransactionOptions, SingleSignerTransaction } from "../transactions"; +import { InputGenerateTransactionOptions, SimpleTransaction } from "../transactions"; /** * A class to query all `FungibleAsset` related queries on Aptos. @@ -134,7 +134,7 @@ export class FungibleAsset { * @param recipient The recipient account address * @param amount Number of assets to transfer * - * @returns A SingleSignerTransaction that can be simulated or submitted to chain. + * @returns A SimpleTransaction that can be simulated or submitted to chain. */ async transferFungibleAsset(args: { sender: Account; @@ -142,7 +142,7 @@ export class FungibleAsset { recipient: AccountAddress; amount: AnyNumber; options?: InputGenerateTransactionOptions; - }): Promise { + }): Promise { return transferFungibleAsset({ aptosConfig: this.config, ...args }); } } diff --git a/src/api/transaction.ts b/src/api/transaction.ts index 970d1a587..4a82db440 100644 --- a/src/api/transaction.ts +++ b/src/api/transaction.ts @@ -32,7 +32,7 @@ import { AnyRawTransaction, InputGenerateTransactionOptions, InputGenerateTransactionPayloadData, - SingleSignerTransaction, + SimpleTransaction, } from "../transactions"; import { AccountAddressInput, Account, PrivateKey } from "../core"; import { TransactionWorker } from "../transactions/management"; @@ -193,14 +193,14 @@ export class Transaction { * @param args.metadataBytes The package metadata bytes * @param args.moduleBytecode An array of the bytecode of each module in the package in compiler output order * - * @returns A SingleSignerTransaction that can be simulated or submitted to chain + * @returns A SimpleTransaction that can be simulated or submitted to chain */ async publishPackageTransaction(args: { account: AccountAddressInput; metadataBytes: HexInput; moduleBytecode: Array; options?: InputGenerateTransactionOptions; - }): Promise { + }): Promise { return publicPackageTransaction({ aptosConfig: this.config, ...args }); } diff --git a/src/api/transactionSubmission/build.ts b/src/api/transactionSubmission/build.ts index c321623fe..3e806fd77 100644 --- a/src/api/transactionSubmission/build.ts +++ b/src/api/transactionSubmission/build.ts @@ -6,7 +6,7 @@ import { generateTransaction } from "../../internal/transactionSubmission"; import { InputGenerateTransactionPayloadData, InputGenerateTransactionOptions, - SingleSignerTransaction, + SimpleTransaction, MultiAgentTransaction, } from "../../transactions"; import { AptosConfig } from "../aptosConfig"; @@ -29,14 +29,14 @@ export class Build { * @param args.options optional. Optional transaction configurations * @param args.withFeePayer optional. Whether there is a fee payer for the transaction * - * @returns SingleSignerTransaction + * @returns SimpleTransaction */ async simple(args: { sender: AccountAddressInput; data: InputGenerateTransactionPayloadData; options?: InputGenerateTransactionOptions; withFeePayer?: boolean; - }): Promise { + }): Promise { return generateTransaction({ aptosConfig: this.config, ...args }); } diff --git a/src/internal/ans.ts b/src/internal/ans.ts index ddebc3de0..80fbc2b75 100644 --- a/src/internal/ans.ts +++ b/src/internal/ans.ts @@ -10,7 +10,7 @@ import { AptosConfig } from "../api/aptosConfig"; import { Account, AccountAddress, AccountAddressInput } from "../core"; -import { InputGenerateTransactionOptions, SingleSignerTransaction } from "../transactions/types"; +import { InputGenerateTransactionOptions, SimpleTransaction } from "../transactions/types"; import { GetANSNameResponse, MoveAddressType, MoveValue, OrderByArg, PaginationArgs, WhereArg } from "../types"; import { GetNamesQuery } from "../types/generated/operations"; import { GetNames } from "../types/generated/queries"; @@ -130,7 +130,7 @@ export interface RegisterNameParameters { options?: InputGenerateTransactionOptions; } -export async function registerName(args: RegisterNameParameters): Promise { +export async function registerName(args: RegisterNameParameters): Promise { const { aptosConfig, expiration, name, sender, targetAddress, toAddress, options, transferable } = args; const routerAddress = getRouterAddress(aptosConfig); const { domainName, subdomainName } = isValidANSName(name); @@ -257,7 +257,7 @@ export async function setPrimaryName(args: { sender: Account; name?: string; options?: InputGenerateTransactionOptions; -}): Promise { +}): Promise { const { aptosConfig, sender, name, options } = args; const routerAddress = getRouterAddress(aptosConfig); @@ -316,7 +316,7 @@ export async function setTargetAddress(args: { name: string; address: AccountAddressInput; options?: InputGenerateTransactionOptions; -}): Promise { +}): Promise { const { aptosConfig, sender, name, address, options } = args; const routerAddress = getRouterAddress(aptosConfig); const { domainName, subdomainName } = isValidANSName(name); @@ -533,7 +533,7 @@ export async function renewDomain(args: { name: string; years?: 1; options?: InputGenerateTransactionOptions; -}): Promise { +}): Promise { const { aptosConfig, sender, name, years = 1, options } = args; const routerAddress = getRouterAddress(aptosConfig); const renewalDuration = years * 31536000; diff --git a/src/internal/coin.ts b/src/internal/coin.ts index e00e7f770..796bb1825 100644 --- a/src/internal/coin.ts +++ b/src/internal/coin.ts @@ -1,6 +1,6 @@ import { AptosConfig } from "../api/aptosConfig"; import { Account, AccountAddressInput } from "../core"; -import { InputGenerateTransactionOptions, SingleSignerTransaction } from "../transactions/types"; +import { InputGenerateTransactionOptions, SimpleTransaction } from "../transactions/types"; import { AnyNumber, MoveStructId } from "../types"; import { APTOS_COIN } from "../utils/const"; import { generateTransaction } from "./transactionSubmission"; @@ -12,7 +12,7 @@ export async function transferCoinTransaction(args: { amount: AnyNumber; coinType?: MoveStructId; options?: InputGenerateTransactionOptions; -}): Promise { +}): Promise { const { aptosConfig, sender, recipient, amount, coinType, options } = args; const coinStructType = coinType ?? APTOS_COIN; const transaction = await generateTransaction({ diff --git a/src/internal/digitalAsset.ts b/src/internal/digitalAsset.ts index 79c155dcc..0d3de8f9e 100644 --- a/src/internal/digitalAsset.ts +++ b/src/internal/digitalAsset.ts @@ -11,7 +11,7 @@ import { AptosConfig } from "../api/aptosConfig"; import { MoveString, Bool, U64 } from "../bcs"; import { Account, AccountAddress, AccountAddressInput } from "../core"; -import { InputGenerateTransactionOptions, SingleSignerTransaction } from "../transactions/types"; +import { InputGenerateTransactionOptions, SimpleTransaction } from "../transactions/types"; import { AnyNumber, GetCollectionDataResponse, @@ -204,7 +204,7 @@ export async function createCollectionTransaction( uri: string; options?: InputGenerateTransactionOptions; } & CreateCollectionOptions, -): Promise { +): Promise { const { aptosConfig, options, creator } = args; const transaction = await generateTransaction({ aptosConfig, @@ -290,7 +290,7 @@ export async function mintDigitalAssetTransaction(args: { propertyTypes?: Array; propertyValues?: Array; options?: InputGenerateTransactionOptions; -}): Promise { +}): Promise { const { aptosConfig, options, @@ -331,7 +331,7 @@ export async function transferDigitalAssetTransaction(args: { recipient: AccountAddress; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; -}): Promise { +}): Promise { const { aptosConfig, sender, digitalAssetAddress, recipient, digitalAssetType, options } = args; const transaction = await generateTransaction({ aptosConfig, @@ -358,7 +358,7 @@ export async function mintSoulBoundTransaction(args: { propertyTypes?: Array; propertyValues?: Array; options?: InputGenerateTransactionOptions; -}): Promise { +}): Promise { const { aptosConfig, account, @@ -407,7 +407,7 @@ export async function burnDigitalAssetTransaction(args: { digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; -}): Promise { +}): Promise { const { aptosConfig, creator, digitalAssetAddress, digitalAssetType, options } = args; const transaction = await generateTransaction({ aptosConfig, @@ -428,7 +428,7 @@ export async function freezeDigitalAssetTransaferTransaction(args: { digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; -}): Promise { +}): Promise { const { aptosConfig, creator, digitalAssetAddress, digitalAssetType, options } = args; const transaction = await generateTransaction({ aptosConfig, @@ -449,7 +449,7 @@ export async function unfreezeDigitalAssetTransaferTransaction(args: { digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; -}): Promise { +}): Promise { const { aptosConfig, creator, digitalAssetAddress, digitalAssetType, options } = args; const transaction = await generateTransaction({ aptosConfig, @@ -471,7 +471,7 @@ export async function setDigitalAssetDescriptionTransaction(args: { digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; -}): Promise { +}): Promise { const { aptosConfig, creator, description, digitalAssetAddress, digitalAssetType, options } = args; const transaction = await generateTransaction({ aptosConfig, @@ -493,7 +493,7 @@ export async function setDigitalAssetNameTransaction(args: { digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; -}): Promise { +}): Promise { const { aptosConfig, creator, name, digitalAssetAddress, digitalAssetType, options } = args; const transaction = await generateTransaction({ aptosConfig, @@ -515,7 +515,7 @@ export async function setDigitalAssetURITransaction(args: { digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; -}): Promise { +}): Promise { const { aptosConfig, creator, uri, digitalAssetAddress, digitalAssetType, options } = args; const transaction = await generateTransaction({ aptosConfig, @@ -539,7 +539,7 @@ export async function addDigitalAssetPropertyTransaction(args: { digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; -}): Promise { +}): Promise { const { aptosConfig, creator, @@ -575,7 +575,7 @@ export async function removeDigitalAssetPropertyTransaction(args: { digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; -}): Promise { +}): Promise { const { aptosConfig, creator, propertyKey, digitalAssetAddress, digitalAssetType, options } = args; const transaction = await generateTransaction({ aptosConfig, @@ -599,7 +599,7 @@ export async function updateDigitalAssetPropertyTransaction(args: { digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; -}): Promise { +}): Promise { const { aptosConfig, creator, @@ -637,7 +637,7 @@ export async function addDigitalAssetTypedPropertyTransaction(args: { digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; -}): Promise { +}): Promise { const { aptosConfig, creator, @@ -670,7 +670,7 @@ export async function updateDigitalAssetTypedPropertyTransaction(args: { digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; -}): Promise { +}): Promise { const { aptosConfig, creator, diff --git a/src/internal/fungibleAsset.ts b/src/internal/fungibleAsset.ts index c028620b4..90465affe 100644 --- a/src/internal/fungibleAsset.ts +++ b/src/internal/fungibleAsset.ts @@ -34,7 +34,7 @@ import { FungibleAssetMetadataBoolExp, } from "../types/generated/types"; import { Account, AccountAddress } from "../core"; -import { InputGenerateTransactionOptions, SingleSignerTransaction } from "../transactions"; +import { InputGenerateTransactionOptions, SimpleTransaction } from "../transactions"; import { generateTransaction } from "./transactionSubmission"; export async function getFungibleAssetMetadata(args: { @@ -116,7 +116,7 @@ export async function transferFungibleAsset(args: { recipient: AccountAddress; amount: AnyNumber; options?: InputGenerateTransactionOptions; -}): Promise { +}): Promise { const { aptosConfig, sender, fungibleAssetMetadataAddress, recipient, amount, options } = args; const transaction = await generateTransaction({ aptosConfig, diff --git a/src/internal/transactionSubmission.ts b/src/internal/transactionSubmission.ts index aff9ed37d..c73ab7830 100644 --- a/src/internal/transactionSubmission.ts +++ b/src/internal/transactionSubmission.ts @@ -26,7 +26,7 @@ import { AnyRawTransaction, InputSimulateTransactionData, InputGenerateTransactionOptions, - SingleSignerTransaction, + SimpleTransaction, InputGenerateTransactionPayloadDataWithRemoteABI, InputSubmitTransactionData, InputGenerateMultiAgentRawTransactionData, @@ -45,7 +45,7 @@ import { UserTransactionResponse, PendingTransactionResponse, MimeType, HexInput */ export async function generateTransaction( args: { aptosConfig: AptosConfig } & InputGenerateSingleSignerRawTransactionData, -): Promise; +): Promise; export async function generateTransaction( args: { aptosConfig: AptosConfig } & InputGenerateMultiAgentRawTransactionData, ): Promise; @@ -287,7 +287,7 @@ export async function publicPackageTransaction(args: { metadataBytes: HexInput; moduleBytecode: Array; options?: InputGenerateTransactionOptions; -}): Promise { +}): Promise { const { aptosConfig, account, metadataBytes, moduleBytecode, options } = args; const totalByteCode = moduleBytecode.map((bytecode) => MoveVector.U8(bytecode)); diff --git a/src/transactions/management/transactionWorker.ts b/src/transactions/management/transactionWorker.ts index 9c1e7a9eb..ffec56379 100644 --- a/src/transactions/management/transactionWorker.ts +++ b/src/transactions/management/transactionWorker.ts @@ -18,11 +18,7 @@ import { Account } from "../../core"; import { waitForTransaction } from "../../internal/transaction"; import { generateTransaction, signAndSubmitTransaction } from "../../internal/transactionSubmission"; import { PendingTransactionResponse, TransactionResponse } from "../../types"; -import { - InputGenerateTransactionOptions, - InputGenerateTransactionPayloadData, - SingleSignerTransaction, -} from "../types"; +import { InputGenerateTransactionOptions, InputGenerateTransactionPayloadData, SimpleTransaction } from "../types"; import { AccountSequenceNumber } from "./accountSequenceNumber"; import { AsyncQueue, AsyncQueueCancelledError } from "./asyncQueue"; @@ -219,10 +215,7 @@ export class TransactionWorker { * @param sequenceNumber a sequence number the transaction will be generated with * @returns */ - async generateNextTransaction( - account: Account, - sequenceNumber: bigint, - ): Promise { + async generateNextTransaction(account: Account, sequenceNumber: bigint): Promise { if (this.transactionsQueue.isEmpty()) return undefined; const [transactionData, options] = await this.transactionsQueue.dequeue(); const transaction = await generateTransaction({ diff --git a/src/transactions/transactionBuilder/transactionBuilder.ts b/src/transactions/transactionBuilder/transactionBuilder.ts index da96182c9..31dd8044e 100644 --- a/src/transactions/transactionBuilder/transactionBuilder.ts +++ b/src/transactions/transactionBuilder/transactionBuilder.ts @@ -59,7 +59,7 @@ import { InputGenerateMultiAgentRawTransactionArgs, InputGenerateRawTransactionArgs, InputGenerateSingleSignerRawTransactionArgs, - SingleSignerTransaction, + SimpleTransaction, InputGenerateTransactionOptions, MultiAgentTransaction, InputScriptData, @@ -245,9 +245,7 @@ export async function generateRawTransaction(args: { * When we call our `generateTransaction` function with the relevant type properties, * Typescript can infer the return type based on the appropriate function overload. */ -export async function buildTransaction( - args: InputGenerateSingleSignerRawTransactionArgs, -): Promise; +export async function buildTransaction(args: InputGenerateSingleSignerRawTransactionArgs): Promise; export async function buildTransaction(args: InputGenerateMultiAgentRawTransactionArgs): Promise; /** diff --git a/src/transactions/types.ts b/src/transactions/types.ts index e45a9f3e8..e284663a1 100644 --- a/src/transactions/types.ts +++ b/src/transactions/types.ts @@ -181,7 +181,7 @@ export type InputGenerateRawTransactionArgs = * * @param rawTransaction a bcs serialized raw transaction */ -export interface SingleSignerTransaction { +export interface SimpleTransaction { rawTransaction: RawTransaction; feePayerAddress?: AccountAddress; secondarySignerAddresses?: undefined; @@ -202,7 +202,7 @@ export interface MultiAgentTransaction { /** * Unified type that holds all the return interfaces when generating different transaction types */ -export type AnyRawTransaction = SingleSignerTransaction | MultiAgentTransaction; +export type AnyRawTransaction = SimpleTransaction | MultiAgentTransaction; // TRANSACTION SIMULATION TYPES //