skillpp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COMPATIBILITY.md +58 -0
- package/LICENSE +21 -0
- package/README.md +307 -0
- package/README.zh-CN.md +307 -0
- package/SKILL.md +490 -0
- package/adapters/binance-ai.md +22 -0
- package/adapters/claude.md +21 -0
- package/adapters/gemini.md +26 -0
- package/adapters/gpt.md +28 -0
- package/adapters/kimi.md +26 -0
- package/adapters/mimo.md +22 -0
- package/adapters/openclaw.md +29 -0
- package/assets/skillpp-banner.png +0 -0
- package/package.json +59 -0
- package/pipelines.md +310 -0
- package/prompts/newbie-mode.md +48 -0
- package/prompts/router-prompt.md +32 -0
- package/prompts/universal-system-prompt.md +41 -0
- package/registry.md +209 -0
- package/rules.md +323 -0
- package/schemas/audit.schema.json +67 -0
- package/schemas/checkpoint.schema.json +86 -0
- package/schemas/handoff.schema.json +82 -0
- package/schemas/token.schema.json +36 -0
- package/scripts/compatibility-check.mjs +130 -0
- package/scripts/selftest.mjs +384 -0
- package/scripts/skillpp.mjs +448 -0
- package/scripts/validate-skillpp.mjs +140 -0
- package/skillpp.manifest.json +714 -0
- package/skills/audit-plus/SKILL.md +612 -0
- package/skills/binance/binance/CHANGELOG.md +112 -0
- package/skills/binance/binance/LICENSE.md +9 -0
- package/skills/binance/binance/SKILL.md +69 -0
- package/skills/binance/binance/references/algo.md +21 -0
- package/skills/binance/binance/references/alpha.md +9 -0
- package/skills/binance/binance/references/auth.md +32 -0
- package/skills/binance/binance/references/c2c.md +5 -0
- package/skills/binance/binance/references/convert.md +19 -0
- package/skills/binance/binance/references/copy-trading.md +6 -0
- package/skills/binance/binance/references/crypto-loan.md +27 -0
- package/skills/binance/binance/references/derivatives-options-streams.md +25 -0
- package/skills/binance/binance/references/derivatives-options.md +85 -0
- package/skills/binance/binance/references/derivatives-portfolio-margin-pro-streams.md +5 -0
- package/skills/binance/binance/references/derivatives-portfolio-margin-pro.md +34 -0
- package/skills/binance/binance/references/derivatives-portfolio-margin-streams.md +5 -0
- package/skills/binance/binance/references/derivatives-portfolio-margin.md +146 -0
- package/skills/binance/binance/references/dual-investment.md +15 -0
- package/skills/binance/binance/references/fiat.md +9 -0
- package/skills/binance/binance/references/futures-coin-streams.md +29 -0
- package/skills/binance/binance/references/futures-coin.md +109 -0
- package/skills/binance/binance/references/futures-usds-streams.md +35 -0
- package/skills/binance/binance/references/futures-usds.md +144 -0
- package/skills/binance/binance/references/gift-card.md +10 -0
- package/skills/binance/binance/references/margin-trading-streams.md +6 -0
- package/skills/binance/binance/references/margin-trading.md +101 -0
- package/skills/binance/binance/references/mining.md +17 -0
- package/skills/binance/binance/references/pay.md +5 -0
- package/skills/binance/binance/references/rebate.md +5 -0
- package/skills/binance/binance/references/simple-earn.md +56 -0
- package/skills/binance/binance/references/spot-streams.md +25 -0
- package/skills/binance/binance/references/spot.md +114 -0
- package/skills/binance/binance/references/staking.md +59 -0
- package/skills/binance/binance/references/sub-account.md +67 -0
- package/skills/binance/binance/references/vip-loan.md +27 -0
- package/skills/binance/binance/references/wallet.md +75 -0
- package/skills/binance/fiat/CHANGELOG.md +11 -0
- package/skills/binance/fiat/LICENSE.md +9 -0
- package/skills/binance/fiat/SKILL.md +169 -0
- package/skills/binance/fiat/references/authentication.md +126 -0
- package/skills/binance/fiat/references/sapi-endpoints.md +217 -0
- package/skills/binance/onchain-pay/.local.md.example +10 -0
- package/skills/binance/onchain-pay/CHANGELOG.md +20 -0
- package/skills/binance/onchain-pay/LICENSE.md +9 -0
- package/skills/binance/onchain-pay/SKILL.md +466 -0
- package/skills/binance/onchain-pay/references/authentication.md +92 -0
- package/skills/binance/onchain-pay/scripts/sign_and_call.sh +52 -0
- package/skills/binance/p2p/CHANGELOG.md +33 -0
- package/skills/binance/p2p/LICENSE.md +9 -0
- package/skills/binance/p2p/SKILL.md +1082 -0
- package/skills/binance/p2p/references/agent-sapi-api.md +795 -0
- package/skills/binance/p2p/references/authentication.md +100 -0
- package/skills/binance/payment/SKILL.md +824 -0
- package/skills/binance/payment/common.py +560 -0
- package/skills/binance/payment/payment_skill.py +86 -0
- package/skills/binance/payment/receive.py +109 -0
- package/skills/binance/payment/references/setup-guide.md +77 -0
- package/skills/binance/payment/requirements.txt +4 -0
- package/skills/binance/payment/send.py +952 -0
- package/skills/binance/payment/send_extension/__init__.py +43 -0
- package/skills/binance/payment/send_extension/base.py +48 -0
- package/skills/binance/payment/send_extension/c2c.py +193 -0
- package/skills/binance/payment/send_extension/pix.py +316 -0
- package/skills/binance/square-post/README.md +62 -0
- package/skills/binance/square-post/SKILL.md +171 -0
- package/skills/binance/square-post/scripts/lib.mjs +175 -0
- package/skills/binance/square-post/scripts/post-image.mjs +80 -0
- package/skills/binance/square-post/scripts/post-text.mjs +41 -0
- package/skills/binance/square-post/scripts/post-video.mjs +110 -0
- package/skills/binance/square-post/scripts/save-key.mjs +34 -0
- package/skills/binance-web3/binance-agentic-wallet/SKILL.md +150 -0
- package/skills/binance-web3/binance-agentic-wallet/references/authentication.md +136 -0
- package/skills/binance-web3/binance-agentic-wallet/references/limit-order.md +204 -0
- package/skills/binance-web3/binance-agentic-wallet/references/market-order.md +179 -0
- package/skills/binance-web3/binance-agentic-wallet/references/prediction.md +489 -0
- package/skills/binance-web3/binance-agentic-wallet/references/preflight.md +66 -0
- package/skills/binance-web3/binance-agentic-wallet/references/security.md +47 -0
- package/skills/binance-web3/binance-agentic-wallet/references/send.md +53 -0
- package/skills/binance-web3/binance-agentic-wallet/references/wallet-setting.md +86 -0
- package/skills/binance-web3/binance-agentic-wallet/references/wallet-view.md +312 -0
- package/skills/binance-web3/binance-agentic-wallet/references/x402-payment.md +259 -0
- package/skills/binance-web3/binance-tokenized-securities-info/SKILL.md +613 -0
- package/skills/binance-web3/crypto-market-rank/SKILL.md +91 -0
- package/skills/binance-web3/crypto-market-rank/references/cli.md +219 -0
- package/skills/binance-web3/crypto-market-rank/scripts/cli.mjs +149 -0
- package/skills/binance-web3/meme-rush/SKILL.md +72 -0
- package/skills/binance-web3/meme-rush/references/cli.md +158 -0
- package/skills/binance-web3/meme-rush/scripts/cli.mjs +101 -0
- package/skills/binance-web3/query-address-info/SKILL.md +61 -0
- package/skills/binance-web3/query-address-info/references/cli.md +56 -0
- package/skills/binance-web3/query-address-info/scripts/cli.mjs +132 -0
- package/skills/binance-web3/query-token-audit/SKILL.md +162 -0
- package/skills/binance-web3/query-token-info/SKILL.md +83 -0
- package/skills/binance-web3/query-token-info/references/cli.md +135 -0
- package/skills/binance-web3/query-token-info/scripts/cli.mjs +112 -0
- package/skills/binance-web3/trading-signal/SKILL.md +66 -0
- package/skills/binance-web3/trading-signal/references/cli.md +90 -0
- package/skills/binance-web3/trading-signal/scripts/cli.mjs +92 -0
- package/skills/four-meme/four-guard/API-Contract-TaxToken.md +277 -0
- package/skills/four-meme/four-guard/API-CreateToken.02-02-2026.md +285 -0
- package/skills/four-meme/four-guard/API-Documents.03-03-2026.md +789 -0
- package/skills/four-meme/four-guard/AgentIdentifier.abi +585 -0
- package/skills/four-meme/four-guard/README.md +21 -0
- package/skills/four-meme/four-guard/SKILL.md +31 -0
- package/skills/four-meme/four-guard/TaxToken.abi +969 -0
- package/skills/four-meme/four-guard/TokenIdentifierSample.js_ +81 -0
- package/skills/four-meme/four-guard/TokenIdentifierSample.sol +69 -0
- package/skills/four-meme/four-guard/TokenManager.lite.abi +836 -0
- package/skills/four-meme/four-guard/TokenManager2.lite.abi +2325 -0
- package/skills/four-meme/four-guard/TokenManagerHelper3.abi +999 -0
- package/skills/four-meme/four-guard/go.mod +36 -0
- package/skills/four-meme/four-guard/go.sum +127 -0
- package/skills/four-meme/four-guard/main.go +183 -0
- package/skills/four-meme/four-meme-ai/SKILL.md +31 -0
- package/skills/four-meme/four-meme-ai/references/agent-creator-and-wallets.md +87 -0
- package/skills/four-meme/four-meme-ai/references/api-create-token.md +55 -0
- package/skills/four-meme/four-meme-ai/references/contract-addresses.md +47 -0
- package/skills/four-meme/four-meme-ai/references/create-token-scripts.md +131 -0
- package/skills/four-meme/four-meme-ai/references/errors.md +29 -0
- package/skills/four-meme/four-meme-ai/references/event-listening.md +75 -0
- package/skills/four-meme/four-meme-ai/references/execute-trade.md +31 -0
- package/skills/four-meme/four-meme-ai/references/tax-token-query.md +38 -0
- package/skills/four-meme/four-meme-ai/references/token-query-api.md +44 -0
- package/skills/four-meme/four-meme-ai/references/token-tax-info.md +77 -0
- package/skills/four-meme/four-meme-ai/scripts/8004-balance.ts +52 -0
- package/skills/four-meme/four-meme-ai/scripts/8004-register.ts +108 -0
- package/skills/four-meme/four-meme-ai/scripts/create-token-api.ts +321 -0
- package/skills/four-meme/four-meme-ai/scripts/create-token-chain.ts +102 -0
- package/skills/four-meme/four-meme-ai/scripts/create-token-instant.ts +106 -0
- package/skills/four-meme/four-meme-ai/scripts/execute-buy.ts +198 -0
- package/skills/four-meme/four-meme-ai/scripts/execute-sell.ts +150 -0
- package/skills/four-meme/four-meme-ai/scripts/get-public-config.ts +25 -0
- package/skills/four-meme/four-meme-ai/scripts/get-recent-events.ts +76 -0
- package/skills/four-meme/four-meme-ai/scripts/get-tax-token-info.ts +69 -0
- package/skills/four-meme/four-meme-ai/scripts/get-token-info.ts +94 -0
- package/skills/four-meme/four-meme-ai/scripts/quote-buy.ts +85 -0
- package/skills/four-meme/four-meme-ai/scripts/quote-sell.ts +66 -0
- package/skills/four-meme/four-meme-ai/scripts/send-token.ts +98 -0
- package/skills/four-meme/four-meme-ai/scripts/token-get.ts +31 -0
- package/skills/four-meme/four-meme-ai/scripts/token-list.ts +134 -0
- package/skills/four-meme/four-meme-ai/scripts/token-rankings.ts +162 -0
- package/skills/four-meme/four-meme-ai/scripts/verify-events.ts +47 -0
- package/skills/four-meme/four-meme-integration/SKILL.md +374 -0
- package/skills/four-meme/four-meme-integration/references/agent-creator-and-wallets.md +87 -0
- package/skills/four-meme/four-meme-integration/references/api-create-token.md +55 -0
- package/skills/four-meme/four-meme-integration/references/contract-addresses.md +47 -0
- package/skills/four-meme/four-meme-integration/references/create-token-scripts.md +131 -0
- package/skills/four-meme/four-meme-integration/references/errors.md +29 -0
- package/skills/four-meme/four-meme-integration/references/event-listening.md +75 -0
- package/skills/four-meme/four-meme-integration/references/execute-trade.md +31 -0
- package/skills/four-meme/four-meme-integration/references/tax-token-query.md +38 -0
- package/skills/four-meme/four-meme-integration/references/token-query-api.md +44 -0
- package/skills/four-meme/four-meme-integration/references/token-tax-info.md +77 -0
- package/skills/four-meme/four-meme-integration/scripts/8004-balance.ts +52 -0
- package/skills/four-meme/four-meme-integration/scripts/8004-register.ts +108 -0
- package/skills/four-meme/four-meme-integration/scripts/create-token-api.ts +321 -0
- package/skills/four-meme/four-meme-integration/scripts/create-token-chain.ts +102 -0
- package/skills/four-meme/four-meme-integration/scripts/create-token-instant.ts +106 -0
- package/skills/four-meme/four-meme-integration/scripts/execute-buy.ts +198 -0
- package/skills/four-meme/four-meme-integration/scripts/execute-sell.ts +150 -0
- package/skills/four-meme/four-meme-integration/scripts/get-public-config.ts +25 -0
- package/skills/four-meme/four-meme-integration/scripts/get-recent-events.ts +76 -0
- package/skills/four-meme/four-meme-integration/scripts/get-tax-token-info.ts +69 -0
- package/skills/four-meme/four-meme-integration/scripts/get-token-info.ts +94 -0
- package/skills/four-meme/four-meme-integration/scripts/quote-buy.ts +85 -0
- package/skills/four-meme/four-meme-integration/scripts/quote-sell.ts +66 -0
- package/skills/four-meme/four-meme-integration/scripts/send-token.ts +98 -0
- package/skills/four-meme/four-meme-integration/scripts/token-get.ts +31 -0
- package/skills/four-meme/four-meme-integration/scripts/token-list.ts +134 -0
- package/skills/four-meme/four-meme-integration/scripts/token-rankings.ts +162 -0
- package/skills/four-meme/four-meme-integration/scripts/verify-events.ts +47 -0
- package/skills/skillpp/contract-profiler/SKILL.md +118 -0
- package/skills/skillpp/newbie-tutor/SKILL.md +85 -0
- package/skills/skillpp/opportunity-board/SKILL.md +87 -0
- package/skills/skillpp/risk-fusion/SKILL.md +146 -0
- package/skills/skillpp/scam-pattern-lab/SKILL.md +115 -0
- package/skills/skillpp/wallet-doctor/SKILL.md +119 -0
- package/skills/skillpp/watchtower/SKILL.md +72 -0
- package/tests/compatibility/v0.1.0.json +117 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: square-post
|
|
3
|
+
description: |
|
|
4
|
+
Use when the user wants to publish new content to Binance Square — short text, multi-image
|
|
5
|
+
posts (up to 4), long-form articles with an optional cover, or videos with an auto-generated
|
|
6
|
+
cover frame. Trigger on direct phrasings like "post to Square", "publish to Binance Square",
|
|
7
|
+
"发广场", "发布到广场", and on near-miss intents where the user clearly wants to share or
|
|
8
|
+
publish content on Square even without naming the skill: "share this analysis on Square",
|
|
9
|
+
"把这篇文章发出去", "发个动态", "把这个视频上传到广场", "publish my chart to Square as an
|
|
10
|
+
article". Also use when the user provides media (images, video) plus a caption and asks to
|
|
11
|
+
push it to Square, or asks to turn a draft into a Square article. Do not use for reading,
|
|
12
|
+
searching, commenting, liking, editing, deleting, scheduling, or managing existing Square
|
|
13
|
+
posts — this skill only creates new posts.
|
|
14
|
+
allowed-tools:
|
|
15
|
+
- Bash
|
|
16
|
+
metadata:
|
|
17
|
+
author: binance-square
|
|
18
|
+
version: "2.0.0"
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# Square Post Skill
|
|
22
|
+
|
|
23
|
+
## Purpose
|
|
24
|
+
|
|
25
|
+
Publish new content to Binance Square by running the local scripts in `scripts/`.
|
|
26
|
+
|
|
27
|
+
Supported post types:
|
|
28
|
+
- Text-only short posts
|
|
29
|
+
- Image posts with up to 4 images
|
|
30
|
+
- Long articles with a title and optional cover image
|
|
31
|
+
- Video posts with an auto-generated cover image
|
|
32
|
+
|
|
33
|
+
Do not hand-code API requests for normal posting. The scripts own upload, polling, cover generation, and publish behavior.
|
|
34
|
+
|
|
35
|
+
## Runtime Dependencies
|
|
36
|
+
|
|
37
|
+
- Node.js 18 or newer. The scripts use native ES modules and the built-in `fetch` API.
|
|
38
|
+
- `ffmpeg` is required for video posts because `post-video.mjs` extracts the first frame as the cover image.
|
|
39
|
+
- `ffprobe` is required when a video duration is not provided by the user.
|
|
40
|
+
- Network access is required for Binance Square OpenAPI requests and presigned media uploads.
|
|
41
|
+
|
|
42
|
+
## Authentication
|
|
43
|
+
|
|
44
|
+
Posting requires a Binance Square OpenAPI key.
|
|
45
|
+
|
|
46
|
+
Before posting:
|
|
47
|
+
- Prefer `BINANCE_SQUARE_OPENAPI_KEY` from the user's environment if present.
|
|
48
|
+
- If it is not present, the scripts automatically check `~/.config/binance-square/openapi-key`.
|
|
49
|
+
- If no valid key is found, ask the user to provide an API key first.
|
|
50
|
+
- If the user wants to reuse the key in future requests, save it with `BINANCE_SQUARE_OPENAPI_KEY=<apiKey> node scripts/save-key.mjs`; otherwise use it only for the current command environment.
|
|
51
|
+
- Tell the user they can create an API key at: https://www.binance.com/square/creator-center/home
|
|
52
|
+
|
|
53
|
+
Pass the key only via `BINANCE_SQUARE_OPENAPI_KEY` (env or saved file). Never write it into command arguments or print the full key — CLI args appear in `ps` output and shell history. When mentioning a key, show only the first 5 and last 4 characters, such as `abc12...xyz9`.
|
|
54
|
+
|
|
55
|
+
## Scripts
|
|
56
|
+
|
|
57
|
+
All commands should be run from this skill directory.
|
|
58
|
+
|
|
59
|
+
### Text Or Article Post
|
|
60
|
+
|
|
61
|
+
Use for text-only short posts or long articles without images.
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
node scripts/post-text.mjs --text "Hello #crypto $BTC"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Long article with title and no cover:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
node scripts/post-text.mjs --text "Full article body..." --title "Market Report"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Flags:
|
|
74
|
+
- `--text` required, post text content
|
|
75
|
+
- `--title` optional, sets article-style content
|
|
76
|
+
|
|
77
|
+
### Image Post
|
|
78
|
+
|
|
79
|
+
Use for short image posts or long articles with a cover image.
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
node scripts/post-image.mjs --text "Chart analysis" --images "./chart1.png,./chart2.png"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Long article with title and cover:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
node scripts/post-image.mjs --text "Full analysis..." --title "Market Report" --cover "./chart.png"
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Flags:
|
|
92
|
+
- `--text` required, post or article content
|
|
93
|
+
- `--images` required for short image posts only. Use comma-separated image paths with max 4.
|
|
94
|
+
- `--title` optional, sets article-style content. When present, do not pass `--images`.
|
|
95
|
+
- `--cover` required when `--title` is present for an article with media. Article mode supports exactly one cover image.
|
|
96
|
+
|
|
97
|
+
The script uploads each image, waits for processing, and publishes with the processed image URL returned by the backend. If `--title` is provided, it publishes `contentType=2`, requires `--cover`, and sends that uploaded image URL as `cover` only. If no `--title` is provided, it publishes `contentType=1` and sends all `--images` as `imageList`.
|
|
98
|
+
|
|
99
|
+
### Video Post
|
|
100
|
+
|
|
101
|
+
Use for video posts.
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
node scripts/post-video.mjs --video "./video.mp4" --duration 7.5 --text "My analysis"
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Flags:
|
|
108
|
+
- `--video` required, local video path
|
|
109
|
+
- `--duration` required, video duration in seconds
|
|
110
|
+
- `--text` optional, post text content
|
|
111
|
+
|
|
112
|
+
The script uploads the video, waits for processing, extracts the first frame with `ffmpeg`, uploads that frame as the cover image, and publishes with `cover` included in the request.
|
|
113
|
+
|
|
114
|
+
If the user does not provide a duration, use `ffprobe` to determine it before running the script.
|
|
115
|
+
|
|
116
|
+
## Agent Workflow
|
|
117
|
+
|
|
118
|
+
1. Resolve the API key (see Authentication). If unresolved, stop and ask the user before doing anything else.
|
|
119
|
+
|
|
120
|
+
2. Pick the script from user intent using the table below. Then validate against Constraints — if a constraint is violated, explain it and do not run.
|
|
121
|
+
|
|
122
|
+
| User intent | Script | Required flags |
|
|
123
|
+
|---|---|---|
|
|
124
|
+
| Short text post | `post-text.mjs` | `--text` |
|
|
125
|
+
| Long article, no media | `post-text.mjs` | `--text --title` |
|
|
126
|
+
| Image short post (1–4 imgs, no title) | `post-image.mjs` | `--text --images "<p1,p2,...>"` |
|
|
127
|
+
| Article with cover | `post-image.mjs` | `--text --title --cover` |
|
|
128
|
+
| Video post | `post-video.mjs` | `--video --duration` (+ optional `--text`) |
|
|
129
|
+
|
|
130
|
+
3. Disambiguate edge cases before running:
|
|
131
|
+
- Title + exactly one image → that image is the cover (`--cover`, not `--images`).
|
|
132
|
+
- Title + multiple images → stop and ask which single image is the cover.
|
|
133
|
+
- Video without duration → run `ffprobe` first to get it.
|
|
134
|
+
|
|
135
|
+
4. Preserve user content exactly. Do not rewrite, translate, add hashtags/cashtags, or change punctuation. `$coin` and `#topic` text passes through verbatim — the backend parses them.
|
|
136
|
+
|
|
137
|
+
5. Run the script with `BINANCE_SQUARE_OPENAPI_KEY` injected into the command environment for one-time use (never as a CLI arg).
|
|
138
|
+
|
|
139
|
+
6. Report the result:
|
|
140
|
+
- On success, return the `ID` and `Link` printed by the script.
|
|
141
|
+
- If the script prints `Success!` with `ID: unavailable` and `Link: unavailable`, treat it as successful — `/content/add` returned 504 after submission, so no post ID or link is available.
|
|
142
|
+
- On failure, surface the script error and any API code/message.
|
|
143
|
+
|
|
144
|
+
## Constraints
|
|
145
|
+
|
|
146
|
+
- Images: max 4 per post; article cover is exactly 1 image.
|
|
147
|
+
- Video: max 1 per post.
|
|
148
|
+
- Images and video are mutually exclusive in a single post.
|
|
149
|
+
- Only attach media the user explicitly provided; do not auto-attach.
|
|
150
|
+
- Do not modify user-provided text. `#topic` and `$coin` are parsed server-side.
|
|
151
|
+
- Daily limits: 100 posts/day, 400 uploads/day.
|
|
152
|
+
|
|
153
|
+
## Common Errors
|
|
154
|
+
|
|
155
|
+
- `220003`: API key not found.
|
|
156
|
+
- `220004`: API key expired.
|
|
157
|
+
- `220009`: Daily post limit exceeded for OpenAPI.
|
|
158
|
+
- `220014`: Daily upload limit exceeded.
|
|
159
|
+
- `20002` or `20022`: Sensitive words detected.
|
|
160
|
+
- `20013`: Content length is limited.
|
|
161
|
+
- `20020` or `220011`: Content body must not be empty.
|
|
162
|
+
- `30008`, `2000001`, or `2000002`: Account or device posting restriction.
|
|
163
|
+
|
|
164
|
+
## Scope
|
|
165
|
+
|
|
166
|
+
This skill only supports publishing new posts. It does not support:
|
|
167
|
+
- Reading, listing, or searching existing posts
|
|
168
|
+
- Editing or deleting posts
|
|
169
|
+
- Commenting, liking, or other interactions
|
|
170
|
+
- User profile or account management
|
|
171
|
+
- Scheduling or drafts
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import os from "os";
|
|
3
|
+
import path from "path";
|
|
4
|
+
|
|
5
|
+
const BASE_URL_V1 = "https://www.binance.com/bapi/composite/v1/public/pgc/openApi";
|
|
6
|
+
const BASE_URL_V2 = "https://www.binance.com/bapi/composite/v2/public/pgc/openApi";
|
|
7
|
+
const POLL_INTERVAL_MS = 3000;
|
|
8
|
+
const MAX_POLL_RETRIES = 10;
|
|
9
|
+
const CONFIG_DIR = path.join(os.homedir(), ".config", "binance-square");
|
|
10
|
+
const CONFIG_FILE = path.join(CONFIG_DIR, "openapi-key");
|
|
11
|
+
|
|
12
|
+
const CONTENT_TYPE_MAP = {
|
|
13
|
+
jpg: "image/jpeg",
|
|
14
|
+
jpeg: "image/jpeg",
|
|
15
|
+
png: "image/png",
|
|
16
|
+
gif: "image/gif",
|
|
17
|
+
webp: "image/webp",
|
|
18
|
+
mp4: "video/mp4",
|
|
19
|
+
mov: "video/quicktime",
|
|
20
|
+
avi: "video/x-msvideo",
|
|
21
|
+
webm: "video/webm",
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export function getContentType(filePath) {
|
|
25
|
+
const ext = path.extname(filePath).slice(1).toLowerCase();
|
|
26
|
+
return CONTENT_TYPE_MAP[ext] || "application/octet-stream";
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function sleep(ms) {
|
|
30
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function getConfigFilePath() {
|
|
34
|
+
return CONFIG_FILE;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function maskApiKey(apiKey) {
|
|
38
|
+
if (!apiKey) return "";
|
|
39
|
+
if (apiKey.length <= 9) return `${apiKey.slice(0, 2)}...`;
|
|
40
|
+
return `${apiKey.slice(0, 5)}...${apiKey.slice(-4)}`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function readSavedApiKey() {
|
|
44
|
+
const keyFile = getConfigFilePath();
|
|
45
|
+
if (!fs.existsSync(keyFile)) return "";
|
|
46
|
+
return fs.readFileSync(keyFile, "utf8").trim();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function saveApiKey(apiKey) {
|
|
50
|
+
const key = apiKey.trim();
|
|
51
|
+
if (!key) {
|
|
52
|
+
throw new Error("Missing Square OpenAPI key");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const keyFile = getConfigFilePath();
|
|
56
|
+
fs.mkdirSync(path.dirname(keyFile), { recursive: true, mode: 0o700 });
|
|
57
|
+
fs.writeFileSync(keyFile, `${key}\n`, { mode: 0o600 });
|
|
58
|
+
fs.chmodSync(keyFile, 0o600);
|
|
59
|
+
return keyFile;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function resolveApiKey(args = []) {
|
|
63
|
+
if (args.includes("--key")) {
|
|
64
|
+
throw new Error("Do not pass API keys with --key. Set BINANCE_SQUARE_OPENAPI_KEY or save the key locally first.");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const envKey = process.env.BINANCE_SQUARE_OPENAPI_KEY;
|
|
68
|
+
if (envKey?.trim()) return envKey.trim();
|
|
69
|
+
|
|
70
|
+
const savedKey = readSavedApiKey();
|
|
71
|
+
if (savedKey) return savedKey;
|
|
72
|
+
|
|
73
|
+
throw new Error(
|
|
74
|
+
`Missing Square OpenAPI key. Set BINANCE_SQUARE_OPENAPI_KEY or save it to ${getConfigFilePath()} first.`,
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export async function api(endpoint, apiKey, body, baseUrl = BASE_URL_V2) {
|
|
79
|
+
const res = await fetch(`${baseUrl}${endpoint}`, {
|
|
80
|
+
method: "POST",
|
|
81
|
+
headers: {
|
|
82
|
+
"X-Square-OpenAPI-Key": apiKey,
|
|
83
|
+
"Content-Type": "application/json",
|
|
84
|
+
clienttype: "binanceSkill",
|
|
85
|
+
},
|
|
86
|
+
body: JSON.stringify(body),
|
|
87
|
+
});
|
|
88
|
+
const raw = await res.text();
|
|
89
|
+
|
|
90
|
+
if (endpoint === "/content/add" && res.status === 504) {
|
|
91
|
+
return { id: null, shareLink: null, publishStatus: "success_without_post_id" };
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
let json;
|
|
95
|
+
try {
|
|
96
|
+
json = JSON.parse(raw);
|
|
97
|
+
} catch (error) {
|
|
98
|
+
console.error("API returned non-JSON response", {
|
|
99
|
+
endpoint,
|
|
100
|
+
status: res.status,
|
|
101
|
+
statusText: res.statusText,
|
|
102
|
+
body: raw,
|
|
103
|
+
});
|
|
104
|
+
throw new Error(`API returned non-JSON response: ${res.status} ${res.statusText}`);
|
|
105
|
+
}
|
|
106
|
+
if (json.code !== "000000") {
|
|
107
|
+
throw new Error(`API error [${json.code}]: ${json.message}`);
|
|
108
|
+
}
|
|
109
|
+
return json.data;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export async function uploadToS3(presignedUrl, filePath, contentType) {
|
|
113
|
+
const fileBuffer = fs.readFileSync(filePath);
|
|
114
|
+
const res = await fetch(presignedUrl, {
|
|
115
|
+
method: "PUT",
|
|
116
|
+
headers: { "Content-Type": contentType },
|
|
117
|
+
body: fileBuffer,
|
|
118
|
+
});
|
|
119
|
+
if (!res.ok) {
|
|
120
|
+
throw new Error(`S3 upload failed: ${res.status} ${res.statusText}`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export async function uploadImage(apiKey, imgPath) {
|
|
125
|
+
const imageName = path.basename(imgPath);
|
|
126
|
+
const contentTypeHeader = getContentType(imgPath);
|
|
127
|
+
|
|
128
|
+
console.log(`Uploading: ${imageName}`);
|
|
129
|
+
const { presignedUrl, fileTicket } = await api("/image/presignedUrl", apiKey, { imageName });
|
|
130
|
+
|
|
131
|
+
await uploadToS3(presignedUrl, imgPath, contentTypeHeader);
|
|
132
|
+
console.log(` Uploaded to S3, polling status...`);
|
|
133
|
+
|
|
134
|
+
const imageStatus = await pollImageStatus(apiKey, fileTicket);
|
|
135
|
+
console.log(` Ready: ${imageStatus.imageUrl}`);
|
|
136
|
+
return imageStatus.imageUrl;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export async function pollImageStatus(apiKey, fileTicket) {
|
|
140
|
+
for (let i = 0; i < MAX_POLL_RETRIES; i++) {
|
|
141
|
+
const data = await api("/image/imageStatus", apiKey, { fileTicket });
|
|
142
|
+
if (data.status === 1) return data;
|
|
143
|
+
if (data.status === 2) throw new Error(`Processing failed: ${data.failedReason}`);
|
|
144
|
+
console.log(` Processing... (${i + 1}/${MAX_POLL_RETRIES})`);
|
|
145
|
+
await sleep(POLL_INTERVAL_MS);
|
|
146
|
+
}
|
|
147
|
+
throw new Error(`Poll timed out after ${MAX_POLL_RETRIES} retries`);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export async function publish(apiKey, body) {
|
|
151
|
+
return await api("/content/add", apiKey, body, BASE_URL_V1);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export function printPublishSuccess(result) {
|
|
155
|
+
console.log(`\nSuccess!`);
|
|
156
|
+
console.log(`ID: ${result.id ?? "unavailable"}`);
|
|
157
|
+
console.log(`Link: ${result.shareLink ?? "unavailable"}`);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export function parseArgs(args, required, optional = []) {
|
|
161
|
+
const result = {};
|
|
162
|
+
for (const flag of [...required, ...optional]) {
|
|
163
|
+
const idx = args.indexOf(`--${flag}`);
|
|
164
|
+
if (idx !== -1 && idx + 1 < args.length) {
|
|
165
|
+
result[flag] = args[idx + 1];
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
for (const flag of required) {
|
|
169
|
+
if (!result[flag]) {
|
|
170
|
+
console.error(`Error: --${flag} is required`);
|
|
171
|
+
process.exit(1);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return result;
|
|
175
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { parseArgs, printPublishSuccess, publish, resolveApiKey, uploadImage } from "./lib.mjs";
|
|
4
|
+
|
|
5
|
+
const args = process.argv.slice(2);
|
|
6
|
+
|
|
7
|
+
if (args.includes("--help")) {
|
|
8
|
+
console.log(`Usage:
|
|
9
|
+
node post-image.mjs --text <content> --images <paths>
|
|
10
|
+
node post-image.mjs --text <content> --title <title> --cover <path>
|
|
11
|
+
|
|
12
|
+
Post short image content or an article with a cover image to Binance Square.
|
|
13
|
+
|
|
14
|
+
Options:
|
|
15
|
+
--text <content> Post text content (required)
|
|
16
|
+
--images <paths> Comma-separated image paths for short posts, max 4
|
|
17
|
+
--title <title> Article title. When present, publish as contentType=2
|
|
18
|
+
--cover <path> Cover image path for article posts with --title
|
|
19
|
+
|
|
20
|
+
Authentication:
|
|
21
|
+
Set BINANCE_SQUARE_OPENAPI_KEY or save a key with scripts/save-key.mjs.`);
|
|
22
|
+
process.exit(0);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const { text } = parseArgs(args, ["text"]);
|
|
26
|
+
const { title, images, cover } = parseArgs(args, [], ["title", "images", "cover"]);
|
|
27
|
+
|
|
28
|
+
if (title && images) {
|
|
29
|
+
console.error("Error: article posts with --title use --cover, not --images");
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
if (cover && !title) {
|
|
33
|
+
console.error("Error: --cover requires --title");
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const imagePaths = title ? [] : images ? images.split(",").map((p) => p.trim()).filter(Boolean) : [];
|
|
38
|
+
|
|
39
|
+
if (title && !cover) {
|
|
40
|
+
console.error("Error: article posts with --title require --cover <path>");
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
if (title && cover.includes(",")) {
|
|
44
|
+
console.error("Error: article posts support exactly one --cover image");
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
if (!title && imagePaths.length === 0) {
|
|
48
|
+
console.error("Error: --images is required for short image posts");
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
if (imagePaths.length > 4) {
|
|
52
|
+
console.error("Error: max 4 images allowed");
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const contentType = title ? 2 : 1;
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
const key = resolveApiKey(args);
|
|
60
|
+
|
|
61
|
+
const body = { contentType, bodyTextOnly: text };
|
|
62
|
+
if (title) {
|
|
63
|
+
const coverUrl = await uploadImage(key, cover);
|
|
64
|
+
body.title = title;
|
|
65
|
+
body.cover = coverUrl;
|
|
66
|
+
} else {
|
|
67
|
+
const uploadedImages = [];
|
|
68
|
+
for (const imgPath of imagePaths) {
|
|
69
|
+
uploadedImages.push(await uploadImage(key, imgPath));
|
|
70
|
+
}
|
|
71
|
+
body.imageList = uploadedImages;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
console.log("Publishing...");
|
|
75
|
+
const result = await publish(key, body);
|
|
76
|
+
printPublishSuccess(result);
|
|
77
|
+
} catch (err) {
|
|
78
|
+
console.error(`\nFailed: ${err.message}`);
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { parseArgs, printPublishSuccess, publish, resolveApiKey } from "./lib.mjs";
|
|
4
|
+
|
|
5
|
+
const args = process.argv.slice(2);
|
|
6
|
+
|
|
7
|
+
if (args.includes("--help")) {
|
|
8
|
+
console.log(`Usage: node post-text.mjs --text <content> [--title <title>]
|
|
9
|
+
|
|
10
|
+
Post text content to Binance Square as a short post or long article.
|
|
11
|
+
|
|
12
|
+
Options:
|
|
13
|
+
--text <content> Post text content (required)
|
|
14
|
+
--title <title> Article title. When present, publish as contentType=2 (optional)
|
|
15
|
+
|
|
16
|
+
Authentication:
|
|
17
|
+
Set BINANCE_SQUARE_OPENAPI_KEY or save a key with scripts/save-key.mjs.`);
|
|
18
|
+
process.exit(0);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const { text } = parseArgs(args, ["text"]);
|
|
22
|
+
const { title } = parseArgs(args, [], ["title"]);
|
|
23
|
+
|
|
24
|
+
const contentType = title ? 2 : 1;
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
const key = resolveApiKey(args);
|
|
28
|
+
|
|
29
|
+
console.log(contentType === 2 ? "Publishing article..." : "Publishing text post...");
|
|
30
|
+
const body = {
|
|
31
|
+
contentType,
|
|
32
|
+
bodyTextOnly: text,
|
|
33
|
+
};
|
|
34
|
+
if (title) body.title = title;
|
|
35
|
+
|
|
36
|
+
const result = await publish(key, body);
|
|
37
|
+
printPublishSuccess(result);
|
|
38
|
+
} catch (err) {
|
|
39
|
+
console.error(`\nFailed: ${err.message}`);
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import os from "os";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import { spawnSync } from "child_process";
|
|
7
|
+
import { parseArgs, api, uploadToS3, pollImageStatus, publish, getContentType, uploadImage, printPublishSuccess, resolveApiKey } from "./lib.mjs";
|
|
8
|
+
|
|
9
|
+
const args = process.argv.slice(2);
|
|
10
|
+
|
|
11
|
+
if (args.includes("--help")) {
|
|
12
|
+
console.log(`Usage: node post-video.mjs --video <path> --duration <seconds> [--text <content>]
|
|
13
|
+
|
|
14
|
+
Post a video to Binance Square.
|
|
15
|
+
|
|
16
|
+
Options:
|
|
17
|
+
--video <path> Video file path (required)
|
|
18
|
+
--duration <seconds> Video duration in seconds (required)
|
|
19
|
+
--text <content> Post text content (optional)
|
|
20
|
+
|
|
21
|
+
Authentication:
|
|
22
|
+
Set BINANCE_SQUARE_OPENAPI_KEY or save a key with scripts/save-key.mjs.`);
|
|
23
|
+
process.exit(0);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const { video, duration } = parseArgs(args, ["video", "duration"]);
|
|
27
|
+
const { text } = parseArgs(args, [], ["text"]);
|
|
28
|
+
|
|
29
|
+
const videoTimeSeconds = Number(duration);
|
|
30
|
+
if (isNaN(videoTimeSeconds) || videoTimeSeconds <= 0) {
|
|
31
|
+
console.error("Error: --duration must be a positive number");
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function extractVideoCover(videoPath) {
|
|
36
|
+
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "square-video-cover-"));
|
|
37
|
+
const coverPath = path.join(tempDir, `${path.parse(videoPath).name}-cover.png`);
|
|
38
|
+
const result = spawnSync("ffmpeg", [
|
|
39
|
+
"-y",
|
|
40
|
+
"-loglevel",
|
|
41
|
+
"error",
|
|
42
|
+
"-i",
|
|
43
|
+
videoPath,
|
|
44
|
+
"-frames:v",
|
|
45
|
+
"1",
|
|
46
|
+
"-q:v",
|
|
47
|
+
"2",
|
|
48
|
+
coverPath,
|
|
49
|
+
], { encoding: "utf8" });
|
|
50
|
+
|
|
51
|
+
if (result.error) {
|
|
52
|
+
throw new Error(`Failed to run ffmpeg: ${result.error.message}`);
|
|
53
|
+
}
|
|
54
|
+
if (result.status !== 0) {
|
|
55
|
+
throw new Error(`Failed to extract video cover: ${result.stderr || "ffmpeg exited with an error"}`);
|
|
56
|
+
}
|
|
57
|
+
if (!fs.existsSync(coverPath) || fs.statSync(coverPath).size === 0) {
|
|
58
|
+
throw new Error("Failed to extract video cover: empty cover file");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return { coverPath, tempDir };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function cleanupCover(coverPath, tempDir) {
|
|
65
|
+
if (coverPath && fs.existsSync(coverPath)) fs.unlinkSync(coverPath);
|
|
66
|
+
if (tempDir && fs.existsSync(tempDir)) fs.rmdirSync(tempDir);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
let coverPath;
|
|
70
|
+
let coverTempDir;
|
|
71
|
+
|
|
72
|
+
try {
|
|
73
|
+
const key = resolveApiKey(args);
|
|
74
|
+
|
|
75
|
+
const fileName = path.basename(video);
|
|
76
|
+
const size = fs.statSync(video).size;
|
|
77
|
+
const contentTypeHeader = getContentType(video);
|
|
78
|
+
|
|
79
|
+
console.log(`Uploading video: ${fileName} (${(size / 1024 / 1024).toFixed(1)}MB)`);
|
|
80
|
+
const { presignedUrl, fileTicket } = await api("/video/preSign", key, { fileName, size });
|
|
81
|
+
|
|
82
|
+
await uploadToS3(presignedUrl, video, contentTypeHeader);
|
|
83
|
+
console.log(` Uploaded to S3, polling status...`);
|
|
84
|
+
|
|
85
|
+
await pollImageStatus(key, fileTicket);
|
|
86
|
+
console.log(` Video processed.`);
|
|
87
|
+
|
|
88
|
+
console.log("Extracting video cover...");
|
|
89
|
+
({ coverPath, tempDir: coverTempDir } = extractVideoCover(video));
|
|
90
|
+
const cover = await uploadImage(key, coverPath);
|
|
91
|
+
|
|
92
|
+
console.log("Publishing...");
|
|
93
|
+
const body = {
|
|
94
|
+
contentType: 3,
|
|
95
|
+
fileTicket,
|
|
96
|
+
cover,
|
|
97
|
+
videoTimeSeconds,
|
|
98
|
+
isPublish: true,
|
|
99
|
+
};
|
|
100
|
+
if (text) body.bodyTextOnly = text;
|
|
101
|
+
|
|
102
|
+
const result = await publish(key, body);
|
|
103
|
+
|
|
104
|
+
printPublishSuccess(result);
|
|
105
|
+
} catch (err) {
|
|
106
|
+
console.error(`\nFailed: ${err.message}`);
|
|
107
|
+
process.exitCode = 1;
|
|
108
|
+
} finally {
|
|
109
|
+
cleanupCover(coverPath, coverTempDir);
|
|
110
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { maskApiKey, saveApiKey } from "./lib.mjs";
|
|
4
|
+
|
|
5
|
+
const args = process.argv.slice(2);
|
|
6
|
+
|
|
7
|
+
if (args.includes("--help")) {
|
|
8
|
+
console.log(`Usage: BINANCE_SQUARE_OPENAPI_KEY=<apiKey> node scripts/save-key.mjs
|
|
9
|
+
|
|
10
|
+
Save the Binance Square OpenAPI key to a local user config file with 0600 permissions.
|
|
11
|
+
|
|
12
|
+
Authentication:
|
|
13
|
+
Read the key from BINANCE_SQUARE_OPENAPI_KEY. Do not pass keys as CLI arguments.`);
|
|
14
|
+
process.exit(0);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (args.length > 0) {
|
|
18
|
+
console.error("Error: do not pass API keys as CLI arguments. Set BINANCE_SQUARE_OPENAPI_KEY instead.");
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const key = process.env.BINANCE_SQUARE_OPENAPI_KEY?.trim();
|
|
23
|
+
if (!key) {
|
|
24
|
+
console.error("Error: BINANCE_SQUARE_OPENAPI_KEY is required.");
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
const keyFile = saveApiKey(key);
|
|
30
|
+
console.log(`Saved Square OpenAPI key ${maskApiKey(key)} to ${keyFile}`);
|
|
31
|
+
} catch (err) {
|
|
32
|
+
console.error(`Failed: ${err.message}`);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|