open-index/open-npm huggingface dataset:
npm package: @pintswap-v3/universal-router-sdk
Description: 🛠 An SDK for building applications on top of Pinkswap.
Latest version: 1.0.32

# universal-router-sdk
This SDK facilitates interactions with Universal Router. This repo is the pinkswap variation of the original Universal-router-sdk by UniswapLabs. The PinkSwap implementation makes the necessary changes in order to be compatible with the Pinkswap smart-router and other existing SDK's.

## Usage
Install latest version of universal-router-sdk. Then import the corresponding Trade class and Data object for each protocol you'd like to interact with.

```sh
npm add @pintswap-v3/universal-router-sdk
# or
yarn add @pintswap-v3/universal-router-sdk
# or
pnpm add @pintswap-v3/universal-router-sdk
```
npm package: @pintswap3/multicall
Description: Enhanced multicall sdk to safely make multicalls within the gas limit.
Latest version: 3.5.8

# Pink Multicall

Enhanced multicall sdk to safely make multicalls within the gas limit.

Inspired by the [1inch multicall](https://github.com/1inch/multicall).

## Install

```bash
$ pnpm add @pintswap3/multicall @pintswap3/sdk viem
```

## Usage

### Basic usage

By default the calls will be splitted into chunks based on gas limit of each call and the rpc call gas limit of the chain

```typescript
import { ChainId } from '@pintswap3/chains'
import { multicallByGasLimit, MulticallRequestWithGas } from '@pintswap3/multicall'

const calls: MulticallRequestWithGas[] = [
  {
    // Target contract to call
    target: '0x',
    // Encoded call data
    callData: '',
    // The maximum gas limit set to this single call
    gasLimit: 1_000_000,
  },
]

const { results, blockNumber } = await multicallByGasLimit(calls, {
  chainId: ChainId.BSC,

  // Rpc client. Please refer to `PublicClient` from viem
  client,
})

for (const { success, result, gasUsed } of results) {
  if (success) {
    // Decode result
    decodeResult(result)
  }
}
```

### Advanced usage

The rpc call gas limit can be overriden if provided. Once provided, the multicall sdk won't ask for the gas limit from on chain.

```typescript
const { results, blockNumber } = await multicallByGasLimit(calls, {
  chainId: ChainId.BSC,
  client,
  gasLimit: 150_000_000,
})
```

## Other utilities

### Get multicall gas limit

```typescript
import { ChainId } from '@pintswap3/chains'
import { getGasLimitOnChain } from '@pintswap3/multicall'

// Get the rpc call gas limit of the specified chain
const gasLimit = await getGasLimitOnChain(ChainId.BSC)
```

## Supported chains

For supported chains and contract addresses, please refer to [multicall contracts](https://github.com/pintswap/pint-frontend/blob/develop/packages/multicall/src/constants/contracts.ts).