-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1225 from demergent-labs/inspect_message
Inspect message
- Loading branch information
Showing
5 changed files
with
81 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
service : () -> { | ||
accessible : () -> (bool); | ||
alsoInaccessible : () -> (bool); | ||
inaccessible : () -> (bool); | ||
} | ||
service: () -> { | ||
accessible: () -> (bool); | ||
inaccessible: () -> (bool); | ||
alsoInaccessible: () -> (bool); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,34 @@ | ||
import { ic, $inspectMessage, $update } from 'azle'; | ||
import { bool, ic, inspectMessage, Service, update } from 'azle'; | ||
|
||
$inspectMessage; | ||
export function inspectMessage(): void { | ||
console.log('inspectMessage called'); | ||
export default class extends Service { | ||
@inspectMessage | ||
inspectMessage() { | ||
console.log('inspectMessage called'); | ||
|
||
if (ic.methodName() === 'accessible') { | ||
ic.acceptMessage(); | ||
return; | ||
} | ||
if (ic.methodName() === 'accessible') { | ||
ic.acceptMessage(); | ||
return; | ||
} | ||
|
||
if (ic.methodName() === 'inaccessible') { | ||
return; | ||
} | ||
if (ic.methodName() === 'inaccessible') { | ||
return; | ||
} | ||
|
||
throw `Method "${ic.methodName()}" not allowed`; | ||
} | ||
throw `Method "${ic.methodName()}" not allowed`; | ||
} | ||
|
||
$update; | ||
export function accessible(): boolean { | ||
return true; | ||
} | ||
@update([], bool) | ||
accessible(): bool { | ||
return true; | ||
} | ||
|
||
$update; | ||
export function inaccessible(): boolean { | ||
return false; | ||
} | ||
@update([], bool) | ||
inaccessible(): bool { | ||
return false; | ||
} | ||
|
||
$update; | ||
export function alsoInaccessible(): boolean { | ||
return false; | ||
@update([], bool) | ||
alsoInaccessible(): bool { | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters