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

test: add unit tests for classic signature requirements pipeline #115

Merged
merged 8 commits into from
Apr 1, 2024
21 changes: 14 additions & 7 deletions src/stellar-plus/core/pipelines/classic-sign-requirements/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class ClassicSignRequirementsPipeline extends ConveyorBelt<

let thresholdLevel = SignatureThreshold.medium

switch (operation.type) {
switch (operation.type as string) {
case xdr.OperationType.createAccount().name:
return {
publicKey: setSourceSigner(operation.source),
Expand Down Expand Up @@ -121,11 +121,11 @@ export class ClassicSignRequirementsPipeline extends ConveyorBelt<

case xdr.OperationType.setOptions().name:
if (
!(operation as Operation.SetOptions).masterWeight &&
!(operation as Operation.SetOptions).signer &&
!(operation as Operation.SetOptions).lowThreshold &&
!(operation as Operation.SetOptions).medThreshold &&
!(operation as Operation.SetOptions).highThreshold
(operation as Operation.SetOptions).masterWeight ||
(operation as Operation.SetOptions).signer ||
(operation as Operation.SetOptions).lowThreshold ||
(operation as Operation.SetOptions).medThreshold ||
(operation as Operation.SetOptions).highThreshold
) {
thresholdLevel = SignatureThreshold.high
}
Expand All @@ -150,7 +150,7 @@ export class ClassicSignRequirementsPipeline extends ConveyorBelt<
case xdr.OperationType.accountMerge().name:
return {
publicKey: setSourceSigner(operation.source),
thresholdLevel,
thresholdLevel: SignatureThreshold.high,
}

case xdr.OperationType.manageData().name:
Expand Down Expand Up @@ -190,6 +190,13 @@ export class ClassicSignRequirementsPipeline extends ConveyorBelt<
}

case xdr.OperationType.revokeSponsorship().name:
case 'revokeAccountSponsorship':
case 'revokeTrustlineSponsorship':
case 'revokeOfferSponsorship':
case 'revokeDataSponsorship':
case 'revokeClaimableBalanceSponsorship':
case 'revokeLiquidityPoolSponsorship':
case 'revokeSignerSponsorship':
return {
publicKey: setSourceSigner(operation.source),
thresholdLevel,
Expand Down
Loading