Skip to content

Commit

Permalink
feat(client-sdk): allow to pass synchronous flag for kwil executions (
Browse files Browse the repository at this point in the history
  • Loading branch information
ditoglez authored Nov 29, 2024
1 parent c733ef6 commit 507125c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 10 additions & 5 deletions packages/idos-sdk-js/src/lib/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ export class Data {
tableName: string,
recordId: string,
receiverPublicKey: string,
synchronous?: boolean,
): Promise<{ id: string }> {
const name = this.singularize(tableName);

Expand Down Expand Up @@ -322,17 +323,21 @@ export class Data {
},
],
`Share a ${name} on idOS`,
true,
synchronous,
);

return { id };
}

async unshare(tableName: string, recordId: string): Promise<{ id: string }> {
return await this.delete(tableName, recordId);
async unshare(
tableName: string,
recordId: string,
synchronous?: boolean,
): Promise<{ id: string }> {
return await this.delete(tableName, recordId, undefined, synchronous);
}

async addWriteGrant(grantee: string) {
async addWriteGrant(grantee: string, synchronous?: boolean) {
return await this.kwilWrapper.execute(
"add_write_grant",
[
Expand All @@ -341,7 +346,7 @@ export class Data {
},
],
`Grant ${grantee} write access to your idOS credentials`,
true,
synchronous,
);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/idos-sdk-js/src/lib/kwil-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export class KwilWrapper {
actionName: string,
actionInputs: Record<string, unknown>[],
description?: string,
synchronous?: boolean,
synchronous = true,
) {
if (!this.signer) throw new Error("No signer set");

Expand Down

0 comments on commit 507125c

Please sign in to comment.