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

feat(json-rpc): get transaction block raw effects #19438

Merged
merged 1 commit into from
Sep 18, 2024
Merged

Conversation

amnn
Copy link
Contributor

@amnn amnn commented Sep 18, 2024

Description

Add the ability to get transaction effects in BCS form, from JSON-RPC's read path, by passing the showRawEffects option.

Test plan

sui$ cargo build --bin sui --features indexer
sui$ $SUI start --force-regenesis --with-indexer --with-graphql --with-faucet

Then in another session:

sui$ $SUI client faucet

Find the transaction $DIGEST of the faucet transaction, and then fetch it with:

curl -LX POST  "http://localhost:9000" \
        --header 'Content-Type: application/json' \
        --data-raw '{
        "jsonrpc": "2.0",
        "method": "sui_getTransactionBlock",
        "id": 1,
        "params": ["'$DIGEST'", { "showRawEffects": true }]
}' | jq .

And corroborate it against the following GraphQL query:

query ($digest: String!) {
  transactionBlock(digest: $digest) {
    effects { bcs }
  }
}

Which can be requested at localhost:9125.


Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • Protocol:
  • Nodes (Validators and Full nodes): sui_getTransactionBlock and sui_multiGetTransactionBlock JSON-RPC endpoints will now heed the showRawEffects option, and return the BCS representation of the transaction effects.
  • Indexer:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:
  • REST API:

## Description

Add the ability to get transaction effects in BCS form, from JSON-RPC's
read path, by passing the `showRawEffects` option.

## Test plan

```
sui$ cargo build --bin sui --features indexer
sui$ $SUI start --force-regenesis --with-indexer --with-graphql --with-faucet
```

Then in another session:

```
sui$ $SUI client faucet
```

Find the transaction `$DIGEST` of the faucet transaction, and then fetch it
with:

```
curl -LX POST  "http://localhost:9000" \
        --header 'Content-Type: application/json' \
        --data-raw '{
        "jsonrpc": "2.0",
        "method": "sui_getTransactionBlock",
        "id": 1,
        "params": ["'$DIGEST'", { "showRawEffects": true }]
}' | jq .
```

And corroborate it against the following GraphQL query:

```
query ($digest: String!) {
  transactionBlock(digest: $digest) {
    effects { bcs }
  }
}
```

Which can be requested at `localhost:9125`.
@amnn amnn requested review from lxfind, tzakian and a team September 18, 2024 21:55
@amnn amnn self-assigned this Sep 18, 2024
Copy link

vercel bot commented Sep 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 18, 2024 10:02pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Sep 18, 2024 10:02pm
sui-kiosk ⬜️ Ignored (Inspect) Sep 18, 2024 10:02pm
sui-typescript-docs ⬜️ Ignored (Inspect) Sep 18, 2024 10:02pm

Copy link
Contributor

@tzakian tzakian left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you for this!

@amnn amnn merged commit 3c1c5ef into main Sep 18, 2024
49 of 50 checks passed
@amnn amnn deleted the amnn/rpc-tx-raw-eff branch September 18, 2024 22:35
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