# @simpleweb/open-format

> The Open Format SDK provides a simple way to interact with the [Open Format platform](https://openformat.simpleweb.co.uk/), an easy way to build build your own NFT ecosystem.

Latest version **0.9.0** (published 2022-09-30) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @simpleweb/open-format
pnpm add @simpleweb/open-format
yarn add @simpleweb/open-format
bun add @simpleweb/open-format
```

## Health

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

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

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.9.0 |
| Published | 2022-09-30 |
| First published | 2022-06-21 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 5 |
| Unpacked size | 1.5 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Benjamin Reid |
| Maintainers | simpleweb |

## Links

- npm: https://www.npmjs.com/package/@simpleweb/open-format
- Repository: https://github.com/simpleweb/open-format.git#main
- Homepage: https://github.com/simpleweb/open-format/tree/main#readme
- Issues: https://github.com/simpleweb/open-format/issues
- npm.io page: https://npm.io/package/@simpleweb/open-format

## Dependencies (5)

- [graphql](https://npm.io/package/graphql.md) ^16.5.0
- [nft.storage](https://npm.io/package/nft.storage.md) ^6.4.1
- [lodash.merge](https://npm.io/package/lodash.merge.md) ^4.6.2
- [graphql-request](https://npm.io/package/graphql-request.md) ^4.3.0
- [@simpleweb/open-format-contracts](https://npm.io/package/@simpleweb/open-format-contracts.md) ^0.3.0

## Recent versions

- 0.9.0 (latest) — 2022-09-30
- 0.8.0 — 2022-09-30
- 0.7.0 — 2022-09-07
- 0.6.0 — 2022-08-17
- 0.5.0 — 2022-07-29
- 0.4.0 — 2022-07-21
- 0.3.0 — 2022-07-11
- 0.2.0 — 2022-07-06
- 0.1.2 — 2022-06-24
- 0.1.1 — 2022-06-24
- 0.1.0 — 2022-06-21

## README

# Open Format SDK

The Open Format SDK provides a simple way to interact with the [Open Format platform](https://openformat.simpleweb.co.uk/), an easy way to build build your own NFT ecosystem.

## Installation

You can install the SDK with NPM or Yarn.

```shell
npm install @simpleweb/open-format ethers
```

```shell
yarn add @simpleweb/open-format ethers
```

## Documentation

[Read the Open Format documentation](https://docs.openformat.simpleweb.co.uk/) in full or you can get started quickly below.

## Getting started

### Deploying an NFT

To do this you'll want to create an instance of the SDK with a `signer`. This can be done by passing a private key...

```tsx
import { OpenFormatSDK } from '@simpleweb/open-format';

const sdk = new OpenFormatSDK({
  network: 'mumbai',
  signer: '0x...',
});
```

...or with a `Signer` instance, which you'd typically get from a connected wallet (but explicitly created in this example). Note that the `signer` must be on the same network.

```tsx
import { OpenFormatSDK } from '@simpleweb/open-format';

const signer = new ethers.Wallet(
  '0x...',
  new ethers.providers.JsonRpcProvider(
    'https://matic-mumbai.chainstacklabs.com/'
  )
);

const sdk = new OpenFormatSDK({
  network: 'mumbai',
  signer,
});
```

Now can now deploy your NFT.

```tsx
const { contractAddress } = await sdk.deploy({
  maxSupply: 100,
  mintingPrice: 0.01,
  name: 'Test 1',
  symbol: 'TEST1',
  url: 'ipfs://',
});
```

### Minting an NFT

Once your contract is deployed you can use the `contractAddress` is returns to create a new NFT instance and mint it.

```tsx
const nft = sdk.getNFT(contractAddress);
await nft.mint();
```

### Reading from the subgraph

To read information from the sub graph you can create a read-only instance of the SDK.

```tsx
import { OpenFormatSDK } from '@simpleweb/open-format';

const sdk = new OpenFormatSDK();
```

By default it will use your local network (http://localhost:8545) so you'll usually want to specify which network you want to interact with.

```tsx
const sdk = new OpenFormatSDK({
  network: 'mumbai',
});
```

To pull back data, simply use any of the pre-built methods.

```tsx
await sdk.getSaleDataForToken('0x...');
```

Or if you want pull back specific data, you can pass through your own GraphQL query. Explore what's possible in the [Open Format playground](https://api.thegraph.com/subgraphs/name/simpleweb/open-format/graphql).

```tsx
import { gql } from 'graphql-request';

const query = gql`
  {
    tokens {
      id
    }
  }
`;

await sdk.rawRequest(query);
```

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