Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 4 additions & 4 deletions apps/account-api/src/controllers/v1/keys-v1.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ export class KeysControllerV1 {
/**
* Using the provided query parameters, creates a new payload that can be signed to add new graph keys.
* @param queryParams - The query parameters for adding a new key
* @returns Payload is included for convenience. Encoded payload to be used when signing the transaction.
* @throws An error if the key already exists or the payload creation fails.
* @returns Payload is included for convenience. Encoded payload is signed to generate the proof for adding the key.
* @throws An error if the key already exists or the payload creation fails, or signature verification fails.
*/
async getPublicKeyAgreementsKeyPayload(
@Query() { msaId, newKey }: PublicKeyAgreementsKeyPayload,
@Query() { msaId, newKey, schemaId }: PublicKeyAgreementsKeyPayload,
): Promise<AddNewPublicKeyAgreementPayloadRequest> {
return this.keysService.getAddPublicKeyAgreementPayload(msaId, newKey);
return this.keysService.getAddPublicKeyAgreementPayload(msaId, newKey, schemaId);
}

@Post('publicKeyAgreements')
Expand Down
4 changes: 3 additions & 1 deletion apps/account-api/src/services/keys.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,12 @@ export class KeysService implements OnApplicationBootstrap {
async getAddPublicKeyAgreementPayload(
msaId: string,
newKey: HexString,
incomingSchemaId?: number,
): Promise<AddNewPublicKeyAgreementPayloadRequest> {
const expiration = await this.getExpiration();

const schemaId = await this.blockchainService.getLatestSchemaIdForIntent(this.graphKeyIntentId);
const schemaId =
incomingSchemaId ?? (await this.blockchainService.getLatestSchemaIdForIntent(this.graphKeyIntentId));

const itemizedStorage = await this.blockchainService.getItemizedStorage(msaId, this.graphKeyIntentId);
if (
Expand Down
484 changes: 242 additions & 242 deletions docs/account-worker/index.html

Large diffs are not rendered by default.

954 changes: 476 additions & 478 deletions docs/account/index.html

Large diffs are not rendered by default.

692 changes: 346 additions & 346 deletions docs/account/webhooks.html

Large diffs are not rendered by default.

484 changes: 242 additions & 242 deletions docs/content-publishing-worker/index.html

Large diffs are not rendered by default.

838 changes: 419 additions & 419 deletions docs/content-publishing/index.html

Large diffs are not rendered by default.

770 changes: 385 additions & 385 deletions docs/content-watcher/index.html

Large diffs are not rendered by default.

664 changes: 332 additions & 332 deletions docs/content-watcher/webhooks.html

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion libs/types/src/account-webhook/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export enum TransactionType {
RETIRE_MSA = 'RETIRE_MSA',
ADD_PUBLIC_KEY_AGREEMENT = 'ADD_PUBLIC_KEY_AGREEMENT',
REVOKE_DELEGATION = 'REVOKE_DELEGATION',
ICS_PUBLISH = 'ICS_PUBLISH',
}

export type TxWebhookRspBase = {
Expand Down
13 changes: 11 additions & 2 deletions libs/types/src/dtos/account/graphs.request.dto.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// eslint-disable-next-line max-classes-per-file
import { ArrayNotEmpty, IsArray, IsEnum, IsNotEmpty, ValidateIf, ValidateNested } from 'class-validator';
import { ArrayNotEmpty, IsArray, IsEnum, IsNotEmpty, IsOptional, ValidateIf, ValidateNested } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';
import { HexString } from '@polkadot/util/types';
import { IsHexValue } from '#utils/decorators';
Expand Down Expand Up @@ -134,4 +134,13 @@ export class PublicKeyAgreementsKeyPayload {
*/
@IsHexValue({ minLength: 64, maxLength: 64 })
newKey: HexString;
}

/**
* Schema Id - The number of the schema to generate the payload for
* @example 16299
* @default DSNP graph key schema value for configured Frequency chain
**/
@IsSchemaId()
@IsOptional()
schemaId: number;
};
111 changes: 32 additions & 79 deletions openapi-specs/account.openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@
]
}
},
"/v2/delegations/{msaId}": {
"/v3/delegations/{msaId}": {
"get": {
"operationId": "DelegationsControllerV2_getDelegation_v2",
"operationId": "DelegationsControllerV3_getDelegation_v3",
"parameters": [
{
"name": "msaId",
Expand All @@ -254,21 +254,21 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DelegationResponseV2"
"$ref": "#/components/schemas/DelegationResponse"
}
}
}
}
},
"summary": "Get all delegation information associated with an MSA Id",
"tags": [
"v2/delegations"
"v3/delegations"
]
}
},
"/v2/delegations/{msaId}/{providerId}": {
"/v3/delegations/{msaId}/{providerId}": {
"get": {
"operationId": "DelegationsControllerV2_getProviderDelegation_v2",
"operationId": "DelegationsControllerV3_getProviderDelegation_v3",
"parameters": [
{
"name": "msaId",
Expand All @@ -291,39 +291,6 @@
}
}
],
"responses": {
"200": {
"description": "Found delegation information",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DelegationResponseV2"
}
}
}
}
},
"summary": "Get an MSA's delegation information for a specific provider",
"tags": [
"v2/delegations"
]
}
},
"/v1/delegation/{msaId}": {
"get": {
"operationId": "DelegationControllerV1_getDelegation_v1",
"parameters": [
{
"name": "msaId",
"required": true,
"in": "path",
"description": "Msa Id of requested account",
"schema": {
"example": "2",
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Found delegation information",
Expand All @@ -336,15 +303,15 @@
}
}
},
"summary": "Get the delegation information associated with an MSA Id",
"summary": "Get an MSA's delegation information for a specific provider",
"tags": [
"v1/delegation"
"v3/delegations"
]
}
},
"/v1/delegation/revokeDelegation/{accountId}/{providerId}": {
"/v3/delegations/revokeDelegation/{accountId}/{providerId}": {
"get": {
"operationId": "DelegationControllerV1_getRevokeDelegationPayload_v1",
"operationId": "DelegationsControllerV3_getRevokeDelegationPayload_v3",
"parameters": [
{
"name": "accountId",
Expand Down Expand Up @@ -381,13 +348,13 @@
},
"summary": "Get a properly encoded RevokeDelegationPayload that can be signed",
"tags": [
"v1/delegation"
"v3/delegations"
]
}
},
"/v1/delegation/revokeDelegation": {
"/v3/delegations/revokeDelegation": {
"post": {
"operationId": "DelegationControllerV1_postRevokeDelegation_v1",
"operationId": "DelegationsControllerV3_postRevokeDelegation_v3",
"parameters": [],
"requestBody": {
"required": true,
Expand All @@ -413,7 +380,7 @@
},
"summary": "Request to revoke a delegation",
"tags": [
"v1/delegation"
"v3/delegations"
]
}
},
Expand Down Expand Up @@ -645,6 +612,16 @@
"example": "0x0ed2f8c714efcac51ca2325cfe95637e5e0b898ae397aa365978b7348a717d0b",
"type": "string"
}
},
{
"name": "schemaId",
"required": true,
"in": "query",
"description": "Schema Id: The number of the schema to generate the payload for",
"schema": {
"example": 16299,
"type": "number"
}
}
],
"responses": {
Expand Down Expand Up @@ -1132,18 +1109,18 @@
"referenceId"
]
},
"SchemaDelegation": {
"IntentDelegation": {
"type": "object",
"properties": {
"schemaId": {
"intentId": {
"type": "number"
},
"revokedAtBlock": {
"type": "number"
}
},
"required": [
"schemaId"
"intentId"
]
},
"Delegation": {
Expand All @@ -1152,10 +1129,10 @@
"providerId": {
"type": "string"
},
"schemaDelegations": {
"delegatedIntents": {
"type": "array",
"items": {
"$ref": "#/components/schemas/SchemaDelegation"
"$ref": "#/components/schemas/IntentDelegation"
}
},
"revokedAtBlock": {
Expand All @@ -1164,10 +1141,10 @@
},
"required": [
"providerId",
"schemaDelegations"
"delegatedIntents"
]
},
"DelegationResponseV2": {
"DelegationResponse": {
"type": "object",
"properties": {
"msaId": {
Expand All @@ -1185,29 +1162,6 @@
"delegations"
]
},
"u32": {
"type": "object",
"properties": {}
},
"DelegationResponse": {
"type": "object",
"properties": {
"providerId": {
"type": "string"
},
"schemaPermissions": {
"type": "object"
},
"revokedAt": {
"$ref": "#/components/schemas/u32"
}
},
"required": [
"providerId",
"schemaPermissions",
"revokedAt"
]
},
"RevokeDelegationPayloadResponseDto": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -1610,8 +1564,7 @@
{
"name": "delegations",
"tags": [
"v1/delegation",
"v2/delegations"
"v3/delegations"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions openapi-specs/content-watcher.openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@
"ChainWatchOptionsDto": {
"type": "object",
"properties": {
"schemaIds": {
"description": "Specific schema ids to watch for",
"intentIds": {
"description": "Specific Intent ids to watch for",
"example": [
1,
19
Expand Down
Loading