From a4468670e0e30b93215cffb4f3df3cdeab3a0cbc Mon Sep 17 00:00:00 2001 From: Benoit Devos Date: Fri, 10 May 2024 15:51:06 +0200 Subject: [PATCH] feat: update logion-client (BlockchainSubmission used everywhere). logion-network/logion-internal#1246 --- package.json | 2 +- src/legal-officer/votes/Mocks.ts | 2 +- src/legal-officer/votes/YourVote.tsx | 4 +++- src/loc/AcknowledgeButton.tsx | 12 +++++++++--- src/loc/CloseLocButton.tsx | 4 +++- src/loc/LocCreationDialog.test.tsx | 4 ++-- src/loc/LocCreationSteps.tsx | 6 ++++-- src/loc/LocPublishLinkButton.tsx | 4 +++- src/loc/LocPublishPrivateFileButton.tsx | 4 +++- src/loc/LocPublishPublicDataButton.tsx | 4 +++- src/loc/OpenLoc.tsx | 4 +++- src/loc/VoidLocButton.tsx | 4 +++- src/loc/VoidLocReplaceExistingButton.tsx | 6 ++++-- src/loc/issuer/IssuerSelectionCheckbox.tsx | 4 +++- yarn.lock | 10 +++++----- 15 files changed, 50 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index 0cd54367..faafbcae 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "license": "Apache-2.0", "dependencies": { "@creativecommons/cc-assets": "^0.1.0", - "@logion/client": "^0.44.0", + "@logion/client": "^0.45.0-2", "@logion/client-browser": "^0.3.5", "@logion/crossmint": "^0.1.32", "@logion/extension": "^0.8.1-1", diff --git a/src/legal-officer/votes/Mocks.ts b/src/legal-officer/votes/Mocks.ts index 9115a4d9..d43c5ea3 100644 --- a/src/legal-officer/votes/Mocks.ts +++ b/src/legal-officer/votes/Mocks.ts @@ -16,7 +16,7 @@ export function mockVote(votes: Votes, data: VoteData): Vote { const vote = Votes.toVote(votes, data); if(vote instanceof PendingVote) { vote.castVote = params => { - vote.data.ballots[DEFAULT_USER_ACCOUNT.accountId.address] = params.result; + vote.data.ballots[DEFAULT_USER_ACCOUNT.accountId.address] = params.payload.result; params.callback!(mockSubmittableResult(true)); return Promise.resolve(vote); }; diff --git a/src/legal-officer/votes/YourVote.tsx b/src/legal-officer/votes/YourVote.tsx index 1b162b58..0a6e6645 100644 --- a/src/legal-officer/votes/YourVote.tsx +++ b/src/legal-officer/votes/YourVote.tsx @@ -30,7 +30,9 @@ export default function YourVote(props: Props) { if(signer && vote.data.status === "PENDING") { const pendingVote = vote as PendingVote; const updatedVote = await pendingVote.castVote({ - result: myVote, + payload: { + result: myVote, + }, signer, callback, }); diff --git a/src/loc/AcknowledgeButton.tsx b/src/loc/AcknowledgeButton.tsx index 247fbb7e..73c2134a 100644 --- a/src/loc/AcknowledgeButton.tsx +++ b/src/loc/AcknowledgeButton.tsx @@ -64,19 +64,25 @@ export default function AcknowledgeButton(props: Props) { if(signer && current instanceof OpenLoc) { if(props.locItem.type === "Document") { return current.legalOfficer.acknowledgeFile({ - hash: props.locItem.as().hash, + payload: { + hash: props.locItem.as().hash, + }, signer, callback, }); } else if(props.locItem.type === "Data") { return current.legalOfficer.acknowledgeMetadata({ - nameHash: props.locItem.as().name.hash, + payload: { + nameHash: props.locItem.as().name.hash, + }, signer, callback, }); } else if(props.locItem.type === "Linked LOC") { return current.legalOfficer.acknowledgeLink({ - target: props.locItem.as().linkedLoc.id, + payload: { + target: props.locItem.as().linkedLoc.id, + }, signer, callback, }); diff --git a/src/loc/CloseLocButton.tsx b/src/loc/CloseLocButton.tsx index 75a675b4..9eab531f 100644 --- a/src/loc/CloseLocButton.tsx +++ b/src/loc/CloseLocButton.tsx @@ -35,7 +35,9 @@ export default function CloseLocButton() { mutateLocState(async current => { if(signer && current instanceof OpenLoc) { return current.legalOfficer.close({ - autoAck, + payload: { + autoAck, + }, signer, callback, }); diff --git a/src/loc/LocCreationDialog.test.tsx b/src/loc/LocCreationDialog.test.tsx index d5bd15ee..a5cdfabf 100644 --- a/src/loc/LocCreationDialog.test.tsx +++ b/src/loc/LocCreationDialog.test.tsx @@ -7,7 +7,7 @@ import { TEST_WALLET_USER } from "../wallet-user/TestData"; import LocCreationDialog from "./LocCreationDialog"; import { setAuthenticatedUser } from "src/common/__mocks__/ModelMock"; -import { LocData, OpenLoc, OpenLocParams, BlockchainSubmissionParams, LogionClient } from "@logion/client"; +import { LocData, OpenLoc, OpenLocParams, BlockchainSubmission, LogionClient } from "@logion/client"; import { mockSubmittableResult } from "../logion-chain/__mocks__/SignatureMock"; import { setLocsState } from "../legal-officer/__mocks__/LegalOfficerContextMock"; import { SUCCESSFUL_SUBMISSION, setClientMock, setExtrinsicSubmissionState } from "../logion-chain/__mocks__/LogionChainMock"; @@ -147,7 +147,7 @@ function mockLegalOfficerCreateLoc(requesterLocId?: UUID) { locsState.findById = () => openLoc; locsState.legalOfficer = { - createLoc: async function (params: OpenLocParams & BlockchainSubmissionParams): Promise { + createLoc: async function (params: BlockchainSubmission): Promise { params.callback!(mockSubmittableResult(true)); return openLoc; } diff --git a/src/loc/LocCreationSteps.tsx b/src/loc/LocCreationSteps.tsx index eb549884..e59d6749 100644 --- a/src/loc/LocCreationSteps.tsx +++ b/src/loc/LocCreationSteps.tsx @@ -48,8 +48,10 @@ export default function LocCreationSteps(props: Props) { await mutateLocsState(async current => { if (signer) { const loc = await current.legalOfficer.createLoc({ - ...locToCreate, - locType: locToCreate.locType, + payload: { + ...locToCreate, + locType: locToCreate.locType, + }, signer, callback, }); diff --git a/src/loc/LocPublishLinkButton.tsx b/src/loc/LocPublishLinkButton.tsx index c02349ed..73de29a3 100644 --- a/src/loc/LocPublishLinkButton.tsx +++ b/src/loc/LocPublishLinkButton.tsx @@ -29,7 +29,9 @@ export default function LocPublishLinkButton(props: Props) { publishMutator={ async (current, callback) => { if(current instanceof OpenLoc) { return current.publishLink({ - target: props.locItem.data().linkedLoc.id, + payload: { + target: props.locItem.data().linkedLoc.id, + }, signer: signer!, callback, }); diff --git a/src/loc/LocPublishPrivateFileButton.tsx b/src/loc/LocPublishPrivateFileButton.tsx index 99b01171..1f309499 100644 --- a/src/loc/LocPublishPrivateFileButton.tsx +++ b/src/loc/LocPublishPrivateFileButton.tsx @@ -34,7 +34,9 @@ export default function LocPublishPrivateFileButton(props: Props) { if(current instanceof OpenLoc) { return current.publishFile({ - hash: props.locItem.data().hash, + payload: { + hash: props.locItem.data().hash, + }, signer: signer!, callback, }); diff --git a/src/loc/LocPublishPublicDataButton.tsx b/src/loc/LocPublishPublicDataButton.tsx index 8ec513c1..92b0203e 100644 --- a/src/loc/LocPublishPublicDataButton.tsx +++ b/src/loc/LocPublishPublicDataButton.tsx @@ -31,7 +31,9 @@ export default function LocPublishPublicDataButton(props: Props) { && props.locItem.submitter) { return current.publishMetadata({ - nameHash: props.locItem.data().name.hash, + payload: { + nameHash: props.locItem.data().name.hash, + }, signer: signer!, callback, }); diff --git a/src/loc/OpenLoc.tsx b/src/loc/OpenLoc.tsx index 0374ceb9..f10b4c66 100644 --- a/src/loc/OpenLoc.tsx +++ b/src/loc/OpenLoc.tsx @@ -51,7 +51,9 @@ export default function OpenLoc(props: Props) { return current.open({ signer, callback, - autoPublish + payload: { + autoPublish + } }); } else { return current; diff --git a/src/loc/VoidLocButton.tsx b/src/loc/VoidLocButton.tsx index cb4739d7..a94a66b2 100644 --- a/src/loc/VoidLocButton.tsx +++ b/src/loc/VoidLocButton.tsx @@ -23,7 +23,9 @@ export default function VoidLocButton() { mutateLocState(async current => { if (signer && (current instanceof OpenLoc || current instanceof ClosedLoc || current instanceof ClosedCollectionLoc)) { return current.legalOfficer.voidLoc({ - reason, + payload: { + reason, + }, signer, callback, }); diff --git a/src/loc/VoidLocReplaceExistingButton.tsx b/src/loc/VoidLocReplaceExistingButton.tsx index a0d9b16e..3940b998 100644 --- a/src/loc/VoidLocReplaceExistingButton.tsx +++ b/src/loc/VoidLocReplaceExistingButton.tsx @@ -42,8 +42,10 @@ export default function VoidLocReplaceExistingButton() { await mutateLocState(async current => { if (signer && (current instanceof OpenLoc || current instanceof ClosedLoc || current instanceof ClosedCollectionLoc)) { return current.legalOfficer.voidLoc({ - reason, - replacer: locId, + payload: { + reason, + replacer: locId, + }, signer, callback, }); diff --git a/src/loc/issuer/IssuerSelectionCheckbox.tsx b/src/loc/issuer/IssuerSelectionCheckbox.tsx index 67b360f5..b7748cdf 100644 --- a/src/loc/issuer/IssuerSelectionCheckbox.tsx +++ b/src/loc/issuer/IssuerSelectionCheckbox.tsx @@ -29,7 +29,9 @@ export default function IssuerSelectionCheckbox(props: Props) { const call = async (callback: CallCallback) => mutateLocState(async current => { if(signer && (current instanceof OpenLoc || current instanceof ClosedCollectionLoc)) { const params = { - issuer: issuerSelection.account, + payload: { + issuer: issuerSelection.account, + }, signer, callback, }; diff --git a/yarn.lock b/yarn.lock index 7f7b45e6..eb3a397a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3216,15 +3216,15 @@ __metadata: languageName: node linkType: hard -"@logion/client@npm:^0.44.0": - version: 0.44.0 - resolution: "@logion/client@npm:0.44.0" +"@logion/client@npm:^0.45.0-2": + version: 0.45.0-2 + resolution: "@logion/client@npm:0.45.0-2" dependencies: "@logion/node-api": ^0.30.0 axios: ^1.6.7 luxon: ^3.4.4 mime-db: ^1.52.0 - checksum: b2960b89db4a734604a5a06be8ef7f7ae5bc963f10d7f056933b9d7323ee24330d367741cd5e0bd553d71b4226b2dcef4449857412a0717a7a54220ae74fe6a5 + checksum: 6550c4a5649a58834a9743e4115b32b8de7996f31134c63a687e13b9066b27179ad65b3d80f5eb954693a0a35832aac8d77e1bfa5176f78ff85d6224f4c5007f languageName: node linkType: hard @@ -12106,7 +12106,7 @@ __metadata: "@babel/preset-react": ^7.23.3 "@babel/preset-typescript": ^7.23.3 "@creativecommons/cc-assets": ^0.1.0 - "@logion/client": ^0.44.0 + "@logion/client": ^0.45.0-2 "@logion/client-browser": ^0.3.5 "@logion/crossmint": ^0.1.32 "@logion/extension": ^0.8.1-1