Session
Approve Spending
Approve the contract to spend MOR tokens on your behalf. Connects to the proxy-router's /blockchain/approve endpoint. For creating sessions, approve enough tokens by calculating: bid_price * session_duration. Uses the DIAMOND_CONTRACT_ADDRESS environment variable as the spender contract address.
Authorization
Authorization<token>🗝️ API key in format: 'Bearer sk-xxxxxx'
In: header
Query Parameters
amountRequiredAmountThe amount to approve, consider bid price * duration for sessions
Response Body
Successful Response
TypeScript Definitions
Use the response body type in TypeScript.
responseRequiredunknownValidation Error
TypeScript Definitions
Use the response body type in TypeScript.
detailDetailcurl -X POST "https://example.com/api/v1/session/approve?amount=0" \
-H "Authorization: <token>"fetch("https://example.com/api/v1/session/approve?amount=0", {
headers: {
"Authorization": "<token>"
}
})package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/v1/session/approve?amount=0"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "<token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}import requests
url = "https://example.com/api/v1/session/approve?amount=0"
response = requests.request("POST", url, headers = {
"Authorization": "<token>"
})
print(response.text)null{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
]
}How is this guide?