@bosonprotocol/core-sdk 1.16.0-alpha.12 → 1.16.0-alpha.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +3 -104
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -2,20 +2,10 @@
2
2
 
3
3
  JS lib that facilitates interaction with the Boson Protocol contracts, subgraph and metadata storage.
4
4
 
5
- ## Install
5
+ ## Get started
6
6
 
7
7
  The `core-sdk` is intended to be used in combination with implementations of the `Web3LibAdapter` and `MetadataStorage` interfaces.
8
8
 
9
- If you, for example, want to use the `core-sdk` in combination with [`ethers`](https://docs.ethers.io/v5/) and `IPFS` as the metadata storage, then run
10
-
11
- ```bash
12
- npm i @bosonprotocol/core-sdk @bosonprotocol/ethers-sdk @bosonprotocol/ipfs-storage ethers
13
-
14
- # OR
15
-
16
- yarn add @bosonprotocol/core-sdk @bosonprotocol/ethers-sdk @bosonprotocol/ipfs-storage ethers
17
- ```
18
-
19
9
  We currently support the following
20
10
 
21
11
  - `Web3LibAdapter` implementations:
@@ -26,97 +16,6 @@ We currently support the following
26
16
  - `MetadataStorage` implementations:
27
17
  - `IpfsMetadata` exported from [`@bosonprotocol/ipfs-storage`](/packages/ipfs-storage/README.md)
28
18
 
29
- ## Usage
30
-
31
- > The following assumes the usage of the `core-sdk` with `ethers` and `IPFS` as the metadata storage.
32
-
33
- - [`@bosonprotocol/core-sdk`](#bosonprotocolcore-sdk)
34
- - [Install](#install)
35
- - [Usage](#usage)
36
- - [Initialize](#initialize)
37
- - [Explicit](#explicit)
38
- - [Default configuration](#default-configuration)
39
- - [Metadata](#metadata)
40
- - [Offers](#offers)
41
- - [Exchange token](#exchange-token)
42
-
43
- ### Initialize
44
-
45
- #### Explicit
46
-
47
- The `core-sdk` can be initialized by explicitly passing in the required arguments
48
-
49
- ```js
50
- import { CoreSDK } from "@bosonprotocol/core-sdk";
51
- import { EthersAdapter } from "@bosonprotocol/ethers-sdk";
52
- import { IpfsMetadata } from "@bosonprotocol/ipfs-storage";
53
- import { ethers } from "ethers";
54
-
55
- // injected web3 provider
56
- const web3Provider = new ethers.providers.Web3Provider(window.ethereum);
57
-
58
- // initialize explicitly
59
- const coreSDK = new CoreSDK({
60
- web3Lib: new EthersAdapter(web3Provider),
61
- subgraphUrl: "https://api.thegraph.com/subgraphs/name/bosonprotocol/cc",
62
- protocolDiamond: "0x5E3f5127e320aD0C38a21970E327eefEf12561E5",
63
- // optional
64
- metadataStorage: new IpfsMetadata({
65
- url: "https://ipfs.infura.io:5001"
66
- }),
67
- // optional
68
- theGraphStorage: new IpfsMetadata({
69
- url: "https://api.thegraph.com/ipfs/api/v0"
70
- })
71
- });
72
- ```
73
-
74
- #### Default configuration
75
-
76
- It is also possible to use the default configuration provided through the [`@bosonprotocol/common`](/packages/common/README.md) package.
77
-
78
- ```js
79
- import { CoreSDK } from "@bosonprotocol/core-sdk";
80
- import { EthersAdapter } from "@bosonprotocol/ethers-sdk";
81
- import { IpfsMetadata } from "@bosonprotocol/ipfs-storage";
82
- import { ethers } from "ethers";
83
-
84
- // injected web3 provider
85
- const web3Provider = new ethers.providers.Web3Provider(window.ethereum);
86
-
87
- // initialize via default config of "testing" environment
88
- const coreSDK = CoreSDK.fromDefaultConfig({
89
- web3Lib: new EthersAdapter(web3Provider),
90
- envName: "testing"
91
- // ...other args
92
- });
93
- ```
94
-
95
- ### Metadata
96
-
97
- For handling metadata through the `core-sdk`, make sure to pass an instance as a constructor argument
98
-
99
- ```js
100
- import { CoreSDK } from "@bosonprotocol/core-sdk";
101
- import { IpfsMetadata } from "@bosonprotocol/ipfs-storage";
102
-
103
- const ipfsMetadata = new IpfsMetadata({ url: "https://ipfs.infura.io:5001" });
104
- const coreSDK = CoreSDK.fromDefaultConfig({
105
- // ...other args
106
- metadataStorage: ipfsMetadata
107
- });
108
-
109
- // store metadata
110
- const cid = await coreSDK.storeMetadata(offerMetadata);
111
-
112
- // get metadata
113
- await coreSDK.getMetadata(cid);
114
- ```
115
-
116
- ### Offers
117
-
118
- > TODO
119
-
120
- ### Exchange token
19
+ Follow the respective guides to get started
121
20
 
122
- > TODO
21
+ - [Use with `ethers` and `IPFS`](/docs/guides/use-with-ethers-ipfs.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bosonprotocol/core-sdk",
3
- "version": "1.16.0-alpha.12",
3
+ "version": "1.16.0-alpha.14",
4
4
  "description": "> TODO: description",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -33,7 +33,7 @@
33
33
  "access": "restricted"
34
34
  },
35
35
  "dependencies": {
36
- "@bosonprotocol/common": "^1.12.0-alpha.14",
36
+ "@bosonprotocol/common": "^1.12.0-alpha.16",
37
37
  "@ethersproject/abi": "^5.5.0",
38
38
  "@ethersproject/address": "^5.5.0",
39
39
  "@ethersproject/bignumber": "^5.5.0",
@@ -54,5 +54,5 @@
54
54
  "ts-jest": "^27.1.3",
55
55
  "typescript": "^4.5.5"
56
56
  },
57
- "gitHead": "22b8e677f4fb90fc18227260c29234d06414cd0d"
57
+ "gitHead": "f1caeb91169d848494740509e7c0edc75fd8a441"
58
58
  }