From 4737c978df992944db8cb6c1ed6cb2e05c53e4ad Mon Sep 17 00:00:00 2001
From: SpaghettiOverload
Date: Tue, 17 Jan 2023 12:09:06 +0200
Subject: [PATCH 01/21] CUDOS-2088 / Fix inject withdraw reward type
---
src/components/msg/mutate/index.tsx | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/components/msg/mutate/index.tsx b/src/components/msg/mutate/index.tsx
index f2a6cb6235..5c38819aa2 100644
--- a/src/components/msg/mutate/index.tsx
+++ b/src/components/msg/mutate/index.tsx
@@ -28,7 +28,7 @@ const insertMissingWithdrawRewardsMsgWhenDelegating = (transaction: any) => {
for (let i = 0; i < messages.length; i += 1) {
const model = getMessageModelByType(messages[i]?.['@type']);
- if (model === MODELS.MsgDelegate) {
+ if (model === MODELS.MsgRedelegate) {
const coinReceivedEvent = getEventAtIndex(transaction, i, 'coin_received');
const coinSpentEvent = getEventAtIndex(transaction, i, 'coin_spent');
@@ -66,12 +66,12 @@ const getEventAtIndex = (transaction: any, index: number, eventType: string) =>
}
};
-const buildWithdrawRewardsMessage = (delegateMsg: any, coinReceivedEvent: any,
+const buildWithdrawRewardsMessage = (redelegateMsg: any, coinReceivedEvent: any,
coinSpentEvent: any) => {
const withdrawMsg = {
'@type': '/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward',
- delegator_address: delegateMsg.delegator_address,
- validator_address: delegateMsg.validator_address,
+ delegator_address: redelegateMsg.delegator_address,
+ validator_address: redelegateMsg.validator_src_address,
};
const events = [];
@@ -126,7 +126,7 @@ const buildWithdrawRewardsMessage = (delegateMsg: any, coinReceivedEvent: any,
key: 'amount', value: coinReceivedEvent.attributes[1].value,
},
{
- key: 'validator', value: delegateMsg.validator_address,
+ key: 'validator', value: redelegateMsg.validator_src_address,
},
]));
From 9643c61bb7130ae67ccd90be830541d04d4871c7 Mon Sep 17 00:00:00 2001
From: SpaghettiOverload
Date: Tue, 17 Jan 2023 12:22:16 +0200
Subject: [PATCH 02/21] update next.config.js to enable client-side debug
---
next.config.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/next.config.js b/next.config.js
index 6857806c1b..d3ee1b9466 100644
--- a/next.config.js
+++ b/next.config.js
@@ -2,6 +2,7 @@ const nextTranslate = require('next-translate');
module.exports = nextTranslate({
poweredByHeader: false,
+ productionBrowserSourceMaps: true,
webpack: (config) => {
config.module.rules.push({
test: /\.svg$/,
From ba7875b87d77e1f7bc4067856808860920b90282 Mon Sep 17 00:00:00 2001
From: SpaghettiOverload
Date: Mon, 23 Jan 2023 18:00:17 +0200
Subject: [PATCH 03/21] 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 04/21] 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 05/21] 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 06/21] 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 07/21] 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",
}
}
From f341a03e18c07b6f56c2ed76c608a076e9dfa6fd Mon Sep 17 00:00:00 2001
From: SpaghettiOverload
Date: Mon, 20 Mar 2023 12:23:15 +0200
Subject: [PATCH 08/21] CUDOS-2367-show-app-version-in-footer
---
.env-dev | 1 +
.env.sample | 1 +
public/locales/en/common.json | 1 +
src/components/footer/index.tsx | 16 +++++++++++++++-
4 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/.env-dev b/.env-dev
index 219aa72d14..71bcfac1a5 100644
--- a/.env-dev
+++ b/.env-dev
@@ -5,3 +5,4 @@ PORT=3000
NEXT_PUBLIC_URL=http://localhost:3000
NEXT_PUBLIC_WS_CHAIN_URL=ws://localhost:26657/websocket
NEXT_PUBLIC_CHAIN_STATUS=testnet
+NEXT_PUBLIC_APP_DEPLOYMENT_VERSION='v1.2.3'
diff --git a/.env.sample b/.env.sample
index dbb987ca30..72c20a12cb 100644
--- a/.env.sample
+++ b/.env.sample
@@ -13,3 +13,4 @@ PORT=3000
NEXT_PUBLIC_URL=http://localhost:3000
NEXT_PUBLIC_RPC_WEBSOCKET=http://localhost:26657/websocket
NEXT_PUBLIC_CHAIN_TYPE=testnet
+NEXT_PUBLIC_APP_DEPLOYMENT_VERSION='v1.2.3'
diff --git a/public/locales/en/common.json b/public/locales/en/common.json
index c1fdb7a35c..a83db405e6 100644
--- a/public/locales/en/common.json
+++ b/public/locales/en/common.json
@@ -62,6 +62,7 @@
"errorDetails": "If you have time please report it to our github at <0>{{issue}}0> with the url that caused the error.",
"errorHome": "Click here to go back home",
"maintainBy": "Maintained By <0>{{name}}0>",
+ "appVersion": "App version: <0>{{appVersion}}0>",
"txListFormat": "Transactions Format",
"compact": "Compact",
"detailed": "Detailed",
diff --git a/src/components/footer/index.tsx b/src/components/footer/index.tsx
index 2df4a68c4c..f60716fc8e 100644
--- a/src/components/footer/index.tsx
+++ b/src/components/footer/index.tsx
@@ -145,7 +145,7 @@ const Footer: React.FC<{className?: string}> = ({ className }) => {
{' '}
{year}
-
+ {/*
= ({ className }) => {
name: generalConfig.maintainer.name,
}}
/>
+ */}
+
+
+ ),
+ ]}
+ values={{
+ appVersion: process.env.NEXT_PUBLIC_APP_DEPLOYMENT_VERSION,
+ }}
+ />
From ea26f303148cf25b27a5d3daa300dd8b9d5aa7df Mon Sep 17 00:00:00 2001
From: SpaghettiOverload
Date: Fri, 19 May 2023 15:44:43 +0300
Subject: [PATCH 09/21] CUDOS-2523-fix-market-cap
---
src/recoil/market/hooks.ts | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/recoil/market/hooks.ts b/src/recoil/market/hooks.ts
index 9ec3340c76..9d5ed3f6d9 100644
--- a/src/recoil/market/hooks.ts
+++ b/src/recoil/market/hooks.ts
@@ -15,6 +15,7 @@ import {
} from '@recoil/market';
import { AtomState } from '@recoil/market/types';
import { formatToken } from '@utils/format_token';
+import Big from 'big.js'
export const useMarketRecoil = () => {
const [market, setMarket] = useRecoilState(writeMarket) as [AtomState, SetterOrUpdater];
@@ -57,10 +58,15 @@ export const useMarketRecoil = () => {
communityPool = formatToken(communityPoolCoin.amount, communityPoolCoin.denom);
}
+ const adjustedMarketCap = Big(rawSupplyAmount)
+ .div(new Big(10).pow(supply.exponent))
+ .times(data?.tokenPrice[0]?.price)
+ .toNumber();
+
return ({
price,
supply,
- marketCap,
+ marketCap: adjustedMarketCap,
inflation,
communityPool,
apr,
From 77e87c3d99c61e569f2e52447d40181e93a42556 Mon Sep 17 00:00:00 2001
From: SpaghettiOverload
Date: Fri, 19 May 2023 15:54:44 +0300
Subject: [PATCH 10/21] update calculation
---
src/recoil/market/hooks.ts | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/recoil/market/hooks.ts b/src/recoil/market/hooks.ts
index 9d5ed3f6d9..ce3a45f1c9 100644
--- a/src/recoil/market/hooks.ts
+++ b/src/recoil/market/hooks.ts
@@ -58,10 +58,17 @@ export const useMarketRecoil = () => {
communityPool = formatToken(communityPoolCoin.amount, communityPoolCoin.denom);
}
- const adjustedMarketCap = Big(rawSupplyAmount)
- .div(new Big(10).pow(supply.exponent))
- .times(data?.tokenPrice[0]?.price)
- .toNumber();
+ let adjustedMarketCap = 0;
+ if (
+ data?.tokenPrice[0]?.price &&
+ rawSupplyAmount &&
+ supply.exponent
+ ) {
+ adjustedMarketCap = Big(rawSupplyAmount)
+ .div(new Big(10).pow(supply.exponent))
+ .times(data?.tokenPrice[0]?.price)
+ .toNumber();
+ }
return ({
price,
From 36e5ffee00ec581b6ebfa6a8be837e55d18cd0f5 Mon Sep 17 00:00:00 2001
From: SpaghettiOverload
Date: Fri, 19 May 2023 16:02:44 +0300
Subject: [PATCH 11/21] address lint errors
---
src/recoil/market/hooks.ts | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/recoil/market/hooks.ts b/src/recoil/market/hooks.ts
index ce3a45f1c9..014e9a439d 100644
--- a/src/recoil/market/hooks.ts
+++ b/src/recoil/market/hooks.ts
@@ -15,7 +15,7 @@ import {
} from '@recoil/market';
import { AtomState } from '@recoil/market/types';
import { formatToken } from '@utils/format_token';
-import Big from 'big.js'
+import Big from 'big.js';
export const useMarketRecoil = () => {
const [market, setMarket] = useRecoilState(writeMarket) as [AtomState, SetterOrUpdater];
@@ -35,12 +35,11 @@ export const useMarketRecoil = () => {
const formatUseChainIdQuery = (data: MarketDataQuery): AtomState => {
let {
- communityPool, price, marketCap,
+ communityPool, price,
} = market;
if (data?.tokenPrice?.length) {
price = numeral(numeral(data?.tokenPrice[0]?.price).format('0.[00]', Math.floor)).value();
- marketCap = data.tokenPrice[0]?.marketCap;
}
const [communityPoolCoin] = R.pathOr([], ['communityPool', 0, 'coins'], data).filter((x) => x.denom === chainConfig.primaryTokenUnit);
@@ -60,9 +59,9 @@ export const useMarketRecoil = () => {
let adjustedMarketCap = 0;
if (
- data?.tokenPrice[0]?.price &&
- rawSupplyAmount &&
- supply.exponent
+ data?.tokenPrice[0]?.price
+ && rawSupplyAmount
+ && supply.exponent
) {
adjustedMarketCap = Big(rawSupplyAmount)
.div(new Big(10).pow(supply.exponent))
From 47af840337194cbdef063ac479d676dc56992a2c Mon Sep 17 00:00:00 2001
From: SpaghettiOverload
Date: Fri, 19 May 2023 16:10:11 +0300
Subject: [PATCH 12/21] resolve test errors
---
src/components/footer/__snapshots__/index.test.tsx.snap | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/footer/__snapshots__/index.test.tsx.snap b/src/components/footer/__snapshots__/index.test.tsx.snap
index d044677889..b74042c611 100644
--- a/src/components/footer/__snapshots__/index.test.tsx.snap
+++ b/src/components/footer/__snapshots__/index.test.tsx.snap
@@ -317,7 +317,7 @@ exports[`component: layout/footer matches snapshot 1`] = `
- common:maintainBy
+ common:appVersion
From ccaa64fcc967294336239632e1e0285482650628 Mon Sep 17 00:00:00 2001
From: SpaghettiOverload
Date: Wed, 5 Jul 2023 15:14:24 +0300
Subject: [PATCH 13/21] add conditional msg decoding to MsgExecuteContract
---
.../msg/cosmwasm/msg_execute_contract.ts | 20 +++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/models/msg/cosmwasm/msg_execute_contract.ts b/src/models/msg/cosmwasm/msg_execute_contract.ts
index 5d49636c41..d333306ab3 100644
--- a/src/models/msg/cosmwasm/msg_execute_contract.ts
+++ b/src/models/msg/cosmwasm/msg_execute_contract.ts
@@ -21,10 +21,9 @@ class MsgExecuteContract {
}
static fromJson(json: any) {
- json.msg_decoded = json.msg;
return new MsgExecuteContract({
contract: json.contract,
- msg: json.msg,
+ msg: this.decodeMsg(json.msg),
sender: json.sender,
type: json['@type'],
json,
@@ -37,6 +36,23 @@ class MsgExecuteContract {
const args = JSON.stringify(msgObj[method]);
return [method, args];
}
+
+ static decodeMsg(data: string): string | undefined {
+ let message: string = data
+ try {
+ // Will throw if data is not valid base64 string
+ const decodedMsg = JSON.parse(window.atob(data));
+ if (Object.keys(decodedMsg).length) {
+ message = decodedMsg
+ }
+
+ } catch (error) {
+ console.log(`no need to decode: ${data}`)
+
+ } finally {
+ return message
+ }
+ }
}
export default MsgExecuteContract;
From 562a2af720320d25723a778687756b04ebae1427 Mon Sep 17 00:00:00 2001
From: SpaghettiOverload
Date: Tue, 29 Aug 2023 17:27:04 +0300
Subject: [PATCH 14/21] CUDOS-2603-fix-cw-20-contract-identifying
---
src/screens/token_details/utils.ts | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/screens/token_details/utils.ts b/src/screens/token_details/utils.ts
index bf72fbdac4..b22484ba8a 100644
--- a/src/screens/token_details/utils.ts
+++ b/src/screens/token_details/utils.ts
@@ -3,7 +3,7 @@ import axios from 'axios';
import * as R from 'ramda';
import { Cw20TokenInfo } from './types';
-export const fetchCW20TokenInfo = async (address: string):Promise => {
+export const fetchCW20TokenInfo = async (address: string): Promise => {
const defaultReturnValue = {
cw20TokenInfo: {
address: '',
@@ -25,8 +25,12 @@ export const fetchCW20TokenInfo = async (address: string):Promise
},
query: Cw20TokenInfoDocument,
});
- const tokenInfo = R.pathOr(defaultReturnValue, ['data', 'cw20token_info_by_pk'], data);
+ if (!data || !data.data?.cw20token_info_by_pk) {
+ throw new Error("No tokenInfo")
+ }
+
+ const tokenInfo = R.pathOr(defaultReturnValue, ['data', 'cw20token_info_by_pk'], data);
return {
address,
name: tokenInfo.name,
From 81e3427096fe218d51861f24ced258eb41467e8e Mon Sep 17 00:00:00 2001
From: SpaghettiOverload
Date: Thu, 31 Aug 2023 12:02:38 +0300
Subject: [PATCH 15/21] fix: lint errors
---
src/models/msg/cosmwasm/msg_execute_contract.ts | 11 ++++-------
src/screens/token_details/utils.ts | 2 +-
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/src/models/msg/cosmwasm/msg_execute_contract.ts b/src/models/msg/cosmwasm/msg_execute_contract.ts
index d333306ab3..424e8b4588 100644
--- a/src/models/msg/cosmwasm/msg_execute_contract.ts
+++ b/src/models/msg/cosmwasm/msg_execute_contract.ts
@@ -38,20 +38,17 @@ class MsgExecuteContract {
}
static decodeMsg(data: string): string | undefined {
- let message: string = data
+ let message: string = data;
try {
// Will throw if data is not valid base64 string
const decodedMsg = JSON.parse(window.atob(data));
if (Object.keys(decodedMsg).length) {
- message = decodedMsg
+ message = decodedMsg;
}
-
} catch (error) {
- console.log(`no need to decode: ${data}`)
-
- } finally {
- return message
+ console.log(`no need to decode: ${data}`);
}
+ return message;
}
}
diff --git a/src/screens/token_details/utils.ts b/src/screens/token_details/utils.ts
index b22484ba8a..f8954eeaa1 100644
--- a/src/screens/token_details/utils.ts
+++ b/src/screens/token_details/utils.ts
@@ -27,7 +27,7 @@ export const fetchCW20TokenInfo = async (address: string): Promise
Date: Tue, 17 Oct 2023 19:51:40 +0300
Subject: [PATCH 16/21] update: docker-compose with deployment version
---
docker-compose-dev.yml | 1 +
docker-compose-prod.yml | 1 +
2 files changed, 2 insertions(+)
diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml
index 2660e6d4df..06f588d82e 100644
--- a/docker-compose-dev.yml
+++ b/docker-compose-dev.yml
@@ -11,6 +11,7 @@ services:
NEXT_PUBLIC_URL: ${NEXT_PUBLIC_URL}
NEXT_PUBLIC_WS_CHAIN_URL: ${NEXT_PUBLIC_WS_CHAIN_URL}
NEXT_PUBLIC_CHAIN_STATUS: ${NEXT_PUBLIC_CHAIN_STATUS}
+ NEXT_PUBLIC_APP_DEPLOYMENT_VERSION: ${NEXT_PUBLIC_APP_DEPLOYMENT_VERSION}
NODE_ENV: ${NODE_ENV}
PORT: ${PORT}
restart: always
diff --git a/docker-compose-prod.yml b/docker-compose-prod.yml
index 60ea0885de..c107621e8f 100644
--- a/docker-compose-prod.yml
+++ b/docker-compose-prod.yml
@@ -11,6 +11,7 @@ services:
NEXT_PUBLIC_URL: ${NEXT_PUBLIC_URL}
NEXT_PUBLIC_WS_CHAIN_URL: ${NEXT_PUBLIC_WS_CHAIN_URL}
NEXT_PUBLIC_CHAIN_STATUS: ${NEXT_PUBLIC_CHAIN_STATUS}
+ NEXT_PUBLIC_APP_DEPLOYMENT_VERSION: ${NEXT_PUBLIC_APP_DEPLOYMENT_VERSION}
NODE_ENV: ${NODE_ENV}
PORT: ${PORT}
restart: always
From 6d5fbe007ac3bd360768dcc19eff32e06057f42a Mon Sep 17 00:00:00 2001
From: SpaghettiOverload
Date: Tue, 17 Oct 2023 20:22:31 +0300
Subject: [PATCH 17/21] update dockerfiles
---
Dockerfile-dev => Dockerfile.dev | 2 ++
Dockerfile-prod => Dockerfile.prod | 2 ++
docker-compose-dev.yml | 2 +-
docker-compose-prod.yml | 2 +-
4 files changed, 6 insertions(+), 2 deletions(-)
rename Dockerfile-dev => Dockerfile.dev (88%)
rename Dockerfile-prod => Dockerfile.prod (90%)
diff --git a/Dockerfile-dev b/Dockerfile.dev
similarity index 88%
rename from Dockerfile-dev
rename to Dockerfile.dev
index 5107e20984..2d7e40756a 100644
--- a/Dockerfile-dev
+++ b/Dockerfile.dev
@@ -23,6 +23,7 @@ ARG NEXT_PUBLIC_GRAPHQL_WS
ARG NEXT_PUBLIC_URL
ARG NEXT_PUBLIC_WS_CHAIN_URL
ARG NEXT_PUBLIC_CHAIN_STATUS
+ARG NEXT_PUBLIC_APP_DEPLOYMENT_VERSION
ARG NODE_ENV
ARG PORT=3000
@@ -33,6 +34,7 @@ ENV NEXT_PUBLIC_GRAPHQL_WS ${NEXT_PUBLIC_GRAPHQL_WS}
ENV NEXT_PUBLIC_URL ${NEXT_PUBLIC_URL}
ENV NEXT_PUBLIC_WS_CHAIN_URL ${NEXT_PUBLIC_WS_CHAIN_URL}
ENV NEXT_PUBLIC_CHAIN_STATUS ${NEXT_PUBLIC_CHAIN_STATUS}
+ENV NEXT_PUBLIC_APP_DEPLOYMENT_VERSION ${NEXT_PUBLIC_APP_DEPLOYMENT_VERSION}
ENV NODE_ENV ${NODE_ENV}
ENV PORT ${PORT}
ENV NODE_OPTIONS="--max-old-space-size=8192"
diff --git a/Dockerfile-prod b/Dockerfile.prod
similarity index 90%
rename from Dockerfile-prod
rename to Dockerfile.prod
index 80399e77d2..d723362c64 100644
--- a/Dockerfile-prod
+++ b/Dockerfile.prod
@@ -27,6 +27,7 @@ ARG NEXT_PUBLIC_WS_CHAIN_URL
ARG NEXT_PUBLIC_RPC_WEBSOCKET
ARG NEXT_PUBLIC_CHAIN_STATUS
ARG NEXT_PUBLIC_CHAIN_TYPE
+ARG NEXT_PUBLIC_APP_DEPLOYMENT_VERSION
ARG NODE_ENV
ARG PORT=3000
@@ -38,6 +39,7 @@ ENV NEXT_PUBLIC_WS_CHAIN_URL ${NEXT_PUBLIC_WS_CHAIN_URL}
ENV NEXT_PUBLIC_RPC_WEBSOCKET ${NEXT_PUBLIC_RPC_WEBSOCKET}
ENV NEXT_PUBLIC_CHAIN_STATUS ${NEXT_PUBLIC_CHAIN_STATUS}
ENV NEXT_PUBLIC_CHAIN_TYPE ${NEXT_PUBLIC_CHAIN_TYPE}
+ENV NEXT_PUBLIC_APP_DEPLOYMENT_VERSION ${NEXT_PUBLIC_APP_DEPLOYMENT_VERSION}
ENV NODE_ENV ${NODE_ENV}
ENV PORT ${PORT}
ENV NODE_OPTIONS="--max-old-space-size=8192"
diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml
index 06f588d82e..a21861769c 100644
--- a/docker-compose-dev.yml
+++ b/docker-compose-dev.yml
@@ -4,7 +4,7 @@ services:
container_name: explorer-v2
build:
context: .
- dockerfile: Dockerfile-dev
+ dockerfile: Dockerfile.dev
args:
NEXT_PUBLIC_GRAPHQL_URL: ${NEXT_PUBLIC_GRAPHQL_URL}
NEXT_PUBLIC_GRAPHQL_WS: ${NEXT_PUBLIC_GRAPHQL_WS}
diff --git a/docker-compose-prod.yml b/docker-compose-prod.yml
index c107621e8f..be53d45235 100644
--- a/docker-compose-prod.yml
+++ b/docker-compose-prod.yml
@@ -4,7 +4,7 @@ services:
container_name: explorer-v2
build:
context: .
- dockerfile: Dockerfile-prod
+ dockerfile: Dockerfile.prod
args:
NEXT_PUBLIC_GRAPHQL_URL: ${NEXT_PUBLIC_GRAPHQL_URL}
NEXT_PUBLIC_GRAPHQL_WS: ${NEXT_PUBLIC_GRAPHQL_WS}
From 511a55b1573b20938b4fe55f05e92a3f7df5e2b8 Mon Sep 17 00:00:00 2001
From: SpaghettiOverload
Date: Wed, 25 Oct 2023 11:51:59 +0300
Subject: [PATCH 18/21] CUDOS-2617-fix-Contract-Transactions-Ordering
---
src/graphql/cosmwasm.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/graphql/cosmwasm.ts b/src/graphql/cosmwasm.ts
index 7c67c35ebb..cb5984b8d4 100644
--- a/src/graphql/cosmwasm.ts
+++ b/src/graphql/cosmwasm.ts
@@ -18,7 +18,7 @@ query CosmWasmInstantiate($address: String!) {
export const CosmWasmExecutesDocument = /* GraphQL */`
query CosmWasmExecutes($address: String!, $offset: Int, $limit: Int) {
- cosmwasm_execute(where: {contract: {_eq: $address}}, offset: $offset, limit: $limit) {
+ cosmwasm_execute(where: {contract: {_eq: $address}}, offset: $offset, limit: $limit, order_by: {transaction: {block: {height: desc}}}) {
method
success
transaction_hash
From f89b990412153c0d9fb3c4181bc00d218aa50da2 Mon Sep 17 00:00:00 2001
From: SpaghettiOverload
Date: Thu, 2 Nov 2023 12:19:59 +0200
Subject: [PATCH 19/21] CUDOS-2627-display ETH addr, Send & Cancel ToEth
---
public/locales/en/message_contents.json | 2 +
public/locales/en/message_labels.json | 2 +
.../msg/gravity/cancel_send_to_eth/index.tsx | 43 ++++++++++++++
.../msg/gravity/cancel_send_to_eth/styles.tsx | 29 ++++++++++
.../msg/gravity/send_to_cosmos/index.tsx | 14 ++++-
.../msg/gravity/send_to_eth/index.tsx | 57 +++++++++++++++++++
.../msg/gravity/send_to_eth/styles.tsx | 29 ++++++++++
src/components/msg/index.ts | 4 ++
.../msg/staking/edit_validator/index.tsx | 2 -
src/components/msg/utils.tsx | 12 ++++
src/components/name/index.tsx | 9 +--
src/configs/index.ts | 18 +++++-
src/models/index.ts | 4 ++
.../msg/gravity/msg_cancel_send_to_eth.ts | 29 ++++++++++
src/models/msg/gravity/msg_send_to_eth.ts | 32 +++++++++++
src/utils/go_to_page.ts | 22 ++++---
16 files changed, 290 insertions(+), 18 deletions(-)
create mode 100644 src/components/msg/gravity/cancel_send_to_eth/index.tsx
create mode 100644 src/components/msg/gravity/cancel_send_to_eth/styles.tsx
create mode 100644 src/components/msg/gravity/send_to_eth/index.tsx
create mode 100644 src/components/msg/gravity/send_to_eth/styles.tsx
create mode 100644 src/models/msg/gravity/msg_cancel_send_to_eth.ts
create mode 100644 src/models/msg/gravity/msg_send_to_eth.ts
diff --git a/public/locales/en/message_contents.json b/public/locales/en/message_contents.json
index 9f2aaa2a84..a7408f0d6b 100644
--- a/public/locales/en/message_contents.json
+++ b/public/locales/en/message_contents.json
@@ -63,6 +63,8 @@
"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>",
+ "MsgSendToEth": "<0>{{sender}}0> sent <1>{{amount}}1> to <2>{{ethDest}}2>",
+ "MsgCancelSendToEth": "<0>{{sender}}0> cancelled Send to ETH TX with ID: <1>{{id}}1>",
"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 671f44b8bc..e46089ec65 100644
--- a/public/locales/en/message_labels.json
+++ b/public/locales/en/message_labels.json
@@ -64,6 +64,8 @@
"txUpdateContractAdmin": "Update Contract Admin",
"txClearContractAdmin": "Clear Contract Admin",
"MsgSendToCosmosClaim": "Gravity Bridge - Ethereum to Cosmos",
+ "MsgCancelSendToEth": "Gravity Bridge - Cancel Send To Eth",
+ "MsgSendToEth": "Gravity Bridge - Cosmos to Ethereum",
"txCreateAddress": "New Address Book Record",
"txUpdateAddress": "Update Address Book Record",
"txDeleteAddress": "Delete Address Book Record",
diff --git a/src/components/msg/gravity/cancel_send_to_eth/index.tsx b/src/components/msg/gravity/cancel_send_to_eth/index.tsx
new file mode 100644
index 0000000000..8c0687cca1
--- /dev/null
+++ b/src/components/msg/gravity/cancel_send_to_eth/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 {
+ useProfileRecoil,
+} from '@recoil/profiles';
+import MsgCancelSendToEth from '@src/models/msg/gravity/msg_cancel_send_to_eth';
+
+const CancelSendToEth = (props: {
+ message: MsgCancelSendToEth;
+}) => {
+ const { message } = props;
+
+ const sender = useProfileRecoil(message.sender);
+ const senderMoniker = sender ? sender?.name : message.sender;
+
+ const { transactionID } = message;
+
+ return (
+ <>
+
+
+ ),
+ ,
+ ]}
+ values={{
+ id: transactionID,
+ }}
+ />
+
+ >
+ );
+};
+
+export default CancelSendToEth;
diff --git a/src/components/msg/gravity/cancel_send_to_eth/styles.tsx b/src/components/msg/gravity/cancel_send_to_eth/styles.tsx
new file mode 100644
index 0000000000..6ff4af1f96
--- /dev/null
+++ b/src/components/msg/gravity/cancel_send_to_eth/styles.tsx
@@ -0,0 +1,29 @@
+import {
+ makeStyles, createStyles,
+} from '@material-ui/styles';
+
+export const useGetStyles = () => {
+ const useStyles = makeStyles((theme: any) => createStyles({
+ root: {
+ overflow: 'hidden',
+ },
+ header: {
+ paddingBottom: theme.spacing(2),
+ },
+ pre: {
+ maxHeight: '400px',
+ overflow: 'auto',
+ padding: '1rem',
+ margin: '0',
+ background: theme.palette.background.default,
+ flex: 1,
+ '& code': {
+ whiteSpace: 'pre-wrap',
+ },
+ },
+ }));
+
+ return {
+ classes: useStyles(),
+ };
+};
diff --git a/src/components/msg/gravity/send_to_cosmos/index.tsx b/src/components/msg/gravity/send_to_cosmos/index.tsx
index 8ec93ec8df..557fcc412b 100644
--- a/src/components/msg/gravity/send_to_cosmos/index.tsx
+++ b/src/components/msg/gravity/send_to_cosmos/index.tsx
@@ -9,15 +9,18 @@ import {
import {
formatToken, formatNumber,
} from '@utils/format_token';
+import { AddressType } from '@src/configs';
const SendToCosmos = (props: {
- message: MsgSendToCosmosClaim;
+ message: MsgSendToCosmosClaim;
}) => {
const { message } = props;
const receiver = useProfileRecoil(message.receiver);
const receiverMoniker = receiver ? receiver?.name : message.receiver;
+ const { ethSender } = message;
+
const amount = formatToken(message.amount, 'acudos');
const displayAmount = `${formatNumber(amount.value, amount.exponent)} ${amount.displayDenom.toUpperCase()}`;
@@ -27,7 +30,13 @@ const SendToCosmos = (props: {
,
+ (
+
+ ),
,
(
diff --git a/src/components/msg/gravity/send_to_eth/index.tsx b/src/components/msg/gravity/send_to_eth/index.tsx
new file mode 100644
index 0000000000..e210701155
--- /dev/null
+++ b/src/components/msg/gravity/send_to_eth/index.tsx
@@ -0,0 +1,57 @@
+import React from 'react';
+import Trans from 'next-translate/Trans';
+import { Typography } from '@material-ui/core';
+import { Name } from '@components';
+import { MsgSendToEth } from '@models';
+import {
+ useProfileRecoil,
+} from '@recoil/profiles';
+import {
+ formatToken, formatNumber,
+} from '@utils/format_token';
+import { AddressType } from '@src/configs';
+
+const SendToEth = (props: {
+ message: MsgSendToEth;
+}) => {
+ const { message } = props;
+
+ const sender = useProfileRecoil(message.sender);
+ const senderMoniker = sender ? sender?.name : message.sender;
+
+ const { ethDest } = message;
+
+ const amount = formatToken(message.amount, 'acudos');
+ const displayAmount = `${formatNumber(amount.value, amount.exponent)} ${amount.displayDenom.toUpperCase()}`;
+
+ return (
+ <>
+
+
+ ),
+ ,
+ (
+
+ ),
+ ]}
+ values={{
+ amount: displayAmount,
+ }}
+ />
+
+ >
+ );
+};
+
+export default SendToEth;
diff --git a/src/components/msg/gravity/send_to_eth/styles.tsx b/src/components/msg/gravity/send_to_eth/styles.tsx
new file mode 100644
index 0000000000..6ff4af1f96
--- /dev/null
+++ b/src/components/msg/gravity/send_to_eth/styles.tsx
@@ -0,0 +1,29 @@
+import {
+ makeStyles, createStyles,
+} from '@material-ui/styles';
+
+export const useGetStyles = () => {
+ const useStyles = makeStyles((theme: any) => createStyles({
+ root: {
+ overflow: 'hidden',
+ },
+ header: {
+ paddingBottom: theme.spacing(2),
+ },
+ pre: {
+ maxHeight: '400px',
+ overflow: 'auto',
+ padding: '1rem',
+ margin: '0',
+ background: theme.palette.background.default,
+ flex: 1,
+ '& code': {
+ whiteSpace: 'pre-wrap',
+ },
+ },
+ }));
+
+ return {
+ classes: useStyles(),
+ };
+};
diff --git a/src/components/msg/index.ts b/src/components/msg/index.ts
index ce443b0dce..63e4ca16e9 100644
--- a/src/components/msg/index.ts
+++ b/src/components/msg/index.ts
@@ -79,6 +79,8 @@ 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 SendToEth from './gravity/send_to_eth';
+import CancelSendToEth from './gravity/cancel_send_to_eth';
import CreateAddress from './addressbook/create_address';
import UpdateAddress from './addressbook/update_address';
import DeleteAddress from './addressbook/delete_address';
@@ -168,6 +170,8 @@ export {
UpdateContractAdmin,
ClearContractAdmin,
SendToCosmos,
+ SendToEth,
+ CancelSendToEth,
CreateAddress,
UpdateAddress,
DeleteAddress,
diff --git a/src/components/msg/staking/edit_validator/index.tsx b/src/components/msg/staking/edit_validator/index.tsx
index 90f640208f..f3d7e66c44 100644
--- a/src/components/msg/staking/edit_validator/index.tsx
+++ b/src/components/msg/staking/edit_validator/index.tsx
@@ -3,7 +3,6 @@ import Trans from 'next-translate/Trans';
import { Typography } from '@material-ui/core';
import { Name } from '@components';
import { MsgEditValidator } from '@models';
-import { VALIDATOR_DETAILS } from '@utils/go_to_page';
import { useProfileRecoil } from '@recoil/profiles';
const EditValidator = (props: {
@@ -24,7 +23,6 @@ const EditValidator = (props: {
),
]}
diff --git a/src/components/msg/utils.tsx b/src/components/msg/utils.tsx
index 06df13c3b0..4b3a0083a6 100644
--- a/src/components/msg/utils.tsx
+++ b/src/components/msg/utils.tsx
@@ -456,6 +456,18 @@ const getDataByType = (type: string) => {
tagTheme: 'four',
tagDisplay: 'MsgSendToCosmosClaim',
},
+ '/gravity.v1.MsgSendToEth': {
+ model: MODELS.MsgSendToEth,
+ content: COMPONENTS.SendToEth,
+ tagTheme: 'four',
+ tagDisplay: 'MsgSendToEth',
+ },
+ '/gravity.v1.MsgCancelSendToEth': {
+ model: MODELS.MsgCancelSendToEth,
+ content: COMPONENTS.CancelSendToEth,
+ tagTheme: 'four',
+ tagDisplay: 'MsgCancelSendToEth',
+ },
// ========================
// Addressbook
// ========================
diff --git a/src/components/name/index.tsx b/src/components/name/index.tsx
index 83fffa71a1..0518c9baa2 100644
--- a/src/components/name/index.tsx
+++ b/src/components/name/index.tsx
@@ -3,20 +3,21 @@ import classnames from 'classnames';
import Link from 'next/link';
import { Typography } from '@material-ui/core';
import { ADDRESS_DETAILS } from '@utils/go_to_page';
+import { AddressType } from '@src/configs';
import { useStyles } from './styles';
const Name: React.FC<{
className?: string;
address: string;
name: string;
- href?: (address: string) => string;
+ addressType?: AddressType;
}> = ({
- className, address, name, href = ADDRESS_DETAILS,
+ className, address, name, addressType,
}) => {
const classes = useStyles();
-
+ const href = ADDRESS_DETAILS(address, addressType);
return (
-
+
{name}
diff --git a/src/configs/index.ts b/src/configs/index.ts
index 32fd9d6973..fd546f31bf 100644
--- a/src/configs/index.ts
+++ b/src/configs/index.ts
@@ -8,17 +8,31 @@ import generalConfig from './general_config.json';
* @returns config
*/
const getChainConfig = () => {
- const chainType = process.env.NEXT_PUBLIC_CHAIN_TYPE || process.env.NEXT_PUBLIC_CHAIN_STATUS;
- if (chainType === 'mainnet') {
+ if (!isTestnet()) {
return chainConfigMainnet;
}
return chainConfigTestnet;
};
+const isTestnet = (): boolean => {
+ return getChainType() !== 'mainnet'
+}
+
+const getChainType = (): string => {
+ return process.env.NEXT_PUBLIC_CHAIN_TYPE || process.env.NEXT_PUBLIC_CHAIN_STATUS;
+}
+
+enum AddressType {
+ ETH = 'eth',
+ CUDOS = 'cudos'
+}
+
const chainConfig = getChainConfig();
export {
chainConfig,
generalConfig,
chainConfigTemp,
+ isTestnet,
+ AddressType
};
diff --git a/src/models/index.ts b/src/models/index.ts
index dcd5c69c9d..56e5b2beaf 100644
--- a/src/models/index.ts
+++ b/src/models/index.ts
@@ -76,6 +76,8 @@ 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 MsgSendToEth from './msg/gravity/msg_send_to_eth';
+import MsgCancelSendToEth from './msg/gravity/msg_cancel_send_to_eth';
import MsgCreateAddress from './msg/addressbook/msg_create_address';
import MsgUpdateAddress from './msg/addressbook/msg_update_address';
import MsgDeleteAddress from './msg/addressbook/msg_delete_address';
@@ -171,6 +173,8 @@ export {
MsgUpdateContractAdmin,
MsgClearContractAdmin,
MsgSendToCosmosClaim,
+ MsgSendToEth,
+ MsgCancelSendToEth,
MsgCreateAddress,
MsgUpdateAddress,
MsgDeleteAddress,
diff --git a/src/models/msg/gravity/msg_cancel_send_to_eth.ts b/src/models/msg/gravity/msg_cancel_send_to_eth.ts
new file mode 100644
index 0000000000..d77f9c6fe6
--- /dev/null
+++ b/src/models/msg/gravity/msg_cancel_send_to_eth.ts
@@ -0,0 +1,29 @@
+import { Categories } from '../types';
+
+class MsgCancelSendToEth {
+ public category: Categories;
+ public sender: string;
+ public transactionID: string;
+ public type: string;
+ public json: JSON;
+
+ constructor(payload: any) {
+ this.category = 'gravity';
+ this.sender = payload.sender;
+ this.transactionID = payload.transactionID;
+ this.type = payload.type;
+ this.json = payload.json;
+ }
+
+ static fromJson(json: any) {
+ return new MsgCancelSendToEth({
+ sender: json.sender,
+ transactionID: json.transaction_id,
+ type: json['@type'],
+ json,
+ });
+ }
+}
+
+export default MsgCancelSendToEth;
+
diff --git a/src/models/msg/gravity/msg_send_to_eth.ts b/src/models/msg/gravity/msg_send_to_eth.ts
new file mode 100644
index 0000000000..083af5edc6
--- /dev/null
+++ b/src/models/msg/gravity/msg_send_to_eth.ts
@@ -0,0 +1,32 @@
+import { Categories } from '../types';
+
+class MsgSendToEth {
+ public category: Categories;
+ public sender: string;
+ public amount: string;
+ public ethDest: string;
+ public type: string;
+ public json: JSON;
+
+ constructor(payload: any) {
+ this.category = 'gravity';
+ this.sender = payload.sender;
+ this.amount = payload.amount;
+ this.ethDest = payload.ethDest;
+ this.type = payload.type;
+ this.json = payload.json;
+ }
+
+ static fromJson(json: any) {
+ return new MsgSendToEth({
+ sender: json.sender,
+ amount: json.amount.amount,
+ ethDest: json.eth_dest,
+ type: json['@type'],
+ json,
+ });
+ }
+}
+
+export default MsgSendToEth;
+
diff --git a/src/utils/go_to_page.ts b/src/utils/go_to_page.ts
index 568ae8e937..8f781e4e68 100644
--- a/src/utils/go_to_page.ts
+++ b/src/utils/go_to_page.ts
@@ -1,23 +1,31 @@
-import { chainConfig } from '@configs';
+import { AddressType, chainConfig, isTestnet } from '@configs';
export const HOME = '/';
export const BLOCKS = '/blocks';
-export const BLOCK_DETAILS = (slot:string | number): string => `/blocks/${slot}`;
+export const BLOCK_DETAILS = (slot: string | number): string => `/blocks/${slot}`;
export const VALIDATOR_DETAILS = (address: string): string => `/validators/${address}`;
export const VALIDATORS = '/validators';
export const TRANSACTIONS = '/transactions';
export const TRANSACTION_DETAILS = (tx: string): string => `/transactions/${tx}`;
export const PROPOSALS = '/proposals';
-export const PROPOSAL_DETAILS = (id:string | number): string => `/proposals/${id}`;
-export const ACCOUNT_DETAILS = (address: string): string => `/accounts/${address}`;
+export const PROPOSAL_DETAILS = (id: string | number): string => `/proposals/${id}`;
+export const ACCOUNT_DETAILS = (address: string, addressType?: AddressType): string => {
+ if (addressType && addressType === AddressType.ETH) {
+ if (isTestnet()) {
+ return `https://sepolia.etherscan.io/address/${address}`
+ }
+ return `https://etherscan.io/address/${address}`
+ }
+ return `/accounts/${address}`
+};
export const TOKEN_DETAILS = (address: string): string => `/token/${address}`;
export const PARAMS = '/params';
-export const PROFILE_DETAILS = (dtag: string):string => `/${dtag}`;
+export const PROFILE_DETAILS = (dtag: string): string => `/${dtag}`;
/**
* Helper to determine if we are routing to validator details or account details
* @param address
* @returns
*/
-export const ADDRESS_DETAILS = (address: string) => (address.includes(chainConfig.prefix.validator)
- ? VALIDATOR_DETAILS(address) : ACCOUNT_DETAILS(address));
+export const ADDRESS_DETAILS = (address: string, addressType?: AddressType) => (address.includes(chainConfig.prefix.validator)
+ ? VALIDATOR_DETAILS(address) : ACCOUNT_DETAILS(address, addressType));
From 7bfff9499b42b8e12d5814777645822a671ae53b Mon Sep 17 00:00:00 2001
From: SpaghettiOverload
Date: Thu, 2 Nov 2023 15:32:57 +0200
Subject: [PATCH 20/21] CUDOS-2624-legacy, new proposals display, linter
---
src/configs/index.ts | 18 +-
.../msg/gravity/msg_cancel_send_to_eth.ts | 1 -
src/models/msg/gravity/msg_send_to_eth.ts | 1 -
.../components/overview/index.tsx | 182 ++++++------------
src/screens/proposal_details/utils.ts | 39 ++++
src/utils/go_to_page.ts | 10 +-
6 files changed, 113 insertions(+), 138 deletions(-)
diff --git a/src/configs/index.ts b/src/configs/index.ts
index fd546f31bf..554693c9b1 100644
--- a/src/configs/index.ts
+++ b/src/configs/index.ts
@@ -15,17 +15,12 @@ const getChainConfig = () => {
};
const isTestnet = (): boolean => {
- return getChainType() !== 'mainnet'
-}
+ return getChainType() !== 'mainnet';
+};
const getChainType = (): string => {
return process.env.NEXT_PUBLIC_CHAIN_TYPE || process.env.NEXT_PUBLIC_CHAIN_STATUS;
-}
-
-enum AddressType {
- ETH = 'eth',
- CUDOS = 'cudos'
-}
+};
const chainConfig = getChainConfig();
@@ -34,5 +29,10 @@ export {
generalConfig,
chainConfigTemp,
isTestnet,
- AddressType
};
+
+// eslint-disable-next-line no-shadow
+export enum AddressType {
+ ETH = 'eth',
+ CUDOS = 'cudos'
+}
diff --git a/src/models/msg/gravity/msg_cancel_send_to_eth.ts b/src/models/msg/gravity/msg_cancel_send_to_eth.ts
index d77f9c6fe6..504c408238 100644
--- a/src/models/msg/gravity/msg_cancel_send_to_eth.ts
+++ b/src/models/msg/gravity/msg_cancel_send_to_eth.ts
@@ -26,4 +26,3 @@ class MsgCancelSendToEth {
}
export default MsgCancelSendToEth;
-
diff --git a/src/models/msg/gravity/msg_send_to_eth.ts b/src/models/msg/gravity/msg_send_to_eth.ts
index 083af5edc6..6f03b1b6dd 100644
--- a/src/models/msg/gravity/msg_send_to_eth.ts
+++ b/src/models/msg/gravity/msg_send_to_eth.ts
@@ -29,4 +29,3 @@ class MsgSendToEth {
}
export default MsgSendToEth;
-
diff --git a/src/screens/proposal_details/components/overview/index.tsx b/src/screens/proposal_details/components/overview/index.tsx
index 2adbf004c4..d4692fdf52 100644
--- a/src/screens/proposal_details/components/overview/index.tsx
+++ b/src/screens/proposal_details/components/overview/index.tsx
@@ -1,5 +1,4 @@
import React from 'react';
-import * as R from 'ramda';
import numeral from 'numeral';
import classnames from 'classnames';
import dayjs, { formatDayJs } from '@utils/dayjs';
@@ -16,14 +15,8 @@ import {
Box,
Markdown,
} from '@components';
-import {
- ParamsChange,
- SoftwareUpgrade,
- IbcUpgrade,
- CommunitySpend,
-} from './components';
import { useStyles } from './styles';
-import { getProposalType } from '../../utils';
+import { getProposalContentString } from '../../utils';
const JSONPrettyMon = require('react-json-pretty/dist/monikai');
@@ -45,69 +38,7 @@ const Overview: React.FC<{
const classes = useStyles();
const { t } = useTranslation('proposals');
- const type = getProposalType(R.pathOr('', ['@type'], props.content));
-
- const getExtraDetails = () => {
- let extraDetails = null;
- if (type === 'parameterChangeProposal') {
- extraDetails = (
- <>
-
- {t('changes')}
-
-
- >
- );
- } else if (type === 'softwareUpgradeProposal') {
- extraDetails = (
- <>
-
- {t('plan')}
-
-
- >
- );
- } else if (type === 'communityPoolSpendProposal') {
- extraDetails = (
- <>
-
- {t('details')}
-
-
- >
- );
- } else if (type === 'IbcUpgradeProposal') {
- extraDetails = (
- <>
-
- {t('details')}
-
-
-
- {t('upgradedClientState')}
-
-
- >
- );
- }
-
- return extraDetails;
- };
-
- const extra = getExtraDetails();
+ const contentString = getProposalContentString(props.content);
return (
@@ -117,68 +48,73 @@ const Overview: React.FC<{
status={props.status}
/>
-
-
- {t('type')}
-
-
- {t(type)}
-
+
+ {contentString ? (
+
+ ) : null}
{t('description')}
- {extra}
{
- !!props.submitTime && (
-
-
- {t('submitTime')}
-
-
- {formatDayJs(dayjs.utc(props.submitTime), dateFormat)}
-
-
- )
- }
+ !!props.submitTime && (
+
+
+ {t('submitTime')}
+
+
+ {formatDayJs(dayjs.utc(props.submitTime), dateFormat)}
+
+
+ )
+ }
{
- !!props.depositEndTime && (
-
-
- {t('depositEndTime')}
-
-
- {formatDayJs(dayjs.utc(props.depositEndTime), dateFormat)}
-
-
- )
- }
+ !!props.depositEndTime && (
+
+
+ {t('depositEndTime')}
+
+
+ {formatDayJs(dayjs.utc(props.depositEndTime), dateFormat)}
+
+
+ )
+ }
{
- !!props.votingStartTime && (
-
-
- {t('votingStartTime')}
-
-
- {formatDayJs(dayjs.utc(props.votingStartTime), dateFormat)}
-
-
- )
- }
+ !!props.votingStartTime && (
+
+
+ {t('votingStartTime')}
+
+
+ {formatDayJs(dayjs.utc(props.votingStartTime), dateFormat)}
+
+
+ )
+ }
{
- !!props.votingEndTime && (
-
-
- {t('votingEndTime')}
-
-
- {formatDayJs(dayjs.utc(props.votingEndTime), dateFormat)}
-
-
- )
- }
+ !!props.votingEndTime && (
+
+
+ {t('votingEndTime')}
+
+
+ {formatDayJs(dayjs.utc(props.votingEndTime), dateFormat)}
+
+
+ )
+ }
);
diff --git a/src/screens/proposal_details/utils.ts b/src/screens/proposal_details/utils.ts
index 5be2e5f9ac..cf4d96eebd 100644
--- a/src/screens/proposal_details/utils.ts
+++ b/src/screens/proposal_details/utils.ts
@@ -1,3 +1,21 @@
+const LEGACY_PROPOSAL_TYPE = '/cosmos.gov.v1.MsgExecLegacyContent';
+
+const OmitFields = {
+ description: 'description',
+ title: 'title',
+ authority: 'authority',
+};
+
+type OmitKeys = keyof typeof OmitFields;
+
+const omitKeys =
>(obj: T, keys: OmitKeys[]): Omit => {
+ const res = { ...obj };
+ keys.forEach((key) => {
+ delete res[key as keyof T];
+ });
+ return res as Omit;
+};
+
export const getProposalType = (proposalType: string) => {
let type = proposalType;
if (proposalType === '/cosmos.gov.v1beta1.TextProposal') {
@@ -39,3 +57,24 @@ export const shouldShowData = (status: string) => (
'PROPOSAL_STATUS_FAILED',
].includes(status)
);
+
+const isLegacyProposal = (content: any): boolean => {
+ const contentType: string = content['@type'];
+ if (contentType) {
+ return contentType === LEGACY_PROPOSAL_TYPE;
+ }
+ return false;
+};
+
+export const getProposalContentString = (content: any): string | null => {
+ if (!content.length) {
+ return null;
+ }
+
+ let contentObject = content;
+ if (isLegacyProposal(contentObject[0])) {
+ contentObject = omitKeys(contentObject[0].content, Object.keys(OmitFields) as OmitKeys[]);
+ }
+
+ return JSON.stringify(contentObject, null, 2);
+};
diff --git a/src/utils/go_to_page.ts b/src/utils/go_to_page.ts
index 8f781e4e68..82480c5ec6 100644
--- a/src/utils/go_to_page.ts
+++ b/src/utils/go_to_page.ts
@@ -1,4 +1,6 @@
-import { AddressType, chainConfig, isTestnet } from '@configs';
+import {
+ AddressType, chainConfig, isTestnet,
+} from '@configs';
export const HOME = '/';
export const BLOCKS = '/blocks';
@@ -12,11 +14,11 @@ export const PROPOSAL_DETAILS = (id: string | number): string => `/proposals/${i
export const ACCOUNT_DETAILS = (address: string, addressType?: AddressType): string => {
if (addressType && addressType === AddressType.ETH) {
if (isTestnet()) {
- return `https://sepolia.etherscan.io/address/${address}`
+ return `https://sepolia.etherscan.io/address/${address}`;
}
- return `https://etherscan.io/address/${address}`
+ return `https://etherscan.io/address/${address}`;
}
- return `/accounts/${address}`
+ return `/accounts/${address}`;
};
export const TOKEN_DETAILS = (address: string): string => `/token/${address}`;
export const PARAMS = '/params';
From a80765a8a19f5f10b5cd298a18bf3a988cfec0c7 Mon Sep 17 00:00:00 2001
From: SpaghettiOverload
Date: Tue, 21 Nov 2023 15:18:45 +0200
Subject: [PATCH 21/21] CUDOS-2651 general group txs msgs recognition
---
public/locales/en/message_labels.json | 16 ++++++++-
src/components/msg/unknown/index.tsx | 9 ++++-
src/components/msg/utils.tsx | 51 +++++++++++++++++++++++++++
src/components/tag/styles.tsx | 4 +++
src/styles/createPalette.d.ts | 1 +
src/styles/theme/index.ts | 1 +
6 files changed, 80 insertions(+), 2 deletions(-)
diff --git a/public/locales/en/message_labels.json b/public/locales/en/message_labels.json
index e46089ec65..39369fa265 100644
--- a/public/locales/en/message_labels.json
+++ b/public/locales/en/message_labels.json
@@ -80,5 +80,19 @@
"txPublishNft": "Publish NFT for sale",
"txRemoveNft": "Remove NFT from sale",
"txUpdatePrice": "Update NFT price",
- "txBuyNft": "Buy NFT"
+ "txBuyNft": "Buy NFT",
+ "MsgCreateGroup":"Create Group",
+ "MsgCreateGroupPolicy":"Create Group Policy",
+ "MsgCreateGroupWithPolicy":"Create Group with Policy",
+ "MsgExec":"Execute Group Proposal",
+ "MsgLeaveGroup":"Leave Group",
+ "MsgSubmitProposal":"Submit Group Proposal",
+ "MsgUpdateGroupAdmin":"Update Group Admin",
+ "MsgUpdateGroupMembers":"Update Group Members",
+ "MsgUpdateGroupMetadata":"Update Group Metadata",
+ "MsgUpdateGroupPolicyAdmin":"Update Group Policy Admin",
+ "MsgUpdateGroupPolicyDecisionPolicy":"Update Group Decision Policy",
+ "MsgUpdateGroupPolicyMetadata":"Update Group Policy Metadata",
+ "MsgVote":"Group Proposal Vote",
+ "MsgWithdrawProposal":"Withdraw Proposal"
}
diff --git a/src/components/msg/unknown/index.tsx b/src/components/msg/unknown/index.tsx
index 16e7b36e46..8ff659e878 100644
--- a/src/components/msg/unknown/index.tsx
+++ b/src/components/msg/unknown/index.tsx
@@ -1,7 +1,10 @@
import React from 'react';
import { MsgUnknown } from '@models';
+import JSONPretty from 'react-json-pretty';
import { useGetStyles } from './styles';
+const JSONPrettyMon = require('react-json-pretty/dist/monikai');
+
const Unknown = (props: {
message: MsgUnknown;
}) => {
@@ -11,7 +14,11 @@ const Unknown = (props: {
return (
- {JSON.stringify(message.json, null, '\t')}
+
);
diff --git a/src/components/msg/utils.tsx b/src/components/msg/utils.tsx
index 4b3a0083a6..ec59b859de 100644
--- a/src/components/msg/utils.tsx
+++ b/src/components/msg/utils.tsx
@@ -5,6 +5,24 @@ import {
} from '@components';
import * as COMPONENTS from '@msg';
+// eslint-disable-next-line no-shadow
+export enum GroupMsgs {
+ MsgCreateGroup = 'MsgCreateGroup',
+ MsgUpdateGroupMembers = 'MsgUpdateGroupMembers',
+ MsgUpdateGroupAdmin = 'MsgUpdateGroupAdmin',
+ MsgUpdateGroupMetadata = 'MsgUpdateGroupMetadata',
+ MsgCreateGroupPolicy = 'MsgCreateGroupPolicy',
+ MsgCreateGroupWithPolicy = 'MsgCreateGroupWithPolicy',
+ MsgUpdateGroupPolicyAdmin = 'MsgUpdateGroupPolicyAdmin',
+ MsgUpdateGroupPolicyDecisionPolicy = 'MsgUpdateGroupPolicyDecisionPolicy',
+ MsgUpdateGroupPolicyMetadata = 'MsgUpdateGroupPolicyMetadata',
+ MsgSubmitProposal = 'MsgSubmitProposal',
+ MsgWithdrawProposal = 'MsgWithdrawProposal',
+ MsgVote = 'MsgVote',
+ MsgExec = 'MsgExec',
+ MsgLeaveGroup = 'MsgLeaveGroup'
+}
+
const getDataByType = (type: string) => {
// =====================================
// DO NOT UPDATE IF THIS IS A FORK.
@@ -564,6 +582,23 @@ const getDataByType = (type: string) => {
tagTheme: 'twentyTwo',
tagDisplay: 'txRemoveAdmin',
},
+ // ========================
+ // Group
+ // ========================
+ ...getGoupType(GroupMsgs.MsgCreateGroup, 'MsgCreateGroup'),
+ ...getGoupType(GroupMsgs.MsgCreateGroupPolicy, 'MsgCreateGroup'),
+ ...getGoupType(GroupMsgs.MsgCreateGroupWithPolicy, 'MsgCreateGroupWithPolicy'),
+ ...getGoupType(GroupMsgs.MsgExec, 'MsgCreateGroupWithPolicy'),
+ ...getGoupType(GroupMsgs.MsgLeaveGroup, 'MsgLeaveGroup'),
+ ...getGoupType(GroupMsgs.MsgSubmitProposal, 'MsgSubmitProposal'),
+ ...getGoupType(GroupMsgs.MsgUpdateGroupAdmin, 'MsgUpdateGroupAdmin'),
+ ...getGoupType(GroupMsgs.MsgUpdateGroupMembers, 'MsgUpdateGroupMembers'),
+ ...getGoupType(GroupMsgs.MsgUpdateGroupMetadata, 'MsgUpdateGroupMetadata'),
+ ...getGoupType(GroupMsgs.MsgUpdateGroupPolicyAdmin, 'MsgUpdateGroupPolicyAdmin'),
+ ...getGoupType(GroupMsgs.MsgUpdateGroupPolicyDecisionPolicy, 'MsgUpdateGroupPolicyDecisionPolicy'),
+ ...getGoupType(GroupMsgs.MsgUpdateGroupPolicyMetadata, 'MsgUpdateGroupPolicyMetadata'),
+ ...getGoupType(GroupMsgs.MsgVote, 'MsgVote'),
+ ...getGoupType(GroupMsgs.MsgWithdrawProposal, 'MsgWithdrawProposal'),
};
if (defaultTypeToModel[type]) return defaultTypeToModel[type];
@@ -642,3 +677,19 @@ export const convertMsgsToModels = (transaction: any) => {
return messages;
};
+
+export const getGoupType = (msgType: keyof typeof GroupMsgs, tagDisplay: string): {
+ [key: string]: { model: any, content: any, tagTheme: string, tagDisplay: string }
+} => {
+ const typeUrl = `cosmos.group.v1.${msgType}`;
+ const baseUrl = `/${typeUrl}`;
+ console.log(baseUrl)
+ return {
+ [baseUrl]: {
+ model: MODELS.MsgUnknown,
+ content: COMPONENTS.Unknown,
+ tagTheme: 'twentyThree',
+ tagDisplay,
+ },
+ };
+};
diff --git a/src/components/tag/styles.tsx b/src/components/tag/styles.tsx
index 71619d3718..6860390243 100644
--- a/src/components/tag/styles.tsx
+++ b/src/components/tag/styles.tsx
@@ -110,6 +110,10 @@ export const useStyles = () => {
color: theme.palette.custom.tags.twentyTwo,
background: Color(theme.palette.custom.tags.twentyTwo).alpha(0.2).string(),
},
+ twentyThree: {
+ color: theme.palette.custom.tags.twentyThree,
+ background: Color(theme.palette.custom.tags.twentyTwo).alpha(0.2).string(),
+ },
});
},
)();
diff --git a/src/styles/createPalette.d.ts b/src/styles/createPalette.d.ts
index 9dd29e6729..5122c5065c 100644
--- a/src/styles/createPalette.d.ts
+++ b/src/styles/createPalette.d.ts
@@ -47,6 +47,7 @@ declare module '@material-ui/core/styles/createPalette' {
twenty: string,
twentyOne: string,
twentyTwo: string,
+ twentyThree: string,
},
charts: {
zero: string;
diff --git a/src/styles/theme/index.ts b/src/styles/theme/index.ts
index 09cf3d195c..5f8f56ff99 100644
--- a/src/styles/theme/index.ts
+++ b/src/styles/theme/index.ts
@@ -129,6 +129,7 @@ export const common = {
twenty: '#D9C788',
twentyOne: '#FF720C',
twentyTwo: '#BA0086',
+ twentyThree: '#125180',
},
fonts: {
fontFive: '#FFFFFF',