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

feat: support peer service adding initial amount of liquidity #1882

Merged
merged 139 commits into from
Sep 20, 2023

Conversation

mkurapov
Copy link
Contributor

@mkurapov mkurapov commented Sep 15, 2023

Changes proposed in this pull request

  • Allow adding initial amount of liquidity during peer creation
  • Automatically issue maximum amount of liquidity during auto-peering
  • Allow accountingService.createDeposit to take in a knex transaction (so we can fail peer creation if we couldn't add initial amount of liquidity)

Context

Fixes #1855

Checklist

  • Related issues linked using fixes #number
  • Tests added/updated
  • Documentation added
  • Make sure that all checks pass
  • Postman collection updated

@@ -205,7 +205,8 @@ async function acceptPeeringRequest(
endpoint: args.ilpConnectorAddress,
authToken: outgoingHttpToken
}
}
},
initialLiquidity: BigInt(Number.MAX_SAFE_INTEGER)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Issue max amount of liquidity during auto-peering

@mkurapov mkurapov marked this pull request as ready for review September 17, 2023 11:01
dragosp1011
dragosp1011 previously approved these changes Sep 18, 2023
njlie
njlie previously approved these changes Sep 18, 2023
): Promise<LedgerAccount | undefined> {
return LedgerAccount.query(deps.knex)
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious what the intent of adding a transaction here is, since these look like they're just reading the database.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we are creating the account and reading it in the same transaction, we also need it here: https://github.com/interledger/rafiki/pull/1882/files#diff-4b287690c751dd38900f4202d32f2e0c023b378614a7363fbf791226fa926f45R152-R167

Base automatically changed from mk/1765/auto-peering-mutation to main September 20, 2023 10:43
@mkurapov mkurapov dismissed stale reviews from dragosp1011 and njlie September 20, 2023 10:43

The base branch was changed.

# Conflicts:
#	packages/backend/src/auto-peering/service.test.ts
#	packages/backend/src/auto-peering/service.ts
@netlify
Copy link

netlify bot commented Sep 20, 2023

Deploy Preview for brilliant-pasca-3e80ec canceled.

Name Link
🔨 Latest commit b287606
🔍 Latest deploy log https://app.netlify.com/sites/brilliant-pasca-3e80ec/deploys/650acd1edbd433000768cf1b

@mkurapov mkurapov merged commit f6936c4 into main Sep 20, 2023
22 checks passed
@mkurapov mkurapov deleted the mk/1855/add-initial-peer-liquidity branch September 20, 2023 11:00
beniaminmunteanu pushed a commit that referenced this pull request Sep 29, 2023
* feat(backend): WIP - add feeid to quote table

* refactor(backend): rename quote gql field

* fix(backend): add fee relation

* feat(backend): WIP calculate fees in quote create

* refactor(backend): rename gql quote field

* fix(backend): rm unused with graph fetched

* feat(backend): move fee calculation to quote service

* fix(backend): use quote error

* fix(backend): rm unused fn

* refactor(backend): rename quote send amount value

* refactor(backend): rename quote send amount to debit amount

* refactor(backend): rename out payment send amount to debit

* chore(backend): format

* chore(documentation): update gql docs

* fix(backend,localenv): trx amount

* fix(backend): handle cross currency fee in quote

* refactor: update spec and rename more fields

* fix(backend): outgoing limit test

* refactor(backend): rename limits field

* rename sendAmount to debitAmount

* fix(localenv): postman ecommerce flow

* fix(backend): remove useless checks

* chore(auth): update open-payments package version

* chore(backend): rm commented out code

* fix(auth): migration to rename jsonb col

* chore(auth): format

* feat: add DuplicatePeer error

* fix: pass in peerService to autoPeeringService

* chore: update diff

* chore: add to peer resolver test

* feat: accept peering request

* fix(backend): remove asset join

* refactor(backend): remove variable assignment

* feat: wire up router for auto peering

* fix: update auto peering service

* feat: correct config

* config: update auto peering routes & errors

* chore: prettier

* feat: add createPeerByUrl mutation to schema

* feat: add initiatePeeringRequest method to auto peering service

* feat: add createPeerByUrl resolver

* chore: fix lint

* chore: add generate graphql files

* chore: update graphql schema comment

* fix: add type to /post peer error

* feat: add postman request

* chore: address comments

* Update packages/backend/src/auto-peering/errors.ts

Co-authored-by: Radu-Cristian Popa <[email protected]>

* chore: remove axios from app

* chore: add axios to app

* chore: fix whitespace

* feature(backend): change error

* reactor(documentation): update fee explanation

* feat: use assetId in getByDestinationAddress

* feat: update peer on duplicate peering request

* chore: remove quote url references

* feat: use proper outgoing/incoming http tokens

* feat: update error during auto-peering request

* fix(openapi): missing server warning

* chore: fix route tests

* feat: support maxPacketAmount and name in peering request

* chore: add fields to peering request

* feat: support maxPacketAmount and name in peering request

* feat: default to peer given name if no name provided

* chore: lint

* fix: remove getter

* Temporary fix

* Revert "Temporary fix"

This reverts commit bc7c69a.

* chore(token-introspection): generate types

* chore: update tests

* refactor(documentation): rename sendAmount to debitAmount

* Revert "Merge branch 'bc/1639/add-fees-to-quote' into mk/1802/accept-peering-request"

This reverts commit 8fb0154, reversing
changes made to 9619132.

* ci: test heap bump

* ci: logheapusage

* chore: bump jest

* chore: update tests

* chore: update tests

* Revert "ci: logheapusage"

This reverts commit 66293e5.

* revert fix

* fix: revert pnpm lock

* Update mutation request

* feat: allow knex trx to be used in transfer creation

* feat: add initial amount of liquidity in peer service

* feat: add max amount of liquidity during auto-peering

* feat: support (new) liquidityThreshold param

* chore: lint

* chore: fix test

* Update `createPeer` and `createPeerByUrl` mutations in postman

* Revert "Update `createPeer` and `createPeerByUrl` mutations in postman"

This reverts commit 1b53f92.

* chore: rename to CreateOrUpdatePeerByUrlInput

* feat: update peer on duplicate request

* feat: update auto-peering resolver

* Update mutation

---------

Co-authored-by: Blair Currey <[email protected]>
Co-authored-by: Radu-Cristian Popa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: backend Changes in the backend package. type: source Changes business logic type: tests Testing related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automatically deposit liquidity during auto-peering
6 participants