Skip to content

Commit

Permalink
Allow specifying broadcast connections to use-solana (#622)
Browse files Browse the repository at this point in the history
  • Loading branch information
macalinao committed Jun 1, 2022
1 parent c6fe08f commit 6195f12
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions packages/use-solana/src/context.tsx
Expand Up @@ -18,7 +18,7 @@ import type {
ConnectionContext,
} from "./utils/useConnectionInternal";
import { useConnectionInternal } from "./utils/useConnectionInternal";
import type { UseProvider } from "./utils/useProviderInternal";
import type { UseProvider, UseProviderArgs } from "./utils/useProviderInternal";
import { useProviderInternal } from "./utils/useProviderInternal";
import type { UseWallet, UseWalletArgs } from "./utils/useWalletInternal";
import { useWalletInternal } from "./utils/useWalletInternal";
Expand All @@ -38,7 +38,8 @@ export interface UseSolanaArgs<
UseWalletArgs<WalletType>,
"onConnect" | "onDisconnect" | "storageAdapter" | "walletProviders"
>
> {
>,
Pick<UseProviderArgs, "broadcastConnections" | "confirmOptions"> {
/**
* Called when an error is thrown.
*/
Expand Down Expand Up @@ -79,6 +80,11 @@ const useSolanaInternal = <WalletType extends WalletTypeEnum<WalletType>>({
onError = defaultOnError,
storageAdapter = LOCAL_STORAGE_ADAPTER,
walletProviders = DEFAULT_WALLET_PROVIDERS as unknown as WalletProviderMap<WalletType>,

// useProvider args
broadcastConnections,
confirmOptions,

...connectionArgs
}: UseSolanaArgs<WalletType> = {}): UseSolana<WalletType> => {
const connectionCtx = useConnectionInternal({
Expand All @@ -98,6 +104,11 @@ const useSolanaInternal = <WalletType extends WalletTypeEnum<WalletType>>({
const providerCtx = useProviderInternal({
connection: connectionCtx.connection,
wallet: walletCtx.wallet,
sendConnection: connectionCtx.sendConnection,
commitment: connectionArgs.commitment,

broadcastConnections,
confirmOptions,
});

return {
Expand Down

0 comments on commit 6195f12

Please sign in to comment.