-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
x/post
and x/tokenfactory
modules msg types [web-desmos] (
#1298) ## Description Closes: [BDU-1125](https://forbole.atlassian.net/browse/BDU-1125) <!-- Add a description of the changes that this PR introduces and the files that are the most critical to review. --> Changes: 1. Support new `x/post` module msg types: - [MsgMovePost](https://github.com/desmos-labs/desmos/blob/v6.0.0/proto/desmos/posts/v3/msgs.proto#L392) - [MsgRequestPostOwnerTransfer](https://github.com/desmos-labs/desmos/blob/v6.0.0/proto/desmos/posts/v3/msgs.proto#L442) - [MsgCancelPostOwnerTransferRequest](https://github.com/desmos-labs/desmos/blob/v6.0.0/proto/desmos/posts/v3/msgs.proto#L481) - [MsgAcceptPostOwnerTransferRequest](https://github.com/desmos-labs/desmos/blob/v6.0.0/proto/desmos/posts/v3/msgs.proto#L515) - [MsgRefusePostOwnerTransferRequest](https://github.com/desmos-labs/desmos/blob/v6.0.0/proto/desmos/posts/v3/msgs.proto#L548) 2. Support `x/tokenfactory` module msg types: - MsgCreateDenom - MsgMint - MsgBurn - MsgSetDenomMetadata - MsgUpdateParams --- ### Author Checklist _All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues._ I have... - [x] ran linting via `yarn lint` - [x] wrote tests where necessary - [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [x] targeted the correct branch - [x] provided a link to the relevant issue or specification - [x] reviewed "Files changed" and left comments if necessary - [x] confirmed all CI checks have passed - [x] added a changeset via [`yarn && yarn changeset`](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md) [BDU-1125]: https://forbole.atlassian.net/browse/BDU-1125?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
- Loading branch information
Showing
48 changed files
with
1,527 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'web-desmos': minor | ||
'ui': minor | ||
--- | ||
|
||
Add x/post and x/tokenfactory modules msg types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...components/msg/posts/accept_post_owner_transfer_request/__snapshots__/index.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`screen: TransactionDetails/AcceptPostOwnerTransferRequest matches snapshot 1`] = ` | ||
.emotion-0 { | ||
margin: 0; | ||
font-size: 1rem; | ||
white-space: pre-wrap; | ||
letter-spacing: 0.5px; | ||
font-family: "Roboto","Helvetica","Arial",sans-serif; | ||
font-weight: 400; | ||
line-height: 1.5; | ||
} | ||
<p | ||
className="MuiTypography-root MuiTypography-body1 emotion-0" | ||
> | ||
<span | ||
data-testid="Trans" | ||
i18nKey="message_contents:txMsgAcceptPostOwnerTransferRequest" | ||
> | ||
<div | ||
address="receiver" | ||
id="Name" | ||
name="receiver" | ||
/> | ||
<b /> | ||
{"receiver":"receiver","post_id":"1","subspace_id":"subspace-id-1"} | ||
</span> | ||
</p> | ||
`; |
38 changes: 38 additions & 0 deletions
38
apps/web-desmos/src/components/msg/posts/accept_post_owner_transfer_request/index.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import renderer from 'react-test-renderer'; | ||
import AcceptPostOwnerTransferRequest from '@/components/msg/posts/accept_post_owner_transfer_request'; | ||
import MsgAcceptPostOwnerTransferRequest from '@/models/msg/posts/msg_accept_post_owner_transfer_request'; | ||
import MockTheme from '@/tests/mocks/MockTheme'; | ||
|
||
// ================================== | ||
// mocks | ||
// ================================== | ||
jest.mock('@/components/name', () => (props: JSX.IntrinsicElements['div']) => ( | ||
<div id="Name" {...props} /> | ||
)); | ||
|
||
// ================================== | ||
// unit tests | ||
// ================================== | ||
describe('screen: TransactionDetails/AcceptPostOwnerTransferRequest', () => { | ||
it('matches snapshot', () => { | ||
const message: MsgAcceptPostOwnerTransferRequest = { | ||
category: 'posts', | ||
type: 'MsgAcceptPostOwnerTransferRequest', | ||
receiver: 'receiver', | ||
post_id: '1', | ||
subspace_id: 'subspace-id-1', | ||
json: {}, | ||
}; | ||
const component = renderer.create( | ||
<MockTheme> | ||
<AcceptPostOwnerTransferRequest message={message} /> | ||
</MockTheme> | ||
); | ||
const tree = component?.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
afterEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
}); |
30 changes: 30 additions & 0 deletions
30
apps/web-desmos/src/components/msg/posts/accept_post_owner_transfer_request/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import Typography from '@mui/material/Typography'; | ||
import AppTrans from '@/components/AppTrans'; | ||
import { FC } from 'react'; | ||
import Name from '@/components/name'; | ||
import MsgAcceptPostOwnerTransferRequest from '@/models/msg/posts/msg_accept_post_owner_transfer_request'; | ||
import { useProfileRecoil } from '@/recoil/profiles/hooks'; | ||
|
||
const AcceptPostOwnerTransferRequest: FC<{ message: MsgAcceptPostOwnerTransferRequest }> = (props) => { | ||
const { message } = props; | ||
|
||
const receiver = useProfileRecoil(message.receiver); | ||
|
||
const receiverMoniker = receiver ? receiver?.name : message.receiver; | ||
|
||
return ( | ||
<Typography> | ||
<AppTrans | ||
i18nKey="message_contents:txMsgAcceptPostOwnerTransferRequest" | ||
components={[<Name address={message.receiver} name={receiverMoniker} />, <b />]} | ||
values={{ | ||
receiver: receiverMoniker, | ||
post_id: message.post_id, | ||
subspace_id: message.subspace_id, | ||
}} | ||
/> | ||
</Typography> | ||
); | ||
}; | ||
|
||
export default AcceptPostOwnerTransferRequest; |
30 changes: 30 additions & 0 deletions
30
...components/msg/posts/cancel_post_owner_transfer_request/__snapshots__/index.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`screen: TransactionDetails/CancelPostOwnerTransferRequest matches snapshot 1`] = ` | ||
.emotion-0 { | ||
margin: 0; | ||
font-size: 1rem; | ||
white-space: pre-wrap; | ||
letter-spacing: 0.5px; | ||
font-family: "Roboto","Helvetica","Arial",sans-serif; | ||
font-weight: 400; | ||
line-height: 1.5; | ||
} | ||
<p | ||
className="MuiTypography-root MuiTypography-body1 emotion-0" | ||
> | ||
<span | ||
data-testid="Trans" | ||
i18nKey="message_contents:txMsgCancelPostOwnerTransferRequest" | ||
> | ||
<div | ||
address="sender" | ||
id="Name" | ||
name="sender" | ||
/> | ||
<b /> | ||
{"sender":"sender","post_id":"1","subspace_id":"subspace-id-1"} | ||
</span> | ||
</p> | ||
`; |
38 changes: 38 additions & 0 deletions
38
apps/web-desmos/src/components/msg/posts/cancel_post_owner_transfer_request/index.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import renderer from 'react-test-renderer'; | ||
import CancelPostOwnerTransferRequest from '@/components/msg/posts/cancel_post_owner_transfer_request'; | ||
import MsgCancelPostOwnerTransferRequest from '@/models/msg/posts/msg_cancel_post_owner_transfer_request'; | ||
import MockTheme from '@/tests/mocks/MockTheme'; | ||
|
||
// ================================== | ||
// mocks | ||
// ================================== | ||
jest.mock('@/components/name', () => (props: JSX.IntrinsicElements['div']) => ( | ||
<div id="Name" {...props} /> | ||
)); | ||
|
||
// ================================== | ||
// unit tests | ||
// ================================== | ||
describe('screen: TransactionDetails/CancelPostOwnerTransferRequest', () => { | ||
it('matches snapshot', () => { | ||
const message: MsgCancelPostOwnerTransferRequest = { | ||
category: 'posts', | ||
type: 'MsgCancelPostOwnerTransferRequest', | ||
sender: 'sender', | ||
post_id: '1', | ||
subspace_id: 'subspace-id-1', | ||
json: {}, | ||
}; | ||
const component = renderer.create( | ||
<MockTheme> | ||
<CancelPostOwnerTransferRequest message={message} /> | ||
</MockTheme> | ||
); | ||
const tree = component?.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
afterEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
}); |
30 changes: 30 additions & 0 deletions
30
apps/web-desmos/src/components/msg/posts/cancel_post_owner_transfer_request/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import Typography from '@mui/material/Typography'; | ||
import AppTrans from '@/components/AppTrans'; | ||
import { FC } from 'react'; | ||
import Name from '@/components/name'; | ||
import MsgCancelPostOwnerTransferRequest from '@/models/msg/posts/msg_cancel_post_owner_transfer_request'; | ||
import { useProfileRecoil } from '@/recoil/profiles/hooks'; | ||
|
||
const CancelPostOwnerTransferRequest: FC<{ message: MsgCancelPostOwnerTransferRequest }> = (props) => { | ||
const { message } = props; | ||
|
||
const sender = useProfileRecoil(message.sender); | ||
|
||
const senderMoniker = sender ? sender?.name : message.sender; | ||
|
||
return ( | ||
<Typography> | ||
<AppTrans | ||
i18nKey="message_contents:txMsgCancelPostOwnerTransferRequest" | ||
components={[<Name address={message.sender} name={senderMoniker} />, <b />]} | ||
values={{ | ||
sender: senderMoniker, | ||
post_id: message.post_id, | ||
subspace_id: message.subspace_id, | ||
}} | ||
/> | ||
</Typography> | ||
); | ||
}; | ||
|
||
export default CancelPostOwnerTransferRequest; |
30 changes: 30 additions & 0 deletions
30
apps/web-desmos/src/components/msg/posts/move_post/__snapshots__/index.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`screen: TransactionDetails/MovePost matches snapshot 1`] = ` | ||
.emotion-0 { | ||
margin: 0; | ||
font-size: 1rem; | ||
white-space: pre-wrap; | ||
letter-spacing: 0.5px; | ||
font-family: "Roboto","Helvetica","Arial",sans-serif; | ||
font-weight: 400; | ||
line-height: 1.5; | ||
} | ||
<p | ||
className="MuiTypography-root MuiTypography-body1 emotion-0" | ||
> | ||
<span | ||
data-testid="Trans" | ||
i18nKey="message_contents:txMsgMovePost" | ||
> | ||
<div | ||
address="owner" | ||
id="Name" | ||
name="owner" | ||
/> | ||
<b /> | ||
{"owner":"owner","post_id":"1","subspace_id":"subspace-id-1","target_subspace_id":"subspace-id-2"} | ||
</span> | ||
</p> | ||
`; |
39 changes: 39 additions & 0 deletions
39
apps/web-desmos/src/components/msg/posts/move_post/index.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import renderer from 'react-test-renderer'; | ||
import MovePost from '@/components/msg/posts/move_post'; | ||
import MsgMovePost from '@/models/msg/posts/msg_move_post'; | ||
import MockTheme from '@/tests/mocks/MockTheme'; | ||
|
||
// ================================== | ||
// mocks | ||
// ================================== | ||
jest.mock('@/components/name', () => (props: JSX.IntrinsicElements['div']) => ( | ||
<div id="Name" {...props} /> | ||
)); | ||
|
||
// ================================== | ||
// unit tests | ||
// ================================== | ||
describe('screen: TransactionDetails/MovePost', () => { | ||
it('matches snapshot', () => { | ||
const message: MsgMovePost = { | ||
category: 'posts', | ||
type: 'MsgMovePost', | ||
owner: 'owner', | ||
post_id: '1', | ||
subspace_id:'subspace-id-1', | ||
target_subspace_id: 'subspace-id-2', | ||
json: {}, | ||
}; | ||
const component = renderer.create( | ||
<MockTheme> | ||
<MovePost message={message} /> | ||
</MockTheme> | ||
); | ||
const tree = component?.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
afterEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
}); |
31 changes: 31 additions & 0 deletions
31
apps/web-desmos/src/components/msg/posts/move_post/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import Typography from '@mui/material/Typography'; | ||
import AppTrans from '@/components/AppTrans'; | ||
import { FC } from 'react'; | ||
import Name from '@/components/name'; | ||
import MsgMovePost from '@/models/msg/posts/msg_move_post'; | ||
import { useProfileRecoil } from '@/recoil/profiles/hooks'; | ||
|
||
const MovePost: FC<{ message: MsgMovePost }> = (props) => { | ||
const { message } = props; | ||
|
||
const owner = useProfileRecoil(message.owner); | ||
|
||
const authorMoniker = owner ? owner?.name : message.owner; | ||
|
||
return ( | ||
<Typography> | ||
<AppTrans | ||
i18nKey="message_contents:txMsgMovePost" | ||
components={[<Name address={message.owner} name={authorMoniker} />, <b />]} | ||
values={{ | ||
owner: authorMoniker, | ||
post_id: message.post_id, | ||
subspace_id: message.subspace_id, | ||
target_subspace_id: message.target_subspace_id, | ||
}} | ||
/> | ||
</Typography> | ||
); | ||
}; | ||
|
||
export default MovePost; |
30 changes: 30 additions & 0 deletions
30
...components/msg/posts/refuse_post_owner_transfer_request/__snapshots__/index.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`screen: TransactionDetails/RefusePostOwnerTransferRequest matches snapshot 1`] = ` | ||
.emotion-0 { | ||
margin: 0; | ||
font-size: 1rem; | ||
white-space: pre-wrap; | ||
letter-spacing: 0.5px; | ||
font-family: "Roboto","Helvetica","Arial",sans-serif; | ||
font-weight: 400; | ||
line-height: 1.5; | ||
} | ||
<p | ||
className="MuiTypography-root MuiTypography-body1 emotion-0" | ||
> | ||
<span | ||
data-testid="Trans" | ||
i18nKey="message_contents:txMsgRefusePostOwnerTransferRequest" | ||
> | ||
<div | ||
address="receiver" | ||
id="Name" | ||
name="receiver" | ||
/> | ||
<b /> | ||
{"receiver":"receiver","post_id":"1","subspace_id":"subspace-id-1"} | ||
</span> | ||
</p> | ||
`; |
Oops, something went wrong.