Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Commit

Permalink
Adjust treasury.tips to tips module (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
WoeOm authored Aug 23, 2021
1 parent 91c452a commit 0473a94
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/page-treasury/src/Overview/TipReason.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ interface Props {

function TipReason ({ hash }: Props): React.ReactElement<Props> {
const { api } = useApi();
const reasonText = useCall<string | null>(api.query.treasury.reasons, [hash], {

const reasonText = useCall<string | null>((api.query.tips || api.query.treasury).reasons, [hash], {
transform: (optBytes: Option<Bytes>) =>
optBytes.isSome
? hexToString(optBytes.unwrap().toHex())
Expand Down
2 changes: 1 addition & 1 deletion packages/page-treasury/src/Overview/Tips.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function Tips ({ className = '', defaultId, hashes, isMember, members, onSelectT
const { api } = useApi();
const [onlyUntipped, setOnlyUntipped] = useState(false);
const bestNumber = useCall<BlockNumber>(api.derive.chain.bestNumber);
const optTips = useCall<Option<OpenTip>[]>(hashes && api.query.treasury.tips.multi, [hashes]);
const optTips = useCall<Option<OpenTip>[]>(hashes && (api.query.tips || api.query.treasury).tips.multi, [hashes]);

const tips = useMemo(
() => extractTips(optTips, hashes),
Expand Down
2 changes: 1 addition & 1 deletion packages/page-treasury/src/Overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function Overview ({ className }: Props): React.ReactElement<Props> {

useEffect((): void => {
if (hashTrigger && mountedRef.current) {
api.query.treasury.tips.keys().then((keys) =>
(api.query.tips || api.query.treasury).tips.keys().then((keys) =>
mountedRef.current && setHashes(
keys.map((key) => key.args[0].toHex())
)
Expand Down

0 comments on commit 0473a94

Please sign in to comment.