-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
431 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
packages/stateful/actions/core/advanced/IcaExecute/Component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { useTranslation } from 'react-i18next' | ||
|
||
import { | ||
NestedActionsEditor, | ||
NestedActionsEditorOptions, | ||
NestedActionsRenderer, | ||
NestedActionsRendererProps, | ||
} from '@dao-dao/stateless' | ||
import { NestedActionsEditorFormData } from '@dao-dao/types' | ||
import { ActionComponent } from '@dao-dao/types/actions' | ||
|
||
export type IcaExecuteData = { | ||
chainId: string | ||
// Set automatically once chain ID is chosen. | ||
icaRemoteAddress: string | ||
} & NestedActionsEditorFormData | ||
|
||
export type IcaExecuteOptions = NestedActionsEditorOptions & | ||
Omit<NestedActionsRendererProps, 'msgsFieldName'> | ||
|
||
export const IcaExecuteComponent: ActionComponent<IcaExecuteOptions> = ( | ||
props | ||
) => { | ||
const { t } = useTranslation() | ||
const { fieldNamePrefix, isCreating, options } = props | ||
|
||
return ( | ||
<> | ||
<p className="title-text -mb-1">{t('title.actions')}</p> | ||
|
||
{isCreating ? ( | ||
<NestedActionsEditor {...props} /> | ||
) : ( | ||
<div className="flex flex-col gap-2"> | ||
<NestedActionsRenderer | ||
{...options} | ||
msgsFieldName={fieldNamePrefix + 'msgs'} | ||
/> | ||
</div> | ||
)} | ||
</> | ||
) | ||
} |
29 changes: 29 additions & 0 deletions
29
packages/stateful/actions/core/advanced/IcaExecute/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# IcaExecute | ||
|
||
Execute messages from an ICA account. | ||
|
||
## Bulk import format | ||
|
||
This is relevant when bulk importing actions, as described in [this | ||
guide](https://github.com/DA0-DA0/dao-dao-ui/wiki/Bulk-importing-actions). | ||
|
||
### Key | ||
|
||
`icaExecute` | ||
|
||
### Data format | ||
|
||
```json | ||
{ | ||
"chainId": "<CHAIN ID>", | ||
"_actionData": [ | ||
// ACTIONS | ||
] | ||
} | ||
``` | ||
|
||
Each action in `_actionData` should be formatted similar to how bulk actions are | ||
formatted, with `key` and `data` fields, except `key` should be replaced with | ||
`actionKey`. Thus, each object in `_actionData` should be an object with | ||
`actionKey` and `data`, formatted the same as the `actions` array in the bulk | ||
JSON format. |
Oops, something went wrong.