Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

API Reference [experimental]

Defelo edited this page Mar 16, 2020 · 6 revisions

Wallets

/create

Creates a wallet

No parameters.

Responses:

  • Success:
{
  "time_stamp": "<Time of the creation of the wallet [string, 'YYYY-MM-DD HH:MM:SS.mmmmmm']>",
  "source_uuid": "<UUID of the wallet [string, UUID]>",
  "key": "<Secure key of the wallet [string, 10 digit hexadecimal key]>",
  "amount": "<Amount of morphcoins on the wallet [number]>",
  "user_uuid": "<UUID of the owner of the wallet [string, UUID]>"
}
  • You already have a wallet
{"error": "already_own_a_wallet"}

/get

Returns a wallet

Required parameters:

  • source_uuid: UUID of the wallet [string, UUID]
  • key Secure key of the wallet [string, 10 digit hexadecimal key]

Responses:

  • Success:
{
  "time_stamp": "<Time of the creation of the wallet [string, 'YYYY-MM-DD HH:MM:SS.mmmmmm']>",
  "source_uuid": "<UUID of the wallet [string, UUID]>",
  "key": "<Secure key of the wallet [string, 10 digit hexadecimal key]>",
  "amount": "<Amount of morphcoins on the wallet [number]>",
  "user_uuid": "<UUID of the owner of the wallet [string, UUID]>",
  "transactions": "<Number of transaction [number]>"
}
  • The wallet does not exist:
{"error": "unknown_source_or_destination"}
  • key is wrong:
{"error": "permission_denied"}

/transactions

Returns all transactions associated with a wallet

Required parameters:

  • source_uuid: UUID of the wallet [string, UUID]
  • key: Secure key of the wallet [string, 10 digit hexadecimal key]
  • count: the number of transactions
  • offset: the position where to start

Responses:

  • Success:
{
  "transactions": [{
    "id": "<Number of the transaction [number]>",
    "time_stamp": "<Time of the transaction [string, 'YYYY-MM-DD HH:MM:SS.mmmmmm']>",
    "source_uuid": "<UUID of the source wallet [string, UUID]>",
    "send_amount": "<Transaction amount of morphcoins [number]>",
    "destination_uuid": "<UUID of the destination wallet [string, UUID]>",
    "usage": "<Description of the transaction [string]>",
    "origin": "<Origin of the transaction (0 = from a user, 1 = from a crypto-miner) [number]>"
  }]
}
  • The wallet does not exist:
{"error": "unknown_source_or_destination"}
  • key is wrong:
{"error": "permission_denied"}

/list

Returns a list of all of your wallets

No parameters

Responses:

  • Success:
{
  "wallets": [
    "<UUID of the wallet [string, UUID]>"
  ]
}

/send

Performs a transaction between two wallets

Required parameters:

  • source_uuid: UUID of the source wallet [string, UUID]
  • key Secret key of the source wallet [string, 10 digit hexadecimal key]
  • send_amount Amount of morphcoins to send from the source wallet to the destination wallet [number, min: 1]
  • destination_uuid: UUID of the destination wallet [string, UUID]
  • usage: Description of the transaction [string]

Responses:

  • Success:
{"ok": true}
  • Source or destination wallet does not exist:
{"error": "unknown_source_or_destination"}
  • Not enough morphcoins in the source wallet:
{"error": "not_enough_coins"}
  • key is wrong:
{"error": "permission_denied"}

/reset

Deletes a wallet of yours without the key

Required parameters:

  • source_uuid: UUID of the wallet to delete [string, UUID]

Responses:

  • Success:
{"ok": true}
  • The wallet does not exist:
{"error": "unknown_source_or_destination"}
  • The wallet does not belong to you:
{"error": "permission_denied"}

/delete

Deletes an existing wallet with the secure key

Required parameters:

  • source_uuid: UUID of the wallet to delete [string, UUID]
  • key: Secret key of the wallet [string, 10 digit hexadecimal key]

Responses:

  • Success:
{"ok": true}
  • The wallet does not exist:
{"error": "unknown_source_or_destination"}
  • key is wrong:
{"error": "permission_denied"}

/exists [MS]

Returns whether a wallet exists

Required parameters:

  • source_uuid: The UUID of the wallet [string, UUID]

Responses:

  • The wallet exists:
{"exists": true}
  • The wallet does not exist:
{"exists": false}

/owner [MS]

Returns the owner of a wallet

Required parameters:

  • source_uuid: The UUID of the wallet [string, UUID]

Responses:

  • Success:
{"owner": "<UUID of the owner of the wallet [String, UUID]>"}
  • The wallet does not exist:
{"error": "unknown_source_or_destination"}

/put [MS]

Performs a dummy transaction between a fake wallet and a real wallet

Required parameters:

  • amount Amount of morphcoins the destination wallet should get [number]
  • destination_uuid: UUID of the destination wallet [string, UUID]
  • create_transaction: Whether a transaction should be created or just the coin amount should change on the wallet [boolean]

Parameters if create_transaction is truthy:

  • source_uuid: UUID of the (fake) source wallet [string, UUID]
  • usage: Description of the transaction [string]
  • origin: Origin of the transaction (0 = from a user, 1 = from a crypto-miner) [number]

Responses:

  • Success (without transaction):
{"ok": true}
  • Success (with transaction):
{
  "id": "<Number of the transaction [number]>",
  "time_stamp": "<Time of the transaction [string, 'YYYY-MM-DD HH:MM:SS.mmmmmm']>",
  "source_uuid": "<UUID of the source wallet [string, UUID]>",
  "send_amount": "<Transaction amount of morphcoins [number]>",
  "destination_uuid": "<UUID of the destination wallet [string, UUID]>",
  "usage": "<Description of the transaction [string]>",
  "origin": "<Origin of the transaction (0 = from a user, 1 = from a crypto-miner) [number]>"
}
  • Source or destination UUID invalid:
{"error": "unknown_source_or_destination"}

/dump [MS]

Takes away morphcoins from a wallet to a fake wallet

Required parameters:

  • amount Amount of morphcoins to take away from the destination [number]
  • source_uuid: UUID of the wallet to take coins away [string, UUID]
  • key: Secure key of the wallet to take coins away [string, 10 digit hexadecimal key]
  • create_transaction: Whether a transaction should be created or just the coin amount should change on the wallet [boolean]

Parameters if create_transaction is truthy:

  • destination_uuid: UUID of the (fake) destination wallet [string, UUID]
  • usage: Description of the transaction [string]
  • origin: Origin of the transaction (0 = from a user, 1 = from a crypto-miner) [number]

Responses:

  • Success (without transaction):
{"ok": true}
  • Success (with transaction):
{
  "id": "<Number of the transaction [number]>",
  "time_stamp": "<Time of the transaction [string, 'YYYY-MM-DD HH:MM:SS.mmmmmm']>",
  "source_uuid": "<UUID of the source wallet [string, UUID]>",
  "send_amount": "<Transaction amount of morphcoins [number]>",
  "destination_uuid": "<UUID of the destination wallet [string, UUID]>",
  "usage": "<Description of the transaction [string]>",
  "origin": "<Origin of the transaction (0 = from a user, 1 = from a crypto-miner) [number]>"
}
  • The wallet does not exist:
{"error": "unknown_source_or_destination"}
  • key is wrong:
{"error": "permission_denied"}
  • You want to take more coins than there are on the wallet:
{"error": "not_enough_coins"}

/delete_user [MS]

Deletes all wallets of a user

Required parameters:

  • user_uuid UUID of the user to delete [string, UUID]

Responses:

  • Success:
{"ok": true}