1.3.2 • Published 20 days ago

@openformat/react v1.3.2

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
20 days ago

Open Format React

Open Format React is an even easier way to integrate with the Open Format SDK using React.

Examples

Fungible tokens

Fungible token creation and minting

const { sdk } = useOpenFormat();

const token = await sdk.App.createToken({
  name: 'My First Token',
  symbol: 'MFT',
  supply: toWei('1000'),
});

// All our hooks use `react-query` under the hood.
const { mint, isLoading: isMinting } = useMintToken(token as ERC20Base);
await mint({ to: 'WALLET_ADDRESS', amount: toWei('1000') });

NFTs

NFT creation and minting

const { sdk } = useOpenFormat();

const NFT = await sdk.App.createNFT({
  name: 'My First NFT',
  symbol: 'NFT',
  royaltyRecipient: '0x123...',
  royaltyBps: 250, // 2.5%
});

// All our hooks use `react-query` under the hood.
const { mint, isLoading: isMinting } = useMintNFT(token);

await mint({
  to: 'WALLET_ADDRESS',
  tokenURI:
    'ipfs://bafkreib2ofqfcgpe5laipvgalzvf24aqbz7tmbktz36zkvt54wnkldzm2i',
});

React + Next.js

From examples/react-next you can yarn run start to run the Next.js app which utiltises @openformat/react.

Try our GetStarted template

GetStarted is an introduction into a new decentralised world and what we believe to be the starting point for 90% of all future applications. It features a fundamental file structure boilerplate, which comprises of an admin area, authentication, and a tokenised system with Action Tokens, Badges, and Reward Tokens, all integrated into a front-end application built using NextJS and the Open Format SDK.

Quickstart

Install dependencies:

npm install @openformat/react ethers^5
# or
yarn install @openformat/react ethers^5
# or
pnpm install @openformat/react ethers^5

Please note: ethers v6.0.0 not yet supported.

Initialise SDK:

import { OpenFormatProvider, Chains } from '@openformat/react';

<OpenFormatProvider
  config={{ networks: [Chains.polygonMumbai], appId: 'INSERT_APP_ID' }}
>
  {/* the rest of your app... */}
</OpenFormatProvider>;

Connecting a wallet:

Before you can deploy or perform any interactions with the contract you'll want to connect a wallet.

You can allow people to connect their wallets using the <ConnectButton /> component (which uses Wagmi and ConnectKit) and the useWallet hook to get the connection state and the address of the wallet if required.

import { ConnectButton, useWallet } from '@openformat/react';

function MyComponent() {
  const { isConnected, address } = useWallet();

  return (
    <>
      <ConnectButton />
    </>
  );
}

Now you can start interacting with the SDK using the useOpenFormat() hook.

import { useOpenFormat } from '@openformat/react';

const { sdk } = useOpenFormat();

// Create NFT contract
await sdk.App.createNFT(params);
// Create Fungible token contract
await sdk.App.createToken(params);
// Get existing contract
await sdk.getContract(params);

There is also custom hooks for certain SDK interacts.

const { sdk } = useOpenFormat();
const { mint, isLoading: isMinting } = useMintToken(token as ERC20Base);

const token = await sdk.App.createToken({
  name: 'My First Token',
  symbol: 'MFT',
  supply: toWei('1000'),
});

// All our hooks use `react-query` under the hood.
await mint({ to: 'WALLET_ADDRESS', amount: toWei('1000') });

Documentation

Quickstart - Swiftly set up your development environment.

App - Learn how to create tokens, manage creator access, and handle application fees for your projects.

NFTs - Effortlessly manage your created Non-Fungible Tokens (NFTs).

Fungible tokens - Seamlessly manage your created Fungible Tokens.

Contributing

Our bounty program provides developers with a chance to earn by contributing to the Open Format ecosystem through completing bounties for new features and templates on our product roadmap. If you're interested in getting involved, check out our current bounties to see if there are any projects that match your skills and interests.

Community

We're building a community of talented developers who are passionate about shaping the future of the internet. We believe that collaboration and shared knowledge are absolutely essential to creating amazing things that will impact people's lives in profound ways. If you share our vision, we invite you to come be a part of something amazing on Discord.

1.3.2

20 days ago

1.3.1

28 days ago

1.3.1-dev-3e1aba0

5 months ago

1.3.0

5 months ago

1.3.1-dev-eb50aa6

5 months ago

1.2.0

9 months ago

1.1.3-dev-05de380

10 months ago

1.3.0-dev-d13a93a

6 months ago

1.2.2

6 months ago

1.2.1

9 months ago

1.1.3-dev-bfd2e07

10 months ago

1.2.2-dev-39eba80

8 months ago

1.2.2-dev-bf1755b

6 months ago

1.3.0-dev-8301b76

5 months ago

1.1.3-dev-9624457

9 months ago

1.3.0-dev-d64642b

5 months ago

1.2.2-dev-9f0d51b

7 months ago

1.2.3-dev-70afa02

6 months ago

1.1.3-dev-038f357

10 months ago

1.2.2-dev-85c3e2a

7 months ago

1.2.2-dev-3535b05

6 months ago

1.3.0-dev-12e705d

5 months ago

1.2.2-dev-6125a60

7 months ago

1.2.2-dev-e86c193

8 months ago

1.2.2-dev-f702910

7 months ago

1.2.2-dev-4aaad47

8 months ago

1.2.2-dev-83fe6ec

7 months ago

1.2.2-dev-cdf4f7d

8 months ago

1.2.1-dev-593b49d

9 months ago

1.3.0-dev-bb11835

5 months ago

1.2.2-dev-43d19a6

9 months ago

1.1.1

12 months ago

1.0.2

1 year ago

1.1.0

12 months ago

1.0.1

1 year ago

1.0.0

1 year ago

1.1.3

11 months ago

1.1.2

12 months ago

1.1.0-dev-8de5595

12 months ago

0.2.0

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago