1.0.4 • Published 1 year ago

@comet-labs/react v1.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

@comet-labs/react

About

Integrate Comet's Instant Wallet and Minting functionality into your React app in 1 line of code.

Note: This is a very early release of Comet's React library and APIs are subject to change.

Installation

npm

npm install --save @comet-labs/react

yarn

yarn add @comet-labs/react

Login with Comet

import React from 'react';
import { CometButton } from '@comet-labs/react';

export default function MyApp(props) {
  // Login handler
  const loginHandler = (result) => {
    alert(`Logged in as @${result.username}! Address: ${result.address.address}`);
  }

  return (
    ...
    <CometButton
      action="login"
      onLoginthis ={loginHandler}
    />
    ...
  );
}

Comet Gallery

import React from 'react';
import { CometButton } from '@comet-labs/react';

export default function MyApp(props) {
  return (
    ...
    <CometButton
      action="gallery"
    />
    ...
  );
}

Mint with Comet

Contact us to launch a new NFT and get its collectionId. Supports free mints and paid mints using Stripe as an onramp.

import React from 'react';
import { CometButton } from '@comet-labs/react';

export default function MyApp(props) {
  return (
    ...
    <CometButton
      action="mint"
      collectionId="<collectionId>"
    />
    ...
  );
}

API

CometButton accepts the following props:

PropRequiredDescription
action:heavy_check_mark:The action that occurs when the button is clicked. Currently the only accepted action is login.
onLogin:heavy_check_mark:Handler function after the login is done. Contains fields for the user's id, username, and data about their address.
chainType, chainIdSpecify chainType and chainId to specify which blockchain to login with. The currently available chainTypes and chainIds are listed below.

Supported chains

By default, Comet generates a wallet on Solana mainnet. To generate wallets on other chains, supply the chainType and chainId props to CometButton. The supported chains are listed below:

BlockchainchainTypechainId
Solana mainnetsolana101
Solana devnetsolana103
1.0.2

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.1

1 year ago

1.0.0-alpha.1

1 year ago

1.0.0-alpha.0

1 year ago

0.4.0

1 year ago

0.3.0

2 years ago

0.3.2

1 year ago

0.3.1

2 years ago

0.3.3

1 year ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

1.0.0

2 years ago

0.0.1

2 years ago