Add createProcess() service method
This commit is contained in:
parent
ae88959496
commit
5d0c617bbb
@ -305,6 +305,38 @@ export default class Services {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async createProcess(
|
||||||
|
privateData: Record<string, any>,
|
||||||
|
publicData: Record<string, any>,
|
||||||
|
roles: Record<string, RoleDefinition>,
|
||||||
|
): Promise<ApiReturn> {
|
||||||
|
const relayAddress = this.getAllRelays()[0]['spAddress'];
|
||||||
|
const feeRate = 1;
|
||||||
|
|
||||||
|
let members: Set<Member> = new Set();
|
||||||
|
for (const role of Object.values(roles!)) {
|
||||||
|
for (const member of role.members) {
|
||||||
|
// Check if we know the member that matches this id
|
||||||
|
const memberAddresses = this.getAddressesForMemberId(member);
|
||||||
|
if (memberAddresses && memberAddresses.length != 0) {
|
||||||
|
members.add({ sp_addresses: memberAddresses });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await this.checkConnections([...members]);
|
||||||
|
|
||||||
|
const result = this.sdkClient.create_new_process (
|
||||||
|
privateData,
|
||||||
|
roles,
|
||||||
|
publicData,
|
||||||
|
relayAddress,
|
||||||
|
feeRate,
|
||||||
|
this.getAllMembers()
|
||||||
|
);
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
public async createDmProcess(
|
public async createDmProcess(
|
||||||
otherMember: string[],
|
otherMember: string[],
|
||||||
): Promise<ApiReturn> {
|
): Promise<ApiReturn> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user