@story-protocol/core-sdk 0.1.0-rc.4 → 0.1.0-rc.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/README.md +76 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -0,0 +1,76 @@
1
+ core-sdk is the base level sdk to interact with story protocol. It provides functions to both read and write data to the protocol.
2
+
3
+ ## Installation
4
+
5
+ Install the SDK and ethers.js
6
+
7
+ npm
8
+ ```shell
9
+ npm i @story-protocol/core-sdk ethers@^5.7.2
10
+ ```
11
+ pnpm
12
+ ```shell
13
+ pnpm i @story-protocol/core-sdk ethers@^5.7.2
14
+ ```
15
+ yarn
16
+ ```shell
17
+ yarn add @story-protocol/core-sdk ethers@^5.7.2
18
+ ```
19
+
20
+ ## Set up `.env` file
21
+
22
+ (Ask the team to provide the values)
23
+
24
+ ```
25
+ NEXT_PUBLIC_API_BASE_URL =
26
+ NEXT_PUBLIC_FRANCHISE_REGISTRY_CONTRACT =
27
+ NEXT_PUBLIC_RELATIONSHIP_MODULE_CONTRACT =
28
+ NEXT_PUBLIC_COLLECT_MODULE_CONTRACT =
29
+ NEXT_PUBLIC_LICENSING_MODULE_CONTRACT =
30
+ ```
31
+
32
+ ## Set up SDK client
33
+ Using browser wallet
34
+
35
+ ```typescript
36
+ import { StoryClient } from "@story-protocol/core-sdk"
37
+ import ethers from "ethers"
38
+
39
+ // Signer from browser wallet (i.e Metamask)
40
+ const provider = new ethers.providers.Web3Provider(window.ethereum);
41
+ // request wallet permissions
42
+ await provider.send("eth_requestAccounts", []);
43
+ const signer = await provider.getSigner();
44
+
45
+ // Instantiate the Story Client
46
+ const client = new StoryClient( { signer } )
47
+
48
+ ```
49
+ Using private key
50
+ ```typescript
51
+ import { StoryClient } from "@story-protocol/core-sdk"
52
+ import ethers from "ethers"
53
+
54
+ // Signer from private key
55
+ const provider = new ethers.providers.JsonRpcProvider(<YOUR RPC URL>)
56
+ const signer = new ethers.Wallet(<YOUR PRIVATE KEY>, provider)
57
+
58
+ // Instantiate the Story Client
59
+ const client = new StoryClient( { signer } )
60
+
61
+ ```
62
+
63
+ ## Use SDK client
64
+
65
+ ```typescript
66
+ // Create a new franchise
67
+ const response = await client.franchise.create({
68
+ franchiseName: "Alice in Wonderland",
69
+ franchiseSymbol: "Wonderland",
70
+ franchiseDescription: "Fantastical journey, curious girl, whimsical characters, dreamlike adventures.",
71
+ })
72
+
73
+ // List franchises
74
+ const { data: franchise } = await client.franchise.list()
75
+
76
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@story-protocol/core-sdk",
3
- "version": "0.1.0-rc.4",
3
+ "version": "0.1.0-rc.5",
4
4
  "description": "Story Protocol Core SDK",
5
5
  "main": "dist/story-protocol-core-sdk.cjs.js",
6
6
  "module": "dist/story-protocol-core-sdk.esm.js",