Comments (3)
Bringing up here again that this:
The current builders are minimal implementations of the pattern that do not apply any compile-time validation
is outdated. Our transaction builders were refactored to check for mandatory fields at compile time. The only remaining builders with the issue should be the algod/kmd/indexer builders, which have a total of 1 or 2 mandatory fields. Here we might need possibly just a factory (initializer that returns an error if e.g. the URL is incorrectly formatted) instead of the builder pattern.
from algonaut.
A slight suggestion: I think the default builder should just be a tight wrapper of the custom endpoint builder struct. Reasoning being -- creating a custom endpoint should be a strictly more powerful ability than creating the default endpoint. It might also help with the discovery of the custom endpoint builder.
from algonaut.
What about something like this:
#[derive(Default)]
pub struct AlgodBuilder {}
impl AlgodBuilder {
pub fn with_token(url: &str, token: &str) -> Result<Algod, AlgonautError> {
Self::with_headers(
url,
vec![("X-Algo-API-Token", &ApiToken::parse(token)?.to_string())],
)
}
pub fn with_headers(url: &str, headers: Headers) -> Result<Algod, AlgonautError> {
Ok(Algod::new(Client::new(url, headers)?))
}
}
We could also remove AlgodBuilder
and just add a convenience initializers to Algod
.
The later would also simplify managing multiple versions - if there are new versions, we don't need to create multiple entry points / builders.
If the initialization becomes more complex later (unlikely?) we can consider re-adding the builder pattern. Currently it seems not justified.
from algonaut.
Related Issues (20)
- `Transaction::note` is a base64 string, but should probably be decoded. HOT 1
- Indexer just launched new version. HOT 5
- ABI support
- Atomic Transaction Composer support
- Consider adding checked arithmetic operations to `MicroAlgos`
- Populate `PendingTransaction.txn`
- Newtypes for app id, asset id, tx id HOT 5
- OpenAPI basic functionality
- OpenAPI types customization
- Add traits for a leaner transaction creation API HOT 4
- Support request retry?
- Add GetApplicationAddress from Algorand SDK HOT 2
- Automated tests stopped working
- Review crate structure HOT 1
- Example `key_reg` stopped working
- Add support for Boxes HOT 11
- Build error when importing `algonaut_transaction` HOT 2
- Implement Logic Crate HOT 2
- querying by tx id fails HOT 1
- Implement Clone on Algod
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 algonaut.