compose-reference

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Goldsky Compose Reference

Goldsky Compose 参考文档

Reference for the
compose.yaml
manifest, the full
goldsky compose
CLI surface, the
TaskContext
API, wallets, gas sponsorship, contract codegen, the dashboard, and pricing. For interactive build flows use
/compose
; for debugging use
/compose-doctor
.
Always validate the manifest before deploying.
goldsky compose dev
catches schema errors fast.
本文档为
compose.yaml
清单、完整
goldsky compose
CLI功能、
TaskContext
API、钱包、Gas赞助、合约代码生成、仪表板及定价提供参考。如需交互式构建流程,请使用
/compose
;如需调试,请使用
/compose-doctor
部署前请务必验证清单。
goldsky compose dev
可快速捕获 schema 错误。

Quick Reference

快速参考

Most common lookups:
最常见的查询内容:

compose.yaml Manifest

compose.yaml 清单

Top-level fields

顶层字段

FieldTypeRequiredNotes
name
stringyesRFC 1123: lowercase, letters/numbers/hyphens, letter-start
api_version
stringdeploy-onlysemver (e.g.
0.1.0
) or
stable
/
preview
/
canary
tasks
arrayyesNon-empty
secrets
string[]noNames only — values set via
compose secret set
env
{ local?, cloud? }
noEach is
Record<string, string>
, flattened into
context.env
字段类型必填说明
name
string符合RFC 1123规范:小写字母、数字、连字符,以字母开头
api_version
string仅部署时需填语义化版本(如
0.1.0
)或
stable
/
preview
/
canary
tasks
array不能为空
secrets
string[]仅需填写名称——值通过
compose secret set
设置
env
{ local?, cloud? }
每个属性为
Record<string, string>
,会被扁平化到
context.env

Task fields

任务字段

FieldTypeRequiredNotes
name
stringyes
/^([a-zA-Z]|_[a-zA-Z0-9])[a-zA-Z0-9_]*$/
path
stringyesRelative path to the
.ts
task file
triggers
arrayyesOne or more; at most one per type
retry_config
objectno
{ max_attempts, initial_interval_ms, backoff_factor }
— all three required when set
字段类型必填说明
name
string符合正则
/^([a-zA-Z]|_[a-zA-Z0-9])[a-zA-Z0-9_]*$/
path
string指向
.ts
任务文件的相对路径
triggers
array至少一个;每种类型最多一个
retry_config
object
{ max_attempts, initial_interval_ms, backoff_factor }
——设置时三个属性均为必填项

Trigger types

触发器类型

cron
yaml
- type: cron
  expression: "*/15 * * * *" # 5-field cron
http
yaml
- type: http
  authentication: auth_token # or "none"
  ip_whitelist: ["1.2.3.4", "10.0.0.0/8"] # optional, IPv4/IPv6/CIDR
onchain_event
yaml
- type: onchain_event
  network: polygon_amoy # snake_case required
  contract: "0xYourContractAddress" # 0x + 40 hex
  events:
    - "Transfer(address,address,uint256)" # viem signature strings, optional
  dataset_version: "..." # optional
cron
yaml
- type: cron
  expression: "*/15 * * * *" # 5字段cron表达式
http
yaml
- type: http
  authentication: auth_token # 或 "none"
  ip_whitelist: ["1.2.3.4", "10.0.0.0/8"] # 可选,支持IPv4/IPv6/CIDR
onchain_event
yaml
- type: onchain_event
  network: polygon_amoy # 必须使用蛇形命名
  contract: "0xYourContractAddress" # 0x开头加40位十六进制字符
  events:
    - "Transfer(address,address,uint256)" # viem签名格式字符串,可选
  dataset_version: "..." # 可选

Full manifest example

完整清单示例

yaml
name: my-app
api_version: stable
secrets:
  - COINGECKO_API_KEY
  - ORACLE_SIGNER_KEY
env:
  cloud:
    LOG_LEVEL: info
  local:
    LOG_LEVEL: debug
tasks:
  - name: update_oracle
    path: src/tasks/update-oracle.ts
    retry_config:
      max_attempts: 3
      initial_interval_ms: 1000
      backoff_factor: 2
    triggers:
      - type: cron
        expression: "*/5 * * * *"
  - name: manual_trigger
    path: src/tasks/manual-trigger.ts
    triggers:
      - type: http
        authentication: auth_token
yaml
name: my-app
api_version: stable
secrets:
  - COINGECKO_API_KEY
  - ORACLE_SIGNER_KEY
env:
  cloud:
    LOG_LEVEL: info
  local:
    LOG_LEVEL: debug
tasks:
  - name: update_oracle
    path: src/tasks/update-oracle.ts
    retry_config:
      max_attempts: 3
      initial_interval_ms: 1000
      backoff_factor: 2
    triggers:
      - type: cron
        expression: "*/5 * * * *"
  - name: manual_trigger
    path: src/tasks/manual-trigger.ts
    triggers:
      - type: http
        authentication: auth_token

CLI Commands

CLI命令

All commands accept
-t/--token
and
--api-server
; the
-n/--name
flag selects the app by name (falls back to
-m/--manifest
, then
./compose.yaml
).
所有命令均支持
-t/--token
--api-server
-n/--name
标志用于按名称选择应用(优先级高于
-m/--manifest
,最后会回退到
./compose.yaml
)。

Lifecycle

生命周期管理

CommandPurposeKey flags
compose init [name]
Scaffold new app(interactive)
compose dev
Run locally (alias:
start
)
--fork-chains
,
--cloud
compose deploy
Bundle + upload to cloud
-m
,
-t
,
-f
,
--sync-env
compose status
Show runtime status
-n
,
--json
compose list
List all apps
--json
compose pause
Pause
-n
compose resume
Resume
-n
compose delete
Delete (type-to-confirm;
--force
for CI)
-n
,
--force
,
--delete-database
compose logs
View / tail logs
-f
,
--tail
,
--level
,
--search
,
--since
,
--max-lines
,
--json
compose clean
Wipe local
.compose/stage.db
-f
compose update
Re-download the compose binary
--preview
compose callTask <name> <json>
POST payload to a local task
命令用途关键标志
compose init [name]
搭建新应用模板(交互式)
compose dev
本地运行(别名:
start
--fork-chains
,
--cloud
compose deploy
打包并上传至云端
-m
,
-t
,
-f
,
--sync-env
compose status
显示运行状态
-n
,
--json
compose list
列出所有应用
--json
compose pause
暂停应用
-n
compose resume
恢复应用
-n
compose delete
删除应用(需输入确认;CI环境可使用
--force
-n
,
--force
,
--delete-database
compose logs
查看/跟踪日志
-f
,
--tail
,
--level
,
--search
,
--since
,
--max-lines
,
--json
compose clean
清空本地
.compose/stage.db
文件
-f
compose update
重新下载compose二进制文件
--preview
compose callTask <name> <json>
向本地任务发送POST请求

Secrets

密钥管理

CommandPurpose
compose secret set --name X --value Y [--env local|cloud] [--redeploy]
Set a secret
compose secret delete --name X [--env local|cloud]
Delete
compose secret list [--env local|cloud]
List
compose secret sync
Upload all of
.env
to cloud
命令用途
compose secret set --name X --value Y [--env local|cloud] [--redeploy]
设置密钥
compose secret delete --name X [--env local|cloud]
删除密钥
compose secret list [--env local|cloud]
列出密钥
compose secret sync
将所有
.env
中的密钥上传至云端

Wallets

钱包管理

CommandPurpose
compose wallet create --name X [--env local|cloud]
Create managed wallet; prints address
compose wallet list
Table: name, address, type (privy / private_key / tevm), created_at
命令用途
compose wallet create --name X [--env local|cloud]
创建托管钱包;会输出钱包地址
compose wallet list
表格形式展示:名称、地址、类型(privy/private_key/tevm)、创建时间

Codegen

代码生成

compose codegen
— parse all
src/contracts/*.json
ABIs, write
.compose/generated/index.ts
and
.compose/types.d.ts
. Runs automatically inside
compose init
,
compose dev
, and during deploy.
compose codegen
—— 解析所有
src/contracts/*.json
格式的ABI,生成
.compose/generated/index.ts
.compose/types.d.ts
文件。该命令会在
compose init
compose dev
以及部署过程中自动运行。

TaskContext API

TaskContext API

main(context: TaskContext, params?: Record<string, unknown>): Promise<unknown>
receives:
ts
type TaskContext = {
  env: Record<string, string>;
  fetch: FetchFn;
  callTask: <Args, T>(name: string, args: Args, retryConfig?: RetryConfig) => Promise<T>;
  logEvent: (event: { code: string; message: string; data?: unknown }) => Promise<void>;
  evm: {
    chains: Record<string, Chain>;              // re-exported from viem/chains
    wallet: (config: WalletConfig) => Promise<IWallet>;
    decodeEventLog: <T>(abi: AbiItem[], log: EventLog) => Promise<T>;
    contracts: Record<string, ContractClass>;   // populated by codegen
  };
  collection: <T>(name: string, indexes?: string[]) => Promise<Collection<T>>;
};
No
logger
or
secrets
namespace.
Secrets flatten into
context.env
. Use
console.log
for free-form logging,
logEvent
for structured events.
main(context: TaskContext, params?: Record<string, unknown>): Promise<unknown>
函数接收的参数结构如下:
ts
type TaskContext = {
  env: Record<string, string>;
  fetch: FetchFn;
  callTask: <Args, T>(name: string, args: Args, retryConfig?: RetryConfig) => Promise<T>;
  logEvent: (event: { code: string; message: string; data?: unknown }) => Promise<void>;
  evm: {
    chains: Record<string, Chain>;              // 从viem/chains导出
    wallet: (config: WalletConfig) => Promise<IWallet>;
    decodeEventLog: <T>(abi: AbiItem[], log: EventLog) => Promise<T>;
    contracts: Record<string, ContractClass>;   // 由代码生成自动填充
  };
  collection: <T>(name: string, indexes?: string[]) => Promise<Collection<T>>;
};
不存在
logger
secrets
命名空间
。密钥会被扁平化到
context.env
中。使用
console.log
进行自由格式日志记录,使用
logEvent
进行结构化事件记录。

fetch
(overloads)

fetch
(重载)

ts
interface FetchFn {
  <T>(url: string, retryConfig?: RetryConfig): Promise<T | undefined>;
  <T>(url: string, body: unknown, retryConfig?: RetryConfig): Promise<T | undefined>;
}
  • body
    is serialized as JSON and sent as POST. Omit
    body
    for GET.
  • Response is JSON-parsed; returns
    undefined
    when the body isn't JSON.
  • Not
    window.fetch
    — use this, not native
    fetch
    .
ts
interface FetchFn {
  <T>(url: string, retryConfig?: RetryConfig): Promise<T | undefined>;
  <T>(url: string, body: unknown, retryConfig?: RetryConfig): Promise<T | undefined>;
}
  • body
    会被序列化为JSON并以POST方式发送。省略
    body
    则使用GET请求。
  • 响应会被解析为JSON;若响应体不是JSON则返回
    undefined
  • 此方法并非
    window.fetch
    ——请使用本方法,而非原生
    fetch

callTask

callTask

ts
callTask<Args, T>(name: string, args: Args, retryConfig?: RetryConfig): Promise<T>
  • T
    is whatever the callee returns. A
    void
    -returning task resolves to
    undefined
    .
  • Use for task-to-task invocation (parent/child patterns).
ts
callTask<Args, T>(name: string, args: Args, retryConfig?: RetryConfig): Promise<T>
  • T
    为被调用任务的返回值类型。返回
    void
    的任务会解析为
    undefined
  • 用于任务间调用(父/子任务模式)。

RetryConfig

RetryConfig

ts
type RetryConfig = {
  max_attempts: number;         // ≥0
  initial_interval_ms: number;  // >0
  backoff_factor: number;       // >0
};
No defaults — supply all three when you pass a
retryConfig
. Without it, the task runs once and any thrown error surfaces to the run record.
ts
type RetryConfig = {
  max_attempts: number;         // ≥0
  initial_interval_ms: number;  // >0
  backoff_factor: number;       // >0
};
无默认值——传递
retryConfig
时需提供所有三个属性。若未传递,则任务仅运行一次,任何抛出的错误都会显示在运行记录中。

EventLog
(for
decodeEventLog
and
onchain_event
triggers)

EventLog
(用于
decodeEventLog
onchain_event
触发器)

ts
type EventLog = {
  address: Address;     // "0x…"
  topics: Hex[];        // indexed topics
  data: Hex;            // non-indexed data
  blockNumber?: bigint;
  transactionHash?: Hex;
  logIndex?: number;
};
For
onchain_event
-triggered tasks,
params
contains
{ log: EventLog }
plus chain-specific metadata.
decodeEventLog(abi, params.log)
returns the decoded struct.
ts
type EventLog = {
  address: Address;     // "0x…"
  topics: Hex[];        // 索引化主题
  data: Hex;            // 非索引化数据
  blockNumber?: bigint;
  transactionHash?: Hex;
  logIndex?: number;
};
对于由
onchain_event
触发的任务,
params
包含
{ log: EventLog }
以及链相关元数据。
decodeEventLog(abi, params.log)
会返回解码后的结构体。

IWallet

IWallet

ts
interface IWallet {
  readonly name: string;
  readonly address: Address;
  writeContract(
    chain: Chain,
    address: Address,
    signatureOrAbi: string | AbiItem,
    args?: unknown[],
    options?: WriteOptions,
  ): Promise<TxResult>;
  readContract(
    chain: Chain,
    address: Address,
    signatureOrAbi: string | AbiItem,
    args?: unknown[],
  ): Promise<unknown>;
  sendTransaction(
    chain: Chain,
    to: Address,
    value: bigint,
    data?: Hex,
    options?: WriteOptions,
  ): Promise<TxResult>;
  simulate(
    chain: Chain,
    address: Address,
    signatureOrAbi: string | AbiItem,
    args?: unknown[],
  ): Promise<SimulateResult>;
  getBalance(chain: Chain): Promise<bigint>;
}

type WriteOptions = {
  confirmations?: number;
  onReorg?: { action: { type: "replay" | "skip" }; depth: number };
  retryConfig?: RetryConfig;
  gas?: bigint;
  gasPrice?: bigint;
};

type TxResult = {
  hash: Hex;
  userOpHash?: Hex;     // only for sponsored transactions
  chainId: number;
  blockNumber?: bigint; // present after mining
};

type SimulateResult = {
  success: boolean;
  result?: unknown;
  error?: string;
};
ts
interface IWallet {
  readonly name: string;
  readonly address: Address;
  writeContract(
    chain: Chain,
    address: Address,
    signatureOrAbi: string | AbiItem,
    args?: unknown[],
    options?: WriteOptions,
  ): Promise<TxResult>;
  readContract(
    chain: Chain,
    address: Address,
    signatureOrAbi: string | AbiItem,
    args?: unknown[],
  ): Promise<unknown>;
  sendTransaction(
    chain: Chain,
    to: Address,
    value: bigint,
    data?: Hex,
    options?: WriteOptions,
  ): Promise<TxResult>;
  simulate(
    chain: Chain,
    address: Address,
    signatureOrAbi: string | AbiItem,
    args?: unknown[],
  ): Promise<SimulateResult>;
  getBalance(chain: Chain): Promise<bigint>;
}

type WriteOptions = {
  confirmations?: number;
  onReorg?: { action: { type: "replay" | "skip" }; depth: number };
  retryConfig?: RetryConfig;
  gas?: bigint;
  gasPrice?: bigint;
};

type TxResult = {
  hash: Hex;
  userOpHash?: Hex;     // 仅赞助交易返回该字段
  chainId: number;
  blockNumber?: bigint; // 挖矿完成后返回该字段
};

type SimulateResult = {
  success: boolean;
  result?: unknown;
  error?: string;
};

Collection

Collection

ts
interface Collection<T> {
  insertOne(doc: T): Promise<void>;
  findOne(filter: Filter<T>): Promise<T | null>;
  findMany(filter: Filter<T>, options?: { limit?: number; skip?: number }): Promise<T[]>;
  getById(id: string): Promise<T | null>;
  setById(id: string, doc: T, opts?: { upsert?: boolean }): Promise<void>; // upsert defaults true
  deleteById(id: string): Promise<void>;
  drop(): Promise<void>;
}
Filter operators:
$gt
,
$gte
,
$lt
,
$lte
,
$in
,
$ne
,
$nin
,
$exists
. Equality:
{ field: value }
.
ts
interface Collection<T> {
  insertOne(doc: T): Promise<void>;
  findOne(filter: Filter<T>): Promise<T | null>;
  findMany(filter: Filter<T>, options?: { limit?: number; skip?: number }): Promise<T[]>;
  getById(id: string): Promise<T | null>;
  setById(id: string, doc: T, opts?: { upsert?: boolean }): Promise<void>; // upsert默认值为true
  deleteById(id: string): Promise<void>;
  drop(): Promise<void>;
}
过滤运算符:
$gt
$gte
$lt
$lte
$in
$ne
$nin
$exists
。相等匹配:
{ field: value }

CLI JSON Schemas

CLI JSON Schema

For agents parsing
--json
output:
供Agent解析
--json
输出使用:

compose status -n <app> --json

compose status -n <app> --json

json
{
  "name": "my-app",
  "status": "RUNNING",
  "created_at": 1771630350411,
  "updated_at": 1774473580871
}
status
is one of
RUNNING | PAUSED | ERROR | STARTING | STOPPED | PROVISIONING
. Timestamps are ms epoch.
json
{
  "name": "my-app",
  "status": "RUNNING",
  "created_at": 1771630350411,
  "updated_at": 1774473580871
}
status
可选值为
RUNNING | PAUSED | ERROR | STARTING | STOPPED | PROVISIONING
。时间戳为毫秒级时间戳。

compose list --json

compose list --json

json
[
  { "name": "my-app", "status": "RUNNING", "created_at": 1771630350411, "updated_at": 1774473580871 }
]
json
[
  { "name": "my-app", "status": "RUNNING", "created_at": 1771630350411, "updated_at": 1774473580871 }
]

compose logs --json

compose logs --json

NDJSON (one object per line):
json
{"timestamp":"2026-04-20T10:00:00Z","level":"info","message":"...","dashboard_url":"https://app.goldsky.com/<project_id>/dashboard/compose/<app>/runs/<run_id>"}
NDJSON格式(每行一个对象):
json
{"timestamp":"2026-04-20T10:00:00Z","level":"info","message":"...","dashboard_url":"https://app.goldsky.com/<project_id>/dashboard/compose/<app>/runs/<run_id>"}

compose secret list -n <app> --json

compose secret list -n <app> --json

json
[{ "name": "MY_SECRET" }]
Values are never returned.
json
[{ "name": "MY_SECRET" }]
永远不会返回密钥值。

compose wallet list --json

compose wallet list --json

json
[{ "name": "updater", "address": "0x...", "type": "privy", "created_at": 1771630350411 }]
type
is one of
privy
(smart wallet),
private_key
(BYO EOA),
tevm
(local forked).
json
[{ "name": "updater", "address": "0x...", "type": "privy", "created_at": 1771630350411 }]
type
可选值为
privy
(智能钱包)、
private_key
(自备EOA)、
tevm
(本地分叉链)。

Wallets — Deep Dive

钱包——深入解析

Smart wallet (managed, Privy-backed)

智能钱包(托管式,基于Privy)

ts
const w = await evm.wallet({ name: "my-oracle" }); // sponsorGas defaults TRUE
Created cloud-side by Privy. Address is persisted. Gas-sponsored by default. Cannot be used in plain local dev — throws
"You cannot use a smart wallet in local dev unless you use chain forking."
Use
compose dev --fork-chains
or switch to a BYO EOA for local iteration.
ts
const w = await evm.wallet({ name: "my-oracle" }); // sponsorGas默认值为TRUE
由Privy在云端创建。地址会被持久化。默认启用Gas赞助无法在纯本地开发环境中使用——会抛出错误
"You cannot use a smart wallet in local dev unless you use chain forking."
。请使用
compose dev --fork-chains
或切换为自备EOA进行本地开发。

BYO EOA (private key)

自备EOA(私钥)

ts
const w = await evm.wallet({
  privateKey: env.MY_KEY,
  name: "my-pk-wallet",       // optional; defaults to the derived address
  sponsorGas: true,           // DEFAULTS TO FALSE — opt in explicitly
});
Works in both cloud and local. When
sponsorGas: true
, the wallet configures EIP-7702 delegation per chain on first use, then submits UserOperations through a sponsored bundler.
ts
const w = await evm.wallet({
  privateKey: env.MY_KEY,
  name: "my-pk-wallet",       // 可选;默认值为派生地址
  sponsorGas: true,           // 默认值为FALSE——需显式开启
});
可在云端和本地环境中使用。当
sponsorGas: true
时,钱包会在首次使用时为每条链配置EIP-7702委托,然后通过赞助打包器提交UserOperations。

Gas Sponsorship

Gas赞助

Bundler fallback order: Alchemy → Pimlico → Gelato. Override via
BUNDLER_PROVIDER=<alchemy|pimlico|gelato>
env var.
打包器 fallback 顺序:Alchemy → Pimlico → Gelato。可通过环境变量
BUNDLER_PROVIDER=<alchemy|pimlico|gelato>
覆盖默认顺序。

Supported chains

支持的链

See the Goldsky docs chains page for the current list (don't hardcode — this changes). Highlights include Ethereum, Base, Arbitrum, Optimism, Polygon, Unichain, Monad (mainnet + testnet), MegaETH testnet, Lisk, Linea, Scroll, Avalanche, Blast, BNB, Celo, Zora, Sonic, Worldchain, plus major Sepolia testnets and Polygon Amoy.
请查看Goldsky文档的链列表获取最新支持链(请勿硬编码——列表会更新)。主要支持链包括Ethereum、Base、Arbitrum、Optimism、Polygon、Unichain、Monad(主网+测试网)、MegaETH测试网、Lisk、Linea、Scroll、Avalanche、Blast、BNB、Celo、Zora、Sonic、Worldchain,以及主要的Sepolia测试网和Polygon Amoy测试网。

Error on unsupported chain

不支持链的错误提示

No bundler provider available for chain <id>. Providers: alchemy: chain not supported; pimlico: missing keys (PIMLICO_API_KEY); gelato: …
Either use a supported chain or set
sponsorGas: false
and fund the EOA manually.
No bundler provider available for chain <id>. Providers: alchemy: chain not supported; pimlico: missing keys (PIMLICO_API_KEY); gelato: …
请使用支持的链,或设置
sponsorGas: false
并手动为EOA充值Gas。

Caveats

注意事项

  • onReorg
    is not supported for gas-sponsored transactions (warning logged, not fatal).
  • Passing a custom
    nonce
    to a sponsored
    sendTransaction
    is ignored (ERC-4337 smart wallets use a different nonce structure).
  • Gas赞助交易不支持
    onReorg
    (会记录警告,但不会导致任务失败)。
  • 向赞助的
    sendTransaction
    传递自定义
    nonce
    会被忽略(ERC-4337智能钱包使用不同的nonce结构)。

Contract Codegen (full example)

合约代码生成(完整示例)

Input

输入

Drop ABI JSON files into
src/contracts/
:
src/contracts/
├── ERC20.json
└── PriceFeed.json
Accepted ABI shapes: bare ABI array (
[{ "type": "function", ... }, ...]
), or wrapped object (
{ "abi": [...] }
), or a Foundry/Hardhat artifact (the generator extracts the
abi
field). The filename (without extension) becomes the generated class name.
将ABI JSON文件放入
src/contracts/
目录:
src/contracts/
├── ERC20.json
└── PriceFeed.json
支持的ABI格式:纯ABI数组(
[{ "type": "function", ... }, ...]
)、包装对象(
{ "abi": [...] }
)或Foundry/Hardhat工件(生成器会提取
abi
字段)。文件名(不含扩展名)会成为生成类的名称。

Generate

生成

bash
goldsky compose codegen
(Also runs automatically during
init
,
dev
, and
deploy
.)
bash
goldsky compose codegen
(该命令也会在
init
dev
deploy
过程中自动运行。)

Output

输出

.compose/generated/index.ts
exports a class per ABI.
.compose/types.d.ts
declares ambient types under the
compose
path alias (referenced in the scaffolded
tsconfig.json
).
.compose/generated/index.ts
会导出每个ABI对应的类。
.compose/types.d.ts
会在
compose
路径别名下声明全局类型(在脚手架生成的
tsconfig.json
中已引用)。

Consume in a task

在任务中使用

ts
import type { TaskContext } from "compose";

export async function main({ evm, env }: TaskContext) {
  const PriceFeed = evm.contracts.PriceFeed;
  const feed = new PriceFeed(evm.chains.ethereum, env.FEED_ADDRESS);
  const price = await feed.latestAnswer();
  return { price: price.toString() };
}
Classes are exposed under
context.evm.contracts.<Name>
. Codegen names ending in
Class
(e.g.
ERC20Class
) are exposed as
ERC20
at runtime.
ts
import type { TaskContext } from "compose";

export async function main({ evm, env }: TaskContext) {
  const PriceFeed = evm.contracts.PriceFeed;
  const feed = new PriceFeed(evm.chains.ethereum, env.FEED_ADDRESS);
  const price = await feed.latestAnswer();
  return { price: price.toString() };
}
类会暴露在
context.evm.contracts.<Name>
下。代码生成的名称以
Class
结尾的(如
ERC20Class
),在运行时会以
ERC20
的名称暴露。

Supported Chains

支持的链

context.evm.chains
is re-exported from
viem/chains
. Any chain viem knows, you can address as
evm.chains.<name>
(e.g.
evm.chains.polygonAmoy
,
evm.chains.monadTestnet
,
evm.chains.baseSepolia
). For gas sponsorship specifically, see the Gas Sponsorship section — sponsorship is a subset of viem's chain list.
context.evm.chains
是从
viem/chains
导出的。viem支持的所有链,均可通过
evm.chains.<name>
访问(如
evm.chains.polygonAmoy
evm.chains.monadTestnet
evm.chains.baseSepolia
)。Gas赞助仅支持部分链——请查看Gas赞助章节,赞助链是viem链列表的子集。

Dashboard

仪表板

URL pattern:
https://app.goldsky.com/<project_id>/dashboard/compose/<app-name>
https://app.goldsky.com/<project_id>/dashboard/compose/<app-name>/runs/<run_id>
The dashboard shows status, secrets, logs, and per-run traces. Log lines include a
dashboard_url
attribute in their metadata so agents can link the user directly to the relevant run.
URL格式:
https://app.goldsky.com/<project_id>/dashboard/compose/<app-name>
https://app.goldsky.com/<project_id>/dashboard/compose/<app-name>/runs/<run_id>
仪表板会显示应用状态、密钥、日志以及每次运行的追踪信息。日志行的元数据中包含
dashboard_url
属性,Agent可通过该属性直接将用户引导至相关运行记录页面。

Pricing

定价

Compose is in Beta. Pricing is enterprise-only — schedule a call with Goldsky to discuss your use case. Source: https://goldsky.com/pricing (Compose section).
Internally, usage is tracked across three metered dimensions:
  • Function calls (
    compose_function_calls
    ) — number of task invocations.
  • Worker hours (
    compose_worker_hours
    ) — runtime consumed.
  • Gas spend (
    compose_gas_spend
    ) — gas paid for sponsored transactions.
These metrics drive enterprise-tier billing; per-unit prices are set per contract, not published.
Compose目前处于Beta阶段。定价仅面向企业客户——请联系Goldsky团队讨论您的使用场景。来源:https://goldsky.com/pricing(Compose章节)。
内部会通过三个计量维度跟踪使用情况:
  • 函数调用次数
    compose_function_calls
    )——任务调用次数。
  • 工作时长
    compose_worker_hours
    )——消耗的运行时间。
  • Gas花费
    compose_gas_spend
    )——赞助交易支付的Gas费用。
这些指标用于企业级计费;单价会根据合同约定,不对外公开。

Related

相关工具

  • /compose
    — Build a new app or explain what Compose is.
  • /compose-doctor
    — Diagnose and fix broken apps.
  • /auth-setup
    goldsky login
    help.
  • /secrets
    — General secret management.
  • /compose
    —— 构建新应用或了解Compose的功能。
  • /compose-doctor
    —— 诊断并修复故障应用。
  • /auth-setup
    ——
    goldsky login
    相关帮助。
  • /secrets
    —— 通用密钥管理。