Replies: 2 comments 3 replies
-
|
Beta Was this translation helpful? Give feedback.
1 reply
-
Hey @ajaythxkur I wrote the code for the view functions. Is this right? #[view]
public fun view_cards_count():u64 acquires State {
let state = borrow_global_mut<State>(@my_addrx);
state.total_cards_count
}
#[view]
public fun view_cards(): vector<Card> acquires State, Card {
let state = borrow_global_mut<State>(@my_addrx);
let cards = vector::empty<Card>();
let count = state.total_cards_count;
for (i in 1..(count+1)) {
let temp = simple_map::borrow(&mut state.cards_by_id, &i);
vector::push_back(&mut cards, temp);
};
cards
} |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Discord user ID
shoydon
Describe your question in detail.
Hello.... I am new to Move. I just wanted some help in my project
Can someone help me correct this code?
i am making a card collection app. I have made it using solidity, so i was trying to build it on aptos
Solidity code for reference:
What error, if any, are you getting?
No response
What have you tried or looked at? Or how can we reproduce the error?
No response
Which operating system are you using?
Windows
Which SDK or tool are you using? (if any)
N/A
Describe your environment or tooling in detail
No response
Beta Was this translation helpful? Give feedback.
All reactions