Skip to content

Commit

Permalink
Updated SDK to support ERC1155 in channels
Browse files Browse the repository at this point in the history
  • Loading branch information
baptistegreve committed Jul 21, 2022
1 parent 4947938 commit 7a4e526
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
22 changes: 19 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ const MAINNET_NODE_URL = "https://node1.orbis.club/";
const TESTNET_NODE_URL = "https://ceramic-clay.3boxlabs.com";

/** Set schemas Commit IDs */
const postSchemaCommitId = "k3y52l7qbv1fryn1brl9cvef0hilj561ooi6i3ac1l21rj2npron7nf2xneuace0w";
const postSchemaCommit = "k3y52l7qbv1fryn1brl9cvef0hilj561ooi6i3ac1l21rj2npron7nf2xneuace0w";
const channelSchema = "k3y52l7qbv1fry19cf09hgx3lvrqjvqknpzj8ens7hh3xaz0pmu7kret3y7gqs1kw";

/** Definition of the Orbis class powering the Orbis SDK */
export class Orbis {
Expand Down Expand Up @@ -278,7 +279,7 @@ export class Orbis {
}

/** Create tile with post schema */
let result = await this.createTileDocument(content, ["orbis", "post"], postSchemaCommitId);
let result = await this.createTileDocument(content, ["orbis", "post"], postSchemaCommit);

/** Return confirmation results */
return result;
Expand Down Expand Up @@ -356,7 +357,22 @@ export class Orbis {
}

/** Create channel object */
let result = await this.createTileDocument(content, ["orbis", "channel"], "k3y52l7qbv1frykwglqnssisct9itj9wg76gxbkmagrrneiz0ul92nksde2fgii2o");
let result = await this.createTileDocument(content, ["orbis", "channel"], channelSchema);
return result;
}

/** User can update a channel */
async updateChannel(channel_id, content) {
if(!channel_id) {
console.log("`channel_id` is required to update a channel.");
return {
status: 300,
result: "`channel_id` is required to update a channel."
}
}

/** Update TileDocument with new content */
let result = await this.updateTileDocument(channel_id, content, ["orbis", "channel"], channelSchema);
return result;
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@orbisclub/orbis-sdk",
"version": "0.2.59",
"version": "0.2.62",
"description": "Official package to implement quickly an Orbis powered decentralized social layer within your application.",
"type": "module",
"main": "index.js",
Expand Down

0 comments on commit 7a4e526

Please sign in to comment.