### Acurast CLI Quick Start Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/tools/cli.mdx A quick start guide for common Acurast CLI operations: creating a new project, initializing configuration, and deploying to Acurast Cloud. ```bash acurast new my-project ``` ```bash acurast init ``` ```bash acurast deploy ``` -------------------------------- ### Execute Live Code Deployment Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/tools/cli.mdx After setup and deployment start, run this command to execute your project on the live processor using existing configuration. ```bash acurast live ``` -------------------------------- ### Connect to Bridge and Request Processor Version (Python) Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/build/cargo-runtime-environment.mdx Example demonstrating how to connect to the Acurast bridge using Python and make a request to get the processor version. Ensure the BRIDGE_SOCKET environment variable is set. ```python import json, os, socket request = json.dumps({ 'jsonrpc': '2.0', 'method': 'processor_version', 'params': [], 'id': '1' }) with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as s: s.connect('\0' + os.environ['BRIDGE_SOCKET']) s.sendall((request + '\n').encode()) response = json.loads(s.recv(65536)) print(response) ``` -------------------------------- ### Install Dependencies and Run Application Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/getting-started/quickstart-cargo.mdx Installs Python 3 requests and executes the hello.py script. Ensure the BRIDGE_SOCKET and WEBHOOK_URL environment variables are set. ```bash apt-get update apt-get install -y python3-requests python3 "$(dirname "$0")/hello.py" ``` -------------------------------- ### Start Local Development Server Source: https://github.com/acurast/acurast-docs/blob/main/README.md Use this command to start a local development server. Changes are reflected live without a server restart. ```bash yarn start ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/acurast/acurast-docs/blob/main/README.md Run this command to install all project dependencies using Yarn. ```bash yarn ``` -------------------------------- ### Example of Updating Deployment Script Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/tools/cli.mdx An example demonstrating how to update a deployment's script using the CLI, including the deployment ID and IPFS hash of the new script. ```bash acurast deployments update script \ "Acurast:5CiPPse...DjL:123456" \ "ipfs://QmNewScriptHash" ``` -------------------------------- ### Connect to Bridge and Request Processor Version (Node.js) Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/build/cargo-runtime-environment.mdx Example demonstrating how to connect to the Acurast bridge using Node.js and make a request to get the processor version. Ensure the BRIDGE_SOCKET environment variable is set. ```javascript const net = require('net'); const client = net.createConnection('\0' + process.env.BRIDGE_SOCKET); const request = JSON.stringify({ jsonrpc: '2.0', method: 'processor_version', params: [], id: '1', }); client.write(request + '\n'); client.once('data', (data) => { const response = JSON.parse(data.toString()); console.log(response); client.end(); }); ``` -------------------------------- ### Setup Live Code Deployment Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/tools/cli.mdx Run this command to set up a live code deployment. Follow the CLI instructions to choose a duration. ```bash acurast live --setup ``` -------------------------------- ### Start P2P Node Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/build/nodejs-runtime-environment.mdx Initiates the P2P node with the provided configuration. Requires a success and error callback. ```javascript /** * @param {P2PConfig} config the node configuration. * @param {P2PSuccess} success the success callback. * @param {P2PError} error the error callback. */ _STD_.p2p.start(config, success, error); ``` -------------------------------- ### Download and Run LLM Server with Localtunnel Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/build/llm-on-acurast.mdx This code downloads a specified LLM model if it doesn't exist, then starts an integrated LLM server. It uses localtunnel to expose the server publicly. Ensure the `LOCALTUNNEL_SUBDOMAIN` is set appropriately. Note that this localtunnel setup is not production-ready. ```typescript import path from "path"; import { MODEL_URL, MODEL_NAME, STORAGE_DIR, LOCALTUNNEL_HOST, } from "./constants"; import { createWriteStream, existsSync } from "fs"; import { Readable } from "stream"; import { finished } from "stream/promises"; import localtunnel from "localtunnel"; declare let _STD_: any; const MODEL_FILE = path.resolve(STORAGE_DIR, MODEL_NAME); async function downloadModel(url: string, dst: string) { console.log("Downloading model", MODEL_NAME); const res = await fetch(url); if (!res.body) { throw new Error("No response body"); } console.log("Writing model to file:", dst); const writer = createWriteStream(dst); await finished(Readable.fromWeb(res.body as any).pipe(writer)); } async function main() { if (!existsSync(MODEL_FILE)) { await downloadModel(MODEL_URL, MODEL_FILE); } else { console.log("Using already downloaded model:", MODEL_FILE); } console.log("model downloaded"); _STD_.llama.server.start( ["--model", MODEL_FILE, "--ctx-size", "2048", "--threads", "8"], () => { // onCompletion console.log("Llama server closed."); }, (error: any) => { // onError console.log("Llama server error:", error); throw error; } ); const tunnel = await localtunnel({ port: 8080, host: LOCALTUNNEL_HOST, subdomain: _STD_.device.getAddress().toLowerCase(), }); console.log(tunnel.url); } main(); ``` -------------------------------- ### Install Acurast SDK Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/tools/sdk.mdx Install the Acurast SDK package using npm. ```bash npm install @acurast/sdk ``` -------------------------------- ### Install and Use Acurast SDK Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/getting-started/quickstart.mdx Install the Acurast SDK and use it programmatically to load configuration and deploy projects. Best for CI pipelines and automated workflows. ```bash npm install @acurast/sdk ``` ```typescript import { deployProject, loadAcurastConfig } from '@acurast/sdk/deploy' const config = await loadAcurastConfig('./acurast.json') await deployProject({ config }) ``` -------------------------------- ### Initialize Acurast Project Configuration Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/deploy-first-app.mdx Initializes the Acurast CLI for your project, creating `acurast.json` and `.env` files. This command starts an interactive guide to set up project details like name, execution type, duration, and the main bundled JavaScript file. ```bash acurast init ``` -------------------------------- ### Compute Verification Hash for Network Whitelisting (Python) Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/build/nodejs-runtime-environment.mdx Example script for computing the verification hash required for network whitelisting. Install the 'substrate-interface' package. This function calculates a SHA-256 hash over the concatenation of source bytes and the host. ```python # pip install substrate-interface import hashlib import base64 from substrateinterface.utils.ss58 import ss58_decode def verification_hash(source: str, host: str) -> str: # Decode hex Account ID directly, or convert SS58 address to raw bytes source_bytes = bytes.fromhex(source) if len(source) == 64 else bytes.fromhex(ss58_decode(source)) # SHA-256 over concatenation of source bytes and UTF-8 encoded host digest = hashlib.sha256(source_bytes + host.encode()).digest() # Return the hash as a base64 string return base64.b64encode(digest).decode() ``` -------------------------------- ### Cargo Entrypoint Script Setup Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/getting-started/quickstart-cargo.mdx The `start.sh` script sets up the environment variables and DNS for your application within the Cargo runtime. Ensure the PATH and HOME variables are correctly exported. ```sh #!/bin/sh # Set up PATH, HOME, and DNS export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin export HOME=/root echo "nameserver 8.8.8.8" > /etc/resolv.conf ``` -------------------------------- ### Install Acurast CLI Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/deploy-first-app.mdx Installs the Acurast CLI globally using npm. Verify the installation by running `acurast` in your terminal. ```bash npm install -g @acurast/cli ``` -------------------------------- ### Compute Verification Hash for Network Whitelisting (Node.js) Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/build/nodejs-runtime-environment.mdx Example script for computing the verification hash required for network whitelisting. Install the '@polkadot/util-crypto' package. This function calculates a SHA-256 hash over the concatenation of source bytes and the host. ```javascript // npm install @polkadot/util-crypto const { createHash } = require('crypto'); const { decodeAddress } = require('@polkadot/util-crypto'); function verificationHash(source, host) { // Decode hex Account ID directly, or convert SS58 address to raw bytes const sourceBytes = source.length === 64 ? Buffer.from(source, 'hex') : Buffer.from(decodeAddress(source)); // SHA-256 over concatenation of source bytes and UTF-8 encoded host const digest = createHash('sha256') .update(sourceBytes) .update(host) .digest(); // Return the hash as a base64 string return digest.toString('base64'); } ``` -------------------------------- ### Scaffold a New Acurast Project Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/getting-started/examples.mdx Use the Acurast CLI to generate a new starter project. Refer to the 'First App Deployment' guide for a complete walkthrough. ```bash npx @acurast/cli new ``` -------------------------------- ### Fund Wallet from LLM Client Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/tools/deploy-agent.mdx After setting up your LLM client and installing skills, you can fund your wallet by typing '/fund' within the client interface. ```shell /fund ``` -------------------------------- ### Example acurast.json Configuration Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/build/deployment-config.mdx This JSON object demonstrates a complete configuration for an Acurast deployment, including project details, network settings, execution parameters, and resource limits. ```json { "projects": { "example": { "projectName": "example", "fileUrl": "dist/bundle.js", "network": "mainnet", "onlyAttestedDevices": true, "enableDevtools": false, "assignmentStrategy": { "type": "Single" }, "execution": { "type": "onetime", "maxExecutionTimeInMs": 10000 }, "maxAllowedStartDelayInMs": 10000, "usageLimit": { "maxMemory": 0, "maxNetworkRequests": 0, "maxStorage": 0 }, "numberOfReplicas": 64, "requiredModules": [], "minProcessorReputation": 0, "maxCostPerExecution": 100000000000, "includeEnvironmentVariables": [], "processorWhitelist": [], "mutability": "Immutable", "reuseKeysFrom": null } } } ``` -------------------------------- ### Add Agentic Wallet Skills Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/tools/deploy-agent.mdx Install the necessary agentic wallet skills using npm. This command adds the coinbase/agentic-wallet-skills package to your project. ```shell npx skills add coinbase/agentic-wallet-skills ``` -------------------------------- ### Check Balance and Get Tokens Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/deploy-first-app.mdx Before deploying, check your account balance. If it's zero, the CLI will provide a link to the Acurast Faucet to obtain test tokens (cACU). ```text tutorial % acurast deploy Deploying project "tutorial" Your balance is 0. Visit https://faucet.acurast.com?address=5GNimXAQhayQq8m8SxJt3xQmG2L3pGzeTkHopx9iPnrS6uHP to get some tokens. ``` -------------------------------- ### Environment Variables Configuration Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/getting-started/quickstart-cargo.mdx Example of how to set environment variables for Acurast, including the mnemonic and the webhook URL. The WEBHOOK_URL should point to your service endpoint. ```text ACURAST_MNEMONIC=abandon abandon about ... WEBHOOK_URL=https://your-webhook.example.com ``` -------------------------------- ### Deploy Job via Pay-for-Service Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/tools/deploy-agent.mdx To deploy a job on Acurast, use the '/pay-for-service' command followed by the job's run file. For example, '/pay-for-service deploy.acu.run'. ```shell /pay-for-service deploy.acu.run ``` -------------------------------- ### Acurast Deployment Status Output Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/build/llm-on-acurast.mdx Example output showing the status of an application deployment on the Acurast network. It indicates the progress from submission to waiting for processor acknowledgements. ```text tutorial % acurast deploy Deploying project "tutorial" The CLI will use the following address: 5GNimXAQhayQq8m8SxJt3xQmG2L3pGzeTkHopx9iPnrS6uHP The deployment will be scheduled to start in 5 minutes 0 seconds. There will be 1 executions with a cost of 0.001 cACU each. ❯ Deploying project (first execution scheduled in 246s) ✔ Submitted to Acurast (ipfs://...) ✔ Deployment registered (DeploymentID: ...) ⠇ Waiting for deployment to be matched with processors ◼ Waiting for processor acknowledgements ``` -------------------------------- ### Get Deployment Public Keys Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/build/cargo-runtime-environment.mdx Fetches the signing public keys for the active deployment, keyed by curve. Only curves with existing keys are included. The request and response are structured JSON-RPC objects. ```ts { "jsonrpc": "2.0", "method": "deployment_publicKeys", "params": [], "id": string } ``` ```ts { "jsonrpc": "2.0", "result": { "publicKeys": { "p256"?: string, // hex "secp256k1"?: string, // hex "ed25519"?: string // hex } }, "id": string } ``` -------------------------------- ### Get Processor App Version Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/build/nodejs-runtime-environment.mdx Retrieves the version of the processor application as a string. Example format: "1.9.2-canary". ```javascript /** * The processor app version as a string. * * Example: "1.9.2-canary" */ _STD_.app_info.version; ``` -------------------------------- ### Scaffold and Initialize Project with CLI Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/getting-started/quickstart.mdx Use the Acurast CLI to scaffold a new project and initialize its configuration files. ```bash npx @acurast/cli new my-project cd my-project acurast init ``` -------------------------------- ### Deploy Project with CLI Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/getting-started/quickstart.mdx Deploy your project after funding the account shown by the CLI. Ensure you have ACU for mainnet or cACU from the faucet for Canary. ```bash acurast deploy ``` -------------------------------- ### Typical Flow to Deploy a Job on Acurast Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/tools/deploy-agent.mdx This interactive flow demonstrates the steps involved in deploying a job, including checking wallet status and specifying the service endpoint. ```shell ❯ /pay-for-service ⏺ I'll check the wallet status first to make sure it's authenticated and ready for paid requests. ⏺ Bash(npx awal@2.0.3 status) ⎿ Wallet Server ✓ Running (PID: 33552) … +4 lines (ctrl+o to expand) ⏺ The wallet is authenticated and ready. To make a paid API request, I need to know which endpoint you want to call. Do you have a specific x402 service URL you'd like to use? ``` -------------------------------- ### Install Polkadot Peer Dependencies Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/tools/sdk.mdx Install the required Polkadot packages as peer dependencies for the Acurast SDK. ```bash npm install @polkadot/api @polkadot/api-augment @polkadot/keyring \ @polkadot/types @polkadot/types-codec @polkadot/util \ @polkadot/util-crypto @polkadot/wasm-crypto ``` -------------------------------- ### Instant Deploy Configuration Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/getting-started/quickstart-cargo.mdx Configure instant deployment to a specific device by using the `instantMatch` field within `assignmentStrategy`. Ensure `numberOfReplicas` matches the number of entries in `instantMatch`. ```json { "projects": { "cargo-hello": { ... "assignmentStrategy": { "type": "Single", "instantMatch": [ { "processor": "", "maxAllowedStartDelayInMs": 10000 } ] }, "numberOfReplicas": 1, ... } } } ``` -------------------------------- ### Create Cargo Project Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/getting-started/quickstart-cargo.mdx Create a new project directory and initialize it with Acurast. This sets up the necessary configuration files for a Cargo deployment. ```bash mkdir cargo-hello cd cargo-hello acurast init ``` -------------------------------- ### Shell Runtime Configuration Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/tools/cli.mdx Configure a project to run as a native binary within a Linux distro image using `runtime: "Shell"`. Provide an image URL and entrypoint. ```json { "projects": { "my-shell-project": { "projectName": "my-shell-project", "fileUrl": "./shell-app", "entrypoint": "acurast.sh", "runtime": "Shell", "image": { "url": "https://github.com/termux/proot-distro/releases/download/v4.30.1/ubuntu-questing-aarch64-pd-v4.30.1.tar.xz", "sha256": "5ab35b90cd9a9f180656261ba400a135c4c01c2da4b74522118342f985c2d328" }, "restartPolicy": "no", "network": "canary", "onlyAttestedDevices": true, "assignmentStrategy": { "type": "Single" }, "execution": { "type": "onetime", "maxExecutionTimeInMs": 60000 }, "maxAllowedStartDelayInMs": 10000, "usageLimit": { "maxMemory": 0, "maxNetworkRequests": 0, "maxStorage": 0 }, "numberOfReplicas": 1, "requiredModules": [], "minProcessorReputation": 0, "maxCostPerExecution": 5000000000, "includeEnvironmentVariables": [], "processorWhitelist": [] } } } ``` -------------------------------- ### Start Acurast Node with Docker Compose Source: https://github.com/acurast/acurast-docs/blob/main/docs/acurast-protocol/node-setup.mdx Command to start the Acurast node in detached mode using Docker Compose. Ensure you are in the directory containing the docker-compose.yml file. ```bash docker compose up -d ``` -------------------------------- ### Deploy Project Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/tools/devtools.mdx After enabling DevTools, deploy your project using the Acurast CLI. The CLI will output a DevTools URL with a view key. ```APIDOC ## Deploy Project After enabling DevTools, deploy your project using the Acurast CLI. The CLI will output a DevTools URL with a view key. ```bash acurast deploy my-project ``` ``` -------------------------------- ### Perform HTTP GET Request Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/build/nodejs-runtime-environment.mdx Executes an HTTP GET request to a specified URL with custom headers. The success and error callbacks handle the response or any errors encountered. ```javascript /** * Performs an HTTP GET request. * @param {string} url the url to connect to. * @param {Record} headers the request's headers, for example: { 'Accept': 'application/json' }. * @param {HttpSuccess} success the success callback function. * @param {HttpError} error the error callback function. */ function httpGET(url, headers, success, error); ``` -------------------------------- ### Pay for Deploy Agent Service Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/tools/deploy-agent.mdx Use this command to pay for and initiate a service with the deploy agent. Ensure you have the correct service URL. ```bash npx awal@2.0.3 pay https://deploy.acu.run --json ``` -------------------------------- ### Access Environment Variables in Cargo Runtime (Node.js Example) Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/build/environment-variables.mdx In the Cargo runtime, environment variables are available as standard system environment variables. This example shows accessing them via `process.env` in a Node.js context within Cargo. ```typescript const API_KEY = process.env.API_KEY; ``` -------------------------------- ### Listing Deployments Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/tools/cli.mdx Commands to list all deployments or filter them by network. ```bash acurast deployments ls ``` ```bash acurast deployments ls --network canary ``` -------------------------------- ### WebViewTab.startRefreshLoop Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/build/nodejs-runtime-environment.mdx Starts the refresh loop for the WebView tab. Available since 1.23.0 (Android). ```APIDOC ## WebViewTab.startRefreshLoop ### Description Starts the refresh loop for the WebView tab. This action may increase resource usage, so it should be used sparingly and only if absolutely necessary, for example in preparation for taking a screenshot. When no longer needed, the refresh loop should be closed with `stopRefreshLoop`. ### Parameters - **options** (WebViewStartRefreshLoopOptions|undefined) - Optional - Options for starting the refresh loop. - **interval** (number|undefined) - The interval of consecutive refreshes in milliseconds. If not provided, the default interval of 500 milliseconds is used. - **wholeTree** (boolean|undefined) - Whether to refresh the whole tree of tabs spawned by this tab or only the current one. If not provided, the default is false. ``` -------------------------------- ### browser_startRefreshLoop Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/build/cargo-runtime-environment.mdx Starts a periodic refresh loop for a tab. Stop with `browser_stopRefreshLoop` when no longer needed. ```APIDOC ## browser_startRefreshLoop ### Description Starts a periodic refresh loop for a tab. Stop with `browser_stopRefreshLoop` when no longer needed. ### Method POST ### Endpoint /browser_startRefreshLoop ### Parameters #### Request Body - **jsonrpc** (string) - Required - JSON-RPC protocol version. - **method** (string) - Required - The method name, should be `browser_startRefreshLoop`. - **params** (array) - Required - An array containing a single object. - **id** (number) - Optional - The ID of the tab to refresh. Defaults to the current active tab. - **interval** (number) - Optional - The refresh interval in milliseconds. Defaults to 500ms. - **wholeTree** (boolean) - Optional - If `true`, starts refresh loop for all spawned tabs as well. Defaults to `false`. - **id** (string) - Required - A unique identifier for the request. ### Response #### Success Response (200) - **jsonrpc** (string) - The JSON-RPC protocol version. - **result** (object) - An empty object, indicating success. - **id** (string) - The identifier for the response, matching the request ID. ### Request Example ```json { "jsonrpc": "2.0", "method": "browser_startRefreshLoop", "params": [{ "id": number, "interval": number, "wholeTree": boolean }], "id": "string" } ``` ### Response Example ```json { "jsonrpc": "2.0", "result": {}, "id": "string" } ``` ``` -------------------------------- ### _STD_.webview.getOpenTabs Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/build/nodejs-runtime-environment.mdx Gets an array of all currently open tabs. Available since 1.23.0 (Android). ```APIDOC ## _STD_.webview.getOpenTabs ### Description Gets an array of all currently open tabs. ### Parameters - **onSuccess** (WebViewGetTabsSuccess) - Required - The success callback. - **onError** (WebViewError) - Required - The error callback. ``` -------------------------------- ### Get WebView Debug URL Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/build/nodejs-runtime-environment.mdx Returns the debug URL of the WebView. This is a synchronous function. ```javascript /** * @since 1.9.2 (Android) * * Returns the debug URL of the WebView. * @return {string} the debug URL. */ _STD_.webview.getDebugUrl(): string; ``` -------------------------------- ### Get Deployment Slot Number Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/build/nodejs-runtime-environment.mdx Returns the slot number of the current deployment as a number. ```javascript /** * @return {number} The slot number of this deployment. */ _STD_.job.getSlot(); ``` -------------------------------- ### Get Ethereum Processor Address Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/build/nodejs-runtime-environment.mdx Retrieve the current deployment's Ethereum processor address. ```javascript /** * @return {string} The processor's ethereum address for the current deployment. */ _STD_.chains.ethereum.getAddress(); ``` -------------------------------- ### High-level Deployment (`@acurast/sdk/deploy`) Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/tools/sdk.mdx Utilities for high-level deployment, including zipping a project, uploading to IPFS, and registering a job on the Acurast chain in a single call. It also exports helper functions like `zipFolder`, `createManifest`, and `checkIsFolder`, along with a `Logger` interface. ```APIDOC ## `@acurast/sdk/deploy` High-level deployment utilities. Zip a local project, upload it to IPFS, and register the job on the Acurast chain in a single call. ```typescript import { deployProject, loadAcurastConfig } from '@acurast/sdk/deploy' const config = await loadAcurastConfig('./acurast.json') await deployProject({ config /* ... */ }) ``` Also exports `zipFolder`, `createManifest`, `checkIsFolder`, and a `Logger` interface with a `NOOP_LOGGER` default. ``` -------------------------------- ### Build Static Content Source: https://github.com/acurast/acurast-docs/blob/main/README.md This command generates static content for deployment. The output is placed in the 'build' directory. ```bash yarn build ``` -------------------------------- ### Get Aeternity Address Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/build/nodejs-runtime-environment.mdx Retrieves the Aeternity address associated with the current environment. Requires version 1.3.34. ```javascript /** * Returns the Aeternity address. * * @since 1.3.34 (version code 19) * * @return {string} The Aeternity address */ _STD_.chains.aeternity.getAddress(); ``` -------------------------------- ### Get Main Account Address Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/build/nodejs-runtime-environment.mdx Retrieves the main account's address as a string. Available since version 1.9.2. ```javascript /** * Get the main account address. * * @since 1.9.2 (version code 58) * * @return {string} String representing the main account address. */ _STD_.device.getAddress(); ``` -------------------------------- ### Connect to P2P Peer Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/build/nodejs-runtime-environment.mdx Establishes a connection to a P2P peer. Supports optional connection options like timeout. Requires success and error callbacks. ```javascript /** * @param {string} peer the address or peer ID of the target peer to establish a connection with. * @param {P2PConnectOptions|undefined} options an optional configuration of this call. * @param {P2PSuccess} success the success callback. * @param {P2PError} error the error callback. */ _STD_.p2p.connect(peer, options, success, error); ``` -------------------------------- ### Get Current Tab URL Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/build/cargo-runtime-environment.mdx Fetches the current URL of a specified tab. Returns `null` if the tab has not yet loaded. ```typescript { "jsonrpc": "2.0", "method": "browser_currentUrl", "params": [{ "id"?: number }], "id": string } ``` ```typescript { "jsonrpc": "2.0", "result": { "url": string | null }, "id": string } ``` -------------------------------- ### Query Deploy Agent for Job Pricing Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/tools/deploy-agent.mdx Before deploying, query the deploy agent to understand accepted payment tokens and the estimated job cost. This uses `curl` to send a POST request with job parameters. ```shell curl "https://deploy.acu.run/deploy" -X POST -H "Content-Type: application/json" -i -d '{ "script": "ipfs://QmZ9mvN4RFCqSqivB2LF3VF1qgrDGTW393PJezbdPy7nH2", "allowedSources": null, "allowOnlyVerifiedSources": true, "schedule": { "startTime": 1777593600000, "endTime": 1777651200000, "duration": 3600000, "interval": 3600001, "maxStartDelay": 10000 }, "memory": 0, "networkRequests": 0, "storage": 0, "requiredModules": [], "assignmentStrategy": "Single", "slots": 1, "reward": 77136800000, "minReputation": 0, "runtime": "NodeJS" }' | sed -n 's/^payment-required: //Ip' | tr -d '\r' | base64 -d | jq ``` -------------------------------- ### Get Currently Open WebView Tabs Source: https://github.com/acurast/acurast-docs/blob/main/docs/developers/build/nodejs-runtime-environment.mdx Retrieves an array of all currently open WebView tabs. Requires success and error callbacks. ```javascript /** * @since 1.23.0 (Android) * * Gets an array of all currently open tabs. * @param {WebViewGetTabsSuccess} onSuccess the success callback. * @param {WebViewError} onError the error callback. */ _STD_.webview.getOpenTabs(onSuccess, onError); ```