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

fix(sui): find owned object id of type among arbitrarily many objects #392

Merged
merged 3 commits into from
Sep 30, 2024

Conversation

sdaveas
Copy link
Contributor

@sdaveas sdaveas commented Sep 26, 2024

findOwnedObjectId returns the first 50 objects. We can either reiterate using the cursor object, or add the type of the target object to the filter which should always return us a single owned object.

E.g., the index of the 0xfe21ac10f6216a4d7923f6f7c9910ffc0aa02d05542108fff1a5ece15b937e57::operators::OperatorCap object is in the 67th position, and the refund command returned an error

node sui/operators refund 0x32034b47cb29d162d9d803cc405356f4ac0ec07fe847ace431385fe8acf3e6e5-2 --receiver 0x851d253fb894059ddb251e93bc693d1824073526bf3fb8a8406dd15b2b01036f --amount 0.01
Wallet address: 0x9b8b3a3e2d0bbee851424e84ac84211dfb02f72dd4d8bc136639d6e2e7773d2f

Wallet balance: 1862.722745504 SUI

Number of owned objects:: 50
/Users/stelios/Projects/axelar/axelar-contract-deployments/sui/utils/utils.js:210
        throw new Error(`No object found for type: ${objectType}`);
              ^

Error: No object found for type: 0xfe21ac10f6216a4d7923f6f7c9910ffc0aa02d05542108fff1a5ece15b937e57::operators::OperatorCap
    at findOwnedObjectId (/Users/stelios/Projects/axelar/axelar-contract-deployments/sui/utils/utils.js:210:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async refund (/Users/stelios/Projects/axelar/axelar-contract-deployments/sui/operators.js:56:27)
    at async mainProcessor (/Users/stelios/Projects/axelar/axelar-contract-deployments/sui/operators.js:166:5)
Screenshot 2024-09-26 at 12 53 31 PM

After the changes:

node sui/operators refund 0x32034b47cb29d162d9d803cc405356f4ac0ec07fe847ace431385fe8acf3e6e5-2 --receiver 0x851d253fb894059ddb251e93bc693d1824073526bf3fb8a8406dd15b2b01036f --amount 0.01
Wallet address: 0x9b8b3a3e2d0bbee851424e84ac84211dfb02f72dd4d8bc136639d6e2e7773d2f

Wallet balance: 1862.619642896 SUI

Refunded Gas: Ge6nhZg5kEBkMv14Fqpz93o8z63g4xS7L56fAPKW5i5i

@sdaveas sdaveas requested a review from a team as a code owner September 26, 2024 09:57
sui/utils/utils.js Outdated Show resolved Hide resolved
sui/utils/utils.js Outdated Show resolved Hide resolved
@sdaveas sdaveas changed the title fix: find owned object id of type among arbitrarily many objects fix(sui): find owned object id of type among arbitrarily many objects Sep 30, 2024
@sdaveas sdaveas enabled auto-merge (squash) September 30, 2024 09:02
@sdaveas sdaveas merged commit d745827 into main Sep 30, 2024
6 checks passed
@sdaveas sdaveas deleted the fix/find-owned-object-id branch September 30, 2024 09:36
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.

3 participants