Skip to content

meditatingsloth/shadow-drive

 
 

Repository files navigation

Shadow Drive

Docs

Typescript components for Shadow Drive.

Quick Setup

Install

Install these dependencies:

yarn add @shadow-drive/sdk

Setup (React)

import React, { useEffect } from "react";
import * as anchor from "@project-serum/anchor";
import {ShdwDrive} from "@shadow-drive/sdk";
import { AnchorWallet, useAnchorWallet, useConnection } from "@solana/wallet-adapter-react";

export default function Drive() {
	const { connection } = useConnection();
	const wallet = useAnchorWallet();
	useEffect(() => {
		(async () => {
			if (wallet?.publicKey) {
				const drive = await new ShdwDrive(connection, wallet).init();
			}
		})();
	}, [wallet?.publicKey])
	return (
		<div></div>
	)
}

Setup (NodeJS)

import {ShdwDrive} from "@shadow-drive/sdk";
const drive = await new ShdwDrive(connection, wallet).init();

Examples

package description
react Using shadow-drive in a react/browser environment

Build From Source

  1. Clone the project:
git clone https://github.com/genesysgo/shadow-drive.git
  1. Install dependencies:
cd shadow-drive
yarn install

Troubleshooting

Getting a 400 HTTP error code when performing POST requests

If you are getting a 400 HTTP error status code when using the POST ShdwDrive methods such as createStorageAccount, uploadFile, addStorage, etc.

Make sure to set your wallet adapter or connection commitment config to max.

<ConnectionProvider endpoint={network} config={{ commitment: 'max' }}>
  ...
</ConnectionProvider>
const connection = new solanaWeb3.Connection(
    "https://ssc-dao.genesysgo.net/",
	"max"
  );

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 99.9%
  • JavaScript 0.1%