npm package: @rikray1208/tempo-ts-cjs
Description: <br> <br>
Latest version: 0.11.3

<br>
<br>

<p align="center">
  <a href="https://tempo.xyz">
    <picture>
      <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/tempoxyz/.github/refs/heads/main/assets/combomark-dark.svg">
      <img alt="tempo combomark" src="https://raw.githubusercontent.com/tempoxyz/.github/refs/heads/main/assets/combomark-bright.svg" width="auto" height="120">
    </picture>
  </a>
</p>

<br>
<br>

# Tempo TS

> [!NOTE]
> This is a temporary package for TypeScript tooling for Tempo.
> It will be merged into [Wevm](https://github.com/wevm) repositories soon.

## Install

```sh
pnpm i tempo.ts
```

If you wish to use `tempo.ts/prool` for programmatic Tempo node instances, you will need
to ensure you have access to [`tempoxyz/tempo`](https://github.com/tempoxyz/tempo) and are logged into the GitHub Container Registry:

```sh
docker login ghcr.io
```

## Entrypoints

| Entrypoint       | Description                              |
| ---------------- | ---------------------------------------- |
| `tempo.ts/viem`  | Tempo extension for Viem.                |
| `tempo.ts/wagmi` | Tempo actions/hooks for Wagmi.           |

## Usage

### `tempo.ts/viem`

```ts
import { createClient, http, publicActions, walletActions } from 'viem';
import { tempo } from 'tempo.ts/chains';

const client = createClient({
  chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
  transport: http(),
})
  .extend(publicActions)
  .extend(walletActions);

const hash = await client.sendTransaction({
  calls: [
    { data: '0x...', to: '0x...' },
    { data: '0x...', to: '0x...' },
  ],
});

const transaction = await client.getTransaction({ hash });
```

### `tempo.ts/wagmi`

```ts
import { createConfig, http } from 'wagmi';
import { tempo } from 'tempo.ts/chains';
import { Actions, Hooks, KeyManager, webauthn } from 'tempo.ts/wagmi';

export const config = createConfig({
  chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
  connectors: [
    webAuthn({
      keyManager: KeyManager.localStorage(),
    })
  ],
  transports: {
    [tempo.id]: http(),
  },
});

const { receipt } = await Actions.dex.buySync(config, {
  tokenIn: '0x...',
  tokenOut: '0x...',
  amountOut: parseEther('100'),
  maxAmountIn: parseEther('150'),
});

const { data, mutate } = Hooks.dex.useBuySync();
mutate({
  tokenIn: '0x...',
  tokenOut: '0x...',
  amountOut: parseEther('100'),
  maxAmountIn: parseEther('150'),
});
```

## Contributing

Our contributor guidelines can be found in [`CONTRIBUTING.md`](https://github.com/tempoxyz/tempo-ts?tab=contributing-ov-file).

## Security

See [`SECURITY.md`](https://github.com/tempoxyz/tempo-ts?tab=security-ov-file).

## License

Licensed under either of [Apache License](./LICENSE-APACHE), Version
2.0 or [MIT License](./LICENSE-MIT) at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in these crates by you, as defined in the Apache-2.0 license,
shall be dual licensed as above, without any additional terms or conditions.