@gumhq/react-sdk
Version:
React SDK for Gum
957 lines (934 loc) • 35.9 kB
TypeScript
import { SDK } from '@gumhq/sdk';
export { GATEWAY_SERVICE_URL, GPLCORE_PROGRAMS, GPLSESSION_PROGRAMS, GPL_NAMESERVICE_PROGRAMS, GRAPHQL_ENDPOINTS, GRAPHQL_ENDPOINTS_OLD, GUM_TLD_ACCOUNT, GumNameService, OLD_GPLCORE_PROGRAMS, SDK } from '@gumhq/sdk';
import { PublicKey, Connection, Transaction, Cluster, ConfirmOptions } from '@solana/web3.js';
import * as _project_serum_anchor_dist_cjs_program_namespace_methods from '@project-serum/anchor/dist/cjs/program/namespace/methods';
import * as _gumhq_sdk_lib_idl_gpl_core from '@gumhq/sdk/lib/idl/gpl_core';
import { WalletContextState, AnchorWallet } from '@solana/wallet-adapter-react';
import { SendTransactionOptions } from '@solana/wallet-adapter-base';
import { ShadowFile, ShadowUploadResponse, StorageAccountResponse, CreateStorageResponse } from '@shadow-drive/sdk';
import { FundResponse } from '@bundlr-network/client/build/common/types';
import { GraphQLClient } from 'graphql-request';
import * as React from 'react';
import { ReactNode } from 'react';
declare const useProfile: (sdk: SDK, profileAccount: PublicKey) => {
profile: any;
profileLoading: boolean;
profileError: Error | null;
};
declare const useCreateProfile: (sdk: SDK) => {
isCreatingProfile: boolean;
createProfileError: Error | null;
create: (metadataUri: string, screenNameAccount: PublicKey, owner: PublicKey, payer?: PublicKey) => Promise<PublicKey | undefined>;
getOrCreate: (metadataUri: string, screenNameAccount: PublicKey, owner: PublicKey, payer?: PublicKey) => Promise<PublicKey | undefined>;
createProfileWithDomain: (metadataUri: string, domainName: string, authority: PublicKey, payer?: PublicKey) => Promise<PublicKey | undefined>;
createProfileIxMethodBuilder: (metadataUri: string, screenNameAccount: PublicKey, authority: PublicKey, payer: PublicKey) => Promise<{
instructionMethodBuilder: _project_serum_anchor_dist_cjs_program_namespace_methods.MethodsBuilder<_gumhq_sdk_lib_idl_gpl_core.GplCore, {
name: "createProfile";
accounts: [{
name: "payer";
isMut: true;
isSigner: true;
}, {
name: "profile";
isMut: true;
isSigner: false;
pda: {
seeds: [{
kind: "const";
type: "string";
value: "profile";
}, {
kind: "arg";
type: {
array: ["u8", 32];
};
path: "random_hash";
}];
};
}, {
name: "screenName";
isMut: false;
isSigner: false;
docs: ["CHECK that this PDA is either SNS, ANS or GPL Nameservice"];
}, {
name: "authority";
isMut: false;
isSigner: true;
}, {
name: "systemProgram";
isMut: false;
isSigner: false;
}];
args: [{
name: "randomHash";
type: {
array: ["u8", 32];
};
}, {
name: "metadataUri";
type: "string";
}];
} & {
name: "createProfile";
}>;
profilePDA: PublicKey;
} | null>;
};
declare const useBadge: (sdk: SDK) => {
isProcessing: boolean;
processingError: Error | null;
createBadge: (metadataUri: string, issuer: PublicKey, schema: PublicKey, holder: PublicKey, updateAuthority: PublicKey, authority: PublicKey) => Promise<PublicKey | undefined>;
updateBadge: (metadataUri: string, badgeAccount: PublicKey, issuer: PublicKey, schema: PublicKey, signer: PublicKey) => Promise<void>;
createIssuer: (authority: PublicKey) => Promise<PublicKey | undefined>;
createSchema: (metadataUri: string, authority: PublicKey) => Promise<PublicKey | undefined>;
issueGatewayBadge: (wallet: WalletContextState, holderWallet: PublicKey, holderProfile: PublicKey, schemaAccount: PublicKey, issuer: PublicKey, gumTld: PublicKey, appId: string, dateJoined: string, authority: PublicKey, updateAuthority?: PublicKey) => Promise<PublicKey | undefined>;
};
declare const useDomains: (sdk: SDK, authority: PublicKey) => {
userDomainAccounts: any;
domainsLoading: boolean;
domainsError: Error | null;
};
declare const useNameService: (sdk: SDK) => {
isCreating: boolean;
creationError: Error | null;
getOrCreateDomain: (tldPDA: PublicKey, domain: string, authority: PublicKey) => Promise<PublicKey | undefined>;
transferDomain: (domainPDA: PublicKey, currentAuthority: PublicKey, newAuthority: PublicKey) => Promise<void>;
};
declare const usePost: (sdk: SDK, postAccount: PublicKey) => {
post: any;
postLoading: boolean;
postError: Error | null;
};
type sendTransactionFn$3 = <T extends Transaction>(transaction: T, connection?: Connection, options?: SendTransactionOptions) => Promise<string>;
declare const useCreatePost: (sdk: SDK) => {
create: (metadataUri: string, profileAccount: PublicKey, owner: PublicKey, payer?: PublicKey) => Promise<string | undefined>;
createWithSession: (metadataUri: string, profileAccount: PublicKey, sessionPublicKey: PublicKey, sessionAccount: PublicKey, sendTransaction: sendTransactionFn$3, payer?: PublicKey, connection?: Connection, options?: SendTransactionOptions) => Promise<string | undefined>;
createPostIxMethodBuilder: (metadataUri: string, profileAccount: PublicKey, owner: PublicKey, payer?: PublicKey) => Promise<_project_serum_anchor_dist_cjs_program_namespace_methods.MethodsBuilder<_gumhq_sdk_lib_idl_gpl_core.GplCore, {
name: "createPost";
accounts: [{
name: "payer";
isMut: true;
isSigner: true;
}, {
name: "post";
isMut: true;
isSigner: false;
pda: {
seeds: [{
kind: "const";
type: "string";
value: "post";
}, {
kind: "arg";
type: {
array: ["u8", 32];
};
path: "random_hash";
}];
};
}, {
name: "profile";
isMut: false;
isSigner: false;
pda: {
seeds: [{
kind: "const";
type: "string";
value: "profile";
}, {
kind: "account";
type: {
array: ["u8", 32];
};
account: "Profile";
path: "profile.random_hash";
}];
};
}, {
name: "sessionToken";
isMut: false;
isSigner: false;
isOptional: true;
}, {
name: "authority";
isMut: false;
isSigner: true;
}, {
name: "systemProgram";
isMut: false;
isSigner: false;
}];
args: [{
name: "metadataUri";
type: "string";
}, {
name: "randomHash";
type: {
array: ["u8", 32];
};
}];
} & {
name: "createPost";
}> | null>;
createPostWithSessionIxMethodBuilder: (metadataUri: string, profileAccount: PublicKey, sessionPublicKey: PublicKey, sessionAccount: PublicKey, payer?: PublicKey) => Promise<_project_serum_anchor_dist_cjs_program_namespace_methods.MethodsBuilder<_gumhq_sdk_lib_idl_gpl_core.GplCore, {
name: "createPost";
accounts: [{
name: "payer";
isMut: true;
isSigner: true;
}, {
name: "post";
isMut: true;
isSigner: false;
pda: {
seeds: [{
kind: "const";
type: "string";
value: "post";
}, {
kind: "arg";
type: {
array: ["u8", 32];
};
path: "random_hash";
}];
};
}, {
name: "profile";
isMut: false;
isSigner: false;
pda: {
seeds: [{
kind: "const";
type: "string";
value: "profile";
}, {
kind: "account";
type: {
array: ["u8", 32];
};
account: "Profile";
path: "profile.random_hash";
}];
};
}, {
name: "sessionToken";
isMut: false;
isSigner: false;
isOptional: true;
}, {
name: "authority";
isMut: false;
isSigner: true;
}, {
name: "systemProgram";
isMut: false;
isSigner: false;
}];
args: [{
name: "metadataUri";
type: "string";
}, {
name: "randomHash";
type: {
array: ["u8", 32];
};
}];
} & {
name: "createPost";
}> | null>;
postPDA: PublicKey | null;
isCreatingPost: boolean;
createPostError: Error | null;
};
declare const useFeed: (sdk: SDK, profileAccount: PublicKey) => {
feedData: any;
feedLoading: boolean;
feedError: Error | null;
};
declare const useExploreFeed: (sdk: SDK) => {
exploreFeedData: any;
exploreFeedLoading: boolean;
exploreFeedError: Error | null;
};
type sendTransactionFn$2 = <T extends Transaction>(transaction: T, connection?: Connection, options?: SendTransactionOptions) => Promise<string>;
declare const useReaction: (sdk: SDK) => {
createReaction: (reaction: string, fromProfile: PublicKey, toPostAccount: PublicKey, owner: PublicKey, payer?: PublicKey) => Promise<string | undefined>;
createReactionWithSession: (reaction: string, fromProfile: PublicKey, toPostAccount: PublicKey, sessionPublicKey: PublicKey, sessionAccount: PublicKey, payer: PublicKey | undefined, sendTransactionFn: sendTransactionFn$2, connection?: Connection, options?: SendTransactionOptions) => Promise<string | undefined>;
createReactionIxMethodBuilder: (reaction: string, fromProfile: PublicKey, toPostAccount: PublicKey, owner: PublicKey, payer?: PublicKey) => Promise<_project_serum_anchor_dist_cjs_program_namespace_methods.MethodsBuilder<_gumhq_sdk_lib_idl_gpl_core.GplCore, {
name: "createReaction";
accounts: [{
name: "payer";
isMut: true;
isSigner: true;
}, {
name: "reaction";
isMut: true;
isSigner: false;
pda: {
seeds: [{
kind: "const";
type: "string";
value: "reaction";
}, {
kind: "arg";
type: "string";
path: "reaction_type";
}, {
kind: "account";
type: "publicKey";
account: "Post";
path: "to_post";
}, {
kind: "account";
type: "publicKey";
account: "Profile";
path: "from_profile";
}];
};
}, {
name: "toPost";
isMut: false;
isSigner: false;
}, {
name: "fromProfile";
isMut: false;
isSigner: false;
pda: {
seeds: [{
kind: "const";
type: "string";
value: "profile";
}, {
kind: "account";
type: {
array: ["u8", 32];
};
account: "Profile";
path: "from_profile.random_hash";
}];
};
}, {
name: "sessionToken";
isMut: false;
isSigner: false;
isOptional: true;
}, {
name: "authority";
isMut: false;
isSigner: true;
}, {
name: "systemProgram";
isMut: false;
isSigner: false;
}];
args: [{
name: "reactionType";
type: "string";
}];
} & {
name: "createReaction";
}> | null>;
createReactionWithSessionIxMethodBuilder: (reaction: string, fromProfile: PublicKey, toPostAccount: PublicKey, sessionPublicKey: PublicKey, sessionTokenAccount: PublicKey, payer?: PublicKey) => Promise<_project_serum_anchor_dist_cjs_program_namespace_methods.MethodsBuilder<_gumhq_sdk_lib_idl_gpl_core.GplCore, {
name: "createReaction";
accounts: [{
name: "payer";
isMut: true;
isSigner: true;
}, {
name: "reaction";
isMut: true;
isSigner: false;
pda: {
seeds: [{
kind: "const";
type: "string";
value: "reaction";
}, {
kind: "arg";
type: "string";
path: "reaction_type";
}, {
kind: "account";
type: "publicKey";
account: "Post";
path: "to_post";
}, {
kind: "account";
type: "publicKey";
account: "Profile";
path: "from_profile";
}];
};
}, {
name: "toPost";
isMut: false;
isSigner: false;
}, {
name: "fromProfile";
isMut: false;
isSigner: false;
pda: {
seeds: [{
kind: "const";
type: "string";
value: "profile";
}, {
kind: "account";
type: {
array: ["u8", 32];
};
account: "Profile";
path: "from_profile.random_hash";
}];
};
}, {
name: "sessionToken";
isMut: false;
isSigner: false;
isOptional: true;
}, {
name: "authority";
isMut: false;
isSigner: true;
}, {
name: "systemProgram";
isMut: false;
isSigner: false;
}];
args: [{
name: "reactionType";
type: "string";
}];
} & {
name: "createReaction";
}> | null>;
deleteReaction: (reactionAccount: PublicKey, fromProfile: PublicKey, toPostAccount: PublicKey, owner: PublicKey, refundReceiver?: PublicKey) => Promise<string | undefined>;
deleteReactionWithSession: (reactionAccount: PublicKey, fromProfile: PublicKey, toPostAccount: PublicKey, sessionPublicKey: PublicKey, sessionAccount: PublicKey, refundReceiver: PublicKey | undefined, sendTransaction: sendTransactionFn$2, connection?: Connection, options?: SendTransactionOptions) => Promise<string | undefined>;
deleteReactionIxMethodBuilder: (reactionAccount: PublicKey, fromProfile: PublicKey, toPostAccount: PublicKey, owner: PublicKey, refundReceiver?: PublicKey) => _project_serum_anchor_dist_cjs_program_namespace_methods.MethodsBuilder<_gumhq_sdk_lib_idl_gpl_core.GplCore, {
name: "deleteReaction";
accounts: [{
name: "reaction";
isMut: true;
isSigner: false;
pda: {
seeds: [{
kind: "const";
type: "string";
value: "reaction";
}, {
kind: "account";
type: "string";
account: "Reaction";
path: "reaction.reaction_type";
}, {
kind: "account";
type: "publicKey";
account: "Reaction";
path: "reaction.to_post";
}, {
kind: "account";
type: "publicKey";
account: "Reaction";
path: "reaction.from_profile";
}];
};
relations: ["to_post", "from_profile"];
}, {
name: "toPost";
isMut: false;
isSigner: false;
}, {
name: "fromProfile";
isMut: false;
isSigner: false;
pda: {
seeds: [{
kind: "const";
type: "string";
value: "profile";
}, {
kind: "account";
type: {
array: ["u8", 32];
};
account: "Profile";
path: "from_profile.random_hash";
}];
};
}, {
name: "sessionToken";
isMut: false;
isSigner: false;
isOptional: true;
}, {
name: "authority";
isMut: true;
isSigner: true;
}, {
name: "refundReceiver";
isMut: true;
isSigner: false;
}, {
name: "systemProgram";
isMut: false;
isSigner: false;
}];
args: [];
} & {
name: "deleteReaction";
}> | null;
deleteReactionWithSessionIxMethodBuilder: (reactionAccount: PublicKey, fromProfile: PublicKey, toPostAccount: PublicKey, sessionPublicKey: PublicKey, sessionAccount: PublicKey, refundReceiver?: PublicKey) => _project_serum_anchor_dist_cjs_program_namespace_methods.MethodsBuilder<_gumhq_sdk_lib_idl_gpl_core.GplCore, {
name: "deleteReaction";
accounts: [{
name: "reaction";
isMut: true;
isSigner: false;
pda: {
seeds: [{
kind: "const";
type: "string";
value: "reaction";
}, {
kind: "account";
type: "string";
account: "Reaction";
path: "reaction.reaction_type";
}, {
kind: "account";
type: "publicKey";
account: "Reaction";
path: "reaction.to_post";
}, {
kind: "account";
type: "publicKey";
account: "Reaction";
path: "reaction.from_profile";
}];
};
relations: ["to_post", "from_profile"];
}, {
name: "toPost";
isMut: false;
isSigner: false;
}, {
name: "fromProfile";
isMut: false;
isSigner: false;
pda: {
seeds: [{
kind: "const";
type: "string";
value: "profile";
}, {
kind: "account";
type: {
array: ["u8", 32];
};
account: "Profile";
path: "from_profile.random_hash";
}];
};
}, {
name: "sessionToken";
isMut: false;
isSigner: false;
isOptional: true;
}, {
name: "authority";
isMut: true;
isSigner: true;
}, {
name: "refundReceiver";
isMut: true;
isSigner: false;
}, {
name: "systemProgram";
isMut: false;
isSigner: false;
}];
args: [];
} & {
name: "deleteReaction";
}> | null;
reactionPDA: PublicKey | null;
isReacting: boolean;
createReactionError: null;
};
type sendTransactionFn$1 = <T extends Transaction>(transaction: T, connection?: Connection, options?: SendTransactionOptions) => Promise<string>;
declare const useFollow: (sdk: SDK) => {
follow: (fromProfile: PublicKey, toProfile: PublicKey, owner: PublicKey, payer?: PublicKey) => Promise<string | undefined>;
followWithSession: (fromProfile: PublicKey, toProfile: PublicKey, sessionPublicKey: PublicKey, sessionAccount: PublicKey, sendTransaction: sendTransactionFn$1, payer?: PublicKey, connection?: Connection, options?: SendTransactionOptions) => Promise<string | undefined>;
createConnectionIxMethodBuilder: (fromProfile: PublicKey, toProfile: PublicKey, owner: PublicKey, payer?: PublicKey) => Promise<_project_serum_anchor_dist_cjs_program_namespace_methods.MethodsBuilder<_gumhq_sdk_lib_idl_gpl_core.GplCore, {
name: "createConnection";
accounts: [{
name: "payer";
isMut: true;
isSigner: true;
}, {
name: "connection";
isMut: true;
isSigner: false;
pda: {
seeds: [{
kind: "const";
type: "string";
value: "connection";
}, {
kind: "account";
type: "publicKey";
account: "Profile";
path: "from_profile";
}, {
kind: "account";
type: "publicKey";
account: "Profile";
path: "to_profile";
}];
};
}, {
name: "fromProfile";
isMut: false;
isSigner: false;
pda: {
seeds: [{
kind: "const";
type: "string";
value: "profile";
}, {
kind: "account";
type: {
array: ["u8", 32];
};
account: "Profile";
path: "from_profile.random_hash";
}];
};
}, {
name: "toProfile";
isMut: false;
isSigner: false;
}, {
name: "sessionToken";
isMut: false;
isSigner: false;
isOptional: true;
}, {
name: "authority";
isMut: false;
isSigner: true;
}, {
name: "systemProgram";
isMut: false;
isSigner: false;
}];
args: [];
} & {
name: "createConnection";
}> | null>;
createConnectionWithSessionIxMethodBuilder: (fromProfile: PublicKey, toProfile: PublicKey, sessionPublicKey: PublicKey, sessionAccount: PublicKey, payer?: PublicKey) => Promise<_project_serum_anchor_dist_cjs_program_namespace_methods.MethodsBuilder<_gumhq_sdk_lib_idl_gpl_core.GplCore, {
name: "createConnection";
accounts: [{
name: "payer";
isMut: true;
isSigner: true;
}, {
name: "connection";
isMut: true;
isSigner: false;
pda: {
seeds: [{
kind: "const";
type: "string";
value: "connection";
}, {
kind: "account";
type: "publicKey";
account: "Profile";
path: "from_profile";
}, {
kind: "account";
type: "publicKey";
account: "Profile";
path: "to_profile";
}];
};
}, {
name: "fromProfile";
isMut: false;
isSigner: false;
pda: {
seeds: [{
kind: "const";
type: "string";
value: "profile";
}, {
kind: "account";
type: {
array: ["u8", 32];
};
account: "Profile";
path: "from_profile.random_hash";
}];
};
}, {
name: "toProfile";
isMut: false;
isSigner: false;
}, {
name: "sessionToken";
isMut: false;
isSigner: false;
isOptional: true;
}, {
name: "authority";
isMut: false;
isSigner: true;
}, {
name: "systemProgram";
isMut: false;
isSigner: false;
}];
args: [];
} & {
name: "createConnection";
}> | null>;
connectionPDA: PublicKey | null;
connectionLoading: boolean;
connectionError: Error | null;
};
type sendTransactionFn = <T extends Transaction>(transaction: T, connection?: Connection, options?: SendTransactionOptions) => Promise<string>;
declare const useUnfollow: (sdk: SDK) => {
unfollow: (connectionAccount: PublicKey, fromProfile: PublicKey, toProfile: PublicKey, owner: PublicKey, refundReceiver?: PublicKey) => Promise<string | undefined>;
unfollowWithSession: (connectionAccount: PublicKey, fromProfile: PublicKey, toProfile: PublicKey, sessionPublicKey: PublicKey, sessionAccount: PublicKey, sendTransaction: sendTransactionFn, refundReceiver?: PublicKey, connection?: Connection, options?: SendTransactionOptions) => Promise<string | undefined>;
deleteConnectionIxMethodBuilder: (connectionAccount: PublicKey, fromProfile: PublicKey, toProfile: PublicKey, owner: PublicKey, refundReceiver?: PublicKey) => Promise<_project_serum_anchor_dist_cjs_program_namespace_methods.MethodsBuilder<_gumhq_sdk_lib_idl_gpl_core.GplCore, {
name: "deleteConnection";
accounts: [{
name: "connection";
isMut: true;
isSigner: false;
pda: {
seeds: [{
kind: "const";
type: "string";
value: "connection";
}, {
kind: "account";
type: "publicKey";
account: "Profile";
path: "from_profile";
}, {
kind: "account";
type: "publicKey";
account: "Profile";
path: "to_profile";
}];
};
relations: ["from_profile", "to_profile"];
}, {
name: "fromProfile";
isMut: false;
isSigner: false;
pda: {
seeds: [{
kind: "const";
type: "string";
value: "profile";
}, {
kind: "account";
type: {
array: ["u8", 32];
};
account: "Profile";
path: "from_profile.random_hash";
}];
};
}, {
name: "toProfile";
isMut: false;
isSigner: false;
}, {
name: "sessionToken";
isMut: false;
isSigner: false;
isOptional: true;
}, {
name: "authority";
isMut: true;
isSigner: true;
}, {
name: "refundReceiver";
isMut: true;
isSigner: false;
}, {
name: "systemProgram";
isMut: false;
isSigner: false;
}];
args: [];
} & {
name: "deleteConnection";
}> | null>;
deleteConnectionWithSessionIxMethodBuilder: (connectionAccount: PublicKey, fromProfile: PublicKey, toProfile: PublicKey, sessionPublicKey: PublicKey, sessionAccount: PublicKey, refundReceiver?: PublicKey) => Promise<_project_serum_anchor_dist_cjs_program_namespace_methods.MethodsBuilder<_gumhq_sdk_lib_idl_gpl_core.GplCore, {
name: "deleteConnection";
accounts: [{
name: "connection";
isMut: true;
isSigner: false;
pda: {
seeds: [{
kind: "const";
type: "string";
value: "connection";
}, {
kind: "account";
type: "publicKey";
account: "Profile";
path: "from_profile";
}, {
kind: "account";
type: "publicKey";
account: "Profile";
path: "to_profile";
}];
};
relations: ["from_profile", "to_profile"];
}, {
name: "fromProfile";
isMut: false;
isSigner: false;
pda: {
seeds: [{
kind: "const";
type: "string";
value: "profile";
}, {
kind: "account";
type: {
array: ["u8", 32];
};
account: "Profile";
path: "from_profile.random_hash";
}];
};
}, {
name: "toProfile";
isMut: false;
isSigner: false;
}, {
name: "sessionToken";
isMut: false;
isSigner: false;
isOptional: true;
}, {
name: "authority";
isMut: true;
isSigner: true;
}, {
name: "refundReceiver";
isMut: true;
isSigner: false;
}, {
name: "systemProgram";
isMut: false;
isSigner: false;
}];
args: [];
} & {
name: "deleteConnection";
}> | null>;
connectionLoading: boolean;
connectionError: Error | null;
};
interface SessionWalletInterface {
publicKey: PublicKey | null;
ownerPublicKey: PublicKey | null;
isLoading: boolean;
error: string | null;
sessionToken: string | null;
signTransaction: (<T extends Transaction>(transaction: T) => Promise<T>) | undefined;
signAllTransactions: (<T extends Transaction>(transactions: T[]) => Promise<T[]>) | undefined;
signMessage: ((message: Uint8Array) => Promise<Uint8Array>) | undefined;
sendTransaction: (<T extends Transaction>(transaction: T, connection?: Connection, options?: SendTransactionOptions) => Promise<string>) | undefined;
signAndSendTransaction: (<T extends Transaction>(transactions: T | T[], connection?: Connection, options?: SendTransactionOptions) => Promise<string[]>) | undefined;
createSession: (targetProgram: PublicKey, topUp: boolean, validUntil?: number, sessionCreatedCallback?: (sessionInfo: {
sessionToken: string;
publicKey: string;
}) => void) => Promise<SessionWalletInterface | undefined>;
revokeSession: () => Promise<string | null>;
getSessionToken: () => Promise<string | null>;
}
declare function useSessionKeyManager(wallet: AnchorWallet, connection: Connection, cluster: Cluster | "localnet"): SessionWalletInterface;
interface Uploader {
upload(data: string | object | File, wallet: WalletContextState | SessionWalletInterface): Promise<{
url: string;
signature: string;
}>;
}
declare const useUploader: (uploaderType: 'arweave' | 'genesysgo' | 'custom', connection: Connection, cluster: "devnet" | "mainnet-beta", customUploaderInstance?: Uploader) => {
handleUpload: (data: string | object | File | ShadowFile, wallet: WalletContextState | SessionWalletInterface) => Promise<{
url: string;
signature: string;
} | undefined>;
uploading: boolean;
error: string | null;
};
interface ArweaveStorageHook {
uploadData: (data: any, wallet: WalletContextState | SessionWalletInterface) => Promise<{
url: string | null;
signature: string | null;
error: string | null;
}>;
getAccountBalance: () => Promise<number>;
estimateMinimumFunds: (data: any) => Promise<number>;
estimateUploadPriceInSol: (data: any) => Promise<number>;
fundStorageNode: (amount: number) => Promise<FundResponse>;
}
declare const useArweaveStorage: (connection: Connection, cluster: "devnet" | "mainnet-beta") => ArweaveStorageHook;
interface ShadowStorageInterface {
uploadData: (data: File | ShadowFile, wallet: WalletContextState | SessionWalletInterface, storageAccount?: PublicKey) => Promise<ShadowUploadResponse | null | undefined>;
getOwnedStorageAccounts: (wallet: WalletContextState | SessionWalletInterface) => Promise<StorageAccountResponse[]>;
createStorageAccount: (name: string, sizeInMB: number, wallet: WalletContextState | SessionWalletInterface, owner2?: PublicKey) => Promise<CreateStorageResponse | null>;
}
/**
* Custom React hook to interact with the Shadow Drive storage system.
*
* @param wallet - The wallet object, which should be of type WalletContextState or SessionWalletInterface.
* @param connection - The connection object, which should be of type Connection from the @solana/web3.js package.
* @returns An object containing methods to upload data, manage storage accounts, and interact with the Shadow token (SHDW).
*/
declare const useShadowStorage: (connection: Connection) => ShadowStorageInterface;
declare const useGum: (wallet: AnchorWallet, connection: Connection, opts: ConfirmOptions, cluster: Cluster | "localnet", graphqlClient?: GraphQLClient) => SDK;
interface GumContextValue {
sdk: SDK;
}
interface GumProviderProps {
children: ReactNode;
sdk: SDK;
}
declare const GumProvider: React.FC<GumProviderProps>;
declare const useGumContext: () => GumContextValue;
declare const useSessionWallet: () => SessionWalletInterface;
interface SessionWalletProviderProps {
sessionWallet: SessionWalletInterface;
children: React.ReactNode;
}
declare const SessionWalletProvider: React.FC<SessionWalletProviderProps>;
interface UploaderContextValue {
handleUpload: (data: string | object | File | ShadowFile, wallet: WalletContextState | SessionWalletInterface) => Promise<{
url: string;
signature: string;
} | undefined>;
uploading: boolean;
error: string | null;
}
interface UploaderProviderProps {
uploaderType: 'arweave' | 'genesysgo' | 'custom';
connection: Connection;
cluster: 'devnet' | 'mainnet-beta';
customUploaderInstance?: Uploader;
children: ReactNode;
}
declare const useUploaderContext: () => UploaderContextValue;
declare const UploaderProvider: ({ uploaderType, connection, cluster, customUploaderInstance, children, }: UploaderProviderProps) => JSX.Element;
export { GumProvider, SessionWalletInterface, SessionWalletProvider, UploaderProvider, useArweaveStorage, useBadge, useCreatePost, useCreateProfile, useDomains, useExploreFeed, useFeed, useFollow, useGum, useGumContext, useNameService, usePost, useProfile, useReaction, useSessionKeyManager, useSessionWallet, useShadowStorage, useUnfollow, useUploader, useUploaderContext };