Last active
October 4, 2022 22:37
-
-
Save yornaath/70a9fecac6a6153ee64b745ff933460f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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