basket-query

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Basket Query

篮子查询

All queries are read-only and free — no
--account
needed.
所有查询均为只读且免费——无需使用
--account
参数。

Setup

环境设置

MAINNET ONLY. Run
vara-wallet config set network mainnet
before anything else. NEVER switch to testnet — there are no contracts there.
bash
undefined
仅支持主网。在进行任何操作前,请先运行
vara-wallet config set network mainnet
。切勿切换到测试网——测试网中没有部署相关合约。
bash
undefined

Set network and variables (see ../references/program-ids.md)

Set network and variables (see ../references/program-ids.md)

vara-wallet config set network mainnet BASKET_MARKET="0x702395d43248eaa5f1fd4d9eadadc75b0fb1c7c5ae9ea20bf31375fd4358f403" BET_TOKEN="0x41be634b690ecde3d79f63ea2db9834b8570a6d4abb3c0be47af3947e3129ece" BET_LANE="0xf5aa436669bb3fc97c1675d06949592e8617f889cbd055451f321113b17bb564" _PB="${POLYBASKETS_SKILLS_DIR:-skills}" IDL="$_PB/idl/polymarket-mirror.idl" BET_TOKEN_IDL="$_PB/idl/bet_token_client.idl" BET_LANE_IDL="$_PB/idl/bet_lane_client.idl"
undefined
vara-wallet config set network mainnet BASKET_MARKET="0x702395d43248eaa5f1fd4d9eadadc75b0fb1c7c5ae9ea20bf31375fd4358f403" BET_TOKEN="0x41be634b690ecde3d79f63ea2db9834b8570a6d4abb3c0be47af3947e3129ece" BET_LANE="0xf5aa436669bb3fc97c1675d06949592e8617f889cbd055451f321113b17bb564" _PB="${POLYBASKETS_SKILLS_DIR:-skills}" IDL="$_PB/idl/polymarket-mirror.idl" BET_TOKEN_IDL="$_PB/idl/bet_token_client.idl" BET_LANE_IDL="$_PB/idl/bet_lane_client.idl"
undefined

Get Your Hex Address

获取你的十六进制地址

Sails
actor_id
args require hex format — SS58 addresses won't work:
bash
MY_ADDR=$(vara-wallet balance | jq -r .address)
echo $MY_ADDR  # 0xe008...
Sails的
actor_id
参数要求为十六进制格式——SS58地址无法使用:
bash
MY_ADDR=$(vara-wallet balance | jq -r .address)
echo $MY_ADDR  # 0xe008...

BasketMarket Queries

BasketMarket查询

Get basket count

获取篮子数量

bash
vara-wallet call $BASKET_MARKET BasketMarket/GetBasketCount --args '[]' --idl $IDL
Returns
u64
— total baskets created. Basket IDs are 0-indexed.
bash
vara-wallet call $BASKET_MARKET BasketMarket/GetBasketCount --args '[]' --idl $IDL
返回
u64
类型数据——即已创建的篮子总数。篮子ID从0开始索引。

Get a basket

获取单个篮子信息

bash
vara-wallet call $BASKET_MARKET BasketMarket/GetBasket --args '[0]' --idl $IDL
Response is nested under
.result.ok
. Parse with jq:
bash
undefined
bash
vara-wallet call $BASKET_MARKET BasketMarket/GetBasket --args '[0]' --idl $IDL
响应结果嵌套在
.result.ok
下。可使用jq工具解析:
bash
undefined

⚠ Use .result.ok — NOT .ok!

⚠ 使用.result.ok — 不要使用.ok!

vara-wallet call $BASKET_MARKET BasketMarket/GetBasket --args '[0]' --idl $IDL | jq '.result.ok'

Basket fields: `id`, `creator`, `name`, `description`, `items` (array of BasketItem), `created_at`, `status` (Active/SettlementPending/Settled), `asset_kind` (Vara/Bet).
vara-wallet call $BASKET_MARKET BasketMarket/GetBasket --args '[0]' --idl $IDL | jq '.result.ok'

篮子包含以下字段:`id`、`creator`、`name`、`description`、`items`(BasketItem数组)、`created_at`、`status`(Active/SettlementPending/Settled)、`asset_kind`(Vara/Bet)。

Get user positions

获取用户仓位

bash
vara-wallet call $BASKET_MARKET BasketMarket/GetPositions \
  --args '["'$MY_ADDR'"]' --idl $IDL
Returns
vec Position
. Each position has:
basket_id
,
user
,
shares
,
claimed
,
index_at_creation_bps
.
To get the agent's own address:
bash
AGENT_ADDR=$(vara-wallet wallet list | jq -r '.[0].address')
bash
vara-wallet call $BASKET_MARKET BasketMarket/GetPositions \
  --args '["'$MY_ADDR'"]' --idl $IDL
返回
vec Position
类型数据。每个仓位包含以下字段:
basket_id
user
shares
claimed
index_at_creation_bps
获取Agent自身的地址:
bash
AGENT_ADDR=$(vara-wallet wallet list | jq -r '.[0].address')

Get settlement

获取结算信息

bash
vara-wallet call $BASKET_MARKET BasketMarket/GetSettlement --args '[0]' --idl $IDL
Returns
Result<Settlement, BasketMarketError>
. Key fields:
status
(Proposed/Finalized),
payout_per_share
,
challenge_deadline
,
finalized_at
,
item_resolutions
.
bash
vara-wallet call $BASKET_MARKET BasketMarket/GetSettlement --args '[0]' --idl $IDL
返回
Result<Settlement, BasketMarketError>
类型数据。关键字段包括:
status
(Proposed/Finalized)、
payout_per_share
challenge_deadline
finalized_at
item_resolutions

Check config

检查配置信息

bash
vara-wallet call $BASKET_MARKET BasketMarket/GetConfig --args '[]' --idl $IDL
Returns
BasketMarketConfig
:
admin_role
,
settler_role
,
liveness_ms
,
vara_enabled
.
bash
vara-wallet call $BASKET_MARKET BasketMarket/GetConfig --args '[]' --idl $IDL
返回
BasketMarketConfig
类型数据:
admin_role
settler_role
liveness_ms
vara_enabled

Check VARA enabled

检查VARA是否启用

bash
vara-wallet call $BASKET_MARKET BasketMarket/IsVaraEnabled --args '[]' --idl $IDL
Returns
bool
.
bash
vara-wallet call $BASKET_MARKET BasketMarket/IsVaraEnabled --args '[]' --idl $IDL
返回
bool
类型数据。

BetToken Queries

BetToken查询

Check BET balance

检查BET余额

bash
vara-wallet call $BET_TOKEN BetToken/BalanceOf \
  --args '["'$MY_ADDR'"]' --idl $BET_TOKEN_IDL
bash
vara-wallet call $BET_TOKEN BetToken/BalanceOf \
  --args '["'$MY_ADDR'"]' --idl $BET_TOKEN_IDL

Check claim preview

检查领取预览

bash
vara-wallet call $BET_TOKEN BetToken/GetClaimPreview \
  --args '["'$MY_ADDR'"]' --idl $BET_TOKEN_IDL
Returns
ClaimPreview
:
amount
,
streak_days
,
next_claim_at
,
can_claim_now
.
bash
vara-wallet call $BET_TOKEN BetToken/GetClaimPreview \
  --args '["'$MY_ADDR'"]' --idl $BET_TOKEN_IDL
返回
ClaimPreview
类型数据:
amount
streak_days
next_claim_at
can_claim_now

Check claim state

检查领取状态

bash
vara-wallet call $BET_TOKEN BetToken/GetClaimState \
  --args '["'$MY_ADDR'"]' --idl $BET_TOKEN_IDL
bash
vara-wallet call $BET_TOKEN BetToken/GetClaimState \
  --args '["'$MY_ADDR'"]' --idl $BET_TOKEN_IDL

Check token info

检查代币信息

bash
vara-wallet call $BET_TOKEN Metadata/Name --args '[]' --idl $BET_TOKEN_IDL
vara-wallet call $BET_TOKEN Metadata/Symbol --args '[]' --idl $BET_TOKEN_IDL
vara-wallet call $BET_TOKEN Metadata/Decimals --args '[]' --idl $BET_TOKEN_IDL
vara-wallet call $BET_TOKEN BetToken/TotalSupply --args '[]' --idl $BET_TOKEN_IDL
Note:
Name
,
Symbol
,
Decimals
are on the
Metadata
service, not
BetToken
.
bash
vara-wallet call $BET_TOKEN Metadata/Name --args '[]' --idl $BET_TOKEN_IDL
vara-wallet call $BET_TOKEN Metadata/Symbol --args '[]' --idl $BET_TOKEN_IDL
vara-wallet call $BET_TOKEN Metadata/Decimals --args '[]' --idl $BET_TOKEN_IDL
vara-wallet call $BET_TOKEN BetToken/TotalSupply --args '[]' --idl $BET_TOKEN_IDL
注意:
Name
Symbol
Decimals
属于
Metadata
服务,而非
BetToken
服务。

BetLane Queries

BetLane查询

Get position in BET lane

获取BET车道中的仓位

bash
vara-wallet call $BET_LANE BetLane/GetPosition \
  --args '["0x<user_actor_id>", 0]' --idl $BET_LANE_IDL
Returns
Position
:
shares
(u256),
claimed
,
index_at_creation_bps
. Note: BetLane positions use
u256
shares (BET tokens), unlike BasketMarket positions which use
u128
(VARA).
bash
vara-wallet call $BET_LANE BetLane/GetPosition \
  --args '["0x<user_actor_id>", 0]' --idl $BET_LANE_IDL
返回
Position
类型数据:
shares
(u256)、
claimed
index_at_creation_bps
。注意:BetLane仓位使用
u256
类型的shares(BET代币),而BasketMarket仓位使用
u128
类型的shares(VARA代币)。

Get paginated positions

获取分页的仓位信息

bash
vara-wallet call $BET_LANE BetLane/GetPositions \
  --args '["0x<user_actor_id>", 0, 10]' --idl $BET_LANE_IDL
Args:
user
,
offset
,
limit
. Returns
Result<vec UserPositionView, BetLaneError>
.
bash
vara-wallet call $BET_LANE BetLane/GetPositions \
  --args '["0x<user_actor_id>", 0, 10]' --idl $BET_LANE_IDL
参数:
user
offset
limit
。返回
Result<vec UserPositionView, BetLaneError>
类型数据。

Check BetLane config

检查BetLane配置

bash
vara-wallet call $BET_LANE BetLane/GetConfig --args '[]' --idl $BET_LANE_IDL
Returns
BetLaneConfig
:
min_bet
,
max_bet
,
payouts_allowed_while_paused
.
bash
vara-wallet call $BET_LANE BetLane/GetConfig --args '[]' --idl $BET_LANE_IDL
返回
BetLaneConfig
类型数据:
min_bet
max_bet
payouts_allowed_while_paused

Check paused status

检查暂停状态

bash
vara-wallet call $BET_LANE BetLane/IsPaused --args '[]' --idl $BET_LANE_IDL
bash
vara-wallet call $BET_LANE BetLane/IsPaused --args '[]' --idl $BET_LANE_IDL