diff --git a/packages/backend/src/graphql/resolvers/asset.test.ts b/packages/backend/src/graphql/resolvers/asset.test.ts index 71acce38cc..97f3f1699e 100644 --- a/packages/backend/src/graphql/resolvers/asset.test.ts +++ b/packages/backend/src/graphql/resolvers/asset.test.ts @@ -225,7 +225,8 @@ describe('Asset Resolvers', (): void => { const asset = await assetService.create({ ...randomAsset(), withdrawalThreshold: BigInt(10), - liquidityThresholdLow: BigInt(100) + liquidityThresholdLow: BigInt(100), + liquidityThresholdHigh: BigInt(1000) }) assert.ok(!isAssetError(asset)) assert.ok(asset.withdrawalThreshold) @@ -293,7 +294,8 @@ describe('Asset Resolvers', (): void => { const asset = await assetService.create({ ...randomAsset(), withdrawalThreshold: BigInt(10), - liquidityThresholdLow: BigInt(100) + liquidityThresholdLow: BigInt(100), + liquidityThresholdHigh: BigInt(1000), }) assert.ok(!isAssetError(asset)) assert.ok(asset.withdrawalThreshold) @@ -309,7 +311,8 @@ describe('Asset Resolvers', (): void => { scale liquidity withdrawalThreshold - liquidityThreshold + liquidityThresholdLow + liquidityThresholdHigh createdAt } } diff --git a/packages/backend/src/graphql/resolvers/peer.test.ts b/packages/backend/src/graphql/resolvers/peer.test.ts index 829551b094..2e95b7e75c 100644 --- a/packages/backend/src/graphql/resolvers/peer.test.ts +++ b/packages/backend/src/graphql/resolvers/peer.test.ts @@ -374,7 +374,8 @@ describe('Peer Resolvers', (): void => { staticIlpAddress liquidity name - liquidityThreshold + liquidityThresholdLow + liquidityThresholdHigh } } `, @@ -407,7 +408,8 @@ describe('Peer Resolvers', (): void => { maxPacketAmount: peer.maxPacketAmount?.toString(), liquidity: '0', name: peer.name, - liquidityThreshold: '100' + liquidityThresholdLow: '100', + liquidityThresholdHigh: '2000' }) await accountingService.createDeposit({ @@ -435,7 +437,8 @@ describe('Peer Resolvers', (): void => { maxPacketAmount: peer.maxPacketAmount?.toString(), liquidity: '100', name: peer.name, - liquidityThreshold: '100' + liquidityThresholdLow: '100', + liquidityThresholdHigh: '2000' }) }) diff --git a/packages/backend/src/openapi/specs/webhooks.yaml b/packages/backend/src/openapi/specs/webhooks.yaml index d775db1bcc..5f17046f57 100644 --- a/packages/backend/src/openapi/specs/webhooks.yaml +++ b/packages/backend/src/openapi/specs/webhooks.yaml @@ -319,7 +319,9 @@ components: type: string enum: - asset.liquidity_low + - asset.liquidity_high - peer.liquidity_low + - peer.liquidity_high data: type: object required: diff --git a/packages/backend/src/payment-method/ilp/auto-peering/service.test.ts b/packages/backend/src/payment-method/ilp/auto-peering/service.test.ts index ff707a31c1..589e39ef8b 100644 --- a/packages/backend/src/payment-method/ilp/auto-peering/service.test.ts +++ b/packages/backend/src/payment-method/ilp/auto-peering/service.test.ts @@ -261,7 +261,7 @@ describe('Auto Peering Service', (): void => { }, maxPacketAmount: args.maxPacketAmount, name: peerDetails.name, - liquidityThreshold: args.liquidityThresholdLow + liquidityThresholdLow: args.liquidityThresholdLow }) scope.done() diff --git a/packages/backend/src/payment-method/ilp/peer/model.test.ts b/packages/backend/src/payment-method/ilp/peer/model.test.ts index 47193c3955..55c01144f3 100644 --- a/packages/backend/src/payment-method/ilp/peer/model.test.ts +++ b/packages/backend/src/payment-method/ilp/peer/model.test.ts @@ -58,7 +58,7 @@ describe('Models', (): void => { maxPacketAmount: BigInt(100), staticIlpAddress: 'test.' + uuid(), name: faker.person.fullName(), - liquidityThreshold: BigInt(100) + liquidityThresholdLow: BigInt(100), } const peerOrError = await peerService.create(options) if (!isPeerError(peerOrError)) { diff --git a/packages/backend/src/payment-method/ilp/peer/model.ts b/packages/backend/src/payment-method/ilp/peer/model.ts index d517d98765..cfa48dccc4 100644 --- a/packages/backend/src/payment-method/ilp/peer/model.ts +++ b/packages/backend/src/payment-method/ilp/peer/model.ts @@ -69,7 +69,7 @@ export class Peer if (isThresholdCrossed) { await PeerEvent.query().insert({ - assetId: this.id, + peerId: this.id, type: eventType, data: { id: this.id, diff --git a/packages/backend/src/payment-method/ilp/peer/service.test.ts b/packages/backend/src/payment-method/ilp/peer/service.test.ts index 81f0051b76..43da9d3308 100644 --- a/packages/backend/src/payment-method/ilp/peer/service.test.ts +++ b/packages/backend/src/payment-method/ilp/peer/service.test.ts @@ -65,12 +65,12 @@ describe('Peer Service', (): void => { describe('Create/Get Peer', (): void => { test.each` - liquidityThreshold + liquidityThresholdLow ${undefined} ${BigInt(1000)} `( - 'A peer can be created and fetched, liquidityThreshold: $liquidityThreshold', - async ({ liquidityThreshold }): Promise => { + 'A peer can be created and fetched, liquidityThresholdLow: $liquidityThresholdLow', + async ({ liquidityThresholdLow }): Promise => { const options = { assetId: asset.id, http: { @@ -81,7 +81,7 @@ describe('Peer Service', (): void => { }, staticIlpAddress: 'test.' + uuid(), name: faker.person.fullName(), - liquidityThreshold + liquidityThresholdLow } const peer = await peerService.create(options) assert.ok(!isPeerError(peer)) @@ -92,7 +92,7 @@ describe('Peer Service', (): void => { }, staticIlpAddress: options.staticIlpAddress, name: options.name, - liquidityThreshold: liquidityThreshold || null + liquidityThresholdLow: liquidityThresholdLow || null }) const retrievedPeer = await peerService.get(peer.id) if (!retrievedPeer) throw new Error('peer not found')