Assets
Assets in Rafiki can be added through the Backend Admin API or the Rafiki Admin application.
Add an asset using the CreateAsset
GraphQL mutation
CreateAsset mutation
mutation CreateAsset($input: CreateAssetInput!) { createAsset(input: $input) { code success message asset { id code scale } }}
Example
To add US dollars, for example, as an asset type to your Rafiki instance, call the CreateAsset
mutation and pass the input
parameters for the asset code
, represented by its ISO 4217 currency code (USD), and scale
variables as follows:
Example JSON request
{ "input": { "code": "USD", "scale": 2 }}
Variable | Description |
---|---|
code | The asset code, generally an ISO 4217 currency code where available. |
scale | Difference in order of magnitude between the standard unit and a fractional unit. |
Example JSON response
{ "data": { "createAsset": { "code": "200", "success": true, "message": "Created Asset", "asset": { "id": "b3dffeda-1e0e-47d4-82a3-69b1a622eeb9", "code": "USD", "scale": 2 } } }}
Add an asset using Rafiki Admin
Assets can be added through the Rafiki Admin application. Navigate to the main Assets page and then configure the asset code and scale.