Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/levifeldman/ic_tools
https://github.com/levifeldman/ic_tools
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/levifeldman/ic_tools
- Owner: levifeldman
- License: other
- Created: 2021-06-20T18:17:36.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-09-22T17:23:21.000Z (about 2 months ago)
- Last Synced: 2024-10-29T09:50:53.499Z (9 days ago)
- Language: Rust
- Homepage:
- Size: 1.62 MB
- Stars: 11
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-internet-computer - ic_tools - IC Tools supporting Dart & Flutter on the Web and Linux. (Client Libraries (Agents) / Dart/Flutter)
README
# ic_tools
[![Pub Version](https://shields.io/pub/v/ic_tools)](https://pub.dev/packages/ic_tools)
----------
This is a package that connects dart-code with the [world-computer](https://internetcomputer.org).For the Dart & Flutter, on the Web & Linux.
```dart
import 'package:ic_tools/ic_tools.dart';
import 'package:ic_tools/candid.dart';
import 'package:ic_tools/common.dart';main() async {
Caller caller = Caller(keys: await Ed25519Keys.new_keys());
print(caller.principal);
Canister icp_ledger = Canister(Principal.text('ryjl3-tyaaa-aaaaa-aaaba-cai'));Uint8List sponse_bytes = await icp_ledger.call(
calltype: CallType.query,
method_name: 'icrc1_balance_of',
put_bytes: c_forwards_one(
Record.of_the_map({
'owner': caller.principal,
'subaccount': Option(value: null, value_type: Blob.type_mode())
})
)
);
BigInt e8s = (c_backwards_one(sponse_bytes) as Nat).value;
Tokens icp_tokens = Tokens(quantums: e8s, decimal_places: 8);
print(icp_tokens);}
```On A Linux:
- create a folder: 'rust_bls12381' in the same directory as the pubspec.yaml file
- put this file: https://github.com/levifeldman/ic_tools_dart/tree/master/rust_bls12381/librust_bls12381.so in that folder.On The Web:
- copy the ic_tools_webfiles folder ( https://github.com/levifeldman/ic_tools_dart/tree/master/ic_tools_webfiles ) into the flutter web folder.
- put this line into the flutter index.html file before the flutter initialization script tags:```html
```