Skip to content

Instantly share code, notes, and snippets.

@yornaath
Last active October 4, 2022 22:37
Show Gist options
  • Save yornaath/70a9fecac6a6153ee64b745ff933460f to your computer and use it in GitHub Desktop.
Save yornaath/70a9fecac6a6153ee64b745ff933460f to your computer and use it in GitHub Desktop.
import { create, createStorage, CreateMarketWithPoolParams } from '@zeitgeistpm/sdk'
import { IPFS } from '@zeitgeistpm/web3.storage'
type CustomMarketMetadata = { description: string }
const storage = createStorage<CustomMarketMetadata>(
IPFS.storage({
node: { url: 'http://ipfs.zeitgeist.pm:5001', pin: false },
}),
)
async function main() {
const sdk = await create({
provider: 'ws://127.0.0.1:9944',
storage: storage,
})
const params = {
metadata: {
description: 'som description',
},
} as CreateMarketWithPoolParams<typeof sdk.storage>
const response = await sdk.model.markets.create(params)
const { market, pool } = response.extract().unwrap()
const metadata = (await market.fetchMetadata()).unwrap()
metadata.description === 'some description'
}
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment