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

How to get previousVersion in graphQL #17120

Open
Wangmmx opened this issue Apr 11, 2024 · 3 comments
Open

How to get previousVersion in graphQL #17120

Wangmmx opened this issue Apr 11, 2024 · 3 comments
Assignees
Labels

Comments

@Wangmmx
Copy link

Wangmmx commented Apr 11, 2024

As former jsonRpc api, there were previousVersion in objectChanges through method:sui_getTransactionBlock, but In graphQL, I can not find any type which contains previousVersion in the same transactionBlock. How can I get object previous version and now version? thanks

@Wangmmx
Copy link
Author

Wangmmx commented Apr 15, 2024

@wlmyng Could you please help me with this?

@FrankC01
Copy link

FrankC01 commented May 1, 2024

@Wangmmx
You may have found this already but (using testnet schema) on digest "BJYyvkTgZBuMgBx8MmgcGtBTYqYZwpFQcc2YHZq4A6Z8"

In the TransactionBlock's effects in the objectChanges nodes, note the input and output version numbers:

{
                    "address": "0x030d1254ab0d83a37397cb2df80341cc1862347da3c48e00c701edbc75f7c7bb",
                    "deleted": false,
                    "created": false,
                    "input_state": {
                        "bcs": "AAEBfCaXAQAAAAAoAw0SVKsNg6Nzl8st+ANBzBhiNH2jxI4AxwHtvHX3x7s3iHUMBgAAAACp4ts4XwVcwCFaPN4mi3YnBTW5RDgHUU8YO+hpJsIZ9CBTUOeevHCpDboGb8A+KbtEeZR4HWfLKdraen1fjBpQZmATDwAAAAAA",
                        "version": 26683004,
                        "object_digest": "3SVEP1qP49Ad94J3LZ3NytztQbcWSRMdpZzMuV7mkzjs",
                        "object_id": "0x030d1254ab0d83a37397cb2df80341cc1862347da3c48e00c701edbc75f7c7bb",
                        "object_kind": "HISTORICAL",
                        "owner": {
                            "owner": {
                                "address_id": "0xa9e2db385f055cc0215a3cde268b76270535b9443807514f183be86926c219f4"
                            },
                            "obj_owner_kind": "AddressOwner",
                        },
                        "storage_rebate": "988000",
                        "prior_transaction": {
                            "previous_transaction_digest": "6cEPi1Cmh9W1n18TcNYRd89zeBRXQCVbGr7LN1upRbuf"
                        },
                        "as_move_content": {
                            "has_public_transfer": true,
                            "as_object": {
                                "content": {
                                    "id": "0x030d1254ab0d83a37397cb2df80341cc1862347da3c48e00c701edbc75f7c7bb",
                                    "balance": {"value": "25978832951"},
                                },
                                "object_type_repr": {
                                    "object_type": "0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin<0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI>"
                                },
                            },
                        },
                    },
                    "output_state": {
                        "bcs": "AAEBfyaXAQAAAAAoAw0SVKsNg6Nzl8st+ANBzBhiNH2jxI4AxwHtvHX3x7stQN91BgAAAACp4ts4XwVcwCFaPN4mi3YnBTW5RDgHUU8YO+hpJsIZ9CCZE+eUfWWNLP7XhwMeVbqakViPlRXyndd10wQjKtJmk2ATDwAAAAAA",
                        "version": 26683007,
                        "object_digest": "EPoFGjy7cFyW6t9Ato8FUHzkw881EnkZMuC1Mdj9DUCJ",
                        "object_id": "0x030d1254ab0d83a37397cb2df80341cc1862347da3c48e00c701edbc75f7c7bb",
                        "object_kind": "HISTORICAL",
                        "owner": {
                            "owner": {
                                "address_id": "0xa9e2db385f055cc0215a3cde268b76270535b9443807514f183be86926c219f4"
                            },
                            "obj_owner_kind": "AddressOwner",
                        },
                        "storage_rebate": "988000",
                        "prior_transaction": {
                            "previous_transaction_digest": "BJYyvkTgZBuMgBx8MmgcGtBTYqYZwpFQcc2YHZq4A6Z8"
                        },
                        "as_move_content": {
                            "has_public_transfer": true,
                            "as_object": {
                                "content": {
                                    "id": "0x030d1254ab0d83a37397cb2df80341cc1862347da3c48e00c701edbc75f7c7bb",
                                    "balance": {"value": "27747369005"},
                                },
                                "object_type_repr": {
                                    "object_type": "0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin<0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI>"
                                },
                            },
                        },
                    },
                },

@FrankC01
Copy link

@Wangmmx

Above is stale in the sense that you can add the 'object_id' of interest to the transactionBlocks query and pass in the object_id for which to fetch all transactions where the object was changed. See the filter options on it, has changedObject

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants