I have problems in deserializing vectors from move contract in SUI.
This is backend codes.
module forum::forum {
use std::option::{ Option, some};
use std::string::{Self, String};
use std::vector::{ empty, push_back, contains};
use sui::object::{Self, UID};
use sui::transfer;
use sui::tx_context::{Self, TxContext};
use sui::url::{Self, Url};
use sui::clock::{Self, Clock};
struct Forum has key {
id: UID,
posts : vector<Post>,
}
struct Post has key, store {
id: UID,
title: String,
content: String,
creator: address,
vote: u64,
comments: vector<Comment>
}
struct Comment has key, store {
id: UID,
created_at: u64,
content: String,
reply: vector<Reply>
}
struct Reply has key, store {
id : UID,
created_at: u64,
content : String,
}
push_back(community_ref, _community);
if(!contains(&gilder.members, &creator)) {
push_back(&mut gilder.members, creator)
}
}
public fun get_posts(forum: &Forum) : &vector<Post> {
return &forum.posts
}
}
I have to deserialize this codes in frontend(for SUI).
I know I have to use bcs to deserialize post vectors from backend but I didn't find the solution.
Please help me if you know the solution.
Thanks
Top comments (0)