Used to check for browser translation.
用于检测浏览器翻译。
ブラウザの翻訳を検出する

Get the endpoint of the DID Space during the installation startup process.


Overview#

If you want your application to store all data in a specific DID Space (typically the owner's DID Space) upon installation and launch, this tutorial will guide you through the process.

A typical application of this DID Spaces connection method is the NFT Maker. During its installation and startup, NFT Maker connects to DID Spaces, obtains the endpoint of the owner's DID Space, and subsequently stores all NFTs generated on the platform within that DID Space.

Prerequisites#

  • Ensure you have a DID Space for testing. If not, see Get a DID Space.
  • Your app's blocklet.yml configuration file sets capabilities.didSpace to requiredOnSetup, indicating that the app requires a connection to the DID Spaces service during installation.

Procedure#

During the application's initial setup, you will be prompted to connect to a DID Space. Please select the DID Space you want to connect to:

image.png

After connecting successfully, click Continue. The installation is complete.

image.png

Application accesses the user's DID Space endpoint#

At this point, your running application can access the DID Space endpoint via the BLOCKLET_APP_SPACE_ENDPOINT environment variable. This variable will have the following format:

console.log(process.env.BLOCKLET_APP_SPACE_ENDPOINT);
// 输出形如: https://space.team.arcblock.io/app/api/space/zNKhe8jwgNZX2z7ZUfwNddNECxSe3wyg7VtS/app/zNKfEK9actwBeLhfVvc9U1p1CqVWxtivVxo6/object/

After retrieving the DID Space endpoint, your application can read and write data to this DID Space. For more information, see: Using @blocklet/did-space-js to read and write DID Space.


你获得 0 积分