Skip to content

Commit

Permalink
Rename SingleSignerTransaction type to SimpleTransaction (#231)
Browse files Browse the repository at this point in the history
rename SingleSignerTransaction type to SimpleTransaction
  • Loading branch information
0xmaayan authored Dec 11, 2023
1 parent 3ff8da0 commit 75526e8
Show file tree
Hide file tree
Showing 16 changed files with 79 additions and 87 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions examples/typescript/external_signing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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
Expand All @@ -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,
});

Expand Down
18 changes: 9 additions & 9 deletions src/api/ans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

/**
Expand Down Expand Up @@ -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<SingleSignerTransaction> {
}): Promise<SimpleTransaction> {
return setTargetAddress({ aptosConfig: this.config, ...args });
}

Expand Down Expand Up @@ -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<SingleSignerTransaction> {
}): Promise<SimpleTransaction> {
return setPrimaryName({ aptosConfig: this.config, ...args });
}

Expand Down Expand Up @@ -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<RegisterNameParameters, "aptosConfig">): Promise<SingleSignerTransaction> {
async registerName(args: Omit<RegisterNameParameters, "aptosConfig">): Promise<SimpleTransaction> {
return registerName({ aptosConfig: this.config, ...args });
}

Expand All @@ -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<SingleSignerTransaction> {
}): Promise<SimpleTransaction> {
return renewDomain({ aptosConfig: this.config, ...args });
}

Expand Down
6 changes: 3 additions & 3 deletions src/api/coin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -21,15 +21,15 @@ 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;
recipient: AccountAddressInput;
amount: AnyNumber;
coinType?: MoveStructId;
options?: InputGenerateTransactionOptions;
}): Promise<SingleSignerTransaction> {
}): Promise<SimpleTransaction> {
return transferCoinTransaction({ aptosConfig: this.config, ...args });
}
}
40 changes: 20 additions & 20 deletions src/api/digitalAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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: {
Expand All @@ -223,7 +223,7 @@ export class DigitalAsset {
uri: string;
options?: InputGenerateTransactionOptions;
} & CreateCollectionOptions,
): Promise<SingleSignerTransaction> {
): Promise<SimpleTransaction> {
return createCollectionTransaction({ aptosConfig: this.config, ...args });
}

Expand All @@ -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;
Expand All @@ -248,7 +248,7 @@ export class DigitalAsset {
propertyTypes?: Array<PropertyType>;
propertyValues?: Array<PropertyValue>;
options?: InputGenerateTransactionOptions;
}): Promise<SingleSignerTransaction> {
}): Promise<SimpleTransaction> {
return mintDigitalAssetTransaction({ aptosConfig: this.config, ...args });
}

Expand All @@ -263,15 +263,15 @@ 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;
digitalAssetAddress: AccountAddressInput;
recipient: AccountAddress;
digitalAssetType?: MoveStructId;
options?: InputGenerateTransactionOptions;
}): Promise<SingleSignerTransaction> {
}): Promise<SimpleTransaction> {
return transferDigitalAssetTransaction({ aptosConfig: this.config, ...args });
}

Expand All @@ -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;
Expand All @@ -301,7 +301,7 @@ export class DigitalAsset {
propertyTypes?: Array<PropertyType>;
propertyValues?: Array<PropertyValue>;
options?: InputGenerateTransactionOptions;
}): Promise<SingleSignerTransaction> {
}): Promise<SimpleTransaction> {
return mintSoulBoundTransaction({ aptosConfig: this.config, ...args });
}

Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/api/fungibleAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -134,15 +134,15 @@ 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;
fungibleAssetMetadataAddress: AccountAddress;
recipient: AccountAddress;
amount: AnyNumber;
options?: InputGenerateTransactionOptions;
}): Promise<SingleSignerTransaction> {
}): Promise<SimpleTransaction> {
return transferFungibleAsset({ aptosConfig: this.config, ...args });
}
}
6 changes: 3 additions & 3 deletions src/api/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
AnyRawTransaction,
InputGenerateTransactionOptions,
InputGenerateTransactionPayloadData,
SingleSignerTransaction,
SimpleTransaction,
} from "../transactions";
import { AccountAddressInput, Account, PrivateKey } from "../core";
import { TransactionWorker } from "../transactions/management";
Expand Down Expand Up @@ -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<HexInput>;
options?: InputGenerateTransactionOptions;
}): Promise<SingleSignerTransaction> {
}): Promise<SimpleTransaction> {
return publicPackageTransaction({ aptosConfig: this.config, ...args });
}

Expand Down
6 changes: 3 additions & 3 deletions src/api/transactionSubmission/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { generateTransaction } from "../../internal/transactionSubmission";
import {
InputGenerateTransactionPayloadData,
InputGenerateTransactionOptions,
SingleSignerTransaction,
SimpleTransaction,
MultiAgentTransaction,
} from "../../transactions";
import { AptosConfig } from "../aptosConfig";
Expand All @@ -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<SingleSignerTransaction> {
}): Promise<SimpleTransaction> {
return generateTransaction({ aptosConfig: this.config, ...args });
}

Expand Down
Loading

0 comments on commit 75526e8

Please sign in to comment.