Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "get legal officer data" query with guest #270

Merged
merged 2 commits into from
Jun 13, 2024
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
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@logion/client",
"version": "0.45.1-1",
"version": "0.45.1-2",
"description": "logion SDK for client applications",
"main": "dist/index.js",
"packageManager": "[email protected]",
Expand Down
12 changes: 9 additions & 3 deletions packages/node-api/integration/LoAuthorityList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,24 @@ import { setup, signAndSend } from "./Util.js";

export async function addGuestLegalOfficer() {
const { alice, api } = await setup();
const dave = api.adapters.getValidPolkadotAccountId("5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy").address;
const dave = api.adapters.getValidPolkadotAccountId("5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy");

const extrinsic = api.polkadot.tx.loAuthorityList.addLegalOfficer(dave, {
const extrinsic = api.polkadot.tx.loAuthorityList.addLegalOfficer(dave.address, {
Guest: alice.address,
});
const sudoExtrinsic = api.polkadot.tx.sudo.sudo(extrinsic);
const result = await signAndSend(alice, sudoExtrinsic);

expect(result.dispatchError).not.toBeDefined();
const entry = await api.polkadot.query.loAuthorityList.legalOfficerSet(dave);
const entry = await api.polkadot.query.loAuthorityList.legalOfficerSet(dave.address);
expect(entry.isSome).toBe(true);
const host = entry.unwrap().asGuest;
expect(host.hostId.toString()).toBe(alice.address);

const legalOfficerData = await api.queries.getLegalOfficerData(dave);
expect(legalOfficerData.isHost).toBe(false);
expect(legalOfficerData.hostData).toBeDefined();
expect(legalOfficerData.hostAccount).toEqual(ValidAccountId.polkadot(alice.address));
}

export async function updateHostLegalOfficer() {
Expand Down
2 changes: 1 addition & 1 deletion packages/node-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@logion/node-api",
"version": "0.31.0",
"version": "0.31.1-1",
"description": "logion API",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/node-api/src/Queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export class Queries {
guests: await this.getGuestsOf(accountId),
};
} else {
const hostAddress = someLegalOfficerData.asGuest.toString();
const hostAddress = someLegalOfficerData.asGuest.hostId.toString();
const hostLegalOfficerData = await this.api.query.loAuthorityList.legalOfficerSet(hostAddress);
const hostData = this.adapters.toHostData(hostLegalOfficerData.unwrap());
onchainSettings = {
Expand Down