> For the complete documentation index, see [llms.txt](https://docs.endless.link/endless/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.endless.link/endless/devbuild/build/endless-sdks/typescript-sdk.md).

# TypeScript SDK

## Endless TypeScript SDK <a href="#endless-typescript-sdk" id="endless-typescript-sdk"></a>

### Overview <a href="#overview" id="overview"></a>

Endless provides a fully supported TypeScript SDK with the source code in the [endless-ts sdk Github](https://github.com/endless-labs/endless-ts-sdk) repository. The Endless TypeScript SDK provides a convenient way to interact with the Endless blockchain using TypeScript. It offers a set of utility functions, classes, and types to simplify the integration process and enhance developer productivity.

* **Developer experience** Strongly typed APIs and Interfaces, autocomplete, comprehensive documentation.
* **Stability** Test suite runs against Endless fullnode and indexer with a local network
* **Transaction Builder** Intuitive and simplified transaction builder flow
* **Serialization/deserialization support** Full nested serialization/deserialization support and Move sub-classes to easily serialize and deserialize Move types

#### Installation <a href="#installation" id="installation"></a>

```shell
 pnpm i @endlesslab/endless-ts-sdk
```

```shell
 npm i @endlesslab/endless-ts-sdk
```

```shell
 yarn add @endlesslab/endless-ts-sdk
```

### Quick Start <a href="#quick-start" id="quick-start"></a>

**Set up** Endless

```js
import { Account, AccountAddress, Endless, EndlessConfig, Network } from "@endlesslab/endless-ts-sdk";

const endless = new Endless(); // default to devnet

// with custom configuration
const endlessConfig = new EndlessConfig({ network: Network.TESTNET });
const endless = new Endless(endlessConfig);
```

**Generate new Account**

```js
const alice = Account.generate();
const bob = Account.generate();
```

**Faucet Alice**

```js
const fund_tx = await endless.fundAccount({ signer: alice });
await endless.waitForTransaction({ transactionHash: fund_tx.hash });
```

**Fetch balance from chain**

```js
const balance = await endless.viewEDSBalance(alice.accountAddress);
console.log("alice balance:", balance);
```

**Transfer EDS coin transaction**

```js
const transaction = await endless.transferEDS({
  sender: alice,
  recipient: bob.accountAddress,
  amount: 1000000,
});
const pendingTransaction = await endless.signAndSubmitTransaction({
  signer: alice,
  transaction,
});
```

**Build and submit transaction**

```js
const transaction = await endless.transaction.build.simple({
  sender: alice.accountAddress,
  data: {
    function: "0x1::endless_account::transfer",
    typeArguments: [],
    functionArguments: [bob.accountAddress, 100],
  },
});

// using sign and submit separately
const senderAuthenticator = endless.transaction.sign({
  signer: alice,
  transaction,
});
const pendingTransaction = await endless.transaction.submit.simple({
  transaction,
  senderAuthenticator,
});

// using signAndSubmit combined
const pendingTransaction = await endless.signAndSubmitTransaction({
  signer: alice,
  transaction,
});
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.endless.link/endless/devbuild/build/endless-sdks/typescript-sdk.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
