chore: a test for interactionType check

This commit is contained in:
ppedziwiatr
2023-12-27 15:10:59 +01:00
parent 5015a3f0b4
commit 01d69d811b
2 changed files with 19 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ export async function handle(state, action) {
const canEvolve = state.canEvolve;
const input = action.input;
const caller = action.caller;
const interactionType = action.interactionType;
if (input.function === 'transfer') {
const target = input.target;
@@ -66,6 +67,10 @@ export async function handle(state, action) {
}
if (input.function === 'balance') {
if (interactionType !== 'view') {
throw new ContractError('Trying to call "view" function from a "write" action.');
}
const target = input.target;
const ticker = state.ticker;