Initializes a new instance of the Aptos client with the provided configuration settings. This allows you to interact with the Aptos blockchain using the specified network and options.
The configuration settings for the Aptos client.
import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
async function runExample() {
// Create a configuration for the Aptos client
const config = new AptosConfig({
network: Network.TESTNET, // specify the network to use
nodeUrl: "https://testnet.aptos.dev" // replace with your node URL
});
// Initialize the Aptos client with the configuration
const aptos = new Aptos(config);
console.log("Aptos client initialized successfully.");
}
runExample().catch(console.error);
Send batch transactions for a single account.
This function uses a transaction worker that receives payloads to be processed and submitted to chain. Note that this process is best for submitting multiple transactions that don't rely on each other, i.e. batch funds, batch token mints, etc.
If any worker failure, the functions throws an error.
An array of transaction payloads
Optionaloptions?: Omit<InputGenerateTransactionOptions, "accountSequenceNumber">optional. Transaction generation configurations (excluding accountSequenceNumber)
The sender account to sign and submit the transaction
void. Throws if any error
Optionalcontext: anyCalls each of the listeners registered for a given event.
Return an array listing the events for which the emitter has registered listeners.
Return the number of listeners listening to a given event.
Return the listeners registered for a given event.
Optionalfn: (Optionalcontext: anyOptionalonce: booleanAdd a listener for a given event.
Optionalcontext: anyAdd a one-time listener for a given event.
Optionalcontext: anyRemove all listeners, or those of the specified event.
Optionalevent: keyof TransactionWorkerEventsRemove the listeners of a given event.
Optionalfn: (Optionalcontext: anyOptionalonce: boolean
Minimal
EventEmitterinterface that is molded against the Node.jsEventEmitterinterface.