From fe4184619cc13f1d38c6a3d1baab966abbfa0f88 Mon Sep 17 00:00:00 2001 From: gitee-bot Date: Thu, 18 Dec 2025 01:53:39 +0000 Subject: [PATCH] Add README.md --- README.en.md | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 170 insertions(+) create mode 100644 README.en.md create mode 100644 README.md diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000..e1f32f0 --- /dev/null +++ b/README.en.md @@ -0,0 +1,85 @@ +# Solana Counter Example Project + +This is a simple counter program example based on the Solana blockchain, featuring both Rust and TypeScript client implementations, designed for learning and developing Solana smart contracts. + +## Project Structure + +- `programs/my-project/` - Solana smart contract program code +- `client/` - Rust client example +- `client-ts/` - TypeScript client example and documentation +- `migrations/` - Deployment scripts +- `tests/` - Test code + +## Core Features + +- Initialize the counter account +- Increment the counter value +- Decrement the counter value +- Query the counter state + +## Development Languages and Tools + +- Rust (smart contract and client) +- TypeScript (client) +- Anchor framework +- Solana CLI + +## Quick Start + +1. Install [Solana CLI](https://docs.solana.com/cli/install-solana-cli-tools) +2. Install [Anchor](https://book.anchor-lang.com/getting_started/installation.html) +3. Start the local test network: + ```bash + solana-test-validator + ``` +4. Build the project: + ```bash + anchor build + ``` +5. Deploy the program: + ```bash + anchor deploy + ``` +6. Run client tests: + - Rust client: + ```bash + cd client + cargo run + ``` + - TypeScript client: + ```bash + cd client-ts + npm install + npx ts-node examples/basic.ts + ``` + +## Documentation Resources + +- [TypeScript Client Usage Guide](client-ts/README.md) +- [Rust Client Usage Guide](client/README.md) +- [Complete Deployment and Invocation Guide](DEPLOYMENT_GUIDE.md) +- [Comparison of Three Client Implementations](client-ts/COMPARISON.md) + +## Smart Contract Details + +The counter program implements the following functions: + +- `initialize`: Creates and initializes the counter account +- `increment`: Increments the counter value by 1 +- `decrement`: Decrements the counter value by 1 + +The account structure contains a `Counter` struct that holds the current count value. + +## Learning Resources + +- Solana Official Documentation: https://docs.solana.com/ +- Anchor Framework Documentation: https://book.anchor-lang.com/ +- Solana Developer Portal: https://solana.com/developers + +## Contribution Guidelines + +Contributions to code and documentation are welcome! Refer to CONTRIBUTING.md for more information. + +## License + +This project is licensed under the MIT License — see the LICENSE file for details. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..9cf84db --- /dev/null +++ b/README.md @@ -0,0 +1,85 @@ +# Solana 计数器示例项目 + +这是一个基于 Solana 区块链的简单计数器程序示例,包含了 Rust 和 TypeScript 客户端实现,适用于学习和开发 Solana 智能合约。 + +## 项目结构 + +- `programs/my-project/` - Solana 智能合约程序代码 +- `client/` - Rust 客户端示例 +- `client-ts/` - TypeScript 客户端示例及文档 +- `migrations/` - 部署脚本 +- `tests/` - 测试代码 + +## 核心功能 + +- 初始化计数器账户 +- 增加计数器值 +- 减少计数器值 +- 查询计数器状态 + +## 开发语言与工具 + +- Rust(智能合约和客户端) +- TypeScript(客户端) +- Anchor 框架 +- Solana CLI + +## 快速开始 + +1. 安装 [Solana CLI](https://docs.solana.com/cli/install-solana-cli-tools) +2. 安装 [Anchor](https://book.anchor-lang.com/getting_started/installation.html) +3. 启动本地测试网络: + ```bash + solana-test-validator + ``` +4. 构建项目: + ```bash + anchor build + ``` +5. 部署程序: + ```bash + anchor deploy + ``` +6. 运行客户端测试: + - Rust 客户端: + ```bash + cd client + cargo run + ``` + - TypeScript 客户端: + ```bash + cd client-ts + npm install + npx ts-node examples/basic.ts + ``` + +## 文档资源 + +- [TypeScript 客户端使用指南](client-ts/README.md) +- [Rust 客户端使用指南](client/README.md) +- [部署和调用完整指南](DEPLOYMENT_GUIDE.md) +- [三种客户端实现方式对比](client-ts/COMPARISON.md) + +## 智能合约说明 + +计数器程序实现了以下功能: + +- `initialize`:创建并初始化计数器账户 +- `increment`:将计数器值加 1 +- `decrement`:将计数器值减 1 + +账户结构包含一个 `Counter` 结构,其中保存了当前计数值。 + +## 学习资源 + +- Solana 官方文档:https://docs.solana.com/ +- Anchor 框架文档:https://book.anchor-lang.com/ +- Solana 开发者门户:https://solana.com/developers + +## 贡献指南 + +欢迎贡献代码和文档!请参考 CONTRIBUTING.md 获取更多信息。 + +## 许可证 + +该项目使用 MIT 许可证,详见 LICENSE 文件。 \ No newline at end of file -- Gitee