Skip to content

Commit

Permalink
Merge pull request #914 from oraichain/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
haunv3 committed Aug 11, 2023
2 parents 1263fb8 + cd13092 commit d640ebf
Show file tree
Hide file tree
Showing 15 changed files with 545 additions and 364 deletions.
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"analyze": "source-map-explorer 'build/static/js/*.js'",
"vendor": "node scripts/vendor.js",
"start": "cross-env GENERATE_SOURCEMAP=false react-app-rewired start",
"postinstall": "patch-package",
"build": "cross-env GENERATE_SOURCEMAP=false DISABLE_ESLINT_PLUGIN=true react-app-rewired build",
"delete-maps": "yarn run delete-references-to-map-files && yarn run delete-map-files",
"delete-map-files": "find ./build -name '*.map' -delete",
Expand All @@ -23,10 +24,10 @@
"ctc": "all-contributors check"
},
"dependencies": {
"@cosmjs/cosmwasm-stargate": "^0.29.0",
"@cosmjs/math": "^0.29.0",
"@cosmjs/proto-signing": "^0.29.0",
"@cosmjs/stargate": "^0.29.0",
"@cosmjs/cosmwasm-stargate": "^0.31.0",
"@cosmjs/math": "^0.31.0",
"@cosmjs/proto-signing": "^0.31.0",
"@cosmjs/stargate": "^0.31.0",
"@hookform/error-message": "0.0.5",
"@hookform/resolvers": "^1.2.0",
"@keplr-wallet/cosmos": "^0.9.12",
Expand All @@ -51,7 +52,7 @@
"classnames": "^2.2.6",
"constant-case": "^3.0.4",
"copy-to-clipboard": "^3.3.1",
"cosmjs-types": "^0.5.2",
"cosmjs-types": "^0.8.0",
"draft-js": "^0.11.7",
"draftjs-to-html": "^0.9.1",
"firebase": "^7.13.2",
Expand Down Expand Up @@ -119,6 +120,7 @@
"jest-environment-jsdom-fourteen": "0.1.0",
"lint-staged": "^10.5.2",
"node-sass": "^7.0.1",
"patch-package": "^7.0.0",
"prettier": "^1.19.1",
"react-app-rewired": "^2.2.1",
"react-dev-utils": "12.0.1",
Expand Down
60 changes: 60 additions & 0 deletions patches/@cosmjs+stargate+0.31.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
diff --git a/node_modules/@cosmjs/stargate/build/modules/gov/queries.d.ts b/node_modules/@cosmjs/stargate/build/modules/gov/queries.d.ts
index 98a8f14..4f400b5 100644
--- a/node_modules/@cosmjs/stargate/build/modules/gov/queries.d.ts
+++ b/node_modules/@cosmjs/stargate/build/modules/gov/queries.d.ts
@@ -8,7 +8,7 @@ export type GovProposalId = string | number | Long | Uint64;
export interface GovExtension {
readonly gov: {
readonly params: (parametersType: GovParamsType) => Promise<QueryParamsResponse>;
- readonly proposals: (proposalStatus: ProposalStatus, depositor: string, voter: string, paginationKey?: Uint8Array) => Promise<QueryProposalsResponse>;
+ readonly proposals: (proposalStatus: ProposalStatus, depositor: string, voter: string, paginationKey?: Uint8Array, offset?: number, limit?: number) => Promise<QueryProposalsResponse>;
readonly proposal: (proposalId: GovProposalId) => Promise<QueryProposalResponse>;
readonly deposits: (proposalId: GovProposalId, paginationKey?: Uint8Array) => Promise<QueryDepositsResponse>;
readonly deposit: (proposalId: GovProposalId, depositorAddress: string) => Promise<QueryDepositResponse>;
diff --git a/node_modules/@cosmjs/stargate/build/modules/gov/queries.js b/node_modules/@cosmjs/stargate/build/modules/gov/queries.js
index 7368eb3..50d8cf8 100644
--- a/node_modules/@cosmjs/stargate/build/modules/gov/queries.js
+++ b/node_modules/@cosmjs/stargate/build/modules/gov/queries.js
@@ -14,12 +14,12 @@ function setupGovExtension(base) {
const response = await queryService.Params({ paramsType: parametersType });
return response;
},
- proposals: async (proposalStatus, depositorAddress, voterAddress, paginationKey) => {
+ proposals: async (proposalStatus, depositorAddress, voterAddress, paginationKey, offset, limit) => {
const response = await queryService.Proposals({
proposalStatus,
depositor: depositorAddress,
voter: voterAddress,
- pagination: (0, queryclient_1.createPagination)(paginationKey),
+ pagination: (0, queryclient_1.createPagination)(paginationKey,offset, limit),
});
return response;
},
diff --git a/node_modules/@cosmjs/stargate/build/queryclient/utils.d.ts b/node_modules/@cosmjs/stargate/build/queryclient/utils.d.ts
index 5317078..3359cc9 100644
--- a/node_modules/@cosmjs/stargate/build/queryclient/utils.d.ts
+++ b/node_modules/@cosmjs/stargate/build/queryclient/utils.d.ts
@@ -15,7 +15,7 @@ export declare function toAccAddress(address: string): Uint8Array;
* Use this with a query response's pagination next key to
* request the next page.
*/
-export declare function createPagination(paginationKey?: Uint8Array): PageRequest | undefined;
+export declare function createPagination(paginationKey?: Uint8Array, limit?: number, offset?: number): PageRequest | undefined;
export interface ProtobufRpcClient {
request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
}
diff --git a/node_modules/@cosmjs/stargate/build/queryclient/utils.js b/node_modules/@cosmjs/stargate/build/queryclient/utils.js
index 6f4ecaa..bf5327a 100644
--- a/node_modules/@cosmjs/stargate/build/queryclient/utils.js
+++ b/node_modules/@cosmjs/stargate/build/queryclient/utils.js
@@ -24,8 +24,8 @@ exports.toAccAddress = toAccAddress;
* Use this with a query response's pagination next key to
* request the next page.
*/
-function createPagination(paginationKey) {
- return paginationKey ? pagination_1.PageRequest.fromPartial({ key: paginationKey }) : undefined;
+function createPagination(paginationKey, offset = 0, limit= undefined) {
+ return offset ? pagination_1.PageRequest.fromPartial({ offset, reverse: true, limit }) : pagination_1.PageRequest.fromPartial({ limit, reverse: true, count_total: true });
}
exports.createPagination = createPagination;
function createProtobufRpcClient(base) {
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import classNames from "classnames/bind";
import { memo } from "react";
import PassedIcon from "src/icons/Proposals/PassedIcon";
import RejectedIcon from "src/icons/Proposals/RejectedIcon";
import ChartCard from './ChartCard/ChartCard';
import ChartCard from "./ChartCard/ChartCard";
import { formatDateTime } from "src/helpers/helper";
import styles from "./TopProposalCardList.module.scss";
import { NavLink } from "react-router-dom";
Expand Down Expand Up @@ -112,7 +112,7 @@ const TopProposalCardList = memo(({ data = [], type = null }) => {
<div className={cx("top-proposal-card-header")}>
<div className={cx("proposal-id-title")}>
<div className={cx("proposal-id")}>{item?.proposal_id ? "#" + item.proposal_id : "-"}</div>
<div className={cx("proposal-title")}>{item.type === txTypes.COSMOS_SDK_NEW_VERSION.EXECUTE_CONTRACT ? "Frontier List Token" + item?.title : item?.title ?? "-"}</div>
<div className={cx("proposal-title")}>{item?.title ? item.title : "-"}</div>
</div>
</div>

Expand All @@ -125,14 +125,14 @@ const TopProposalCardList = memo(({ data = [], type = null }) => {
<table>
<tbody>
<tr>
<td>
{/* <td>
<div className={cx("item-title")}>Proposer</div>
</td>
<td>
<NavLink className={cx("item-text")} to={`${consts.PATH.ACCOUNT}/${item?.proposer ?? 0}`}>
<span className={cx("item-text-proposer")}>{item?.proposer && reduceString(item?.proposer, 8, 8)}</span>
</NavLink>
</td>
</td> */}
</tr>

<tr>
Expand Down
14 changes: 9 additions & 5 deletions src/components/Tx/TxData/TxMessage/TxMessageContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ const TxMessageContent = ({
</div>
</>
)}
{compareTypeMessage(type, [txTypes.COSMOS_SDK.MSG_UPDATE_ADMIN_CONTRACT, txTypes.COSMOS_SDK_NEW_VERSION.MSG_UPDATE_ADMIN_CONTRACT]) && (
<>
{getAddressRow("Contract", value?.contract)}
{getAddressRow("Sender", value?.sender)}
{getAddressRow("New Admin", value?.new_admin)}
{getCurrencyRowFromObject("Init funds", value?.init_funds ?? value?.funds)}
</>
)}
{compareTypeMessage(type, [txTypes.COSMOS_SDK.MSG_DELEGATE, txTypes.COSMOS_SDK_NEW_VERSION.MSG_DELEGATE]) && (
<>
{getAddressRow("Delegator Address", value?.delegator_address, value?.delegator_address_tag)}
Expand Down Expand Up @@ -343,7 +351,6 @@ const TxMessageContent = ({
</>
)}


{/* update 23/3/2023: add IBC progress for MsgExecute */}
{compareTypeMessage(type, [txTypes.COSMOS_SDK.EXECUTE_CONTRACT, txTypes.COSMOS_SDK_NEW_VERSION.EXECUTE_CONTRACT]) && (
<>
Expand All @@ -366,7 +373,6 @@ const TxMessageContent = ({
</>
)}


{/* add IBC Progress */}

{compareTypeMessage(type, [txTypes.COSMOS_SDK.MSG_IBC_TRANSFER, txTypes.COSMOS_SDK_NEW_VERSION.MSG_IBC_TRANSFER]) && (
Expand Down Expand Up @@ -607,9 +613,7 @@ const TxMessageContent = ({
</InfoRow>
</>
)}
{
getRawLog(data?.raw_log)
}
{getRawLog(data?.raw_log)}
</div>
</>
);
Expand Down
12 changes: 7 additions & 5 deletions src/components/common/StatusBox/StatusBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { showAlert } from "src/store/modules/global";
import { ORAI } from "src/lib/config/constants";
import { Tooltip } from "antd";
import { QuestionCircleOutlined } from "@ant-design/icons";
import { updateBondedToken } from "src/store/modules/proposal";

const StatusBox = memo(() => {
const cx = classNames.bind(styles);
Expand All @@ -31,12 +32,12 @@ const StatusBox = memo(() => {
},
});

const { data: communityPool, refetch: refetchPool, error: errorPool } = useGet({
const { data: communityPool, refetch: refetchPool, error: errorPool } = useGet({
path: `${consts.LCD_API_BASE}${consts.LCD_API.COMMUNITY_POOL}`,
resolve: ({ pool }) => {
const oraiPool = pool.find(pool => pool.denom === ORAI);
// fallback case if the api has any problem
if (!oraiPool) return { denom: ORAI.toUpperCase(), amount: "-1" }
if (!oraiPool) return { denom: ORAI.toUpperCase(), amount: "-1" };
setLoadCommunityPoolCompleted(true);
dispatch(setStatusBox(oraiPool));
return oraiPool;
Expand Down Expand Up @@ -82,7 +83,8 @@ const StatusBox = memo(() => {
useEffect(() => {
calculateInflationFromApr()
.then(inflation => {
setWantedInflationRate(inflation);
setWantedInflationRate(inflation.inflationRate);
dispatch(updateBondedToken(inflation?.bonded_tokens));
})
.catch(err => {
console.log("error getting wanted inflation rate: ", err.message);
Expand Down Expand Up @@ -113,8 +115,8 @@ const StatusBox = memo(() => {
</div>
</div>
<div className={cx("status-box-item")}>
<span className={cx("status-label")}>Community Pool: </span>
<span className={cx("status-value")}>{formatOrai(communityPool?.amount, 1000000, 2) + ' ' + communityPool?.denom.toUpperCase()}</span>
<span className={cx("status-label")}>DAO Treasury: </span>
<span className={cx("status-value")}>{formatOrai(communityPool?.amount, 1000000, 2) + " " + communityPool?.denom.toUpperCase()}</span>
</div>
</div>
);
Expand Down
7 changes: 4 additions & 3 deletions src/constants/txTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ export default Object.freeze({
MSG_CHANNEL_OPEN_INIT: "/ibc.core.channel.v1beta1.MsgChannelOpenInit",
MSG_CHANNEL_OPEN_ACK: "/ibc.core.channel.v1beta1.MsgChannelOpenAck",
MSG_CHANNEL_ACKNOWLEDGEMENT: "/ibc.core.channel.v1beta1.MsgAcknowledgement",
MSG_TIMEOUT: "/ibc.core.channel.v1beta1.MsgTimeout"
MSG_UPDATE_ADMIN_CONTRACT: "/cosmwasm.wasm.v1beta1.MsgUpdateAdmin",
MSG_TIMEOUT: "/ibc.core.channel.v1beta1.MsgTimeout",
},


// MIGRATE VERSION COSMOS
COSMOS_SDK_NEW_VERSION: {
MSG_UPDATE_ADMIN_CONTRACT: "/cosmwasm.wasm.v1.MsgUpdateAdmin",
MSG_CREATE_VALIDATOR: "/cosmos.staking.v1.MsgCreateValidator",
MSG_DELEGATE: "/cosmos.staking.v1.MsgDelegate",
MSG_UNDELEGATE: "/cosmos.staking.v1.MsgUndelegate",
Expand Down Expand Up @@ -69,7 +70,7 @@ export default Object.freeze({
MSG_CHANNEL_OPEN_INIT: "/ibc.core.channel.v1.MsgChannelOpenInit",
MSG_CHANNEL_OPEN_ACK: "/ibc.core.channel.v1.MsgChannelOpenAck",
MSG_CHANNEL_ACKNOWLEDGEMENT: "/ibc.core.channel.v1.MsgAcknowledgement",
MSG_TIMEOUT: "/ibc.core.channel.v1.MsgTimeout"
MSG_TIMEOUT: "/ibc.core.channel.v1.MsgTimeout",
},

// DEX
Expand Down
Loading

0 comments on commit d640ebf

Please sign in to comment.