Joystream Stats 5f4deb8284 report-generator: Giza cleanup hace 2 años
..
scripts 238bf9008f move contributions/tech to scripts hace 2 años
src 238bf9008f move contributions/tech to scripts hace 2 años
README.md 238bf9008f move contributions/tech to scripts hace 2 años
package.json 238bf9008f move contributions/tech to scripts hace 2 años
tsconfig.json 5f4deb8284 report-generator: Giza cleanup hace 2 años
yarn.lock 238bf9008f move contributions/tech to scripts hace 2 años

README.md

Joystream API Examples

Repo with examples on how to use the @joystream/types package along with @polkadot/api to communicate with a joystream full node.

Building the code

yarn && yarn build

In case you have a compilation error saying:

node_modules/@joystream/types/content-working-group/index.d.ts:3:22 - error TS2614: Module '"../common"' has no exported member 'Credential'. Did you mean to use 'import Credential from "../common"' instead?

3 import { OptionText, Credential, SlashingTerms } from '../common';
                       ~~~~~~~~~~
Found 1 error.

Open the file node_modules/@joystream/types/content-working-group/index.d.ts in a text editor and remove the failing import, so that the line looks as follows: import { OptionText, SlashingTerms } from '../common';

Save the changes and re-run yarn && yarn build again, the build should work fine.

Example Scripts

general.js

Ideal for newcomers. Contains the very basic APIs usage examples: get the last blockchain finalized block, get total coin issuance. Also shows how to iterate the events inside a given block.

node lib/examples/general.js

status.js

Another good starting point for newcomers to understand how APIs are called.

node lib/general/status.js

get-media-change.js

Shows how to work with Substrate events and Extrinsics to get the information about Joystream media uploads.

node lib/curators/get-media-change.js

council.js

Shows how to use councilElection, minting, council APIs.

node lib/examples/council.js

get-events-and-extrinsics.js

Shows the variety of Substrate event Extrinsic types within a given range of blocks.

node lib/examples/get-events-and-extrinsics.js

working-groups.js

Shows how to use a set of APIs related to Joystream working groups: storageWorkingGroup, recurringRewards, contentDirectoryWorkingGroup.

node lib/examples/working-groups.js

proposals.js

Shows how to use a APIs related to Joystream DAO proposals proposalsEngine, staking, members.

node lib/examples/proposals.js

Javascript scripts

There are some untyped Javascript scripts available for working with the data directory. You can run them using yarn:

//shows the available scripts
yarn script index

yarn script exportDataDirectory
yarn script listDataDirectory

or execute them in Pioneer JS Toolbox