fix(pox-4-tests): Update AllowContractCallerCommand to remove the wallet from ex-allowed's list

This commit is contained in:
BowTiedRadone
2024-04-22 16:19:13 +03:00
committed by Nikos Baxevanis
parent d2c1eb74dd
commit e33895fa78

View File

@@ -74,6 +74,27 @@ export class AllowContractCallerCommand implements PoxCommand {
// Get the wallets involved from the model and update it with the new state.
const wallet = model.stackers.get(this.wallet.stxAddress)!;
const callerAllowedBefore = wallet.allowedContractCaller;
const callerAllowedBeforeState = model.stackers.get(callerAllowedBefore) ||
null;
if (callerAllowedBeforeState) {
// Remove the allower from the ex-allowed caller's allowance list.
const walletIndexInsideAllowedByList = callerAllowedBeforeState
.callerAllowedBy.indexOf(
this.wallet.stxAddress,
);
expect(walletIndexInsideAllowedByList).toBeGreaterThan(-1);
callerAllowedBeforeState.callerAllowedBy.splice(
walletIndexInsideAllowedByList,
1,
);
}
const callerToAllow = model.stackers.get(this.allowanceTo.stxAddress)!;
// Update model so that we know this wallet has authorized a contract-caller.