Skip to content
🎉 Welcome to the new Aptos Docs! Click here to submit feedback!

TypeScript SDK Example Code

For sample code which explains the core concepts of how to use the SDK, see:

Below are additional resources which may be more suited for your individual use case.

Code Snippets

The examples folder in the SDK repo has dozens of code snippets you can customize to your needs.

How to run examples

To run one of the example scripts:

Clone the aptos-ts-sdk repository

Terminal
git clone https://github.com/aptos-labs/aptos-ts-sdk.git

From the top-level of the package, install all dependencies.

Terminal
pnpm install

Build the package.

Terminal
pnpm build

Go to the folder of an example you would like to run.

Terminal
cd examples/typescript

Install local dependencies.

Terminal
pnpm install

Run the example.

Terminal
pnpm run simple_transfer

Helpful Reference Code