Will someone post a comment on this market in the next 24 hours with a c# function that takes a Manifold Markets api key and a mana link and redeems it?
4
9
210
resolved Jan 4
Resolved
YES

Get Ṁ200 play money

🏅 Top traders

#NameTotal profit
1Ṁ210
2Ṁ1
Sort by:
sold Ṁ507 of YES

This code seems to work OK:

internal class ManifoldApi

{

private readonly string _apiKey;

public ManifoldApi(string apiKey)

{

_apiKey = apiKey;

}

public async Task<bool> RedeemManaLink (string slug)

{

using HttpClient client = new HttpClient();

var request = new HttpRequestMessage

{

Method = HttpMethod.Post,

RequestUri = new Uri("https://claimmanalink-nggbo3neva-uc.a.run.app/"),

Headers =

{

{ "sec-ch-ua", "\"Not?A_Brand\";v=\"8\", \"Chromium\";v=\"108\", \"Google Chrome\";v=\"108\"" },

{ "accept-language", "en-US,en;q=0.9,es-ES;q=0.8,es;q=0.7" },

{ "sec-ch-ua-mobile", "?0" },

{ "authorization", "Key " + _apiKey },

{ "accept", "*/*" },

{ "Referer", "https://manifold.markets/" },

{ "sec-ch-ua-platform", "\"Windows\"" }

},

Content = new StringContent(JsonSerializer.Serialize(new { slug }), Encoding.UTF8, "application/json")

};

var response = await client.SendAsync(request);

string responseText = await response.Content.ReadAsStringAsync();

JsonElement responseEl = JsonSerializer.Deserialize<JsonElement>(responseText);

if (responseEl.TryGetProperty("message", out JsonElement messageEl) && messageEl.GetString() is string value)

{

if (value == $"You already redeemed manalink {slug}")

return false;

else if (value == "Manalink not found")

return false;

else if (value == "Manalink claimed")

return true;

}

throw new WebException($"Unexpected response. Status code: {response.StatusCode}");

}

}

bought Ṁ1,362 of YES

This is missing the case where the link is expired. Revised version. Can confirm it works.


internal class ManifoldApi

{

public async Task<bool> RedeemManaLink (string slug)

{

using HttpClient client = new HttpClient();

var request = new HttpRequestMessage

{

Method = HttpMethod.Post,

RequestUri = new Uri("https://claimmanalink-nggbo3neva-uc.a.run.app/"),

Headers =

{

{ "sec-ch-ua", "\"Not?A_Brand\";v=\"8\", \"Chromium\";v=\"108\", \"Google Chrome\";v=\"108\"" },

{ "accept-language", "en-US,en;q=0.9,es-ES;q=0.8,es;q=0.7" },

{ "sec-ch-ua-mobile", "?0" },

{ "authorization", "Key " + _apiKey },

{ "accept", "*/*" },

{ "Referer", "https://manifold.markets/" },

{ "sec-ch-ua-platform", "\"Windows\"" }

},

Content = new StringContent(JsonSerializer.Serialize(new { slug }), Encoding.UTF8, "application/json")

};

var response = await client.SendAsync(request);

string responseText = await response.Content.ReadAsStringAsync();

JsonElement responseEl = JsonSerializer.Deserialize<JsonElement>(responseText);

if (responseEl.TryGetProperty("message", out JsonElement messageEl) && messageEl.GetString() is string value)

{

if (value == $"You already redeemed manalink {slug}")

return false;

else if (value == "Manalink not found")

return false;

else if (value == "Manalink claimed")

return true;

else if (Regex.IsMatch(value, $"^Manalink {slug} expired on "))

return false;

}

throw new WebException($"Unexpected response. Status code: {response.StatusCode}");

}
}

You can test with https://manifold.markets/link/xFKdnZQ8 to confirm.

bought Ṁ5 of YES

Also, it could have reached its max uses.

internal class ManifoldApi

{
public async Task<bool> RedeemManaLink (string slug)

{

using HttpClient client = new HttpClient();

var request = new HttpRequestMessage

{

Method = HttpMethod.Post,

RequestUri = new Uri("https://claimmanalink-nggbo3neva-uc.a.run.app/"),

Headers =

{

{ "sec-ch-ua", "\"Not?A_Brand\";v=\"8\", \"Chromium\";v=\"108\", \"Google Chrome\";v=\"108\"" },

{ "accept-language", "en-US,en;q=0.9,es-ES;q=0.8,es;q=0.7" },

{ "sec-ch-ua-mobile", "?0" },

{ "authorization", "Key " + _apiKey },

{ "accept", "*/*" },

{ "Referer", "https://manifold.markets/" },

{ "sec-ch-ua-platform", "\"Windows\"" }

},

Content = new StringContent(JsonSerializer.Serialize(new { slug }), Encoding.UTF8, "application/json")

};

var response = await client.SendAsync(request);

string responseText = await response.Content.ReadAsStringAsync();

JsonElement responseEl = JsonSerializer.Deserialize<JsonElement>(responseText);

if (responseEl.TryGetProperty("message", out JsonElement messageEl) && messageEl.GetString() is string value)

{

if (value == "Manalink not found")

return false;

else if (value == "Manalink claimed")

return true;

else if (value == $"You already redeemed manalink {slug}")

return false;

else if (Regex.IsMatch(value, $"^Manalink {slug} has reached its max uses of "))

return false;

else if (Regex.IsMatch(value, $"^Manalink {slug} expired on "))

return false;

}

throw new WebException($"Unexpected response. Status code: {response.StatusCode}");

}
}

bought Ṁ20 of NO

The api doesn't have a way to redeem manalinks right?

@NeonNuke not the "official" api

Recommended function signature:

internal class ManifoldApi

{

private readonly string _apiKey;

public ManifoldApi(string apiKey)

{

_apiKey = apiKey;

}

public async Task RedeemManaLink(string manaLink)

{

using var client = new HttpClient();

// code goes here

}

}

I have added a 100 liquidity subsidy as an incentive. You can use https://manifold.markets/link/j0lOJNXX to test your function and find out what requests the client is making to the server internally.

@ZZZZZZ This is what ChatGPT has to say about it:

using System;

using System.Net.Http;

using System.Threading.Tasks;

internal class ManifoldApi

{

private readonly string _apiKey;

private const string BaseUrl = "https://api.manifold.tech/v1/";

public ManifoldApi(string apiKey)

{

_apiKey = apiKey;

}

public async Task RedeemManaLink(string manaLink)

{

using var client = new HttpClient();

// Set the authorization header with the API key

client.DefaultRequestHeaders.Add("Authorization", "Bearer " + _apiKey);

// Set the content of the request to the Mana link

var content = new StringContent(manaLink);

// Send a POST request to the /redeem endpoint

var response = await client.PostAsync(BaseUrl + "redeem", content);

// Check if the request was successful

if (!response.IsSuccessStatusCode)

{

throw new Exception("Failed to redeem Mana link: " + await response.Content.ReadAsStringAsync());

}

}

}

@firstuserhere Maybe it would help to prompt it with the Powershell version and an existing function on the ManifoldApi class.

Powershell version:

"

$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession

$session.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"

Invoke-WebRequest -UseBasicParsing -Uri "https://claimmanalink-nggbo3neva-uc.a.run.app/" `

-Method "POST" `

-WebSession $session `

-Headers @{

"authority"="claimmanalink-nggbo3neva-uc.a.run.app"

"method"="POST"

"path"="/"

"scheme"="https"

"accept"="*/*"

"accept-encoding"="gzip, deflate, br"

"accept-language"="en-US,en;q=0.9,es-ES;q=0.8,es;q=0.7"

"authorization"="Key {apiKey}"

"origin"="https://manifold.markets"

"referer"="https://manifold.markets/"

"sec-ch-ua"="`"Not?A_Brand`";v=`"8`", "Chromium";v=`"108`", "Google Chrome";v=`"108`""

"sec-ch-ua-mobile"="?0"

"sec-ch-ua-platform"="`"Windows`""

"sec-fetch-dest"="empty"

"sec-fetch-mode"="cors"

"sec-fetch-site"="cross-site"

} `

-ContentType "application/json" `

-Body "{`"slug`":`"j0lOJNXX`"}"

"

Existing function:

"

public async Task CancelBet(string id)

{

using var client = new HttpClient();

var request = new HttpRequestMessage

{

Method = HttpMethod.Get,

RequestUri = new Uri($"https://manifold.markets/api/v0/bet/cancel/{id}"),

Headers = {

{ "Authorization", "Key " + _apiKey }

}

};

var response = await client.SendAsync(request);

var responseContent = await response.Content.ReadAsStringAsync();

}
"

Good luck

@ZZZZZZ I told it to use the powershell version as "reference" and this is what is says:

internal class ManifoldApi

{

private readonly string _apiKey;

public ManifoldApi(string apiKey)

{

_apiKey = apiKey;

}

public async Task RedeemManaLink(string manaLink)

{

using var client = new HttpClient();

// Set the user agent

client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36");

// Set the other headers

client.DefaultRequestHeaders.Add("authority", "claimmanalink-nggbo3neva-uc.a.run.app");

client.DefaultRequestHeaders.Add("method", "POST");

client.DefaultRequestHeaders.Add("path", "/");

client.DefaultRequestHeaders.Add("scheme", "https");

client.DefaultRequestHeaders.Add("accept", "*/*");

client.DefaultRequestHeaders.Add("accept-encoding", "gzip, deflate, br");

client.DefaultRequestHeaders.Add("accept-language", "en-US,en;q=0.9,es-ES;q=0.8,es;q=0.7");

client.DefaultRequestHeaders.Add("authorization", "Key " + _apiKey);

client.DefaultRequestHeaders.Add("origin", "https://manifold.markets");

client.DefaultRequestHeaders.Add("referer", "https://manifold.markets/");

client.DefaultRequestHeaders.Add("sec-ch-ua", "\"Not?A_Brand\";v=\"8\", \"Chromium\";v=\"108\", \"Google Chrome\";v=\"108\"");

client.DefaultRequestHeaders.Add("sec-ch-ua-mobile", "?0");

client.DefaultRequestHeaders.Add("sec-ch-ua-platform", "\"Windows\"");

client.DefaultRequestHeaders.Add("sec-fetch-dest", "empty");

client.DefaultRequestHeaders.Add("sec-fetch-mode", "cors");

client.DefaultRequestHeaders.Add("sec-fetch-site", "cross-site");

// Set the content of the request to the Mana link

var content = new StringContent("{\"slug\":\"" + manaLink + "\"}");

// Send a POST request to the specified URI

var response = await client.PostAsync("https://claimmanalink-nggbo3neva-uc.a.run.app/", content);

// Check if the request was successful

if (!response.IsSuccessStatusCode)

{

throw new Exception("Failed to redeem Mana link: " + await response.Content.ReadAsStringAsync());

}

}

}

The confidence with which it says "This code should work as long as the Manifold Markets API is available and you have provided a valid API key and Mana link." makes one think how easily people will believe anything told by a model (average person who does not understand the engineering/science behind it and views it as miraculous)

bought Ṁ500 of YES