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

[Deepbook SDK] Check user's locked balance before placing order. #17082

Open
vivekascoder opened this issue Apr 7, 2024 · 2 comments
Open

[Deepbook SDK] Check user's locked balance before placing order. #17082

vivekascoder opened this issue Apr 7, 2024 · 2 comments
Assignees
Labels

Comments

@vivekascoder
Copy link

I think that it would be an improvement with errors if we check the user's locked balance first and make sure it's more than the amount he's placing an order for because otherwise you get error from balance module with an unreadable error message, unless you know know what that error code meant.

error: Dry run failed, could not automatically determine a budget: MoveAbort(MoveLocation { module: ModuleId { address: 0000000000000000000000000000000000000000000000000000000000000002, name: Identifier("balance") }, function: 7, instruction: 10, function_name: Some("split") }, 2) in command 0
 cause: {
  "effects": {
    "messageVersion": "v1",
    "status": {
      "status": "failure",
      "error": "MoveAbort(MoveLocation { module: ModuleId { address: 0000000000000000000000000000000000000000000000000000000000000002, name: Identifier(\"balance\") }, function: 7, instruction: 10, function_name: Some(\"split\") }, 2) in command 0"
    },
    "executedEpoch": "360",

what do you think? happy to work on it if you think it would be an improvement in the sdk.

@vivekascoder
Copy link
Author

vivekascoder commented Apr 7, 2024

Another thing that could be an improvement is to take an optional TransactionalBlock here which will allow me to do something like depositing first and then adding limit order in the same transactional block.

I think each function should take an optional TransactionalBlock rather than returning a new one as it'll help to chain other things together i.e. making things composable.

@0xaslan
Copy link
Contributor

0xaslan commented Apr 9, 2024

Hey, thanks for the feedback! We will take care of things on the Move side, but feel free to create a PR on the SDK with the improvement you mentioned.

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