Skip to content

Commit

Permalink
update compat readme to include instructions (#57)
Browse files Browse the repository at this point in the history
* docs: readme

* Update packages/compat/README.md

Co-authored-by: Callum McIntyre <[email protected]>

---------

Co-authored-by: Callum McIntyre <[email protected]>
  • Loading branch information
nickfrosty and mcintyre94 authored Jan 13, 2025
1 parent 1e47a5e commit 9029dc1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/rotten-dryers-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@solana/compat': patch
---

updated readme to include instruction compat functions
14 changes: 13 additions & 1 deletion packages/compat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { fromLegacyKeypair } from '@solana/compat';
const { privateKey, publicKey } = await fromLegacyKeypair(Keypair.generate());
```

### `fromVersionedTransaction`
### `fromVersionedTransaction()`

This can be used to convert a legacy `VersionedTransaction` object to a `Transaction` object.

Expand All @@ -44,3 +44,15 @@ import { fromVersionedTransaction } from '@solana/compat';
const legacyVersionedTransaction = getMyLegacyVersionedTransaction();
const transaction = fromVersionedTransaction(legacyVersionedTransaction);
```

### `fromLegacyTransactionInstruction()`

This can be used to convert a legacy `TransactionInstruction` object to a `IInstruction` object.

```ts
import { fromLegacyTransactionInstruction } from '@solana/compat';

// imagine a function that returns a legacy `TransactionInstruction`
const legacyInstruction = getMyLegacyInstruction();
const instruction = fromLegacyTransactionInstruction(legacyInstruction);
```

0 comments on commit 9029dc1

Please sign in to comment.