💿Actions
The JSON file used in STRIKE is a key component for defining actions and interactions with canisters on the Internet Computer. This JSON file contains metadata that defines the structure, appearance, and functionality of the STRIKE component when a user interacts with a canister via a shared URL (such as through Twitter).
Below is a detailed breakdown of the JSON format, followed by an explanation of the image provided.

JSON File Structure
json{
"icon": "https://strike.oranj.co/hello-strike.png",
"homepage": "https://strike.oranj.co",
"label": "Simple Ownership",
"title": "Simple Ownership",
"description": "Demo canister integration with STRIKE",
"canisterId": "ea6rm-nyaaa-aaaak-ak2wa-cai",
"actions": [
{
"label": "Hello",
"method": "hello",
"type": "query",
"input": [],
"output": ["Text"],
"inputParameters": [],
"uiParameters": [],
},
{
"label": "Get owner",
"method": "get_owner",
"type": "query",
"input": [],
"output": ["Principal"],
"inputParameters": [],
"uiParameters": [],
},
{
"label": "Set owner",
"method": "set_owner",
"type": "update",
"input": ["Principal"],
"output": [],
"uiParameters": [
{
"name": "owner",
"label": "Enter a new owner",
"candidType": "Principal"
}
],
"inputParameters": ["{owner}"],
}
]
}
1. Icon
Field:
"icon"
Value: URL of the image that will be displayed in the STRIKE interface as an icon.
Example:
"https://ucarecdn.com/e75cce91-c367-4f74-9ffe-2b6d63398ce1/-/preview/880x864/-/quality/smart/-/format/auto/"
Purpose: This image will be displayed at the top of the interface. It’s used as a visual representation of the canister or the action.
2. Label
Field:
"label"
Value: Text that appears below the icon to give a short, identifying name to the action or canister.
Example:
"Simple ownership"
Purpose: This label is used to indicate the type of action or function that the canister represents.
3. Title
Field:
"title"
Value: A brief title that gives more information about the purpose of the action.
Example:
"Simple ownership"
Purpose: The title is used as a headline to summarize the action or canister's functionality.
4. Description
Field:
"description"
Value: A description that explains the action or purpose of the canister in more detail.
Example:
"Demo canister integration with STRIKE"
Purpose: This description gives context to the user about the canister and the specific interactions they can perform.
5. Canister ID
Field:
"canisterId"
Value: A unique identifier for the canister that the JSON file is interacting with. This ID is similar to a smart contract address.
Example:
"ea6rm-nyaaa-aaaak-ak2wa-cai"
Purpose: The canister ID links the user’s interaction to a specific canister on the Internet Computer, ensuring they are working with the correct contract.
6. Links (Actions)
Field:
"actions"
Value: A set of actions that users can perform with the canister.
Example:
json{ "actions": [ { "label": "Hello", "method": "hello", "type": "query", "input": [], "output": ["Text"], "inputParameters": [], "uiParameters": [], }, { "label": "Get owner", "method": "get_owner", "type": "query", "input": [], "output": ["Principal"], "inputParameters": [], "uiParameters": [], }, { "label": "Set owner", "method": "set_owner", "type": "update", "input": ["Principal"], "output": [], "uiParameters": [ { "name": "owner", "label": "Enter a new owner", "candidType": "Principal" } ], "inputParameters": ["{owner}"], } ] }
Label: A short name for the action (e.g., "Hello," "Get Owner," "Set Owner").
Method: A method to do update call(e.g., "hello", "get_owner", "set_owner").
Type: The types of calls to interact with a canister's methods(e.g., "query", "update").
Input: The data type of input parameter.
Output: The data type of output parameter.
Ui Parameters: A Input parameters being rendered to the user.
Input Parameters: (for actions like "Set Owner"): Any input required for the action (e.g., a new owner in the "Set Owner" function).
Purpose: This defines the available actions for the user, providing the necessary paths and input fields for interacting with the canister.
Last updated