搜索插件、代码仓与 APP 分类

GitHub 代码仓Simplicity-Block/simplicity_sdk

simplicity_sdk

Simplicity-Block/simplicity_sdk open-source repository details.

simplicity_sdk 项目封面
星标
1
复刻
0
最近推送(UTC)
2025年3月2日
项目状态
未归档

原始 README

以下为英文项目原文快照,最新内容请访问 GitHub。

Simplicity SDK for Flutter

The official SDK for interacting with the Simplicity Blockchain, designed specifically for Flutter developers. This SDK simplifies the process of deploying smart contracts and interacting with their functions, abstracting complexities such as signature management.

The SDK supports smart contracts written in Simply-lang, a user-friendly programming language for the Simplicity Blockchain. With this package, you can focus on building innovative blockchain solutions without dealing with low-level details.

Learn more about Simply-lang and Simplicity Blockchain here:

Features

  • 🚀 Easy contract deployment
  • 🔄 Simple function calls
  • 🔐 Automatic signature handling
  • 🔑 Public key derivation
  • ⚡ Async/await support
  • 🛡️ Comprehensive error handling

Installation

To install the SDK, add it to your pubspec.yaml file:

dependencies:
  simplicity_sdk: ^1.0.0

Then, run:

flutter pub get

Quick Start

Initialize the SDK
import 'package:simplicity_sdk/simplicity_sdk.dart';

final sdk = SmartContractSDK();
Deploy a Contract
try {
  final deploymentResult = await sdk.deployContract(
    privateKey: 'your_private_key',
    contractName: 'MyWallet',
    contractCode: '''
      contract wallet with amount, address does
        deposit takes amount does
          save balance is balance + amount
          return balance
        .
      .
    ''',
  );
  
  print('Contract deployed at: ${deploymentResult.contractAddress}');
} on SmartContractException catch (e) {
  print('Deployment failed: $e');
}
Call Contract Functions
try {
  final callResult = await sdk.callContract(
    privateKey: 'your_private_key',
    contractAddress: 'contract_address',
    functionName: 'deposit',
    parameters: {'amount': 100},
  );
  
  print('Call result: ${callResult.result}');
} on SmartContractException catch (e) {
  print('Contract call failed: $e');
}

Advanced Usage

Custom Server Configuration

You can configure custom server URLs for both ECDSA and contract services:

final sdk = SmartContractSDK(
  ecdsaServerUrl: 'https://your-ecdsa-server.com',
  contractServerUrl: 'https://your-contract-server.com',
);
Error Handling

The SDK provides a custom SmartContractException for detailed error messages:

try {
  // SDK operations
} on SmartContractException catch (e) {
  print('Operation failed: ${e.message}');
} catch (e) {
  print('Unexpected error: $e');
}
Response Types
DeploymentResult
DeploymentResult {
  String contractAddress;    // The deployed contract's address
}
ContractCallResult
ContractCallResult {
  bool success;             // Whether the call was successful
  dynamic result;           // The function call result
}

Example Project

Check out the example directory for a complete sample project that demonstrates the features of the SDK.

Contributing

Contributions are welcome! If you encounter a bug or want to suggest a feature:

  1. Check existing issues and pull requests
  2. Create an issue to discuss the change
  3. Submit a pull request

Please read CONTRIBUTING.md for details on our code of conduct and development process.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Simplicity Block GitHub avatar
GitHub 作者

Simplicity Block ↗

Simplicity Blockchain: It's designed so anyone can effortlessly learn how blockchain works.

语言C++CMakeDartSwiftCHTMLKotlinObjective-C

使用的依赖

依赖清单 4 项

  • flutter{"sdk":"flutter"}
  • http^1.1.0
  • flutter_test开发依赖{"sdk":"flutter"}
  • flutter_lints开发依赖^2.0.0

如何选择适合项目的代码仓?

先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。

  1. 通过仓库名、作者或描述搜索,再按技术分类缩小范围。
  2. 结合星标、复刻与最近推送比较项目;星标反映社区关注,不代表质量保证。
  3. 使用前在 GitHub 核对 README、许可证与 Issues。

来源与维护

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗