1.0.23 • Published 12 months ago

react-sdk57 v1.0.23

Weekly downloads
-
License
MIT
Repository
-
Last release
12 months ago

Story Protocol React SDK

The react-sdk is a library that provides a set of hooks to interact with the SDK. It is designed to be used in a React application.

How to use Story Protocol SDK in Your Project

Generate React SDK

  1. Install the dependencies
pnpm install
  1. Update the @story-protocol/core-sdk package version in the packages/react-sdk/package.json file to the latest version.

Important: Once publish core-sdk, you need to update the core-sdk version in the react-sdk package.json file.

  1. Generate the SDK
pnpm run generate

This SDK is generated using the command pnpm run generate. The source code resides in the packages/sdk directory and the generated SDK can be found in the packages/react-sdk folder.

How to use Story Protocol React SDK in Your Project

  • Install Story Protocol React SDK
pnpm install @story-protocol/react-sdk
  • Import the provider in your React application
import { StoryProvider } from "@story-protocol/react-sdk";
const client = StoryClient.newClient(config);
 <StoryProvider
  config={{
    chainId: "sepolia",
    transport: http("RPC_URL"),
    wallet: walletClient,
  }}
  </StoryProvider>
  • Use the hooks in your component
import { useIpAsset } from "@story-protocol/react-sdk";
const { data, error, loading, register } = useIpAsset();
register({ nftContract: "0x1234", tokenId: "1" });

How To Build and Test Story Protocol React SDK for local testing

  • Install yalc
npm install -g yalc
  • For manual testing of the react-sdk, set up a separate web project. The guide below uses yalc to link the react-sdk locally, enabling its installation and import for testing.

Under the typescript-sdk/packages/react-sdk directory:

  • Execute npm run build to build your latest code.
  • Run yalc publish. You should see a message like @story-protocol/react-sdk@<version> published in store. (Note: The version number may vary).
  • To set up your testing environment (e.g., a new Next.js project), use yalc add @story-protocol/react-sdk@<version> (ensure the version number is updated accordingly).

  • Run pnpm install. This installs @story-protocol/react-sdk@<version> with your local changes.

Steps to Refresh the Change1s

Under the typescript-sdk/packages/react-sdk directory:

  • Execute npm run build to build your latest code.
  • Run yalc push.

In your testing environment:

  • Run yalc update to pull the latest changes.
1.0.23

12 months ago

1.0.21

12 months ago

1.0.20

12 months ago

1.0.19

12 months ago

1.0.18

12 months ago

1.0.17

12 months ago

1.0.16

12 months ago

1.0.15

12 months ago

1.0.14

12 months ago

1.0.13

12 months ago

1.0.12

12 months ago

1.0.11

12 months ago

1.0.10

12 months ago

1.0.9

12 months ago

1.0.8

12 months ago

1.0.7

12 months ago

1.0.6

12 months ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago