From ba7875b87d77e1f7bc4067856808860920b90282 Mon Sep 17 00:00:00 2001
From: SpaghettiOverload
Date: Mon, 23 Jan 2023 18:00:17 +0200
Subject: [PATCH 1/5] CUDOS-2076 missing Msgs - Addressbook
---
public/locales/en/message_contents.json | 5 ++-
public/locales/en/message_labels.json | 5 ++-
src/components/addressbook_details/index.tsx | 43 ++++++++++++++++++
src/components/addressbook_details/styles.ts | 5 +++
src/components/index.ts | 2 +
.../__snapshots__/index.test.tsx.snap | 9 ++++
.../addressbook/create_address/index.test.tsx | 45 +++++++++++++++++++
.../msg/addressbook/create_address/index.tsx | 42 +++++++++++++++++
.../__snapshots__/index.test.tsx.snap | 9 ++++
.../addressbook/delete_address/index.test.tsx | 45 +++++++++++++++++++
.../msg/addressbook/delete_address/index.tsx | 42 +++++++++++++++++
.../__snapshots__/index.test.tsx.snap | 9 ++++
.../addressbook/update_address/index.test.tsx | 45 +++++++++++++++++++
.../msg/addressbook/update_address/index.tsx | 42 +++++++++++++++++
src/components/msg/index.ts | 6 +++
src/components/msg/utils.tsx | 23 +++++++++-
src/components/tag/styles.tsx | 8 ++++
src/models/index.ts | 6 +++
.../msg/addressbook/msg_create_address.ts | 35 +++++++++++++++
.../msg/addressbook/msg_delete_address.ts | 33 ++++++++++++++
.../msg/addressbook/msg_update_address.ts | 35 +++++++++++++++
src/models/msg/types.ts | 2 +-
.../components/messages/styles.ts | 1 -
src/styles/createPalette.d.ts | 2 +
src/styles/theme/index.ts | 12 ++---
25 files changed, 501 insertions(+), 10 deletions(-)
create mode 100644 src/components/addressbook_details/index.tsx
create mode 100644 src/components/addressbook_details/styles.ts
create mode 100644 src/components/msg/addressbook/create_address/__snapshots__/index.test.tsx.snap
create mode 100644 src/components/msg/addressbook/create_address/index.test.tsx
create mode 100644 src/components/msg/addressbook/create_address/index.tsx
create mode 100644 src/components/msg/addressbook/delete_address/__snapshots__/index.test.tsx.snap
create mode 100644 src/components/msg/addressbook/delete_address/index.test.tsx
create mode 100644 src/components/msg/addressbook/delete_address/index.tsx
create mode 100644 src/components/msg/addressbook/update_address/__snapshots__/index.test.tsx.snap
create mode 100644 src/components/msg/addressbook/update_address/index.test.tsx
create mode 100644 src/components/msg/addressbook/update_address/index.tsx
create mode 100644 src/models/msg/addressbook/msg_create_address.ts
create mode 100644 src/models/msg/addressbook/msg_delete_address.ts
create mode 100644 src/models/msg/addressbook/msg_update_address.ts
diff --git a/public/locales/en/message_contents.json b/public/locales/en/message_contents.json
index e560817a9f..beb8ba9714 100644
--- a/public/locales/en/message_contents.json
+++ b/public/locales/en/message_contents.json
@@ -62,5 +62,8 @@
"txMigrateContract": "<0>{{admin}}0> migrated contract <1>{{contract}}1> to <1>{{newCodeId}}1>",
"txUpdateContractAdmin": "<0>{{admin}}0> updated contract <1>{{contract}}1> admin to <2>{{newAdmin}}2>",
"txClearContractAdmin": "<0>{{admin}}0> cleared admin on contract <1>{{contract}}1>",
- "MsgSendToCosmosClaim": "<0>{{ethSender}}0> sent <1>{{amount}}1> to <2>{{receiver}}2>"
+ "MsgSendToCosmosClaim": "<0>{{ethSender}}0> sent <1>{{amount}}1> to <2>{{receiver}}2>",
+ "txCreateAddress": "<0>{{creator}}0> created an addressbook record with the following details - <1>1>",
+ "txUpdateAddress": "<0>{{creator}}0> updated an addressbook record. New details - <1>1>",
+ "txDeleteAddress": "<0>{{creator}}0> deleted the following addressbook record - <1>1>"
}
diff --git a/public/locales/en/message_labels.json b/public/locales/en/message_labels.json
index 3aabfccb9e..94acda2300 100644
--- a/public/locales/en/message_labels.json
+++ b/public/locales/en/message_labels.json
@@ -63,5 +63,8 @@
"txMigrateContract": "Migrate Contract",
"txUpdateContractAdmin": "Update Contract Admin",
"txClearContractAdmin": "Clear Contract Admin",
- "MsgSendToCosmosClaim": "Gravity Bridge - Ethereum to Cosmos"
+ "MsgSendToCosmosClaim": "Gravity Bridge - Ethereum to Cosmos",
+ "txCreateAddress": "New Address Book Record",
+ "txUpdateAddress": "Updating Address Book Record",
+ "txDeleteAddress": "Deleting Address Book Record"
}
diff --git a/src/components/addressbook_details/index.tsx b/src/components/addressbook_details/index.tsx
new file mode 100644
index 0000000000..2db96255b2
--- /dev/null
+++ b/src/components/addressbook_details/index.tsx
@@ -0,0 +1,43 @@
+import React from 'react';
+import {
+ Typography,
+ Box,
+} from '@material-ui/core';
+import { addressBookDetails } from './styles';
+
+interface AddressBookDetailsValue {
+ network: string;
+ label: string;
+ value: string;
+}
+
+const StyledTypography = ({
+ text,
+ content,
+}: {
+ text: string,
+ content: string
+}) => {
+ return (
+
+
+ {text}
+
+
+ {content}
+
+
+ );
+};
+
+const AddressBookDetails = ({ content }: { content: AddressBookDetailsValue }) => {
+ return (
+ <>
+ {content.network ? : null}
+ {content.label ? : null}
+ {content.value ? : null}
+ >
+ );
+};
+
+export default AddressBookDetails;
diff --git a/src/components/addressbook_details/styles.ts b/src/components/addressbook_details/styles.ts
new file mode 100644
index 0000000000..75846cc193
--- /dev/null
+++ b/src/components/addressbook_details/styles.ts
@@ -0,0 +1,5 @@
+export const addressBookDetails = {
+ gap: '10px',
+ width: '100%',
+ display: 'flex',
+};
diff --git a/src/components/index.ts b/src/components/index.ts
index 9f8a8ff1ef..94cf1f4477 100644
--- a/src/components/index.ts
+++ b/src/components/index.ts
@@ -33,6 +33,7 @@ import AvatarNameListMsg from './avatar_name_list_msg';
import {
ContractOverview, ContractMessages, ContractMessagesList, SingleContractMessageMobile,
} from './cosmwasm';
+import AddressBookDetails from './addressbook_details';
export {
Layout,
@@ -71,4 +72,5 @@ export {
ContractMessages,
ContractMessagesList,
SingleContractMessageMobile,
+ AddressBookDetails,
};
diff --git a/src/components/msg/addressbook/create_address/__snapshots__/index.test.tsx.snap b/src/components/msg/addressbook/create_address/__snapshots__/index.test.tsx.snap
new file mode 100644
index 0000000000..8b8e0baa8f
--- /dev/null
+++ b/src/components/msg/addressbook/create_address/__snapshots__/index.test.tsx.snap
@@ -0,0 +1,9 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`screen: TransactionDetails/MsgCreateAddress matches snapshot 1`] = `
+
+ message_contents:txCreateAddress
+
+`;
diff --git a/src/components/msg/addressbook/create_address/index.test.tsx b/src/components/msg/addressbook/create_address/index.test.tsx
new file mode 100644
index 0000000000..53396d6256
--- /dev/null
+++ b/src/components/msg/addressbook/create_address/index.test.tsx
@@ -0,0 +1,45 @@
+import React from 'react';
+import { RecoilRoot } from 'recoil';
+import renderer from 'react-test-renderer';
+import { MockTheme } from '@tests/utils';
+import { MsgCreateAddress } from '@models';
+import CreateAddress from '.';
+
+// ==================================
+// mocks
+// ==================================
+
+jest.mock('@components', () => ({
+ Name: (props) => ,
+}));
+
+// ==================================
+// unit tests
+// ==================================
+describe('screen: TransactionDetails/MsgCreateAddress', () => {
+ it('matches snapshot', () => {
+ const message = new MsgCreateAddress({
+ category: 'addressbook',
+ type: 'MsgCreateAddress',
+ creator: 'creatorAddress',
+ network: 'testNetwork',
+ label: 'testLabel',
+ value: 'testValue',
+ });
+ const component = renderer.create(
+
+
+
+
+ ,
+ );
+ const tree = component.toJSON();
+ expect(tree).toMatchSnapshot();
+ });
+
+ afterEach(() => {
+ jest.clearAllMocks();
+ });
+});
diff --git a/src/components/msg/addressbook/create_address/index.tsx b/src/components/msg/addressbook/create_address/index.tsx
new file mode 100644
index 0000000000..42514e8261
--- /dev/null
+++ b/src/components/msg/addressbook/create_address/index.tsx
@@ -0,0 +1,42 @@
+import React from 'react';
+import Trans from 'next-translate/Trans';
+import { Typography } from '@material-ui/core';
+import {
+ Name,
+ AddressBookDetails,
+} from '@components';
+import { MsgCreateAddress } from '@models';
+
+const CreateAddress = (props: {
+ message: MsgCreateAddress;
+}) => {
+ const { message } = props;
+ const { creator } = message;
+
+ return (
+
+
+ ),
+ (
+
+ ),
+ ]}
+ />
+
+ );
+};
+
+export default CreateAddress;
diff --git a/src/components/msg/addressbook/delete_address/__snapshots__/index.test.tsx.snap b/src/components/msg/addressbook/delete_address/__snapshots__/index.test.tsx.snap
new file mode 100644
index 0000000000..e1daae7767
--- /dev/null
+++ b/src/components/msg/addressbook/delete_address/__snapshots__/index.test.tsx.snap
@@ -0,0 +1,9 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`screen: TransactionDetails/MsgDeleteAddress matches snapshot 1`] = `
+
+ message_contents:txDeleteAddress
+
+`;
diff --git a/src/components/msg/addressbook/delete_address/index.test.tsx b/src/components/msg/addressbook/delete_address/index.test.tsx
new file mode 100644
index 0000000000..929f37277a
--- /dev/null
+++ b/src/components/msg/addressbook/delete_address/index.test.tsx
@@ -0,0 +1,45 @@
+import React from 'react';
+import { RecoilRoot } from 'recoil';
+import renderer from 'react-test-renderer';
+import { MockTheme } from '@tests/utils';
+import { MsgDeleteAddress } from '@models';
+import CreateAddress from '.';
+
+// ==================================
+// mocks
+// ==================================
+
+jest.mock('@components', () => ({
+ Name: (props) => ,
+}));
+
+// ==================================
+// unit tests
+// ==================================
+describe('screen: TransactionDetails/MsgDeleteAddress', () => {
+ it('matches snapshot', () => {
+ const message = new MsgDeleteAddress({
+ category: 'addressbook',
+ type: 'MsgDeleteAddress',
+ creator: 'creatorAddress',
+ network: 'testNetwork',
+ label: 'testLabel',
+ value: 'testValue',
+ });
+ const component = renderer.create(
+
+
+
+
+ ,
+ );
+ const tree = component.toJSON();
+ expect(tree).toMatchSnapshot();
+ });
+
+ afterEach(() => {
+ jest.clearAllMocks();
+ });
+});
diff --git a/src/components/msg/addressbook/delete_address/index.tsx b/src/components/msg/addressbook/delete_address/index.tsx
new file mode 100644
index 0000000000..c193189a7a
--- /dev/null
+++ b/src/components/msg/addressbook/delete_address/index.tsx
@@ -0,0 +1,42 @@
+import React from 'react';
+import Trans from 'next-translate/Trans';
+import { Typography } from '@material-ui/core';
+import {
+ Name,
+ AddressBookDetails,
+} from '@components';
+import { MsgDeleteAddress } from '@models';
+
+const DeleteAddress = (props: {
+ message: MsgDeleteAddress;
+}) => {
+ const { message } = props;
+ const { creator } = message;
+
+ return (
+
+
+ ),
+ (
+
+ ),
+ ]}
+ />
+
+ );
+};
+
+export default DeleteAddress;
diff --git a/src/components/msg/addressbook/update_address/__snapshots__/index.test.tsx.snap b/src/components/msg/addressbook/update_address/__snapshots__/index.test.tsx.snap
new file mode 100644
index 0000000000..05d11518cc
--- /dev/null
+++ b/src/components/msg/addressbook/update_address/__snapshots__/index.test.tsx.snap
@@ -0,0 +1,9 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`screen: TransactionDetails/MsgUpdateAddress matches snapshot 1`] = `
+
+ message_contents:txUpdateAddress
+
+`;
diff --git a/src/components/msg/addressbook/update_address/index.test.tsx b/src/components/msg/addressbook/update_address/index.test.tsx
new file mode 100644
index 0000000000..b12a4f1a7f
--- /dev/null
+++ b/src/components/msg/addressbook/update_address/index.test.tsx
@@ -0,0 +1,45 @@
+import React from 'react';
+import { RecoilRoot } from 'recoil';
+import renderer from 'react-test-renderer';
+import { MockTheme } from '@tests/utils';
+import { MsgUpdateAddress } from '@models';
+import CreateAddress from '.';
+
+// ==================================
+// mocks
+// ==================================
+
+jest.mock('@components', () => ({
+ Name: (props) => ,
+}));
+
+// ==================================
+// unit tests
+// ==================================
+describe('screen: TransactionDetails/MsgUpdateAddress', () => {
+ it('matches snapshot', () => {
+ const message = new MsgUpdateAddress({
+ category: 'addressbook',
+ type: 'MsgUpdateAddress',
+ creator: 'creatorAddress',
+ network: 'testNetwork',
+ label: 'testLabel',
+ value: 'testValue',
+ });
+ const component = renderer.create(
+
+
+
+
+ ,
+ );
+ const tree = component.toJSON();
+ expect(tree).toMatchSnapshot();
+ });
+
+ afterEach(() => {
+ jest.clearAllMocks();
+ });
+});
diff --git a/src/components/msg/addressbook/update_address/index.tsx b/src/components/msg/addressbook/update_address/index.tsx
new file mode 100644
index 0000000000..97eda83578
--- /dev/null
+++ b/src/components/msg/addressbook/update_address/index.tsx
@@ -0,0 +1,42 @@
+import React from 'react';
+import Trans from 'next-translate/Trans';
+import { Typography } from '@material-ui/core';
+import {
+ Name,
+ AddressBookDetails,
+} from '@components';
+import { MsgUpdateAddress } from '@models';
+
+const UpdateAddress = (props: {
+ message: MsgUpdateAddress;
+}) => {
+ const { message } = props;
+ const { creator } = message;
+
+ return (
+
+
+ ),
+ (
+
+ ),
+ ]}
+ />
+
+ );
+};
+
+export default UpdateAddress;
diff --git a/src/components/msg/index.ts b/src/components/msg/index.ts
index d4c6083eee..221ba62fa4 100644
--- a/src/components/msg/index.ts
+++ b/src/components/msg/index.ts
@@ -79,6 +79,9 @@ import MigrateContract from './cosmwasm/migrate_contract';
import UpdateContractAdmin from './cosmwasm/update_contract_admin';
import ClearContractAdmin from './cosmwasm/clear_contract_admin';
import SendToCosmos from './gravity/send_to_cosmos';
+import CreateAddress from './addressbook/create_address';
+import UpdateAddress from './addressbook/update_address';
+import DeleteAddress from './addressbook/delete_address';
export {
getMessageModelByType,
@@ -153,4 +156,7 @@ export {
UpdateContractAdmin,
ClearContractAdmin,
SendToCosmos,
+ CreateAddress,
+ UpdateAddress,
+ DeleteAddress,
};
diff --git a/src/components/msg/utils.tsx b/src/components/msg/utils.tsx
index e65cd20b7a..bd690b2a12 100644
--- a/src/components/msg/utils.tsx
+++ b/src/components/msg/utils.tsx
@@ -456,6 +456,27 @@ const getDataByType = (type: string) => {
tagTheme: 'four',
tagDisplay: 'MsgSendToCosmosClaim',
},
+ // ========================
+ // Addressbook
+ // ========================
+ '/cudoventures.cudosnode.addressbook.MsgCreateAddress': {
+ model: MODELS.MsgCreateAddress,
+ content: COMPONENTS.CreateAddress,
+ tagTheme: 'twentyOne',
+ tagDisplay: 'txCreateAddress',
+ },
+ '/cudoventures.cudosnode.addressbook.MsgUpdateAddress': {
+ model: MODELS.MsgUpdateAddress,
+ content: COMPONENTS.UpdateAddress,
+ tagTheme: 'twentyOne',
+ tagDisplay: 'txUpdateAddress',
+ },
+ '/cudoventures.cudosnode.addressbook.MsgDeleteAddress': {
+ model: MODELS.MsgDeleteAddress,
+ content: COMPONENTS.DeleteAddress,
+ tagTheme: 'twentyOne',
+ tagDisplay: 'txDeleteAddress',
+ },
};
if (defaultTypeToModel[type]) return defaultTypeToModel[type];
@@ -480,7 +501,7 @@ export const getMessageModelByType = (type: string) => {
* Helper function to correctly display the correct UI
* @param type Model type
*/
-export const getMessageByType = (message: any, viewRaw: boolean, t:any) => {
+export const getMessageByType = (message: any, viewRaw: boolean, t: any) => {
const { type } = message;
let results: {
content: any;
diff --git a/src/components/tag/styles.tsx b/src/components/tag/styles.tsx
index 210abe621c..71619d3718 100644
--- a/src/components/tag/styles.tsx
+++ b/src/components/tag/styles.tsx
@@ -102,6 +102,14 @@ export const useStyles = () => {
color: theme.palette.custom.tags.twenty,
background: Color(theme.palette.custom.tags.twenty).alpha(0.2).string(),
},
+ twentyOne: {
+ color: theme.palette.custom.tags.twentyOne,
+ background: Color(theme.palette.custom.tags.twentyOne).alpha(0.2).string(),
+ },
+ twentyTwo: {
+ color: theme.palette.custom.tags.twentyTwo,
+ background: Color(theme.palette.custom.tags.twentyTwo).alpha(0.2).string(),
+ },
});
},
)();
diff --git a/src/models/index.ts b/src/models/index.ts
index a847a7a2de..f7000516ef 100644
--- a/src/models/index.ts
+++ b/src/models/index.ts
@@ -76,6 +76,9 @@ import MsgMigrateContract from './msg/cosmwasm/msg_migrate_contract';
import MsgUpdateContractAdmin from './msg/cosmwasm/msg_update_contract_admin';
import MsgClearContractAdmin from './msg/cosmwasm/msg_clear_contract_admin';
import MsgSendToCosmosClaim from './msg/gravity/msg_send_to_cosmos_claim';
+import MsgCreateAddress from './msg/addressbook/msg_create_address';
+import MsgUpdateAddress from './msg/addressbook/msg_update_address';
+import MsgDeleteAddress from './msg/addressbook/msg_delete_address';
export {
BigDipperNetwork,
@@ -156,4 +159,7 @@ export {
MsgUpdateContractAdmin,
MsgClearContractAdmin,
MsgSendToCosmosClaim,
+ MsgCreateAddress,
+ MsgUpdateAddress,
+ MsgDeleteAddress,
};
diff --git a/src/models/msg/addressbook/msg_create_address.ts b/src/models/msg/addressbook/msg_create_address.ts
new file mode 100644
index 0000000000..1d25305880
--- /dev/null
+++ b/src/models/msg/addressbook/msg_create_address.ts
@@ -0,0 +1,35 @@
+import { Categories } from '../types';
+
+class MsgCreateAddress {
+ public category: Categories;
+ public type: string;
+ public json: any;
+ public creator: string;
+ public network: string;
+ public label: string;
+ public value: string;
+
+
+ constructor(payload: any) {
+ this.category = 'addressbook';
+ this.type = payload.type;
+ this.json = payload.json;
+ this.creator = payload.creator;
+ this.network = payload.network;
+ this.label = payload.label;
+ this.value = payload.value;
+ }
+
+ static fromJson(json: any) {
+ return new MsgCreateAddress({
+ json,
+ type: json['@type'],
+ label: json.label,
+ creator: json.creator,
+ network: json.network,
+ value: json.value
+ });
+ }
+}
+
+export default MsgCreateAddress;
diff --git a/src/models/msg/addressbook/msg_delete_address.ts b/src/models/msg/addressbook/msg_delete_address.ts
new file mode 100644
index 0000000000..fa3330b2fb
--- /dev/null
+++ b/src/models/msg/addressbook/msg_delete_address.ts
@@ -0,0 +1,33 @@
+import { Categories } from '../types';
+
+class MsgDeleteAddress {
+ public category: Categories;
+ public type: string;
+ public json: any;
+ public creator: string;
+ public network: string;
+ public label: string;
+ public value: string;
+
+
+ constructor(payload: any) {
+ this.category = 'addressbook';
+ this.type = payload.type;
+ this.json = payload.json;
+ this.creator = payload.creator;
+ this.network = payload.network;
+ this.label = payload.label;
+ }
+
+ static fromJson(json: any) {
+ return new MsgDeleteAddress({
+ json,
+ type: json['@type'],
+ label: json.label,
+ creator: json.creator,
+ network: json.network,
+ });
+ }
+}
+
+export default MsgDeleteAddress;
diff --git a/src/models/msg/addressbook/msg_update_address.ts b/src/models/msg/addressbook/msg_update_address.ts
new file mode 100644
index 0000000000..295995850a
--- /dev/null
+++ b/src/models/msg/addressbook/msg_update_address.ts
@@ -0,0 +1,35 @@
+import { Categories } from '../types';
+
+class MsgUpdateAddress {
+ public category: Categories;
+ public type: string;
+ public json: any;
+ public creator: string;
+ public network: string;
+ public label: string;
+ public value: string;
+
+
+ constructor(payload: any) {
+ this.category = 'addressbook';
+ this.type = payload.type;
+ this.json = payload.json;
+ this.creator = payload.creator;
+ this.network = payload.network;
+ this.label = payload.label;
+ this.value = payload.value;
+ }
+
+ static fromJson(json: any) {
+ return new MsgUpdateAddress({
+ json,
+ type: json['@type'],
+ label: json.label,
+ creator: json.creator,
+ network: json.network,
+ value: json.value
+ });
+ }
+}
+
+export default MsgUpdateAddress;
diff --git a/src/models/msg/types.ts b/src/models/msg/types.ts
index 9b6ef03819..b676f5fdb9 100644
--- a/src/models/msg/types.ts
+++ b/src/models/msg/types.ts
@@ -1,3 +1,3 @@
export type BaseCategories = 'bank' | 'crisis' | 'distribution' | 'governance' | 'slashing' | 'staking' | 'profiles' | 'ibc' | 'ibc-transfer' | 'authz' | 'feegrant' | 'vesting' | 'others'
-export type CustomCategories = 'cosmwasm' | 'gravity'; // custom modules
+export type CustomCategories = 'cosmwasm' | 'gravity' | 'addressbook'; // custom modules
export type Categories = BaseCategories | CustomCategories
diff --git a/src/screens/transaction_details/components/messages/styles.ts b/src/screens/transaction_details/components/messages/styles.ts
index 7b399d2b08..898ac1daa9 100644
--- a/src/screens/transaction_details/components/messages/styles.ts
+++ b/src/screens/transaction_details/components/messages/styles.ts
@@ -68,7 +68,6 @@ export const useStyles = () => {
tags: {
marginBottom: theme.spacing(2),
[theme.breakpoints.up('lg')]: {
- minWidth: '200px',
marginBottom: 0,
paddingRight: theme.spacing(2),
alignSelf: 'flex-start',
diff --git a/src/styles/createPalette.d.ts b/src/styles/createPalette.d.ts
index 29012412be..9dd29e6729 100644
--- a/src/styles/createPalette.d.ts
+++ b/src/styles/createPalette.d.ts
@@ -45,6 +45,8 @@ declare module '@material-ui/core/styles/createPalette' {
eighteen: string,
nineteen: string,
twenty: string,
+ twentyOne: string,
+ twentyTwo: string,
},
charts: {
zero: string;
diff --git a/src/styles/theme/index.ts b/src/styles/theme/index.ts
index e65bd1d780..5ae9b3c312 100644
--- a/src/styles/theme/index.ts
+++ b/src/styles/theme/index.ts
@@ -127,6 +127,8 @@ export const common = {
eighteen: '#F0A479',
nineteen: '#D37763',
twenty: '#D9C788',
+ twentyOne: '#FF720C',
+ twentyTwo: '#BA0086'
},
fonts: {
fontFive: '#FFFFFF',
@@ -190,11 +192,11 @@ export const common = {
},
};
-export const lightTemplate:ThemeOptions = R.mergeDeepLeft(lightThemeOverride, common);
-export const darkTemplate:ThemeOptions = R.mergeDeepLeft(darkThemeOverride, common);
-export const deuteranopiaTemplate:ThemeOptions = R.mergeDeepLeft(deuteranopiaThemeOverride, common);
-export const tritanopiaTemplate:ThemeOptions = R.mergeDeepLeft(tritanopiaThemeOverride, common);
-export const cudosTemplate:ThemeOptions = R.mergeDeepLeft(cudosThemeOverride, common);
+export const lightTemplate: ThemeOptions = R.mergeDeepLeft(lightThemeOverride, common);
+export const darkTemplate: ThemeOptions = R.mergeDeepLeft(darkThemeOverride, common);
+export const deuteranopiaTemplate: ThemeOptions = R.mergeDeepLeft(deuteranopiaThemeOverride, common);
+export const tritanopiaTemplate: ThemeOptions = R.mergeDeepLeft(tritanopiaThemeOverride, common);
+export const cudosTemplate: ThemeOptions = R.mergeDeepLeft(cudosThemeOverride, common);
// export const lightTheme = createMuiTheme(lightTemplate);
// export const darkTheme = createMuiTheme(darkTemplate);
From 935dafd716877cfa7ef8ea76dbb27d39f7faf329 Mon Sep 17 00:00:00 2001
From: SpaghettiOverload
Date: Mon, 23 Jan 2023 18:21:46 +0200
Subject: [PATCH 2/5] fix lint errors
---
.../msg/addressbook/msg_create_address.ts | 31 +++++++++----------
.../msg/addressbook/msg_delete_address.ts | 27 ++++++++--------
.../msg/addressbook/msg_update_address.ts | 31 +++++++++----------
src/styles/theme/index.ts | 2 +-
4 files changed, 44 insertions(+), 47 deletions(-)
diff --git a/src/models/msg/addressbook/msg_create_address.ts b/src/models/msg/addressbook/msg_create_address.ts
index 1d25305880..5517fbb77c 100644
--- a/src/models/msg/addressbook/msg_create_address.ts
+++ b/src/models/msg/addressbook/msg_create_address.ts
@@ -9,26 +9,25 @@ class MsgCreateAddress {
public label: string;
public value: string;
-
constructor(payload: any) {
- this.category = 'addressbook';
- this.type = payload.type;
- this.json = payload.json;
- this.creator = payload.creator;
- this.network = payload.network;
- this.label = payload.label;
- this.value = payload.value;
+ this.category = 'addressbook';
+ this.type = payload.type;
+ this.json = payload.json;
+ this.creator = payload.creator;
+ this.network = payload.network;
+ this.label = payload.label;
+ this.value = payload.value;
}
static fromJson(json: any) {
- return new MsgCreateAddress({
- json,
- type: json['@type'],
- label: json.label,
- creator: json.creator,
- network: json.network,
- value: json.value
- });
+ return new MsgCreateAddress({
+ json,
+ type: json['@type'],
+ label: json.label,
+ creator: json.creator,
+ network: json.network,
+ value: json.value,
+ });
}
}
diff --git a/src/models/msg/addressbook/msg_delete_address.ts b/src/models/msg/addressbook/msg_delete_address.ts
index fa3330b2fb..24a19ece42 100644
--- a/src/models/msg/addressbook/msg_delete_address.ts
+++ b/src/models/msg/addressbook/msg_delete_address.ts
@@ -9,24 +9,23 @@ class MsgDeleteAddress {
public label: string;
public value: string;
-
constructor(payload: any) {
- this.category = 'addressbook';
- this.type = payload.type;
- this.json = payload.json;
- this.creator = payload.creator;
- this.network = payload.network;
- this.label = payload.label;
+ this.category = 'addressbook';
+ this.type = payload.type;
+ this.json = payload.json;
+ this.creator = payload.creator;
+ this.network = payload.network;
+ this.label = payload.label;
}
static fromJson(json: any) {
- return new MsgDeleteAddress({
- json,
- type: json['@type'],
- label: json.label,
- creator: json.creator,
- network: json.network,
- });
+ return new MsgDeleteAddress({
+ json,
+ type: json['@type'],
+ label: json.label,
+ creator: json.creator,
+ network: json.network,
+ });
}
}
diff --git a/src/models/msg/addressbook/msg_update_address.ts b/src/models/msg/addressbook/msg_update_address.ts
index 295995850a..70b25ff644 100644
--- a/src/models/msg/addressbook/msg_update_address.ts
+++ b/src/models/msg/addressbook/msg_update_address.ts
@@ -9,26 +9,25 @@ class MsgUpdateAddress {
public label: string;
public value: string;
-
constructor(payload: any) {
- this.category = 'addressbook';
- this.type = payload.type;
- this.json = payload.json;
- this.creator = payload.creator;
- this.network = payload.network;
- this.label = payload.label;
- this.value = payload.value;
+ this.category = 'addressbook';
+ this.type = payload.type;
+ this.json = payload.json;
+ this.creator = payload.creator;
+ this.network = payload.network;
+ this.label = payload.label;
+ this.value = payload.value;
}
static fromJson(json: any) {
- return new MsgUpdateAddress({
- json,
- type: json['@type'],
- label: json.label,
- creator: json.creator,
- network: json.network,
- value: json.value
- });
+ return new MsgUpdateAddress({
+ json,
+ type: json['@type'],
+ label: json.label,
+ creator: json.creator,
+ network: json.network,
+ value: json.value,
+ });
}
}
diff --git a/src/styles/theme/index.ts b/src/styles/theme/index.ts
index 5ae9b3c312..09cf3d195c 100644
--- a/src/styles/theme/index.ts
+++ b/src/styles/theme/index.ts
@@ -128,7 +128,7 @@ export const common = {
nineteen: '#D37763',
twenty: '#D9C788',
twentyOne: '#FF720C',
- twentyTwo: '#BA0086'
+ twentyTwo: '#BA0086',
},
fonts: {
fontFive: '#FFFFFF',
From f76bd30ab7beb30f9e1bab4b5aa5e4b038a476de Mon Sep 17 00:00:00 2001
From: SpaghettiOverload
Date: Wed, 25 Jan 2023 12:43:36 +0200
Subject: [PATCH 3/5] CUDOS-2076 missing Msgs - Marketplace
---
public/locales/en/message_contents.json | 14 +++-
public/locales/en/message_labels.json | 16 +++-
src/components/addressbook_details/index.tsx | 38 ++-------
src/components/index.ts | 4 +
src/components/msg/index.ts | 24 ++++++
.../__snapshots__/index.test.tsx.snap | 24 ++++++
.../msg/marketplace/add_admin/index.test.tsx | 44 ++++++++++
.../msg/marketplace/add_admin/index.tsx | 40 +++++++++
.../buy_nft/__snapshots__/index.test.tsx.snap | 30 +++++++
.../msg/marketplace/buy_nft/index.test.tsx | 48 +++++++++++
.../msg/marketplace/buy_nft/index.tsx | 39 +++++++++
.../__snapshots__/index.test.tsx.snap | 47 +++++++++++
.../create_collection/index.test.tsx | 52 ++++++++++++
.../marketplace/create_collection/index.tsx | 48 +++++++++++
.../__snapshots__/index.test.tsx.snap | 41 ++++++++++
.../msg/marketplace/mint_nft/index.test.tsx | 53 ++++++++++++
.../msg/marketplace/mint_nft/index.tsx | 46 +++++++++++
.../__snapshots__/index.test.tsx.snap | 47 +++++++++++
.../publish_collection/index.test.tsx | 52 ++++++++++++
.../marketplace/publish_collection/index.tsx | 48 +++++++++++
.../__snapshots__/index.test.tsx.snap | 27 ++++++
.../marketplace/publish_nft/index.test.tsx | 48 +++++++++++
.../msg/marketplace/publish_nft/index.tsx | 37 +++++++++
.../__snapshots__/index.test.tsx.snap | 24 ++++++
.../marketplace/remove_admin/index.test.tsx | 44 ++++++++++
.../msg/marketplace/remove_admin/index.tsx | 40 +++++++++
.../__snapshots__/index.test.tsx.snap | 25 ++++++
.../msg/marketplace/remove_nft/index.test.tsx | 45 ++++++++++
.../msg/marketplace/remove_nft/index.tsx | 32 ++++++++
.../__snapshots__/index.test.tsx.snap | 29 +++++++
.../unverify_collection/index.test.tsx | 45 ++++++++++
.../marketplace/unverify_collection/index.tsx | 43 ++++++++++
.../__snapshots__/index.test.tsx.snap | 26 ++++++
.../marketplace/update_price/index.test.tsx | 47 +++++++++++
.../msg/marketplace/update_price/index.tsx | 33 ++++++++
.../__snapshots__/index.test.tsx.snap | 47 +++++++++++
.../update_royalties/index.test.tsx | 52 ++++++++++++
.../marketplace/update_royalties/index.tsx | 48 +++++++++++
.../__snapshots__/index.test.tsx.snap | 29 +++++++
.../verify_collection/index.test.tsx | 45 ++++++++++
.../marketplace/verify_collection/index.tsx | 43 ++++++++++
src/components/msg/utils.tsx | 82 ++++++++++++++++++-
src/components/nft_details/index.tsx | 21 +++++
src/components/royalties_details/index.tsx | 32 ++++++++
.../styled_typography_pair/index.tsx | 26 ++++++
.../styled_typography_pair/styles.ts | 10 +++
src/models/index.ts | 24 ++++++
src/models/msg/marketplace/msg_add_admin.ts | 28 +++++++
src/models/msg/marketplace/msg_buy_nft.ts | 54 ++++++++++++
.../msg/marketplace/msg_create_collection.ts | 35 ++++++++
src/models/msg/marketplace/msg_mint_nft.ts | 41 ++++++++++
.../msg/marketplace/msg_publish_collection.ts | 35 ++++++++
src/models/msg/marketplace/msg_publish_nft.ts | 35 ++++++++
.../msg/marketplace/msg_remove_admin.ts | 28 +++++++
src/models/msg/marketplace/msg_remove_nft.ts | 28 +++++++
.../marketplace/msg_unverify_collection.ts | 38 +++++++++
.../msg/marketplace/msg_update_price.ts | 32 ++++++++
.../msg/marketplace/msg_update_royalties.ts | 35 ++++++++
.../msg/marketplace/msg_verify_collection.ts | 38 +++++++++
src/models/msg/types.ts | 19 ++++-
60 files changed, 2166 insertions(+), 39 deletions(-)
create mode 100644 src/components/msg/marketplace/add_admin/__snapshots__/index.test.tsx.snap
create mode 100644 src/components/msg/marketplace/add_admin/index.test.tsx
create mode 100644 src/components/msg/marketplace/add_admin/index.tsx
create mode 100644 src/components/msg/marketplace/buy_nft/__snapshots__/index.test.tsx.snap
create mode 100644 src/components/msg/marketplace/buy_nft/index.test.tsx
create mode 100644 src/components/msg/marketplace/buy_nft/index.tsx
create mode 100644 src/components/msg/marketplace/create_collection/__snapshots__/index.test.tsx.snap
create mode 100644 src/components/msg/marketplace/create_collection/index.test.tsx
create mode 100644 src/components/msg/marketplace/create_collection/index.tsx
create mode 100644 src/components/msg/marketplace/mint_nft/__snapshots__/index.test.tsx.snap
create mode 100644 src/components/msg/marketplace/mint_nft/index.test.tsx
create mode 100644 src/components/msg/marketplace/mint_nft/index.tsx
create mode 100644 src/components/msg/marketplace/publish_collection/__snapshots__/index.test.tsx.snap
create mode 100644 src/components/msg/marketplace/publish_collection/index.test.tsx
create mode 100644 src/components/msg/marketplace/publish_collection/index.tsx
create mode 100644 src/components/msg/marketplace/publish_nft/__snapshots__/index.test.tsx.snap
create mode 100644 src/components/msg/marketplace/publish_nft/index.test.tsx
create mode 100644 src/components/msg/marketplace/publish_nft/index.tsx
create mode 100644 src/components/msg/marketplace/remove_admin/__snapshots__/index.test.tsx.snap
create mode 100644 src/components/msg/marketplace/remove_admin/index.test.tsx
create mode 100644 src/components/msg/marketplace/remove_admin/index.tsx
create mode 100644 src/components/msg/marketplace/remove_nft/__snapshots__/index.test.tsx.snap
create mode 100644 src/components/msg/marketplace/remove_nft/index.test.tsx
create mode 100644 src/components/msg/marketplace/remove_nft/index.tsx
create mode 100644 src/components/msg/marketplace/unverify_collection/__snapshots__/index.test.tsx.snap
create mode 100644 src/components/msg/marketplace/unverify_collection/index.test.tsx
create mode 100644 src/components/msg/marketplace/unverify_collection/index.tsx
create mode 100644 src/components/msg/marketplace/update_price/__snapshots__/index.test.tsx.snap
create mode 100644 src/components/msg/marketplace/update_price/index.test.tsx
create mode 100644 src/components/msg/marketplace/update_price/index.tsx
create mode 100644 src/components/msg/marketplace/update_royalties/__snapshots__/index.test.tsx.snap
create mode 100644 src/components/msg/marketplace/update_royalties/index.test.tsx
create mode 100644 src/components/msg/marketplace/update_royalties/index.tsx
create mode 100644 src/components/msg/marketplace/verify_collection/__snapshots__/index.test.tsx.snap
create mode 100644 src/components/msg/marketplace/verify_collection/index.test.tsx
create mode 100644 src/components/msg/marketplace/verify_collection/index.tsx
create mode 100644 src/components/nft_details/index.tsx
create mode 100644 src/components/royalties_details/index.tsx
create mode 100644 src/components/styled_typography_pair/index.tsx
create mode 100644 src/components/styled_typography_pair/styles.ts
create mode 100644 src/models/msg/marketplace/msg_add_admin.ts
create mode 100644 src/models/msg/marketplace/msg_buy_nft.ts
create mode 100644 src/models/msg/marketplace/msg_create_collection.ts
create mode 100644 src/models/msg/marketplace/msg_mint_nft.ts
create mode 100644 src/models/msg/marketplace/msg_publish_collection.ts
create mode 100644 src/models/msg/marketplace/msg_publish_nft.ts
create mode 100644 src/models/msg/marketplace/msg_remove_admin.ts
create mode 100644 src/models/msg/marketplace/msg_remove_nft.ts
create mode 100644 src/models/msg/marketplace/msg_unverify_collection.ts
create mode 100644 src/models/msg/marketplace/msg_update_price.ts
create mode 100644 src/models/msg/marketplace/msg_update_royalties.ts
create mode 100644 src/models/msg/marketplace/msg_verify_collection.ts
diff --git a/public/locales/en/message_contents.json b/public/locales/en/message_contents.json
index beb8ba9714..9f2aaa2a84 100644
--- a/public/locales/en/message_contents.json
+++ b/public/locales/en/message_contents.json
@@ -65,5 +65,17 @@
"MsgSendToCosmosClaim": "<0>{{ethSender}}0> sent <1>{{amount}}1> to <2>{{receiver}}2>",
"txCreateAddress": "<0>{{creator}}0> created an addressbook record with the following details - <1>1>",
"txUpdateAddress": "<0>{{creator}}0> updated an addressbook record. New details - <1>1>",
- "txDeleteAddress": "<0>{{creator}}0> deleted the following addressbook record - <1>1>"
+ "txDeleteAddress": "<0>{{creator}}0> deleted the following addressbook record - <1>1>",
+ "txCreateCollection": "<0>{{creator}}0> created '<3>{{collectionId}}3>' collection. <1>1><2>2>",
+ "txPublishCollection": "<0>{{creator}}0> published '<3>{{collectionId}}3>' collection. <1>1><2>2>",
+ "txUpdateRoyalties": "<0>{{creator}}0> updated royalties for collection with ID: '<3>{{collectionId}}3>' <1>1><2>2>",
+ "txVerifyCollection": "Marketplace admin: <1>{{admin}}1> verified collection with ID: <2>{{collectionId}}2> created by: <0>{{creator}}0>",
+ "txUnverifyCollection": "Marketplace admin: <1>{{admin}}1> unverified collection with ID: <2>{{collectionId}}2> created by: <0>{{creator}}0>",
+ "txAddAdmin": "<0>{{creator}}0> added <1>{{address}}1> as marketplace admin",
+ "txRemoveAdmin": "<0>{{creator}}0> removed <1>{{address}}1> from marketplace admins",
+ "txMintNft": "<0>{{creator}}0> minted an NFT to <1>{{recipient}}1> <2>2>",
+ "txPublishNft": "<0>{{creator}}0> published for sale NFT with ID: <3>{{tokenId}}3> from collection ID: <2>{{denomId}}2> for <1>{{price}}1>",
+ "txRemoveNft": "<0>{{creator}}0> removed from sale NFT with ID: <1>{{id}}1>",
+ "txUpdatePrice": "<0>{{creator}}0> updated the price of NFT with ID: <2>{{id}}2>. New price: <1>{{price}}1>",
+ "txBuyNft": "<0>{{buyer}}0> purchased NFT with ID: <3>{{id}}3> from <1>{{seller}}1> for <2>{{price}}2>"
}
diff --git a/public/locales/en/message_labels.json b/public/locales/en/message_labels.json
index 94acda2300..671f44b8bc 100644
--- a/public/locales/en/message_labels.json
+++ b/public/locales/en/message_labels.json
@@ -65,6 +65,18 @@
"txClearContractAdmin": "Clear Contract Admin",
"MsgSendToCosmosClaim": "Gravity Bridge - Ethereum to Cosmos",
"txCreateAddress": "New Address Book Record",
- "txUpdateAddress": "Updating Address Book Record",
- "txDeleteAddress": "Deleting Address Book Record"
+ "txUpdateAddress": "Update Address Book Record",
+ "txDeleteAddress": "Delete Address Book Record",
+ "txCreateCollection": "Create NFT Collection",
+ "txPublishCollection": "Publish NFT Collection",
+ "txUpdateRoyalties": "Update NFT Collection Royalties",
+ "txVerifyCollection": "Verify NFT Collection",
+ "txUnverifyCollection": "Unverify NFT Collection",
+ "txAddAdmin": "Add Marketplace Admin",
+ "txRemoveAdmin": "Remove Marketplace Admin",
+ "txMintNft": "Mint NFT",
+ "txPublishNft": "Publish NFT for sale",
+ "txRemoveNft": "Remove NFT from sale",
+ "txUpdatePrice": "Update NFT price",
+ "txBuyNft": "Buy NFT"
}
diff --git a/src/components/addressbook_details/index.tsx b/src/components/addressbook_details/index.tsx
index 2db96255b2..198907d0a2 100644
--- a/src/components/addressbook_details/index.tsx
+++ b/src/components/addressbook_details/index.tsx
@@ -1,41 +1,13 @@
import React from 'react';
-import {
- Typography,
- Box,
-} from '@material-ui/core';
-import { addressBookDetails } from './styles';
-
-interface AddressBookDetailsValue {
- network: string;
- label: string;
- value: string;
-}
-
-const StyledTypography = ({
- text,
- content,
-}: {
- text: string,
- content: string
-}) => {
- return (
-
-
- {text}
-
-
- {content}
-
-
- );
-};
+import { AddressBookDetailsValue } from '@src/models/msg/types';
+import StyledTypographyPair from '../styled_typography_pair';
const AddressBookDetails = ({ content }: { content: AddressBookDetailsValue }) => {
return (
<>
- {content.network ? : null}
- {content.label ? : null}
- {content.value ? : null}
+ {content.network ? : null}
+ {content.label ? : null}
+ {content.value ? : null}
>
);
};
diff --git a/src/components/index.ts b/src/components/index.ts
index 94cf1f4477..e48fa64ee5 100644
--- a/src/components/index.ts
+++ b/src/components/index.ts
@@ -34,6 +34,8 @@ import {
ContractOverview, ContractMessages, ContractMessagesList, SingleContractMessageMobile,
} from './cosmwasm';
import AddressBookDetails from './addressbook_details';
+import RoyaltiesDetails from './royalties_details';
+import NftDetails from './nft_details';
export {
Layout,
@@ -73,4 +75,6 @@ export {
ContractMessagesList,
SingleContractMessageMobile,
AddressBookDetails,
+ RoyaltiesDetails,
+ NftDetails,
};
diff --git a/src/components/msg/index.ts b/src/components/msg/index.ts
index 221ba62fa4..ce443b0dce 100644
--- a/src/components/msg/index.ts
+++ b/src/components/msg/index.ts
@@ -82,6 +82,18 @@ import SendToCosmos from './gravity/send_to_cosmos';
import CreateAddress from './addressbook/create_address';
import UpdateAddress from './addressbook/update_address';
import DeleteAddress from './addressbook/delete_address';
+import CreateCollection from './marketplace/create_collection';
+import PublishCollection from './marketplace/publish_collection';
+import VerifyCollection from './marketplace/verify_collection';
+import UnverifyCollection from './marketplace/unverify_collection';
+import AddAdmin from './marketplace/add_admin';
+import MintNft from './marketplace/mint_nft';
+import PublishNft from './marketplace/publish_nft';
+import RemoveNft from './marketplace/remove_nft';
+import UpdatePrice from './marketplace/update_price';
+import UpdateRoyalties from './marketplace/update_royalties';
+import BuyNft from './marketplace/buy_nft';
+import RemoveAdmin from './marketplace/remove_admin';
export {
getMessageModelByType,
@@ -159,4 +171,16 @@ export {
CreateAddress,
UpdateAddress,
DeleteAddress,
+ CreateCollection,
+ PublishCollection,
+ VerifyCollection,
+ UnverifyCollection,
+ AddAdmin,
+ MintNft,
+ PublishNft,
+ RemoveNft,
+ UpdatePrice,
+ UpdateRoyalties,
+ BuyNft,
+ RemoveAdmin,
};
diff --git a/src/components/msg/marketplace/add_admin/__snapshots__/index.test.tsx.snap b/src/components/msg/marketplace/add_admin/__snapshots__/index.test.tsx.snap
new file mode 100644
index 0000000000..750d13680f
--- /dev/null
+++ b/src/components/msg/marketplace/add_admin/__snapshots__/index.test.tsx.snap
@@ -0,0 +1,24 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`screen: TransactionDetails/MsgAddAdmin matches snapshot 1`] = `
+
+
,
+ ,
+ ]
+ }
+ i18nKey="message_contents:txAddAdmin"
+ id="message_contents:txAddAdmin"
+ />
+
+`;
diff --git a/src/components/msg/marketplace/add_admin/index.test.tsx b/src/components/msg/marketplace/add_admin/index.test.tsx
new file mode 100644
index 0000000000..443baaf25f
--- /dev/null
+++ b/src/components/msg/marketplace/add_admin/index.test.tsx
@@ -0,0 +1,44 @@
+import React from 'react';
+import { RecoilRoot } from 'recoil';
+import renderer from 'react-test-renderer';
+import { MockTheme } from '@tests/utils';
+import { MsgAddAdmin } from '@models';
+import AddAdmin from '.';
+
+jest.mock('@components', () => ({
+ Name: (props) => ,
+}));
+
+jest.mock('next-translate/Trans', () => (
+ (props) =>
+));
+
+// ==================================
+// unit tests
+// ==================================
+describe('screen: TransactionDetails/MsgAddAdmin', () => {
+ it('matches snapshot', () => {
+ const message = new MsgAddAdmin({
+ category: 'marketplace',
+ type: 'MsgAddAdmin',
+ creator: 'creator',
+ address: 'address',
+ });
+ const component = renderer.create(
+
+
+
+
+ ,
+ );
+ const tree = component.toJSON();
+ expect(tree).toMatchSnapshot();
+ expect(component.root.findByProps({ id: 'message_contents:txAddAdmin' }).props.i18nKey).toEqual('message_contents:txAddAdmin');
+ });
+
+ afterEach(() => {
+ jest.clearAllMocks();
+ });
+});
diff --git a/src/components/msg/marketplace/add_admin/index.tsx b/src/components/msg/marketplace/add_admin/index.tsx
new file mode 100644
index 0000000000..a7c0f59bc6
--- /dev/null
+++ b/src/components/msg/marketplace/add_admin/index.tsx
@@ -0,0 +1,40 @@
+import React from 'react';
+import Trans from 'next-translate/Trans';
+import { Typography } from '@material-ui/core';
+import {
+ Name,
+} from '@components';
+import { MsgAddAdmin } from '@models';
+
+const AddAdmin = (props: {
+ message: MsgAddAdmin;
+}) => {
+ const { message } = props;
+ const {
+ creator, address,
+ } = message;
+
+ return (
+
+
+ ),
+ (
+
+ ),
+ ]}
+ />
+
+ );
+};
+
+export default AddAdmin;
diff --git a/src/components/msg/marketplace/buy_nft/__snapshots__/index.test.tsx.snap b/src/components/msg/marketplace/buy_nft/__snapshots__/index.test.tsx.snap
new file mode 100644
index 0000000000..7fbddddc08
--- /dev/null
+++ b/src/components/msg/marketplace/buy_nft/__snapshots__/index.test.tsx.snap
@@ -0,0 +1,30 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`screen: TransactionDetails/MsgBuyNft matches snapshot 1`] = `
+
+
,
+ ,
+ ]
+ }
+ i18nKey="message_contents:txBuyNft"
+ id="message_contents:txBuyNft"
+ values={
+ Object {
+ "id": undefined,
+ "price": "1 acudos",
+ }
+ }
+ />
+
+`;
diff --git a/src/components/msg/marketplace/buy_nft/index.test.tsx b/src/components/msg/marketplace/buy_nft/index.test.tsx
new file mode 100644
index 0000000000..a8a6aaa5dd
--- /dev/null
+++ b/src/components/msg/marketplace/buy_nft/index.test.tsx
@@ -0,0 +1,48 @@
+import React from 'react';
+import { RecoilRoot } from 'recoil';
+import renderer from 'react-test-renderer';
+import { MockTheme } from '@tests/utils';
+import { MsgBuyNft } from '@models';
+import { formatToken } from '@src/utils/format_token';
+import BuyNft from '.';
+
+jest.mock('@components', () => ({
+ Name: (props) => ,
+}));
+
+jest.mock('next-translate/Trans', () => (
+ (props) =>
+));
+
+// ==================================
+// unit tests
+// ==================================
+describe('screen: TransactionDetails/MsgBuyNft', () => {
+ it('matches snapshot', () => {
+ const message = new MsgBuyNft({
+ category: 'marketplace',
+ type: 'MsgBuyNft',
+ seller: 'seller',
+ buyer: 'buyer',
+ id: 'id',
+ price: formatToken('1', 'acudos'),
+ });
+
+ const component = renderer.create(
+
+
+
+
+ ,
+ );
+ const tree = component.toJSON();
+ expect(tree).toMatchSnapshot();
+ expect(component.root.findByProps({ id: 'message_contents:txBuyNft' }).props.i18nKey).toEqual('message_contents:txBuyNft');
+ });
+
+ afterEach(() => {
+ jest.clearAllMocks();
+ });
+});
diff --git a/src/components/msg/marketplace/buy_nft/index.tsx b/src/components/msg/marketplace/buy_nft/index.tsx
new file mode 100644
index 0000000000..187e3274d5
--- /dev/null
+++ b/src/components/msg/marketplace/buy_nft/index.tsx
@@ -0,0 +1,39 @@
+import React from 'react';
+import Trans from 'next-translate/Trans';
+import { Typography } from '@material-ui/core';
+import { Name } from '@components';
+import { MsgBuyNft } from '@models';
+
+const BuyNft = (props: {
+ message: MsgBuyNft;
+}) => {
+ const { message } = props;
+
+ return (
+
+
+ ),
+ (
+
+ ),
+ ]}
+ values={{
+ price: `${message.price.value} ${message.price.displayDenom}`,
+ id: message.id,
+ }}
+ />
+
+ );
+};
+
+export default BuyNft;
diff --git a/src/components/msg/marketplace/create_collection/__snapshots__/index.test.tsx.snap b/src/components/msg/marketplace/create_collection/__snapshots__/index.test.tsx.snap
new file mode 100644
index 0000000000..4cd76e8bea
--- /dev/null
+++ b/src/components/msg/marketplace/create_collection/__snapshots__/index.test.tsx.snap
@@ -0,0 +1,47 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`screen: TransactionDetails/MsgCreateCollection matches snapshot 1`] = `
+
+
,
+ ,
+ ,
+ ]
+ }
+ i18nKey="message_contents:txCreateCollection"
+ id="message_contents:txCreateCollection"
+ values={
+ Object {
+ "collectionId": "collectionId",
+ }
+ }
+ />
+
+`;
diff --git a/src/components/msg/marketplace/create_collection/index.test.tsx b/src/components/msg/marketplace/create_collection/index.test.tsx
new file mode 100644
index 0000000000..655619eb51
--- /dev/null
+++ b/src/components/msg/marketplace/create_collection/index.test.tsx
@@ -0,0 +1,52 @@
+import React from 'react';
+import { RecoilRoot } from 'recoil';
+import renderer from 'react-test-renderer';
+import { MockTheme } from '@tests/utils';
+import { MsgCreateCollection } from '@models';
+import CreateCollection from '.';
+
+jest.mock('@components', () => ({
+ Name: (props) => ,
+}));
+
+jest.mock('next-translate/Trans', () => (
+ (props) =>
+));
+
+// ==================================
+// unit tests
+// ==================================
+describe('screen: TransactionDetails/MsgCreateCollection', () => {
+ it('matches snapshot', () => {
+ const message = new MsgCreateCollection({
+ category: 'marketplace',
+ type: 'MsgCreateCollection',
+ creator: 'Creator',
+ collectionId: 'collectionId',
+ mintRoyalties: [{
+ address: 'address',
+ percent: 'percent',
+ }],
+ resaleRoyalties: [{
+ address: 'address',
+ percent: 'percent',
+ }],
+ });
+ const component = renderer.create(
+
+
+
+
+ ,
+ );
+ const tree = component.toJSON();
+ expect(tree).toMatchSnapshot();
+ expect(component.root.findByProps({ id: 'message_contents:txCreateCollection' }).props.i18nKey).toEqual('message_contents:txCreateCollection');
+ });
+
+ afterEach(() => {
+ jest.clearAllMocks();
+ });
+});
diff --git a/src/components/msg/marketplace/create_collection/index.tsx b/src/components/msg/marketplace/create_collection/index.tsx
new file mode 100644
index 0000000000..1cefdb18fb
--- /dev/null
+++ b/src/components/msg/marketplace/create_collection/index.tsx
@@ -0,0 +1,48 @@
+import React from 'react';
+import Trans from 'next-translate/Trans';
+import { Typography } from '@material-ui/core';
+import {
+ Name,
+ RoyaltiesDetails,
+} from '@components';
+import { MsgCreateCollection } from '@models';
+
+const CreateCollection = (props: {
+ message: MsgCreateCollection;
+}) => {
+ const { message } = props;
+ const { creator } = message;
+
+ return (
+
+
+ ),
+ (
+
+ ),
+ (
+
+ ),
+ ]}
+ values={{
+ collectionId: message.collectionId,
+ }}
+ />
+
+ );
+};
+
+export default CreateCollection;
diff --git a/src/components/msg/marketplace/mint_nft/__snapshots__/index.test.tsx.snap b/src/components/msg/marketplace/mint_nft/__snapshots__/index.test.tsx.snap
new file mode 100644
index 0000000000..158e542757
--- /dev/null
+++ b/src/components/msg/marketplace/mint_nft/__snapshots__/index.test.tsx.snap
@@ -0,0 +1,41 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`screen: TransactionDetails/MsgMintNft matches snapshot 1`] = `
+
+
,
+ ,
+ ,
+ ]
+ }
+ i18nKey="message_contents:txMintNft"
+ id="message_contents:txMintNft"
+ />
+
+`;
diff --git a/src/components/msg/marketplace/mint_nft/index.test.tsx b/src/components/msg/marketplace/mint_nft/index.test.tsx
new file mode 100644
index 0000000000..1020871087
--- /dev/null
+++ b/src/components/msg/marketplace/mint_nft/index.test.tsx
@@ -0,0 +1,53 @@
+import React from 'react';
+import { RecoilRoot } from 'recoil';
+import renderer from 'react-test-renderer';
+import { MockTheme } from '@tests/utils';
+import { MsgMintNft } from '@models';
+import { formatToken } from '@src/utils/format_token';
+import MintNft from '.';
+
+jest.mock('@components', () => ({
+ Name: (props) => ,
+}));
+
+jest.mock('next-translate/Trans', () => (
+ (props) =>
+));
+
+// ==================================
+// unit tests
+// ==================================
+describe('screen: TransactionDetails/MsgMintNft', () => {
+ it('matches snapshot', () => {
+ const message = new MsgMintNft({
+ category: 'marketplace',
+ type: 'MsgMintNft',
+ creator: 'creator',
+ recipient: 'recipient',
+ mintedNftData: {
+ denomId: 'denomId',
+ uid: 'uid',
+ uri: 'uri',
+ data: 'data',
+ name: 'name',
+ price: formatToken('1', 'acudos'),
+ },
+ });
+ const component = renderer.create(
+
+
+
+
+ ,
+ );
+ const tree = component.toJSON();
+ expect(tree).toMatchSnapshot();
+ expect(component.root.findByProps({ id: 'message_contents:txMintNft' }).props.i18nKey).toEqual('message_contents:txMintNft');
+ });
+
+ afterEach(() => {
+ jest.clearAllMocks();
+ });
+});
diff --git a/src/components/msg/marketplace/mint_nft/index.tsx b/src/components/msg/marketplace/mint_nft/index.tsx
new file mode 100644
index 0000000000..866aab7593
--- /dev/null
+++ b/src/components/msg/marketplace/mint_nft/index.tsx
@@ -0,0 +1,46 @@
+import React from 'react';
+import Trans from 'next-translate/Trans';
+import { Typography } from '@material-ui/core';
+import {
+ Name,
+ NftDetails,
+} from '@components';
+import { MsgMintNft } from '@models';
+
+const MintNft = (props: {
+ message: MsgMintNft;
+}) => {
+ const { message } = props;
+ const {
+ creator, recipient, mintedNftData,
+ } = message;
+
+ return (
+
+
+ ),
+ (
+
+ ),
+ (
+
+ ),
+ ]}
+ />
+
+ );
+};
+
+export default MintNft;
diff --git a/src/components/msg/marketplace/publish_collection/__snapshots__/index.test.tsx.snap b/src/components/msg/marketplace/publish_collection/__snapshots__/index.test.tsx.snap
new file mode 100644
index 0000000000..d55d930a8e
--- /dev/null
+++ b/src/components/msg/marketplace/publish_collection/__snapshots__/index.test.tsx.snap
@@ -0,0 +1,47 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`screen: TransactionDetails/MsgPublishCollection matches snapshot 1`] = `
+
+
,
+ ,
+ ,
+ ]
+ }
+ i18nKey="message_contents:txPublishCollection"
+ id="message_contents:txPublishCollection"
+ values={
+ Object {
+ "collectionId": "collectionId",
+ }
+ }
+ />
+
+`;
diff --git a/src/components/msg/marketplace/publish_collection/index.test.tsx b/src/components/msg/marketplace/publish_collection/index.test.tsx
new file mode 100644
index 0000000000..d3a8fd1813
--- /dev/null
+++ b/src/components/msg/marketplace/publish_collection/index.test.tsx
@@ -0,0 +1,52 @@
+import React from 'react';
+import { RecoilRoot } from 'recoil';
+import renderer from 'react-test-renderer';
+import { MockTheme } from '@tests/utils';
+import { MsgPublishCollection } from '@models';
+import PublishCollection from '.';
+
+jest.mock('@components', () => ({
+ Name: (props) => ,
+}));
+
+jest.mock('next-translate/Trans', () => (
+ (props) =>
+));
+
+// ==================================
+// unit tests
+// ==================================
+describe('screen: TransactionDetails/MsgPublishCollection', () => {
+ it('matches snapshot', () => {
+ const message = new MsgPublishCollection({
+ category: 'marketplace',
+ type: 'MsgPublishCollection',
+ creator: 'Creator',
+ collectionId: 'collectionId',
+ mintRoyalties: [{
+ address: 'address',
+ percent: 'percent',
+ }],
+ resaleRoyalties: [{
+ address: 'address',
+ percent: 'percent',
+ }],
+ });
+ const component = renderer.create(
+
+
+
+
+ ,
+ );
+ const tree = component.toJSON();
+ expect(tree).toMatchSnapshot();
+ expect(component.root.findByProps({ id: 'message_contents:txPublishCollection' }).props.i18nKey).toEqual('message_contents:txPublishCollection');
+ });
+
+ afterEach(() => {
+ jest.clearAllMocks();
+ });
+});
diff --git a/src/components/msg/marketplace/publish_collection/index.tsx b/src/components/msg/marketplace/publish_collection/index.tsx
new file mode 100644
index 0000000000..0288abcb57
--- /dev/null
+++ b/src/components/msg/marketplace/publish_collection/index.tsx
@@ -0,0 +1,48 @@
+import React from 'react';
+import Trans from 'next-translate/Trans';
+import { Typography } from '@material-ui/core';
+import {
+ Name,
+ RoyaltiesDetails,
+} from '@components';
+import { MsgPublishCollection } from '@models';
+
+const PublishCollection = (props: {
+ message: MsgPublishCollection;
+}) => {
+ const { message } = props;
+ const { creator } = message;
+
+ return (
+
+
+ ),
+ (
+
+ ),
+ (
+
+ ),
+ ]}
+ values={{
+ collectionId: message.collectionId,
+ }}
+ />
+
+ );
+};
+
+export default PublishCollection;
diff --git a/src/components/msg/marketplace/publish_nft/__snapshots__/index.test.tsx.snap b/src/components/msg/marketplace/publish_nft/__snapshots__/index.test.tsx.snap
new file mode 100644
index 0000000000..a0c352c529
--- /dev/null
+++ b/src/components/msg/marketplace/publish_nft/__snapshots__/index.test.tsx.snap
@@ -0,0 +1,27 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`screen: TransactionDetails/MsgPublishNft matches snapshot 1`] = `
+
+
,
+ ]
+ }
+ i18nKey="message_contents:txPublishNft"
+ id="message_contents:txPublishNft"
+ values={
+ Object {
+ "denomId": "denomId",
+ "price": "1 acudos",
+ "tokenId": "tokenId",
+ }
+ }
+ />
+
+`;
diff --git a/src/components/msg/marketplace/publish_nft/index.test.tsx b/src/components/msg/marketplace/publish_nft/index.test.tsx
new file mode 100644
index 0000000000..ba577770ef
--- /dev/null
+++ b/src/components/msg/marketplace/publish_nft/index.test.tsx
@@ -0,0 +1,48 @@
+import React from 'react';
+import { RecoilRoot } from 'recoil';
+import renderer from 'react-test-renderer';
+import { MockTheme } from '@tests/utils';
+import { MsgPublishNft } from '@models';
+import { formatToken } from '@src/utils/format_token';
+import PublishNft from '.';
+
+jest.mock('@components', () => ({
+ Name: (props) => ,
+}));
+
+jest.mock('next-translate/Trans', () => (
+ (props) =>
+));
+
+// ==================================
+// unit tests
+// ==================================
+describe('screen: TransactionDetails/MsgPublishNft', () => {
+ it('matches snapshot', () => {
+ const message = new MsgPublishNft({
+ category: 'marketplace',
+ type: 'MsgPublishNft',
+ creator: 'creator',
+ denomId: 'denomId',
+ tokenId: 'tokenId',
+ price: formatToken('1', 'acudos'),
+ });
+
+ const component = renderer.create(
+
+
+
+
+ ,
+ );
+ const tree = component.toJSON();
+ expect(tree).toMatchSnapshot();
+ expect(component.root.findByProps({ id: 'message_contents:txPublishNft' }).props.i18nKey).toEqual('message_contents:txPublishNft');
+ });
+
+ afterEach(() => {
+ jest.clearAllMocks();
+ });
+});
diff --git a/src/components/msg/marketplace/publish_nft/index.tsx b/src/components/msg/marketplace/publish_nft/index.tsx
new file mode 100644
index 0000000000..e0b08fceae
--- /dev/null
+++ b/src/components/msg/marketplace/publish_nft/index.tsx
@@ -0,0 +1,37 @@
+import React from 'react';
+import Trans from 'next-translate/Trans';
+import { Typography } from '@material-ui/core';
+import { Name } from '@components';
+import { MsgPublishNft } from '@models';
+
+const MintNft = (props: {
+ message: MsgPublishNft;
+}) => {
+ const { message } = props;
+ const {
+ creator, price, denomId, tokenId,
+ } = message;
+
+ return (
+
+
+ ),
+ ]}
+ values={{
+ price: `${price.value} ${price.displayDenom}`,
+ denomId,
+ tokenId,
+ }}
+ />
+
+ );
+};
+
+export default MintNft;
diff --git a/src/components/msg/marketplace/remove_admin/__snapshots__/index.test.tsx.snap b/src/components/msg/marketplace/remove_admin/__snapshots__/index.test.tsx.snap
new file mode 100644
index 0000000000..252ce4c8ad
--- /dev/null
+++ b/src/components/msg/marketplace/remove_admin/__snapshots__/index.test.tsx.snap
@@ -0,0 +1,24 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`screen: TransactionDetails/MsgRemoveAdmin matches snapshot 1`] = `
+
+
,
+ ,
+ ]
+ }
+ i18nKey="message_contents:txRemoveAdmin"
+ id="message_contents:txRemoveAdmin"
+ />
+
+`;
diff --git a/src/components/msg/marketplace/remove_admin/index.test.tsx b/src/components/msg/marketplace/remove_admin/index.test.tsx
new file mode 100644
index 0000000000..80aef7c99d
--- /dev/null
+++ b/src/components/msg/marketplace/remove_admin/index.test.tsx
@@ -0,0 +1,44 @@
+import React from 'react';
+import { RecoilRoot } from 'recoil';
+import renderer from 'react-test-renderer';
+import { MockTheme } from '@tests/utils';
+import { MsgRemoveAdmin } from '@models';
+import RemoveAdmin from '.';
+
+jest.mock('@components', () => ({
+ Name: (props) => ,
+}));
+
+jest.mock('next-translate/Trans', () => (
+ (props) =>
+));
+
+// ==================================
+// unit tests
+// ==================================
+describe('screen: TransactionDetails/MsgRemoveAdmin', () => {
+ it('matches snapshot', () => {
+ const message = new MsgRemoveAdmin({
+ category: 'marketplace',
+ type: 'MsgRemoveAdmin',
+ creator: 'creator',
+ address: 'address',
+ });
+ const component = renderer.create(
+
+
+
+
+ ,
+ );
+ const tree = component.toJSON();
+ expect(tree).toMatchSnapshot();
+ expect(component.root.findByProps({ id: 'message_contents:txRemoveAdmin' }).props.i18nKey).toEqual('message_contents:txRemoveAdmin');
+ });
+
+ afterEach(() => {
+ jest.clearAllMocks();
+ });
+});
diff --git a/src/components/msg/marketplace/remove_admin/index.tsx b/src/components/msg/marketplace/remove_admin/index.tsx
new file mode 100644
index 0000000000..e8ad53cb54
--- /dev/null
+++ b/src/components/msg/marketplace/remove_admin/index.tsx
@@ -0,0 +1,40 @@
+import React from 'react';
+import Trans from 'next-translate/Trans';
+import { Typography } from '@material-ui/core';
+import {
+ Name,
+} from '@components';
+import { MsgRemoveAdmin } from '@models';
+
+const RemoveAdmin = (props: {
+ message: MsgRemoveAdmin;
+}) => {
+ const { message } = props;
+ const {
+ creator, address,
+ } = message;
+
+ return (
+
+
+ ),
+ (
+
+ ),
+ ]}
+ />
+
+ );
+};
+
+export default RemoveAdmin;
diff --git a/src/components/msg/marketplace/remove_nft/__snapshots__/index.test.tsx.snap b/src/components/msg/marketplace/remove_nft/__snapshots__/index.test.tsx.snap
new file mode 100644
index 0000000000..b291793bfd
--- /dev/null
+++ b/src/components/msg/marketplace/remove_nft/__snapshots__/index.test.tsx.snap
@@ -0,0 +1,25 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`screen: TransactionDetails/MsgRemoveNft matches snapshot 1`] = `
+
+
,
+ ]
+ }
+ i18nKey="message_contents:txRemoveNft"
+ id="message_contents:txRemoveNft"
+ values={
+ Object {
+ "id": "id",
+ }
+ }
+ />
+
+`;
diff --git a/src/components/msg/marketplace/remove_nft/index.test.tsx b/src/components/msg/marketplace/remove_nft/index.test.tsx
new file mode 100644
index 0000000000..b8fa8c87d9
--- /dev/null
+++ b/src/components/msg/marketplace/remove_nft/index.test.tsx
@@ -0,0 +1,45 @@
+import React from 'react';
+import { RecoilRoot } from 'recoil';
+import renderer from 'react-test-renderer';
+import { MockTheme } from '@tests/utils';
+import { MsgRemoveNft } from '@models';
+import RemoveNft from '.';
+
+jest.mock('@components', () => ({
+ Name: (props) => ,
+}));
+
+jest.mock('next-translate/Trans', () => (
+ (props) =>
+));
+
+// ==================================
+// unit tests
+// ==================================
+describe('screen: TransactionDetails/MsgRemoveNft', () => {
+ it('matches snapshot', () => {
+ const message = new MsgRemoveNft({
+ category: 'marketplace',
+ type: 'MsgRemoveNft',
+ creator: 'creator',
+ id: 'id',
+ });
+
+ const component = renderer.create(
+
+
+
+
+ ,
+ );
+ const tree = component.toJSON();
+ expect(tree).toMatchSnapshot();
+ expect(component.root.findByProps({ id: 'message_contents:txRemoveNft' }).props.i18nKey).toEqual('message_contents:txRemoveNft');
+ });
+
+ afterEach(() => {
+ jest.clearAllMocks();
+ });
+});
diff --git a/src/components/msg/marketplace/remove_nft/index.tsx b/src/components/msg/marketplace/remove_nft/index.tsx
new file mode 100644
index 0000000000..b238e6f981
--- /dev/null
+++ b/src/components/msg/marketplace/remove_nft/index.tsx
@@ -0,0 +1,32 @@
+import React from 'react';
+import Trans from 'next-translate/Trans';
+import { Typography } from '@material-ui/core';
+import { Name } from '@components';
+import { MsgRemoveNft } from '@models';
+
+const RemoveNft = (props: {
+ message: MsgRemoveNft;
+}) => {
+ const { message } = props;
+
+ return (
+
+
+ ),
+ ]}
+ values={{
+ id: message.id,
+ }}
+ />
+
+ );
+};
+
+export default RemoveNft;
diff --git a/src/components/msg/marketplace/unverify_collection/__snapshots__/index.test.tsx.snap b/src/components/msg/marketplace/unverify_collection/__snapshots__/index.test.tsx.snap
new file mode 100644
index 0000000000..ce887f8cc0
--- /dev/null
+++ b/src/components/msg/marketplace/unverify_collection/__snapshots__/index.test.tsx.snap
@@ -0,0 +1,29 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`screen: TransactionDetails/MsgUnverifyCollection matches snapshot 1`] = `
+
+
,
+ ,
+ ]
+ }
+ i18nKey="message_contents:txUnverifyCollection"
+ id="message_contents:txUnverifyCollection"
+ values={
+ Object {
+ "collectionId": "collectionId",
+ }
+ }
+ />
+
+`;
diff --git a/src/components/msg/marketplace/unverify_collection/index.test.tsx b/src/components/msg/marketplace/unverify_collection/index.test.tsx
new file mode 100644
index 0000000000..1a999b7be9
--- /dev/null
+++ b/src/components/msg/marketplace/unverify_collection/index.test.tsx
@@ -0,0 +1,45 @@
+import React from 'react';
+import { RecoilRoot } from 'recoil';
+import renderer from 'react-test-renderer';
+import { MockTheme } from '@tests/utils';
+import { MsgUnverifyCollection } from '@models';
+import UnverifyCollection from '.';
+
+jest.mock('@components', () => ({
+ Name: (props) => ,
+}));
+
+jest.mock('next-translate/Trans', () => (
+ (props) =>
+));
+
+// ==================================
+// unit tests
+// ==================================
+describe('screen: TransactionDetails/MsgUnverifyCollection', () => {
+ it('matches snapshot', () => {
+ const message = new MsgUnverifyCollection({
+ category: 'marketplace',
+ type: 'MsgUnverifyCollection',
+ creator: 'Creator',
+ collectionId: 'collectionId',
+ admin: 'admin',
+ });
+ const component = renderer.create(
+
+
+
+
+ ,
+ );
+ const tree = component.toJSON();
+ expect(tree).toMatchSnapshot();
+ expect(component.root.findByProps({ id: 'message_contents:txUnverifyCollection' }).props.i18nKey).toEqual('message_contents:txUnverifyCollection');
+ });
+
+ afterEach(() => {
+ jest.clearAllMocks();
+ });
+});
diff --git a/src/components/msg/marketplace/unverify_collection/index.tsx b/src/components/msg/marketplace/unverify_collection/index.tsx
new file mode 100644
index 0000000000..0713ffeb97
--- /dev/null
+++ b/src/components/msg/marketplace/unverify_collection/index.tsx
@@ -0,0 +1,43 @@
+import React from 'react';
+import Trans from 'next-translate/Trans';
+import { Typography } from '@material-ui/core';
+import {
+ Name,
+} from '@components';
+import { MsgUnverifyCollection } from '@models';
+
+const UnverifyCollection = (props: {
+ message: MsgUnverifyCollection;
+}) => {
+ const { message } = props;
+ const {
+ creator, admin,
+ } = message;
+
+ return (
+
+
+ ),
+ (
+
+ ),
+ ]}
+ values={{
+ collectionId: message.collectionId,
+ }}
+ />
+
+ );
+};
+
+export default UnverifyCollection;
diff --git a/src/components/msg/marketplace/update_price/__snapshots__/index.test.tsx.snap b/src/components/msg/marketplace/update_price/__snapshots__/index.test.tsx.snap
new file mode 100644
index 0000000000..03f3f31869
--- /dev/null
+++ b/src/components/msg/marketplace/update_price/__snapshots__/index.test.tsx.snap
@@ -0,0 +1,26 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`screen: TransactionDetails/MsgUpdatePrice matches snapshot 1`] = `
+
+
,
+ ]
+ }
+ i18nKey="message_contents:txUpdatePrice"
+ id="message_contents:txUpdatePrice"
+ values={
+ Object {
+ "id": "id",
+ "price": "1 acudos",
+ }
+ }
+ />
+
+`;
diff --git a/src/components/msg/marketplace/update_price/index.test.tsx b/src/components/msg/marketplace/update_price/index.test.tsx
new file mode 100644
index 0000000000..186cb3777c
--- /dev/null
+++ b/src/components/msg/marketplace/update_price/index.test.tsx
@@ -0,0 +1,47 @@
+import React from 'react';
+import { RecoilRoot } from 'recoil';
+import renderer from 'react-test-renderer';
+import { MockTheme } from '@tests/utils';
+import { MsgUpdatePrice } from '@models';
+import { formatToken } from '@src/utils/format_token';
+import UpdatePrice from '.';
+
+jest.mock('@components', () => ({
+ Name: (props) => ,
+}));
+
+jest.mock('next-translate/Trans', () => (
+ (props) =>
+));
+
+// ==================================
+// unit tests
+// ==================================
+describe('screen: TransactionDetails/MsgUpdatePrice', () => {
+ it('matches snapshot', () => {
+ const message = new MsgUpdatePrice({
+ category: 'marketplace',
+ type: 'MsgUpdatePrice',
+ creator: 'creator',
+ id: 'id',
+ price: formatToken('1', 'acudos'),
+ });
+
+ const component = renderer.create(
+
+
+
+
+ ,
+ );
+ const tree = component.toJSON();
+ expect(tree).toMatchSnapshot();
+ expect(component.root.findByProps({ id: 'message_contents:txUpdatePrice' }).props.i18nKey).toEqual('message_contents:txUpdatePrice');
+ });
+
+ afterEach(() => {
+ jest.clearAllMocks();
+ });
+});
diff --git a/src/components/msg/marketplace/update_price/index.tsx b/src/components/msg/marketplace/update_price/index.tsx
new file mode 100644
index 0000000000..06888c23c6
--- /dev/null
+++ b/src/components/msg/marketplace/update_price/index.tsx
@@ -0,0 +1,33 @@
+import React from 'react';
+import Trans from 'next-translate/Trans';
+import { Typography } from '@material-ui/core';
+import { Name } from '@components';
+import { MsgUpdatePrice } from '@models';
+
+const UpdatePrice = (props: {
+ message: MsgUpdatePrice;
+}) => {
+ const { message } = props;
+
+ return (
+
+
+ ),
+ ]}
+ values={{
+ price: `${message.price.value} ${message.price.displayDenom}`,
+ id: message.id,
+ }}
+ />
+
+ );
+};
+
+export default UpdatePrice;
diff --git a/src/components/msg/marketplace/update_royalties/__snapshots__/index.test.tsx.snap b/src/components/msg/marketplace/update_royalties/__snapshots__/index.test.tsx.snap
new file mode 100644
index 0000000000..f7cbedaa9e
--- /dev/null
+++ b/src/components/msg/marketplace/update_royalties/__snapshots__/index.test.tsx.snap
@@ -0,0 +1,47 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`screen: TransactionDetails/MsgPublishCollection matches snapshot 1`] = `
+
+
,
+ ,
+ ,
+ ]
+ }
+ i18nKey="message_contents:txUpdateRoyalties"
+ id="message_contents:txUpdateRoyalties"
+ values={
+ Object {
+ "collectionId": "collectionId",
+ }
+ }
+ />
+
+`;
diff --git a/src/components/msg/marketplace/update_royalties/index.test.tsx b/src/components/msg/marketplace/update_royalties/index.test.tsx
new file mode 100644
index 0000000000..0feee59c13
--- /dev/null
+++ b/src/components/msg/marketplace/update_royalties/index.test.tsx
@@ -0,0 +1,52 @@
+import React from 'react';
+import { RecoilRoot } from 'recoil';
+import renderer from 'react-test-renderer';
+import { MockTheme } from '@tests/utils';
+import { MsgUpdateRoyalties } from '@models';
+import UpdateRoyalties from '.';
+
+jest.mock('@components', () => ({
+ Name: (props) => ,
+}));
+
+jest.mock('next-translate/Trans', () => (
+ (props) =>
+));
+
+// ==================================
+// unit tests
+// ==================================
+describe('screen: TransactionDetails/MsgPublishCollection', () => {
+ it('matches snapshot', () => {
+ const message = new MsgUpdateRoyalties({
+ category: 'marketplace',
+ type: 'MsgUpdateRoyalties',
+ creator: 'Creator',
+ collectionId: 'collectionId',
+ mintRoyalties: [{
+ address: 'address',
+ percent: 'percent',
+ }],
+ resaleRoyalties: [{
+ address: 'address',
+ percent: 'percent',
+ }],
+ });
+ const component = renderer.create(
+
+
+
+
+ ,
+ );
+ const tree = component.toJSON();
+ expect(tree).toMatchSnapshot();
+ expect(component.root.findByProps({ id: 'message_contents:txUpdateRoyalties' }).props.i18nKey).toEqual('message_contents:txUpdateRoyalties');
+ });
+
+ afterEach(() => {
+ jest.clearAllMocks();
+ });
+});
diff --git a/src/components/msg/marketplace/update_royalties/index.tsx b/src/components/msg/marketplace/update_royalties/index.tsx
new file mode 100644
index 0000000000..7f6083b68e
--- /dev/null
+++ b/src/components/msg/marketplace/update_royalties/index.tsx
@@ -0,0 +1,48 @@
+import React from 'react';
+import Trans from 'next-translate/Trans';
+import { Typography } from '@material-ui/core';
+import {
+ Name,
+ RoyaltiesDetails,
+} from '@components';
+import { MsgUpdateRoyalties } from '@models';
+
+const UpdateRoyalties = (props: {
+ message: MsgUpdateRoyalties;
+}) => {
+ const { message } = props;
+ const { creator } = message;
+
+ return (
+
+
+ ),
+ (
+
+ ),
+ (
+
+ ),
+ ]}
+ values={{
+ collectionId: message.collectionId,
+ }}
+ />
+
+ );
+};
+
+export default UpdateRoyalties;
diff --git a/src/components/msg/marketplace/verify_collection/__snapshots__/index.test.tsx.snap b/src/components/msg/marketplace/verify_collection/__snapshots__/index.test.tsx.snap
new file mode 100644
index 0000000000..022e14859b
--- /dev/null
+++ b/src/components/msg/marketplace/verify_collection/__snapshots__/index.test.tsx.snap
@@ -0,0 +1,29 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`screen: TransactionDetails/MsgVerifyCollection matches snapshot 1`] = `
+
+
,
+ ,
+ ]
+ }
+ i18nKey="message_contents:txVerifyCollection"
+ id="message_contents:txVerifyCollection"
+ values={
+ Object {
+ "collectionId": "collectionId",
+ }
+ }
+ />
+
+`;
diff --git a/src/components/msg/marketplace/verify_collection/index.test.tsx b/src/components/msg/marketplace/verify_collection/index.test.tsx
new file mode 100644
index 0000000000..154ca91490
--- /dev/null
+++ b/src/components/msg/marketplace/verify_collection/index.test.tsx
@@ -0,0 +1,45 @@
+import React from 'react';
+import { RecoilRoot } from 'recoil';
+import renderer from 'react-test-renderer';
+import { MockTheme } from '@tests/utils';
+import { MsgVerifyCollection } from '@models';
+import VerifyCollection from '.';
+
+jest.mock('@components', () => ({
+ Name: (props) => ,
+}));
+
+jest.mock('next-translate/Trans', () => (
+ (props) =>
+));
+
+// ==================================
+// unit tests
+// ==================================
+describe('screen: TransactionDetails/MsgVerifyCollection', () => {
+ it('matches snapshot', () => {
+ const message = new MsgVerifyCollection({
+ category: 'marketplace',
+ type: 'MsgVerifyCollection',
+ creator: 'Creator',
+ collectionId: 'collectionId',
+ admin: 'admin',
+ });
+ const component = renderer.create(
+
+
+
+
+ ,
+ );
+ const tree = component.toJSON();
+ expect(tree).toMatchSnapshot();
+ expect(component.root.findByProps({ id: 'message_contents:txVerifyCollection' }).props.i18nKey).toEqual('message_contents:txVerifyCollection');
+ });
+
+ afterEach(() => {
+ jest.clearAllMocks();
+ });
+});
diff --git a/src/components/msg/marketplace/verify_collection/index.tsx b/src/components/msg/marketplace/verify_collection/index.tsx
new file mode 100644
index 0000000000..3c47712bf1
--- /dev/null
+++ b/src/components/msg/marketplace/verify_collection/index.tsx
@@ -0,0 +1,43 @@
+import React from 'react';
+import Trans from 'next-translate/Trans';
+import { Typography } from '@material-ui/core';
+import {
+ Name,
+} from '@components';
+import { MsgVerifyCollection } from '@models';
+
+const VerifyCollection = (props: {
+ message: MsgVerifyCollection;
+}) => {
+ const { message } = props;
+ const {
+ creator, admin,
+ } = message;
+
+ return (
+
+
+ ),
+ (
+
+ ),
+ ]}
+ values={{
+ collectionId: message.collectionId,
+ }}
+ />
+
+ );
+};
+
+export default VerifyCollection;
diff --git a/src/components/msg/utils.tsx b/src/components/msg/utils.tsx
index bd690b2a12..06df13c3b0 100644
--- a/src/components/msg/utils.tsx
+++ b/src/components/msg/utils.tsx
@@ -475,7 +475,82 @@ const getDataByType = (type: string) => {
model: MODELS.MsgDeleteAddress,
content: COMPONENTS.DeleteAddress,
tagTheme: 'twentyOne',
- tagDisplay: 'txDeleteAddress',
+ tagDisplay: 'txCreateCollection',
+ },
+ // ========================
+ // Marketplace
+ // ========================
+ '/cudoventures.cudosnode.marketplace.MsgCreateCollection': {
+ model: MODELS.MsgCreateCollection,
+ content: COMPONENTS.CreateCollection,
+ tagTheme: 'twentyTwo',
+ tagDisplay: 'txCreateCollection',
+ },
+ '/cudoventures.cudosnode.marketplace.MsgPublishCollection': {
+ model: MODELS.MsgPublishCollection,
+ content: COMPONENTS.PublishCollection,
+ tagTheme: 'twentyTwo',
+ tagDisplay: 'txPublishCollection',
+ },
+ '/cudoventures.cudosnode.marketplace.MsgVerifyCollection': {
+ model: MODELS.MsgVerifyCollection,
+ content: COMPONENTS.VerifyCollection,
+ tagTheme: 'twentyTwo',
+ tagDisplay: 'txPublishCollection',
+ },
+ '/cudoventures.cudosnode.marketplace.MsgUnverifyCollection': {
+ model: MODELS.MsgUnverifyCollection,
+ content: COMPONENTS.UnverifyCollection,
+ tagTheme: 'twentyTwo',
+ tagDisplay: 'txUnverifyCollection',
+ },
+ '/cudoventures.cudosnode.marketplace.MsgAddAdmin': {
+ model: MODELS.MsgAddAdmin,
+ content: COMPONENTS.AddAdmin,
+ tagTheme: 'twentyTwo',
+ tagDisplay: 'txAddAdmin',
+ },
+ '/cudoventures.cudosnode.marketplace.MsgMintNft': {
+ model: MODELS.MsgMintNft,
+ content: COMPONENTS.MintNft,
+ tagTheme: 'twentyTwo',
+ tagDisplay: 'txMintNft',
+ },
+ '/cudoventures.cudosnode.marketplace.MsgPublishNft': {
+ model: MODELS.MsgPublishNft,
+ content: COMPONENTS.PublishNft,
+ tagTheme: 'twentyTwo',
+ tagDisplay: 'txPublishNft',
+ },
+ '/cudoventures.cudosnode.marketplace.MsgRemoveNft': {
+ model: MODELS.MsgRemoveNft,
+ content: COMPONENTS.RemoveNft,
+ tagTheme: 'twentyTwo',
+ tagDisplay: 'txRemoveNft',
+ },
+ '/cudoventures.cudosnode.marketplace.MsgUpdatePrice': {
+ model: MODELS.MsgUpdatePrice,
+ content: COMPONENTS.UpdatePrice,
+ tagTheme: 'twentyTwo',
+ tagDisplay: 'txUpdatePrice',
+ },
+ '/cudoventures.cudosnode.marketplace.MsgUpdateRoyalties': {
+ model: MODELS.MsgUpdateRoyalties,
+ content: COMPONENTS.UpdateRoyalties,
+ tagTheme: 'twentyTwo',
+ tagDisplay: 'txUpdateRoyalties',
+ },
+ '/cudoventures.cudosnode.marketplace.MsgBuyNft': {
+ model: MODELS.MsgBuyNft,
+ content: COMPONENTS.BuyNft,
+ tagTheme: 'twentyTwo',
+ tagDisplay: 'txBuyNft',
+ },
+ '/cudoventures.cudosnode.marketplace.MsgRemoveAdmin': {
+ model: MODELS.MsgRemoveAdmin,
+ content: COMPONENTS.RemoveAdmin,
+ tagTheme: 'twentyTwo',
+ tagDisplay: 'txRemoveAdmin',
},
};
@@ -543,7 +618,10 @@ export const convertMsgsToModels = (transaction: any) => {
const model = getMessageModelByType(msg?.['@type']);
if (model === MODELS.MsgWithdrawDelegatorReward
|| model === MODELS.MsgWithdrawValidatorCommission
- || model === MODELS.MsgInstantiateContract) {
+ || model === MODELS.MsgInstantiateContract
+ || model === MODELS.MsgVerifyCollection
+ || model === MODELS.MsgUnverifyCollection
+ || model === MODELS.MsgBuyNft) {
const log = R.pathOr(null, ['logs', i], transaction);
return model.fromJson(msg, log);
}
diff --git a/src/components/nft_details/index.tsx b/src/components/nft_details/index.tsx
new file mode 100644
index 0000000000..ab28eeb80f
--- /dev/null
+++ b/src/components/nft_details/index.tsx
@@ -0,0 +1,21 @@
+import React from 'react';
+import { MintedNft } from '@src/models/msg/types';
+import { Typography } from '@material-ui/core';
+import StyledTypographyPair from '../styled_typography_pair';
+import { title } from '../styled_typography_pair/styles';
+
+const NftDetails = ({ content }: { content: MintedNft }) => {
+ return (
+ <>
+ NFT DETAILS
+ {content.denomId ? : null}
+ {content.name ? : null}
+ {content.price.value ? : null}
+ {content.uid ? : null}
+ {content.uri ? : null}
+ {content.data ? : null}
+ >
+ );
+};
+
+export default NftDetails;
diff --git a/src/components/royalties_details/index.tsx b/src/components/royalties_details/index.tsx
new file mode 100644
index 0000000000..e6168b3009
--- /dev/null
+++ b/src/components/royalties_details/index.tsx
@@ -0,0 +1,32 @@
+import React from 'react';
+import {
+ Typography,
+ Box,
+} from '@material-ui/core';
+import { Royalties } from '@src/models/msg/types';
+import Name from '../name';
+import {
+ holder, title,
+} from '../styled_typography_pair/styles';
+
+const RoyaltiesDetails = ({
+ type, royalties,
+}: { type: 'Mint' | 'Resale', royalties: Royalties[] }) => {
+ return !royalties.length ? null : (
+ <>
+ {`${type} Royalties`}
+ {royalties.map((royaltie) => {
+ return (
+
+
+
+ {`${parseFloat(royaltie.percent)} %`}
+
+
+ );
+ })}
+ >
+ );
+};
+
+export default RoyaltiesDetails;
diff --git a/src/components/styled_typography_pair/index.tsx b/src/components/styled_typography_pair/index.tsx
new file mode 100644
index 0000000000..58cc3e9d6b
--- /dev/null
+++ b/src/components/styled_typography_pair/index.tsx
@@ -0,0 +1,26 @@
+import {
+ Typography,
+ Box,
+} from '@material-ui/core';
+import { holder } from './styles';
+
+const StyledTypographyPair = ({
+ text,
+ content,
+}: {
+ text: string,
+ content: string
+}) => {
+ return (
+
+
+ {text}
+
+
+ {content}
+
+
+ );
+};
+
+export default StyledTypographyPair;
diff --git a/src/components/styled_typography_pair/styles.ts b/src/components/styled_typography_pair/styles.ts
new file mode 100644
index 0000000000..31d246fc23
--- /dev/null
+++ b/src/components/styled_typography_pair/styles.ts
@@ -0,0 +1,10 @@
+export const holder = {
+ gap: '10px',
+ width: '100%',
+ display: 'flex',
+};
+
+export const title = {
+ marginTop: '10px',
+ fontWeight: 900,
+};
diff --git a/src/models/index.ts b/src/models/index.ts
index f7000516ef..dcd5c69c9d 100644
--- a/src/models/index.ts
+++ b/src/models/index.ts
@@ -79,6 +79,18 @@ import MsgSendToCosmosClaim from './msg/gravity/msg_send_to_cosmos_claim';
import MsgCreateAddress from './msg/addressbook/msg_create_address';
import MsgUpdateAddress from './msg/addressbook/msg_update_address';
import MsgDeleteAddress from './msg/addressbook/msg_delete_address';
+import MsgCreateCollection from './msg/marketplace/msg_create_collection';
+import MsgPublishCollection from './msg/marketplace/msg_publish_collection';
+import MsgVerifyCollection from './msg/marketplace/msg_verify_collection';
+import MsgUnverifyCollection from './msg/marketplace/msg_unverify_collection';
+import MsgAddAdmin from './msg/marketplace/msg_add_admin';
+import MsgMintNft from './msg/marketplace/msg_mint_nft';
+import MsgPublishNft from './msg/marketplace/msg_publish_nft';
+import MsgRemoveNft from './msg/marketplace/msg_remove_nft';
+import MsgUpdatePrice from './msg/marketplace/msg_update_price';
+import MsgUpdateRoyalties from './msg/marketplace/msg_update_royalties';
+import MsgBuyNft from './msg/marketplace/msg_buy_nft';
+import MsgRemoveAdmin from './msg/marketplace/msg_remove_admin';
export {
BigDipperNetwork,
@@ -162,4 +174,16 @@ export {
MsgCreateAddress,
MsgUpdateAddress,
MsgDeleteAddress,
+ MsgCreateCollection,
+ MsgPublishCollection,
+ MsgVerifyCollection,
+ MsgUnverifyCollection,
+ MsgAddAdmin,
+ MsgMintNft,
+ MsgPublishNft,
+ MsgRemoveNft,
+ MsgUpdatePrice,
+ MsgUpdateRoyalties,
+ MsgBuyNft,
+ MsgRemoveAdmin,
};
diff --git a/src/models/msg/marketplace/msg_add_admin.ts b/src/models/msg/marketplace/msg_add_admin.ts
new file mode 100644
index 0000000000..f8928449c3
--- /dev/null
+++ b/src/models/msg/marketplace/msg_add_admin.ts
@@ -0,0 +1,28 @@
+import { Categories } from '../types';
+
+class MsgAddAdmin {
+ public category: Categories;
+ public type: string;
+ public json: any;
+ public creator: string;
+ public address: string;
+
+ constructor(payload: any) {
+ this.category = 'marketplace';
+ this.type = payload.type;
+ this.json = payload.json;
+ this.creator = payload.creator;
+ this.address = payload.address;
+ }
+
+ static fromJson(json: any) {
+ return new MsgAddAdmin({
+ json,
+ type: json['@type'],
+ creator: json.creator,
+ address: json.address,
+ });
+ }
+}
+
+export default MsgAddAdmin;
diff --git a/src/models/msg/marketplace/msg_buy_nft.ts b/src/models/msg/marketplace/msg_buy_nft.ts
new file mode 100644
index 0000000000..455b7b8c60
--- /dev/null
+++ b/src/models/msg/marketplace/msg_buy_nft.ts
@@ -0,0 +1,54 @@
+import { formatToken } from '@src/utils/format_token';
+import { Categories } from '../types';
+
+class MsgBuyNft {
+ public category: Categories;
+ public type: string;
+ public json: any;
+ public seller: string;
+ public buyer: string;
+ public id: string;
+ public price: TokenUnit;
+
+ constructor(payload: any) {
+ this.category = 'marketplace';
+ this.type = payload.type;
+ this.json = payload.json;
+ this.seller = payload.seller;
+ this.buyer = payload.buyer;
+ this.id = payload.id;
+ this.price = payload.price;
+ }
+
+ static getPriceFromSaleEvents(events: any): TokenUnit {
+ const salePrice = events
+ .attributes.find((attribute: { key: string; }) => attribute.key === 'price')
+ .value || undefined;
+ const splitPrice = salePrice.split(/(\d+)/);
+ return formatToken(splitPrice[1], splitPrice[2]);
+ }
+
+ static getSellerFromSaleEvents(events: any) {
+ return events
+ .attributes.find((attribute: { key: string; }) => attribute.key === 'owner')
+ .value || undefined;
+ }
+
+ static getSaleEventsFromLog(log: any) {
+ return log.events.find((event: { type: string; }) => event.type === 'buy_nft');
+ }
+
+ static fromJson(json: any, log?: any) {
+ const saleEvents = this.getSaleEventsFromLog(log);
+ return new MsgBuyNft({
+ json,
+ type: json['@type'],
+ seller: this.getSellerFromSaleEvents(saleEvents),
+ buyer: json.creator,
+ id: json.id,
+ price: this.getPriceFromSaleEvents(saleEvents),
+ });
+ }
+}
+
+export default MsgBuyNft;
diff --git a/src/models/msg/marketplace/msg_create_collection.ts b/src/models/msg/marketplace/msg_create_collection.ts
new file mode 100644
index 0000000000..5301363a64
--- /dev/null
+++ b/src/models/msg/marketplace/msg_create_collection.ts
@@ -0,0 +1,35 @@
+import { Royalties } from '@src/models/msg/types';
+import { Categories } from '../types';
+
+class MsgCreateCollection {
+ public category: Categories;
+ public type: string;
+ public json: any;
+ public creator: string;
+ public collectionId: string;
+ public mintRoyalties: Royalties[];
+ public resaleRoyalties: Royalties[];
+
+ constructor(payload: any) {
+ this.category = 'marketplace';
+ this.type = payload.type;
+ this.json = payload.json;
+ this.creator = payload.creator;
+ this.collectionId = payload.collectionId;
+ this.mintRoyalties = payload.mintRoyalties;
+ this.resaleRoyalties = payload.resaleRoyalties;
+ }
+
+ static fromJson(json: any) {
+ return new MsgCreateCollection({
+ json,
+ type: json['@type'],
+ creator: json.creator,
+ collectionId: json.id,
+ mintRoyalties: json.mintRoyalties,
+ resaleRoyalties: json.resaleRoyalties,
+ });
+ }
+}
+
+export default MsgCreateCollection;
diff --git a/src/models/msg/marketplace/msg_mint_nft.ts b/src/models/msg/marketplace/msg_mint_nft.ts
new file mode 100644
index 0000000000..04c6204d07
--- /dev/null
+++ b/src/models/msg/marketplace/msg_mint_nft.ts
@@ -0,0 +1,41 @@
+import { formatToken } from '@src/utils/format_token';
+import {
+ Categories, MintedNft,
+} from '../types';
+
+class MsgMintNft {
+ public category: Categories;
+ public type: string;
+ public json: any;
+ public mintedNftData: MintedNft;
+ public creator: string;
+ public recipient: string;
+
+ constructor(payload: any) {
+ this.category = 'marketplace';
+ this.type = payload.type;
+ this.json = payload.json;
+ this.creator = payload.creator;
+ this.recipient = payload.recipient;
+ this.mintedNftData = payload.mintedNftData;
+ }
+
+ static fromJson(json: any) {
+ return new MsgMintNft({
+ json,
+ type: json['@type'],
+ creator: json.creator,
+ recipient: json.recipient,
+ mintedNftData: {
+ denomId: json.denomId,
+ uid: json.uid,
+ uri: json.uri,
+ data: json.data,
+ name: json.name,
+ price: formatToken(json.price.amount, json.price.denom),
+ },
+ });
+ }
+}
+
+export default MsgMintNft;
diff --git a/src/models/msg/marketplace/msg_publish_collection.ts b/src/models/msg/marketplace/msg_publish_collection.ts
new file mode 100644
index 0000000000..e62551489a
--- /dev/null
+++ b/src/models/msg/marketplace/msg_publish_collection.ts
@@ -0,0 +1,35 @@
+import { Royalties } from '@src/models/msg/types';
+import { Categories } from '../types';
+
+class MsgPublishCollection {
+ public category: Categories;
+ public type: string;
+ public json: any;
+ public creator: string;
+ public collectionId: string;
+ public mintRoyalties: Royalties[];
+ public resaleRoyalties: Royalties[];
+
+ constructor(payload: any) {
+ this.category = 'marketplace';
+ this.type = payload.type;
+ this.json = payload.json;
+ this.creator = payload.creator;
+ this.collectionId = payload.collectionId;
+ this.mintRoyalties = payload.mintRoyalties;
+ this.resaleRoyalties = payload.resaleRoyalties;
+ }
+
+ static fromJson(json: any) {
+ return new MsgPublishCollection({
+ json,
+ type: json['@type'],
+ creator: json.creator,
+ collectionId: json.denomId,
+ mintRoyalties: json.mintRoyalties,
+ resaleRoyalties: json.resaleRoyalties,
+ });
+ }
+}
+
+export default MsgPublishCollection;
diff --git a/src/models/msg/marketplace/msg_publish_nft.ts b/src/models/msg/marketplace/msg_publish_nft.ts
new file mode 100644
index 0000000000..a750e3f914
--- /dev/null
+++ b/src/models/msg/marketplace/msg_publish_nft.ts
@@ -0,0 +1,35 @@
+import { formatToken } from '@src/utils/format_token';
+import { Categories } from '../types';
+
+class MsgPublishNft {
+ public category: Categories;
+ public type: string;
+ public json: any;
+ public creator: string;
+ public denomId: string;
+ public tokenId: string;
+ public price: TokenUnit
+
+ constructor(payload: any) {
+ this.category = 'marketplace';
+ this.type = payload.type;
+ this.json = payload.json;
+ this.creator = payload.creator;
+ this.denomId = payload.denomId;
+ this.tokenId = payload.tokenId;
+ this.price = payload.price;
+ }
+
+ static fromJson(json: any) {
+ return new MsgPublishNft({
+ json,
+ type: json['@type'],
+ creator: json.creator,
+ denomId: json.denomId,
+ tokenId: json.tokenId,
+ price: formatToken(json.price.amount, json.price.denom),
+ });
+ }
+}
+
+export default MsgPublishNft;
diff --git a/src/models/msg/marketplace/msg_remove_admin.ts b/src/models/msg/marketplace/msg_remove_admin.ts
new file mode 100644
index 0000000000..5243f019c5
--- /dev/null
+++ b/src/models/msg/marketplace/msg_remove_admin.ts
@@ -0,0 +1,28 @@
+import { Categories } from '../types';
+
+class MsgRemoveAdmin {
+ public category: Categories;
+ public type: string;
+ public json: any;
+ public creator: string;
+ public address: string;
+
+ constructor(payload: any) {
+ this.category = 'marketplace';
+ this.type = payload.type;
+ this.json = payload.json;
+ this.creator = payload.creator;
+ this.address = payload.address;
+ }
+
+ static fromJson(json: any) {
+ return new MsgRemoveAdmin({
+ json,
+ type: json['@type'],
+ creator: json.creator,
+ address: json.address,
+ });
+ }
+}
+
+export default MsgRemoveAdmin;
diff --git a/src/models/msg/marketplace/msg_remove_nft.ts b/src/models/msg/marketplace/msg_remove_nft.ts
new file mode 100644
index 0000000000..297ec059c5
--- /dev/null
+++ b/src/models/msg/marketplace/msg_remove_nft.ts
@@ -0,0 +1,28 @@
+import { Categories } from '../types';
+
+class MsgRemoveNft {
+ public category: Categories;
+ public type: string;
+ public json: any;
+ public creator: string;
+ public id: string;
+
+ constructor(payload: any) {
+ this.category = 'marketplace';
+ this.type = payload.type;
+ this.json = payload.json;
+ this.creator = payload.creator;
+ this.id = payload.id;
+ }
+
+ static fromJson(json: any) {
+ return new MsgRemoveNft({
+ json,
+ type: json['@type'],
+ creator: json.creator,
+ id: json.id,
+ });
+ }
+}
+
+export default MsgRemoveNft;
diff --git a/src/models/msg/marketplace/msg_unverify_collection.ts b/src/models/msg/marketplace/msg_unverify_collection.ts
new file mode 100644
index 0000000000..fb32fa494e
--- /dev/null
+++ b/src/models/msg/marketplace/msg_unverify_collection.ts
@@ -0,0 +1,38 @@
+import { Categories } from '../types';
+
+class MsgUnverifyCollection {
+ public category: Categories;
+ public type: string;
+ public json: any;
+ public creator: string;
+ public admin: string;
+ public collectionId: string;
+
+ constructor(payload: any) {
+ this.category = 'marketplace';
+ this.type = payload.type;
+ this.json = payload.json;
+ this.creator = payload.creator;
+ this.admin = payload.admin;
+ this.collectionId = payload.collectionId;
+ }
+
+ static getAdminFromLog(log: any) {
+ return log
+ .events.find((event: { type: string; }) => event.type === 'message')
+ .attributes.find((attribute: { key: string; }) => attribute.key === 'sender')
+ .value || undefined;
+ }
+
+ static fromJson(json: any, log?: any) {
+ return new MsgUnverifyCollection({
+ json,
+ type: json['@type'],
+ creator: json.creator,
+ admin: this.getAdminFromLog(log),
+ collectionId: json.id,
+ });
+ }
+}
+
+export default MsgUnverifyCollection;
diff --git a/src/models/msg/marketplace/msg_update_price.ts b/src/models/msg/marketplace/msg_update_price.ts
new file mode 100644
index 0000000000..3eb7961fe4
--- /dev/null
+++ b/src/models/msg/marketplace/msg_update_price.ts
@@ -0,0 +1,32 @@
+import { formatToken } from '@src/utils/format_token';
+import { Categories } from '../types';
+
+class MsgUpdatePrice {
+ public category: Categories;
+ public type: string;
+ public json: any;
+ public creator: string;
+ public id: string;
+ public price: TokenUnit;
+
+ constructor(payload: any) {
+ this.category = 'marketplace';
+ this.type = payload.type;
+ this.json = payload.json;
+ this.creator = payload.creator;
+ this.id = payload.id;
+ this.price = payload.price;
+ }
+
+ static fromJson(json: any) {
+ return new MsgUpdatePrice({
+ json,
+ type: json['@type'],
+ creator: json.creator,
+ id: json.id,
+ price: formatToken(json.price.amount, json.price.denom),
+ });
+ }
+}
+
+export default MsgUpdatePrice;
diff --git a/src/models/msg/marketplace/msg_update_royalties.ts b/src/models/msg/marketplace/msg_update_royalties.ts
new file mode 100644
index 0000000000..bce57a29ce
--- /dev/null
+++ b/src/models/msg/marketplace/msg_update_royalties.ts
@@ -0,0 +1,35 @@
+import { Royalties } from '@src/models/msg/types';
+import { Categories } from '../types';
+
+class MsgUpdateRoyalties {
+ public category: Categories;
+ public type: string;
+ public json: any;
+ public creator: string;
+ public collectionId: string;
+ public mintRoyalties: Royalties[];
+ public resaleRoyalties: Royalties[];
+
+ constructor(payload: any) {
+ this.category = 'marketplace';
+ this.type = payload.type;
+ this.json = payload.json;
+ this.creator = payload.creator;
+ this.collectionId = payload.collectionId;
+ this.mintRoyalties = payload.mintRoyalties;
+ this.resaleRoyalties = payload.resaleRoyalties;
+ }
+
+ static fromJson(json: any) {
+ return new MsgUpdateRoyalties({
+ json,
+ type: json['@type'],
+ creator: json.creator,
+ collectionId: json.id,
+ mintRoyalties: json.mintRoyalties,
+ resaleRoyalties: json.resaleRoyalties,
+ });
+ }
+}
+
+export default MsgUpdateRoyalties;
diff --git a/src/models/msg/marketplace/msg_verify_collection.ts b/src/models/msg/marketplace/msg_verify_collection.ts
new file mode 100644
index 0000000000..34b1d8560a
--- /dev/null
+++ b/src/models/msg/marketplace/msg_verify_collection.ts
@@ -0,0 +1,38 @@
+import { Categories } from '../types';
+
+class MsgVerifyCollection {
+ public category: Categories;
+ public type: string;
+ public json: any;
+ public creator: string;
+ public admin: string;
+ public collectionId: string;
+
+ constructor(payload: any) {
+ this.category = 'marketplace';
+ this.type = payload.type;
+ this.json = payload.json;
+ this.creator = payload.creator;
+ this.admin = payload.admin;
+ this.collectionId = payload.collectionId;
+ }
+
+ static getAdminFromLog(log: any) {
+ return log
+ .events.find((event: { type: string; }) => event.type === 'message')
+ .attributes.find((attribute: { key: string; }) => attribute.key === 'sender')
+ .value || undefined;
+ }
+
+ static fromJson(json: any, log?: any) {
+ return new MsgVerifyCollection({
+ json,
+ type: json['@type'],
+ creator: json.creator,
+ admin: this.getAdminFromLog(log),
+ collectionId: json.id,
+ });
+ }
+}
+
+export default MsgVerifyCollection;
diff --git a/src/models/msg/types.ts b/src/models/msg/types.ts
index b676f5fdb9..58e6f3bff6 100644
--- a/src/models/msg/types.ts
+++ b/src/models/msg/types.ts
@@ -1,3 +1,20 @@
export type BaseCategories = 'bank' | 'crisis' | 'distribution' | 'governance' | 'slashing' | 'staking' | 'profiles' | 'ibc' | 'ibc-transfer' | 'authz' | 'feegrant' | 'vesting' | 'others'
-export type CustomCategories = 'cosmwasm' | 'gravity' | 'addressbook'; // custom modules
+export type CustomCategories = 'cosmwasm' | 'gravity' | 'addressbook' | 'marketplace'; // custom modules
export type Categories = BaseCategories | CustomCategories
+export interface MintedNft {
+ denomId: string;
+ uid: string;
+ uri: string;
+ data: string;
+ name: string;
+ price: TokenUnit;
+}
+export interface AddressBookDetailsValue {
+ network: string;
+ label: string;
+ value: string;
+}
+export interface Royalties {
+ address: string;
+ percent: string;
+}
From c50b4ea32ceb69bc4e57d5e9deb69097be675a7e Mon Sep 17 00:00:00 2001
From: SpaghettiOverload
Date: Wed, 25 Jan 2023 12:47:02 +0200
Subject: [PATCH 4/5] fix lint errors
---
src/models/msg/marketplace/msg_create_collection.ts | 5 +++--
src/models/msg/marketplace/msg_publish_collection.ts | 5 +++--
src/models/msg/marketplace/msg_update_royalties.ts | 5 +++--
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/models/msg/marketplace/msg_create_collection.ts b/src/models/msg/marketplace/msg_create_collection.ts
index 5301363a64..60edebffd8 100644
--- a/src/models/msg/marketplace/msg_create_collection.ts
+++ b/src/models/msg/marketplace/msg_create_collection.ts
@@ -1,5 +1,6 @@
-import { Royalties } from '@src/models/msg/types';
-import { Categories } from '../types';
+import {
+ Royalties, Categories,
+} from '@src/models/msg/types';
class MsgCreateCollection {
public category: Categories;
diff --git a/src/models/msg/marketplace/msg_publish_collection.ts b/src/models/msg/marketplace/msg_publish_collection.ts
index e62551489a..51648da2d6 100644
--- a/src/models/msg/marketplace/msg_publish_collection.ts
+++ b/src/models/msg/marketplace/msg_publish_collection.ts
@@ -1,5 +1,6 @@
-import { Royalties } from '@src/models/msg/types';
-import { Categories } from '../types';
+import {
+ Royalties, Categories,
+} from '@src/models/msg/types';
class MsgPublishCollection {
public category: Categories;
diff --git a/src/models/msg/marketplace/msg_update_royalties.ts b/src/models/msg/marketplace/msg_update_royalties.ts
index bce57a29ce..05a67f1654 100644
--- a/src/models/msg/marketplace/msg_update_royalties.ts
+++ b/src/models/msg/marketplace/msg_update_royalties.ts
@@ -1,5 +1,6 @@
-import { Royalties } from '@src/models/msg/types';
-import { Categories } from '../types';
+import {
+ Royalties, Categories,
+} from '@src/models/msg/types';
class MsgUpdateRoyalties {
public category: Categories;
From 9e2ec6feacb529ca10f37e1594b56a7ade3bbb82 Mon Sep 17 00:00:00 2001
From: SpaghettiOverload
Date: Wed, 25 Jan 2023 12:53:56 +0200
Subject: [PATCH 5/5] update test snapshot
---
.../msg/marketplace/buy_nft/__snapshots__/index.test.tsx.snap | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/msg/marketplace/buy_nft/__snapshots__/index.test.tsx.snap b/src/components/msg/marketplace/buy_nft/__snapshots__/index.test.tsx.snap
index 7fbddddc08..ff5f6c7a33 100644
--- a/src/components/msg/marketplace/buy_nft/__snapshots__/index.test.tsx.snap
+++ b/src/components/msg/marketplace/buy_nft/__snapshots__/index.test.tsx.snap
@@ -21,7 +21,7 @@ exports[`screen: TransactionDetails/MsgBuyNft matches snapshot 1`] = `
id="message_contents:txBuyNft"
values={
Object {
- "id": undefined,
+ "id": "id",
"price": "1 acudos",
}
}