Update script to upload all submissions

This commit is contained in:
Austin Chen 2022-08-25 10:39:01 -07:00
parent 75e05c5bf7
commit ef5b0807f5

View File

@ -1,5 +1,9 @@
// Run with `npx ts-node src/scripts/contest/create-markets.ts` // Run with `npx ts-node src/scripts/contest/create-markets.ts`
const API_KEY = 'e0f4561c-59c3-453e-bf58-52a17e750099'
import { CEP_SUBMISSIONS } from './submissions'
// Dev API key for Cause Exploration Prizes
const API_KEY = '188f014c-0ba2-4c35-9e6d-88252e281dbf'
type CEPSubmission = { type CEPSubmission = {
title: string title: string
@ -7,12 +11,6 @@ type CEPSubmission = {
link: string link: string
} }
const SUBMISSION_1: CEPSubmission = {
title: 'New cause area: Violence against women and girls',
author: 'Akhil',
link: 'https://forum.effectivealtruism.org/posts/majcwf7i8pW8eMJ3v/new-cause-area-violence-against-women-and-girls',
}
// Use the API to create a new market for this Cause Exploration Prize submission // Use the API to create a new market for this Cause Exploration Prize submission
async function postMarket(submission: CEPSubmission) { async function postMarket(submission: CEPSubmission) {
const { title, author } = submission const { title, author } = submission
@ -24,21 +22,26 @@ async function postMarket(submission: CEPSubmission) {
}, },
body: JSON.stringify({ body: JSON.stringify({
outcomeType: 'BINARY', outcomeType: 'BINARY',
question: `"${title}" by ${author}` + 'DEV1', question: `"${title}" by ${author}`,
description: makeDescription(submission), description: makeDescription(submission),
closeTime: 1700000000000, closeTime: Date.parse('2022-09-08').valueOf(),
initialProb: 25, initialProb: 10,
// Super secret options: // Super secret options:
groupId: 'aW0904dRtCc6FVOTCEpf', groupId: 'y2hcaGybXT1UfobK3XTx', // CEP Tournament
visibility: 'unlisted', visibility: 'unlisted',
// TODO: Increase liquidity? // TODO: Increase liquidity?
}), }),
}) })
const data = await response.json() const data = await response.json()
console.log(data) console.log('Created market:', data.slug)
} }
postMarket(SUBMISSION_1) async function postAll() {
for (const submission of CEP_SUBMISSIONS.slice(10)) {
await postMarket(submission)
}
}
postAll()
/* Example curl request: /* Example curl request:
$ curl https://manifold.markets/api/v0/market -X POST -H 'Content-Type: application/json' \ $ curl https://manifold.markets/api/v0/market -X POST -H 'Content-Type: application/json' \
@ -97,7 +100,7 @@ function makeDescription(submission: CEPSubmission) {
type: 'iframe', type: 'iframe',
attrs: { attrs: {
allowfullscreen: true, allowfullscreen: true,
src: 'https://forum.effectivealtruism.org/posts/majcwf7i8pW8eMJ3v/new-cause-area-violence-against-women-and-girls', src: link,
frameborder: 0, frameborder: 0,
}, },
}, },