# ethers-suave

> Module for interacting with SUAVE smart contracts.

Latest version **1.1.2** (published 2024-08-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install ethers-suave
pnpm add ethers-suave
yarn add ethers-suave
bun add ethers-suave
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2024-08-02 |
| First published | 2023-12-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 185.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Miha Lotric |
| Maintainers | halo3mic |
| Keywords | ethers, suave, ccr, confidential-compute-request |

## Links

- npm: https://www.npmjs.com/package/ethers-suave
- Repository: https://github.com/halo3mic/ethers-suave
- Homepage: https://github.com/halo3mic/ethers-suave#readme
- Issues: https://github.com/halo3mic/ethers-suave/issues
- npm.io page: https://npm.io/package/ethers-suave

## Dependencies (2)

- [ethers](https://npm.io/package/ethers.md) ^6.9.0
- [typescript](https://npm.io/package/typescript.md) ^5.3.2

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.1.2 (latest) — 2024-08-02
- 1.1.1 — 2024-08-02
- 1.1.0 — 2024-07-30
- 1.0.4 — 2024-04-11
- 1.0.3 — 2023-12-14
- 1.0.2 — 2023-12-13
- 1.0.1 — 2023-12-13
- 1.0.0 — 2023-12-13

## README

# ethers-suave

A typescript library, built on top of ethers.js, for interacting with Suave confidential requests.

## Usage

#### Send confidential request with ABI
```typescript
const provider = new SuaveProvider(kettleUrl)
const wallet = new SuaveWallet(pk, provider)

const StoreContract = new SuaveContract(storeContractAdd, storeABI, wallet)
const milkLiters = 2
const milkType = 1 // 'whole'
// Non-confidential methods are called as usual
const milkPrice = await StoreContract.milkSpotPrice(milkType)
const confidentialInputs = createPaymentBundle(milkPrice, milkLiters)
// Response is ConfidentialTransactionResponse 
const res = await StoreContract.buyMilk.sendCCR(milkType, milkLiters, { confidentialInputs })
// Receipt is a normal EVM transaction receipt
const receipt = await res.wait()
```

#### Create a confidential request
```typescript
const ccr = await StoreContract.buyMilk.prepareCCR(milkType, milkLiters, { confidentialInputs }) 
```

#### Get a confidential request
```typescript
const tx = await provider.getConfidentialTransaction('0xafac2...')
```

#### Send confidential request without ABI
```typescript
const crecordlike = {
    data: '0x966a0212...',
    to: storeContractAdd
}
const confidentialTxResponse = await wallet.sendCCR(crecordlike, confidentialInputs)
```

#### Populate confidential record without ABI
```typescript
const crecordlike = {
    data: '0x966a0212...',
    to: storeContractAdd
}
const crecord = await wallet.populateCRecord(crecordlike)
```


## Dev Setup
#### Install dependencies
```bash
yarn install --dev
```

#### Test
```bash
yarn test
```

## Contributions 

Any contributions are welcome! Please submit a PR or an issue.

---
_Source: https://npm.io/package/ethers-suave · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
