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

chore: constrain the connection input of sendTransaction to the minimum interface actually required #848

Closed
wants to merge 1 commit into from

Conversation

steveluscher
Copy link
Collaborator

The sendTransaction() method takes in a Connection from @solana/web3.js but actually requires very little of it; just commitment, sendRawTransaction(), and getLatestBlockhash().

In this PR we constrain the interface to exactly that and no more. This will make it easier to supply non @solana/web3.js implementations at that callsite, so long as they can fulfil the same contract.

Comment on lines +8 to +21
type BlockhashFetcher = (config?: {
commitment?: Commitment;
minContextSlot?: number;
}) => Promise<{ blockhash: string }>;

export interface ConnectionContext {
commitment?: Commitment;
getLatestBlockhash: BlockhashFetcher;
sendRawTransaction(
rawTransaction: Buffer | Uint8Array | Array<number>,
options?: SendOptions
): Promise<TransactionSignature>;
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Start here.

packages/wallets/censo/src/adapter.ts Outdated Show resolved Hide resolved
Copy link
Collaborator Author

Rebased. I still think this is worth doing. Are you opposed to this in any way @jordaaash?

@steveluscher steveluscher force-pushed the constrain-that-connection-interface branch from 8907d29 to a0ef497 Compare May 10, 2024 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants