Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions packages/js-evo-sdk/src/system/facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,18 @@ export class SystemFacade {
return w.getPrefundedSpecializedBalanceWithProofInfo(identityId);
}

async pathElements(path: string[], keys: string[]): Promise<wasm.PathElement[]> {
async pathElements(
path: wasm.GrovePathSegment[],
keys: wasm.GrovePathSegment[],
): Promise<wasm.PathElement[]> {
const w = await this.sdk.getWasmSdkConnected();
return w.getPathElements(path, keys);
}

async pathElementsWithProof(path: string[], keys: string[]):
Promise<wasm.ProofMetadataResponseTyped<wasm.PathElement[]>> {
async pathElementsWithProof(
path: wasm.GrovePathSegment[],
keys: wasm.GrovePathSegment[],
): Promise<wasm.ProofMetadataResponseTyped<wasm.PathElement[]>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getPathElementsWithProofInfo(path, keys);
}
Expand Down
14 changes: 12 additions & 2 deletions packages/js-evo-sdk/tests/unit/facades/system.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,25 @@ describe('SystemFacade', () => {

describe('pathElements()', () => {
it('should forward to getPathElements', async () => {
await client.system.pathElements(['p'], ['k']);
const path = ['p', new Uint8Array([0x80, 0xff])];
const keys = [new Uint8Array([0x01, 0x02])];

await client.system.pathElements(path, keys);

expect(getPathElementsStub).to.be.calledOnce();
expect(getPathElementsStub).to.be.calledWithExactly(path, keys);
});
});

describe('pathElementsWithProof()', () => {
it('should forward to getPathElementsWithProofInfo', async () => {
await client.system.pathElementsWithProof(['p2'], ['k2']);
const path = ['p2', new Uint8Array([0x80, 0xff])];
const keys = [new Uint8Array([0x03, 0x04])];

await client.system.pathElementsWithProof(path, keys);

expect(getPathElementsWithProofInfoStub).to.be.calledOnce();
expect(getPathElementsWithProofInfoStub).to.be.calledWithExactly(path, keys);
});
});
});
Loading
Loading