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

Auto acknowledge on close #197

Merged
merged 3 commits into from
Oct 19, 2023
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/integration/Protection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ async function createAndCloseIdentityLoc(
});
await signer.signAndSend({
signerId: legalOfficerAddress,
submittable: api.polkadot.tx.logionLoc.close(api.adapters.toLocId(identityLocId))
submittable: api.polkadot.tx.logionLoc.close(api.adapters.toLocId(identityLocId), null, false)
});
return identityLocId;
}
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.33.0-1",
"version": "0.33.0-2",
"description": "logion SDK for client applications",
"main": "dist/index.js",
"packageManager": "[email protected]",
Expand Down
20 changes: 8 additions & 12 deletions packages/client/src/LocClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ export class ClientToken {
type: type as TokenType,
issuance: this.issuance,
};
}
}
}

export interface ClientItemFile {
Expand Down Expand Up @@ -1905,17 +1905,13 @@ export class AuthenticatedLocClient extends LocClient {
}

async close(parameters: { locId: UUID, seal?: string } & BlockchainSubmissionParams): Promise<void> {
let submittable: SubmittableExtrinsic;
if(parameters.seal) {
submittable = this.nodeApi.polkadot.tx.logionLoc.closeAndSeal(
this.nodeApi.adapters.toLocId(parameters.locId),
parameters.seal,
);
} else {
submittable = this.nodeApi.polkadot.tx.logionLoc.close(
this.nodeApi.adapters.toLocId(parameters.locId),
);
}
const seal = parameters.seal || null;
const autoAck = false; // TODO temporarily hard-coded to keep previous behaviour.
const submittable = this.nodeApi.polkadot.tx.logionLoc.close(
this.nodeApi.adapters.toLocId(parameters.locId),
seal,
autoAck,
);

const fees = await this.nodeApi.fees.estimateWithoutStorage({
origin: this.currentAddress.address,
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.23.0",
"version": "0.24.0-1",
"description": "logion API",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down
12 changes: 8 additions & 4 deletions packages/node-api/src/interfaces/augment-api-errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ declare module '@polkadot/api-base/types/errors' {
**/
AlreadyExists: AugmentedError<ApiType>;
/**
* Issuer has already been nominated by the guardian
* Issuer has already been nominated by the owner
**/
AlreadyNominated: AugmentedError<ApiType>;
/**
Expand All @@ -255,9 +255,13 @@ declare module '@polkadot/api-base/types/errors' {
**/
CannotAddRecord: AugmentedError<ApiType>;
/**
* There is still at least one Unacknowledged Item (Metadata or File)
* There is still at least one Item (Metadata, Link or File) unacknowledged by LOC owner
**/
CannotCloseUnacknowledged: AugmentedError<ApiType>;
CannotCloseUnacknowledgedByOwner: AugmentedError<ApiType>;
/**
* There is still at least one Item (Metadata, Link or File) unacknowledged by verified issuer
**/
CannotCloseUnacknowledgedByVerifiedIssuer: AugmentedError<ApiType>;
/**
* The sponsorship cannot be used for creating the new LOC
**/
Expand Down Expand Up @@ -363,7 +367,7 @@ declare module '@polkadot/api-base/types/errors' {
**/
NotFound: AugmentedError<ApiType>;
/**
* Issuer is not nominated by the guardian
* Issuer is not nominated by the owner
**/
NotNominated: AugmentedError<ApiType>;
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/node-api/src/interfaces/augment-api-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ declare module '@polkadot/api-base/types/storage' {
**/
verifiedIssuersByLocMap: AugmentedQuery<ApiType, (arg1: u128 | AnyNumber | Uint8Array, arg2: AccountId32 | string | Uint8Array) => Observable<Option<Null>>, [u128, AccountId32]> & QueryableStorageEntry<ApiType, [u128, AccountId32]>;
/**
* Verified Issuers by guardian
* Verified Issuers by owner
**/
verifiedIssuersMap: AugmentedQuery<ApiType, (arg1: AccountId32 | string | Uint8Array, arg2: AccountId32 | string | Uint8Array) => Observable<Option<PalletLogionLocVerifiedIssuer>>, [AccountId32, AccountId32]> & QueryableStorageEntry<ApiType, [AccountId32, AccountId32]>;
/**
Expand Down
10 changes: 1 addition & 9 deletions packages/node-api/src/interfaces/augment-api-tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,6 @@ declare module '@polkadot/api-base/types/submittable' {
* See [`Pallet::add_collection_item`].
**/
addCollectionItem: AugmentedSubmittable<(collectionLocId: Compact<u128> | AnyNumber | Uint8Array, itemId: H256 | string | Uint8Array, itemDescription: H256 | string | Uint8Array, itemFiles: Vec<PalletLogionLocCollectionItemFile> | (PalletLogionLocCollectionItemFile | { name?: any; contentType?: any; size_?: any; hash_?: any } | string | Uint8Array)[], itemToken: Option<PalletLogionLocCollectionItemToken> | null | Uint8Array | PalletLogionLocCollectionItemToken | { tokenType?: any; tokenId?: any; tokenIssuance?: any } | string, restrictedDelivery: bool | boolean | Uint8Array, termsAndConditions: Vec<PalletLogionLocTermsAndConditionsElement> | (PalletLogionLocTermsAndConditionsElement | { tcType?: any; tcLoc?: any; details?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Compact<u128>, H256, H256, Vec<PalletLogionLocCollectionItemFile>, Option<PalletLogionLocCollectionItemToken>, bool, Vec<PalletLogionLocTermsAndConditionsElement>]>;
/**
* See [`Pallet::add_collection_item_with_terms_and_conditions`].
**/
addCollectionItemWithTermsAndConditions: AugmentedSubmittable<(collectionLocId: Compact<u128> | AnyNumber | Uint8Array, itemId: H256 | string | Uint8Array, itemDescription: H256 | string | Uint8Array, itemFiles: Vec<PalletLogionLocCollectionItemFile> | (PalletLogionLocCollectionItemFile | { name?: any; contentType?: any; size_?: any; hash_?: any } | string | Uint8Array)[], itemToken: Option<PalletLogionLocCollectionItemToken> | null | Uint8Array | PalletLogionLocCollectionItemToken | { tokenType?: any; tokenId?: any; tokenIssuance?: any } | string, restrictedDelivery: bool | boolean | Uint8Array, termsAndConditions: Vec<PalletLogionLocTermsAndConditionsElement> | (PalletLogionLocTermsAndConditionsElement | { tcType?: any; tcLoc?: any; details?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Compact<u128>, H256, H256, Vec<PalletLogionLocCollectionItemFile>, Option<PalletLogionLocCollectionItemToken>, bool, Vec<PalletLogionLocTermsAndConditionsElement>]>;
/**
* See [`Pallet::add_file`].
**/
Expand All @@ -270,11 +266,7 @@ declare module '@polkadot/api-base/types/submittable' {
/**
* See [`Pallet::close`].
**/
close: AugmentedSubmittable<(locId: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u128>]>;
/**
* See [`Pallet::close_and_seal`].
**/
closeAndSeal: AugmentedSubmittable<(locId: Compact<u128> | AnyNumber | Uint8Array, seal: H256 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u128>, H256]>;
close: AugmentedSubmittable<(locId: Compact<u128> | AnyNumber | Uint8Array, seal: Option<H256> | null | Uint8Array | H256 | string, autoAck: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u128>, Option<H256>, bool]>;
/**
* See [`Pallet::create_collection_loc`].
**/
Expand Down
Loading
Loading