NEAR QR Code Skill
Generate and read QR codes for NEAR Protocol addresses and payment requests.
Setup
Install the required Python dependencies:
CODEBLOCK0
Commands
1. Generate Address QR — near_qr_address
Generate a QR code containing a NEAR account address.
Usage:
CODEBLOCK1
Parameters:
- -
account_id (required) — The NEAR account address (e.g. alice.near) - INLINECODE3 — Output file path (default:
<account_id>_qr.png) - INLINECODE5 — QR image size in pixels (default:
400)
Example:
python near_qr.py address alice.near --output alice_qr.png --size 500
2. Generate Payment QR — near_qr_payment
Generate a QR code for a NEAR payment request, encoding recipient, amount, and optional memo.
Usage:
CODEBLOCK3
Parameters:
- -
to (required) — Recipient NEAR account (e.g. bob.near) - INLINECODE10 (required) — Amount of NEAR to request (e.g.
2.5) - INLINECODE12 — Optional memo or reference note
- INLINECODE13 — Output file path (default:
payment_qr.png) - INLINECODE15 — QR image size in pixels (default:
400)
Example:
python near_qr.py payment bob.near 5.0 --memo "Invoice #42" --output pay_bob.png
3. Read QR Code — near_qr_read
Decode a NEAR QR code from an image file and extract the embedded data.
Usage:
CODEBLOCK5
Parameters:
- -
image_path (required) — Path to the QR code image
Example:
CODEBLOCK6
Output: Returns a JSON object with the decoded type and data:
{
"type": "near_address",
"account": "alice.near"
}
or for payment QR codes:
CODEBLOCK8
NEAR 二维码技能
生成和读取用于 NEAR 协议地址和支付请求的二维码。
环境设置
安装所需的 Python 依赖:
bash
pip install -r requirements.txt
命令
1. 生成地址二维码 — nearqraddress
生成包含 NEAR 账户地址的二维码。
用法:
bash
python nearqr.py address id> [--output <路径>] [--size <像素>]
参数:
- - accountid(必填)— NEAR 账户地址(例如 alice.near)
- --output — 输出文件路径(默认:id>_qr.png)
- --size — 二维码图像大小(像素,默认:400)
示例:
bash
python nearqr.py address alice.near --output aliceqr.png --size 500
2. 生成支付二维码 — nearqrpayment
生成用于 NEAR 支付请求的二维码,编码收款人、金额和可选备注信息。
用法:
bash
python near_qr.py payment [--memo <文本>] [--output <路径>] [--size <像素>]
参数:
- - to(必填)— 收款人 NEAR 账户(例如 bob.near)
- amount(必填)— 请求的 NEAR 金额(例如 2.5)
- --memo — 可选的备注或参考说明
- --output — 输出文件路径(默认:payment_qr.png)
- --size — 二维码图像大小(像素,默认:400)
示例:
bash
python nearqr.py payment bob.near 5.0 --memo 发票 #42 --output paybob.png
3. 读取二维码 — nearqrread
从图像文件中解码 NEAR 二维码并提取嵌入的数据。
用法:
bash
python nearqr.py read path>
参数:
- - image_path(必填)— 二维码图像路径
示例:
bash
python nearqr.py read aliceqr.png
输出: 返回包含解码类型和数据的 JSON 对象:
json
{
type: near_address,
account: alice.near
}
或用于支付二维码:
json
{
type: near_payment,
to: bob.near,
amount: 5.0,
memo: 发票 #42
}