Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow the passing of connection configuration options to the widget #80

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions src/contexts/ContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const HARDCODED_WALLET_STANDARDS: { id: string; name: WalletName; url: st
];

const noop = () => {};
const WalletContextProvider: React.FC<PropsWithChildren<IInit>> = ({ autoConnect, endpoint, children }) => {
const WalletContextProvider: React.FC<PropsWithChildren<IInit>> = ({ autoConnect, endpoint, endpointConfig, children }) => {
const { networkConfiguration } = useNetworkConfiguration();
const network = networkConfiguration as WalletAdapterNetwork;
const selectedEndpoint: string = useMemo(() => endpoint ?? clusterApiUrl(network), [endpoint, network]);
Expand Down Expand Up @@ -126,7 +126,7 @@ const WalletContextProvider: React.FC<PropsWithChildren<IInit>> = ({ autoConnect

return (
<>
<ConnectionProvider endpoint={selectedEndpoint}>
<ConnectionProvider endpoint={selectedEndpoint} config={endpointConfig}>
<ShouldWrapWalletProvider>{children}</ShouldWrapWalletProvider>
</ConnectionProvider>
{showWalletStatus.show && showWalletStatus.message ? (
Expand Down
7 changes: 6 additions & 1 deletion src/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CSSProperties } from 'react';
import { Root } from 'react-dom/client';
import { createStore } from 'jotai';
import { Wallet } from '@jup-ag/wallet-adapter';
import { PublicKey, TransactionError } from '@solana/web3.js';
import { ConnectionConfig, PublicKey, TransactionError } from '@solana/web3.js';
import { QuoteResponseMeta, SwapMode, SwapResult } from '@jup-ag/react-hook';
import { WalletContextState } from '@jup-ag/wallet-adapter';
import EventEmitter from 'events';
Expand Down Expand Up @@ -73,6 +73,11 @@ export interface IOnRequestIxCallback {
export interface IInit {
/** Solana RPC endpoint */
endpoint: string;
/**
* Configuration for instantiating a Solana RPC Connection object.
* [`ConnectionConfig` docs](https://solana-labs.github.io/solana-web3.js/classes/Connection.html)
*/
endpointConfig?: ConnectionConfig;
/** TODO: Update to use the new platform fee and accounts */
platformFeeAndAccounts?: PlatformFeeAndAccounts;
/** Configure Terminal's behaviour and allowed actions for your user */
Expand Down