Skip to content

Commit

Permalink
feat: update logion-client (BlockchainSubmission used everywhere).
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitdevos committed May 13, 2024
1 parent cd9a93c commit 8c9adea
Show file tree
Hide file tree
Showing 15 changed files with 52 additions and 26 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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-1",
"@logion/client-browser": "^0.3.5",
"@logion/crossmint": "^0.1.32",
"@logion/extension": "^0.8.1-1",
Expand Down
2 changes: 1 addition & 1 deletion src/legal-officer/votes/Mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down
4 changes: 3 additions & 1 deletion src/legal-officer/votes/YourVote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
12 changes: 9 additions & 3 deletions src/loc/AcknowledgeButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<FileData>().hash,
payload: {
hash: props.locItem.as<FileData>().hash,
},
signer,
callback,
});
} else if(props.locItem.type === "Data") {
return current.legalOfficer.acknowledgeMetadata({
nameHash: props.locItem.as<MetadataData>().name.hash,
payload: {
nameHash: props.locItem.as<MetadataData>().name.hash,
},
signer,
callback,
});
} else if(props.locItem.type === "Linked LOC") {
return current.legalOfficer.acknowledgeLink({
target: props.locItem.as<LinkData>().linkedLoc.id,
payload: {
target: props.locItem.as<LinkData>().linkedLoc.id,
},
signer,
callback,
});
Expand Down
4 changes: 3 additions & 1 deletion src/loc/CloseLocButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
4 changes: 2 additions & 2 deletions src/loc/LocCreationDialog.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -147,7 +147,7 @@ function mockLegalOfficerCreateLoc(requesterLocId?: UUID) {
locsState.findById = () => openLoc;

locsState.legalOfficer = {
createLoc: async function (params: OpenLocParams & BlockchainSubmissionParams): Promise<OpenLoc> {
createLoc: async function (params: BlockchainSubmission<OpenLocParams>): Promise<OpenLoc> {
params.callback!(mockSubmittableResult(true));
return openLoc;
}
Expand Down
6 changes: 4 additions & 2 deletions src/loc/LocCreationSteps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
4 changes: 3 additions & 1 deletion src/loc/LocPublishLinkButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
4 changes: 3 additions & 1 deletion src/loc/LocPublishPrivateFileButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
4 changes: 3 additions & 1 deletion src/loc/LocPublishPublicDataButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
4 changes: 3 additions & 1 deletion src/loc/OpenLoc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ export default function OpenLoc(props: Props) {
return current.open({
signer,
callback,
autoPublish
payload: {
autoPublish
}
});
} else {
return current;
Expand Down
4 changes: 3 additions & 1 deletion src/loc/VoidLocButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
6 changes: 4 additions & 2 deletions src/loc/VoidLocReplaceExistingButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
4 changes: 3 additions & 1 deletion src/loc/issuer/IssuerSelectionCheckbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
14 changes: 7 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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-1":
version: 0.45.0-1
resolution: "@logion/client@npm:0.45.0-1"
dependencies:
"@logion/node-api": ^0.30.0
"@logion/node-api": ^0.30.0-1
axios: ^1.6.7
luxon: ^3.4.4
mime-db: ^1.52.0
checksum: b2960b89db4a734604a5a06be8ef7f7ae5bc963f10d7f056933b9d7323ee24330d367741cd5e0bd553d71b4226b2dcef4449857412a0717a7a54220ae74fe6a5
checksum: 637db6d06aab6bbc953d18fef9da998ef262b8597bb2d4b9bf5d96224548956807d3a9df84e9851315a953a97e9dc2a2e0e9cb3d749a73a7e7152c90446470ec
languageName: node
linkType: hard

Expand Down Expand Up @@ -3263,7 +3263,7 @@ __metadata:
languageName: node
linkType: hard

"@logion/node-api@npm:^0.30.0":
"@logion/node-api@npm:^0.30.0-1":
version: 0.30.0
resolution: "@logion/node-api@npm:0.30.0"
dependencies:
Expand Down Expand Up @@ -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-1
"@logion/client-browser": ^0.3.5
"@logion/crossmint": ^0.1.32
"@logion/extension": ^0.8.1-1
Expand Down

0 comments on commit 8c9adea

Please sign in to comment.