diff --git a/src/core/adapter/devhub-contract.jsx b/src/core/adapter/devhub-contract.jsx index f3e2ee363..3ccc11815 100644 --- a/src/core/adapter/devhub-contract.jsx +++ b/src/core/adapter/devhub-contract.jsx @@ -105,23 +105,23 @@ function getAllCommunitiesMetadata() { } function getAllLabels() { - return Near.view("${REPL_DEVHUB_CONTRACT}", "get_all_labels") ?? null; + return Near.view("${REPL_DEVHUB_LEGACY}", "get_all_labels") ?? null; } function getPost({ post_id }) { - return Near.view("${REPL_DEVHUB_CONTRACT}", "get_post", { post_id }) ?? null; + return Near.view("${REPL_DEVHUB_LEGACY}", "get_post", { post_id }) ?? null; } function getPostsByAuthor({ author }) { return ( - Near.view("${REPL_DEVHUB_CONTRACT}", "get_posts_by_author", { author }) ?? + Near.view("${REPL_DEVHUB_LEGACY}", "get_posts_by_author", { author }) ?? null ); } function getPostsByLabel({ label }) { return ( - Near.view("${REPL_DEVHUB_CONTRACT}", "get_posts_by_label", { + Near.view("${REPL_DEVHUB_LEGACY}", "get_posts_by_label", { label, }) ?? null ); @@ -142,7 +142,7 @@ function useQuery(name, params) { const cacheState = useCache( () => Near.asyncView( - "${REPL_DEVHUB_CONTRACT}", + "${REPL_DEVHUB_LEGACY}", ["get", name].join("_"), params ?? {} ) diff --git a/src/devhub/entity/post/Post.jsx b/src/devhub/entity/post/Post.jsx index 01a6c99bb..c5c66c4af 100644 --- a/src/devhub/entity/post/Post.jsx +++ b/src/devhub/entity/post/Post.jsx @@ -30,7 +30,7 @@ const postId = props.post.id ?? (props.id ? parseInt(props.id) : 0); const post = props.post ?? - Near.view("${REPL_DEVHUB_CONTRACT}", "get_post", { post_id: postId }); + Near.view("${REPL_DEVHUB_LEGACY}", "get_post", { post_id: postId }); if (!post) { return
Loading ...
; @@ -60,12 +60,12 @@ const compareSnapshot = // If this post is displayed under another post. Used to limit the size. const isUnderPost = props.isUnderPost ? true : false; -const parentId = Near.view("${REPL_DEVHUB_CONTRACT}", "get_parent_id", { +const parentId = Near.view("${REPL_DEVHUB_LEGACY}", "get_parent_id", { post_id: postId, }); const childPostIdsUnordered = - Near.view("${REPL_DEVHUB_CONTRACT}", "get_children_ids", { + Near.view("${REPL_DEVHUB_LEGACY}", "get_children_ids", { post_id: postId, }) ?? []; @@ -278,7 +278,7 @@ const onLike = () => { let likeTxn = [ { - contractName: "${REPL_DEVHUB_CONTRACT}", + contractName: "${REPL_DEVHUB_LEGACY}", methodName: "add_like", args: { post_id: postId, diff --git a/src/devhub/entity/post/PostEditor.jsx b/src/devhub/entity/post/PostEditor.jsx index 8fb798e93..a2952201a 100644 --- a/src/devhub/entity/post/PostEditor.jsx +++ b/src/devhub/entity/post/PostEditor.jsx @@ -85,7 +85,7 @@ const [postData, setPostData] = useState(null); // for capturing edit post chang useEffect(() => { if (mode == "Edit") { - const data = Near.view("${REPL_DEVHUB_CONTRACT}", "get_post", { + const data = Near.view("${REPL_DEVHUB_LEGACY}", "get_post", { post_id: postId, }); if (!postData) { @@ -97,7 +97,7 @@ useEffect(() => { setPostData(data); } } else { - const postIds = Near.view("${REPL_DEVHUB_CONTRACT}", "get_all_post_ids"); + const postIds = Near.view("${REPL_DEVHUB_LEGACY}", "get_all_post_ids"); if (!postIdList) { setPostIdList(postIds); } @@ -400,7 +400,7 @@ const setLabels = (labels) => { oldLabels.delete(label.name); } let removed = oldLabels.values().next().value; - Near.asyncView("${REPL_DEVHUB_CONTRACT}", "is_allowed_to_use_labels", { + Near.asyncView("${REPL_DEVHUB_LEGACY}", "is_allowed_to_use_labels", { editor: context.accountId, labels: [removed], }).then((allowed) => { @@ -425,7 +425,7 @@ const setLabels = (labels) => { } }; const existingLabelStrings = - Near.view("${REPL_DEVHUB_CONTRACT}", "get_all_allowed_labels", { + Near.view("${REPL_DEVHUB_LEGACY}", "get_all_allowed_labels", { editor: context.accountId, }) ?? []; const existingLabelSet = new Set(existingLabelStrings); @@ -455,7 +455,7 @@ const labelEditor = ( props.text.toLowerCase() !== "blog" && // dont allow adding "Blog" props.selected.filter((selected) => selected.name === props.text) .length == 0 && - Near.view("${REPL_DEVHUB_CONTRACT}", "is_allowed_to_use_labels", { + Near.view("${REPL_DEVHUB_LEGACY}", "is_allowed_to_use_labels", { editor: context.accountId, labels: [props.text], })