-
Notifications
You must be signed in to change notification settings - Fork 81
Add auth example and update auth learn page #95
Conversation
Preview is available here: |
let key = DataKey::Nonce(id.clone()); | ||
let nonce = Self::read_nonce(e, id); | ||
e.contract_data() | ||
.set(key, nonce.clone() + BigInt::from_u32(e, 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fyi you can just do + 1.
- .set(key, nonce.clone() + BigInt::from_u32(e, 1));
+ .set(key, &nonce + 1);
&e, | ||
&WrappedAuth(auth), | ||
nonce.clone(), | ||
Symbol::from_str("save_data"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use symbol!
? It reduces the code size considerably and was added in this release.
- Symbol::from_str("save_data"),
+ symbol!("save_data"),
pub struct AuthContract; | ||
|
||
#[cfg_attr(feature = "export", contractimpl)] | ||
#[cfg_attr(not(feature = "export"), contractimpl(export = false))] | ||
impl AuthContract { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we rename the contract to ExampleContract
? The name AuthContract
tripped me up the first time I saw it because I thought it was a contract that provided authorization. I think this could trip others up too, like this is an example of a contract that provides authorization rather than an example of how to do authorization.
title: Authorization | ||
--- | ||
|
||
The [authorization example] demonstrates how to write a contract function that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The [authorization example] demonstrates how to write a contract function that
+ The [authorization example] demonstrates how to add authorization to a contract, and how to write a contract function that
* noop * noop * Update sdk and cli versions and output (#87) * Update code samples in quickstart (#88) * empty * Update the tutorial for creating a project (#89) * Update the tutorial for writing a contract (#90) * Update the tutorial for testing (#91) * Update the hello_world contract (#92) * Small fix to hello contract * Update the increment contract (#93) * Small fix to increment example * Update the custom_types contract (#94) * Add auth example and update auth learn page (#95) * Put auth example earlier in list of examples Co-authored-by: Tyler van der Hoeven <[email protected]> Co-authored-by: Siddharth Suresh <[email protected]>
* noop * noop * Update sdk and cli versions and output (#87) * Update code samples in quickstart (#88) * empty * Update the tutorial for creating a project (#89) * Update the tutorial for writing a contract (#90) * Update the tutorial for testing (#91) * Update the hello_world contract (#92) * Small fix to hello contract * Update the increment contract (#93) * Small fix to increment example * Update the custom_types contract (#94) * Add auth example and update auth learn page (#95) * Put auth example earlier in list of examples (#98) (cherry picked from commit fc2fc75) * Add events example (#100) * Update the cross_contract contract (#99) * Small tweak to contract call doc * Fix to contract call code sample * Fix to contract call code sample * noop to try and make it deploy properly * Reorder examples so that contract events appears higher in list * Fix headings of cross contract example (#102) * Add soroban-cli read example * Tweak language about developer discord * Some changes to the events example page (#101) * Rename standard-contracts and update token-contract (#103) * Rename Standard Contracts to Built-In Contracts * Update built-in-contracts/token-contract and examples/authorization * Fix title capitalization of built-in contracts page (#104) * Add stub for token example (#105) * Update authorization docs to line up with contract examples (#106) * Small fixes for token contract doc * Make authorization docs line up with the example * Instruct users to checkout v0.0.4 tag for examples (#107) * fix pages and sdk instructions * Add auth sdk page Co-authored-by: Tyler van der Hoeven <[email protected]> Co-authored-by: Siddharth Suresh <[email protected]> Co-authored-by: Jay Geng <[email protected]> Co-authored-by: jonjove <[email protected]>
No description provided.