Comments (6)
Hey!
v0.5 is still alpha, we're pushing for it to be stable very soon, hopefully, this week. For the inter-canister calls, you can currently see the example in fib
and multi-counter
both demoing the use of the new CallBuilder
For automatic candid generation notice this in the fib example:
ic-kit/examples/fib/src/canister.rs
Lines 29 to 31 in 7f8a47c
running
cargo test
now automatically writes the candid to the provided path.
As for importing canisters and dynamic creation, the new version is taking a different approach which is what's currently pending, the factory-counter example should demo this once it is possible.
from ic-kit.
see this #24 for the wip dynamic canister creation.
from ic-kit.
believe me, we're also eagerly awaiting the release internally xD
- the
main.rs
file is used for building the canister as a wasm, but we're considering allowing a CLI over the canister implementation, and later allowingcargo run
to spin up a debugger replica, but i think if you docrate-type = ["cdylib", "lib"]
you should be able to both import the library and build it at the same time. So there is a chance we may end up removing thosemain.rs
files and have onebin/src/{cli.rs, replica.rs}
- for type-safe canister interface import we're also thinking of auto-generating a trait for the canister, the design of it is still pending, but once we merge the dynamic canister ability, we can move to that.
But one of our main goals is being able to import the canister, that is:
- import the canister along its dependencies for testing.
- import the canister for dynamic creation (factory design pattern)
- Import the interface of the canister to do type-safe interaction.
from ic-kit.
The upgrade and schema migration should happen on each canister level, we will only provide the installation helpers in the dynamic canister context.
But ic-kit-stable
is probably what you would be interested in, it will contain stable data structures implemented. and as far as schema migration goes it's always advised to:
- never remove/rename a field at the application data model layer.
- always only append new optional fields in the model layer and provide a default value.
This will greatly reduce your cost of migration and more importantly will save you from headaches since you can still restore/decode data stored in a previous version and access it.
And as far as mass migration goes, we currently don't have something on the roadmap, but if it turns out to be a need for some project internally we may consider creating an option (Cap future migration might involve a mass migration, but I honestly don't know and wish it doesn't!)
from ic-kit.
@qti3e Thank you for the clarification. Eagerly awaiting the release :)
2 quick questions I had while going through the example code:
- Any particular reason why there's a
main.rs
files for all the canister packages? Do you build a binary? What does it do? - The Dfinity prescribed mechanism of inter-canister calls just needs you to import the canister name and it detects the details (I imagine from the
dfx.json
andcanister_ids.json
files). TheCallBuilder
mechanism requires us to pass thecanister_id
as aPrincipal
and the method name to be called as aString
kinda how the ic_cdk does it as a System API call. I apologize if my Rust understanding is limited but I was wondering if there's a way to import the canister struct definition in a type safe way into another canister and have it expose its methods available in a type safe way. This would be the the most ergonomic and delightful developer experience possible and would make ic-kit a compelling reason for other projects as well as opposed to the ic_cdk. I imagine this is possible theoretically since the type information is available over Candid but not sure how feasible this is practically.
Thank you for the inputs nonetheless :)
from ic-kit.
@qti3e
One final question. For dynamically created canisters, how do you prescribe handling migrations, especially if there's a schema change? Will ic-kit have any guidelines/features around it?
from ic-kit.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ic-kit.