Skip to content

Commit

Permalink
Merge pull request #482 from provenance-io/jarryd/update-wcjs-and-wal…
Browse files Browse the repository at this point in the history
…let-utils-versions

Update for proposals and voting
  • Loading branch information
jarrydallison authored Jan 26, 2023
2 parents 3aab749 + 6f786dc commit b4a532b
Show file tree
Hide file tree
Showing 11 changed files with 8,941 additions and 19,557 deletions.
3 changes: 2 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
save-exact=true
save-exact=true
legacy-peer-deps=true
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Bug Fixes

### Features
- Update wcjs and wallet utils versions #481

## 3.5.0

Expand Down
28,426 changes: 8,897 additions & 19,529 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"private": false,
"sideEffects": false,
"dependencies": {
"@provenanceio/wallet-utils": "2.3.0",
"@provenanceio/walletconnect-js": "2.0.5",
"@provenanceio/wallet-utils": "2.6.0",
"@provenanceio/walletconnect-js": "2.1.1",
"@reduxjs/toolkit": "1.8.1",
"bech32": "2.0.0",
"big.js": "6.1.1",
Expand All @@ -21,7 +21,6 @@
"echarts": "5.2.2",
"format-number": "3.0.0",
"formik": "2.2.9",
"let-it-snow": "1.1.6",
"query-string": "7.0.1",
"react": "17.0.2",
"react-datepicker": "4.1.1",
Expand Down
6 changes: 3 additions & 3 deletions src/Components/Summary/Summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,12 @@ const buildSummaryValue = (rowData: RowDataProps, theme: string) => {
return finalValue;
};

const buildSummaryRow = (rowData: RowDataProps, theme: string) => {
const buildSummaryRow = (rowData: RowDataProps, theme: string, index: number) => {
const { isJson, nobreak = false, title, value, hover = '', table } = rowData;
const valueMissing = value === undefined || value === null || value === '';

return (
<SummaryRow key={title} isJson={isJson || false} nobreak={nobreak}>
<SummaryRow key={`${title} ${index}`} isJson={isJson || false} nobreak={nobreak}>
<SummaryTitle>{title}:</SummaryTitle>
{table && (
<Table
Expand Down Expand Up @@ -308,5 +308,5 @@ export interface SummaryDataProps {

export const Summary = ({ data }: SummaryDataProps) => {
const { themeName } = useColorScheme();
return <>{data.map((rowData) => buildSummaryRow(rowData, themeName))}</>;
return <>{data.map((rowData, index) => buildSummaryRow(rowData, themeName, index))}</>;
};
5 changes: 5 additions & 0 deletions src/Pages/Proposals/Components/ManageProposalModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ const ManageProposalModal = ({

const handleModalClose = () => {
setSubmitted(false);

onClose();
setProposalType('text');
};
Expand Down Expand Up @@ -189,6 +190,10 @@ const ManageProposalModal = ({
// Set proposal type back to default
setProposalType('text');
// Clear the form
// Set initial deposit back to zero.
proposalContent(values as unknown as ContentProps).initialDeposit = [
{ amount: '0', denom: 'nhash' },
];
resetForm();
}}
>
Expand Down
15 changes: 10 additions & 5 deletions src/consts/proposals.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
// TO-DO: Re-allow Instantiate/Params when available

export const PROPOSAL_TYPES: { [key: string]: string } = {
TEXT: 'text',
SOFTWARE_UPGRADE: 'software upgrade',
CANCEL_SOFTWARE_UPGRADE: 'cancel upgrade',
STORE_CODE: 'store code',
INSTANTIATE_CODE: 'instantiate contract',
PARAMS_CHANGE: 'parameter change',
// INSTANTIATE_CODE: 'instantiate contract',
// PARAMS_CHANGE: 'parameter change',
//TO-DOS:
//COMMUNITY_POOL_SPEND: 'community pool spend',
//COMMUNITY_POOL_SPEND_WITH_DEPOSIT: 'community pool spend with deposit',
};

export const ACCESS_TYPES = {
NOBODY: 'nobody',
ONLY_ADDRESS: 'only address',
EVERYBODY: 'everybody',
ACCESS_TYPE_UNSPECIFIED: 'ACCESS_TYPE_UNSPECIFIED',
ACCESS_TYPE_NOBODY: 'ACCESS_TYPE_NOBODY',
ACCESS_TYPE_ONLY_ADDRESS: 'ACCESS_TYPE_ONLY_ADDRESS',
ACCESS_TYPE_EVERYBODY: 'ACCESS_TYPE_EVERYBODY',
// TO-DO: incorporate this option
// ACCESS_TYPE_ANY_OF_ADDRESSES: '',
};
17 changes: 10 additions & 7 deletions src/utils/proposals/proposalContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ export interface ContentProps {
height?: number;
info?: string;
runAs?: string;
accessConfig?: {
type: string;
address: string | null;
};
accessType?: string;
address?: string;
admin?: string;
codeId?: number;
label?: string;
Expand All @@ -42,7 +40,8 @@ export const proposalContent = ({
height,
info,
runAs,
accessConfig,
accessType,
address,
admin,
codeId,
label,
Expand All @@ -57,7 +56,8 @@ export const proposalContent = ({
height ||
info ||
runAs ||
accessConfig ||
accessType ||
address ||
admin ||
codeId ||
label ||
Expand All @@ -69,7 +69,10 @@ export const proposalContent = ({
height,
info,
runAs,
accessConfig,
...(accessType &&
accessType !== 'ACCESS_TYPE_UNSPECIFIED' && {
accessConfig: { type: accessType, address },
}),
admin,
codeId,
label,
Expand Down
15 changes: 8 additions & 7 deletions src/utils/proposals/proposalData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,14 @@ export const proposalData = (proposalType: string) => {
label: 'WASM Byte Code',
field: 'file',
},
{
type: 'dropdown',
dropdown: ACCESS_TYPES,
initialValue: ACCESS_TYPES.NOBODY,
label: 'access type',
field: 'accessType',
},
// TODO: Re-allow once proposals are discussed
// {
// type: 'dropdown',
// dropdown: ACCESS_TYPES,
// initialValue: ACCESS_TYPES.ACCESS_TYPE_UNSPECIFIED,
// label: 'access type',
// field: 'accessType',
// },
// This is conditional based on the access type ONLY_ADDRESS
{
type: 'text',
Expand Down
2 changes: 1 addition & 1 deletion src/utils/proposals/proposalValidations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const proposalValidations = (proposalType: string, blocksHeight: number)
)
.test('fileSize', 'Files must be less than 1MB', checkMaxFileSize),
address: yup.string().when(['accessType'], {
is: (accessType: string) => accessType === ACCESS_TYPES.ONLY_ADDRESS,
is: (accessType: string) => accessType === ACCESS_TYPES.ACCESS_TYPE_NOBODY,
then: yup.string().required('Address is required for "address only" access type'),
}),
initialDeposit,
Expand Down
3 changes: 2 additions & 1 deletion src/utils/table/formatTableData.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ export const formatTableData = (data = [], tableHeaders) => {
case 'votingTime.endTime': //fallthrough
case 'votingTime.startTime': {
const value = serverValue
? getUTCTime(serverValue).slice(0, 4) !== '1901'
? getUTCTime(serverValue).slice(0, 4) !== '1901' &&
getUTCTime(serverValue).slice(0, 4) !== '1970'
? `${getUTCTime(serverValue)}+UTC`
: '--'
: 'N/A';
Expand Down

0 comments on commit b4a532b

Please sign in to comment.