ποΈDeveloper Guide
Introduction
STRIKE is designed to streamline interactions with canisters (smart contracts) on the Internet Computer Protocol (ICP).
This guide provides an overview of how STRIKE operates, including setup instructions, action creation, and sharing through platforms like Twitter (X).
To interact with STRIKE URLs and the canisters they reference, you must install the STRIKE Chrome extension.
Getting Started with a Simple Example
Let's begin with a fundamental example: a "Hello" backend on the Internet Computer.
This canister implementation includes three functions: hello
, set_owner
, and get_owner
.
We will now proceed with implementing these functions.
Creating the Actions JSON File
To enable interactions with the canister, we need to create an actions.json
file that defines the permitted actions.
This JSON file includes metadata such as action labels, descriptions, canister IDs, and the available actions ("Hello"
, "Get Owner"
, and "Set Owner"
).
Create a new file named actions.json
and add the following configuration:
icon
: A URL linking to the image that will be displayed at the top of the interface.homepage
: A string that represents the canisterβs homepage.canisterId
: The identifier of the canister.
For further details on these values, refer to the Actions page.
Implementing the Functions for Interaction
Next, we need to define the available actions in the JSON file.
Append the following script to actions.json
:
This configuration defines three actions:
Hello
: A query method that returns a greeting message.Get Owner
: A query method that retrieves the current canister owner.Set Owner
: An update method that allows modifying the canister owner.
By setting up these actions, we enable seamless interaction with the canister through STRIKE.
Hosting and Deployment
Once the actions.json
file is created, it can be hosted on any public platform (e.g., GitHub, a custom domain, or any publicly accessible location).
Deploy the code and use the generated link to test it on strike.oranj.co.
Registering on the STRIKE registry
To enable STRIKE card unfurling on Twitter/X, you must register it in the STRIKE registry. Once your STRIKE card is ready, you can fill out this form for registration.
Conclusion
In this guide, we explored the fundamentals of STRIKE, canister integration, and strike card routing. We also demonstrated a simple ownership model using STRIKE Actions.
Last updated