Wallet API

Middleman wallets have all of the functionality a web3 wallet has, and you can use any of the wallet functions available in the Web3 API.

post
Create A Wallet

https://api.middleman.cx/wallets
Request
Response
Headers
X-Auth-Key
required
string
Body Parameters
user_id
required
string
user id the wallet belongs to inside your application
200: OK
{
"wallet": {
"address": "0x8d3e809fbd258083a5ba004a527159da535c8aba ",
"user_id": "00000001",
"_id": "5b5e94f58f8889421d61d41d"
}
}

get
Get Wallets

https://api.middleman.cx/wallets
Get all wallets.
Request
Response
Headers
X-Auth-Key
required
string
200: OK
{
"wallets": [
{
"_id": "5b5c995041c20579193d25be",
"address": "0x8d3e809fbd258083a5ba004a527159da535c8aba ",
"user_id": "00000001"
},
{
"_id": "5b5ca658a23027c4190ab467",
"address": "0x284C2Ed46cE5cD8a9943E674776e3a97F7763E2a",
"user_id": "00000002",
}
]
}

get
Get Wallets (By User)

https://api.middleman.cx/wallets/user/:userid
Get all wallets you have created for a specific user.
Request
Response
Headers
X-Auth-Key
required
string
200: OK
{
"wallets": [
{
"_id": "5b5c995041c20579193d25be",
"address": "0x8d3e809fbd258083a5ba004a527159da535c8aba ",
"user_id": "00000001"
},
{
"_id": "5b5ca658a23027c4190ab467",
"address": "0x284C2Ed46cE5cD8a9943E674776e3a97F7763E2a",
"user_id": "00000002",
}
]
}

get
Get Wallet (By ID)

https://middleman.cx/wallets/:id
Request
Response
Path Parameters
id
required
string
Wallet ID
Headers
X-Auth-Key
required
string
200: OK
{
"wallet": {
"_id": "5b5c995041c20579193d25be",
"address": "0x8d3e809fbd258083a5ba004a527159da535c8aba ",
"user_id": "00000001"
}
}

get
Get Wallet (By Address)

https://api.middleman.cx/wallets/address/:addr
Request
Response
Path Parameters
addr
required
string
Wallet Address
Headers
X-Auth-Key
required
string
200: OK
{
"wallet": {
"_id": "5b5c995041c20579193d25be",
"address": "0x8d3e809fbd258083a5ba004a527159da535c8aba ",
"user_id": "00000001"
}
}

get
Get Wallet Balance (By ID)

https://api.middleman.cx/wallets/:id/balance
Returns balance for ETH, ERC20 and ERC721 tokens
Request
Response
Path Parameters
id
required
string
Wallet ID
Headers
X-Auth-Key
required
string
200: OK
{
"balance": {
"eth": "0.21",
"erc20": {
"0": {
"symbol": "ADT",
"name": "AdToken",
"balance": "10.00"
},
"1": {
"symbol": "DANI",
"name": "danicoin",
"balance": "0.00"
},
"2": {
"symbol": "EMJ",
"name": "Ethmoji",
"balance": "1.00"
},
"3": {
"symbol": "LOOM",
"name": "LoomToken",
"balance": "1.00"
},
"4": {
"symbol": "WTR",
"name": "Water",
"balance": "100.00"
}
},
"erc721": {
"0": {
"name": "Ethmoji",
"id": 1027160,
"image_url": "https://storage.googleapis.com/opensea-prod.appspot.com/0xa6d954d08877f8ce1224f6bfb83484c7d3abf8e9%2F518None",
"last_sale_price": "0.00"
},
"1": {
"name": "CryptoKitties",
"id": 676335,
"image_url": "https://storage.googleapis.com/ck-kitty-image/0x06012c8cf97bead5deae237070f9587f8e7a266d/645145.svg",
"last_sale_price": "0.17"
}
}
}
}

get
Get Wallet Balance (By Address)

https://api.middleman.cx/wallets/address/:addr/balance
Request
Response
Path Parameters
addr
required
string
Wallet Address
Headers
X-Auth-Key
required
string
200: OK
{
"balance": {
"eth": "0.21",
"erc20": {
"0": {
"symbol": "ADT",
"name": "AdToken",
"balance": "10.00"
},
"1": {
"symbol": "DANI",
"name": "danicoin",
"balance": "0.00"
},
"2": {
"symbol": "EMJ",
"name": "Ethmoji",
"balance": "1.00"
},
"3": {
"symbol": "LOOM",
"name": "LoomToken",
"balance": "1.00"
},
"4": {
"symbol": "WTR",
"name": "Water",
"balance": "100.00"
}
},
"erc721": {
"0": {
"name": "Ethmoji",
"id": 1027160,
"image_url": "https://storage.googleapis.com/opensea-prod.appspot.com/0xa6d954d08877f8ce1224f6bfb83484c7d3abf8e9%2F518None",
"last_sale_price": "0.00"
},
"1": {
"name": "CryptoKitties",
"id": 676335,
"image_url": "https://storage.googleapis.com/ck-kitty-image/0x06012c8cf97bead5deae237070f9587f8e7a266d/645145.svg",
"last_sale_price": "0.17"
}
}
}
}

post
Sign Transaction (By Wallet ID)

https://api.middleman.cx/wallets/:id/signTransaction
Matches functionality of web3.eth.accounts.signTransaction in Web3js
Request
Response
Path Parameters
id
required
string
Wallet ID
Headers
X-Auth-Key
required
string
Body Parameters
Transaction
required
object
Transaction { "to": String, "value": Integer, "gas": Integer }
200: OK
{
"signedTransaction": {
"messageHash": "0x6f5383e77c8414ce084193714e0eb45a69296da954b7bfcd43fcb7973a0ca84d",
"v": "0x25",
"r": "0xd01e60597240195ff9baa69a26306fbd770a6ceddf43feaebbf00822a7cd247f",
"s": "0x53cd2759c0110b634a4c0a785ff62a4a414f66837555c2d76186c769859de3cf",
"rawTransaction": "0xf868808477359400831e848094f0109fc8df283027b6285cc889f5aa624eac1f55843b9aca008025a0d01e60597240195ff9baa69a26306fbd770a6ceddf43feaebbf00822a7cd247fa053cd2759c0110b634a4c0a785ff62a4a414f66837555c2d76186c769859de3cf"
}
}

post
Sign Transaction (By Address)

https://api.middleman.cx/wallets/address/:addr/signTransaction
Matches functionality of web3.eth.accounts.signTransaction in Web3js
Request
Response
Path Parameters
addr
required
string
Wallet Address
Headers
X-Auth-Key
required
string
Body Parameters
Transaction
required
object
{ "to": String, "value": Integer, "gas": Integer }
200: OK
{
"signedTransaction": {
"messageHash": "0x6f5383e77c8414ce084193714e0eb45a69296da954b7bfcd43fcb7973a0ca84d",
"v": "0x25",
"r": "0xd01e60597240195ff9baa69a26306fbd770a6ceddf43feaebbf00822a7cd247f",
"s": "0x53cd2759c0110b634a4c0a785ff62a4a414f66837555c2d76186c769859de3cf",
"rawTransaction": "0xf868808477359400831e848094f0109fc8df283027b6285cc889f5aa624eac1f55843b9aca008025a0d01e60597240195ff9baa69a26306fbd770a6ceddf43feaebbf00822a7cd247fa053cd2759c0110b634a4c0a785ff62a4a414f66837555c2d76186c769859de3cf"
}
}

post
Recover Transaction (By ID)

https://api.middleman.cx/wallets/:id/recoverTransaction
Matches functionality of web3.eth.accounts.recoverTransaction in Web3js
Request
Response
Path Parameters
id
required
string
Wallet ID
Headers
X-Auth-Key
required
string
Body Parameters
rawTransaction
required
string
The RLP encoded transaction
200: OK
{
"address": "0x8d3e809fbd258083a5ba004a527159da535c8aba "
}

post
Recover Transaction (By Address)

https://api.middleman.cx/wallets/address/:addr/recoverTransaction
Request
Response
Path Parameters
addr
required
string
Wallet Address
Headers
X-Auth-Key
required
string
Body Parameters
rawTransaction
required
string
The RLP encoded transaction
200: OK
{
"address": "0x8d3e809fbd258083a5ba004a527159da535c8aba "
}

post
Hash Message (By ID)

https://api.middleman.cx/wallets/:id/hashMessage
Request
Response
Path Parameters
id
required
string
Wallet ID
Headers
X-Auth-Key
required
string
Body Parameters
message
required
string
Message to hash
200: OK
{
"hashedMessage": "0x39395cb760c11dee4785f72b83a64c8e2975b3618da15458d7b53007e9ff6f3b"
}

post
Hash Message (By Address)

https://api.middleman.cx/wallets/address/:addr/hashMessage
Request
Response
Path Parameters
addr
required
string
Wallet Address
Headers
X-Auth-Key
required
string
Body Parameters
message
required
string
Message to hash
200: OK
{
"hashedMessage": "0x39395cb760c11dee4785f72b83a64c8e2975b3618da15458d7b53007e9ff6f3b"
}

post
Sign Data (By ID)

https://api.middleman.cx/wallets/:id/sign
Request
Response
Path Parameters
id
required
string
Wallet ID
Headers
X-Auth-Key
required
string
Body Parameters
message
required
string
Data to sign
200: OK
{
"message": {
"message": "really secret message",
"messageHash": "0x50c7a8853283752ec77597fca468a2e5e291cbc680bbd2ff84969a23459a0f04",
"v": "0x1c",
"r": "0x0366b6e30156b8f6e4c4f18ef2231890d076eb54c6b9d74a481cf176bffc0b81",
"s": "0x261218a4d0851f5ee4061a3ea1267e025fc4c4c95ce87269925cdd780a55e469",
"signature": "0x0366b6e30156b8f6e4c4f18ef2231890d076eb54c6b9d74a481cf176bffc0b81261218a4d0851f5ee4061a3ea1267e025fc4c4c95ce87269925cdd780a55e4691c"
}
}

post
Sign Data (By Address)

https://api.middleman.cx/wallets/address/:addr/sign
Request
Response
Path Parameters
addr
required
string
Wallet Address
Headers
X-Auth-Key
required
string
Body Parameters
message
required
string
Data to sign
200: OK
{
"message": {
"message": "really secret message",
"messageHash": "0x50c7a8853283752ec77597fca468a2e5e291cbc680bbd2ff84969a23459a0f04",
"v": "0x1c",
"r": "0x0366b6e30156b8f6e4c4f18ef2231890d076eb54c6b9d74a481cf176bffc0b81",
"s": "0x261218a4d0851f5ee4061a3ea1267e025fc4c4c95ce87269925cdd780a55e469",
"signature": "0x0366b6e30156b8f6e4c4f18ef2231890d076eb54c6b9d74a481cf176bffc0b81261218a4d0851f5ee4061a3ea1267e025fc4c4c95ce87269925cdd780a55e4691c"
}
}