-
Notifications
You must be signed in to change notification settings - Fork 11.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rpc-alt: getOwnedObjects type params filter
## Description Filter owned objects by it's type's type parameters. ## Test plan ``` sui$ cargo nextest run -p sui-indexer-alt-e2e-tests \ -- objects/query/by_type_params ```
- Loading branch information
Showing
3 changed files
with
253 additions
and
1 deletion.
There are no files selected for viewing
90 changes: 90 additions & 0 deletions
90
crates/sui-indexer-alt-e2e-tests/tests/jsonrpc/objects/query/by_type_params.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//# init --protocol-version 70 --accounts A B --addresses P=0x0 --simulator | ||
|
||
// 1. All the objects of a generic type instance, for a particular owner | ||
// 2. All the objects of another generic type instance, for that same owner | ||
// 3. ...limited | ||
// 4. ...limited, with a cursor | ||
|
||
//# publish | ||
module P::M { | ||
public struct O1<phantom T> has key, store { | ||
id: UID, | ||
} | ||
|
||
public fun o1<T>(ctx: &mut TxContext): O1<T> { | ||
O1 { id: object::new(ctx) } | ||
} | ||
} | ||
|
||
//# programmable --sender B --inputs @B | ||
//> 0: P::M::o1<u64>(); | ||
//> 1: TransferObjects([Result(0)], Input(0)) | ||
|
||
//# programmable --sender A --inputs @A | ||
//> 0: P::M::o1<u64>(); | ||
//> 1: P::M::o1<u32>(); | ||
//> 2: P::M::o1<u64>(); | ||
//> 3: TransferObjects([Result(0), Result(1), Result(2)], Input(0)) | ||
|
||
//# create-checkpoint | ||
|
||
//# programmable --sender A --inputs @A | ||
//> 0: P::M::o1<u32>(); | ||
//> 1: TransferObjects([Result(0)], Input(0)) | ||
|
||
//# create-checkpoint | ||
|
||
//# run-jsonrpc | ||
{ | ||
"method": "suix_getOwnedObjects", | ||
"params": [ | ||
"@{A}", | ||
{ | ||
"filter": { "StructType": "@{P}::M::O1<u64>" }, | ||
"options": { "showType": true } | ||
} | ||
] | ||
} | ||
|
||
//# run-jsonrpc | ||
{ | ||
"method": "suix_getOwnedObjects", | ||
"params": [ | ||
"@{A}", | ||
{ | ||
"filter": { "StructType": "@{P}::M::O1<u32>" }, | ||
"options": { "showType": true } | ||
} | ||
] | ||
} | ||
|
||
//# run-jsonrpc | ||
{ | ||
"method": "suix_getOwnedObjects", | ||
"params": [ | ||
"@{A}", | ||
{ | ||
"filter": { "StructType": "@{P}::M::O1<u32>" }, | ||
"options": { "showType": true } | ||
}, | ||
null, | ||
1 | ||
] | ||
} | ||
|
||
//# run-jsonrpc --cursors @{obj_5_0,2} | ||
{ | ||
"method": "suix_getOwnedObjects", | ||
"params": [ | ||
"@{A}", | ||
{ | ||
"filter": { "StructType": "@{P}::M::O1<u32>" }, | ||
"options": { "showType": true } | ||
}, | ||
"@{cursor_0}", | ||
1 | ||
] | ||
} |
147 changes: 147 additions & 0 deletions
147
crates/sui-indexer-alt-e2e-tests/tests/jsonrpc/objects/query/by_type_params.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
--- | ||
source: external-crates/move/crates/move-transactional-test-runner/src/framework.rs | ||
--- | ||
processed 11 tasks | ||
|
||
init: | ||
A: object(0,0), B: object(0,1) | ||
|
||
task 1, lines 11-20: | ||
//# publish | ||
created: object(1,0) | ||
mutated: object(0,2) | ||
gas summary: computation_cost: 1000000, storage_cost: 4696800, storage_rebate: 0, non_refundable_storage_fee: 0 | ||
|
||
task 2, lines 22-24: | ||
//# programmable --sender B --inputs @B | ||
//> 0: P::M::o1<u64>(); | ||
//> 1: TransferObjects([Result(0)], Input(0)) | ||
created: object(2,0) | ||
mutated: object(0,1) | ||
gas summary: computation_cost: 1000000, storage_cost: 2211600, storage_rebate: 0, non_refundable_storage_fee: 0 | ||
|
||
task 3, lines 26-30: | ||
//# programmable --sender A --inputs @A | ||
//> 0: P::M::o1<u64>(); | ||
//> 1: P::M::o1<u32>(); | ||
//> 2: P::M::o1<u64>(); | ||
//> 3: TransferObjects([Result(0), Result(1), Result(2)], Input(0)) | ||
created: object(3,0), object(3,1), object(3,2) | ||
mutated: object(0,0) | ||
gas summary: computation_cost: 1000000, storage_cost: 4658800, storage_rebate: 0, non_refundable_storage_fee: 0 | ||
|
||
task 4, line 32: | ||
//# create-checkpoint | ||
Checkpoint created: 1 | ||
|
||
task 5, lines 34-36: | ||
//# programmable --sender A --inputs @A | ||
//> 0: P::M::o1<u32>(); | ||
//> 1: TransferObjects([Result(0)], Input(0)) | ||
created: object(5,0) | ||
mutated: object(0,0) | ||
gas summary: computation_cost: 1000000, storage_cost: 2211600, storage_rebate: 978120, non_refundable_storage_fee: 9880 | ||
|
||
task 6, line 38: | ||
//# create-checkpoint | ||
Checkpoint created: 2 | ||
|
||
task 7, lines 40-50: | ||
//# run-jsonrpc | ||
Response: { | ||
"jsonrpc": "2.0", | ||
"id": 0, | ||
"result": { | ||
"data": [ | ||
{ | ||
"data": { | ||
"objectId": "0x9a80dfcde4a045e027dceaa9f60cd0c170743fa029d775b8b77657432053ebe7", | ||
"version": "2", | ||
"digest": "EeN99ChrMgtWcwzfyXKmbePCRJdNqMUAEAynADFjRHLE", | ||
"type": "0xb950fe2a124ab853efc3ee02166d1f5224b744789fdbdb16b4cc83bd25b1affa::M::O1<u64>" | ||
} | ||
}, | ||
{ | ||
"data": { | ||
"objectId": "0x09bd57395cac88fc79d52fa7914d7f6127370b7d2de860ccb71929beb5d7c869", | ||
"version": "2", | ||
"digest": "2gZHNT6i7iNRoizwG812drn3fy6AETK1VygZmYcPyHgH", | ||
"type": "0xb950fe2a124ab853efc3ee02166d1f5224b744789fdbdb16b4cc83bd25b1affa::M::O1<u64>" | ||
} | ||
} | ||
], | ||
"nextCursor": "IAm9VzlcrIj8edUvp5FNf2EnNwt9LehgzLcZKb6118hpAQAAAAAAAAA=", | ||
"hasNextPage": false | ||
} | ||
} | ||
|
||
task 8, lines 52-62: | ||
//# run-jsonrpc | ||
Response: { | ||
"jsonrpc": "2.0", | ||
"id": 1, | ||
"result": { | ||
"data": [ | ||
{ | ||
"data": { | ||
"objectId": "0xa1f7fd756f61d5ddfac12633b350fedb6114dba40e2a42c20053bd011d8fb79f", | ||
"version": "3", | ||
"digest": "8DGH1AnMfXTs9ydGuR5RXhG1jF1PVD7kuAEewPYG8Zkr", | ||
"type": "0xb950fe2a124ab853efc3ee02166d1f5224b744789fdbdb16b4cc83bd25b1affa::M::O1<u32>" | ||
} | ||
}, | ||
{ | ||
"data": { | ||
"objectId": "0xeaeae71b228562e9813ebed88f1c019c39d1a24a4b35717817b00d80aa3b04b5", | ||
"version": "2", | ||
"digest": "Ai86Kt6S54Q7CXvjEGWmmjSQpT9sE4bLFVDwEc5ctjmt", | ||
"type": "0xb950fe2a124ab853efc3ee02166d1f5224b744789fdbdb16b4cc83bd25b1affa::M::O1<u32>" | ||
} | ||
} | ||
], | ||
"nextCursor": "IOrq5xsihWLpgT6+2I8cAZw50aJKSzVxeBewDYCqOwS1AQAAAAAAAAA=", | ||
"hasNextPage": false | ||
} | ||
} | ||
|
||
task 9, lines 64-76: | ||
//# run-jsonrpc | ||
Response: { | ||
"jsonrpc": "2.0", | ||
"id": 2, | ||
"result": { | ||
"data": [ | ||
{ | ||
"data": { | ||
"objectId": "0xa1f7fd756f61d5ddfac12633b350fedb6114dba40e2a42c20053bd011d8fb79f", | ||
"version": "3", | ||
"digest": "8DGH1AnMfXTs9ydGuR5RXhG1jF1PVD7kuAEewPYG8Zkr", | ||
"type": "0xb950fe2a124ab853efc3ee02166d1f5224b744789fdbdb16b4cc83bd25b1affa::M::O1<u32>" | ||
} | ||
} | ||
], | ||
"nextCursor": "IKH3/XVvYdXd+sEmM7NQ/tthFNukDipCwgBTvQEdj7efAgAAAAAAAAA=", | ||
"hasNextPage": true | ||
} | ||
} | ||
|
||
task 10, lines 78-90: | ||
//# run-jsonrpc --cursors @{obj_5_0,2} | ||
Response: { | ||
"jsonrpc": "2.0", | ||
"id": 3, | ||
"result": { | ||
"data": [ | ||
{ | ||
"data": { | ||
"objectId": "0xeaeae71b228562e9813ebed88f1c019c39d1a24a4b35717817b00d80aa3b04b5", | ||
"version": "2", | ||
"digest": "Ai86Kt6S54Q7CXvjEGWmmjSQpT9sE4bLFVDwEc5ctjmt", | ||
"type": "0xb950fe2a124ab853efc3ee02166d1f5224b744789fdbdb16b4cc83bd25b1affa::M::O1<u32>" | ||
} | ||
} | ||
], | ||
"nextCursor": "IOrq5xsihWLpgT6+2I8cAZw50aJKSzVxeBewDYCqOwS1AQAAAAAAAAA=", | ||
"hasNextPage": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters