diff --git a/src/components/DepositCapMessage.tsx b/src/components/DepositCapMessage.tsx
index 6053d4f0..6aaee248 100644
--- a/src/components/DepositCapMessage.tsx
+++ b/src/components/DepositCapMessage.tsx
@@ -33,7 +33,7 @@ export default function DepositCapMessage(props: Props) {
Cap Left:
} />}
} />
+ } />
} />
} />
{ENABLE_PERPS && } />}
diff --git a/src/components/Trade/TradeModule/AssetSelector/AssetSelectorPair.tsx b/src/components/Trade/TradeModule/AssetSelector/AssetSelectorPair.tsx
index 77bcc6e2..5256ecf0 100644
--- a/src/components/Trade/TradeModule/AssetSelector/AssetSelectorPair.tsx
+++ b/src/components/Trade/TradeModule/AssetSelector/AssetSelectorPair.tsx
@@ -35,18 +35,21 @@ export default function AssetSelectorPair(props: Props) {
}, [])
return (
-
-
- {buyAsset.symbol}/{sellAsset.symbol}
-
+ <>
-
+ >
)
}
diff --git a/src/pages/ExecuteMessagePage.tsx b/src/pages/ExecuteMessagePage.tsx
new file mode 100644
index 00000000..1a1a665f
--- /dev/null
+++ b/src/pages/ExecuteMessagePage.tsx
@@ -0,0 +1,93 @@
+import { useState } from 'react'
+import { useSearchParams } from 'react-router-dom'
+
+import Text from 'components/Text'
+import WarningMessages from 'components/WarningMessages'
+import { ENV } from 'constants/env'
+import useStore from 'store'
+
+import ActionButton from '../components/Button/ActionButton'
+
+export default function ExecuteMessagePage() {
+ const [searchParams] = useSearchParams()
+
+ const [contract, setContract] = useState(
+ searchParams.get('contract') ?? ENV.ADDRESS_CREDIT_MANAGER,
+ )
+ const [message, setMessage] = useState(atob(searchParams.get('msg') ?? ''))
+ const [funds, setFunds] = useState(atob(searchParams.get('funds') ?? ''))
+
+ const [messageWarnings, setMessageWarnings] = useState([])
+ const [fundsWarnings, setFundsWarnings] = useState([])
+
+ const execute = useStore((s) => s.execute)
+
+ function onChangeTextArea(value: string) {
+ setMessage(value)
+
+ try {
+ if (value !== '') JSON.parse(value)
+ setMessageWarnings([])
+ } catch {
+ setMessageWarnings(['Invalid JSON'])
+ }
+ }
+
+ function onChangeFunds(value: string) {
+ setFunds(value)
+
+ try {
+ if (value !== '') JSON.parse(value)
+ setFundsWarnings([])
+ } catch {
+ setFundsWarnings(['Invalid JSON'])
+ }
+ }
+
+ return (
+
+
Execute Custom Message
+
+
+
+
+
+
{
+ execute(contract, JSON.parse(message), funds ? JSON.parse(funds) : [])
+ }}
+ disabled={fundsWarnings.length > 0 || !contract || messageWarnings.length > 0 || !message}
+ />
+
+ )
+}
diff --git a/src/store/slices/broadcast.ts b/src/store/slices/broadcast.ts
index fe50d381..8289c77e 100644
--- a/src/store/slices/broadcast.ts
+++ b/src/store/slices/broadcast.ts
@@ -14,6 +14,7 @@ import {
ActionCoin,
Action as CreditManagerAction,
ExecuteMsg as CreditManagerExecuteMsg,
+ ExecuteMsg,
} from 'types/generated/mars-credit-manager/MarsCreditManager.types'
import { AccountKind } from 'types/generated/mars-rover-health-types/MarsRoverHealthTypes.types'
import { getAssetByDenom, getAssetBySymbol, getPythAssets } from 'utils/assets'
@@ -184,6 +185,7 @@ export default function createBroadcastSlice(
get().setToast({
response,
+
options: {
action: 'hls-staking',
accountId: options.accountId,
@@ -194,6 +196,18 @@ export default function createBroadcastSlice(
return response.then((response) => !!response.result)
},
+ execute: async (contract: string, msg: ExecuteMsg, funds: Coin[]) => {
+ const response = get().executeMsg({
+ messages: [generateExecutionMessage(get().address, contract, msg, funds)],
+ })
+
+ get().setToast({
+ response,
+ options: { action: 'deposit', message: `Executed message` },
+ })
+
+ return response
+ },
borrow: async (options: { accountId: string; coin: BNCoin; borrowToWallet: boolean }) => {
const borrowAction: Action = { borrow: options.coin.toCoin() }
const withdrawAction: Action = { withdraw: options.coin.toActionCoin() }
diff --git a/src/types/interfaces/route.d.ts b/src/types/interfaces/route.d.ts
index 216b8c56..cbd0f1c5 100644
--- a/src/types/interfaces/route.d.ts
+++ b/src/types/interfaces/route.d.ts
@@ -10,3 +10,4 @@ type Page =
| 'hls-farm'
| 'hls-staking'
| 'governance'
+ | 'execute'
diff --git a/src/types/interfaces/store/broadcast.d.ts b/src/types/interfaces/store/broadcast.d.ts
index 4b8bfb05..6849e131 100644
--- a/src/types/interfaces/store/broadcast.d.ts
+++ b/src/types/interfaces/store/broadcast.d.ts
@@ -107,6 +107,7 @@ interface BroadcastSlice {
isCreate: boolean
kind: import('types/generated/mars-rover-health-types/MarsRoverHealthTypes.types').AccountKind
}) => Promise
+ execute: (contract: string, msg: ExecuteMsg, funds: Coin[]) => Promise
executeMsg: (options: { messages: MsgExecuteContract[] }) => Promise
lend: (options: { accountId: string; coin: BNCoin; isMax?: boolean }) => Promise
reclaim: (options: { accountId: string; coin: BNCoin; isMax?: boolean }) => Promise
diff --git a/src/utils/route.ts b/src/utils/route.ts
index 1ca2b6a8..c8697554 100644
--- a/src/utils/route.ts
+++ b/src/utils/route.ts
@@ -28,6 +28,7 @@ export function getRoute(
export function getPage(pathname: string): Page {
const pages: Page[] = [
+ 'execute',
'trade',
'trade-advanced',
'perps',