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

Update logion-client (BlockchainSubmission used everywhere). #570

Merged
merged 1 commit into from
May 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 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-2",
"@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
10 changes: 5 additions & 5 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-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

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-2
"@logion/client-browser": ^0.3.5
"@logion/crossmint": ^0.1.32
"@logion/extension": ^0.8.1-1
Expand Down
Loading