Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

Commit

Permalink
feat: identity for Dashpay + register dashpay
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Werner committed Aug 20, 2020
1 parent 908e077 commit fc97c6b
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/listr/tasks/platform/initTaskFactory.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { Listr } = require('listr2');

const dpnsDocumentSchema = require('@dashevo/dpns-contract/schema/dpns-contract-documents.json');
const dashpayDocumentSchema = require('@dashevo/dashpay-contract/schema/dashpay.schema.json');

const wait = require('../../../util/wait');

Expand Down Expand Up @@ -76,6 +77,33 @@ function initTaskFactory(
await ctx.client.platform.names.register('dash', ctx.identity);
},
},
{
title: 'Register identity for Dashpay',
task: async (ctx, task) => {
ctx.identity = await ctx.client.platform.identities.register(5);

// eslint-disable-next-line no-param-reassign
task.output = `Dashpay's owner identity: ${ctx.identity.getId()}`;
},
options: { persistentOutput: true },
},
{
title: 'Register Dashpay Contract',
task: async (ctx, task) => {
ctx.dataContract = await ctx.client.platform.contracts.create(
dashpayDocumentSchema, ctx.identity,
);

await ctx.client.platform.contracts.broadcast(
ctx.dataContract,
ctx.identity,
);

// eslint-disable-next-line no-param-reassign
task.output = `Dashpay contract ID: ${ctx.dataContract.getId()}`;
},
options: { persistentOutput: true },
},
{
title: 'Disconnect SDK',
task: async (ctx) => ctx.client.disconnect(),
Expand Down

0 comments on commit fc97c6b

Please sign in to comment.