{"id":22035726,"url":"https://github.com/mrtnetwork/ton_dart","last_synced_at":"2025-05-07T19:43:31.236Z","repository":{"id":243912070,"uuid":"813756431","full_name":"mrtnetwork/ton_dart","owner":"mrtnetwork","description":"Ton Dart streamlines transaction management and crypto ops in the Ton network. It supports Wallet Contract, Highload Wallet, and Jetton contracts.","archived":false,"fork":false,"pushed_at":"2025-05-05T12:16:55.000Z","size":1671,"stargazers_count":15,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-05T13:31:56.242Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrtnetwork.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-06-11T17:20:35.000Z","updated_at":"2025-05-05T12:17:00.000Z","dependencies_parsed_at":"2025-04-11T19:39:01.995Z","dependency_job_id":"239e31f3-87c5-4240-8356-a9c1c2c67c48","html_url":"https://github.com/mrtnetwork/ton_dart","commit_stats":null,"previous_names":["mrtnetwork/ton_dart"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrtnetwork%2Fton_dart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrtnetwork%2Fton_dart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrtnetwork%2Fton_dart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrtnetwork%2Fton_dart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrtnetwork","download_url":"https://codeload.github.com/mrtnetwork/ton_dart/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252946239,"owners_count":21829744,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-30T10:26:13.429Z","updated_at":"2025-05-07T19:43:31.229Z","avatar_url":"https://github.com/mrtnetwork.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TON Dart\n\nTon Dart is a versatile package tailored for seamless integration with TonApi and TonCenter RPC APIs. It empowers developers to effortlessly create, sign, and dispatch transactions while offering robust support for Boc Serialization.\n\nDesigned to streamline interactions with Ton wallets such as Basic wallets 1 to 4, Highload Wallet V3, and Jetton Wallet, Ton Dart ensures smooth communication and transaction management within the Ton network.\n\nWith Ton Dart, you can harness advanced cryptographic capabilities for secure transaction signing and verification, enhancing the integrity of your operations. Whether you're executing runtime calls or querying accounts, TonDart provides a comprehensive toolkit to handle various data formats and cryptographic operations effectively.\n\nTo leverage Ton Dart's capabilities optimally, familiarity with TonApi and TonCenter RPC APIs is recommended. Ton Dart simplifies complex tasks, making it an indispensable tool for developers navigating the Ton ecosystem.\n\n## Futures\n\n- **Transaction Management**\n  - Create, sign, and verify transactions using ED25519.\n\n- **JSON-RPC**\n  - Communication with TonApi and TonCenter.\n\n- **BOC serialization**\n  - TON BOC serialization is a method for encoding and decoding data structures into a binary format within the Telegram Open Network.\n\n- **Contract**\n  - Provides support for Basic wallets 1 through 5.\n  - Offers support for deploying tokens and transferring Jettons with Minter and Jetton wallets (Jetton, StableJetton).\n  - Highload Wallet v3.\n  - Support for MultiOwner contracts (MultiOwner, Order).\n  - Support for NFTs contracts (NFTCollection, EditableCollection, NFTItem).\n\n### Examples\n\n  - [JettonMinter](https://github.com/mrtnetwork/ton_dart/tree/main/example/lib/examples/jetton/minter)\n  - [JettonWallet](https://github.com/mrtnetwork/ton_dart/tree/main/example/lib/examples/jetton/minter)\n  - [StableJettonMinter](https://github.com/mrtnetwork/ton_dart/tree/main/example/lib/examples/jetton/stable_minter)\n  - [StableJettonWallet](https://github.com/mrtnetwork/ton_dart/tree/main/example/lib/examples/jetton/stable_minter)\n  - [NFTs](https://github.com/mrtnetwork/ton_dart/tree/main/example/lib/examples/nft)\n  - [MultiOwner](https://github.com/mrtnetwork/ton_dart/tree/main/example/lib/examples/wallet/multi_owner)\n  - [Highload](https://github.com/mrtnetwork/ton_dart/tree/main/example/lib/examples/wallet/highload)\n  - [VersionedWallets](https://github.com/mrtnetwork/ton_dart/tree/main/example/lib/examples/wallet/versioned_wallet)\n\n- transfer\n\n```dart\n  /// TestWallet is a utility for quickly generating and testing wallet contracts from a specified version. \n  /// The code for this is available in the example folder.\n  final TestWallet\u003cWalletV5R1\u003e wallet = TestWallet(version: WalletVersion.v5R1);\n\n  final destination = TestWallet(version: WalletVersion.v1R1);\n  final destination2 = TestWallet(version: WalletVersion.v1R2);\n  final destination3 = TestWallet(version: WalletVersion.v1R3);\n  final destination4 = TestWallet(version: WalletVersion.v2R1);\n  final destination5 = TestWallet(version: WalletVersion.v2R2);\n  final destination6 = TestWallet(version: WalletVersion.v3R1);\n  final destination7 = TestWallet(version: WalletVersion.v3R2);\n  final destination8 = TestWallet(version: WalletVersion.v4);\n  final destination9 = TestWallet(version: WalletVersion.v5R1, index: 1);\n\n  await wallet.wallet.sendTransfer(\n      params:\n          VersionedV5TransferParams.external(signer: wallet.signer, messages: [\n        OutActionSendMsg(\n            outMessage: TonHelper.internal(\n                destination: destination.address,\n                amount: TonHelper.toNano(\"0.01\"))),\n        OutActionSendMsg(\n            outMessage: TonHelper.internal(\n                destination: destination2.address,\n                amount: TonHelper.toNano(\"0.01\"))),\n        OutActionSendMsg(\n            outMessage: TonHelper.internal(\n                destination: destination3.address,\n                amount: TonHelper.toNano(\"0.01\"))),\n        OutActionSendMsg(\n            outMessage: TonHelper.internal(\n                destination: destination4.address,\n                amount: TonHelper.toNano(\"0.01\"))),\n        OutActionSendMsg(\n            outMessage: TonHelper.internal(\n                destination: destination5.address,\n                amount: TonHelper.toNano(\"0.01\"))),\n        OutActionSendMsg(\n            outMessage: TonHelper.internal(\n                destination: destination6.address,\n                amount: TonHelper.toNano(\"0.01\"))),\n        OutActionSendMsg(\n            outMessage: TonHelper.internal(\n                destination: destination7.address,\n                amount: TonHelper.toNano(\"0.01\"))),\n        OutActionSendMsg(\n            outMessage: TonHelper.internal(\n                destination: destination8.address,\n                amount: TonHelper.toNano(\"0.01\"))),\n        OutActionSendMsg(\n            outMessage: TonHelper.internal(\n                destination: destination9.address,\n                amount: TonHelper.toNano(\"0.01\"))),\n      ]),\n      rpc: wallet.rpc);\n\n\n```\n\n- Deploy Jetton minter and mint token\n\n```dart\n final wallet = TestWallet\u003cWalletV5R1\u003e(version: WalletVersion.v5R1, index: 96);\n\n  final metadata = JettonOnChainMetadata.snakeFormat(\n      name: \"MRT NETWORK\",\n      image: \"https://avatars.githubusercontent.com/u/56779182?s=96\u0026v=4\",\n      symbol: \"MRT\",\n      decimals: 9,\n      description: \"https://github.com/mrtnetwork/ton_dart\");\n\n  final jetton = JettonMinter.create(\n      owner: wallet.wallet,\n      state: MinterWalletState(\n        owner: wallet.address,\n        chain: TonChain.testnet,\n        metadata: metadata,\n      ));\n\n  await jetton.sendOperation(\n      signerParams: VersionedV5TransferParams.external(signer: wallet.signer),\n      rpc: wallet.rpc,\n      amount: TonHelper.toNano(\"0.9\"),\n      operation: JettonMinterMint(\n          totalTonAmount: TonHelper.toNano(\"0.5\"),\n          to: wallet.address,\n          transfer: JettonMinterInternalTransfer(\n              jettonAmount: TonHelper.toNano(\"100000\"),\n              forwardTonAmount: TonHelper.toNano(\"0.01\")),\n          jettonAmount: TonHelper.toNano(\"100000\")));\n\n```\n\n\n### JSON-RPC\n\n```dart\n\n/// HTTPProvider class implements TonServiceProvider interface\n/// for handling HTTP requests to TonApi and TonCenter.\nclass HTTPProvider implements TonServiceProvider {\n  /// Constructor for HTTPProvider.\n  HTTPProvider({\n    required this.tonApiUrl,\n    required this.tonCenterUrl,\n    http.Client? client,\n    this.defaultRequestTimeout = const Duration(seconds: 30),\n  }) : client = client ?? http.Client();\n\n  /// TonApi URL.\n  final String? tonApiUrl;\n\n  /// TonCenter URL.\n  final String? tonCenterUrl;\n\n  /// HTTP client.\n  final http.Client client;\n\n  /// Default request timeout.\n  final Duration defaultRequestTimeout;\n\n  @override\n  Future\u003cdynamic\u003e get(TonRequestDetails params, [Duration? timeout]) async {\n    /// Check examples file\n    /// ...\n  }\n\n  @override\n  Future\u003cdynamic\u003e post(TonRequestDetails params, [Duration? timeout]) async {\n    /// Check examples file\n    /// ...\n  }\n}\n\n\n  /// Initialize TonProvider with HTTPProvider for Testnet\n  final rpc = TonProvider(HTTPProvider(\n    tonApiUrl: \"https://testnet.tonapi.io\",\n    tonCenterUrl: \"https://testnet.toncenter.com/api/v2/jsonRPC\",\n  ));\n\n  /// Define TonAddress\n  final address =\n      TonAddress(\"Ef_GHcGwnw-bASoxTGQRMNwMQ6w9iCQnTqrv1REDfJ5fCYD2\");\n\n  /// Get balance of the address\n  final balance =\n      await rpc.request(TonCenterGetAddressBalance(address.toString()));\n\n  /// Get account details\n  final account = await rpc.request(TonApiGetAccount(address.toString()));\n\n  /// Get transactions related to the address\n  final transaction =\n      rpc.request(TonCenterGetTransactions(address: address.toString()));\n\n  /// ...\n\n\n```\n\n### Addresses and KeyManagment\n\n```dart\n\n  /// Define password for mnemonic generation\n  const String password = \"MRTNETWORK\";\n\n  /// Generate mnemonic from specified number of words and password\n  final mnemonic =\n      TonMnemonicGenerator().fromWordsNumber(24, password: password);\n\n  /// Generate seed from mnemonic\n  final seed = TonSeedGenerator(mnemonic)\n      .generate(password: password, validateTonMnemonic: true);\n\n  /// Derive private key from seed\n  final privateKey = TonPrivateKey.fromBytes(seed);\n\n  /// Derive public key from private key\n  final publicKey = privateKey.toPublicKey();\n\n  /// Create WalletV4 instance with derived public key\n  final wallet = WalletV4(chain: TonChain.testnet, , publicKey: publicKey.toBytes());\n\n  /// Get address from wallet\n  final address = wallet.address;\n\n  /// sign transaction\n  final signature = privateKey.sign(digest);\n\n```\n\n## Resources\n\n- Comprehensive Testing: All functionalities have been thoroughly tested, ensuring reliability and accuracy.\n\n## Contributing\n\nContributions are welcome! Please follow these guidelines:\n\n- Fork the repository and create a new branch.\n- Make your changes and ensure tests pass.\n- Submit a pull request with a detailed description of your changes.\n\n## Feature requests and bugs\n\nPlease file feature requests and bugs in the issue tracker.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrtnetwork%2Fton_dart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrtnetwork%2Fton_dart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrtnetwork%2Fton_dart/lists"}