Skip to content

Remove Anchor dependency #74

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

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
75 changes: 0 additions & 75 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ Error Handling & Utilities:

[Get a Solana Explorer link for a transaction, address, or block](#get-a-solana-explorer-link-for-a-transaction-address-or-block)

Anchor Program Interaction:
[Parse account data with IDL](#parse-account-data-with-idl)

[Parse transaction events](#parse-transaction-events)

[Decode Anchor transaction](#decode-anchor-transaction)

## Installation

```bash
Expand Down Expand Up @@ -567,71 +560,3 @@ await prepareTransactionWithCompute(
```

Both functions help with common transaction handling tasks in Solana, making it easier to send reliable transactions with appropriate compute unit settings.

## Anchor IDL Utilities

### Parse Account Data with IDL

Usage:

```typescript
const accountData = await getIdlParsedAccountData(
"./idl/program.json",
"counter",
accountAddress,
connection,
);

// Decoded Data: { count: <BN: 2> }
```

Fetches and parses an account's data using an Anchor IDL file. This is useful when you need to decode account data from Anchor programs.

### Parse Transaction Events

Usage:

```typescript
const events = await parseAnchorTransactionEvents(
"./idl/program.json",
signature,
connection,
);

// Events will be an array of:
// {
// name: "GameCreated",
// data: { gameId: "123", player: "..." }
// }
```

Parses all Anchor events emitted in a transaction. This helps you track and verify program events after transaction execution.

### Decode Anchor Transaction

Usage:

```typescript
const decoded = await decodeAnchorTransaction(
"./idl/program.json",
signature,
connection,
);

// Print human-readable format
console.log(decoded.toString());

// Access specific instruction data
decoded.instructions.forEach((ix) => {
console.log(`Instruction: ${ix.name}`);
console.log(`Arguments: ${JSON.stringify(ix.data)}`);
console.log(`Accounts: ${ix.accounts.map((acc) => acc.name).join(", ")}`);
});
```

Provides detailed decoding of all Anchor instructions in a transaction, including:

- Instruction names and arguments
- All involved accounts with their roles (signer/writable)
- Account data for program-owned accounts
- Human-readable string representation
158 changes: 0 additions & 158 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@
"@solana/spl-token-metadata": "^0.1.4",
"@solana/web3.js": "^1.98.0",
"bs58": "^6.0.0",
"dotenv": "^16.4.5",
"@coral-xyz/anchor": "^0.30.1"
"dotenv": "^16.4.5"
},
"devDependencies": {
"@types/node": "^20.16.1",
Expand Down
Loading