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

Cli withdraw amount fix #97

Merged
merged 7 commits into from
Sep 2, 2024
Merged

Cli withdraw amount fix #97

merged 7 commits into from
Sep 2, 2024

Conversation

ochaloup
Copy link
Contributor

Changing show-bond command to

a) show data about withdrawal requests a bit better
b) fixing calculation for amountToWithdraw
c) adjusting the way how to vote account data is shown to contain fewer data and not be obtrusive
d) when withdraw amount is max then showing <ALL> label instead

Depending on CLI common update
marinade-finance/marinade-ts-cli#25

From data of command pnpm cli -u$RPC_URL show-bond 5iZ5PQPy5Z9XDnkfoWPi6nvUgtxWnRFwZ36WaftPuaVM --with-funding

Old

{"programId":"vBoNdEvzMrSai7is21XgVYik65mqtaKXuSdMBJ1xkW4","publicKey":"6X5aGtRKGFTKcaTfqXK714BavQABTWKyCKYEw1F3z3cW","account":{"config":"vbMaRfmTCg92HWGzmd53APkMNpPnGVGZTUHwUJQkXAU","voteAccount":"5iZ5PQPy5Z9XDnkfoWPi6nvUgtxWnRFwZ36WaftPuaVM","authority":"61QB1Evn9E3noQtpJm4auFYyHSXS5FPgqKtPgwJJfEQk","costPerMillePerEpoch":"0 lamport","maxStakeWanted":"0.000000000 SOL"},"voteAccount":{"nodePubkey":"61QB1Evn9E3noQtpJm4auFYyHSXS5FPgqKtPgwJJfEQk","authorizedWithdrawer":"9dzQ48BtqSUvPGzRWmea6biDndZ9WzA22CNdZEtxubbN","authorizedVoters":[{"epoch":663,"authorizedVoter":"61QB1Evn9E3noQtpJm4auFYyHSXS5FPgqKtPgwJJfEQk"}],"commission":0,"rootSlot":286823160},"amountActive":"-18446743956.051243265 SOLs","amountAtSettlements":"0.000000000 SOL","amountToWithdraw":"18446744073.709551615 SOLs","numberActiveStakeAccounts":4,"numberSettlementStakeAccounts":0,"withdrawRequest":{"publicKey":"9rzcCVqFm9M7hMJMEm4hFpLucnYNmQ3qywK6uL3BdsPw","account":{"voteAccount":"5iZ5PQPy5Z9XDnkfoWPi6nvUgtxWnRFwZ36WaftPuaVM","bond":"6X5aGtRKGFTKcaTfqXK714BavQABTWKyCKYEw1F3z3cW","epoch":660,"requestedAmount":"18446744073.709551615 SOLs","withdrawnAmount":"0.000000000 SOL"}}}

# jq '.'
{
  "programId": "vBoNdEvzMrSai7is21XgVYik65mqtaKXuSdMBJ1xkW4",
  "publicKey": "6X5aGtRKGFTKcaTfqXK714BavQABTWKyCKYEw1F3z3cW",
  "account": {
    "config": "vbMaRfmTCg92HWGzmd53APkMNpPnGVGZTUHwUJQkXAU",
    "voteAccount": "5iZ5PQPy5Z9XDnkfoWPi6nvUgtxWnRFwZ36WaftPuaVM",
    "authority": "61QB1Evn9E3noQtpJm4auFYyHSXS5FPgqKtPgwJJfEQk",
    "costPerMillePerEpoch": "0 lamport",
    "maxStakeWanted": "0.000000000 SOL"
  },
  "voteAccount": {
    "nodePubkey": "61QB1Evn9E3noQtpJm4auFYyHSXS5FPgqKtPgwJJfEQk",
    "authorizedWithdrawer": "9dzQ48BtqSUvPGzRWmea6biDndZ9WzA22CNdZEtxubbN",
    "authorizedVoters": [
      {
        "epoch": 663,
        "authorizedVoter": "61QB1Evn9E3noQtpJm4auFYyHSXS5FPgqKtPgwJJfEQk"
      }
    ],
    "commission": 0,
    "rootSlot": 286823234
  },
  "amountActive": "-18446743956.051243265 SOLs",
  "amountAtSettlements": "0.000000000 SOL",
  "amountToWithdraw": "18446744073.709551615 SOLs",
  "numberActiveStakeAccounts": 4,
  "numberSettlementStakeAccounts": 0,
  "withdrawRequest": {
    "publicKey": "9rzcCVqFm9M7hMJMEm4hFpLucnYNmQ3qywK6uL3BdsPw",
    "account": {
      "voteAccount": "5iZ5PQPy5Z9XDnkfoWPi6nvUgtxWnRFwZ36WaftPuaVM",
      "bond": "6X5aGtRKGFTKcaTfqXK714BavQABTWKyCKYEw1F3z3cW",
      "epoch": 660,
      "requestedAmount": "18446744073.709551615 SOLs",
      "withdrawnAmount": "0.000000000 SOL"
    }
  }
}

New

{
  "programId": "vBoNdEvzMrSai7is21XgVYik65mqtaKXuSdMBJ1xkW4",
  "publicKey": "6X5aGtRKGFTKcaTfqXK714BavQABTWKyCKYEw1F3z3cW",
  "account": {
    "config": "vbMaRfmTCg92HWGzmd53APkMNpPnGVGZTUHwUJQkXAU",
    "voteAccount": "5iZ5PQPy5Z9XDnkfoWPi6nvUgtxWnRFwZ36WaftPuaVM",
    "authority": "61QB1Evn9E3noQtpJm4auFYyHSXS5FPgqKtPgwJJfEQk",
    "costPerMillePerEpoch": "0 lamport",
    "maxStakeWanted": "0 SOL"
  },
  "voteAccount": {
    "nodePubkey": "61QB1Evn9E3noQtpJm4auFYyHSXS5FPgqKtPgwJJfEQk",
    "authorizedWithdrawer": "9dzQ48BtqSUvPGzRWmea6biDndZ9WzA22CNdZEtxubbN",
    "commission": 0
  },
  "amountOwned": "117.658308350 SOLs",
  "amountActive": "-18446743956.051243265 SOLs",
  "numberActiveStakeAccounts": 4,
  "amountAtSettlements": "0 SOL",
  "numberSettlementStakeAccounts": 0,
  "amountToWithdraw": "117.658308350 SOLs",
  "epochsToElapseToWithdraw": 1,
  "withdrawRequest": {
    "publicKey": "9rzcCVqFm9M7hMJMEm4hFpLucnYNmQ3qywK6uL3BdsPw",
    "account": {
      "voteAccount": "5iZ5PQPy5Z9XDnkfoWPi6nvUgtxWnRFwZ36WaftPuaVM",
      "bond": "6X5aGtRKGFTKcaTfqXK714BavQABTWKyCKYEw1F3z3cW",
      "epoch": 660,
      "requestedAmount": "<ALL>",
      "withdrawnAmount": "0 SOL"
    }
  }
}

@ochaloup ochaloup requested a review from Cerbah August 30, 2024 21:53
@Cerbah
Copy link

Cerbah commented Sep 2, 2024

lgtm

@ochaloup ochaloup merged commit 456b546 into main Sep 2, 2024
@ochaloup ochaloup deleted the cli-withdraw-amount-fix branch September 5, 2024 06:49
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