Skip to content
This repository has been archived by the owner on Feb 5, 2025. It is now read-only.

Chore/dev into main #1233

Merged
merged 44 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
7b32b0f
Fix/package build (#1124)
bitbeckers Oct 22, 2023
6d75f0a
Feat/deploy to celo (#1135)
bitbeckers Oct 23, 2023
c60e8f7
fix(gha): use pnpm cache in graph gha (#1138)
bitbeckers Oct 23, 2023
a99e85e
Merge branch 'main' into develop
bitbeckers Oct 23, 2023
fe9b359
chore: add wrapper components for split and merge functionality
Jipperism Oct 31, 2023
b033d77
Fix/handle batch transfers graph (#1149)
bitbeckers Nov 3, 2023
859366a
SDK remove default chainID dependency (#1146)
bitbeckers Nov 6, 2023
462abfd
Fix/gha graph (#1165)
bitbeckers Nov 6, 2023
ee250ee
Feat/allowlist proof util (#1168)
bitbeckers Nov 7, 2023
44baf47
Add hypercerts to marketplace functionality (#1170)
bitbeckers Nov 8, 2023
a827b5e
feat(restriction): add transfer restriction to fe (#1173)
bitbeckers Nov 8, 2023
34436b9
feat(metadata): add application name (#1174)
bitbeckers Nov 9, 2023
fc0161d
feat(deployments): typed deployment contracts
bitbeckers Nov 9, 2023
55c1f57
fix(props): props from plas to form (#1176)
bitbeckers Nov 9, 2023
c93f391
format external url in case it is a direct ipfs link (#1182)
Jipperism Nov 13, 2023
dbdb083
fix(fix formatting of ipfs urls on hypercert page) (#1183)
Jipperism Nov 15, 2023
a6c3b8f
Feat/split and merge (#1185)
Jipperism Nov 21, 2023
84a623c
Feat/hardhat deploy script (#1177)
bitbeckers Nov 22, 2023
9657f17
feat(merkle): account allowlist strategy (#1186)
bitbeckers Nov 22, 2023
5623583
Added strategy and tests for hypercert functionality (#1188)
bitbeckers Nov 24, 2023
582af93
Feat/partial fraction sale (#1190)
bitbeckers Nov 24, 2023
3bc340a
Feat/sdk common js (#1191)
bitbeckers Nov 26, 2023
ccdf65b
feat(abis): updated SDK abis and restored tests (#1193)
bitbeckers Nov 29, 2023
1acbaa0
fix(test): add currency admin to test (#1197)
bitbeckers Nov 30, 2023
de5e0d0
fix build error - set output:export in next config (#1199)
Jipperism Dec 1, 2023
31ac54c
add placeholder for transfer fraction button (#1201)
Jipperism Dec 1, 2023
5c94088
change next build back to next export (#1202)
Jipperism Dec 1, 2023
6ef5b40
Feature/transfer fraction button (#1203)
Jipperism Dec 1, 2023
6488e79
add override chain id functionality for plasmic editing (#1204)
Jipperism Dec 1, 2023
a602567
Bugfix/add override chain id for plasmit editing (#1205)
Jipperism Dec 1, 2023
2406b96
remove transfer fraction button from split fraction button (#1206)
Jipperism Dec 1, 2023
6a93ec8
Bugfix/only show transfer button for fraction owned (#1207)
Jipperism Dec 1, 2023
f36b963
Feat/more robust split transfer logic with hc strategy (#1208)
bitbeckers Dec 2, 2023
4b86911
Feat/docs tests cleanup (#1210)
bitbeckers Dec 4, 2023
b253cd6
Feat/docs tests cleanup (#1211)
bitbeckers Dec 4, 2023
2637ed0
Feat/docs tests cleanup (#1212)
bitbeckers Dec 4, 2023
1cc481f
Feat/add batch transfer method to client methods (#1215)
bitbeckers Dec 6, 2023
0c249aa
Chore/lets merge together (#1220)
Jipperism Dec 7, 2023
435db09
feat(urql): refactored to urql and own codegen (#1223)
bitbeckers Dec 8, 2023
73b06f3
Feat/docs updates docusaurs v3 search release (#1226)
bitbeckers Dec 8, 2023
f1de3d6
Feat/sdk npm docs release 1 (#1228)
bitbeckers Dec 8, 2023
210c167
Feat/sdk npm docs release 1 (#1231)
bitbeckers Dec 8, 2023
fbe4d76
Merge branch 'develop' into chore/dev_into_main
bitbeckers Dec 9, 2023
6c166ce
chore(cleanup): merge artifacts
bitbeckers Dec 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Feat/allowlist proof util (#1168)
* feat(util): allowlist utils and updated docs

* feat(test): updated test and docs

* chore(bump): alpha-7

* feat(merkle): test merkleProof fetcher

* chore(bump): 1.0.0-alpha.8

* fix(import): allowlist default export

* chore(run): local validation run
  • Loading branch information
bitbeckers authored Nov 7, 2023
commit ee250ee581fd9beec85149f701705203028d4352
3 changes: 0 additions & 3 deletions frontend/components/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ export function Config(props: ConfigProps) {
? Number(hypercertClient.config.chain.id)
: undefined;

console.log(chainId);
console.log("Config: ", hypercertClient.config);

const data: ConfigData = {
domain: DOMAIN,
chainId: chainId,
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@graphprotocol/client-cli": "^2.2.16",
"@hypercerts-org/contracts": "0.9.0",
"@hypercerts-org/observabletreemap": "workspace: *",
"@hypercerts-org/sdk": "1.0.0-alpha.6",
"@hypercerts-org/sdk": "1.0.0-alpha.8",
"@mui/icons-material": "^5.11.9",
"@mui/material": "^5.11.2",
"@mui/x-date-pickers": "^5.0.12",
Expand Down
2 changes: 1 addition & 1 deletion graph/tests/.latest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "0.6.0",
"timestamp": 1699280746839
"timestamp": 1699397492586
}
133 changes: 71 additions & 62 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

92 changes: 24 additions & 68 deletions sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@ import { HypercertClient } from "@hypercerts-org/sdk";

```js
const client = new HypercertClient({
chainId: 5,
provider,
signer,
chain: { id: 5 } // required
nftStorageToken,
web3StorageToken,
});
```

> **Note** If there's no `signer`, `provider`, `nftStorageToken` or `web3StorageToken` provided, the client will run in
> **Note** If there's no `walletClient`, `nftStorageToken` or `web3StorageToken` provided, the client will run in
> [read-only mode](#read-only-mode)

4. Use the client object to interact with the Hypercert network.
Expand Down Expand Up @@ -60,78 +58,36 @@ environment variables for your NFT.storage and web3.storage API keys in your .en

## Config

The SDK will try to determine the `DEFAULT_CHAIN_ID` and use that to inform the configuration. We allow for `overrides`
when creating the SDK by passing configuration variables. Finally, when not defaults or overrides are found, we check
the environment variables.
HypercertClientConfig is a configuration object used when initializing a new instance of the HypercertClient. It allows
you to customize the client by setting your own providers or deployments. At it's simplest, you only need to provide
`chain.id` to initalize the client in `readonly` mode.

| Field | Type | Description |
| --------------------------- | ------- | ---------------------------------------------------------------------------------------------- |
| `chain` | Object | Partial configuration for the blockchain network. |
| `contractAddress` | String | The address of the deployed contract. |
| `graphUrl` | String | The URL to the subgraph that indexes the contract events. Override for localized testing. |
| `graphName` | String | The name of the subgraph. |
| `nftStorageToken` | String | The API token for NFT.storage. |
| `web3StorageToken` | String | The API token for Web3.storage. |
| `easContractAddress` | String | The address of the EAS contract. |
| `publicClient` | Object | The PublicClient is inherently read-only and is used for reading data from the blockchain. |
| `walletClient` | Object | The WalletClient is used for signing and sending transactions. |
| `unsafeForceOverrideConfig` | Boolean | Boolean to force the use of overridden values. |
| `readOnly` | Boolean | Boolean to assert if the client is in read-only mode. |
| `readOnlyReason` | String | Reason for read-only mode. This is optional and can be used for logging or debugging purposes. |

### Read-only mode

The SDK client will be in read-only mode if any of the following conditions are true:

- The client was initialized without a signer or provider.
- The client was initialized with a provider but not a signer.
- The client was initialized with a signer but not a provider.
- The client was initialized without a walletprovider.
- The contract address is not set.
- The storage layer is in read-only mode.

If any of these conditions are true, the readonly property of the HypercertClient instance will be set to true, and a
warning message will be logged indicating that the client is in read-only mode.

### Defaults

The constants.ts file defines various constants that are used throughout the Hypercert system. Here's a brief
explanation of each constant:

`DEFAULT_CHAIN_ID`: This constant defines the default chain ID to use if no chain ID is specified. In this case, the
default chain ID is set to 5, which corresponds to the Goerli testnet.

Based on `DEFAULT_CHAIN_ID` the SDK will select a `DEPLOYMENT`.

`DEPLOYMENTS`: This constant defines the deployments that are managed by the Hypercert system. Each Deployment object
contains information about a specific deployment, including the chain ID, chain name, contract address, and graph name.

For example:

```json
{
"5": {
"chainId": 5,
"chainName": "goerli",
"contractAddress": "0x822F17A9A5EeCFd66dBAFf7946a8071C265D1d07",
"graphName": "hypercerts-testnet"
}
}
```

### Client config properties

| \| Property | Type | Description |
| ------------------ | -------------------- | -------------------------------------- |
| `chainId` | `number` | The chain ID of the network to use. |
| `chainName` | `string` | The name of the network to use. |
| `contractAddress` | `string` | The address of the Hypercert contract. |
| `rpcUrl` | `string` | The URL of the RPC endpoint to use. |
| `graphName` | `string` | The name of the Gsubgraph to use. |
| `provider` | `providers.Provider` | A custom provider to use. |
| `signer` | `Signer` | A custom signer to use. |
| `nftStorageToken` | `string` | Your NFT.storage API key. |
| `web3StorageToken` | `string` | Your web3.storage API key. |

### Environment variables

To determine the missing configuration values the SDK defaults to the following environment variables:

| Environment Variable | Description |
| -------------------------------- | --------------------------------------------------------------------------------------------------- |
| `DEFAULT_CHAIN_ID` | Specifies the default chain ID to use if no chain ID is specified. |
| `CONTRACT_ADDRESS` | Specifies the contract address to use for the Hypercert protocol. |
| `RPC_URL` | Specifies the RPC URL to use for the evm-compatible network. |
| `PRIVATE_KEY` | Specifies the private key to use for signing transactions. |
| `NFT_STORAGE_TOKEN` | Specifies the NFT.storage API token to use for storing Hypercert metadata. |
| `NEXT_PUBLIC_NFT_STORAGE_TOKEN` | Specifies the NFT.storage API token to use for storing Hypercert metadata in a Next.js application. |
| `WEB3_STORAGE_TOKEN` | Specifies the Web3.storage API token to use for storing Hypercert data. |
| `NEXT_PUBLIC_WEB3_STORAGE_TOKEN` | Specifies the Web3.storage API token to use for storing Hypercert data in a Next.js application. |

### Logging

The logger for the SDK uses the log level based on the value of the LOG_LEVEL environment variable. The log level
Expand All @@ -147,7 +103,7 @@ HypercertIndexer, and HypercertMinter classes, respectively.
```js
const {
client: { storage },
} = new HypercertClient({});
} = new HypercertClient({ chain: { id: 5 } });
```

The `storage` is a utility class that provides methods for storing and retrieving Hypercert metadata on IPFS and
Expand All @@ -156,7 +112,7 @@ NFT.storage. It is used by the HypercertClient to store metadata when creating n
```js
const {
client: { indexer },
} = new HypercertClient({});
} = new HypercertClient({ chain: { id: 5 } });
```

The `indexer` is a utility class that provides methods for indexing and searching Hypercerts based on various criteria.
Expand All @@ -165,7 +121,7 @@ It is used by the HypercertClient to retrieve event-based data via the subgraph
```js
const {
client: { contract },
} = new HypercertClient({});
} = new HypercertClient({ chain: { id: 5 } });
```

Finally we have a `contract` that provides methods for interacting with the HypercertMinter smart contract. It is used
Expand Down
4 changes: 2 additions & 2 deletions sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hypercerts-org/sdk",
"version": "1.0.0-alpha.6",
"version": "1.0.0-alpha.8",
"description": "SDK for hypercerts protocol",
"repository": "git@github.com:hypercerts-org/hypercerts.git",
"author": "Hypercerts team",
Expand Down Expand Up @@ -38,7 +38,7 @@
"@graphql-mesh/utils": "^0.95.7",
"@graphql-typed-document-node/core": "^3.2.0",
"@hypercerts-org/contracts": "0.8.11",
"@openzeppelin/merkle-tree": "^1.0.4",
"@openzeppelin/merkle-tree": "^1.0.5",
"@whatwg-node/fetch": "^0.9.13",
"ajv": "^8.11.2",
"axios": "^1.2.2",
Expand Down
Loading