open-index/open-npm huggingface dataset:
npm package: @magmalabs/spreadsheet
Description: A spreadsheet view_component for your Rails app
Latest version: 1.0.0-alpha

# Spreadsheet
A spreadsheet view_component for your Rails app

## Installation
Add this line to your application's Gemfile:

```ruby
gem 'spreadsheet', github: 'magma-labs/spreadsheet'
```

And then execute:
```bash
$ bundle
```

Or install it yourself as:
```bash
$ gem install spreadsheet
```

Then run the installation task
```bash
$ rake spreadsheet:install
```

> **_NOTE:_** Spreadsheet's ViewComponents use [shoelace](https://shoelace.style/) and [tailwind](https://tailwindcss.com/) in templates,
but for now these packages aren't included with the installation task so you will
need to install manually

## Usage

After install you can use Spreadsheet's ViewComponents in your templates

```haml
  = render Spreadsheet::Cell.new(id: 'cell-id', value: 'A Spreadsheet Cell')
```

Most components accept the following options:
- `classnames`: For agregate css classes to use with your component
- `colspan`: For define colspan to be applied in a component
- `component_controller`: For use a custom stimulus controller with a component
- `extra_data`: For extend default dataset added in the component template

## Development

### Setup project locally
In development, when editing js files you will need to [link your local repository](https://classic.yarnpkg.com/en/docs/cli/link/)
and run [webpack-dev-server script from `webpacker`](https://github.com/rails/webpacker#development) in your rails application

In brief, the process is 2 steps:
* Run `yarn link` in this directory.
* Run `yarn link "spreadsheet"` in the project that has the dependency.

## Contributing
Bug reports and pull requests are welcome on GitHub at [https://github.com/magma-labs/spreadsheet](https://github.com/magma-labs/spreadsheet).

## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
npm package: @magmaprotocol/aggregator-sdk
Description: The SDK is published to npm registry. To use the SDK in your project, you can
Latest version: 0.3.4

# Install

The SDK is published to npm registry. To use the SDK in your project, you can

```sh
npm install @magmaprotocol/aggregator-sdk
```

# Usage

## 1. Init client with rpc and package config

```typescript
const client = new AggregatorClient()
```

## 2. Get best router swap result from aggregator service

```typescript
const amount = new BN(1000000)
const from = "0x2::sui::SUI"
const target =
  "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC"

const routerRes = await client.findRouters({
  from,
  target,
  amount,
  byAmountIn: true, // true means fix input amount, false means fix output amount
})
```

## 3. Confirm and do fast swap

```typescript
const routerTx = new Transaction()

if (routerRes != null) {
  await client.fastRouterSwap({
    routers: routerRes.routes,
    byAmountIn,
    txb: routerTx,
    slippage: 0.01,
    isMergeTragetCoin: true,
    refreshAllCoins: true,
  })

  let result = await client.devInspectTransactionBlock(routerTx, keypair)

  if (result.effects.status.status === "success") {
    console.log("Sim exec transaction success")
    const result = await client.signAndExecuteTransaction(routerTx, keypair)
  }
  console.log("result", result)
}
```

## 4. Build PTB and return target coin

```typescript
const routerTx = new Transaction()
const byAmountIn = true;

if (routerRes != null) {
  const targetCoin = await client.routerSwap({
    routers: routerRes.routes,
    byAmountIn,
    txb: routerTx,
    inputCoin,
    slippage: 0.01,
  })

  // you can use this target coin object argument to build your ptb.
  const client.transferOrDestoryCoin(
      txb,
      targetCoin,
      targetCoinType
  )

  let result = await client.devInspectTransactionBlock(routerTx, keypair)

  if (result.effects.status.status === "success") {
    console.log("Sim exec transaction success")
    const result = await client.signAndExecuteTransaction(routerTx, keypair)
  }
  console.log("result", result)
}
```