Cover the rest of generic messages for authz grant & revoke
This commit is contained in:
parent
1015590bed
commit
58ae7c05af
@ -149,6 +149,46 @@ const Grant: NextPage = () => {
|
||||
(expiration?.getTime() as number) / 1000 || 0,
|
||||
)
|
||||
}
|
||||
if (genericAuthType === 'MsgBeginRedelegate') {
|
||||
return AuthzGenericGrantMsg(
|
||||
wallet.address || '',
|
||||
granteeAddressState.value,
|
||||
'/cosmos.staking.v1beta1.MsgBeginRedelegate',
|
||||
(expiration?.getTime() as number) / 1000 || 0,
|
||||
)
|
||||
}
|
||||
if (genericAuthType === 'MsgWithdrawDelegatorReward') {
|
||||
return AuthzGenericGrantMsg(
|
||||
wallet.address || '',
|
||||
granteeAddressState.value,
|
||||
'/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward',
|
||||
(expiration?.getTime() as number) / 1000 || 0,
|
||||
)
|
||||
}
|
||||
if (genericAuthType === 'MsgVote') {
|
||||
return AuthzGenericGrantMsg(
|
||||
wallet.address || '',
|
||||
granteeAddressState.value,
|
||||
'/cosmos.gov.v1beta1.MsgVote',
|
||||
(expiration?.getTime() as number) / 1000 || 0,
|
||||
)
|
||||
}
|
||||
if (genericAuthType === 'MsgExecuteContract') {
|
||||
return AuthzGenericGrantMsg(
|
||||
wallet.address || '',
|
||||
granteeAddressState.value,
|
||||
'/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
(expiration?.getTime() as number) / 1000 || 0,
|
||||
)
|
||||
}
|
||||
if (genericAuthType === 'MsgMigrateContract') {
|
||||
return AuthzGenericGrantMsg(
|
||||
wallet.address || '',
|
||||
granteeAddressState.value,
|
||||
'/cosmwasm.wasm.v1.MsgMigrateContract',
|
||||
(expiration?.getTime() as number) / 1000 || 0,
|
||||
)
|
||||
}
|
||||
} else if (authType === 'Send') {
|
||||
return AuthzSendGrantMsg(
|
||||
wallet.address || '',
|
||||
@ -227,28 +267,20 @@ const Grant: NextPage = () => {
|
||||
<option value="MsgSend">Send</option>
|
||||
<option value="MsgDelegate">Delegate</option>
|
||||
<option value="MsgUndelegate">Undelegate</option>
|
||||
<option disabled value="MsgBeginRedelegate">
|
||||
Redelegate
|
||||
</option>
|
||||
<option disabled value="MsgWithdrawDelegatorReward">
|
||||
Withdraw Delegator Reward
|
||||
</option>
|
||||
<option disabled value="MsgVote">
|
||||
Vote
|
||||
</option>
|
||||
<option disabled value="MsgExecuteContract">
|
||||
Execute Contract
|
||||
</option>
|
||||
<option disabled value="MsgMigrateContract">
|
||||
Migrate Contract
|
||||
</option>
|
||||
<option value="MsgBeginRedelegate">Redelegate</option>
|
||||
<option value="MsgWithdrawDelegatorReward">Withdraw Delegator Reward</option>
|
||||
<option value="MsgVote">Vote</option>
|
||||
<option value="MsgExecuteContract">Execute Contract</option>
|
||||
<option value="MsgMigrateContract">Migrate Contract</option>
|
||||
</select>
|
||||
</div>
|
||||
</Conditional>
|
||||
<TextInput className="w-2/5" {...granteeAddressState} />
|
||||
<Conditional test={authType === 'Send'}>
|
||||
<NumberInput className="w-1/4" {...spendLimitState} />
|
||||
<TextInput className="w-1/4" {...spendLimitDenomState} />
|
||||
<div className="flex flex-row">
|
||||
<NumberInput className="w-1/4" {...spendLimitState} />
|
||||
<TextInput className="w-1/4 ml-2" {...spendLimitDenomState} />
|
||||
</div>
|
||||
{/* <TextInput className="w-2/5" {...allowListState} /> */}
|
||||
</Conditional>
|
||||
<Conditional test={authType === 'Execute Smart Contract'}>
|
||||
|
||||
@ -51,7 +51,7 @@ const RevokeAuthorization: NextPage = () => {
|
||||
gasPrice: GasPrice.fromString('0.25ustars'),
|
||||
})
|
||||
|
||||
const result = await stargateClient.signAndBroadcast(
|
||||
const response = await stargateClient.signAndBroadcast(
|
||||
wallet.address || '',
|
||||
[
|
||||
{
|
||||
@ -68,8 +68,9 @@ const RevokeAuthorization: NextPage = () => {
|
||||
gas: '200000',
|
||||
},
|
||||
)
|
||||
setTransactionHash(result.transactionHash)
|
||||
toast.success(`Revoke authorization success.`, { style: { maxWidth: 'none' } })
|
||||
setTransactionHash(response.transactionHash)
|
||||
if (response.rawLog?.includes('failed')) toast.error(response.rawLog, { style: { maxWidth: 'none' } })
|
||||
else toast.success(`Revoke authorization success.`, { style: { maxWidth: 'none' } })
|
||||
setIsLoading(false)
|
||||
} catch (e: any) {
|
||||
console.log(e)
|
||||
@ -103,15 +104,30 @@ const RevokeAuthorization: NextPage = () => {
|
||||
<option className="bg-black" value="/cosmos.staking.v1beta1.MsgUndelegate">
|
||||
/cosmos.staking.v1beta1.MsgUndelegate
|
||||
</option>
|
||||
<option className="bg-black" value="/cosmos.bank.v1beta1.SendAuthorization">
|
||||
<option className="bg-black" value="/cosmos.staking.v1beta1.MsgBeginRedelegate">
|
||||
/cosmos.staking.v1beta1.MsgBeginRedelegate
|
||||
</option>
|
||||
<option className="bg-black" value="/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward">
|
||||
/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward
|
||||
</option>
|
||||
<option className="bg-black" value="/cosmos.gov.v1beta1.MsgVote">
|
||||
/cosmos.gov.v1beta1.MsgVote
|
||||
</option>
|
||||
<option className="bg-black" value="/cosmwasm.wasm.v1.MsgExecuteContract">
|
||||
/cosmwasm.wasm.v1.MsgExecuteContract
|
||||
</option>
|
||||
<option className="bg-black" value="/cosmwasm.wasm.v1.MsgMigrateContract">
|
||||
/cosmwasm.wasm.v1.MsgMigrateContract
|
||||
</option>
|
||||
<option className="bg-black" disabled value="/cosmos.bank.v1beta1.SendAuthorization">
|
||||
/cosmos.bank.v1beta1.SendAuthorization
|
||||
</option>
|
||||
<option className="bg-black" value="/cosmwasm.wasm.v1.ContractExecutionAuthorization">
|
||||
<option className="bg-black" disabled value="/cosmwasm.wasm.v1.ContractExecutionAuthorization">
|
||||
/cosmwasm.wasm.v1.ContractExecutionAuthorization
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<TextInput className="w-1/3" {...granteeAddressState} />
|
||||
<TextInput className="w-2/5" {...granteeAddressState} />
|
||||
{/* <TextInput className="w-1/3" {...messageState} /> */}
|
||||
<Button
|
||||
className="text-white bg-stargaze btn"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user