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

Endpoint for returning wallet balance (and status) #3345

Merged
merged 1 commit into from
Oct 10, 2024

Conversation

nieznanysprawiciel
Copy link
Contributor

Endpoint returns the same structure as yagna payment status CLI command

yagna payment status --network polygon

Status for account: 0xf98bb0842a7e744beedd291c98e7cd2c9b27f300
Payment Driver status: OK

┌────────────────────┬────────────────┬────────────┬─────────────┬────────────────────────────┬────────────────────────────┬────────────────┐
│  platform          │  total amount  │  reserved  │  amount     │  incoming                  │  outgoing                  │  gas           │
├────────────────────┼────────────────┼────────────┼─────────────┼────────────────────────────┼────────────────────────────┼────────────────┤
│  driver: erc20     │  22.4449 GLM   │  0 GLM     │  accepted   │  0.086760639607644453 GLM  │  0.000197094797101683 GLM  │  0.2212 MATIC  │
│  network: polygon  │                │            │  confirmed  │  0.086760639607644453 GLM  │  0.000197094797101683 GLM  │                │
│  token: GLM        │                │            │  requested  │  0.086760639607644453 GLM  │  0.000197094797101683 GLM  │                │
└────────────────────┴────────────────┴────────────┴─────────────┴────────────────────────────┴────────────────────────────┴────────────────┘

curl -H "Authorization: Bearer secret-secret-secret" "http://localhost:7465/payment-api/v1/account/status?network=polygon" | jq

{
  "amount": "22.444979322042006358",
  "reserved": "0",
  "outgoing": {
    "requested": {
      "totalAmount": "0.000197094797101683",
      "agreementsCount": 3
    },
    "accepted": {
      "totalAmount": "0.000197094797101683",
      "agreementsCount": 3
    },
    "confirmed": {
      "totalAmount": "0.000197094797101683",
      "agreementsCount": 3
    }
  },
  "incoming": {
    "requested": {
      "totalAmount": "0.086760639607644453",
      "agreementsCount": 4
    },
    "accepted": {
      "totalAmount": "0.086760639607644453",
      "agreementsCount": 4
    },
    "confirmed": {
      "totalAmount": "0.086760639607644453",
      "agreementsCount": 4
    }
  },
  "driver": "erc20",
  "network": "polygon",
  "token": "GLM",
  "gas": {
    "currency_short_name": "MATIC",
    "currency_long_name": "Polygon",
    "balance": "0.221277145100550748"
  },
  "block_number": 0,
  "block_datetime": "1970-01-01T00:00:00Z"
}

@nieznanysprawiciel nieznanysprawiciel merged commit 8d95f94 into gamerhash/master Oct 10, 2024
42 checks passed
@nieznanysprawiciel nieznanysprawiciel deleted the rest-get-account-status branch October 10, 2024 14:56
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