Skip to content
This repository was archived by the owner on Dec 12, 2024. It is now read-only.

Add balance resource and todos#212

Merged
kirahsapong merged 15 commits intomainfrom
feat/add-balance-resource
Mar 29, 2024
Merged

Add balance resource and todos#212
kirahsapong merged 15 commits intomainfrom
feat/add-balance-resource

Conversation

@kirahsapong
Copy link
Contributor

@kirahsapong kirahsapong commented Mar 25, 2024

closes #138

  • adds Balance resource and protocol tests
  • adds client getBalance method and tests
  • adds server GET /balance endpoint, handlers and tests

@changeset-bot
Copy link

changeset-bot bot commented Mar 25, 2024

⚠️ No Changeset found

Latest commit: 7716e0a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Mar 25, 2024

TBDocs Report

🛑 Errors: 0
⚠️ Warnings: 3

@tbdex/protocol

  • Project entry file: packages/protocol/src/main.ts

@tbdex/http-client

  • Project entry file: packages/http-client/src/main.ts

@tbdex/http-server

  • Project entry file: packages/http-server/src/main.ts
📄 File: packages/http-server/src/http-server.ts
⚠️ extractor:ae-unresolved-link: The @link reference could not be resolved: The package "@tbdex/http-server" does not have an export "InMemoryOfferingsApi" #L49
⚠️ extractor:ae-unresolved-link: The @link reference could not be resolved: The package "@tbdex/http-server" does not have an export "InMemoryExchangesApi" #L49
⚠️ extractor:ae-unresolved-link: The @link reference could not be resolved: The package "@tbdex/http-server" does not have an export "InMemoryBalancesApi" #L49

TBDocs Report Updated at 2024-03-29T15:50:25Z 7716e0a

@codecov
Copy link

codecov bot commented Mar 25, 2024

Codecov Report

Merging #212 (77954d8) into main (529b37a) will decrease coverage by 1.76%.
The diff coverage is 35.71%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #212      +/-   ##
==========================================
- Coverage   93.53%   91.77%   -1.76%     
==========================================
  Files          39       40       +1     
  Lines        3141     3236      +95     
  Branches      356      357       +1     
==========================================
+ Hits         2938     2970      +32     
- Misses        203      266      +63     
Components Coverage Δ
protocol 91.06% <35.71%> (-3.22%) ⬇️
http-client 94.83% <ø> (ø)
http-server 91.05% <ø> (ø)

@codecov-commenter
Copy link

codecov-commenter commented Mar 27, 2024

Codecov Report

Merging #212 (818ce7a) into main (6dea4d9) will increase coverage by 0.11%.
The diff coverage is 94.46%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #212      +/-   ##
==========================================
+ Coverage   92.91%   93.03%   +0.11%     
==========================================
  Files          39       42       +3     
  Lines        3104     3386     +282     
  Branches      344      374      +30     
==========================================
+ Hits         2884     3150     +266     
- Misses        220      236      +16     
Components Coverage Δ
protocol 93.32% <95.37%> (+0.10%) ⬆️
http-client 95.27% <100.00%> (+0.34%) ⬆️
http-server 90.87% <91.91%> (+0.16%) ⬆️

@kirahsapong kirahsapong force-pushed the feat/add-balance-resource branch from 8a35046 to 3da75c2 Compare March 28, 2024 21:33
it('returns 401 if bearer token is missing from the Authorization header', async () => {
const resp = await fetch('http://localhost:8000/balances', {
headers: {
'Authorization': 'Not well formatted token'

Check failure

Code scanning / CodeQL

Hard-coded credentials

The hard-coded value "Not well formatted token" is used as [authorization header](1).
it('returns 401 if the bearer token is malformed in the Authorization header', async () => {
const resp = await fetch('http://localhost:8000/balances', {
headers: {
'Authorization': 'Bearer MALFORMED'

Check failure

Code scanning / CodeQL

Hard-coded credentials

The hard-coded value "Bearer MALFORMED" is used as [authorization header](1).
Comment on lines +224 to +225
this.api.get('/balances', (req, res) =>
getBalances(req, res, {
callback: this.callbacks['getBalances'],
balancesApi,
pfiDid,
})

Check failure

Code scanning / CodeQL

Missing rate limiting

This route handler performs [authorization](1), but is not rate-limited.
Copy link
Contributor

@KendallWeihe KendallWeihe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two open comments but neither are blockers

awesome work here!

@kirahsapong kirahsapong force-pushed the feat/add-balance-resource branch from 818ce7a to e221206 Compare March 29, 2024 15:46
@kirahsapong kirahsapong merged commit 7edf704 into main Mar 29, 2024
@kirahsapong kirahsapong deleted the feat/add-balance-resource branch March 29, 2024 16:00
diehuxx pushed a commit that referenced this pull request Mar 30, 2024
* main:
  Refresh offerings test vector (#218)
  updating parse close vector with success field (#220)
  Add balance resource and todos (#212)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement GET account balance endpoint and client method

5 participants