Skip to content

Bulk importing actions

noah edited this page Nov 20, 2023 · 11 revisions

To bulk import actions, you can use the Bulk Import Actions action in the Advanced category: Screenshot 2023-11-20 at 14 29 50

You can use either a JSON file or a CSV file. CSV files are easier to use but only support some of the actions, whereas JSON files support all actions.

JSON

The JSON file (with extension .json) must be formatted with one top-level actions key, which is an array of actions, like this:

{
  "actions": [
    // INSERT ACTIONS HERE
  ]
}

An action looks like this:

{
  "key": "<ACTION KEY>",
  "data": {
    // INSERT ACTION DATA HERE
  }
}

CSV

The CSV file (with extension .csv) must have a header with an ACTION column and columns for each key in the data object of an action. Only actions with flat data objects (i.e. no nested objects or arrays) are supported.

A CSV that imports a bunch of Spend actions would look like this:

ACTION,to,amount,denom
spend,junoAddress,5,ujuno
spend,anotherJunoAddress,5,ujuno
spend,junoAddress,1,ibc/EAC38D55372F38F1AFD68DF7FE9EF762DCF69F26520643CF3F9D292A738D8034

Action keys

The action keys can be found in @dao-dao/types/actions.ts in the ActionKey enum. For example:

  • spend
  • mintNft
  • execute
  • mint

The key and data format for an action are defined in its README.md, and the actions can be found in the following places:

Here are some common ones:

spend

For sending money from the treasury.

{
  "to": "<RECIPIENT ADDRESS>",
  "amount": "<TOKEN AMOUNT>",
  "denom": "<TOKEN DENOM>"
}

mintNft

For minting an NFT in a collection the DAO controls.

{
  "contractChosen": true,
  "collectionAddress": "<NFT COLLECTION ADDRESS>",
  "mintMsg": {
    "owner": "<RECIPIENT ADDRESS>",
    "token_id": "<UNIQUE TOKEN ID>",
    "token_uri": "<JSON METADATA URL>"
  }
}

mint

For minting governance tokens in a token-based DAO.

{
  "to": "<RECIPIENT ADDRESS>",
  "amount": "<TOKEN AMOUNT>"
}