Skip to content

Commit

Permalink
Merge pull request #837 from kaleido-io/abi-refactoring
Browse files Browse the repository at this point in the history
Use firefly-signer library and allow numbers expressed as strings
  • Loading branch information
nguyer authored Jun 14, 2022
2 parents 51218fe + 9aca617 commit 15c8802
Show file tree
Hide file tree
Showing 31 changed files with 1,399 additions and 418 deletions.
4 changes: 4 additions & 0 deletions db/migrations/postgres/000093_add_ffi_details.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
BEGIN;
ALTER TABLE ffimethods DROP COLUMN details;
ALTER TABLE ffievents DROP COLUMN details;
COMMIT;
4 changes: 4 additions & 0 deletions db/migrations/postgres/000093_add_ffi_details.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
BEGIN;
ALTER TABLE ffimethods ADD COLUMN details TEXT;
ALTER TABLE ffievents ADD COLUMN details TEXT;
COMMIT;
2 changes: 2 additions & 0 deletions db/migrations/sqlite/000093_add_ffi_details.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE ffimethods DROP COLUMN details;
ALTER TABLE ffievents DROP COLUMN details;
2 changes: 2 additions & 0 deletions db/migrations/sqlite/000093_add_ffi_details.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE ffimethods ADD COLUMN details TEXT;
ALTER TABLE ffievents ADD COLUMN details TEXT;
23 changes: 16 additions & 7 deletions docs/reference/firefly_interface_format.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,28 @@ There are four required fields when broadcasting a contract interface in FireFly
## Method

Let's look at a what goes inside the `methods` array now. It is also a JSON object that has a `name`, a list of `params` which are the arguments the function will take and a list of `returns` which are the return values of the function. Optionally, it also has a `description` which can be helpful in OpenAPI Spec generation.
Let's look at a what goes inside the `methods` array now. It is also a JSON object that has a `name`, a list of `params` which are the arguments the function will take and a list of `returns` which are the return values of the function. It also has an optional `description` which can be helpful in OpenAPI Spec generation. Finally, it has an optional `details` object which wraps blockchain specific information about this method. This can be used by the blockchain plugin when invoking this function, and it is also used in documentation generation.

```json
{
"name": "add",
"description": "Add two numbers together",
"params": [],
"returns": []
"returns": [],
"details": {}
}
```

## Event

What goes into the `events` array is very similar. It is also a JSON object that has a `name` and a list of `params`. The difference is that `events` don't have `returns`. Arguments that are passed to the event when it is emitted are in `params`. Optionally, it also has a `description` which can be helpful in OpenAPI Spec generation.
What goes into the `events` array is very similar. It is also a JSON object that has a `name` and a list of `params`. The difference is that `events` don't have `returns`. Arguments that are passed to the event when it is emitted are in `params`. It also has an optional `description` which can be helpful in OpenAPI Spec generation. Finally, it has an optional `details` object which wraps blockchain specific information about this event. This can be used by the blockchain plugin when invoking this function, and it is also used in documentation generation.

```json
{
"name": "added",
"description": "An event that occurs when numbers have been added",
"params": []
"params": [],
"details": {}
}
```

Expand Down Expand Up @@ -137,7 +139,10 @@ Putting it all together, here is a full example of the FireFly Interface format
}
}
}
]
],
"details": {
"stateMutability": "viewable"
}
},
{
"name": "set",
Expand All @@ -154,7 +159,10 @@ Putting it all together, here is a full example of the FireFly Interface format
}
}
],
"returns": []
"returns": [],
"details": {
"stateMutability": "payable"
}
}
],
"events": [
Expand Down Expand Up @@ -183,7 +191,8 @@ Putting it all together, here is a full example of the FireFly Interface format
}
}
}
]
],
"details": {}
}
]
}
Expand Down
1 change: 1 addition & 0 deletions docs/reference/types/contractlistener.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ nav_order: 9
| `name` | The name of the event | `string` |
| `description` | A description of the smart contract event | `string` |
| `params` | An array of event parameter/argument definitions | [`FFIParam[]`](#ffiparam) |
| `details` | Additional blockchain specific fields about this event from the original smart contract. Used by the blockchain plugin and for documentation generation. | [`JSONObject`](simpletypes#jsonobject) |

## FFIParam

Expand Down
12 changes: 10 additions & 2 deletions docs/reference/types/ffi.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ nav_order: 8
}
}
}
]
],
"details": {
"stateMutability": "viewable"
}
},
{
"id": "fc6f54ee-2e3c-4e56-b17c-4a1a0ae7394b",
Expand All @@ -69,7 +72,10 @@ nav_order: 8
}
}
],
"returns": []
"returns": [],
"details": {
"stateMutability": "payable"
}
}
],
"events": [
Expand Down Expand Up @@ -132,6 +138,7 @@ nav_order: 8
| `description` | A description of the smart contract method | `string` |
| `params` | An array of method parameter/argument definitions | [`FFIParam[]`](#ffiparam) |
| `returns` | An array of method return definitions | [`FFIParam[]`](#ffiparam) |
| `details` | Additional blockchain specific fields about this method from the original smart contract. Used by the blockchain plugin and for documentation generation. | [`JSONObject`](simpletypes#jsonobject) |

## FFIParam

Expand All @@ -154,6 +161,7 @@ nav_order: 8
| `name` | The name of the event | `string` |
| `description` | A description of the smart contract event | `string` |
| `params` | An array of event parameter/argument definitions | [`FFIParam[]`](#ffiparam) |
| `details` | Additional blockchain specific fields about this event from the original smart contract. Used by the blockchain plugin and for documentation generation. | [`JSONObject`](simpletypes#jsonobject) |

## FFIParam

Expand Down
Loading

0 comments on commit 15c8802

Please sign in to comment.