agent_dart
An agent library built for Internet Computer, a plugin package for dart and flutter apps. Developers can build ones to interact with Dfinity's blockchain directly.
Community: https://discord.gg/aNzRuePmUY
📃 Table of content
- Table of content
- Prerequisites
- Quick start
- Motivation
- Milestones
- Documentation
- Contributing
- Reference and related projects
- FAQ
🚦 Prerequisites
- Flutter version in the
agent_dart/pubspec.yaml
- CMake v3.2.0 or later
- Xcode (10.12) or later (Running on macOS or iOS)
- Android NDK version
21.4.7075529
(Running on Android) - Rust version 1.51
- Node.js v15.0 or later, TBD
⚡️ Quick start
-
git clone
-
install Prerequisites, make sure you run
flutter doctor -v
Without errors
-
To run example, follow instructions under
example
folder -
To run tests:
flutter test
🧘♂️ Motivation
The Internet Computer is powered by blockchain and its major impact is to bring WebApp to be truly decentralized. However, we are in the mobile internet era, even we can use Safari or Chrome on our cell phones. But most average people, not crypto enthusiasts, are likely to use native mobile apps, major users are there.
It's important to attract these people to use Dapps of Internet Computer, by providing stable, fast, and fully integrated to Dfinity's blockchain. We likely to provide further solution to balancing the "Decentralization" and "Efficiency". But first things first, we have to make mobile native apps work.
agent-rs
and agent-js
are the actual lower level client-SDKs, just like ether.js
or web3.js
of Ethereum's ecosystem. This library is aiming to port and replicate features from them. And this library is mainly for mobile apps to connect canisters, not deploying contracts (you can do that if you want, but use dart directly).
We have tried our best to migrate most interface styles just like Javascript version, but there are limitations and differences between different programming languages, we will document them as much as possible.
🏆 Milestones
Milestone 1: Core features/libraries migrating.
agent
, core library, with crypto and encoding/decoding methods , http call/query encapsulated, for interacting with canister.auth_client
, a popup window for flutter, used for getting authentication from Identity provider(eg, Internet Identity).authentication
, a library supportsauth_client
candid
, candid library, used for encoding/decoding candid data types, and used them in dart-lang.principal
, principal library, used for generate principal for many usage cases.protobuf
, protobuf library, used for interacting withrosetta-node
in submit/query transactionutils
, common utils, including useful helpers like extension methods in dart.wallet
, wallet library, signer, rosetta, key-smith all-in-one library.
Milestone 2: Enhanced built tool and more example apps
Milestone 3: Documentation and community driven development
📘 Documentation
Plan for docs site
A stand-alone docs site with guides for Dfinity Dapps made in Flutter/Dart
👨💻 Contributing
By contributing to agent_dart, you agree that your contributions will be licensed under its MIT License.
-
Fork this library and add your own branch. like this:
{github_id}/{feat|fix|test|dep}-{detail}
-
Install Prerequisites
-
Build rust dependencies for all supported platform (macOS, iOS, Android, windows, linux)
$ sh ./scripts/clean && ./scripts/init.sh && ./scripts/build.sh
-
Start example
Read instruction first, then run
$ cd example $ flutter run
-
Test (Unit Test and Integration Test)
$ flutter test
-
Commit and make a pull request, process is TBD for now. We will use CI to automate
🔗 Reference and related projects
⚠️ FAQ
Build rust libraries for iOS/MacOS
-
All rust method have to be written inside
SwiftAgentDartPlugin.swift
, to avoid tree shaking of latest release build by XCode. -
The
agent_dart_podspec
should change accordingly when this repo goes 1.0.0 -
On M1 chipset of MacOS, please install
rosetta 2
$ sudo softwareupdate --install-rosetta --agree-to-license
Network problem in iOS and MacOS
- If you run example or build a flutter app, you may come up with this:
[macOS] SocketException: Connection failed (OS Error: Operation not permitted, errno = 1)
- Go to
macos/Runner/
of macOS andios/Runner
- Edit
DebugProfile.entitlements
andReleaseProfile.entitlements
, Add following:
<key>com.apple.security.network.client</key>
<true/>
Libraries
- agent/actor
- agent/agent
- agent/agent/api
- agent/agent/factory
- agent/agent/http/fetch
- agent/agent/http/index
- agent/agent/http/transform
- agent/agent/http/types
- agent/agent/index
- agent/agent/proxy
- agent/auth
- agent/canisters/asset
- agent/canisters/asset_idl
- agent/canisters/canisters
- agent/canisters/management
- agent/canisters/management_idl
- agent/cbor
- agent/certificate
- agent/crypto/crypto
- agent/crypto/keystore/api
- agent/crypto/keystore/key_store
- agent/crypto/random
- agent/errors
- agent/polling/index
- agent/polling/strategy
- agent/request_id
- agent/types
- agent/utils/buffer_pipe
- agent/utils/hash
- agent/utils/leb128
- agent/utils/utils
- agent_dart
- agent_dart_web
- archiver/archiver
- archiver/decoder
- archiver/encoder
- archiver/signing_block
- auth_client/auth_client
- authentication/authentication
- bls/bls.base
- bls/bls.ffi
- bls/bls.stub
- bls/bls.web
- bls/ffi/ffi
- bls/ffi/ffi_base
- bls/ffi/ffi_helper
- bls/wasm_interop
- Dart wrapper for WebAssembly JavaScript API
- candid/idl
- candid/index
- identity/delegation
- identity/der
- identity/ed25519
- identity/identity
- identity/secp256k1
- principal/principal
- principal/utils/base32
- principal/utils/get_crc
- principal/utils/sha224
- principal/utils/sha256
- principal/utils/utils
- protobuf/ic_base_types/pb/v1/types.pb
- protobuf/ic_base_types/pb/v1/types.pbenum
- protobuf/ic_base_types/pb/v1/types.pbjson
- protobuf/ic_base_types/pb/v1/types.pbserver
- protobuf/ic_ledger/pb/v1/types.pb
- protobuf/ic_ledger/pb/v1/types.pbenum
- protobuf/ic_ledger/pb/v1/types.pbjson
- protobuf/ic_ledger/pb/v1/types.pbserver
- utils/array
- utils/base64
- utils/bech32
- utils/bn
- utils/extension
- utils/hex
- utils/is
- utils/map
- utils/number
- utils/string
- utils/u8a
- wallet/hashing
- wallet/keysmith
- wallet/ledger
- wallet/pem
- wallet/rosetta
- wallet/signer
- wallet/types
- wallet/wallet