From d164992fc3b67b5162881d6e1534ce88826e20d9 Mon Sep 17 00:00:00 2001 From: AbstractFruitFactory Date: Fri, 12 Jan 2024 11:03:51 +0000 Subject: [PATCH 01/19] fix: load all non fungible resources --- sdk/typescript/lib/subapis/state.ts | 156 +++++++++++++++++++++------- 1 file changed, 121 insertions(+), 35 deletions(-) diff --git a/sdk/typescript/lib/subapis/state.ts b/sdk/typescript/lib/subapis/state.ts index 24c996ea5..41c5b6141 100644 --- a/sdk/typescript/lib/subapis/state.ts +++ b/sdk/typescript/lib/subapis/state.ts @@ -17,6 +17,7 @@ import { StateEntityDetailsResponseItem, StateEntityFungiblesPageResponse, StateEntityMetadataPageResponse, + StateEntityNonFungiblesPageResponse, StateNonFungibleDetailsResponseItem, StateNonFungibleIdsResponse, StateNonFungibleLocationResponseItem, @@ -62,14 +63,14 @@ export class State { constructor( public innerClient: StateApi, public configuration: RuntimeConfiguration - ) {} + ) { } /** * Get detailed information about entities together with vault aggregated fungible and non-fungible resources. * Returns an array or single item depending on input value. If array is passed, it will be split into chunks of 20 addresses * which will be requested separately and returned only if all requests are successful. * - * Calling this function will exhaust list of all fungible resources for each entity. + * Calling this function will exhaust list of all resources for each entity. * If any of the requests fail, the whole operation will fail. * * When requesting details for `internal_vault` entity, `non_fungible_resources` and `fungible_resources` will be defaulted to objects with empty arrays @@ -135,21 +136,20 @@ export class State { return isArray ? Promise.all( - (items as StateEntityDetailsVaultResponseItem[]).map((item) => - this.queryAllFungibles( - item, - ledgerState || { - state_version: ledger_state.state_version, - } - ) + (items as StateEntityDetailsVaultResponseItem[]).map((item) => + this.queryAllResources( + item, + ledgerState || { + state_version: ledger_state.state_version, + } ) - ) - : this.queryAllFungibles( - items[0] as StateEntityDetailsVaultResponseItem, - ledgerState || { - state_version: ledger_state.state_version, - } - ) + )) + : this.queryAllResources( + items[0] as StateEntityDetailsVaultResponseItem, + ledgerState || { + state_version: ledger_state.state_version, + } + ) } /** @@ -383,6 +383,57 @@ export class State { > } + private async getEntityNonFungiblesPageVaultAggregated( + entity: string, + nextCursor?: string | undefined, + ledgerState?: LedgerStateSelector + ): Promise< + ReplaceProperty< + StateEntityNonFungiblesPageResponse, + 'items', + NonFungibleResourcesCollectionItemVaultAggregated[] + > + > { + return this.innerClient.entityNonFungiblesPage({ + stateEntityNonFungiblesPageRequest: { + address: entity, + cursor: nextCursor, + aggregation_level: 'Vault', + at_ledger_state: ledgerState, + }, + }) as Promise< + ReplaceProperty< + StateEntityNonFungiblesPageResponse, + 'items', + NonFungibleResourcesCollectionItemVaultAggregated[] + > + > + } + + private ensureResourcesProperties( + response: StateEntityDetailsResponse + ): ReplaceProperty< + StateEntityDetailsResponse, + 'items', + StateEntityDetailsVaultResponseItem[] + > { + return { + ...response, + items: response.items.map((item) => ({ + ...item, + fungible_resources: item.fungible_resources || { + total_count: 0, + items: [], + }, + non_fungible_resources: item.non_fungible_resources || { + total_count: 0, + items: [], + }, + })) as StateEntityDetailsVaultResponseItem[], + } + } + + private async queryAllFungibles( stateEntityDetails: StateEntityDetailsVaultResponseItem, ledgerState?: LedgerStateSelector @@ -412,26 +463,61 @@ export class State { }) } - private ensureResourcesProperties( - response: StateEntityDetailsResponse - ): ReplaceProperty< - StateEntityDetailsResponse, - 'items', - StateEntityDetailsVaultResponseItem[] - > { - return { - ...response, - items: response.items.map((item) => ({ - ...item, - fungible_resources: item.fungible_resources || { - total_count: 0, - items: [], + + private async queryAllNonFungibles( + stateEntityDetails: StateEntityDetailsVaultResponseItem, + ledgerState?: LedgerStateSelector + ): Promise { + const nextCursor = stateEntityDetails.non_fungible_resources.next_cursor + + if (!nextCursor) return Promise.resolve(stateEntityDetails) + + const allNonFungibles = await exhaustPaginationWithLedgerState( + (cursor) => + this.getEntityNonFungiblesPageVaultAggregated( + stateEntityDetails.address, + cursor, + ledgerState + ), + nextCursor + ) + + return Promise.resolve({ + ...stateEntityDetails, + non_fungible_resources: { + items: [ + ...stateEntityDetails.non_fungible_resources.items, + ...allNonFungibles.aggregatedEntities, + ], + }, + }) + } + + private async queryAllResources( + stateEntityDetails: StateEntityDetailsVaultResponseItem, + ledgerState?: LedgerStateSelector + ): Promise { + const itemsWithAllFungibles = this.queryAllFungibles(stateEntityDetails, ledgerState) + const itemsWithAllNonFungibles = this.queryAllNonFungibles(stateEntityDetails, ledgerState) + + return Promise.all([itemsWithAllFungibles, itemsWithAllNonFungibles]).then((results) => { + return { + ...stateEntityDetails, + fungible_resources: { + ...stateEntityDetails.fungible_resources, + items: [ + ...stateEntityDetails.fungible_resources.items, + ...results[0].fungible_resources.items, + ], }, - non_fungible_resources: item.non_fungible_resources || { - total_count: 0, - items: [], + non_fungible_resources: { + ...stateEntityDetails.non_fungible_resources, + items: [ + ...stateEntityDetails.non_fungible_resources.items, + ...results[1].non_fungible_resources.items, + ], }, - })) as StateEntityDetailsVaultResponseItem[], - } + } + }) } } From 16b0e3ad916d6c80be4e1c166705ea39a183c57d Mon Sep 17 00:00:00 2001 From: AbstractFruitFactory Date: Fri, 12 Jan 2024 12:26:39 +0000 Subject: [PATCH 02/19] fix: returned resources --- sdk/typescript/lib/subapis/state.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/sdk/typescript/lib/subapis/state.ts b/sdk/typescript/lib/subapis/state.ts index 41c5b6141..0d2824c08 100644 --- a/sdk/typescript/lib/subapis/state.ts +++ b/sdk/typescript/lib/subapis/state.ts @@ -506,14 +506,12 @@ export class State { fungible_resources: { ...stateEntityDetails.fungible_resources, items: [ - ...stateEntityDetails.fungible_resources.items, ...results[0].fungible_resources.items, ], }, non_fungible_resources: { ...stateEntityDetails.non_fungible_resources, items: [ - ...stateEntityDetails.non_fungible_resources.items, ...results[1].non_fungible_resources.items, ], }, From d52433fa10b0f824ad6cf4e6905cf6ccc10eda11 Mon Sep 17 00:00:00 2001 From: AbstractFruitFactory Date: Fri, 12 Jan 2024 12:34:37 +0000 Subject: [PATCH 03/19] fix: pagination with ledger state --- .../lib/helpers/exhaust-pagination.ts | 24 ------------------- sdk/typescript/lib/subapis/state.ts | 19 +++++++++++---- 2 files changed, 14 insertions(+), 29 deletions(-) diff --git a/sdk/typescript/lib/helpers/exhaust-pagination.ts b/sdk/typescript/lib/helpers/exhaust-pagination.ts index fe5478cc8..ec7fd1e65 100644 --- a/sdk/typescript/lib/helpers/exhaust-pagination.ts +++ b/sdk/typescript/lib/helpers/exhaust-pagination.ts @@ -1,29 +1,5 @@ import { LedgerState } from '../generated' -/** - * Exhausts a paginated API resource and returns all the results. - */ -export const exhaustPagination = async ( - queryFunction: ( - cursor?: string - ) => Promise<{ items: T[]; next_cursor?: string | null }>, - start?: string -): Promise => { - let next_cursor: string | null | undefined = start - const aggregatedEntities: T[] = [] - - do { - const queryFunctionResponse: { - next_cursor?: string | null - items: T[] - } = await queryFunction(next_cursor) - aggregatedEntities.push(...queryFunctionResponse.items) - next_cursor = queryFunctionResponse.next_cursor - } while (next_cursor) - - return aggregatedEntities -} - /** * Exhausts a paginated API resource and returns all the results. */ diff --git a/sdk/typescript/lib/subapis/state.ts b/sdk/typescript/lib/subapis/state.ts index 0d2824c08..47789d579 100644 --- a/sdk/typescript/lib/subapis/state.ts +++ b/sdk/typescript/lib/subapis/state.ts @@ -1,6 +1,5 @@ import { chunk } from '../helpers/chunk' import { - exhaustPagination, exhaustPaginationWithLedgerState, } from '../helpers/exhaust-pagination' import { @@ -208,10 +207,10 @@ export class State { address: string, startCursor?: string ): Promise { - return exhaustPagination( + return exhaustPaginationWithLedgerState( this.getEntityMetadata.bind(this, address), startCursor - ) + ).then((res) => res.aggregatedEntities) } /** @@ -232,11 +231,20 @@ export class State { * Get list of all validators. This will iterate over returned cursors and aggregate all responses. */ async getAllValidators(start?: string): Promise { - return exhaustPagination(this.getValidators.bind(this), start) + return exhaustPaginationWithLedgerState((cursor?: string) => { + const v = this.getValidatorsWithLedgerState(cursor) + return v.then((res) => ({ + items: res.validators.items, + ledger_state: res.ledger_state, + next_cursor: res.validators.next_cursor + })) + }, start).then( + (res) => res.aggregatedEntities + ) } /** - * Get paged list of validators + * Get paged list of validators with ledger state * @param cursor */ async getValidatorsWithLedgerState(cursor?: string) { @@ -256,6 +264,7 @@ export class State { this.getValidatorsWithLedgerState(cursor).then((res) => ({ items: res.validators.items, ledger_state: res.ledger_state, + next_cursor: res.validators.next_cursor })), start ) From 80ba4b2a04a03763510ddfef9284a502562f2ce4 Mon Sep 17 00:00:00 2001 From: Dawid Sowa Date: Mon, 15 Jan 2024 10:55:17 +0100 Subject: [PATCH 04/19] fix: propagate explicitMetadata & nonFungibleIncludeNfids --- sdk/typescript/lib/subapis/state.ts | 137 +++++++++------ sdk/typescript/test/state.test.ts | 247 ++++++++++++++++++++++++++++ 2 files changed, 334 insertions(+), 50 deletions(-) diff --git a/sdk/typescript/lib/subapis/state.ts b/sdk/typescript/lib/subapis/state.ts index 47789d579..955b2c1e8 100644 --- a/sdk/typescript/lib/subapis/state.ts +++ b/sdk/typescript/lib/subapis/state.ts @@ -1,7 +1,5 @@ import { chunk } from '../helpers/chunk' -import { - exhaustPaginationWithLedgerState, -} from '../helpers/exhaust-pagination' +import { exhaustPaginationWithLedgerState } from '../helpers/exhaust-pagination' import { EntityMetadataItem, FungibleResourcesCollection, @@ -62,7 +60,7 @@ export class State { constructor( public innerClient: StateApi, public configuration: RuntimeConfiguration - ) { } + ) {} /** * Get detailed information about entities together with vault aggregated fungible and non-fungible resources. @@ -135,20 +133,30 @@ export class State { return isArray ? Promise.all( - (items as StateEntityDetailsVaultResponseItem[]).map((item) => - this.queryAllResources( - item, - ledgerState || { - state_version: ledger_state.state_version, - } + (items as StateEntityDetailsVaultResponseItem[]).map((item) => + this.queryAllResources( + item, + { + explicitMetadata: options?.explicitMetadata ?? [], + nonFungibleIncludeNfids: + options?.nonFungibleIncludeNfids ?? true, + }, + ledgerState || { + state_version: ledger_state.state_version, + } + ) ) - )) + ) : this.queryAllResources( - items[0] as StateEntityDetailsVaultResponseItem, - ledgerState || { - state_version: ledger_state.state_version, - } - ) + items[0] as StateEntityDetailsVaultResponseItem, + { + explicitMetadata: options?.explicitMetadata ?? [], + nonFungibleIncludeNfids: options?.nonFungibleIncludeNfids ?? true, + }, + ledgerState || { + state_version: ledger_state.state_version, + } + ) } /** @@ -236,11 +244,9 @@ export class State { return v.then((res) => ({ items: res.validators.items, ledger_state: res.ledger_state, - next_cursor: res.validators.next_cursor + next_cursor: res.validators.next_cursor, })) - }, start).then( - (res) => res.aggregatedEntities - ) + }, start).then((res) => res.aggregatedEntities) } /** @@ -264,7 +270,7 @@ export class State { this.getValidatorsWithLedgerState(cursor).then((res) => ({ items: res.validators.items, ledger_state: res.ledger_state, - next_cursor: res.validators.next_cursor + next_cursor: res.validators.next_cursor, })), start ) @@ -367,8 +373,11 @@ export class State { private async getEntityFungiblesPageVaultAggregated( entity: string, - nextCursor?: string | undefined, - ledgerState?: LedgerStateSelector + options?: { + nextCursor?: string | undefined + ledgerState?: LedgerStateSelector + explicitMetadata?: string[] + } ): Promise< ReplaceProperty< StateEntityFungiblesPageResponse, @@ -379,9 +388,12 @@ export class State { return this.innerClient.entityFungiblesPage({ stateEntityFungiblesPageRequest: { address: entity, - cursor: nextCursor, + cursor: options?.nextCursor, aggregation_level: 'Vault', - at_ledger_state: ledgerState, + at_ledger_state: options?.ledgerState, + opt_ins: { + explicit_metadata: options?.explicitMetadata, + }, }, }) as Promise< ReplaceProperty< @@ -394,8 +406,12 @@ export class State { private async getEntityNonFungiblesPageVaultAggregated( entity: string, - nextCursor?: string | undefined, - ledgerState?: LedgerStateSelector + options?: { + cursor: string | undefined + ledgerState?: LedgerStateSelector + explicitMetadata?: string[] + nonFungibleIncludeNfids?: boolean + } ): Promise< ReplaceProperty< StateEntityNonFungiblesPageResponse, @@ -406,9 +422,13 @@ export class State { return this.innerClient.entityNonFungiblesPage({ stateEntityNonFungiblesPageRequest: { address: entity, - cursor: nextCursor, + cursor: options?.cursor, aggregation_level: 'Vault', - at_ledger_state: ledgerState, + at_ledger_state: options?.ledgerState, + opt_ins: { + explicit_metadata: options?.explicitMetadata, + non_fungible_include_nfids: options?.nonFungibleIncludeNfids, + }, }, }) as Promise< ReplaceProperty< @@ -442,9 +462,11 @@ export class State { } } - private async queryAllFungibles( stateEntityDetails: StateEntityDetailsVaultResponseItem, + options?: { + explicitMetadata?: string[] + }, ledgerState?: LedgerStateSelector ): Promise { const nextCursor = stateEntityDetails?.fungible_resources?.next_cursor @@ -453,11 +475,11 @@ export class State { const allFungibles = await exhaustPaginationWithLedgerState( (cursor) => - this.getEntityFungiblesPageVaultAggregated( - stateEntityDetails.address, - cursor, - ledgerState - ), + this.getEntityFungiblesPageVaultAggregated(stateEntityDetails.address, { + nextCursor: cursor, + ledgerState, + explicitMetadata: options?.explicitMetadata, + }), nextCursor ) @@ -472,9 +494,12 @@ export class State { }) } - private async queryAllNonFungibles( stateEntityDetails: StateEntityDetailsVaultResponseItem, + options?: { + explicitMetadata?: string[] + nonFungibleIncludeNfids?: boolean + }, ledgerState?: LedgerStateSelector ): Promise { const nextCursor = stateEntityDetails.non_fungible_resources.next_cursor @@ -485,8 +510,12 @@ export class State { (cursor) => this.getEntityNonFungiblesPageVaultAggregated( stateEntityDetails.address, - cursor, - ledgerState + { + cursor, + ledgerState, + explicitMetadata: options?.explicitMetadata, + nonFungibleIncludeNfids: options?.nonFungibleIncludeNfids, + } ), nextCursor ) @@ -504,27 +533,35 @@ export class State { private async queryAllResources( stateEntityDetails: StateEntityDetailsVaultResponseItem, + options?: { + explicitMetadata?: string[] + nonFungibleIncludeNfids?: boolean + }, ledgerState?: LedgerStateSelector ): Promise { - const itemsWithAllFungibles = this.queryAllFungibles(stateEntityDetails, ledgerState) - const itemsWithAllNonFungibles = this.queryAllNonFungibles(stateEntityDetails, ledgerState) + const itemsWithAllFungibles = this.queryAllFungibles( + stateEntityDetails, + options, + ledgerState + ) + const itemsWithAllNonFungibles = this.queryAllNonFungibles( + stateEntityDetails, + options, + ledgerState + ) - return Promise.all([itemsWithAllFungibles, itemsWithAllNonFungibles]).then((results) => { - return { + return Promise.all([itemsWithAllFungibles, itemsWithAllNonFungibles]).then( + (results) => ({ ...stateEntityDetails, fungible_resources: { ...stateEntityDetails.fungible_resources, - items: [ - ...results[0].fungible_resources.items, - ], + items: [...results[0].fungible_resources.items], }, non_fungible_resources: { ...stateEntityDetails.non_fungible_resources, - items: [ - ...results[1].non_fungible_resources.items, - ], + items: [...results[1].non_fungible_resources.items], }, - } - }) + }) + ) } } diff --git a/sdk/typescript/test/state.test.ts b/sdk/typescript/test/state.test.ts index 5e0cea217..06d6fa687 100644 --- a/sdk/typescript/test/state.test.ts +++ b/sdk/typescript/test/state.test.ts @@ -152,6 +152,253 @@ describe('State Subapi', () => { }, ]) }) + + it('should propagate explicit_metadata to fungbile paging requests', async () => { + // Arrange + const spy = jest.fn().mockImplementation((a) => { + if (a.includes('/state/entity/details')) { + return fetchResponseFactory({ + items: [ + { + address: 'address', + fungible_resources: { + items: [{ aggregation_level: 'Vault' }], + next_cursor: 'eyJvIjoxMDB9', + total_count: 2, + }, + non_fungible_resources: { + items: [{ aggregation_level: 'Vault' }], + total_count: 1, + }, + }, + ], + ledger_state: { + state_version: 1, + }, + })() + } else { + return fetchResponseFactory({ + items: [], + ledger_state: { + state_version: 1, + }, + })() + } + }) + const gatewayApi = GatewayApiClient.initialize({ + fetchApi: spy, + basePath: 'https://just-for-test.com', + maxAddressesCount: 1, + }) + + // Act + const response = await gatewayApi.state.getEntityDetailsVaultAggregated( + ['address'], + { + explicitMetadata: ['name'], + } + ) + + // Assert + expect(spy).toHaveBeenCalledTimes(2) + expect(spy.mock.calls).toEqual([ + [ + 'https://just-for-test.com/state/entity/details', + { + body: '{"opt_ins":{"ancestor_identities":false,"component_royalty_vault_balance":false,"package_royalty_vault_balance":false,"non_fungible_include_nfids":true,"explicit_metadata":["name"]},"addresses":["address"],"aggregation_level":"Vault"}', + credentials: undefined, + headers: { + 'Content-Type': 'application/json', + 'RDX-App-Dapp-Definition': 'Unknown', + 'RDX-App-Name': 'Unknown', + 'RDX-App-Version': 'Unknown', + 'RDX-Client-Name': '@radixdlt/babylon-gateway-api-sdk', + 'RDX-Client-Version': '0.0.0', + }, + method: 'POST', + }, + ], + [ + 'https://just-for-test.com/state/entity/page/fungibles/', + { + body: '{"at_ledger_state":{"state_version":1},"cursor":"eyJvIjoxMDB9","address":"address","aggregation_level":"Vault","opt_ins":{"explicit_metadata":["name"]}}', + credentials: undefined, + headers: { + 'Content-Type': 'application/json', + 'RDX-App-Dapp-Definition': 'Unknown', + 'RDX-App-Name': 'Unknown', + 'RDX-App-Version': 'Unknown', + 'RDX-Client-Name': '@radixdlt/babylon-gateway-api-sdk', + 'RDX-Client-Version': '0.0.0', + }, + method: 'POST', + }, + ], + ]) + }) + + it('should propagate explicit_metadata & nonFungibleIncludeNfids to non-fungbile paging requests', async () => { + // Arrange + const spy = jest.fn().mockImplementation((a) => { + if (a.includes('/state/entity/details')) { + return fetchResponseFactory({ + items: [ + { + address: 'address', + fungible_resources: { + items: [{ aggregation_level: 'Vault' }], + total_count: 2, + }, + non_fungible_resources: { + items: [{ aggregation_level: 'Vault' }], + next_cursor: 'eyJvIjoxMDB9', + total_count: 2, + }, + }, + ], + ledger_state: { + state_version: 1, + }, + })() + } else { + return fetchResponseFactory({ + items: [], + ledger_state: { + state_version: 1, + }, + })() + } + }) + const gatewayApi = GatewayApiClient.initialize({ + fetchApi: spy, + basePath: 'https://just-for-test.com', + maxAddressesCount: 1, + }) + + // Act + await gatewayApi.state.getEntityDetailsVaultAggregated(['address'], { + explicitMetadata: ['name'], + }) + + // Assert + expect(spy).toHaveBeenCalledTimes(2) + expect(spy.mock.calls).toEqual([ + [ + 'https://just-for-test.com/state/entity/details', + { + body: '{"opt_ins":{"ancestor_identities":false,"component_royalty_vault_balance":false,"package_royalty_vault_balance":false,"non_fungible_include_nfids":true,"explicit_metadata":["name"]},"addresses":["address"],"aggregation_level":"Vault"}', + credentials: undefined, + headers: { + 'Content-Type': 'application/json', + 'RDX-App-Dapp-Definition': 'Unknown', + 'RDX-App-Name': 'Unknown', + 'RDX-App-Version': 'Unknown', + 'RDX-Client-Name': '@radixdlt/babylon-gateway-api-sdk', + 'RDX-Client-Version': '0.0.0', + }, + method: 'POST', + }, + ], + [ + 'https://just-for-test.com/state/entity/page/non-fungibles/', + { + body: '{"at_ledger_state":{"state_version":1},"cursor":"eyJvIjoxMDB9","address":"address","aggregation_level":"Vault","opt_ins":{"non_fungible_include_nfids":true,"explicit_metadata":["name"]}}', + credentials: undefined, + headers: { + 'Content-Type': 'application/json', + 'RDX-App-Dapp-Definition': 'Unknown', + 'RDX-App-Name': 'Unknown', + 'RDX-App-Version': 'Unknown', + 'RDX-Client-Name': '@radixdlt/babylon-gateway-api-sdk', + 'RDX-Client-Version': '0.0.0', + }, + method: 'POST', + }, + ], + ]) + }) + + it('should false nonFungibleIncludeNfids to non-fungbile paging requests', async () => { + // Arrange + const spy = jest.fn().mockImplementation((a) => { + if (a.includes('/state/entity/details')) { + return fetchResponseFactory({ + items: [ + { + address: 'address', + fungible_resources: { + items: [{ aggregation_level: 'Vault' }], + total_count: 2, + }, + non_fungible_resources: { + items: [{ aggregation_level: 'Vault' }], + next_cursor: 'eyJvIjoxMDB9', + total_count: 2, + }, + }, + ], + ledger_state: { + state_version: 1, + }, + })() + } else { + return fetchResponseFactory({ + items: [], + ledger_state: { + state_version: 1, + }, + })() + } + }) + const gatewayApi = GatewayApiClient.initialize({ + fetchApi: spy, + basePath: 'https://just-for-test.com', + maxAddressesCount: 1, + }) + + // Act + await gatewayApi.state.getEntityDetailsVaultAggregated(['address'], { + explicitMetadata: ['name'], + nonFungibleIncludeNfids: false, + }) + + // Assert + expect(spy).toHaveBeenCalledTimes(2) + expect(spy.mock.calls).toEqual([ + [ + 'https://just-for-test.com/state/entity/details', + { + body: '{"opt_ins":{"ancestor_identities":false,"component_royalty_vault_balance":false,"package_royalty_vault_balance":false,"non_fungible_include_nfids":false,"explicit_metadata":["name"]},"addresses":["address"],"aggregation_level":"Vault"}', + credentials: undefined, + headers: { + 'Content-Type': 'application/json', + 'RDX-App-Dapp-Definition': 'Unknown', + 'RDX-App-Name': 'Unknown', + 'RDX-App-Version': 'Unknown', + 'RDX-Client-Name': '@radixdlt/babylon-gateway-api-sdk', + 'RDX-Client-Version': '0.0.0', + }, + method: 'POST', + }, + ], + [ + 'https://just-for-test.com/state/entity/page/non-fungibles/', + { + body: '{"at_ledger_state":{"state_version":1},"cursor":"eyJvIjoxMDB9","address":"address","aggregation_level":"Vault","opt_ins":{"non_fungible_include_nfids":false,"explicit_metadata":["name"]}}', + credentials: undefined, + headers: { + 'Content-Type': 'application/json', + 'RDX-App-Dapp-Definition': 'Unknown', + 'RDX-App-Name': 'Unknown', + 'RDX-App-Version': 'Unknown', + 'RDX-Client-Name': '@radixdlt/babylon-gateway-api-sdk', + 'RDX-Client-Version': '0.0.0', + }, + method: 'POST', + }, + ], + ]) + }) }) describe('getNonFungibleData', () => { From 633174abe2380247eb0fa2d49132056b7ed66f6d Mon Sep 17 00:00:00 2001 From: Dawid Sowa Date: Mon, 15 Jan 2024 11:49:50 +0100 Subject: [PATCH 05/19] test: loosen unit test matchers --- sdk/typescript/test/state.test.ts | 56 ++++--------------------------- 1 file changed, 7 insertions(+), 49 deletions(-) diff --git a/sdk/typescript/test/state.test.ts b/sdk/typescript/test/state.test.ts index 06d6fa687..f48609cb0 100644 --- a/sdk/typescript/test/state.test.ts +++ b/sdk/typescript/test/state.test.ts @@ -207,14 +207,7 @@ describe('State Subapi', () => { { body: '{"opt_ins":{"ancestor_identities":false,"component_royalty_vault_balance":false,"package_royalty_vault_balance":false,"non_fungible_include_nfids":true,"explicit_metadata":["name"]},"addresses":["address"],"aggregation_level":"Vault"}', credentials: undefined, - headers: { - 'Content-Type': 'application/json', - 'RDX-App-Dapp-Definition': 'Unknown', - 'RDX-App-Name': 'Unknown', - 'RDX-App-Version': 'Unknown', - 'RDX-Client-Name': '@radixdlt/babylon-gateway-api-sdk', - 'RDX-Client-Version': '0.0.0', - }, + headers: expect.anything(), method: 'POST', }, ], @@ -223,14 +216,7 @@ describe('State Subapi', () => { { body: '{"at_ledger_state":{"state_version":1},"cursor":"eyJvIjoxMDB9","address":"address","aggregation_level":"Vault","opt_ins":{"explicit_metadata":["name"]}}', credentials: undefined, - headers: { - 'Content-Type': 'application/json', - 'RDX-App-Dapp-Definition': 'Unknown', - 'RDX-App-Name': 'Unknown', - 'RDX-App-Version': 'Unknown', - 'RDX-Client-Name': '@radixdlt/babylon-gateway-api-sdk', - 'RDX-Client-Version': '0.0.0', - }, + headers: expect.anything(), method: 'POST', }, ], @@ -288,14 +274,7 @@ describe('State Subapi', () => { { body: '{"opt_ins":{"ancestor_identities":false,"component_royalty_vault_balance":false,"package_royalty_vault_balance":false,"non_fungible_include_nfids":true,"explicit_metadata":["name"]},"addresses":["address"],"aggregation_level":"Vault"}', credentials: undefined, - headers: { - 'Content-Type': 'application/json', - 'RDX-App-Dapp-Definition': 'Unknown', - 'RDX-App-Name': 'Unknown', - 'RDX-App-Version': 'Unknown', - 'RDX-Client-Name': '@radixdlt/babylon-gateway-api-sdk', - 'RDX-Client-Version': '0.0.0', - }, + headers: expect.anything(), method: 'POST', }, ], @@ -304,21 +283,14 @@ describe('State Subapi', () => { { body: '{"at_ledger_state":{"state_version":1},"cursor":"eyJvIjoxMDB9","address":"address","aggregation_level":"Vault","opt_ins":{"non_fungible_include_nfids":true,"explicit_metadata":["name"]}}', credentials: undefined, - headers: { - 'Content-Type': 'application/json', - 'RDX-App-Dapp-Definition': 'Unknown', - 'RDX-App-Name': 'Unknown', - 'RDX-App-Version': 'Unknown', - 'RDX-Client-Name': '@radixdlt/babylon-gateway-api-sdk', - 'RDX-Client-Version': '0.0.0', - }, + headers: expect.anything(), method: 'POST', }, ], ]) }) - it('should false nonFungibleIncludeNfids to non-fungbile paging requests', async () => { + it('should propagate nonFungibleIncludeNfids=false to non-fungbile paging requests', async () => { // Arrange const spy = jest.fn().mockImplementation((a) => { if (a.includes('/state/entity/details')) { @@ -370,14 +342,7 @@ describe('State Subapi', () => { { body: '{"opt_ins":{"ancestor_identities":false,"component_royalty_vault_balance":false,"package_royalty_vault_balance":false,"non_fungible_include_nfids":false,"explicit_metadata":["name"]},"addresses":["address"],"aggregation_level":"Vault"}', credentials: undefined, - headers: { - 'Content-Type': 'application/json', - 'RDX-App-Dapp-Definition': 'Unknown', - 'RDX-App-Name': 'Unknown', - 'RDX-App-Version': 'Unknown', - 'RDX-Client-Name': '@radixdlt/babylon-gateway-api-sdk', - 'RDX-Client-Version': '0.0.0', - }, + headers: expect.anything(), method: 'POST', }, ], @@ -386,14 +351,7 @@ describe('State Subapi', () => { { body: '{"at_ledger_state":{"state_version":1},"cursor":"eyJvIjoxMDB9","address":"address","aggregation_level":"Vault","opt_ins":{"non_fungible_include_nfids":false,"explicit_metadata":["name"]}}', credentials: undefined, - headers: { - 'Content-Type': 'application/json', - 'RDX-App-Dapp-Definition': 'Unknown', - 'RDX-App-Name': 'Unknown', - 'RDX-App-Version': 'Unknown', - 'RDX-Client-Name': '@radixdlt/babylon-gateway-api-sdk', - 'RDX-Client-Version': '0.0.0', - }, + headers: expect.anything(), method: 'POST', }, ], From 961c1a21fb0eafddfe38bea0aaf000655e48fba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Pawelec?= Date: Tue, 16 Jan 2024 15:01:01 +0100 Subject: [PATCH 06/19] move vm type to package code history --- CHANGELOG.md | 3 +- .../CustomTypes.cs | 1 - .../PostgresLedgerExtenderService.cs | 34 +- .../LedgerExtension/Records.cs | 2 + .../LedgerExtension/WriteHelper.cs | 14 +- ...8_MoveVmTypeToCodeHistoryTable.Designer.cs | 2357 +++++++++++++++++ ...0116140418_MoveVmTypeToCodeHistoryTable.cs | 106 + .../Migrations/IdempotentApplyMigrations.sql | 26 + .../MigrationsDbContextModelSnapshot.cs | 19 +- .../Models/Entity.cs | 2 - .../Models/PackageCodeHistory.cs | 4 + .../Services/EntityStateQuerier.cs | 2 +- 12 files changed, 2537 insertions(+), 33 deletions(-) create mode 100644 src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240116140418_MoveVmTypeToCodeHistoryTable.Designer.cs create mode 100644 src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240116140418_MoveVmTypeToCodeHistoryTable.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index e8715f597..0d9265115 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ -## 1.2.5 +## 1.3.0 Release Date: _unreleased_ - add support for new transaction types (flash transactions) that are gonna occur on protocol update. +- move vm_type to `package_code_history` table from package in `entity` table. ## 1.2.4 Release Date: 4.01.2024 diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/CustomTypes.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/CustomTypes.cs index 769b18ae3..d86c1b449 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/CustomTypes.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/CustomTypes.cs @@ -68,7 +68,6 @@ using RadixDlt.NetworkGateway.PostgresIntegration.Models; using RadixDlt.NetworkGateway.PostgresIntegration.ValueConverters; using NonFungibleIdType = RadixDlt.NetworkGateway.Abstractions.Model.NonFungibleIdType; -using PackageVmType = RadixDlt.NetworkGateway.Abstractions.Model.PackageVmType; using PublicKeyType = RadixDlt.NetworkGateway.Abstractions.Model.PublicKeyType; namespace RadixDlt.NetworkGateway.PostgresIntegration; diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs index 82e364689..51377f21d 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs @@ -437,14 +437,6 @@ private async Task ProcessTransactions(ReadWriteDbContext db e.PendingOwnerStakeUnitUnlockVault = referencedEntities.Get((EntityAddress)validator.Value.PendingOwnerStakeUnitUnlockVault.EntityAddress).DatabaseId; }); } - - if (substateData is CoreModel.PackageCodeVmTypeEntrySubstate packageCodeVmType) - { - referencedEntity.PostResolveConfigure((GlobalPackageEntity e) => - { - e.VmType = packageCodeVmType.Value.VmType.ToModel(); - }); - } } foreach (var deletedSubstate in stateUpdates.DeletedSubstates) @@ -715,7 +707,7 @@ private async Task ProcessTransactions(ReadWriteDbContext db var keyValueStoreEntryHistoryToAdd = new List(); var componentMethodRoyaltiesToAdd = new List(); var packageBlueprintHistoryToAdd = new Dictionary(); - var packageCodeHistoryToAdd = new List(); + var packageCodeHistoryToAdd = new Dictionary(); var schemaHistoryToAdd = new List(); var nonFungibleSchemaHistoryToAdd = new List(); var keyValueStoreSchemaHistoryToAdd = new List(); @@ -1029,14 +1021,32 @@ private async Task ProcessTransactions(ReadWriteDbContext db if (substateData is CoreModel.PackageCodeOriginalCodeEntrySubstate packageCodeOriginalCode) { - packageCodeHistoryToAdd.Add(new PackageCodeHistory + var lookup = new PackageCodeLookup(packageCodeOriginalCode.Key.CodeHash); + + var codeHistory = packageCodeHistoryToAdd.GetOrAdd(lookup, _ => new PackageCodeHistory { Id = sequences.PackageCodeHistorySequence++, FromStateVersion = stateVersion, PackageEntityId = referencedEntity.DatabaseId, CodeHash = packageCodeOriginalCode.Key.CodeHash.ConvertFromHex(), - Code = packageCodeOriginalCode.Value.CodeHex.ConvertFromHex(), }); + + codeHistory.Code = packageCodeOriginalCode.Value.CodeHex.ConvertFromHex(); + } + + if (substateData is CoreModel.PackageCodeVmTypeEntrySubstate packageCodeVmType) + { + var lookup = new PackageCodeLookup(packageCodeVmType.Key.CodeHash); + + var codeHistory = packageCodeHistoryToAdd.GetOrAdd(lookup, _ => new PackageCodeHistory + { + Id = sequences.PackageCodeHistorySequence++, + FromStateVersion = stateVersion, + PackageEntityId = referencedEntity.DatabaseId, + CodeHash = packageCodeVmType.Key.CodeHash.ConvertFromHex(), + }); + + codeHistory.VmType = packageCodeVmType.Value.VmType.ToModel(); } if (substateData is CoreModel.SchemaEntrySubstate schema) @@ -1872,7 +1882,7 @@ void AggregateEntityResourceVaultInternal(long entityId, long resourceEntityId, rowsInserted += await writeHelper.CopyValidatorKeyHistory(validatorKeyHistoryToAdd.Values, token); rowsInserted += await writeHelper.CopyValidatorActiveSetHistory(validatorActiveSetHistoryToAdd, token); rowsInserted += await writeHelper.CopyPackageBlueprintHistory(packageBlueprintHistoryToAdd.Values, token); - rowsInserted += await writeHelper.CopyPackageCodeHistory(packageCodeHistoryToAdd, token); + rowsInserted += await writeHelper.CopyPackageCodeHistory(packageCodeHistoryToAdd.Values, token); rowsInserted += await writeHelper.CopySchemaHistory(schemaHistoryToAdd, token); rowsInserted += await writeHelper.CopyKeyValueStoreEntryHistory(keyValueStoreEntryHistoryToAdd, token); rowsInserted += await writeHelper.CopyAccountDefaultDepositRuleHistory(accountDefaultDepositRuleHistoryToAdd, token); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Records.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Records.cs index 59a9ecd1e..a6f123f38 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Records.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Records.cs @@ -111,6 +111,8 @@ internal record struct MetadataLookup(long EntityId, string Key); internal record struct PackageBlueprintLookup(long PackageEntityId, string Name, string BlueprintVersion); +internal record struct PackageCodeLookup(string CodeHex); + internal record struct EntityResourceLookup(long EntityId, long ResourceEntityId); internal record struct EntityResourceVaultLookup(long EntityId, long ResourceEntityId); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/WriteHelper.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/WriteHelper.cs index 3fcafb91e..39cee8ce1 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/WriteHelper.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/WriteHelper.cs @@ -104,7 +104,7 @@ public async Task CopyEntity(ICollection entities, CancellationToke var sw = Stopwatch.GetTimestamp(); await using var writer = await _connection.BeginBinaryImportAsync( - "COPY entities (id, from_state_version, address, is_global, ancestor_ids, parent_ancestor_id, owner_ancestor_id, global_ancestor_id, correlated_entities, discriminator, package_id, blueprint_name, blueprint_version, divisibility, non_fungible_id_type, vm_type, stake_vault_entity_id, pending_xrd_withdraw_vault_entity_id, locked_owner_stake_unit_vault_entity_id, pending_owner_stake_unit_unlock_vault_entity_id, resource_entity_id, royalty_vault_of_entity_id) FROM STDIN (FORMAT BINARY)", + "COPY entities (id, from_state_version, address, is_global, ancestor_ids, parent_ancestor_id, owner_ancestor_id, global_ancestor_id, correlated_entities, discriminator, package_id, blueprint_name, blueprint_version, divisibility, non_fungible_id_type, stake_vault_entity_id, pending_xrd_withdraw_vault_entity_id, locked_owner_stake_unit_vault_entity_id, pending_owner_stake_unit_unlock_vault_entity_id, resource_entity_id, royalty_vault_of_entity_id) FROM STDIN (FORMAT BINARY)", token); foreach (var e in entities) @@ -154,15 +154,6 @@ public async Task CopyEntity(ICollection entities, CancellationToke await writer.WriteNullAsync(token); } - if (e is GlobalPackageEntity packageEntity) - { - await writer.WriteAsync(packageEntity.VmType, "package_vm_type", token); - } - else - { - await writer.WriteNullAsync(token); - } - if (e is GlobalValidatorEntity validatorEntity) { await writer.WriteAsync(validatorEntity.StakeVaultEntityId, NpgsqlDbType.Bigint, token); @@ -1078,7 +1069,7 @@ public async Task CopyPackageCodeHistory(ICollection en var sw = Stopwatch.GetTimestamp(); - await using var writer = await _connection.BeginBinaryImportAsync("COPY package_code_history (id, from_state_version, package_entity_id, code_hash, code) FROM STDIN (FORMAT BINARY)", token); + await using var writer = await _connection.BeginBinaryImportAsync("COPY package_code_history (id, from_state_version, package_entity_id, code_hash, code, vm_type) FROM STDIN (FORMAT BINARY)", token); foreach (var e in entities) { @@ -1088,6 +1079,7 @@ public async Task CopyPackageCodeHistory(ICollection en await writer.WriteAsync(e.PackageEntityId, NpgsqlDbType.Bigint, token); await writer.WriteAsync(e.CodeHash, NpgsqlDbType.Bytea, token); await writer.WriteAsync(e.Code, NpgsqlDbType.Bytea, token); + await writer.WriteAsync(e.VmType, "vm_type", token); } await writer.CompleteAsync(token); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240116140418_MoveVmTypeToCodeHistoryTable.Designer.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240116140418_MoveVmTypeToCodeHistoryTable.Designer.cs new file mode 100644 index 000000000..12d9e1ef8 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240116140418_MoveVmTypeToCodeHistoryTable.Designer.cs @@ -0,0 +1,2357 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +// +using System; +using System.Collections.Generic; +using System.Numerics; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using RadixDlt.NetworkGateway.Abstractions.Addressing; +using RadixDlt.NetworkGateway.Abstractions.Model; +using RadixDlt.NetworkGateway.PostgresIntegration; +using RadixDlt.NetworkGateway.PostgresIntegration.Models; + +#nullable disable + +namespace RadixDlt.NetworkGateway.PostgresIntegration.Migrations +{ + [DbContext(typeof(MigrationsDbContext))] + [Migration("20240116140418_MoveVmTypeToCodeHistoryTable")] + partial class MoveVmTypeToCodeHistoryTable + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "account_default_deposit_rule", new[] { "accept", "reject", "allow_existing" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "account_resource_preference_rule", new[] { "allowed", "disallowed" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "entity_type", new[] { "global_consensus_manager", "global_fungible_resource", "global_non_fungible_resource", "global_generic_component", "internal_generic_component", "global_account_component", "global_package", "internal_key_value_store", "internal_fungible_vault", "internal_non_fungible_vault", "global_validator", "global_access_controller", "global_identity", "global_one_resource_pool", "global_two_resource_pool", "global_multi_resource_pool", "global_transaction_tracker" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_event_type", new[] { "withdrawal", "deposit" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_operation_type", new[] { "resource_in_use", "account_deposited_into", "account_withdrawn_from" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_origin_type", new[] { "user", "epoch_change" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_type", new[] { "origin", "event", "manifest_address", "affected_global_entity" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_status", new[] { "succeeded", "failed" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_type", new[] { "genesis", "user", "round_update", "flash" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "module_id", new[] { "main", "metadata", "royalty", "role_assignment" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "non_fungible_id_type", new[] { "string", "integer", "bytes", "ruid" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "package_vm_type", new[] { "native", "scrypto_v1" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "pending_transaction_intent_ledger_status", new[] { "unknown", "committed", "commit_pending", "permanent_rejection", "possible_to_commit", "likely_but_not_certain_rejection" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "pending_transaction_payload_ledger_status", new[] { "unknown", "committed", "commit_pending", "clashing_commit", "permanently_rejected", "transiently_accepted", "transiently_rejected" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "public_key_type", new[] { "ecdsa_secp256k1", "eddsa_ed25519" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "resource_type", new[] { "fungible", "non_fungible" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "sbor_type_kind", new[] { "well_known", "schema_local" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "state_type", new[] { "json", "sbor" }); + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AccountDefaultDepositRuleHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountEntityId") + .HasColumnType("bigint") + .HasColumnName("account_entity_id"); + + b.Property("DefaultDepositRule") + .HasColumnType("account_default_deposit_rule") + .HasColumnName("default_deposit_rule"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.HasKey("Id"); + + b.HasIndex("AccountEntityId", "FromStateVersion"); + + b.ToTable("account_default_deposit_rule_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AccountResourcePreferenceRuleHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountEntityId") + .HasColumnType("bigint") + .HasColumnName("account_entity_id"); + + b.Property("AccountResourcePreferenceRule") + .HasColumnType("account_resource_preference_rule") + .HasColumnName("account_resource_preference_rule"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("AccountEntityId", "ResourceEntityId", "FromStateVersion"); + + b.ToTable("account_resource_preference_rule_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ComponentMethodRoyaltyEntryHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("IsLocked") + .HasColumnType("boolean") + .HasColumnName("is_locked"); + + b.Property("MethodName") + .IsRequired() + .HasColumnType("text") + .HasColumnName("method_name"); + + b.Property("RoyaltyAmount") + .HasColumnType("jsonb") + .HasColumnName("royalty_amount"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.HasIndex("EntityId", "MethodName", "FromStateVersion"); + + b.ToTable("component_method_royalty_entry_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasColumnType("text") + .HasColumnName("address"); + + b.Property>("AncestorIds") + .HasColumnType("bigint[]") + .HasColumnName("ancestor_ids"); + + b.Property>("CorrelatedEntities") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("correlated_entities"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("GlobalAncestorId") + .HasColumnType("bigint") + .HasColumnName("global_ancestor_id"); + + b.Property("IsGlobal") + .HasColumnType("boolean") + .HasColumnName("is_global"); + + b.Property("OwnerAncestorId") + .HasColumnType("bigint") + .HasColumnName("owner_ancestor_id"); + + b.Property("ParentAncestorId") + .HasColumnType("bigint") + .HasColumnName("parent_ancestor_id"); + + b.Property("discriminator") + .HasColumnType("entity_type"); + + b.HasKey("Id"); + + b.HasIndex("Address") + .IsUnique(); + + b.HasIndex("FromStateVersion") + .HasFilter("discriminator = 'global_validator'"); + + b.ToTable("entities"); + + b.HasDiscriminator("discriminator"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityMetadataAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property>("MetadataIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("metadata_ids"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.ToTable("entity_metadata_aggregate_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityMetadataHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted"); + + b.Property("IsLocked") + .HasColumnType("boolean") + .HasColumnName("is_locked"); + + b.Property("Key") + .IsRequired() + .HasColumnType("text") + .HasColumnName("key"); + + b.Property("Value") + .HasColumnType("bytea") + .HasColumnName("value"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "Key", "FromStateVersion"); + + b.ToTable("entity_metadata_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property>("FungibleResourceEntityIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("fungible_resource_entity_ids"); + + b.Property>("FungibleResourceSignificantUpdateStateVersions") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("fungible_resource_significant_update_state_versions"); + + b.Property>("NonFungibleResourceEntityIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("non_fungible_resource_entity_ids"); + + b.Property>("NonFungibleResourceSignificantUpdateStateVersions") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("non_fungible_resource_significant_update_state_versions"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.ToTable("entity_resource_aggregate_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregatedVaultsHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.Property("discriminator") + .HasColumnType("resource_type"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "ResourceEntityId", "FromStateVersion"); + + b.ToTable("entity_resource_aggregated_vaults_history"); + + b.HasDiscriminator("discriminator"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceVaultAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.Property>("VaultEntityIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("vault_entity_ids"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "ResourceEntityId", "FromStateVersion"); + + b.ToTable("entity_resource_vault_aggregate_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityRoleAssignmentsAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property>("EntryIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("entry_ids"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("OwnerRoleId") + .HasColumnType("bigint") + .HasColumnName("owner_role_id"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.ToTable("entity_role_assignments_aggregate_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityRoleAssignmentsEntryHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted"); + + b.Property("KeyModule") + .HasColumnType("module_id") + .HasColumnName("key_module"); + + b.Property("KeyRole") + .IsRequired() + .HasColumnType("text") + .HasColumnName("key_role"); + + b.Property("RoleAssignments") + .HasColumnType("jsonb") + .HasColumnName("role_assignments"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "KeyRole", "KeyModule", "FromStateVersion"); + + b.ToTable("entity_role_assignments_entry_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityRoleAssignmentsOwnerRoleHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("RoleAssignments") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("role_assignments"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.ToTable("entity_role_assignments_owner_role_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityVaultHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("GlobalEntityId") + .HasColumnType("bigint") + .HasColumnName("global_entity_id"); + + b.Property("OwnerEntityId") + .HasColumnType("bigint") + .HasColumnName("owner_entity_id"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.Property("VaultEntityId") + .HasColumnType("bigint") + .HasColumnName("vault_entity_id"); + + b.Property("discriminator") + .HasColumnType("resource_type"); + + b.HasKey("Id"); + + b.HasIndex("GlobalEntityId", "FromStateVersion") + .HasFilter("is_royalty_vault = true"); + + b.HasIndex("OwnerEntityId", "FromStateVersion") + .HasFilter("is_royalty_vault = true"); + + b.HasIndex("VaultEntityId", "FromStateVersion") + .HasFilter("discriminator = 'non_fungible'"); + + b.HasIndex("GlobalEntityId", "VaultEntityId", "FromStateVersion"); + + b.HasIndex("Id", "ResourceEntityId", "FromStateVersion"); + + b.HasIndex("OwnerEntityId", "VaultEntityId", "FromStateVersion"); + + b.ToTable("entity_vault_history"); + + b.HasDiscriminator("discriminator"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.KeyValueStoreEntryHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted"); + + b.Property("IsLocked") + .HasColumnType("boolean") + .HasColumnName("is_locked"); + + b.Property("Key") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("key"); + + b.Property("KeyValueStoreEntityId") + .HasColumnType("bigint") + .HasColumnName("key_value_store_entity_id"); + + b.Property("Value") + .HasColumnType("bytea") + .HasColumnName("value"); + + b.HasKey("Id"); + + b.HasIndex("KeyValueStoreEntityId", "Key", "FromStateVersion"); + + b.ToTable("key_value_store_entry_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.KeyValueStoreSchemaHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("KeySborTypeKind") + .HasColumnType("sbor_type_kind") + .HasColumnName("key_sbor_type_kind"); + + b.Property("KeySchemaDefiningEntityId") + .HasColumnType("bigint") + .HasColumnName("key_schema_defining_entity_id"); + + b.Property("KeySchemaHash") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("key_schema_hash"); + + b.Property("KeyTypeIndex") + .HasColumnType("bigint") + .HasColumnName("key_type_index"); + + b.Property("KeyValueStoreEntityId") + .HasColumnType("bigint") + .HasColumnName("key_value_store_entity_id"); + + b.Property("ValueSborTypeKind") + .HasColumnType("sbor_type_kind") + .HasColumnName("value_sbor_type_kind"); + + b.Property("ValueSchemaDefiningEntityId") + .HasColumnType("bigint") + .HasColumnName("value_schema_defining_entity_id"); + + b.Property("ValueSchemaHash") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("value_schema_hash"); + + b.Property("ValueTypeIndex") + .HasColumnType("bigint") + .HasColumnName("value_type_index"); + + b.HasKey("Id"); + + b.HasIndex("KeyValueStoreEntityId", "FromStateVersion"); + + b.ToTable("key_value_store_schema_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction", b => + { + b.Property("StateVersion") + .HasColumnType("bigint") + .HasColumnName("state_version"); + + b.Property("AffectedGlobalEntities") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("affected_global_entities"); + + b.Property("BalanceChanges") + .HasColumnType("jsonb") + .HasColumnName("balance_changes"); + + b.Property("CreatedTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_timestamp"); + + b.Property("Epoch") + .HasColumnType("bigint") + .HasColumnName("epoch"); + + b.Property("FeePaid") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("fee_paid"); + + b.Property("IndexInEpoch") + .HasColumnType("bigint") + .HasColumnName("index_in_epoch"); + + b.Property("IndexInRound") + .HasColumnType("bigint") + .HasColumnName("index_in_round"); + + b.Property("NormalizedRoundTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("normalized_round_timestamp"); + + b.Property("ReceiptCostingParameters") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("receipt_costing_parameters"); + + b.Property("ReceiptErrorMessage") + .HasColumnType("text") + .HasColumnName("receipt_error_message"); + + b.Property("ReceiptEventEmitters") + .IsRequired() + .HasColumnType("jsonb[]") + .HasColumnName("receipt_event_emitters"); + + b.Property("ReceiptEventNames") + .IsRequired() + .HasColumnType("text[]") + .HasColumnName("receipt_event_names"); + + b.Property("ReceiptEventSborTypeKinds") + .IsRequired() + .HasColumnType("sbor_type_kind[]") + .HasColumnName("receipt_event_sbor_type_kinds"); + + b.Property("ReceiptEventSbors") + .IsRequired() + .HasColumnType("bytea[]") + .HasColumnName("receipt_event_sbors"); + + b.Property("ReceiptEventSchemaEntityIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("receipt_event_schema_entity_ids"); + + b.Property("ReceiptEventSchemaHashes") + .IsRequired() + .HasColumnType("bytea[]") + .HasColumnName("receipt_event_schema_hashes"); + + b.Property("ReceiptEventTypeIndexes") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("receipt_event_type_indexes"); + + b.Property("ReceiptFeeDestination") + .HasColumnType("jsonb") + .HasColumnName("receipt_fee_destination"); + + b.Property("ReceiptFeeSource") + .HasColumnType("jsonb") + .HasColumnName("receipt_fee_source"); + + b.Property("ReceiptFeeSummary") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("receipt_fee_summary"); + + b.Property("ReceiptNextEpoch") + .HasColumnType("jsonb") + .HasColumnName("receipt_next_epoch"); + + b.Property("ReceiptOutput") + .HasColumnType("jsonb") + .HasColumnName("receipt_output"); + + b.Property("ReceiptStateUpdates") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("receipt_state_updates"); + + b.Property("ReceiptStatus") + .HasColumnType("ledger_transaction_status") + .HasColumnName("receipt_status"); + + b.Property("ReceiptTreeHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("receipt_tree_hash"); + + b.Property("RoundInEpoch") + .HasColumnType("bigint") + .HasColumnName("round_in_epoch"); + + b.Property("RoundTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("round_timestamp"); + + b.Property("StateTreeHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("state_tree_hash"); + + b.Property("TipPaid") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("tip_paid"); + + b.Property("TransactionTreeHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("transaction_tree_hash"); + + b.Property("discriminator") + .HasColumnType("ledger_transaction_type"); + + b.HasKey("StateVersion"); + + b.HasIndex("RoundTimestamp"); + + b.HasIndex("Epoch", "RoundInEpoch") + .IsUnique() + .HasFilter("index_in_round = 0"); + + b.ToTable("ledger_transactions"); + + b.HasDiscriminator("discriminator"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("StateVersion") + .HasColumnType("bigint") + .HasColumnName("state_version"); + + b.Property("discriminator") + .HasColumnType("ledger_transaction_marker_type"); + + b.HasKey("Id"); + + b.HasIndex("StateVersion"); + + b.ToTable("ledger_transaction_markers"); + + b.HasDiscriminator("discriminator"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NetworkConfiguration", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("AddressTypeDefinitions") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("address_type_definitions"); + + b.Property("GenesisEpoch") + .HasColumnType("bigint") + .HasColumnName("genesis_epoch"); + + b.Property("GenesisRound") + .HasColumnType("bigint") + .HasColumnName("genesis_round"); + + b.Property("HrpDefinition") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("hrp_definition"); + + b.Property("NetworkHrpSuffix") + .IsRequired() + .HasColumnType("text") + .HasColumnName("network_hrp_suffix"); + + b.Property("NetworkId") + .HasColumnType("smallint") + .HasColumnName("network_id"); + + b.Property("NetworkName") + .IsRequired() + .HasColumnType("text") + .HasColumnName("network_name"); + + b.Property("WellKnownAddresses") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("well_known_addresses"); + + b.HasKey("Id"); + + b.ToTable("network_configuration"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("NonFungibleId") + .IsRequired() + .HasColumnType("text") + .HasColumnName("non_fungible_id"); + + b.Property("NonFungibleResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("non_fungible_resource_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("NonFungibleResourceEntityId", "FromStateVersion"); + + b.HasIndex("NonFungibleResourceEntityId", "NonFungibleId", "FromStateVersion") + .IsUnique(); + + b.ToTable("non_fungible_id_data"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdDataHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Data") + .HasColumnType("bytea") + .HasColumnName("data"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted"); + + b.Property("IsLocked") + .HasColumnType("boolean") + .HasColumnName("is_locked"); + + b.Property("NonFungibleIdDataId") + .HasColumnType("bigint") + .HasColumnName("non_fungible_id_data_id"); + + b.HasKey("Id"); + + b.HasIndex("NonFungibleIdDataId", "FromStateVersion"); + + b.ToTable("non_fungible_id_data_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdLocationHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("NonFungibleIdDataId") + .HasColumnType("bigint") + .HasColumnName("non_fungible_id_data_id"); + + b.Property("VaultEntityId") + .HasColumnType("bigint") + .HasColumnName("vault_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("NonFungibleIdDataId", "FromStateVersion"); + + b.ToTable("non_fungible_id_location_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdStoreHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property>("NonFungibleIdDataIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("non_fungible_id_data_ids"); + + b.Property("NonFungibleResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("non_fungible_resource_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("NonFungibleResourceEntityId", "FromStateVersion"); + + b.ToTable("non_fungible_id_store_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleSchemaHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.Property("SborTypeKind") + .HasColumnType("sbor_type_kind") + .HasColumnName("sbor_type_kind"); + + b.Property("SchemaDefiningEntityId") + .HasColumnType("bigint") + .HasColumnName("schema_defining_entity_id"); + + b.Property("SchemaHash") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("schema_hash"); + + b.Property("TypeIndex") + .HasColumnType("bigint") + .HasColumnName("type_index"); + + b.HasKey("Id"); + + b.HasIndex("ResourceEntityId", "FromStateVersion"); + + b.ToTable("non_fungible_schema_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageBlueprintHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AuthTemplate") + .HasColumnType("jsonb") + .HasColumnName("auth_template"); + + b.Property("AuthTemplateIsLocked") + .HasColumnType("boolean") + .HasColumnName("auth_template_is_locked"); + + b.Property("Definition") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("definition"); + + b.Property>("DependantEntityIds") + .HasColumnType("bigint[]") + .HasColumnName("dependant_entity_ids"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("PackageEntityId") + .HasColumnType("bigint") + .HasColumnName("package_entity_id"); + + b.Property("RoyaltyConfig") + .HasColumnType("jsonb") + .HasColumnName("royalty_config"); + + b.Property("RoyaltyConfigIsLocked") + .HasColumnType("boolean") + .HasColumnName("royalty_config_is_locked"); + + b.Property("Version") + .IsRequired() + .HasColumnType("text") + .HasColumnName("version"); + + b.HasKey("Id"); + + b.HasIndex("PackageEntityId", "FromStateVersion"); + + b.HasIndex("PackageEntityId", "Name", "Version", "FromStateVersion"); + + b.ToTable("package_blueprint_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageCodeHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Code") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("code"); + + b.Property("CodeHash") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("code_hash"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("PackageEntityId") + .HasColumnType("bigint") + .HasColumnName("package_entity_id"); + + b.Property("VmType") + .HasColumnType("package_vm_type") + .HasColumnName("vm_type"); + + b.HasKey("Id"); + + b.HasIndex("PackageEntityId", "FromStateVersion"); + + b.ToTable("package_code_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EndEpochExclusive") + .HasColumnType("numeric(20,0)") + .HasColumnName("end_epoch_exclusive"); + + b.Property("IntentHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("intent_hash"); + + b.Property("PayloadHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("payload_hash"); + + b.Property("PayloadId") + .HasColumnType("bigint") + .HasColumnName("payload_id"); + + b.Property("VersionControl") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.HasKey("Id"); + + b.HasIndex("IntentHash"); + + b.HasIndex("PayloadHash") + .IsUnique(); + + b.ToTable("pending_transactions"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionPayload", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("NotarizedTransactionBlob") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("notarized_transaction_blob"); + + b.Property("PendingTransactionId") + .HasColumnType("bigint") + .HasColumnName("pending_transaction_id"); + + b.HasKey("Id"); + + b.HasIndex("PendingTransactionId") + .IsUnique(); + + b.ToTable("pending_transaction_payloads"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ResourceEntitySupplyHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.Property("TotalBurned") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("total_burned"); + + b.Property("TotalMinted") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("total_minted"); + + b.Property("TotalSupply") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("total_supply"); + + b.HasKey("Id"); + + b.HasIndex("ResourceEntityId", "FromStateVersion"); + + b.ToTable("resource_entity_supply_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.SchemaHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("Schema") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("schema"); + + b.Property("SchemaHash") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("schema_hash"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.HasIndex("SchemaHash", "FromStateVersion"); + + b.ToTable("schema_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.StateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("discriminator") + .HasColumnType("state_type"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.ToTable("state_history"); + + b.HasDiscriminator("discriminator"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorActiveSetHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Epoch") + .HasColumnType("bigint") + .HasColumnName("epoch"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("Stake") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("stake"); + + b.Property("ValidatorPublicKeyHistoryId") + .HasColumnType("bigint") + .HasColumnName("validator_public_key_history_id"); + + b.HasKey("Id"); + + b.HasIndex("Epoch"); + + b.HasIndex("FromStateVersion"); + + b.HasIndex("ValidatorPublicKeyHistoryId"); + + b.ToTable("validator_active_set_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorEmissionStatistics", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EpochNumber") + .HasColumnType("bigint") + .HasColumnName("epoch_number"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("ProposalsMade") + .HasColumnType("bigint") + .HasColumnName("proposals_made"); + + b.Property("ProposalsMissed") + .HasColumnType("bigint") + .HasColumnName("proposals_missed"); + + b.Property("ValidatorEntityId") + .HasColumnType("bigint") + .HasColumnName("validator_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("ValidatorEntityId", "EpochNumber"); + + b.ToTable("validator_emission_statistics"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorPublicKeyHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("Key") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("key"); + + b.Property("KeyType") + .HasColumnType("public_key_type") + .HasColumnName("key_type"); + + b.Property("ValidatorEntityId") + .HasColumnType("bigint") + .HasColumnName("validator_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("ValidatorEntityId", "FromStateVersion"); + + b.HasIndex("ValidatorEntityId", "KeyType", "Key"); + + b.ToTable("validator_public_key_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalAccessControllerEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalAccessController); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalAccountEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalAccountComponent); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalConsensusManager", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalConsensusManager); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalFungibleResourceEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("Divisibility") + .HasColumnType("integer") + .HasColumnName("divisibility"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalFungibleResource); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalGenericComponentEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalGenericComponent); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalIdentityEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalIdentity); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalMultiResourcePoolEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalMultiResourcePool); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalNonFungibleResourceEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("NonFungibleIdType") + .HasColumnType("non_fungible_id_type") + .HasColumnName("non_fungible_id_type"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalNonFungibleResource); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalOneResourcePoolEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalOneResourcePool); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalPackageEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalPackage); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalTransactionTrackerEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalTransactionTracker); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalTwoResourcePoolEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalTwoResourcePool); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalValidatorEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("LockedOwnerStakeUnitVault") + .HasColumnType("bigint") + .HasColumnName("locked_owner_stake_unit_vault_entity_id"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.Property("PendingOwnerStakeUnitUnlockVault") + .HasColumnType("bigint") + .HasColumnName("pending_owner_stake_unit_unlock_vault_entity_id"); + + b.Property("PendingXrdWithdrawVault") + .HasColumnType("bigint") + .HasColumnName("pending_xrd_withdraw_vault_entity_id"); + + b.Property("StakeVaultEntityId") + .HasColumnType("bigint") + .HasColumnName("stake_vault_entity_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalValidator); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalFungibleVaultEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.Property("ResourceEntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.Property("RoyaltyVaultOfEntityId") + .HasColumnType("bigint") + .HasColumnName("royalty_vault_of_entity_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.InternalFungibleVault); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalGenericComponentEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.InternalGenericComponent); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalKeyValueStoreEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.InternalKeyValueStore); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalNonFungibleVaultEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.Property("ResourceEntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.InternalNonFungibleVault); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityFungibleResourceAggregatedVaultsHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregatedVaultsHistory"); + + b.Property("Balance") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("balance"); + + b.ToTable("entity_resource_aggregated_vaults_history"); + + b.HasDiscriminator().HasValue(ResourceType.Fungible); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityNonFungibleResourceAggregatedVaultsHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregatedVaultsHistory"); + + b.Property("TotalCount") + .HasColumnType("bigint") + .HasColumnName("total_count"); + + b.ToTable("entity_resource_aggregated_vaults_history"); + + b.HasDiscriminator().HasValue(ResourceType.NonFungible); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityFungibleVaultHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityVaultHistory"); + + b.Property("Balance") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("balance"); + + b.Property("IsRoyaltyVault") + .HasColumnType("boolean") + .HasColumnName("is_royalty_vault"); + + b.ToTable("entity_vault_history"); + + b.HasDiscriminator().HasValue(ResourceType.Fungible); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityNonFungibleVaultHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityVaultHistory"); + + b.Property>("NonFungibleIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("non_fungible_ids"); + + b.ToTable("entity_vault_history"); + + b.HasDiscriminator().HasValue(ResourceType.NonFungible); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.FlashLedgerTransaction", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); + + b.ToTable("ledger_transactions"); + + b.HasDiscriminator().HasValue(LedgerTransactionType.Flash); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GenesisLedgerTransaction", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); + + b.ToTable("ledger_transactions"); + + b.HasDiscriminator().HasValue(LedgerTransactionType.Genesis); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.RoundUpdateLedgerTransaction", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); + + b.ToTable("ledger_transactions"); + + b.HasDiscriminator().HasValue(LedgerTransactionType.RoundUpdate); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.UserLedgerTransaction", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); + + b.Property("IntentHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("intent_hash"); + + b.Property("Message") + .HasColumnType("jsonb") + .HasColumnName("message"); + + b.Property("PayloadHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("payload_hash"); + + b.Property("RawPayload") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("raw_payload"); + + b.Property("SignedIntentHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("signed_intent_hash"); + + b.HasIndex("IntentHash") + .HasFilter("intent_hash IS NOT NULL"); + + NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("IntentHash"), "hash"); + + b.ToTable("ledger_transactions"); + + b.HasDiscriminator().HasValue(LedgerTransactionType.User); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AffectedGlobalEntityTransactionMarker", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); + + b.Property("EntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.HasIndex("EntityId", "StateVersion") + .HasFilter("discriminator = 'affected_global_entity'"); + + b.ToTable("ledger_transaction_markers"); + + b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.AffectedGlobalEntity); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EventLedgerTransactionMarker", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); + + b.Property("EntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("EventType") + .HasColumnType("ledger_transaction_marker_event_type") + .HasColumnName("event_type"); + + b.Property("Quantity") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("quantity"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.HasIndex("EventType", "EntityId", "StateVersion") + .HasFilter("discriminator = 'event'"); + + b.ToTable("ledger_transaction_markers"); + + b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.Event); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ManifestAddressLedgerTransactionMarker", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); + + b.Property("EntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("OperationType") + .HasColumnType("ledger_transaction_marker_operation_type") + .HasColumnName("operation_type"); + + b.HasIndex("OperationType", "EntityId", "StateVersion") + .HasFilter("discriminator = 'manifest_address'"); + + b.ToTable("ledger_transaction_markers"); + + b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.ManifestAddress); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.OriginLedgerTransactionMarker", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); + + b.Property("OriginType") + .HasColumnType("ledger_transaction_marker_origin_type") + .HasColumnName("origin_type"); + + b.HasIndex("OriginType", "StateVersion") + .HasFilter("discriminator = 'origin'"); + + b.ToTable("ledger_transaction_markers"); + + b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.Origin); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.JsonStateHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.StateHistory"); + + b.Property("JsonState") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("json_state"); + + b.ToTable("state_history"); + + b.HasDiscriminator().HasValue(StateType.Json); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.SborStateHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.StateHistory"); + + b.Property("SborState") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("sbor_state"); + + b.Property("SborTypeKind") + .HasColumnType("sbor_type_kind") + .HasColumnName("sbor_type_kind"); + + b.Property("SchemaDefiningEntityId") + .HasColumnType("bigint") + .HasColumnName("schema_defining_entity_id"); + + b.Property("SchemaHash") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("schema_hash"); + + b.Property("TypeIndex") + .HasColumnType("bigint") + .HasColumnName("type_index"); + + b.ToTable("state_history"); + + b.HasDiscriminator().HasValue(StateType.Sbor); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", b => + { + b.OwnsOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionGatewayHandling", "GatewayHandling", b1 => + { + b1.Property("PendingTransactionId") + .HasColumnType("bigint"); + + b1.Property("AttemptedSubmissionToNodesCount") + .HasColumnType("integer") + .HasColumnName("node_submission_count"); + + b1.Property("FirstSubmittedToGatewayTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("first_submitted_to_gateway_timestamp"); + + b1.Property("HandlingStatusReason") + .HasColumnType("text") + .HasColumnName("handling_status_reason"); + + b1.Property("ResubmitFromTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("resubmit_from_timestamp"); + + b1.HasKey("PendingTransactionId"); + + b1.HasIndex("FirstSubmittedToGatewayTimestamp"); + + b1.HasIndex("ResubmitFromTimestamp"); + + b1.ToTable("pending_transactions"); + + b1.WithOwner() + .HasForeignKey("PendingTransactionId"); + }); + + b.OwnsOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionLedgerDetails", "LedgerDetails", b1 => + { + b1.Property("PendingTransactionId") + .HasColumnType("bigint"); + + b1.Property("CommitTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("commit_timestamp"); + + b1.Property("InitialRejectionReason") + .HasColumnType("text") + .HasColumnName("initial_rejection_reason"); + + b1.Property("IntentLedgerStatus") + .HasColumnType("pending_transaction_intent_ledger_status") + .HasColumnName("intent_status"); + + b1.Property("LatestRejectionReason") + .HasColumnType("text") + .HasColumnName("latest_rejection_reason"); + + b1.Property("LatestRejectionTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("latest_rejection_timestamp"); + + b1.Property("PayloadLedgerStatus") + .HasColumnType("pending_transaction_payload_ledger_status") + .HasColumnName("payload_status"); + + b1.HasKey("PendingTransactionId"); + + b1.ToTable("pending_transactions"); + + b1.WithOwner() + .HasForeignKey("PendingTransactionId"); + }); + + b.OwnsOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionNetworkDetails", "NetworkDetails", b1 => + { + b1.Property("PendingTransactionId") + .HasColumnType("bigint"); + + b1.Property("LastSubmitErrorTitle") + .HasColumnType("text") + .HasColumnName("last_submit_error"); + + b1.Property("LatestNodeSubmissionTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("latest_node_submission_timestamp"); + + b1.Property("LatestNodeSubmissionWasAccepted") + .HasColumnType("boolean") + .HasColumnName("latest_node_submission_was_accepted"); + + b1.Property("LatestSubmittedToNodeName") + .HasColumnType("text") + .HasColumnName("latest_submitted_to_node_name"); + + b1.HasKey("PendingTransactionId"); + + b1.ToTable("pending_transactions"); + + b1.WithOwner() + .HasForeignKey("PendingTransactionId"); + }); + + b.Navigation("GatewayHandling") + .IsRequired(); + + b.Navigation("LedgerDetails") + .IsRequired(); + + b.Navigation("NetworkDetails") + .IsRequired(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionPayload", b => + { + b.HasOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", "PendingTransaction") + .WithOne("Payload") + .HasForeignKey("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionPayload", "PendingTransactionId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("PendingTransaction"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorActiveSetHistory", b => + { + b.HasOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorPublicKeyHistory", "PublicKey") + .WithMany() + .HasForeignKey("ValidatorPublicKeyHistoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PublicKey"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", b => + { + b.Navigation("Payload"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240116140418_MoveVmTypeToCodeHistoryTable.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240116140418_MoveVmTypeToCodeHistoryTable.cs new file mode 100644 index 000000000..f958413e9 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240116140418_MoveVmTypeToCodeHistoryTable.cs @@ -0,0 +1,106 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +using Microsoft.EntityFrameworkCore.Migrations; +using RadixDlt.NetworkGateway.Abstractions.Model; + +#nullable disable + +namespace RadixDlt.NetworkGateway.PostgresIntegration.Migrations +{ + /// + public partial class MoveVmTypeToCodeHistoryTable : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "vm_type", + table: "package_code_history", + type: "package_vm_type", + nullable: false, + defaultValue: PackageVmType.Native); + + migrationBuilder.Sql("update package_code_history pch set vm_type = (select vm_type from entities e where e.id = pch.package_entity_id)"); + + migrationBuilder.DropColumn( + name: "vm_type", + table: "entities"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "vm_type", + table: "entities", + type: "package_vm_type", + nullable: true); + + migrationBuilder.DropColumn( + name: "vm_type", + table: "package_code_history"); + } + } +} diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql index e48ac7e2c..8866bedd2 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql @@ -1113,3 +1113,29 @@ BEGIN END $EF$; COMMIT; +START TRANSACTION; + + +DO $EF$ +BEGIN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240116140418_MoveVmTypeToCodeHistoryTable') THEN + ALTER TABLE entities DROP COLUMN vm_type; + END IF; +END $EF$; + +DO $EF$ +BEGIN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240116140418_MoveVmTypeToCodeHistoryTable') THEN + ALTER TABLE package_code_history ADD vm_type package_vm_type NOT NULL DEFAULT 'native'::package_vm_type; + END IF; +END $EF$; + +DO $EF$ +BEGIN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240116140418_MoveVmTypeToCodeHistoryTable') THEN + INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") + VALUES ('20240116140418_MoveVmTypeToCodeHistoryTable', '7.0.11'); + END IF; +END $EF$; +COMMIT; + diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs index 3f49c1c2f..aaae6bb9a 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs @@ -1202,6 +1202,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("bigint") .HasColumnName("package_entity_id"); + b.Property("VmType") + .HasColumnType("package_vm_type") + .HasColumnName("vm_type"); + b.HasKey("Id"); b.HasIndex("PackageEntityId", "FromStateVersion"); @@ -1755,10 +1759,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("bigint") .HasColumnName("package_id"); - b.Property("VmType") - .HasColumnType("package_vm_type") - .HasColumnName("vm_type"); - b.ToTable("entities"); b.HasDiscriminator().HasValue(EntityType.GlobalPackage); @@ -2018,7 +2018,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasDiscriminator().HasValue(ResourceType.NonFungible); }); - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GenesisLedgerTransaction", b => + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.FlashLedgerTransaction", b => { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); @@ -2027,6 +2027,15 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasDiscriminator().HasValue(LedgerTransactionType.Flash); }); + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GenesisLedgerTransaction", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); + + b.ToTable("ledger_transactions"); + + b.HasDiscriminator().HasValue(LedgerTransactionType.Genesis); + }); + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.RoundUpdateLedgerTransaction", b => { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/Entity.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/Entity.cs index 5f5aeb720..7f32acc54 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/Entity.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/Entity.cs @@ -250,8 +250,6 @@ internal class GlobalIdentityEntity : ComponentEntity internal class GlobalPackageEntity : ComponentEntity { - [Column("vm_type")] - public PackageVmType VmType { get; set; } } // This is transient model, not stored in database diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/PackageCodeHistory.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/PackageCodeHistory.cs index 830343d40..d02551d8c 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/PackageCodeHistory.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/PackageCodeHistory.cs @@ -62,6 +62,7 @@ * permissions under this License. */ +using RadixDlt.NetworkGateway.Abstractions.Model; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; @@ -85,4 +86,7 @@ internal class PackageCodeHistory [Column("code")] public byte[] Code { get; set; } + + [Column("vm_type")] + public PackageVmType VmType { get; set; } } diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntityStateQuerier.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntityStateQuerier.cs index ca1b760a4..3a0380e30 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntityStateQuerier.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntityStateQuerier.cs @@ -243,7 +243,7 @@ public EntityStateQuerier( } details = new GatewayModel.StateEntityDetailsResponsePackageDetails( - vmType: pe.VmType.ToGatewayModel(), + vmType: codeHistory.VmType.ToGatewayModel(), codeHashHex: codeHistory.CodeHash.ToHex(), codeHex: codeHistory.Code.ToHex(), royaltyVaultBalance: packageRoyaltyVaultBalance != null ? TokenAmount.FromSubUnitsString(packageRoyaltyVaultBalance).ToString() : null, From ecc6ffd0139aa867edfc4ee15d4cbc2d59905ed2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Pawelec?= Date: Wed, 17 Jan 2024 13:36:34 +0100 Subject: [PATCH 07/19] aggregate blueprint history. --- .../CommonDbContext.cs | 6 + .../PackageBlueprintAggregator.cs | 204 ++ .../PostgresLedgerExtenderService.cs | 92 +- .../LedgerExtension/ReadHelper.cs | 87 +- .../LedgerExtension/Records.cs | 2 +- .../LedgerExtension/SequencesHolder.cs | 2 + .../LedgerExtension/WriteHelper.cs | 34 +- ...BlueprintHistoryAggregateTable.Designer.cs | 2386 +++++++++++++++++ ...93225_AddBlueprintHistoryAggregateTable.cs | 113 + .../Migrations/IdempotentApplyMigrations.sql | 43 +- .../MigrationsDbContextModelSnapshot.cs | 29 + .../PackageBlueprintAggregateHistory.cs | 86 + .../Services/BlueprintProvider.cs | 31 +- .../Services/EntityStateQuerier.cs | 30 +- .../Services/ValidatorQuerier.cs | 1 - 15 files changed, 3074 insertions(+), 72 deletions(-) create mode 100644 src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageBlueprintAggregator.cs create mode 100644 src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117093225_AddBlueprintHistoryAggregateTable.Designer.cs create mode 100644 src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117093225_AddBlueprintHistoryAggregateTable.cs create mode 100644 src/RadixDlt.NetworkGateway.PostgresIntegration/Models/PackageBlueprintAggregateHistory.cs diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/CommonDbContext.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/CommonDbContext.cs index 69d0bb60c..3767b15b7 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/CommonDbContext.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/CommonDbContext.cs @@ -101,6 +101,8 @@ internal abstract class CommonDbContext : DbContext public DbSet EntityMetadataAggregateHistory => Set(); + public DbSet PackageBlueprintAggregateHistory => Set(); + public DbSet EntityResourceAggregateHistory => Set(); public DbSet EntityResourceVaultAggregateHistory => Set(); @@ -360,6 +362,10 @@ private static void HookupHistory(ModelBuilder modelBuilder) .Entity() .HasIndex(e => new { e.EntityId, e.FromStateVersion }); + modelBuilder + .Entity() + .HasIndex(e => new { e.PackageEntityId, e.FromStateVersion }); + modelBuilder .Entity() .HasIndex(e => new { e.EntityId, e.FromStateVersion }); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageBlueprintAggregator.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageBlueprintAggregator.cs new file mode 100644 index 000000000..1414e804d --- /dev/null +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageBlueprintAggregator.cs @@ -0,0 +1,204 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +using RadixDlt.NetworkGateway.PostgresIntegration.Models; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; + +namespace RadixDlt.NetworkGateway.PostgresIntegration.LedgerExtension; + +internal abstract record PackageBlueprintChange(long StateVersion, long PackageEntityId, string Name, string Version); + +internal record PackageBlueprintDefinitionChange(long StateVersion, long PackageEntityId, string Name, string Version, string Definition) + : PackageBlueprintChange(StateVersion, PackageEntityId, Name, Version); + +internal record PackageBlueprintDependantEntityIdsChange(long StateVersion, long PackageEntityId, string Name, string Version, List? DependantEntityIds = null) + : PackageBlueprintChange(StateVersion, PackageEntityId, Name, Version); + +internal record PackageBlueprintAuthTemplateChange(long StateVersion, long PackageEntityId, string Name, string Version, string? AuthTemplate = null, bool? AuthTemplateIsLocked = null) + : PackageBlueprintChange(StateVersion, PackageEntityId, Name, Version); + +internal record PackageBlueprintRoyaltyConfigChange(long StateVersion, long PackageEntityId, string Name, string Version, string? RoyaltyConfig = null, bool? RoyaltyConfigIsLocked = null) + : PackageBlueprintChange(StateVersion, PackageEntityId, Name, Version); + +internal static class PackageBlueprintAggregator +{ + public static (List PackageBlueprintHistoryToAdd, List PackageBlueprintAggregateHistoryToAdd) AggregatePackageBlueprint( + List packageBlueprintChanges, + Dictionary mostRecentPackageBlueprintHistory, + Dictionary mostRecentPackageBlueprintAggregateHistory, + SequencesHolder sequences) + { + var packageBlueprintHistoryToAdd = new List(); + var packageBlueprintAggregateHistoryToAdd = new List(); + + var packageGroups = packageBlueprintChanges.GroupBy(x => new { x.PackageEntityId, x.StateVersion }); + + foreach (var packageGroup in packageGroups) + { + var packageEntityId = packageGroup.Key.PackageEntityId; + var stateVersion = packageGroup.Key.StateVersion; + mostRecentPackageBlueprintAggregateHistory.TryGetValue(packageEntityId, out var existingPackageBlueprintAggregate); + + PackageBlueprintAggregateHistory packageBlueprintAggregate; + + if (existingPackageBlueprintAggregate == null) + { + packageBlueprintAggregate = new PackageBlueprintAggregateHistory + { + Id = sequences.PackageBlueprintAggregateHistorySequence++, + FromStateVersion = stateVersion, + PackageEntityId = packageEntityId, + PackageBlueprintIds = new List(), + }; + + mostRecentPackageBlueprintAggregateHistory[packageEntityId] = packageBlueprintAggregate; + } + else + { + packageBlueprintAggregate = existingPackageBlueprintAggregate; + packageBlueprintAggregate.Id = sequences.PackageBlueprintAggregateHistorySequence++; + packageBlueprintAggregate.FromStateVersion = stateVersion; + } + + var packageBlueprintGroups = packageGroup + .GroupBy(x => new { x.PackageEntityId, x.Name, x.Version, x.StateVersion }); + + foreach (var packageBlueprintGroup in packageBlueprintGroups) + { + var lookup = new PackageBlueprintLookup(packageEntityId, packageBlueprintGroup.Key.Name, packageBlueprintGroup.Key.Version); + mostRecentPackageBlueprintHistory.TryGetValue(lookup, out var existingPackageBlueprint); + + PackageBlueprintHistory packageBlueprintHistory; + + if (existingPackageBlueprint != null) + { + var previousPackageBlueprintHistoryId = existingPackageBlueprint.Id; + + packageBlueprintHistory = existingPackageBlueprint; + packageBlueprintHistory.Id = sequences.PackageBlueprintHistorySequence++; + packageBlueprintHistory.FromStateVersion = packageBlueprintGroup.Key.StateVersion; + + packageBlueprintAggregate.PackageBlueprintIds.Remove(previousPackageBlueprintHistoryId); + packageBlueprintAggregate.PackageBlueprintIds.Add(packageBlueprintHistory.Id); + } + else + { + packageBlueprintHistory = new PackageBlueprintHistory + { + Id = sequences.PackageBlueprintHistorySequence++, + PackageEntityId = packageEntityId, + FromStateVersion = stateVersion, + Name = lookup.Name, + Version = lookup.Version, + }; + mostRecentPackageBlueprintHistory[lookup] = packageBlueprintHistory; + + packageBlueprintAggregate.PackageBlueprintIds.Add(packageBlueprintHistory.Id); + } + + foreach (var change in packageBlueprintGroup) + { + switch (change) + { + case PackageBlueprintDefinitionChange definitionChange: + { + packageBlueprintHistory.Definition = definitionChange.Definition; + break; + } + + case PackageBlueprintAuthTemplateChange authTemplateChange: + { + packageBlueprintHistory.AuthTemplate = authTemplateChange.AuthTemplate; + packageBlueprintHistory.AuthTemplateIsLocked = authTemplateChange.AuthTemplateIsLocked; + break; + } + + case PackageBlueprintRoyaltyConfigChange royaltyConfigChange: + { + packageBlueprintHistory.RoyaltyConfig = royaltyConfigChange.RoyaltyConfig; + packageBlueprintHistory.RoyaltyConfigIsLocked = royaltyConfigChange.RoyaltyConfigIsLocked; + break; + } + + case PackageBlueprintDependantEntityIdsChange dependantEntityIdsChange: + { + packageBlueprintHistory.DependantEntityIds = dependantEntityIdsChange.DependantEntityIds; + break; + } + + default: throw new UnreachableException($"Unexpected type of package blueprint change: {change.GetType()}"); + } + } + + packageBlueprintHistoryToAdd.Add(packageBlueprintHistory); + } + + packageBlueprintAggregateHistoryToAdd.Add(packageBlueprintAggregate); + } + + return (packageBlueprintHistoryToAdd, packageBlueprintAggregateHistoryToAdd); + } +} diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs index 51377f21d..186320cdd 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs @@ -702,11 +702,11 @@ private async Task ProcessTransactions(ReadWriteDbContext db var metadataChanges = new List(); var resourceSupplyChanges = new List(); var validatorSetChanges = new List(); + var packageBlueprintChanges = new List(); var stateToAdd = new List(); var vaultHistoryToAdd = new List(); var keyValueStoreEntryHistoryToAdd = new List(); var componentMethodRoyaltiesToAdd = new List(); - var packageBlueprintHistoryToAdd = new Dictionary(); var packageCodeHistoryToAdd = new Dictionary(); var schemaHistoryToAdd = new List(); var nonFungibleSchemaHistoryToAdd = new List(); @@ -957,66 +957,52 @@ private async Task ProcessTransactions(ReadWriteDbContext db if (substateData is CoreModel.PackageBlueprintDefinitionEntrySubstate packageBlueprintDefinition) { - var lookup = new PackageBlueprintLookup(referencedEntity.DatabaseId, packageBlueprintDefinition.Key.BlueprintName, packageBlueprintDefinition.Key.BlueprintVersion); - - packageBlueprintHistoryToAdd - .GetOrAdd(lookup, _ => new PackageBlueprintHistory - { - Id = sequences.PackageBlueprintHistorySequence++, - FromStateVersion = stateVersion, - PackageEntityId = referencedEntity.DatabaseId, - Name = lookup.Name, - Version = lookup.BlueprintVersion, - }) - .Definition = packageBlueprintDefinition.Value.Definition.ToJson(); + packageBlueprintChanges.Add( + new PackageBlueprintDefinitionChange( + stateVersion, + referencedEntity.DatabaseId, + packageBlueprintDefinition.Key.BlueprintName, + packageBlueprintDefinition.Key.BlueprintVersion, + packageBlueprintDefinition.Value.Definition.ToJson() + )); } if (substateData is CoreModel.PackageBlueprintDependenciesEntrySubstate packageBlueprintDependencies) { - var lookup = new PackageBlueprintLookup(referencedEntity.DatabaseId, packageBlueprintDependencies.Key.BlueprintName, packageBlueprintDependencies.Key.BlueprintVersion); - - packageBlueprintHistoryToAdd - .GetOrAdd(lookup, _ => new PackageBlueprintHistory - { - Id = sequences.PackageBlueprintHistorySequence++, - FromStateVersion = stateVersion, - PackageEntityId = referencedEntity.DatabaseId, - Name = lookup.Name, - Version = lookup.BlueprintVersion, - }) - .DependantEntityIds = packageBlueprintDependencies.Value.Dependencies.Dependencies.Select(address => referencedEntities.Get((EntityAddress)address).DatabaseId).ToList(); + packageBlueprintChanges.Add( + new PackageBlueprintDependantEntityIdsChange( + stateVersion, + referencedEntity.DatabaseId, + packageBlueprintDependencies.Key.BlueprintName, + packageBlueprintDependencies.Key.BlueprintVersion, + packageBlueprintDependencies.Value.Dependencies.Dependencies.Select(address => referencedEntities.Get((EntityAddress)address).DatabaseId).ToList() + )); } if (substateData is CoreModel.PackageBlueprintRoyaltyEntrySubstate packageBlueprintRoyalty) { - var lookup = new PackageBlueprintLookup(referencedEntity.DatabaseId, packageBlueprintRoyalty.Key.BlueprintName, packageBlueprintRoyalty.Key.BlueprintVersion); - var pb = packageBlueprintHistoryToAdd.GetOrAdd(lookup, _ => new PackageBlueprintHistory - { - Id = sequences.PackageBlueprintHistorySequence++, - FromStateVersion = stateVersion, - PackageEntityId = referencedEntity.DatabaseId, - Name = lookup.Name, - Version = lookup.BlueprintVersion, - }); - - pb.RoyaltyConfig = packageBlueprintRoyalty.Value.RoyaltyConfig.ToJson(); - pb.RoyaltyConfigIsLocked = packageBlueprintRoyalty.IsLocked; + packageBlueprintChanges.Add( + new PackageBlueprintRoyaltyConfigChange( + stateVersion, + referencedEntity.DatabaseId, + packageBlueprintRoyalty.Key.BlueprintName, + packageBlueprintRoyalty.Key.BlueprintVersion, + packageBlueprintRoyalty.Value.RoyaltyConfig.ToJson(), + packageBlueprintRoyalty.IsLocked + )); } if (substateData is CoreModel.PackageBlueprintAuthTemplateEntrySubstate packageBlueprintAuthTemplate) { - var lookup = new PackageBlueprintLookup(referencedEntity.DatabaseId, packageBlueprintAuthTemplate.Key.BlueprintName, packageBlueprintAuthTemplate.Key.BlueprintVersion); - var pb = packageBlueprintHistoryToAdd.GetOrAdd(lookup, _ => new PackageBlueprintHistory - { - Id = sequences.PackageBlueprintHistorySequence++, - FromStateVersion = stateVersion, - PackageEntityId = referencedEntity.DatabaseId, - Name = lookup.Name, - Version = lookup.BlueprintVersion, - }); - - pb.AuthTemplate = packageBlueprintAuthTemplate.Value.AuthConfig.ToJson(); - pb.AuthTemplateIsLocked = packageBlueprintAuthTemplate.IsLocked; + packageBlueprintChanges.Add( + new PackageBlueprintAuthTemplateChange( + stateVersion, + referencedEntity.DatabaseId, + packageBlueprintAuthTemplate.Key.BlueprintName, + packageBlueprintAuthTemplate.Key.BlueprintVersion, + packageBlueprintAuthTemplate.Value.AuthConfig.ToJson(), + packageBlueprintAuthTemplate.IsLocked + )); } if (substateData is CoreModel.PackageCodeOriginalCodeEntrySubstate packageCodeOriginalCode) @@ -1356,6 +1342,7 @@ private async Task ProcessTransactions(ReadWriteDbContext db { var sw = Stopwatch.StartNew(); + var mostRecentPackageBlueprintHistory = await readHelper.MostRecentPackageBlueprintHistoryFor(packageBlueprintChanges, token); var mostRecentMetadataHistory = await readHelper.MostRecentEntityMetadataHistoryFor(metadataChanges, token); var mostRecentAggregatedMetadataHistory = await readHelper.MostRecentEntityAggregateMetadataHistoryFor(metadataChanges, token); var mostRecentAccessRulesEntryHistory = await readHelper.MostRecentEntityRoleAssignmentsEntryHistoryFor(roleAssignmentsChangePointers.Values, token); @@ -1368,6 +1355,7 @@ private async Task ProcessTransactions(ReadWriteDbContext db var mostRecentEntityNonFungibleVaultHistory = await readHelper.MostRecentEntityNonFungibleVaultHistory(vaultSnapshots.OfType().ToList(), token); var existingNonFungibleIdData = await readHelper.ExistingNonFungibleIdDataFor(nonFungibleIdChanges, vaultSnapshots.OfType().ToList(), token); var existingValidatorKeys = await readHelper.ExistingValidatorKeysFor(validatorSetChanges, token); + var mostRecentPackageBlueprintAggregateHistory = await readHelper.MostRecentPackageBlueprintAggregateHistoryFor(packageBlueprintChanges, token); dbReadDuration += sw.Elapsed; @@ -1384,6 +1372,9 @@ private async Task ProcessTransactions(ReadWriteDbContext db var nonFungibleIdLocationHistoryToAdd = new List(); var nonFungibleIdsMutableDataHistoryToAdd = new List(); + var (packageBlueprintHistoryToAdd, packageBlueprintAggregateHistoryToAdd) = + PackageBlueprintAggregator.AggregatePackageBlueprint(packageBlueprintChanges, mostRecentPackageBlueprintHistory, mostRecentPackageBlueprintAggregateHistory, sequences); + foreach (var metadataChange in metadataChanges) { var lookup = new MetadataLookup(metadataChange.ReferencedEntity.DatabaseId, metadataChange.Key); @@ -1881,7 +1872,7 @@ void AggregateEntityResourceVaultInternal(long entityId, long resourceEntityId, rowsInserted += await writeHelper.CopyResourceEntitySupplyHistory(resourceEntitySupplyHistoryToAdd, token); rowsInserted += await writeHelper.CopyValidatorKeyHistory(validatorKeyHistoryToAdd.Values, token); rowsInserted += await writeHelper.CopyValidatorActiveSetHistory(validatorActiveSetHistoryToAdd, token); - rowsInserted += await writeHelper.CopyPackageBlueprintHistory(packageBlueprintHistoryToAdd.Values, token); + rowsInserted += await writeHelper.CopyPackageBlueprintHistory(packageBlueprintHistoryToAdd, token); rowsInserted += await writeHelper.CopyPackageCodeHistory(packageCodeHistoryToAdd.Values, token); rowsInserted += await writeHelper.CopySchemaHistory(schemaHistoryToAdd, token); rowsInserted += await writeHelper.CopyKeyValueStoreEntryHistory(keyValueStoreEntryHistoryToAdd, token); @@ -1890,6 +1881,7 @@ void AggregateEntityResourceVaultInternal(long entityId, long resourceEntityId, rowsInserted += await writeHelper.CopyValidatorEmissionStatistics(validatorEmissionStatisticsToAdd, token); rowsInserted += await writeHelper.CopyNonFungibleDataSchemaHistory(nonFungibleSchemaHistoryToAdd, token); rowsInserted += await writeHelper.CopyKeyValueStoreSchemaHistory(keyValueStoreSchemaHistoryToAdd, token); + rowsInserted += await writeHelper.CopyPackageBlueprintAggregateHistory(packageBlueprintAggregateHistoryToAdd, token); await writeHelper.UpdateSequences(sequences, token); dbWriteDuration += sw.Elapsed; diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/ReadHelper.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/ReadHelper.cs index 067573b4b..bcbb9b361 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/ReadHelper.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/ReadHelper.cs @@ -93,6 +93,56 @@ public ReadHelper(ReadWriteDbContext dbContext, IEnumerable> MostRecentPackageBlueprintHistoryFor(List packageBlueprintChanges, CancellationToken token) + { + if (!packageBlueprintChanges.Any()) + { + return new Dictionary(); + } + + var sw = Stopwatch.GetTimestamp(); + + var entityIds = new List(); + var names = new List(); + var versions = new List(); + var lookupSet = new HashSet(); + + foreach (var change in packageBlueprintChanges) + { + lookupSet.Add(new PackageBlueprintLookup(change.PackageEntityId, change.Name, change.Version)); + } + + foreach (var lookup in lookupSet) + { + entityIds.Add(lookup.PackageEntityId); + names.Add(lookup.Name); + versions.Add(lookup.Version); + } + + var result = await _dbContext + .PackageBlueprintHistory + .FromSqlInterpolated(@$" +WITH variables (entity_id, name, version) AS ( + SELECT UNNEST({entityIds}), UNNEST({names}), UNNEST({versions}) +) +SELECT pbh.* +FROM variables +INNER JOIN LATERAL ( + SELECT * + FROM package_blueprint_history + WHERE package_entity_id = variables.entity_id AND name = variables.name AND version = variables.version + ORDER BY from_state_version DESC + LIMIT 1 +) pbh ON true;") + .AsNoTracking() + .AnnotateMetricName() + .ToDictionaryAsync(e => new PackageBlueprintLookup(e.PackageEntityId, e.Name, e.Version), token); + + await _observers.ForEachAsync(x => x.StageCompleted(nameof(MostRecentPackageBlueprintHistoryFor), Stopwatch.GetElapsedTime(sw), result.Count)); + + return result; + } + public async Task> MostRecentEntityMetadataHistoryFor(List metadataChanges, CancellationToken token) { if (!metadataChanges.Any()) @@ -140,6 +190,40 @@ LIMIT 1 return result; } + public async Task> MostRecentPackageBlueprintAggregateHistoryFor(List packageBlueprintChanges, CancellationToken token) + { + if (!packageBlueprintChanges.Any()) + { + return new Dictionary(); + } + + var sw = Stopwatch.GetTimestamp(); + var packageEntityIds = packageBlueprintChanges.Select(x => x.PackageEntityId).Distinct().ToList(); + + var result = await _dbContext + .PackageBlueprintAggregateHistory + .FromSqlInterpolated(@$" +WITH variables (package_entity_id) AS ( + SELECT UNNEST({packageEntityIds}) +) +SELECT pbah.* +FROM variables +INNER JOIN LATERAL ( + SELECT * + FROM package_blueprint_aggregate_history + WHERE package_entity_id = variables.package_entity_id + ORDER BY from_state_version DESC + LIMIT 1 +) pbah ON true;") + .AsNoTracking() + .AnnotateMetricName() + .ToDictionaryAsync(e => e.PackageEntityId, token); + + await _observers.ForEachAsync(x => x.StageCompleted(nameof(MostRecentPackageBlueprintAggregateHistoryFor), Stopwatch.GetElapsedTime(sw), result.Count)); + + return result; + } + public async Task> MostRecentEntityAggregateMetadataHistoryFor(List metadataChanges, CancellationToken token) { if (!metadataChanges.Any()) @@ -662,7 +746,8 @@ public async Task LoadSequences(CancellationToken token) nextval('key_value_store_entry_history_id_seq') AS KeyValueStoreEntryHistorySequence, nextval('validator_emission_statistics_id_seq') AS ValidatorEmissionStatisticsSequence, nextval('non_fungible_schema_history_id_seq') AS NonFungibleSchemaHistorySequence, - nextval('key_value_store_schema_history_id_seq') AS KeyValueSchemaHistorySequence", + nextval('key_value_store_schema_history_id_seq') AS KeyValueSchemaHistorySequence, + nextval('package_blueprint_aggregate_history_id_seq') AS PackageBlueprintAggregateHistorySequence", cancellationToken: token); var result = await _connection.QueryFirstAsync(cd); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Records.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Records.cs index a6f123f38..5435d8b05 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Records.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Records.cs @@ -109,7 +109,7 @@ internal record ValidatorSetChange(long Epoch, IDictionary CopyEntityMetadataHistory(ICollection CopyPackageBlueprintAggregateHistory(ICollection entities, CancellationToken token) + { + if (!entities.Any()) + { + return 0; + } + + var sw = Stopwatch.GetTimestamp(); + + await using var writer = await _connection.BeginBinaryImportAsync("COPY package_blueprint_aggregate_history (id, from_state_version, package_entity_id, package_blueprint_ids) FROM STDIN (FORMAT BINARY)", token); + + foreach (var e in entities) + { + await writer.StartRowAsync(token); + await writer.WriteAsync(e.Id, NpgsqlDbType.Bigint, token); + await writer.WriteAsync(e.FromStateVersion, NpgsqlDbType.Bigint, token); + await writer.WriteAsync(e.PackageEntityId, NpgsqlDbType.Bigint, token); + await writer.WriteAsync(e.PackageBlueprintIds.ToArray(), NpgsqlDbType.Array | NpgsqlDbType.Bigint, token); + } + + await writer.CompleteAsync(token); + + await _observers.ForEachAsync(x => x.StageCompleted(nameof(CopyEntityMetadataAggregateHistory), Stopwatch.GetElapsedTime(sw), entities.Count)); + + return entities.Count; + } + public async Task CopyEntityMetadataAggregateHistory(ICollection entities, CancellationToken token) { if (!entities.Any()) @@ -1079,7 +1106,7 @@ public async Task CopyPackageCodeHistory(ICollection en await writer.WriteAsync(e.PackageEntityId, NpgsqlDbType.Bigint, token); await writer.WriteAsync(e.CodeHash, NpgsqlDbType.Bytea, token); await writer.WriteAsync(e.Code, NpgsqlDbType.Bytea, token); - await writer.WriteAsync(e.VmType, "vm_type", token); + await writer.WriteAsync(e.VmType, "package_vm_type", token); } await writer.CompleteAsync(token); @@ -1254,7 +1281,9 @@ public async Task UpdateSequences(SequencesHolder sequences, CancellationToken t setval('key_value_store_entry_history_id_seq', @keyValueStoreEntryHistorySequence), setval('validator_emission_statistics_id_seq', @validatorEmissionStatisticsSequence), setval('non_fungible_schema_history_id_seq', @NonFungibleSchemaHistorySequence), - setval('key_value_store_schema_history_id_seq', @KeyValueSchemaHistorySequence)", + setval('key_value_store_schema_history_id_seq', @KeyValueSchemaHistorySequence), + setval('package_blueprint_aggregate_history_id_seq', @packageBlueprintAggregateHistorySequence) +", parameters: new { accountDefaultDepositRuleHistorySequence = sequences.AccountDefaultDepositRuleHistorySequence, @@ -1286,6 +1315,7 @@ public async Task UpdateSequences(SequencesHolder sequences, CancellationToken t validatorEmissionStatisticsSequence = sequences.ValidatorEmissionStatisticsSequence, nonFungibleSchemaHistorySequence = sequences.NonFungibleSchemaHistorySequence, keyValueSchemaHistorySequence = sequences.KeyValueSchemaHistorySequence, + packageBlueprintAggregateHistorySequence = sequences.PackageBlueprintAggregateHistorySequence, }, cancellationToken: token); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117093225_AddBlueprintHistoryAggregateTable.Designer.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117093225_AddBlueprintHistoryAggregateTable.Designer.cs new file mode 100644 index 000000000..677187385 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117093225_AddBlueprintHistoryAggregateTable.Designer.cs @@ -0,0 +1,2386 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +// +using System; +using System.Collections.Generic; +using System.Numerics; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using RadixDlt.NetworkGateway.Abstractions.Addressing; +using RadixDlt.NetworkGateway.Abstractions.Model; +using RadixDlt.NetworkGateway.PostgresIntegration; +using RadixDlt.NetworkGateway.PostgresIntegration.Models; + +#nullable disable + +namespace RadixDlt.NetworkGateway.PostgresIntegration.Migrations +{ + [DbContext(typeof(MigrationsDbContext))] + [Migration("20240117093225_AddBlueprintHistoryAggregateTable")] + partial class AddBlueprintHistoryAggregateTable + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "account_default_deposit_rule", new[] { "accept", "reject", "allow_existing" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "account_resource_preference_rule", new[] { "allowed", "disallowed" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "entity_type", new[] { "global_consensus_manager", "global_fungible_resource", "global_non_fungible_resource", "global_generic_component", "internal_generic_component", "global_account_component", "global_package", "internal_key_value_store", "internal_fungible_vault", "internal_non_fungible_vault", "global_validator", "global_access_controller", "global_identity", "global_one_resource_pool", "global_two_resource_pool", "global_multi_resource_pool", "global_transaction_tracker" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_event_type", new[] { "withdrawal", "deposit" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_operation_type", new[] { "resource_in_use", "account_deposited_into", "account_withdrawn_from" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_origin_type", new[] { "user", "epoch_change" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_type", new[] { "origin", "event", "manifest_address", "affected_global_entity" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_status", new[] { "succeeded", "failed" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_type", new[] { "genesis", "user", "round_update", "flash" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "module_id", new[] { "main", "metadata", "royalty", "role_assignment" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "non_fungible_id_type", new[] { "string", "integer", "bytes", "ruid" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "package_vm_type", new[] { "native", "scrypto_v1" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "pending_transaction_intent_ledger_status", new[] { "unknown", "committed", "commit_pending", "permanent_rejection", "possible_to_commit", "likely_but_not_certain_rejection" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "pending_transaction_payload_ledger_status", new[] { "unknown", "committed", "commit_pending", "clashing_commit", "permanently_rejected", "transiently_accepted", "transiently_rejected" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "public_key_type", new[] { "ecdsa_secp256k1", "eddsa_ed25519" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "resource_type", new[] { "fungible", "non_fungible" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "sbor_type_kind", new[] { "well_known", "schema_local" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "state_type", new[] { "json", "sbor" }); + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AccountDefaultDepositRuleHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountEntityId") + .HasColumnType("bigint") + .HasColumnName("account_entity_id"); + + b.Property("DefaultDepositRule") + .HasColumnType("account_default_deposit_rule") + .HasColumnName("default_deposit_rule"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.HasKey("Id"); + + b.HasIndex("AccountEntityId", "FromStateVersion"); + + b.ToTable("account_default_deposit_rule_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AccountResourcePreferenceRuleHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountEntityId") + .HasColumnType("bigint") + .HasColumnName("account_entity_id"); + + b.Property("AccountResourcePreferenceRule") + .HasColumnType("account_resource_preference_rule") + .HasColumnName("account_resource_preference_rule"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("AccountEntityId", "ResourceEntityId", "FromStateVersion"); + + b.ToTable("account_resource_preference_rule_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ComponentMethodRoyaltyEntryHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("IsLocked") + .HasColumnType("boolean") + .HasColumnName("is_locked"); + + b.Property("MethodName") + .IsRequired() + .HasColumnType("text") + .HasColumnName("method_name"); + + b.Property("RoyaltyAmount") + .HasColumnType("jsonb") + .HasColumnName("royalty_amount"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.HasIndex("EntityId", "MethodName", "FromStateVersion"); + + b.ToTable("component_method_royalty_entry_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasColumnType("text") + .HasColumnName("address"); + + b.Property>("AncestorIds") + .HasColumnType("bigint[]") + .HasColumnName("ancestor_ids"); + + b.Property>("CorrelatedEntities") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("correlated_entities"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("GlobalAncestorId") + .HasColumnType("bigint") + .HasColumnName("global_ancestor_id"); + + b.Property("IsGlobal") + .HasColumnType("boolean") + .HasColumnName("is_global"); + + b.Property("OwnerAncestorId") + .HasColumnType("bigint") + .HasColumnName("owner_ancestor_id"); + + b.Property("ParentAncestorId") + .HasColumnType("bigint") + .HasColumnName("parent_ancestor_id"); + + b.Property("discriminator") + .HasColumnType("entity_type"); + + b.HasKey("Id"); + + b.HasIndex("Address") + .IsUnique(); + + b.HasIndex("FromStateVersion") + .HasFilter("discriminator = 'global_validator'"); + + b.ToTable("entities"); + + b.HasDiscriminator("discriminator"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityMetadataAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property>("MetadataIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("metadata_ids"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.ToTable("entity_metadata_aggregate_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityMetadataHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted"); + + b.Property("IsLocked") + .HasColumnType("boolean") + .HasColumnName("is_locked"); + + b.Property("Key") + .IsRequired() + .HasColumnType("text") + .HasColumnName("key"); + + b.Property("Value") + .HasColumnType("bytea") + .HasColumnName("value"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "Key", "FromStateVersion"); + + b.ToTable("entity_metadata_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property>("FungibleResourceEntityIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("fungible_resource_entity_ids"); + + b.Property>("FungibleResourceSignificantUpdateStateVersions") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("fungible_resource_significant_update_state_versions"); + + b.Property>("NonFungibleResourceEntityIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("non_fungible_resource_entity_ids"); + + b.Property>("NonFungibleResourceSignificantUpdateStateVersions") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("non_fungible_resource_significant_update_state_versions"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.ToTable("entity_resource_aggregate_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregatedVaultsHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.Property("discriminator") + .HasColumnType("resource_type"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "ResourceEntityId", "FromStateVersion"); + + b.ToTable("entity_resource_aggregated_vaults_history"); + + b.HasDiscriminator("discriminator"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceVaultAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.Property>("VaultEntityIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("vault_entity_ids"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "ResourceEntityId", "FromStateVersion"); + + b.ToTable("entity_resource_vault_aggregate_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityRoleAssignmentsAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property>("EntryIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("entry_ids"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("OwnerRoleId") + .HasColumnType("bigint") + .HasColumnName("owner_role_id"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.ToTable("entity_role_assignments_aggregate_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityRoleAssignmentsEntryHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted"); + + b.Property("KeyModule") + .HasColumnType("module_id") + .HasColumnName("key_module"); + + b.Property("KeyRole") + .IsRequired() + .HasColumnType("text") + .HasColumnName("key_role"); + + b.Property("RoleAssignments") + .HasColumnType("jsonb") + .HasColumnName("role_assignments"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "KeyRole", "KeyModule", "FromStateVersion"); + + b.ToTable("entity_role_assignments_entry_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityRoleAssignmentsOwnerRoleHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("RoleAssignments") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("role_assignments"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.ToTable("entity_role_assignments_owner_role_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityVaultHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("GlobalEntityId") + .HasColumnType("bigint") + .HasColumnName("global_entity_id"); + + b.Property("OwnerEntityId") + .HasColumnType("bigint") + .HasColumnName("owner_entity_id"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.Property("VaultEntityId") + .HasColumnType("bigint") + .HasColumnName("vault_entity_id"); + + b.Property("discriminator") + .HasColumnType("resource_type"); + + b.HasKey("Id"); + + b.HasIndex("GlobalEntityId", "FromStateVersion") + .HasFilter("is_royalty_vault = true"); + + b.HasIndex("OwnerEntityId", "FromStateVersion") + .HasFilter("is_royalty_vault = true"); + + b.HasIndex("VaultEntityId", "FromStateVersion") + .HasFilter("discriminator = 'non_fungible'"); + + b.HasIndex("GlobalEntityId", "VaultEntityId", "FromStateVersion"); + + b.HasIndex("Id", "ResourceEntityId", "FromStateVersion"); + + b.HasIndex("OwnerEntityId", "VaultEntityId", "FromStateVersion"); + + b.ToTable("entity_vault_history"); + + b.HasDiscriminator("discriminator"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.KeyValueStoreEntryHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted"); + + b.Property("IsLocked") + .HasColumnType("boolean") + .HasColumnName("is_locked"); + + b.Property("Key") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("key"); + + b.Property("KeyValueStoreEntityId") + .HasColumnType("bigint") + .HasColumnName("key_value_store_entity_id"); + + b.Property("Value") + .HasColumnType("bytea") + .HasColumnName("value"); + + b.HasKey("Id"); + + b.HasIndex("KeyValueStoreEntityId", "Key", "FromStateVersion"); + + b.ToTable("key_value_store_entry_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.KeyValueStoreSchemaHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("KeySborTypeKind") + .HasColumnType("sbor_type_kind") + .HasColumnName("key_sbor_type_kind"); + + b.Property("KeySchemaDefiningEntityId") + .HasColumnType("bigint") + .HasColumnName("key_schema_defining_entity_id"); + + b.Property("KeySchemaHash") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("key_schema_hash"); + + b.Property("KeyTypeIndex") + .HasColumnType("bigint") + .HasColumnName("key_type_index"); + + b.Property("KeyValueStoreEntityId") + .HasColumnType("bigint") + .HasColumnName("key_value_store_entity_id"); + + b.Property("ValueSborTypeKind") + .HasColumnType("sbor_type_kind") + .HasColumnName("value_sbor_type_kind"); + + b.Property("ValueSchemaDefiningEntityId") + .HasColumnType("bigint") + .HasColumnName("value_schema_defining_entity_id"); + + b.Property("ValueSchemaHash") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("value_schema_hash"); + + b.Property("ValueTypeIndex") + .HasColumnType("bigint") + .HasColumnName("value_type_index"); + + b.HasKey("Id"); + + b.HasIndex("KeyValueStoreEntityId", "FromStateVersion"); + + b.ToTable("key_value_store_schema_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction", b => + { + b.Property("StateVersion") + .HasColumnType("bigint") + .HasColumnName("state_version"); + + b.Property("AffectedGlobalEntities") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("affected_global_entities"); + + b.Property("BalanceChanges") + .HasColumnType("jsonb") + .HasColumnName("balance_changes"); + + b.Property("CreatedTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_timestamp"); + + b.Property("Epoch") + .HasColumnType("bigint") + .HasColumnName("epoch"); + + b.Property("FeePaid") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("fee_paid"); + + b.Property("IndexInEpoch") + .HasColumnType("bigint") + .HasColumnName("index_in_epoch"); + + b.Property("IndexInRound") + .HasColumnType("bigint") + .HasColumnName("index_in_round"); + + b.Property("NormalizedRoundTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("normalized_round_timestamp"); + + b.Property("ReceiptCostingParameters") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("receipt_costing_parameters"); + + b.Property("ReceiptErrorMessage") + .HasColumnType("text") + .HasColumnName("receipt_error_message"); + + b.Property("ReceiptEventEmitters") + .IsRequired() + .HasColumnType("jsonb[]") + .HasColumnName("receipt_event_emitters"); + + b.Property("ReceiptEventNames") + .IsRequired() + .HasColumnType("text[]") + .HasColumnName("receipt_event_names"); + + b.Property("ReceiptEventSborTypeKinds") + .IsRequired() + .HasColumnType("sbor_type_kind[]") + .HasColumnName("receipt_event_sbor_type_kinds"); + + b.Property("ReceiptEventSbors") + .IsRequired() + .HasColumnType("bytea[]") + .HasColumnName("receipt_event_sbors"); + + b.Property("ReceiptEventSchemaEntityIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("receipt_event_schema_entity_ids"); + + b.Property("ReceiptEventSchemaHashes") + .IsRequired() + .HasColumnType("bytea[]") + .HasColumnName("receipt_event_schema_hashes"); + + b.Property("ReceiptEventTypeIndexes") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("receipt_event_type_indexes"); + + b.Property("ReceiptFeeDestination") + .HasColumnType("jsonb") + .HasColumnName("receipt_fee_destination"); + + b.Property("ReceiptFeeSource") + .HasColumnType("jsonb") + .HasColumnName("receipt_fee_source"); + + b.Property("ReceiptFeeSummary") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("receipt_fee_summary"); + + b.Property("ReceiptNextEpoch") + .HasColumnType("jsonb") + .HasColumnName("receipt_next_epoch"); + + b.Property("ReceiptOutput") + .HasColumnType("jsonb") + .HasColumnName("receipt_output"); + + b.Property("ReceiptStateUpdates") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("receipt_state_updates"); + + b.Property("ReceiptStatus") + .HasColumnType("ledger_transaction_status") + .HasColumnName("receipt_status"); + + b.Property("ReceiptTreeHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("receipt_tree_hash"); + + b.Property("RoundInEpoch") + .HasColumnType("bigint") + .HasColumnName("round_in_epoch"); + + b.Property("RoundTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("round_timestamp"); + + b.Property("StateTreeHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("state_tree_hash"); + + b.Property("TipPaid") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("tip_paid"); + + b.Property("TransactionTreeHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("transaction_tree_hash"); + + b.Property("discriminator") + .HasColumnType("ledger_transaction_type"); + + b.HasKey("StateVersion"); + + b.HasIndex("RoundTimestamp"); + + b.HasIndex("Epoch", "RoundInEpoch") + .IsUnique() + .HasFilter("index_in_round = 0"); + + b.ToTable("ledger_transactions"); + + b.HasDiscriminator("discriminator"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("StateVersion") + .HasColumnType("bigint") + .HasColumnName("state_version"); + + b.Property("discriminator") + .HasColumnType("ledger_transaction_marker_type"); + + b.HasKey("Id"); + + b.HasIndex("StateVersion"); + + b.ToTable("ledger_transaction_markers"); + + b.HasDiscriminator("discriminator"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NetworkConfiguration", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("AddressTypeDefinitions") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("address_type_definitions"); + + b.Property("GenesisEpoch") + .HasColumnType("bigint") + .HasColumnName("genesis_epoch"); + + b.Property("GenesisRound") + .HasColumnType("bigint") + .HasColumnName("genesis_round"); + + b.Property("HrpDefinition") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("hrp_definition"); + + b.Property("NetworkHrpSuffix") + .IsRequired() + .HasColumnType("text") + .HasColumnName("network_hrp_suffix"); + + b.Property("NetworkId") + .HasColumnType("smallint") + .HasColumnName("network_id"); + + b.Property("NetworkName") + .IsRequired() + .HasColumnType("text") + .HasColumnName("network_name"); + + b.Property("WellKnownAddresses") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("well_known_addresses"); + + b.HasKey("Id"); + + b.ToTable("network_configuration"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("NonFungibleId") + .IsRequired() + .HasColumnType("text") + .HasColumnName("non_fungible_id"); + + b.Property("NonFungibleResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("non_fungible_resource_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("NonFungibleResourceEntityId", "FromStateVersion"); + + b.HasIndex("NonFungibleResourceEntityId", "NonFungibleId", "FromStateVersion") + .IsUnique(); + + b.ToTable("non_fungible_id_data"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdDataHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Data") + .HasColumnType("bytea") + .HasColumnName("data"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted"); + + b.Property("IsLocked") + .HasColumnType("boolean") + .HasColumnName("is_locked"); + + b.Property("NonFungibleIdDataId") + .HasColumnType("bigint") + .HasColumnName("non_fungible_id_data_id"); + + b.HasKey("Id"); + + b.HasIndex("NonFungibleIdDataId", "FromStateVersion"); + + b.ToTable("non_fungible_id_data_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdLocationHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("NonFungibleIdDataId") + .HasColumnType("bigint") + .HasColumnName("non_fungible_id_data_id"); + + b.Property("VaultEntityId") + .HasColumnType("bigint") + .HasColumnName("vault_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("NonFungibleIdDataId", "FromStateVersion"); + + b.ToTable("non_fungible_id_location_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdStoreHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property>("NonFungibleIdDataIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("non_fungible_id_data_ids"); + + b.Property("NonFungibleResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("non_fungible_resource_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("NonFungibleResourceEntityId", "FromStateVersion"); + + b.ToTable("non_fungible_id_store_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleSchemaHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.Property("SborTypeKind") + .HasColumnType("sbor_type_kind") + .HasColumnName("sbor_type_kind"); + + b.Property("SchemaDefiningEntityId") + .HasColumnType("bigint") + .HasColumnName("schema_defining_entity_id"); + + b.Property("SchemaHash") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("schema_hash"); + + b.Property("TypeIndex") + .HasColumnType("bigint") + .HasColumnName("type_index"); + + b.HasKey("Id"); + + b.HasIndex("ResourceEntityId", "FromStateVersion"); + + b.ToTable("non_fungible_schema_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageBlueprintAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property>("PackageBlueprintIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("package_blueprint_ids"); + + b.Property("PackageEntityId") + .HasColumnType("bigint") + .HasColumnName("package_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("PackageEntityId", "FromStateVersion"); + + b.ToTable("package_blueprint_aggregate_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageBlueprintHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AuthTemplate") + .HasColumnType("jsonb") + .HasColumnName("auth_template"); + + b.Property("AuthTemplateIsLocked") + .HasColumnType("boolean") + .HasColumnName("auth_template_is_locked"); + + b.Property("Definition") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("definition"); + + b.Property>("DependantEntityIds") + .HasColumnType("bigint[]") + .HasColumnName("dependant_entity_ids"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("PackageEntityId") + .HasColumnType("bigint") + .HasColumnName("package_entity_id"); + + b.Property("RoyaltyConfig") + .HasColumnType("jsonb") + .HasColumnName("royalty_config"); + + b.Property("RoyaltyConfigIsLocked") + .HasColumnType("boolean") + .HasColumnName("royalty_config_is_locked"); + + b.Property("Version") + .IsRequired() + .HasColumnType("text") + .HasColumnName("version"); + + b.HasKey("Id"); + + b.HasIndex("PackageEntityId", "FromStateVersion"); + + b.HasIndex("PackageEntityId", "Name", "Version", "FromStateVersion"); + + b.ToTable("package_blueprint_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageCodeHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Code") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("code"); + + b.Property("CodeHash") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("code_hash"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("PackageEntityId") + .HasColumnType("bigint") + .HasColumnName("package_entity_id"); + + b.Property("VmType") + .HasColumnType("package_vm_type") + .HasColumnName("vm_type"); + + b.HasKey("Id"); + + b.HasIndex("PackageEntityId", "FromStateVersion"); + + b.ToTable("package_code_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EndEpochExclusive") + .HasColumnType("numeric(20,0)") + .HasColumnName("end_epoch_exclusive"); + + b.Property("IntentHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("intent_hash"); + + b.Property("PayloadHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("payload_hash"); + + b.Property("PayloadId") + .HasColumnType("bigint") + .HasColumnName("payload_id"); + + b.Property("VersionControl") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.HasKey("Id"); + + b.HasIndex("IntentHash"); + + b.HasIndex("PayloadHash") + .IsUnique(); + + b.ToTable("pending_transactions"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionPayload", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("NotarizedTransactionBlob") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("notarized_transaction_blob"); + + b.Property("PendingTransactionId") + .HasColumnType("bigint") + .HasColumnName("pending_transaction_id"); + + b.HasKey("Id"); + + b.HasIndex("PendingTransactionId") + .IsUnique(); + + b.ToTable("pending_transaction_payloads"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ResourceEntitySupplyHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.Property("TotalBurned") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("total_burned"); + + b.Property("TotalMinted") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("total_minted"); + + b.Property("TotalSupply") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("total_supply"); + + b.HasKey("Id"); + + b.HasIndex("ResourceEntityId", "FromStateVersion"); + + b.ToTable("resource_entity_supply_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.SchemaHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("Schema") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("schema"); + + b.Property("SchemaHash") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("schema_hash"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.HasIndex("SchemaHash", "FromStateVersion"); + + b.ToTable("schema_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.StateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("discriminator") + .HasColumnType("state_type"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.ToTable("state_history"); + + b.HasDiscriminator("discriminator"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorActiveSetHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Epoch") + .HasColumnType("bigint") + .HasColumnName("epoch"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("Stake") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("stake"); + + b.Property("ValidatorPublicKeyHistoryId") + .HasColumnType("bigint") + .HasColumnName("validator_public_key_history_id"); + + b.HasKey("Id"); + + b.HasIndex("Epoch"); + + b.HasIndex("FromStateVersion"); + + b.HasIndex("ValidatorPublicKeyHistoryId"); + + b.ToTable("validator_active_set_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorEmissionStatistics", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EpochNumber") + .HasColumnType("bigint") + .HasColumnName("epoch_number"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("ProposalsMade") + .HasColumnType("bigint") + .HasColumnName("proposals_made"); + + b.Property("ProposalsMissed") + .HasColumnType("bigint") + .HasColumnName("proposals_missed"); + + b.Property("ValidatorEntityId") + .HasColumnType("bigint") + .HasColumnName("validator_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("ValidatorEntityId", "EpochNumber"); + + b.ToTable("validator_emission_statistics"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorPublicKeyHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("Key") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("key"); + + b.Property("KeyType") + .HasColumnType("public_key_type") + .HasColumnName("key_type"); + + b.Property("ValidatorEntityId") + .HasColumnType("bigint") + .HasColumnName("validator_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("ValidatorEntityId", "FromStateVersion"); + + b.HasIndex("ValidatorEntityId", "KeyType", "Key"); + + b.ToTable("validator_public_key_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalAccessControllerEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalAccessController); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalAccountEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalAccountComponent); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalConsensusManager", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalConsensusManager); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalFungibleResourceEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("Divisibility") + .HasColumnType("integer") + .HasColumnName("divisibility"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalFungibleResource); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalGenericComponentEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalGenericComponent); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalIdentityEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalIdentity); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalMultiResourcePoolEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalMultiResourcePool); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalNonFungibleResourceEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("NonFungibleIdType") + .HasColumnType("non_fungible_id_type") + .HasColumnName("non_fungible_id_type"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalNonFungibleResource); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalOneResourcePoolEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalOneResourcePool); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalPackageEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalPackage); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalTransactionTrackerEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalTransactionTracker); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalTwoResourcePoolEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalTwoResourcePool); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalValidatorEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("LockedOwnerStakeUnitVault") + .HasColumnType("bigint") + .HasColumnName("locked_owner_stake_unit_vault_entity_id"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.Property("PendingOwnerStakeUnitUnlockVault") + .HasColumnType("bigint") + .HasColumnName("pending_owner_stake_unit_unlock_vault_entity_id"); + + b.Property("PendingXrdWithdrawVault") + .HasColumnType("bigint") + .HasColumnName("pending_xrd_withdraw_vault_entity_id"); + + b.Property("StakeVaultEntityId") + .HasColumnType("bigint") + .HasColumnName("stake_vault_entity_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalValidator); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalFungibleVaultEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.Property("ResourceEntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.Property("RoyaltyVaultOfEntityId") + .HasColumnType("bigint") + .HasColumnName("royalty_vault_of_entity_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.InternalFungibleVault); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalGenericComponentEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.InternalGenericComponent); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalKeyValueStoreEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.InternalKeyValueStore); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalNonFungibleVaultEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.Property("ResourceEntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.InternalNonFungibleVault); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityFungibleResourceAggregatedVaultsHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregatedVaultsHistory"); + + b.Property("Balance") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("balance"); + + b.ToTable("entity_resource_aggregated_vaults_history"); + + b.HasDiscriminator().HasValue(ResourceType.Fungible); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityNonFungibleResourceAggregatedVaultsHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregatedVaultsHistory"); + + b.Property("TotalCount") + .HasColumnType("bigint") + .HasColumnName("total_count"); + + b.ToTable("entity_resource_aggregated_vaults_history"); + + b.HasDiscriminator().HasValue(ResourceType.NonFungible); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityFungibleVaultHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityVaultHistory"); + + b.Property("Balance") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("balance"); + + b.Property("IsRoyaltyVault") + .HasColumnType("boolean") + .HasColumnName("is_royalty_vault"); + + b.ToTable("entity_vault_history"); + + b.HasDiscriminator().HasValue(ResourceType.Fungible); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityNonFungibleVaultHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityVaultHistory"); + + b.Property>("NonFungibleIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("non_fungible_ids"); + + b.ToTable("entity_vault_history"); + + b.HasDiscriminator().HasValue(ResourceType.NonFungible); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.FlashLedgerTransaction", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); + + b.ToTable("ledger_transactions"); + + b.HasDiscriminator().HasValue(LedgerTransactionType.Flash); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GenesisLedgerTransaction", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); + + b.ToTable("ledger_transactions"); + + b.HasDiscriminator().HasValue(LedgerTransactionType.Genesis); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.RoundUpdateLedgerTransaction", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); + + b.ToTable("ledger_transactions"); + + b.HasDiscriminator().HasValue(LedgerTransactionType.RoundUpdate); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.UserLedgerTransaction", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); + + b.Property("IntentHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("intent_hash"); + + b.Property("Message") + .HasColumnType("jsonb") + .HasColumnName("message"); + + b.Property("PayloadHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("payload_hash"); + + b.Property("RawPayload") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("raw_payload"); + + b.Property("SignedIntentHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("signed_intent_hash"); + + b.HasIndex("IntentHash") + .HasFilter("intent_hash IS NOT NULL"); + + NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("IntentHash"), "hash"); + + b.ToTable("ledger_transactions"); + + b.HasDiscriminator().HasValue(LedgerTransactionType.User); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AffectedGlobalEntityTransactionMarker", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); + + b.Property("EntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.HasIndex("EntityId", "StateVersion") + .HasFilter("discriminator = 'affected_global_entity'"); + + b.ToTable("ledger_transaction_markers"); + + b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.AffectedGlobalEntity); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EventLedgerTransactionMarker", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); + + b.Property("EntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("EventType") + .HasColumnType("ledger_transaction_marker_event_type") + .HasColumnName("event_type"); + + b.Property("Quantity") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("quantity"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.HasIndex("EventType", "EntityId", "StateVersion") + .HasFilter("discriminator = 'event'"); + + b.ToTable("ledger_transaction_markers"); + + b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.Event); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ManifestAddressLedgerTransactionMarker", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); + + b.Property("EntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("OperationType") + .HasColumnType("ledger_transaction_marker_operation_type") + .HasColumnName("operation_type"); + + b.HasIndex("OperationType", "EntityId", "StateVersion") + .HasFilter("discriminator = 'manifest_address'"); + + b.ToTable("ledger_transaction_markers"); + + b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.ManifestAddress); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.OriginLedgerTransactionMarker", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); + + b.Property("OriginType") + .HasColumnType("ledger_transaction_marker_origin_type") + .HasColumnName("origin_type"); + + b.HasIndex("OriginType", "StateVersion") + .HasFilter("discriminator = 'origin'"); + + b.ToTable("ledger_transaction_markers"); + + b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.Origin); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.JsonStateHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.StateHistory"); + + b.Property("JsonState") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("json_state"); + + b.ToTable("state_history"); + + b.HasDiscriminator().HasValue(StateType.Json); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.SborStateHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.StateHistory"); + + b.Property("SborState") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("sbor_state"); + + b.Property("SborTypeKind") + .HasColumnType("sbor_type_kind") + .HasColumnName("sbor_type_kind"); + + b.Property("SchemaDefiningEntityId") + .HasColumnType("bigint") + .HasColumnName("schema_defining_entity_id"); + + b.Property("SchemaHash") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("schema_hash"); + + b.Property("TypeIndex") + .HasColumnType("bigint") + .HasColumnName("type_index"); + + b.ToTable("state_history"); + + b.HasDiscriminator().HasValue(StateType.Sbor); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", b => + { + b.OwnsOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionGatewayHandling", "GatewayHandling", b1 => + { + b1.Property("PendingTransactionId") + .HasColumnType("bigint"); + + b1.Property("AttemptedSubmissionToNodesCount") + .HasColumnType("integer") + .HasColumnName("node_submission_count"); + + b1.Property("FirstSubmittedToGatewayTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("first_submitted_to_gateway_timestamp"); + + b1.Property("HandlingStatusReason") + .HasColumnType("text") + .HasColumnName("handling_status_reason"); + + b1.Property("ResubmitFromTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("resubmit_from_timestamp"); + + b1.HasKey("PendingTransactionId"); + + b1.HasIndex("FirstSubmittedToGatewayTimestamp"); + + b1.HasIndex("ResubmitFromTimestamp"); + + b1.ToTable("pending_transactions"); + + b1.WithOwner() + .HasForeignKey("PendingTransactionId"); + }); + + b.OwnsOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionLedgerDetails", "LedgerDetails", b1 => + { + b1.Property("PendingTransactionId") + .HasColumnType("bigint"); + + b1.Property("CommitTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("commit_timestamp"); + + b1.Property("InitialRejectionReason") + .HasColumnType("text") + .HasColumnName("initial_rejection_reason"); + + b1.Property("IntentLedgerStatus") + .HasColumnType("pending_transaction_intent_ledger_status") + .HasColumnName("intent_status"); + + b1.Property("LatestRejectionReason") + .HasColumnType("text") + .HasColumnName("latest_rejection_reason"); + + b1.Property("LatestRejectionTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("latest_rejection_timestamp"); + + b1.Property("PayloadLedgerStatus") + .HasColumnType("pending_transaction_payload_ledger_status") + .HasColumnName("payload_status"); + + b1.HasKey("PendingTransactionId"); + + b1.ToTable("pending_transactions"); + + b1.WithOwner() + .HasForeignKey("PendingTransactionId"); + }); + + b.OwnsOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionNetworkDetails", "NetworkDetails", b1 => + { + b1.Property("PendingTransactionId") + .HasColumnType("bigint"); + + b1.Property("LastSubmitErrorTitle") + .HasColumnType("text") + .HasColumnName("last_submit_error"); + + b1.Property("LatestNodeSubmissionTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("latest_node_submission_timestamp"); + + b1.Property("LatestNodeSubmissionWasAccepted") + .HasColumnType("boolean") + .HasColumnName("latest_node_submission_was_accepted"); + + b1.Property("LatestSubmittedToNodeName") + .HasColumnType("text") + .HasColumnName("latest_submitted_to_node_name"); + + b1.HasKey("PendingTransactionId"); + + b1.ToTable("pending_transactions"); + + b1.WithOwner() + .HasForeignKey("PendingTransactionId"); + }); + + b.Navigation("GatewayHandling") + .IsRequired(); + + b.Navigation("LedgerDetails") + .IsRequired(); + + b.Navigation("NetworkDetails") + .IsRequired(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionPayload", b => + { + b.HasOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", "PendingTransaction") + .WithOne("Payload") + .HasForeignKey("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionPayload", "PendingTransactionId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("PendingTransaction"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorActiveSetHistory", b => + { + b.HasOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorPublicKeyHistory", "PublicKey") + .WithMany() + .HasForeignKey("ValidatorPublicKeyHistoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PublicKey"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", b => + { + b.Navigation("Payload"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117093225_AddBlueprintHistoryAggregateTable.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117093225_AddBlueprintHistoryAggregateTable.cs new file mode 100644 index 000000000..6fb3750dd --- /dev/null +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117093225_AddBlueprintHistoryAggregateTable.cs @@ -0,0 +1,113 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace RadixDlt.NetworkGateway.PostgresIntegration.Migrations +{ + /// + public partial class AddBlueprintHistoryAggregateTable : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "package_blueprint_aggregate_history", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + from_state_version = table.Column(type: "bigint", nullable: false), + package_entity_id = table.Column(type: "bigint", nullable: false), + package_blueprint_ids = table.Column>(type: "bigint[]", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_package_blueprint_aggregate_history", x => x.id); + }); + + migrationBuilder.CreateIndex( + name: "IX_package_blueprint_aggregate_history_package_entity_id_from_~", + table: "package_blueprint_aggregate_history", + columns: new[] { "package_entity_id", "from_state_version" }); + + migrationBuilder.Sql(@" +INSERT INTO package_blueprint_aggregate_history (from_state_version, package_entity_id, package_blueprint_ids) +SELECT MIN(from_state_version) from_state_version, package_entity_id, array_agg(id order by id asc) package_blueprint_ids +FROM package_blueprint_history +GROUP BY package_entity_id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "package_blueprint_aggregate_history"); + } + } +} diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql index 8866bedd2..0e5ed5d6f 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql @@ -1119,14 +1119,21 @@ START TRANSACTION; DO $EF$ BEGIN IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240116140418_MoveVmTypeToCodeHistoryTable') THEN - ALTER TABLE entities DROP COLUMN vm_type; + ALTER TABLE package_code_history ADD vm_type package_vm_type NOT NULL DEFAULT 'native'::package_vm_type; END IF; END $EF$; DO $EF$ BEGIN IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240116140418_MoveVmTypeToCodeHistoryTable') THEN - ALTER TABLE package_code_history ADD vm_type package_vm_type NOT NULL DEFAULT 'native'::package_vm_type; + update package_code_history pch set vm_type = (select vm_type from entities e where e.id = pch.package_entity_id) + END IF; +END $EF$; + +DO $EF$ +BEGIN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240116140418_MoveVmTypeToCodeHistoryTable') THEN + ALTER TABLE entities DROP COLUMN vm_type; END IF; END $EF$; @@ -1139,3 +1146,35 @@ BEGIN END $EF$; COMMIT; +START TRANSACTION; + + +DO $EF$ +BEGIN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240117093225_AddBlueprintHistoryAggregateTable') THEN + CREATE TABLE package_blueprint_aggregate_history ( + id bigint GENERATED BY DEFAULT AS IDENTITY, + from_state_version bigint NOT NULL, + package_entity_id bigint NOT NULL, + package_blueprint_ids bigint[] NOT NULL, + CONSTRAINT "PK_package_blueprint_aggregate_history" PRIMARY KEY (id) + ); + END IF; +END $EF$; + +DO $EF$ +BEGIN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240117093225_AddBlueprintHistoryAggregateTable') THEN + CREATE INDEX "IX_package_blueprint_aggregate_history_package_entity_id_from_~" ON package_blueprint_aggregate_history (package_entity_id, from_state_version); + END IF; +END $EF$; + +DO $EF$ +BEGIN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240117093225_AddBlueprintHistoryAggregateTable') THEN + INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") + VALUES ('20240117093225_AddBlueprintHistoryAggregateTable', '7.0.11'); + END IF; +END $EF$; +COMMIT; + diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs index aaae6bb9a..c6c15ee2c 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs @@ -1114,6 +1114,35 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("non_fungible_schema_history"); }); + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageBlueprintAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property>("PackageBlueprintIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("package_blueprint_ids"); + + b.Property("PackageEntityId") + .HasColumnType("bigint") + .HasColumnName("package_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("PackageEntityId", "FromStateVersion"); + + b.ToTable("package_blueprint_aggregate_history"); + }); + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageBlueprintHistory", b => { b.Property("Id") diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/PackageBlueprintAggregateHistory.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/PackageBlueprintAggregateHistory.cs new file mode 100644 index 000000000..a6539e7d2 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/PackageBlueprintAggregateHistory.cs @@ -0,0 +1,86 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace RadixDlt.NetworkGateway.PostgresIntegration.Models; + +[Table("package_blueprint_aggregate_history")] +internal class PackageBlueprintAggregateHistory +{ + [Key] + [Column("id")] + public long Id { get; set; } + + [Column("from_state_version")] + public long FromStateVersion { get; set; } + + [Column("package_entity_id")] + public long PackageEntityId { get; set; } + + [Column("package_blueprint_ids")] + public List PackageBlueprintIds { get; set; } +} diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/BlueprintProvider.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/BlueprintProvider.cs index 56a587bbe..fed6859a6 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/BlueprintProvider.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/BlueprintProvider.cs @@ -102,11 +102,34 @@ public async Task> GetPackageBluepr return new Dictionary(); } - // should return all the blueprint history entries (no LIMIT 1 in nested query) as blueprints cannot be deleted - return (await _dbContext .PackageBlueprintHistory .FromSqlInterpolated($@" -WITH variables (entity_id) AS (SELECT UNNEST({packageEntityIds})) +WITH variables (package_entity_id) AS (SELECT UNNEST({packageEntityIds})), +most_recent_package_blueprints AS +( + SELECT + package_blueprint_ids + FROM variables var + INNER JOIN LATERAL ( + SELECT * + FROM package_blueprint_aggregate_history + WHERE from_state_version <= {ledgerState.StateVersion} AND package_entity_id = var.package_entity_id + ORDER BY from_state_version DESC + LIMIT 1 + ) pbah ON TRUE +) SELECT pbh.* -FROM variables -INNER JOIN LATERAL( - SELECT * - FROM package_blueprint_history - WHERE package_entity_id = variables.entity_id AND from_state_version <= {ledgerState.StateVersion} - ORDER BY from_state_version DESC -) pbh ON true") +FROM most_recent_package_blueprints mrpb +INNER JOIN package_blueprint_history pbh +ON pbh.id = ANY(mrpb.package_blueprint_ids) +ORDER BY array_position(mrpb.package_blueprint_ids, pbh.id) +") .AnnotateMetricName() .ToListAsync(token)) .GroupBy(b => b.PackageEntityId) diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/ValidatorQuerier.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/ValidatorQuerier.cs index c69bd782f..9afaa8dd6 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/ValidatorQuerier.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/ValidatorQuerier.cs @@ -71,7 +71,6 @@ using System.Threading; using System.Threading.Tasks; using GatewayModel = RadixDlt.NetworkGateway.GatewayApiSdk.Model; -using ToolkitModel = RadixEngineToolkit; namespace RadixDlt.NetworkGateway.PostgresIntegration.Services; From 034fbb72c573cf65f88bab1c326bdca32ea7c071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Pawelec?= Date: Wed, 17 Jan 2024 16:56:23 +0100 Subject: [PATCH 08/19] add support to multiple codes per package. --- CHANGELOG.md | 3 + .../gateway-api-schema.yaml | 25 + .../Model/PackageCodeCollectionItem.cs | 217 ++ .../Model/StateEntityDetailsRequest.cs | 5 +- .../Model/StateEntityDetailsRequestAllOf.cs | 5 +- ...tateEntityDetailsResponsePackageDetails.cs | 22 +- ...ntityDetailsResponsePackageDetailsAllOf.cs | 20 +- ...ilsResponsePackageDetailsCodeCollection.cs | 232 ++ ...sponsePackageDetailsCodeCollectionAllOf.cs | 194 ++ .../Model/StateKeyValueStoreDataRequest.cs | 5 +- .../StateKeyValueStoreDataRequestAllOf.cs | 5 +- .../Model/StateNonFungibleDataRequest.cs | 5 +- .../Model/StateNonFungibleLocationRequest.cs | 5 +- .../StateNonFungibleLocationRequestAllOf.cs | 5 +- .../CommonDbContext.cs | 6 + .../LedgerExtension/PackageCodeAggregator.cs | 185 ++ .../PostgresLedgerExtenderService.cs | 44 +- .../LedgerExtension/ReadHelper.cs | 85 +- .../LedgerExtension/Records.cs | 2 +- .../LedgerExtension/SequencesHolder.cs | 2 + .../LedgerExtension/WriteHelper.cs | 31 +- ...ckageCodeAggregateHistoryTable.Designer.cs | 2415 +++++++++++++++++ ...350_AddPackageCodeAggregateHistoryTable.cs | 113 + .../Migrations/IdempotentApplyMigrations.sql | 54 + .../MigrationsDbContextModelSnapshot.cs | 29 + .../Models/PackageCodeAggregateHistory.cs | 86 + .../Services/EntityStateQuerier.cs | 66 +- 27 files changed, 3800 insertions(+), 66 deletions(-) create mode 100644 src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/PackageCodeCollectionItem.cs create mode 100644 src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetailsCodeCollection.cs create mode 100644 src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetailsCodeCollectionAllOf.cs create mode 100644 src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageCodeAggregator.cs create mode 100644 src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117153350_AddPackageCodeAggregateHistoryTable.Designer.cs create mode 100644 src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117153350_AddPackageCodeAggregateHistoryTable.cs create mode 100644 src/RadixDlt.NetworkGateway.PostgresIntegration/Models/PackageCodeAggregateHistory.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d9265115..1440a55e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ Release Date: _unreleased_ - add support for new transaction types (flash transactions) that are gonna occur on protocol update. - move vm_type to `package_code_history` table from package in `entity` table. +- fix and return `vm_type`, `code_hash_hex` and `code_hex` as collection (it's allowed to have multiple codes per package). previous properties will return empty strings to keep contract compatibility. +- create new `package_blueprint_aggregate_history` table which will hold pointers to all current package blueprints. +- create new `package_code_aggregate_history` table which will hold pointers to all current package codes. ## 1.2.4 Release Date: 4.01.2024 diff --git a/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml b/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml index 3ddf0e652..5ee437346 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml +++ b/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml @@ -3104,15 +3104,20 @@ components: $ref: "#/components/schemas/Address" balance: $ref: "#/components/schemas/NonFungibleResourcesCollectionItemVaultAggregatedVaultItem" + StateEntityDetailsResponsePackageDetails: + description: "vm_type, code_hash_hex and code_hex are always going to be empty, use `codes` property which will return code collection" allOf: - $ref: "#/components/schemas/StateEntityDetailsResponseItemDetails" - type: object required: + - code_items - vm_type - code_hash_hex - code_hex properties: + codes: + $ref: "#/components/schemas/StateEntityDetailsResponsePackageDetailsCodeCollection" vm_type: $ref: "#/components/schemas/PackageVmType" code_hash_hex: @@ -3125,6 +3130,26 @@ components: $ref: "#/components/schemas/StateEntityDetailsResponsePackageDetailsBlueprintCollection" schemas: $ref: "#/components/schemas/StateEntityDetailsResponsePackageDetailsSchemaCollection" + StateEntityDetailsResponsePackageDetailsCodeCollection: + allOf: + - $ref: "#/components/schemas/ResultSetCursorMixin" + - type: object + required: + - items + properties: + items: + type: array + items: + $ref: "#/components/schemas/PackageCodeCollectionItem" + PackageCodeCollectionItem: + type: object + properties: + vm_type: + $ref: "#/components/schemas/PackageVmType" + code_hash_hex: + $ref: "#/components/schemas/HexString" + code_hex: + $ref: "#/components/schemas/HexString" StateEntityDetailsResponsePackageDetailsBlueprintCollection: allOf: - $ref: "#/components/schemas/ResultSetCursorMixin" diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/PackageCodeCollectionItem.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/PackageCodeCollectionItem.cs new file mode 100644 index 000000000..a61f3a70f --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/PackageCodeCollectionItem.cs @@ -0,0 +1,217 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Gateway API - Babylon + * + * This API is exposed by the Babylon Radix Gateway to enable clients to efficiently query current and historic state on the RadixDLT ledger, and intelligently handle transaction submission. It is designed for use by wallets and explorers, and for light queries from front-end dApps. For exchange/asset integrations, back-end dApp integrations, or simple use cases, you should consider using the Core API on a Node. A Gateway is only needed for reading historic snapshots of ledger states or a more robust set-up. The Gateway API is implemented by the [Network Gateway](https://github.com/radixdlt/babylon-gateway), which is configured to read from [full node(s)](https://github.com/radixdlt/babylon-node) to extract and index data from the network. This document is an API reference documentation, visit [User Guide](https://docs.radixdlt.com/) to learn more about how to run a Gateway of your own. ## Migration guide Please see [the latest release notes](https://github.com/radixdlt/babylon-gateway/releases). ## Integration and forward compatibility guarantees All responses may have additional fields added at any release, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. When the Radix protocol is updated, new functionality may be added, and so discriminated unions returned by the API may need to be updated to have new variants added, corresponding to the updated data. Clients may need to update in advance to be able to handle these new variants when a protocol update comes out. On the very rare occasions we need to make breaking changes to the API, these will be warned in advance with deprecation notices on previous versions. These deprecation notices will include a safe migration path. Deprecation notes or breaking changes will be flagged clearly in release notes for new versions of the Gateway. The Gateway DB schema is not subject to any compatibility guarantees, and may be changed at any release. DB changes will be flagged in the release notes so clients doing custom DB integrations can prepare. + * + * The version of the OpenAPI document: v1.2.2 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model +{ + /// + /// PackageCodeCollectionItem + /// + [DataContract(Name = "PackageCodeCollectionItem")] + public partial class PackageCodeCollectionItem : IEquatable + { + + /// + /// Gets or Sets VmType + /// + [DataMember(Name = "vm_type", EmitDefaultValue = true)] + public PackageVmType? VmType { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// vmType. + /// Hex-encoded binary blob.. + /// Hex-encoded binary blob.. + public PackageCodeCollectionItem(PackageVmType? vmType = default(PackageVmType?), string codeHashHex = default(string), string codeHex = default(string)) + { + this.VmType = vmType; + this.CodeHashHex = codeHashHex; + this.CodeHex = codeHex; + } + + /// + /// Hex-encoded binary blob. + /// + /// Hex-encoded binary blob. + [DataMember(Name = "code_hash_hex", EmitDefaultValue = true)] + public string CodeHashHex { get; set; } + + /// + /// Hex-encoded binary blob. + /// + /// Hex-encoded binary blob. + [DataMember(Name = "code_hex", EmitDefaultValue = true)] + public string CodeHex { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PackageCodeCollectionItem {\n"); + sb.Append(" VmType: ").Append(VmType).Append("\n"); + sb.Append(" CodeHashHex: ").Append(CodeHashHex).Append("\n"); + sb.Append(" CodeHex: ").Append(CodeHex).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as PackageCodeCollectionItem); + } + + /// + /// Returns true if PackageCodeCollectionItem instances are equal + /// + /// Instance of PackageCodeCollectionItem to be compared + /// Boolean + public bool Equals(PackageCodeCollectionItem input) + { + if (input == null) + { + return false; + } + return + ( + this.VmType == input.VmType || + this.VmType.Equals(input.VmType) + ) && + ( + this.CodeHashHex == input.CodeHashHex || + (this.CodeHashHex != null && + this.CodeHashHex.Equals(input.CodeHashHex)) + ) && + ( + this.CodeHex == input.CodeHex || + (this.CodeHex != null && + this.CodeHex.Equals(input.CodeHex)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.VmType.GetHashCode(); + if (this.CodeHashHex != null) + { + hashCode = (hashCode * 59) + this.CodeHashHex.GetHashCode(); + } + if (this.CodeHex != null) + { + hashCode = (hashCode * 59) + this.CodeHex.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsRequest.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsRequest.cs index dbd387b8c..400e90d39 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsRequest.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsRequest.cs @@ -111,7 +111,7 @@ protected StateEntityDetailsRequest() { } /// /// atLedgerState. /// optIns. - /// addresses (required). + /// limited to max 100 items. (required). /// aggregationLevel. public StateEntityDetailsRequest(LedgerStateSelector atLedgerState = default(LedgerStateSelector), StateEntityDetailsOptIns optIns = default(StateEntityDetailsOptIns), List addresses = default(List), ResourceAggregationLevel? aggregationLevel = default(ResourceAggregationLevel?)) { @@ -139,8 +139,9 @@ protected StateEntityDetailsRequest() { } public StateEntityDetailsOptIns OptIns { get; set; } /// - /// Gets or Sets Addresses + /// limited to max 100 items. /// + /// limited to max 100 items. [DataMember(Name = "addresses", IsRequired = true, EmitDefaultValue = true)] public List Addresses { get; set; } diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsRequestAllOf.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsRequestAllOf.cs index 434bb6a57..3d8aca8d0 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsRequestAllOf.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsRequestAllOf.cs @@ -110,7 +110,7 @@ protected StateEntityDetailsRequestAllOf() { } /// Initializes a new instance of the class. /// /// optIns. - /// addresses (required). + /// limited to max 100 items. (required). /// aggregationLevel. public StateEntityDetailsRequestAllOf(StateEntityDetailsOptIns optIns = default(StateEntityDetailsOptIns), List addresses = default(List), ResourceAggregationLevel? aggregationLevel = default(ResourceAggregationLevel?)) { @@ -131,8 +131,9 @@ protected StateEntityDetailsRequestAllOf() { } public StateEntityDetailsOptIns OptIns { get; set; } /// - /// Gets or Sets Addresses + /// limited to max 100 items. /// + /// limited to max 100 items. [DataMember(Name = "addresses", IsRequired = true, EmitDefaultValue = true)] public List Addresses { get; set; } diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetails.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetails.cs index 8f1524f27..921a43873 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetails.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetails.cs @@ -91,7 +91,7 @@ namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model { /// - /// StateEntityDetailsResponsePackageDetails + /// vm_type, code_hash_hex and code_hex are always going to be empty, use `codes` property which will return code collection /// [DataContract(Name = "StateEntityDetailsResponsePackageDetails")] [JsonConverter(typeof(JsonSubtypes), "type")] @@ -117,6 +117,7 @@ protected StateEntityDetailsResponsePackageDetails() { } /// /// Initializes a new instance of the class. /// + /// codes. /// vmType (required). /// Hex-encoded binary blob. (required). /// Hex-encoded binary blob. (required). @@ -124,7 +125,7 @@ protected StateEntityDetailsResponsePackageDetails() { } /// blueprints. /// schemas. /// type (required) (default to StateEntityDetailsResponseItemDetailsType.Package). - public StateEntityDetailsResponsePackageDetails(PackageVmType vmType = default(PackageVmType), string codeHashHex = default(string), string codeHex = default(string), string royaltyVaultBalance = default(string), StateEntityDetailsResponsePackageDetailsBlueprintCollection blueprints = default(StateEntityDetailsResponsePackageDetailsBlueprintCollection), StateEntityDetailsResponsePackageDetailsSchemaCollection schemas = default(StateEntityDetailsResponsePackageDetailsSchemaCollection), StateEntityDetailsResponseItemDetailsType type = StateEntityDetailsResponseItemDetailsType.Package) : base(type) + public StateEntityDetailsResponsePackageDetails(StateEntityDetailsResponsePackageDetailsCodeCollection codes = default(StateEntityDetailsResponsePackageDetailsCodeCollection), PackageVmType vmType = default(PackageVmType), string codeHashHex = default(string), string codeHex = default(string), string royaltyVaultBalance = default(string), StateEntityDetailsResponsePackageDetailsBlueprintCollection blueprints = default(StateEntityDetailsResponsePackageDetailsBlueprintCollection), StateEntityDetailsResponsePackageDetailsSchemaCollection schemas = default(StateEntityDetailsResponsePackageDetailsSchemaCollection), StateEntityDetailsResponseItemDetailsType type = StateEntityDetailsResponseItemDetailsType.Package) : base(type) { this.VmType = vmType; // to ensure "codeHashHex" is required (not null) @@ -139,11 +140,18 @@ protected StateEntityDetailsResponsePackageDetails() { } throw new ArgumentNullException("codeHex is a required property for StateEntityDetailsResponsePackageDetails and cannot be null"); } this.CodeHex = codeHex; + this.Codes = codes; this.RoyaltyVaultBalance = royaltyVaultBalance; this.Blueprints = blueprints; this.Schemas = schemas; } + /// + /// Gets or Sets Codes + /// + [DataMember(Name = "codes", EmitDefaultValue = true)] + public StateEntityDetailsResponsePackageDetailsCodeCollection Codes { get; set; } + /// /// Hex-encoded binary blob. /// @@ -186,6 +194,7 @@ public override string ToString() StringBuilder sb = new StringBuilder(); sb.Append("class StateEntityDetailsResponsePackageDetails {\n"); sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" Codes: ").Append(Codes).Append("\n"); sb.Append(" VmType: ").Append(VmType).Append("\n"); sb.Append(" CodeHashHex: ").Append(CodeHashHex).Append("\n"); sb.Append(" CodeHex: ").Append(CodeHex).Append("\n"); @@ -227,6 +236,11 @@ public bool Equals(StateEntityDetailsResponsePackageDetails input) return false; } return base.Equals(input) && + ( + this.Codes == input.Codes || + (this.Codes != null && + this.Codes.Equals(input.Codes)) + ) && base.Equals(input) && ( this.VmType == input.VmType || this.VmType.Equals(input.VmType) @@ -267,6 +281,10 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = base.GetHashCode(); + if (this.Codes != null) + { + hashCode = (hashCode * 59) + this.Codes.GetHashCode(); + } hashCode = (hashCode * 59) + this.VmType.GetHashCode(); if (this.CodeHashHex != null) { diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetailsAllOf.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetailsAllOf.cs index 9baf61d3c..4f5e2db6f 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetailsAllOf.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetailsAllOf.cs @@ -109,13 +109,14 @@ protected StateEntityDetailsResponsePackageDetailsAllOf() { } /// /// Initializes a new instance of the class. /// + /// codes. /// vmType (required). /// Hex-encoded binary blob. (required). /// Hex-encoded binary blob. (required). /// String-encoded decimal representing the amount of a related fungible resource.. /// blueprints. /// schemas. - public StateEntityDetailsResponsePackageDetailsAllOf(PackageVmType vmType = default(PackageVmType), string codeHashHex = default(string), string codeHex = default(string), string royaltyVaultBalance = default(string), StateEntityDetailsResponsePackageDetailsBlueprintCollection blueprints = default(StateEntityDetailsResponsePackageDetailsBlueprintCollection), StateEntityDetailsResponsePackageDetailsSchemaCollection schemas = default(StateEntityDetailsResponsePackageDetailsSchemaCollection)) + public StateEntityDetailsResponsePackageDetailsAllOf(StateEntityDetailsResponsePackageDetailsCodeCollection codes = default(StateEntityDetailsResponsePackageDetailsCodeCollection), PackageVmType vmType = default(PackageVmType), string codeHashHex = default(string), string codeHex = default(string), string royaltyVaultBalance = default(string), StateEntityDetailsResponsePackageDetailsBlueprintCollection blueprints = default(StateEntityDetailsResponsePackageDetailsBlueprintCollection), StateEntityDetailsResponsePackageDetailsSchemaCollection schemas = default(StateEntityDetailsResponsePackageDetailsSchemaCollection)) { this.VmType = vmType; // to ensure "codeHashHex" is required (not null) @@ -130,11 +131,18 @@ protected StateEntityDetailsResponsePackageDetailsAllOf() { } throw new ArgumentNullException("codeHex is a required property for StateEntityDetailsResponsePackageDetailsAllOf and cannot be null"); } this.CodeHex = codeHex; + this.Codes = codes; this.RoyaltyVaultBalance = royaltyVaultBalance; this.Blueprints = blueprints; this.Schemas = schemas; } + /// + /// Gets or Sets Codes + /// + [DataMember(Name = "codes", EmitDefaultValue = true)] + public StateEntityDetailsResponsePackageDetailsCodeCollection Codes { get; set; } + /// /// Hex-encoded binary blob. /// @@ -176,6 +184,7 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class StateEntityDetailsResponsePackageDetailsAllOf {\n"); + sb.Append(" Codes: ").Append(Codes).Append("\n"); sb.Append(" VmType: ").Append(VmType).Append("\n"); sb.Append(" CodeHashHex: ").Append(CodeHashHex).Append("\n"); sb.Append(" CodeHex: ").Append(CodeHex).Append("\n"); @@ -217,6 +226,11 @@ public bool Equals(StateEntityDetailsResponsePackageDetailsAllOf input) return false; } return + ( + this.Codes == input.Codes || + (this.Codes != null && + this.Codes.Equals(input.Codes)) + ) && ( this.VmType == input.VmType || this.VmType.Equals(input.VmType) @@ -257,6 +271,10 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = 41; + if (this.Codes != null) + { + hashCode = (hashCode * 59) + this.Codes.GetHashCode(); + } hashCode = (hashCode * 59) + this.VmType.GetHashCode(); if (this.CodeHashHex != null) { diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetailsCodeCollection.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetailsCodeCollection.cs new file mode 100644 index 000000000..a7c40ae35 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetailsCodeCollection.cs @@ -0,0 +1,232 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Gateway API - Babylon + * + * This API is exposed by the Babylon Radix Gateway to enable clients to efficiently query current and historic state on the RadixDLT ledger, and intelligently handle transaction submission. It is designed for use by wallets and explorers, and for light queries from front-end dApps. For exchange/asset integrations, back-end dApp integrations, or simple use cases, you should consider using the Core API on a Node. A Gateway is only needed for reading historic snapshots of ledger states or a more robust set-up. The Gateway API is implemented by the [Network Gateway](https://github.com/radixdlt/babylon-gateway), which is configured to read from [full node(s)](https://github.com/radixdlt/babylon-node) to extract and index data from the network. This document is an API reference documentation, visit [User Guide](https://docs.radixdlt.com/) to learn more about how to run a Gateway of your own. ## Migration guide Please see [the latest release notes](https://github.com/radixdlt/babylon-gateway/releases). ## Integration and forward compatibility guarantees All responses may have additional fields added at any release, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. When the Radix protocol is updated, new functionality may be added, and so discriminated unions returned by the API may need to be updated to have new variants added, corresponding to the updated data. Clients may need to update in advance to be able to handle these new variants when a protocol update comes out. On the very rare occasions we need to make breaking changes to the API, these will be warned in advance with deprecation notices on previous versions. These deprecation notices will include a safe migration path. Deprecation notes or breaking changes will be flagged clearly in release notes for new versions of the Gateway. The Gateway DB schema is not subject to any compatibility guarantees, and may be changed at any release. DB changes will be flagged in the release notes so clients doing custom DB integrations can prepare. + * + * The version of the OpenAPI document: v1.2.2 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model +{ + /// + /// StateEntityDetailsResponsePackageDetailsCodeCollection + /// + [DataContract(Name = "StateEntityDetailsResponsePackageDetailsCodeCollection")] + public partial class StateEntityDetailsResponsePackageDetailsCodeCollection : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected StateEntityDetailsResponsePackageDetailsCodeCollection() { } + /// + /// Initializes a new instance of the class. + /// + /// Total number of items in underlying collection, fragment of which is available in `items` collection.. + /// If specified, contains a cursor to query next page of the `items` collection.. + /// items (required). + public StateEntityDetailsResponsePackageDetailsCodeCollection(long? totalCount = default(long?), string nextCursor = default(string), List items = default(List)) + { + // to ensure "items" is required (not null) + if (items == null) + { + throw new ArgumentNullException("items is a required property for StateEntityDetailsResponsePackageDetailsCodeCollection and cannot be null"); + } + this.Items = items; + this.TotalCount = totalCount; + this.NextCursor = nextCursor; + } + + /// + /// Total number of items in underlying collection, fragment of which is available in `items` collection. + /// + /// Total number of items in underlying collection, fragment of which is available in `items` collection. + [DataMember(Name = "total_count", EmitDefaultValue = true)] + public long? TotalCount { get; set; } + + /// + /// If specified, contains a cursor to query next page of the `items` collection. + /// + /// If specified, contains a cursor to query next page of the `items` collection. + [DataMember(Name = "next_cursor", EmitDefaultValue = true)] + public string NextCursor { get; set; } + + /// + /// Gets or Sets Items + /// + [DataMember(Name = "items", IsRequired = true, EmitDefaultValue = true)] + public List Items { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class StateEntityDetailsResponsePackageDetailsCodeCollection {\n"); + sb.Append(" TotalCount: ").Append(TotalCount).Append("\n"); + sb.Append(" NextCursor: ").Append(NextCursor).Append("\n"); + sb.Append(" Items: ").Append(Items).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as StateEntityDetailsResponsePackageDetailsCodeCollection); + } + + /// + /// Returns true if StateEntityDetailsResponsePackageDetailsCodeCollection instances are equal + /// + /// Instance of StateEntityDetailsResponsePackageDetailsCodeCollection to be compared + /// Boolean + public bool Equals(StateEntityDetailsResponsePackageDetailsCodeCollection input) + { + if (input == null) + { + return false; + } + return + ( + this.TotalCount == input.TotalCount || + (this.TotalCount != null && + this.TotalCount.Equals(input.TotalCount)) + ) && + ( + this.NextCursor == input.NextCursor || + (this.NextCursor != null && + this.NextCursor.Equals(input.NextCursor)) + ) && + ( + this.Items == input.Items || + this.Items != null && + input.Items != null && + this.Items.SequenceEqual(input.Items) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.TotalCount != null) + { + hashCode = (hashCode * 59) + this.TotalCount.GetHashCode(); + } + if (this.NextCursor != null) + { + hashCode = (hashCode * 59) + this.NextCursor.GetHashCode(); + } + if (this.Items != null) + { + hashCode = (hashCode * 59) + this.Items.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetailsCodeCollectionAllOf.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetailsCodeCollectionAllOf.cs new file mode 100644 index 000000000..dfb28081f --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetailsCodeCollectionAllOf.cs @@ -0,0 +1,194 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Gateway API - Babylon + * + * This API is exposed by the Babylon Radix Gateway to enable clients to efficiently query current and historic state on the RadixDLT ledger, and intelligently handle transaction submission. It is designed for use by wallets and explorers, and for light queries from front-end dApps. For exchange/asset integrations, back-end dApp integrations, or simple use cases, you should consider using the Core API on a Node. A Gateway is only needed for reading historic snapshots of ledger states or a more robust set-up. The Gateway API is implemented by the [Network Gateway](https://github.com/radixdlt/babylon-gateway), which is configured to read from [full node(s)](https://github.com/radixdlt/babylon-node) to extract and index data from the network. This document is an API reference documentation, visit [User Guide](https://docs.radixdlt.com/) to learn more about how to run a Gateway of your own. ## Migration guide Please see [the latest release notes](https://github.com/radixdlt/babylon-gateway/releases). ## Integration and forward compatibility guarantees All responses may have additional fields added at any release, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. When the Radix protocol is updated, new functionality may be added, and so discriminated unions returned by the API may need to be updated to have new variants added, corresponding to the updated data. Clients may need to update in advance to be able to handle these new variants when a protocol update comes out. On the very rare occasions we need to make breaking changes to the API, these will be warned in advance with deprecation notices on previous versions. These deprecation notices will include a safe migration path. Deprecation notes or breaking changes will be flagged clearly in release notes for new versions of the Gateway. The Gateway DB schema is not subject to any compatibility guarantees, and may be changed at any release. DB changes will be flagged in the release notes so clients doing custom DB integrations can prepare. + * + * The version of the OpenAPI document: v1.2.2 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model +{ + /// + /// StateEntityDetailsResponsePackageDetailsCodeCollectionAllOf + /// + [DataContract(Name = "StateEntityDetailsResponsePackageDetailsCodeCollection_allOf")] + public partial class StateEntityDetailsResponsePackageDetailsCodeCollectionAllOf : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected StateEntityDetailsResponsePackageDetailsCodeCollectionAllOf() { } + /// + /// Initializes a new instance of the class. + /// + /// items (required). + public StateEntityDetailsResponsePackageDetailsCodeCollectionAllOf(List items = default(List)) + { + // to ensure "items" is required (not null) + if (items == null) + { + throw new ArgumentNullException("items is a required property for StateEntityDetailsResponsePackageDetailsCodeCollectionAllOf and cannot be null"); + } + this.Items = items; + } + + /// + /// Gets or Sets Items + /// + [DataMember(Name = "items", IsRequired = true, EmitDefaultValue = true)] + public List Items { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class StateEntityDetailsResponsePackageDetailsCodeCollectionAllOf {\n"); + sb.Append(" Items: ").Append(Items).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as StateEntityDetailsResponsePackageDetailsCodeCollectionAllOf); + } + + /// + /// Returns true if StateEntityDetailsResponsePackageDetailsCodeCollectionAllOf instances are equal + /// + /// Instance of StateEntityDetailsResponsePackageDetailsCodeCollectionAllOf to be compared + /// Boolean + public bool Equals(StateEntityDetailsResponsePackageDetailsCodeCollectionAllOf input) + { + if (input == null) + { + return false; + } + return + ( + this.Items == input.Items || + this.Items != null && + input.Items != null && + this.Items.SequenceEqual(input.Items) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Items != null) + { + hashCode = (hashCode * 59) + this.Items.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateKeyValueStoreDataRequest.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateKeyValueStoreDataRequest.cs index ae982e5ce..3a2916655 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateKeyValueStoreDataRequest.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateKeyValueStoreDataRequest.cs @@ -105,7 +105,7 @@ protected StateKeyValueStoreDataRequest() { } /// /// atLedgerState. /// Bech32m-encoded human readable version of the address. (required). - /// keys (required). + /// limited to max 100 items. (required). public StateKeyValueStoreDataRequest(LedgerStateSelector atLedgerState = default(LedgerStateSelector), string keyValueStoreAddress = default(string), List keys = default(List)) { // to ensure "keyValueStoreAddress" is required (not null) @@ -137,8 +137,9 @@ protected StateKeyValueStoreDataRequest() { } public string KeyValueStoreAddress { get; set; } /// - /// Gets or Sets Keys + /// limited to max 100 items. /// + /// limited to max 100 items. [DataMember(Name = "keys", IsRequired = true, EmitDefaultValue = true)] public List Keys { get; set; } diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateKeyValueStoreDataRequestAllOf.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateKeyValueStoreDataRequestAllOf.cs index ec4985dd5..52154ccbc 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateKeyValueStoreDataRequestAllOf.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateKeyValueStoreDataRequestAllOf.cs @@ -104,7 +104,7 @@ protected StateKeyValueStoreDataRequestAllOf() { } /// Initializes a new instance of the class. /// /// Bech32m-encoded human readable version of the address. (required). - /// keys (required). + /// limited to max 100 items. (required). public StateKeyValueStoreDataRequestAllOf(string keyValueStoreAddress = default(string), List keys = default(List)) { // to ensure "keyValueStoreAddress" is required (not null) @@ -129,8 +129,9 @@ protected StateKeyValueStoreDataRequestAllOf() { } public string KeyValueStoreAddress { get; set; } /// - /// Gets or Sets Keys + /// limited to max 100 items. /// + /// limited to max 100 items. [DataMember(Name = "keys", IsRequired = true, EmitDefaultValue = true)] public List Keys { get; set; } diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateNonFungibleDataRequest.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateNonFungibleDataRequest.cs index 0cdaee9c3..742429608 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateNonFungibleDataRequest.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateNonFungibleDataRequest.cs @@ -105,7 +105,7 @@ protected StateNonFungibleDataRequest() { } /// /// atLedgerState. /// Bech32m-encoded human readable version of the address. (required). - /// nonFungibleIds (required). + /// limited to max 100 items. (required). public StateNonFungibleDataRequest(LedgerStateSelector atLedgerState = default(LedgerStateSelector), string resourceAddress = default(string), List nonFungibleIds = default(List)) { // to ensure "resourceAddress" is required (not null) @@ -137,8 +137,9 @@ protected StateNonFungibleDataRequest() { } public string ResourceAddress { get; set; } /// - /// Gets or Sets NonFungibleIds + /// limited to max 100 items. /// + /// limited to max 100 items. [DataMember(Name = "non_fungible_ids", IsRequired = true, EmitDefaultValue = true)] public List NonFungibleIds { get; set; } diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateNonFungibleLocationRequest.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateNonFungibleLocationRequest.cs index 667fcb392..e8f32ed30 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateNonFungibleLocationRequest.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateNonFungibleLocationRequest.cs @@ -105,7 +105,7 @@ protected StateNonFungibleLocationRequest() { } /// /// atLedgerState. /// Bech32m-encoded human readable version of the address. (required). - /// nonFungibleIds (required). + /// limited to max 100 items. (required). public StateNonFungibleLocationRequest(LedgerStateSelector atLedgerState = default(LedgerStateSelector), string resourceAddress = default(string), List nonFungibleIds = default(List)) { // to ensure "resourceAddress" is required (not null) @@ -137,8 +137,9 @@ protected StateNonFungibleLocationRequest() { } public string ResourceAddress { get; set; } /// - /// Gets or Sets NonFungibleIds + /// limited to max 100 items. /// + /// limited to max 100 items. [DataMember(Name = "non_fungible_ids", IsRequired = true, EmitDefaultValue = true)] public List NonFungibleIds { get; set; } diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateNonFungibleLocationRequestAllOf.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateNonFungibleLocationRequestAllOf.cs index 1bb995d93..f6fc4f043 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateNonFungibleLocationRequestAllOf.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateNonFungibleLocationRequestAllOf.cs @@ -104,7 +104,7 @@ protected StateNonFungibleLocationRequestAllOf() { } /// Initializes a new instance of the class. /// /// Bech32m-encoded human readable version of the address. (required). - /// nonFungibleIds (required). + /// limited to max 100 items. (required). public StateNonFungibleLocationRequestAllOf(string resourceAddress = default(string), List nonFungibleIds = default(List)) { // to ensure "resourceAddress" is required (not null) @@ -129,8 +129,9 @@ protected StateNonFungibleLocationRequestAllOf() { } public string ResourceAddress { get; set; } /// - /// Gets or Sets NonFungibleIds + /// limited to max 100 items. /// + /// limited to max 100 items. [DataMember(Name = "non_fungible_ids", IsRequired = true, EmitDefaultValue = true)] public List NonFungibleIds { get; set; } diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/CommonDbContext.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/CommonDbContext.cs index 3767b15b7..bab3fa8f9 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/CommonDbContext.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/CommonDbContext.cs @@ -103,6 +103,8 @@ internal abstract class CommonDbContext : DbContext public DbSet PackageBlueprintAggregateHistory => Set(); + public DbSet PackageCodeAggregateHistory => Set(); + public DbSet EntityResourceAggregateHistory => Set(); public DbSet EntityResourceVaultAggregateHistory => Set(); @@ -366,6 +368,10 @@ private static void HookupHistory(ModelBuilder modelBuilder) .Entity() .HasIndex(e => new { e.PackageEntityId, e.FromStateVersion }); + modelBuilder + .Entity() + .HasIndex(e => new { e.PackageEntityId, e.FromStateVersion }); + modelBuilder .Entity() .HasIndex(e => new { e.EntityId, e.FromStateVersion }); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageCodeAggregator.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageCodeAggregator.cs new file mode 100644 index 000000000..3d13975fd --- /dev/null +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageCodeAggregator.cs @@ -0,0 +1,185 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +using RadixDlt.NetworkGateway.Abstractions; +using RadixDlt.NetworkGateway.Abstractions.Model; +using RadixDlt.NetworkGateway.PostgresIntegration.Models; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; + +namespace RadixDlt.NetworkGateway.PostgresIntegration.LedgerExtension; + +internal abstract record PackageCodeChange(long StateVersion, long PackageEntityId, byte[] CodeHash); + +internal record PackageCodeByteChange(long StateVersion, long PackageEntityId, byte[] CodeHash, byte[] Code) : PackageCodeChange(StateVersion, PackageEntityId, CodeHash); + +internal record PackageCodeVmChange(long StateVersion, long PackageEntityId, byte[] CodeHash, PackageVmType VmType) : PackageCodeChange(StateVersion, PackageEntityId, CodeHash); + +internal static class PackageCodeAggregator +{ + public static (List PackageCodeHistoryToAdd, List PackageCodeAggregateHistoryToAdd) AggregatePackageCode( + List packageCodeChanges, + Dictionary mostRecentPackageCodeHistory, + Dictionary mostRecentPackageCodeAggregateHistory, + SequencesHolder sequences) + { + var packageCodeHistoryToAdd = new List(); + var packageCodeAggregateHistoryToAdd = new List(); + + var packageGroups = packageCodeChanges.GroupBy(x => new { x.PackageEntityId, x.StateVersion }); + + foreach (var packageGroup in packageGroups) + { + var packageEntityId = packageGroup.Key.PackageEntityId; + var stateVersion = packageGroup.Key.StateVersion; + + mostRecentPackageCodeAggregateHistory.TryGetValue(packageEntityId, out var existingPackageCodeAggregate); + + PackageCodeAggregateHistory packageCodeAggregate; + + if (existingPackageCodeAggregate == null) + { + packageCodeAggregate = new PackageCodeAggregateHistory + { + Id = sequences.PackageCodeAggregateHistorySequence++, + FromStateVersion = stateVersion, + PackageEntityId = packageEntityId, + PackageCodeIds = new List(), + }; + + mostRecentPackageCodeAggregateHistory[packageEntityId] = packageCodeAggregate; + } + else + { + packageCodeAggregate = existingPackageCodeAggregate; + packageCodeAggregate.Id = sequences.PackageCodeAggregateHistorySequence++; + packageCodeAggregate.FromStateVersion = stateVersion; + } + + var packageCodeGroups = packageGroup + .GroupBy(x => new { x.PackageEntityId, CodeHash = (ValueBytes)x.CodeHash, x.StateVersion }); + + foreach (var packageCodeGroup in packageCodeGroups) + { + var lookup = new PackageCodeLookup(packageEntityId, packageCodeGroup.Key.CodeHash); + mostRecentPackageCodeHistory.TryGetValue(lookup, out var existingPackageCode); + + PackageCodeHistory packageCodeHistory; + + if (existingPackageCode != null) + { + var previousPackageBlueprintHistoryId = existingPackageCode.Id; + + packageCodeHistory = existingPackageCode; + packageCodeHistory.Id = sequences.PackageCodeHistorySequence++; + packageCodeHistory.FromStateVersion = packageCodeGroup.Key.StateVersion; + + packageCodeAggregate.PackageCodeIds.Remove(previousPackageBlueprintHistoryId); + packageCodeAggregate.PackageCodeIds.Add(packageCodeHistory.Id); + } + else + { + packageCodeHistory = new PackageCodeHistory + { + Id = sequences.PackageCodeHistorySequence++, + PackageEntityId = packageEntityId, + FromStateVersion = stateVersion, + CodeHash = lookup.CodeHex, + }; + + mostRecentPackageCodeHistory[lookup] = packageCodeHistory; + + packageCodeAggregate.PackageCodeIds.Add(packageCodeHistory.Id); + } + + foreach (var change in packageCodeGroup) + { + switch (change) + { + case PackageCodeByteChange codeByteChange: + { + packageCodeHistory.Code = codeByteChange.Code; + break; + } + + case PackageCodeVmChange vmChange: + { + packageCodeHistory.VmType = vmChange.VmType; + break; + } + + default: throw new UnreachableException($"Unexpected type of package code change: {change.GetType()}"); + } + } + + packageCodeHistoryToAdd.Add(packageCodeHistory); + } + + packageCodeAggregateHistoryToAdd.Add(packageCodeAggregate); + } + + return (packageCodeHistoryToAdd, packageCodeAggregateHistoryToAdd); + } +} diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs index 186320cdd..d81008f4d 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs @@ -703,11 +703,11 @@ private async Task ProcessTransactions(ReadWriteDbContext db var resourceSupplyChanges = new List(); var validatorSetChanges = new List(); var packageBlueprintChanges = new List(); + var packageCodeChanges = new List(); var stateToAdd = new List(); var vaultHistoryToAdd = new List(); var keyValueStoreEntryHistoryToAdd = new List(); var componentMethodRoyaltiesToAdd = new List(); - var packageCodeHistoryToAdd = new Dictionary(); var schemaHistoryToAdd = new List(); var nonFungibleSchemaHistoryToAdd = new List(); var keyValueStoreSchemaHistoryToAdd = new List(); @@ -1007,32 +1007,22 @@ private async Task ProcessTransactions(ReadWriteDbContext db if (substateData is CoreModel.PackageCodeOriginalCodeEntrySubstate packageCodeOriginalCode) { - var lookup = new PackageCodeLookup(packageCodeOriginalCode.Key.CodeHash); - - var codeHistory = packageCodeHistoryToAdd.GetOrAdd(lookup, _ => new PackageCodeHistory - { - Id = sequences.PackageCodeHistorySequence++, - FromStateVersion = stateVersion, - PackageEntityId = referencedEntity.DatabaseId, - CodeHash = packageCodeOriginalCode.Key.CodeHash.ConvertFromHex(), - }); - - codeHistory.Code = packageCodeOriginalCode.Value.CodeHex.ConvertFromHex(); + packageCodeChanges.Add(new PackageCodeByteChange( + stateVersion, + referencedEntity.DatabaseId, + packageCodeOriginalCode.Key.CodeHash.ConvertFromHex(), + packageCodeOriginalCode.Value.CodeHex.ConvertFromHex() + )); } if (substateData is CoreModel.PackageCodeVmTypeEntrySubstate packageCodeVmType) { - var lookup = new PackageCodeLookup(packageCodeVmType.Key.CodeHash); - - var codeHistory = packageCodeHistoryToAdd.GetOrAdd(lookup, _ => new PackageCodeHistory - { - Id = sequences.PackageCodeHistorySequence++, - FromStateVersion = stateVersion, - PackageEntityId = referencedEntity.DatabaseId, - CodeHash = packageCodeVmType.Key.CodeHash.ConvertFromHex(), - }); - - codeHistory.VmType = packageCodeVmType.Value.VmType.ToModel(); + packageCodeChanges.Add(new PackageCodeVmChange( + stateVersion, + referencedEntity.DatabaseId, + packageCodeVmType.Key.CodeHash.ConvertFromHex(), + packageCodeVmType.Value.VmType.ToModel() + )); } if (substateData is CoreModel.SchemaEntrySubstate schema) @@ -1343,6 +1333,7 @@ private async Task ProcessTransactions(ReadWriteDbContext db var sw = Stopwatch.StartNew(); var mostRecentPackageBlueprintHistory = await readHelper.MostRecentPackageBlueprintHistoryFor(packageBlueprintChanges, token); + var mostRecentPackageCodeHistory = await readHelper.MostRecentPackageCodeHistoryFor(packageCodeChanges, token); var mostRecentMetadataHistory = await readHelper.MostRecentEntityMetadataHistoryFor(metadataChanges, token); var mostRecentAggregatedMetadataHistory = await readHelper.MostRecentEntityAggregateMetadataHistoryFor(metadataChanges, token); var mostRecentAccessRulesEntryHistory = await readHelper.MostRecentEntityRoleAssignmentsEntryHistoryFor(roleAssignmentsChangePointers.Values, token); @@ -1356,6 +1347,7 @@ private async Task ProcessTransactions(ReadWriteDbContext db var existingNonFungibleIdData = await readHelper.ExistingNonFungibleIdDataFor(nonFungibleIdChanges, vaultSnapshots.OfType().ToList(), token); var existingValidatorKeys = await readHelper.ExistingValidatorKeysFor(validatorSetChanges, token); var mostRecentPackageBlueprintAggregateHistory = await readHelper.MostRecentPackageBlueprintAggregateHistoryFor(packageBlueprintChanges, token); + var mostRecentPackageCodeAggregateHistory = await readHelper.MostRecentPackageCodeAggregateHistoryFor(packageCodeChanges, token); dbReadDuration += sw.Elapsed; @@ -1375,6 +1367,9 @@ private async Task ProcessTransactions(ReadWriteDbContext db var (packageBlueprintHistoryToAdd, packageBlueprintAggregateHistoryToAdd) = PackageBlueprintAggregator.AggregatePackageBlueprint(packageBlueprintChanges, mostRecentPackageBlueprintHistory, mostRecentPackageBlueprintAggregateHistory, sequences); + var (packageCodeHistoryToAdd, packageCodeAggregateHistoryToAdd) = + PackageCodeAggregator.AggregatePackageCode(packageCodeChanges, mostRecentPackageCodeHistory, mostRecentPackageCodeAggregateHistory, sequences); + foreach (var metadataChange in metadataChanges) { var lookup = new MetadataLookup(metadataChange.ReferencedEntity.DatabaseId, metadataChange.Key); @@ -1873,7 +1868,8 @@ void AggregateEntityResourceVaultInternal(long entityId, long resourceEntityId, rowsInserted += await writeHelper.CopyValidatorKeyHistory(validatorKeyHistoryToAdd.Values, token); rowsInserted += await writeHelper.CopyValidatorActiveSetHistory(validatorActiveSetHistoryToAdd, token); rowsInserted += await writeHelper.CopyPackageBlueprintHistory(packageBlueprintHistoryToAdd, token); - rowsInserted += await writeHelper.CopyPackageCodeHistory(packageCodeHistoryToAdd.Values, token); + rowsInserted += await writeHelper.CopyPackageCodeHistory(packageCodeHistoryToAdd, token); + rowsInserted += await writeHelper.CopyPackageCodeAggregateHistory(packageCodeAggregateHistoryToAdd, token); rowsInserted += await writeHelper.CopySchemaHistory(schemaHistoryToAdd, token); rowsInserted += await writeHelper.CopyKeyValueStoreEntryHistory(keyValueStoreEntryHistoryToAdd, token); rowsInserted += await writeHelper.CopyAccountDefaultDepositRuleHistory(accountDefaultDepositRuleHistoryToAdd, token); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/ReadHelper.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/ReadHelper.cs index bcbb9b361..fdb6cc12b 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/ReadHelper.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/ReadHelper.cs @@ -143,6 +143,54 @@ LIMIT 1 return result; } + public async Task> MostRecentPackageCodeHistoryFor(List packageCodeChanges, CancellationToken token) + { + if (!packageCodeChanges.Any()) + { + return new Dictionary(); + } + + var sw = Stopwatch.GetTimestamp(); + + var entityIds = new List(); + var codeHashes = new List(); + var lookupSet = new HashSet(); + + foreach (var change in packageCodeChanges) + { + lookupSet.Add(new PackageCodeLookup(change.PackageEntityId, change.CodeHash)); + } + + foreach (var lookup in lookupSet) + { + entityIds.Add(lookup.PackageEntityId); + codeHashes.Add(lookup.CodeHex); + } + + var result = await _dbContext + .PackageCodeHistory + .FromSqlInterpolated(@$" +WITH variables (entity_id, code_hash) AS ( + SELECT UNNEST({entityIds}), UNNEST({codeHashes}) +) +SELECT pbh.* +FROM variables +INNER JOIN LATERAL ( + SELECT * + FROM package_code_history + WHERE package_entity_id = variables.entity_id AND code_hash = variables.code_hash + ORDER BY from_state_version DESC + LIMIT 1 +) pbh ON true;") + .AsNoTracking() + .AnnotateMetricName() + .ToDictionaryAsync(e => new PackageCodeLookup(e.PackageEntityId, e.CodeHash), token); + + await _observers.ForEachAsync(x => x.StageCompleted(nameof(MostRecentPackageCodeHistoryFor), Stopwatch.GetElapsedTime(sw), result.Count)); + + return result; + } + public async Task> MostRecentEntityMetadataHistoryFor(List metadataChanges, CancellationToken token) { if (!metadataChanges.Any()) @@ -190,6 +238,40 @@ LIMIT 1 return result; } + public async Task> MostRecentPackageCodeAggregateHistoryFor(List packageCodeChanges, CancellationToken token) + { + if (!packageCodeChanges.Any()) + { + return new Dictionary(); + } + + var sw = Stopwatch.GetTimestamp(); + var packageEntityIds = packageCodeChanges.Select(x => x.PackageEntityId).Distinct().ToList(); + + var result = await _dbContext + .PackageCodeAggregateHistory + .FromSqlInterpolated(@$" +WITH variables (package_entity_id) AS ( + SELECT UNNEST({packageEntityIds}) +) +SELECT pbah.* +FROM variables +INNER JOIN LATERAL ( + SELECT * + FROM package_code_aggregate_history + WHERE package_entity_id = variables.package_entity_id + ORDER BY from_state_version DESC + LIMIT 1 +) pbah ON true;") + .AsNoTracking() + .AnnotateMetricName() + .ToDictionaryAsync(e => e.PackageEntityId, token); + + await _observers.ForEachAsync(x => x.StageCompleted(nameof(MostRecentPackageBlueprintAggregateHistoryFor), Stopwatch.GetElapsedTime(sw), result.Count)); + + return result; + } + public async Task> MostRecentPackageBlueprintAggregateHistoryFor(List packageBlueprintChanges, CancellationToken token) { if (!packageBlueprintChanges.Any()) @@ -747,7 +829,8 @@ public async Task LoadSequences(CancellationToken token) nextval('validator_emission_statistics_id_seq') AS ValidatorEmissionStatisticsSequence, nextval('non_fungible_schema_history_id_seq') AS NonFungibleSchemaHistorySequence, nextval('key_value_store_schema_history_id_seq') AS KeyValueSchemaHistorySequence, - nextval('package_blueprint_aggregate_history_id_seq') AS PackageBlueprintAggregateHistorySequence", + nextval('package_blueprint_aggregate_history_id_seq') AS PackageBlueprintAggregateHistorySequence, + nextval('package_code_aggregate_history_id_seq') AS PackageCodeAggregateHistorySequence", cancellationToken: token); var result = await _connection.QueryFirstAsync(cd); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Records.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Records.cs index 5435d8b05..5dbc2404c 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Records.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Records.cs @@ -111,7 +111,7 @@ internal record struct MetadataLookup(long EntityId, string Key); internal record struct PackageBlueprintLookup(long PackageEntityId, string Name, string Version); -internal record struct PackageCodeLookup(string CodeHex); +internal record struct PackageCodeLookup(long PackageEntityId, ValueBytes CodeHex); internal record struct EntityResourceLookup(long EntityId, long ResourceEntityId); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/SequencesHolder.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/SequencesHolder.cs index c2da4b2b7..39038a907 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/SequencesHolder.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/SequencesHolder.cs @@ -125,4 +125,6 @@ internal class SequencesHolder public long KeyValueSchemaHistorySequence { get; set; } public long PackageBlueprintAggregateHistorySequence { get; set; } + + public long PackageCodeAggregateHistorySequence { get; set; } } diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/WriteHelper.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/WriteHelper.cs index 44eced87c..31d93da39 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/WriteHelper.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/WriteHelper.cs @@ -403,6 +403,33 @@ public async Task CopyPackageBlueprintAggregateHistory(ICollection CopyPackageCodeAggregateHistory(ICollection entities, CancellationToken token) + { + if (!entities.Any()) + { + return 0; + } + + var sw = Stopwatch.GetTimestamp(); + + await using var writer = await _connection.BeginBinaryImportAsync("COPY package_code_aggregate_history (id, from_state_version, package_entity_id, package_code_ids) FROM STDIN (FORMAT BINARY)", token); + + foreach (var e in entities) + { + await writer.StartRowAsync(token); + await writer.WriteAsync(e.Id, NpgsqlDbType.Bigint, token); + await writer.WriteAsync(e.FromStateVersion, NpgsqlDbType.Bigint, token); + await writer.WriteAsync(e.PackageEntityId, NpgsqlDbType.Bigint, token); + await writer.WriteAsync(e.PackageCodeIds.ToArray(), NpgsqlDbType.Array | NpgsqlDbType.Bigint, token); + } + + await writer.CompleteAsync(token); + + await _observers.ForEachAsync(x => x.StageCompleted(nameof(CopyEntityMetadataAggregateHistory), Stopwatch.GetElapsedTime(sw), entities.Count)); + + return entities.Count; + } + public async Task CopyEntityMetadataAggregateHistory(ICollection entities, CancellationToken token) { if (!entities.Any()) @@ -1282,7 +1309,8 @@ public async Task UpdateSequences(SequencesHolder sequences, CancellationToken t setval('validator_emission_statistics_id_seq', @validatorEmissionStatisticsSequence), setval('non_fungible_schema_history_id_seq', @NonFungibleSchemaHistorySequence), setval('key_value_store_schema_history_id_seq', @KeyValueSchemaHistorySequence), - setval('package_blueprint_aggregate_history_id_seq', @packageBlueprintAggregateHistorySequence) + setval('package_blueprint_aggregate_history_id_seq', @packageBlueprintAggregateHistorySequence), + setval('package_code_aggregate_history_id_seq', @PackageCodeAggregateHistorySequence) ", parameters: new { @@ -1316,6 +1344,7 @@ public async Task UpdateSequences(SequencesHolder sequences, CancellationToken t nonFungibleSchemaHistorySequence = sequences.NonFungibleSchemaHistorySequence, keyValueSchemaHistorySequence = sequences.KeyValueSchemaHistorySequence, packageBlueprintAggregateHistorySequence = sequences.PackageBlueprintAggregateHistorySequence, + packageCodeAggregateHistorySequence = sequences.PackageCodeAggregateHistorySequence, }, cancellationToken: token); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117153350_AddPackageCodeAggregateHistoryTable.Designer.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117153350_AddPackageCodeAggregateHistoryTable.Designer.cs new file mode 100644 index 000000000..14cfe7a76 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117153350_AddPackageCodeAggregateHistoryTable.Designer.cs @@ -0,0 +1,2415 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +// +using System; +using System.Collections.Generic; +using System.Numerics; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using RadixDlt.NetworkGateway.Abstractions.Addressing; +using RadixDlt.NetworkGateway.Abstractions.Model; +using RadixDlt.NetworkGateway.PostgresIntegration; +using RadixDlt.NetworkGateway.PostgresIntegration.Models; + +#nullable disable + +namespace RadixDlt.NetworkGateway.PostgresIntegration.Migrations +{ + [DbContext(typeof(MigrationsDbContext))] + [Migration("20240117153350_AddPackageCodeAggregateHistoryTable")] + partial class AddPackageCodeAggregateHistoryTable + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "account_default_deposit_rule", new[] { "accept", "reject", "allow_existing" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "account_resource_preference_rule", new[] { "allowed", "disallowed" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "entity_type", new[] { "global_consensus_manager", "global_fungible_resource", "global_non_fungible_resource", "global_generic_component", "internal_generic_component", "global_account_component", "global_package", "internal_key_value_store", "internal_fungible_vault", "internal_non_fungible_vault", "global_validator", "global_access_controller", "global_identity", "global_one_resource_pool", "global_two_resource_pool", "global_multi_resource_pool", "global_transaction_tracker" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_event_type", new[] { "withdrawal", "deposit" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_operation_type", new[] { "resource_in_use", "account_deposited_into", "account_withdrawn_from" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_origin_type", new[] { "user", "epoch_change" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_type", new[] { "origin", "event", "manifest_address", "affected_global_entity" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_status", new[] { "succeeded", "failed" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_type", new[] { "genesis", "user", "round_update", "flash" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "module_id", new[] { "main", "metadata", "royalty", "role_assignment" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "non_fungible_id_type", new[] { "string", "integer", "bytes", "ruid" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "package_vm_type", new[] { "native", "scrypto_v1" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "pending_transaction_intent_ledger_status", new[] { "unknown", "committed", "commit_pending", "permanent_rejection", "possible_to_commit", "likely_but_not_certain_rejection" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "pending_transaction_payload_ledger_status", new[] { "unknown", "committed", "commit_pending", "clashing_commit", "permanently_rejected", "transiently_accepted", "transiently_rejected" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "public_key_type", new[] { "ecdsa_secp256k1", "eddsa_ed25519" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "resource_type", new[] { "fungible", "non_fungible" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "sbor_type_kind", new[] { "well_known", "schema_local" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "state_type", new[] { "json", "sbor" }); + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AccountDefaultDepositRuleHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountEntityId") + .HasColumnType("bigint") + .HasColumnName("account_entity_id"); + + b.Property("DefaultDepositRule") + .HasColumnType("account_default_deposit_rule") + .HasColumnName("default_deposit_rule"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.HasKey("Id"); + + b.HasIndex("AccountEntityId", "FromStateVersion"); + + b.ToTable("account_default_deposit_rule_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AccountResourcePreferenceRuleHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountEntityId") + .HasColumnType("bigint") + .HasColumnName("account_entity_id"); + + b.Property("AccountResourcePreferenceRule") + .HasColumnType("account_resource_preference_rule") + .HasColumnName("account_resource_preference_rule"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("AccountEntityId", "ResourceEntityId", "FromStateVersion"); + + b.ToTable("account_resource_preference_rule_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ComponentMethodRoyaltyEntryHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("IsLocked") + .HasColumnType("boolean") + .HasColumnName("is_locked"); + + b.Property("MethodName") + .IsRequired() + .HasColumnType("text") + .HasColumnName("method_name"); + + b.Property("RoyaltyAmount") + .HasColumnType("jsonb") + .HasColumnName("royalty_amount"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.HasIndex("EntityId", "MethodName", "FromStateVersion"); + + b.ToTable("component_method_royalty_entry_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasColumnType("text") + .HasColumnName("address"); + + b.Property>("AncestorIds") + .HasColumnType("bigint[]") + .HasColumnName("ancestor_ids"); + + b.Property>("CorrelatedEntities") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("correlated_entities"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("GlobalAncestorId") + .HasColumnType("bigint") + .HasColumnName("global_ancestor_id"); + + b.Property("IsGlobal") + .HasColumnType("boolean") + .HasColumnName("is_global"); + + b.Property("OwnerAncestorId") + .HasColumnType("bigint") + .HasColumnName("owner_ancestor_id"); + + b.Property("ParentAncestorId") + .HasColumnType("bigint") + .HasColumnName("parent_ancestor_id"); + + b.Property("discriminator") + .HasColumnType("entity_type"); + + b.HasKey("Id"); + + b.HasIndex("Address") + .IsUnique(); + + b.HasIndex("FromStateVersion") + .HasFilter("discriminator = 'global_validator'"); + + b.ToTable("entities"); + + b.HasDiscriminator("discriminator"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityMetadataAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property>("MetadataIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("metadata_ids"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.ToTable("entity_metadata_aggregate_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityMetadataHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted"); + + b.Property("IsLocked") + .HasColumnType("boolean") + .HasColumnName("is_locked"); + + b.Property("Key") + .IsRequired() + .HasColumnType("text") + .HasColumnName("key"); + + b.Property("Value") + .HasColumnType("bytea") + .HasColumnName("value"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "Key", "FromStateVersion"); + + b.ToTable("entity_metadata_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property>("FungibleResourceEntityIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("fungible_resource_entity_ids"); + + b.Property>("FungibleResourceSignificantUpdateStateVersions") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("fungible_resource_significant_update_state_versions"); + + b.Property>("NonFungibleResourceEntityIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("non_fungible_resource_entity_ids"); + + b.Property>("NonFungibleResourceSignificantUpdateStateVersions") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("non_fungible_resource_significant_update_state_versions"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.ToTable("entity_resource_aggregate_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregatedVaultsHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.Property("discriminator") + .HasColumnType("resource_type"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "ResourceEntityId", "FromStateVersion"); + + b.ToTable("entity_resource_aggregated_vaults_history"); + + b.HasDiscriminator("discriminator"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceVaultAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.Property>("VaultEntityIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("vault_entity_ids"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "ResourceEntityId", "FromStateVersion"); + + b.ToTable("entity_resource_vault_aggregate_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityRoleAssignmentsAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property>("EntryIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("entry_ids"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("OwnerRoleId") + .HasColumnType("bigint") + .HasColumnName("owner_role_id"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.ToTable("entity_role_assignments_aggregate_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityRoleAssignmentsEntryHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted"); + + b.Property("KeyModule") + .HasColumnType("module_id") + .HasColumnName("key_module"); + + b.Property("KeyRole") + .IsRequired() + .HasColumnType("text") + .HasColumnName("key_role"); + + b.Property("RoleAssignments") + .HasColumnType("jsonb") + .HasColumnName("role_assignments"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "KeyRole", "KeyModule", "FromStateVersion"); + + b.ToTable("entity_role_assignments_entry_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityRoleAssignmentsOwnerRoleHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("RoleAssignments") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("role_assignments"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.ToTable("entity_role_assignments_owner_role_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityVaultHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("GlobalEntityId") + .HasColumnType("bigint") + .HasColumnName("global_entity_id"); + + b.Property("OwnerEntityId") + .HasColumnType("bigint") + .HasColumnName("owner_entity_id"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.Property("VaultEntityId") + .HasColumnType("bigint") + .HasColumnName("vault_entity_id"); + + b.Property("discriminator") + .HasColumnType("resource_type"); + + b.HasKey("Id"); + + b.HasIndex("GlobalEntityId", "FromStateVersion") + .HasFilter("is_royalty_vault = true"); + + b.HasIndex("OwnerEntityId", "FromStateVersion") + .HasFilter("is_royalty_vault = true"); + + b.HasIndex("VaultEntityId", "FromStateVersion") + .HasFilter("discriminator = 'non_fungible'"); + + b.HasIndex("GlobalEntityId", "VaultEntityId", "FromStateVersion"); + + b.HasIndex("Id", "ResourceEntityId", "FromStateVersion"); + + b.HasIndex("OwnerEntityId", "VaultEntityId", "FromStateVersion"); + + b.ToTable("entity_vault_history"); + + b.HasDiscriminator("discriminator"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.KeyValueStoreEntryHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted"); + + b.Property("IsLocked") + .HasColumnType("boolean") + .HasColumnName("is_locked"); + + b.Property("Key") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("key"); + + b.Property("KeyValueStoreEntityId") + .HasColumnType("bigint") + .HasColumnName("key_value_store_entity_id"); + + b.Property("Value") + .HasColumnType("bytea") + .HasColumnName("value"); + + b.HasKey("Id"); + + b.HasIndex("KeyValueStoreEntityId", "Key", "FromStateVersion"); + + b.ToTable("key_value_store_entry_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.KeyValueStoreSchemaHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("KeySborTypeKind") + .HasColumnType("sbor_type_kind") + .HasColumnName("key_sbor_type_kind"); + + b.Property("KeySchemaDefiningEntityId") + .HasColumnType("bigint") + .HasColumnName("key_schema_defining_entity_id"); + + b.Property("KeySchemaHash") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("key_schema_hash"); + + b.Property("KeyTypeIndex") + .HasColumnType("bigint") + .HasColumnName("key_type_index"); + + b.Property("KeyValueStoreEntityId") + .HasColumnType("bigint") + .HasColumnName("key_value_store_entity_id"); + + b.Property("ValueSborTypeKind") + .HasColumnType("sbor_type_kind") + .HasColumnName("value_sbor_type_kind"); + + b.Property("ValueSchemaDefiningEntityId") + .HasColumnType("bigint") + .HasColumnName("value_schema_defining_entity_id"); + + b.Property("ValueSchemaHash") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("value_schema_hash"); + + b.Property("ValueTypeIndex") + .HasColumnType("bigint") + .HasColumnName("value_type_index"); + + b.HasKey("Id"); + + b.HasIndex("KeyValueStoreEntityId", "FromStateVersion"); + + b.ToTable("key_value_store_schema_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction", b => + { + b.Property("StateVersion") + .HasColumnType("bigint") + .HasColumnName("state_version"); + + b.Property("AffectedGlobalEntities") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("affected_global_entities"); + + b.Property("BalanceChanges") + .HasColumnType("jsonb") + .HasColumnName("balance_changes"); + + b.Property("CreatedTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_timestamp"); + + b.Property("Epoch") + .HasColumnType("bigint") + .HasColumnName("epoch"); + + b.Property("FeePaid") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("fee_paid"); + + b.Property("IndexInEpoch") + .HasColumnType("bigint") + .HasColumnName("index_in_epoch"); + + b.Property("IndexInRound") + .HasColumnType("bigint") + .HasColumnName("index_in_round"); + + b.Property("NormalizedRoundTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("normalized_round_timestamp"); + + b.Property("ReceiptCostingParameters") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("receipt_costing_parameters"); + + b.Property("ReceiptErrorMessage") + .HasColumnType("text") + .HasColumnName("receipt_error_message"); + + b.Property("ReceiptEventEmitters") + .IsRequired() + .HasColumnType("jsonb[]") + .HasColumnName("receipt_event_emitters"); + + b.Property("ReceiptEventNames") + .IsRequired() + .HasColumnType("text[]") + .HasColumnName("receipt_event_names"); + + b.Property("ReceiptEventSborTypeKinds") + .IsRequired() + .HasColumnType("sbor_type_kind[]") + .HasColumnName("receipt_event_sbor_type_kinds"); + + b.Property("ReceiptEventSbors") + .IsRequired() + .HasColumnType("bytea[]") + .HasColumnName("receipt_event_sbors"); + + b.Property("ReceiptEventSchemaEntityIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("receipt_event_schema_entity_ids"); + + b.Property("ReceiptEventSchemaHashes") + .IsRequired() + .HasColumnType("bytea[]") + .HasColumnName("receipt_event_schema_hashes"); + + b.Property("ReceiptEventTypeIndexes") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("receipt_event_type_indexes"); + + b.Property("ReceiptFeeDestination") + .HasColumnType("jsonb") + .HasColumnName("receipt_fee_destination"); + + b.Property("ReceiptFeeSource") + .HasColumnType("jsonb") + .HasColumnName("receipt_fee_source"); + + b.Property("ReceiptFeeSummary") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("receipt_fee_summary"); + + b.Property("ReceiptNextEpoch") + .HasColumnType("jsonb") + .HasColumnName("receipt_next_epoch"); + + b.Property("ReceiptOutput") + .HasColumnType("jsonb") + .HasColumnName("receipt_output"); + + b.Property("ReceiptStateUpdates") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("receipt_state_updates"); + + b.Property("ReceiptStatus") + .HasColumnType("ledger_transaction_status") + .HasColumnName("receipt_status"); + + b.Property("ReceiptTreeHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("receipt_tree_hash"); + + b.Property("RoundInEpoch") + .HasColumnType("bigint") + .HasColumnName("round_in_epoch"); + + b.Property("RoundTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("round_timestamp"); + + b.Property("StateTreeHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("state_tree_hash"); + + b.Property("TipPaid") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("tip_paid"); + + b.Property("TransactionTreeHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("transaction_tree_hash"); + + b.Property("discriminator") + .HasColumnType("ledger_transaction_type"); + + b.HasKey("StateVersion"); + + b.HasIndex("RoundTimestamp"); + + b.HasIndex("Epoch", "RoundInEpoch") + .IsUnique() + .HasFilter("index_in_round = 0"); + + b.ToTable("ledger_transactions"); + + b.HasDiscriminator("discriminator"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("StateVersion") + .HasColumnType("bigint") + .HasColumnName("state_version"); + + b.Property("discriminator") + .HasColumnType("ledger_transaction_marker_type"); + + b.HasKey("Id"); + + b.HasIndex("StateVersion"); + + b.ToTable("ledger_transaction_markers"); + + b.HasDiscriminator("discriminator"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NetworkConfiguration", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("AddressTypeDefinitions") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("address_type_definitions"); + + b.Property("GenesisEpoch") + .HasColumnType("bigint") + .HasColumnName("genesis_epoch"); + + b.Property("GenesisRound") + .HasColumnType("bigint") + .HasColumnName("genesis_round"); + + b.Property("HrpDefinition") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("hrp_definition"); + + b.Property("NetworkHrpSuffix") + .IsRequired() + .HasColumnType("text") + .HasColumnName("network_hrp_suffix"); + + b.Property("NetworkId") + .HasColumnType("smallint") + .HasColumnName("network_id"); + + b.Property("NetworkName") + .IsRequired() + .HasColumnType("text") + .HasColumnName("network_name"); + + b.Property("WellKnownAddresses") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("well_known_addresses"); + + b.HasKey("Id"); + + b.ToTable("network_configuration"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("NonFungibleId") + .IsRequired() + .HasColumnType("text") + .HasColumnName("non_fungible_id"); + + b.Property("NonFungibleResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("non_fungible_resource_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("NonFungibleResourceEntityId", "FromStateVersion"); + + b.HasIndex("NonFungibleResourceEntityId", "NonFungibleId", "FromStateVersion") + .IsUnique(); + + b.ToTable("non_fungible_id_data"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdDataHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Data") + .HasColumnType("bytea") + .HasColumnName("data"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted"); + + b.Property("IsLocked") + .HasColumnType("boolean") + .HasColumnName("is_locked"); + + b.Property("NonFungibleIdDataId") + .HasColumnType("bigint") + .HasColumnName("non_fungible_id_data_id"); + + b.HasKey("Id"); + + b.HasIndex("NonFungibleIdDataId", "FromStateVersion"); + + b.ToTable("non_fungible_id_data_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdLocationHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("NonFungibleIdDataId") + .HasColumnType("bigint") + .HasColumnName("non_fungible_id_data_id"); + + b.Property("VaultEntityId") + .HasColumnType("bigint") + .HasColumnName("vault_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("NonFungibleIdDataId", "FromStateVersion"); + + b.ToTable("non_fungible_id_location_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdStoreHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property>("NonFungibleIdDataIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("non_fungible_id_data_ids"); + + b.Property("NonFungibleResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("non_fungible_resource_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("NonFungibleResourceEntityId", "FromStateVersion"); + + b.ToTable("non_fungible_id_store_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleSchemaHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.Property("SborTypeKind") + .HasColumnType("sbor_type_kind") + .HasColumnName("sbor_type_kind"); + + b.Property("SchemaDefiningEntityId") + .HasColumnType("bigint") + .HasColumnName("schema_defining_entity_id"); + + b.Property("SchemaHash") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("schema_hash"); + + b.Property("TypeIndex") + .HasColumnType("bigint") + .HasColumnName("type_index"); + + b.HasKey("Id"); + + b.HasIndex("ResourceEntityId", "FromStateVersion"); + + b.ToTable("non_fungible_schema_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageBlueprintAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property>("PackageBlueprintIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("package_blueprint_ids"); + + b.Property("PackageEntityId") + .HasColumnType("bigint") + .HasColumnName("package_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("PackageEntityId", "FromStateVersion"); + + b.ToTable("package_blueprint_aggregate_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageBlueprintHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AuthTemplate") + .HasColumnType("jsonb") + .HasColumnName("auth_template"); + + b.Property("AuthTemplateIsLocked") + .HasColumnType("boolean") + .HasColumnName("auth_template_is_locked"); + + b.Property("Definition") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("definition"); + + b.Property>("DependantEntityIds") + .HasColumnType("bigint[]") + .HasColumnName("dependant_entity_ids"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("PackageEntityId") + .HasColumnType("bigint") + .HasColumnName("package_entity_id"); + + b.Property("RoyaltyConfig") + .HasColumnType("jsonb") + .HasColumnName("royalty_config"); + + b.Property("RoyaltyConfigIsLocked") + .HasColumnType("boolean") + .HasColumnName("royalty_config_is_locked"); + + b.Property("Version") + .IsRequired() + .HasColumnType("text") + .HasColumnName("version"); + + b.HasKey("Id"); + + b.HasIndex("PackageEntityId", "FromStateVersion"); + + b.HasIndex("PackageEntityId", "Name", "Version", "FromStateVersion"); + + b.ToTable("package_blueprint_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageCodeAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property>("PackageCodeIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("package_code_ids"); + + b.Property("PackageEntityId") + .HasColumnType("bigint") + .HasColumnName("package_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("PackageEntityId", "FromStateVersion"); + + b.ToTable("package_code_aggregate_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageCodeHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Code") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("code"); + + b.Property("CodeHash") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("code_hash"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("PackageEntityId") + .HasColumnType("bigint") + .HasColumnName("package_entity_id"); + + b.Property("VmType") + .HasColumnType("package_vm_type") + .HasColumnName("vm_type"); + + b.HasKey("Id"); + + b.HasIndex("PackageEntityId", "FromStateVersion"); + + b.ToTable("package_code_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EndEpochExclusive") + .HasColumnType("numeric(20,0)") + .HasColumnName("end_epoch_exclusive"); + + b.Property("IntentHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("intent_hash"); + + b.Property("PayloadHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("payload_hash"); + + b.Property("PayloadId") + .HasColumnType("bigint") + .HasColumnName("payload_id"); + + b.Property("VersionControl") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.HasKey("Id"); + + b.HasIndex("IntentHash"); + + b.HasIndex("PayloadHash") + .IsUnique(); + + b.ToTable("pending_transactions"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionPayload", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("NotarizedTransactionBlob") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("notarized_transaction_blob"); + + b.Property("PendingTransactionId") + .HasColumnType("bigint") + .HasColumnName("pending_transaction_id"); + + b.HasKey("Id"); + + b.HasIndex("PendingTransactionId") + .IsUnique(); + + b.ToTable("pending_transaction_payloads"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ResourceEntitySupplyHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.Property("TotalBurned") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("total_burned"); + + b.Property("TotalMinted") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("total_minted"); + + b.Property("TotalSupply") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("total_supply"); + + b.HasKey("Id"); + + b.HasIndex("ResourceEntityId", "FromStateVersion"); + + b.ToTable("resource_entity_supply_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.SchemaHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("Schema") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("schema"); + + b.Property("SchemaHash") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("schema_hash"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.HasIndex("SchemaHash", "FromStateVersion"); + + b.ToTable("schema_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.StateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("discriminator") + .HasColumnType("state_type"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.ToTable("state_history"); + + b.HasDiscriminator("discriminator"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorActiveSetHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Epoch") + .HasColumnType("bigint") + .HasColumnName("epoch"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("Stake") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("stake"); + + b.Property("ValidatorPublicKeyHistoryId") + .HasColumnType("bigint") + .HasColumnName("validator_public_key_history_id"); + + b.HasKey("Id"); + + b.HasIndex("Epoch"); + + b.HasIndex("FromStateVersion"); + + b.HasIndex("ValidatorPublicKeyHistoryId"); + + b.ToTable("validator_active_set_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorEmissionStatistics", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EpochNumber") + .HasColumnType("bigint") + .HasColumnName("epoch_number"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("ProposalsMade") + .HasColumnType("bigint") + .HasColumnName("proposals_made"); + + b.Property("ProposalsMissed") + .HasColumnType("bigint") + .HasColumnName("proposals_missed"); + + b.Property("ValidatorEntityId") + .HasColumnType("bigint") + .HasColumnName("validator_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("ValidatorEntityId", "EpochNumber"); + + b.ToTable("validator_emission_statistics"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorPublicKeyHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("Key") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("key"); + + b.Property("KeyType") + .HasColumnType("public_key_type") + .HasColumnName("key_type"); + + b.Property("ValidatorEntityId") + .HasColumnType("bigint") + .HasColumnName("validator_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("ValidatorEntityId", "FromStateVersion"); + + b.HasIndex("ValidatorEntityId", "KeyType", "Key"); + + b.ToTable("validator_public_key_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalAccessControllerEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalAccessController); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalAccountEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalAccountComponent); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalConsensusManager", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalConsensusManager); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalFungibleResourceEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("Divisibility") + .HasColumnType("integer") + .HasColumnName("divisibility"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalFungibleResource); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalGenericComponentEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalGenericComponent); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalIdentityEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalIdentity); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalMultiResourcePoolEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalMultiResourcePool); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalNonFungibleResourceEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("NonFungibleIdType") + .HasColumnType("non_fungible_id_type") + .HasColumnName("non_fungible_id_type"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalNonFungibleResource); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalOneResourcePoolEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalOneResourcePool); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalPackageEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalPackage); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalTransactionTrackerEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalTransactionTracker); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalTwoResourcePoolEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalTwoResourcePool); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalValidatorEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("LockedOwnerStakeUnitVault") + .HasColumnType("bigint") + .HasColumnName("locked_owner_stake_unit_vault_entity_id"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.Property("PendingOwnerStakeUnitUnlockVault") + .HasColumnType("bigint") + .HasColumnName("pending_owner_stake_unit_unlock_vault_entity_id"); + + b.Property("PendingXrdWithdrawVault") + .HasColumnType("bigint") + .HasColumnName("pending_xrd_withdraw_vault_entity_id"); + + b.Property("StakeVaultEntityId") + .HasColumnType("bigint") + .HasColumnName("stake_vault_entity_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalValidator); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalFungibleVaultEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.Property("ResourceEntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.Property("RoyaltyVaultOfEntityId") + .HasColumnType("bigint") + .HasColumnName("royalty_vault_of_entity_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.InternalFungibleVault); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalGenericComponentEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.InternalGenericComponent); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalKeyValueStoreEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.InternalKeyValueStore); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalNonFungibleVaultEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.Property("ResourceEntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.InternalNonFungibleVault); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityFungibleResourceAggregatedVaultsHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregatedVaultsHistory"); + + b.Property("Balance") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("balance"); + + b.ToTable("entity_resource_aggregated_vaults_history"); + + b.HasDiscriminator().HasValue(ResourceType.Fungible); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityNonFungibleResourceAggregatedVaultsHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregatedVaultsHistory"); + + b.Property("TotalCount") + .HasColumnType("bigint") + .HasColumnName("total_count"); + + b.ToTable("entity_resource_aggregated_vaults_history"); + + b.HasDiscriminator().HasValue(ResourceType.NonFungible); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityFungibleVaultHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityVaultHistory"); + + b.Property("Balance") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("balance"); + + b.Property("IsRoyaltyVault") + .HasColumnType("boolean") + .HasColumnName("is_royalty_vault"); + + b.ToTable("entity_vault_history"); + + b.HasDiscriminator().HasValue(ResourceType.Fungible); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityNonFungibleVaultHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityVaultHistory"); + + b.Property>("NonFungibleIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("non_fungible_ids"); + + b.ToTable("entity_vault_history"); + + b.HasDiscriminator().HasValue(ResourceType.NonFungible); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.FlashLedgerTransaction", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); + + b.ToTable("ledger_transactions"); + + b.HasDiscriminator().HasValue(LedgerTransactionType.Flash); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GenesisLedgerTransaction", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); + + b.ToTable("ledger_transactions"); + + b.HasDiscriminator().HasValue(LedgerTransactionType.Genesis); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.RoundUpdateLedgerTransaction", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); + + b.ToTable("ledger_transactions"); + + b.HasDiscriminator().HasValue(LedgerTransactionType.RoundUpdate); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.UserLedgerTransaction", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); + + b.Property("IntentHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("intent_hash"); + + b.Property("Message") + .HasColumnType("jsonb") + .HasColumnName("message"); + + b.Property("PayloadHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("payload_hash"); + + b.Property("RawPayload") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("raw_payload"); + + b.Property("SignedIntentHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("signed_intent_hash"); + + b.HasIndex("IntentHash") + .HasFilter("intent_hash IS NOT NULL"); + + NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("IntentHash"), "hash"); + + b.ToTable("ledger_transactions"); + + b.HasDiscriminator().HasValue(LedgerTransactionType.User); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AffectedGlobalEntityTransactionMarker", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); + + b.Property("EntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.HasIndex("EntityId", "StateVersion") + .HasFilter("discriminator = 'affected_global_entity'"); + + b.ToTable("ledger_transaction_markers"); + + b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.AffectedGlobalEntity); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EventLedgerTransactionMarker", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); + + b.Property("EntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("EventType") + .HasColumnType("ledger_transaction_marker_event_type") + .HasColumnName("event_type"); + + b.Property("Quantity") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("quantity"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.HasIndex("EventType", "EntityId", "StateVersion") + .HasFilter("discriminator = 'event'"); + + b.ToTable("ledger_transaction_markers"); + + b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.Event); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ManifestAddressLedgerTransactionMarker", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); + + b.Property("EntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("OperationType") + .HasColumnType("ledger_transaction_marker_operation_type") + .HasColumnName("operation_type"); + + b.HasIndex("OperationType", "EntityId", "StateVersion") + .HasFilter("discriminator = 'manifest_address'"); + + b.ToTable("ledger_transaction_markers"); + + b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.ManifestAddress); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.OriginLedgerTransactionMarker", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); + + b.Property("OriginType") + .HasColumnType("ledger_transaction_marker_origin_type") + .HasColumnName("origin_type"); + + b.HasIndex("OriginType", "StateVersion") + .HasFilter("discriminator = 'origin'"); + + b.ToTable("ledger_transaction_markers"); + + b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.Origin); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.JsonStateHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.StateHistory"); + + b.Property("JsonState") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("json_state"); + + b.ToTable("state_history"); + + b.HasDiscriminator().HasValue(StateType.Json); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.SborStateHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.StateHistory"); + + b.Property("SborState") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("sbor_state"); + + b.Property("SborTypeKind") + .HasColumnType("sbor_type_kind") + .HasColumnName("sbor_type_kind"); + + b.Property("SchemaDefiningEntityId") + .HasColumnType("bigint") + .HasColumnName("schema_defining_entity_id"); + + b.Property("SchemaHash") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("schema_hash"); + + b.Property("TypeIndex") + .HasColumnType("bigint") + .HasColumnName("type_index"); + + b.ToTable("state_history"); + + b.HasDiscriminator().HasValue(StateType.Sbor); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", b => + { + b.OwnsOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionGatewayHandling", "GatewayHandling", b1 => + { + b1.Property("PendingTransactionId") + .HasColumnType("bigint"); + + b1.Property("AttemptedSubmissionToNodesCount") + .HasColumnType("integer") + .HasColumnName("node_submission_count"); + + b1.Property("FirstSubmittedToGatewayTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("first_submitted_to_gateway_timestamp"); + + b1.Property("HandlingStatusReason") + .HasColumnType("text") + .HasColumnName("handling_status_reason"); + + b1.Property("ResubmitFromTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("resubmit_from_timestamp"); + + b1.HasKey("PendingTransactionId"); + + b1.HasIndex("FirstSubmittedToGatewayTimestamp"); + + b1.HasIndex("ResubmitFromTimestamp"); + + b1.ToTable("pending_transactions"); + + b1.WithOwner() + .HasForeignKey("PendingTransactionId"); + }); + + b.OwnsOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionLedgerDetails", "LedgerDetails", b1 => + { + b1.Property("PendingTransactionId") + .HasColumnType("bigint"); + + b1.Property("CommitTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("commit_timestamp"); + + b1.Property("InitialRejectionReason") + .HasColumnType("text") + .HasColumnName("initial_rejection_reason"); + + b1.Property("IntentLedgerStatus") + .HasColumnType("pending_transaction_intent_ledger_status") + .HasColumnName("intent_status"); + + b1.Property("LatestRejectionReason") + .HasColumnType("text") + .HasColumnName("latest_rejection_reason"); + + b1.Property("LatestRejectionTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("latest_rejection_timestamp"); + + b1.Property("PayloadLedgerStatus") + .HasColumnType("pending_transaction_payload_ledger_status") + .HasColumnName("payload_status"); + + b1.HasKey("PendingTransactionId"); + + b1.ToTable("pending_transactions"); + + b1.WithOwner() + .HasForeignKey("PendingTransactionId"); + }); + + b.OwnsOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionNetworkDetails", "NetworkDetails", b1 => + { + b1.Property("PendingTransactionId") + .HasColumnType("bigint"); + + b1.Property("LastSubmitErrorTitle") + .HasColumnType("text") + .HasColumnName("last_submit_error"); + + b1.Property("LatestNodeSubmissionTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("latest_node_submission_timestamp"); + + b1.Property("LatestNodeSubmissionWasAccepted") + .HasColumnType("boolean") + .HasColumnName("latest_node_submission_was_accepted"); + + b1.Property("LatestSubmittedToNodeName") + .HasColumnType("text") + .HasColumnName("latest_submitted_to_node_name"); + + b1.HasKey("PendingTransactionId"); + + b1.ToTable("pending_transactions"); + + b1.WithOwner() + .HasForeignKey("PendingTransactionId"); + }); + + b.Navigation("GatewayHandling") + .IsRequired(); + + b.Navigation("LedgerDetails") + .IsRequired(); + + b.Navigation("NetworkDetails") + .IsRequired(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionPayload", b => + { + b.HasOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", "PendingTransaction") + .WithOne("Payload") + .HasForeignKey("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionPayload", "PendingTransactionId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("PendingTransaction"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorActiveSetHistory", b => + { + b.HasOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorPublicKeyHistory", "PublicKey") + .WithMany() + .HasForeignKey("ValidatorPublicKeyHistoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PublicKey"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", b => + { + b.Navigation("Payload"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117153350_AddPackageCodeAggregateHistoryTable.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117153350_AddPackageCodeAggregateHistoryTable.cs new file mode 100644 index 000000000..d90ffe50e --- /dev/null +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117153350_AddPackageCodeAggregateHistoryTable.cs @@ -0,0 +1,113 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace RadixDlt.NetworkGateway.PostgresIntegration.Migrations +{ + /// + public partial class AddPackageCodeAggregateHistoryTable : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "package_code_aggregate_history", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + from_state_version = table.Column(type: "bigint", nullable: false), + package_entity_id = table.Column(type: "bigint", nullable: false), + package_code_ids = table.Column>(type: "bigint[]", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_package_code_aggregate_history", x => x.id); + }); + + migrationBuilder.CreateIndex( + name: "IX_package_code_aggregate_history_package_entity_id_from_state~", + table: "package_code_aggregate_history", + columns: new[] { "package_entity_id", "from_state_version" }); + + migrationBuilder.Sql(@" +INSERT INTO package_code_aggregate_history (from_state_version, package_entity_id, package_code_ids) +SELECT MIN(from_state_version) from_state_version, package_entity_id, array_agg(id order by id asc) package_code_ids +FROM package_code_history +GROUP BY package_entity_id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "package_code_aggregate_history"); + } + } +} diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql index 0e5ed5d6f..c6b2e8084 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql @@ -1169,6 +1169,17 @@ BEGIN END IF; END $EF$; +DO $EF$ +BEGIN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240117093225_AddBlueprintHistoryAggregateTable') THEN + + INSERT INTO package_blueprint_aggregate_history (from_state_version, package_entity_id, package_blueprint_ids) + SELECT MIN(from_state_version) from_state_version, package_entity_id, array_agg(id order by id asc) package_blueprint_ids + FROM package_blueprint_history + GROUP BY package_entity_id + END IF; +END $EF$; + DO $EF$ BEGIN IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240117093225_AddBlueprintHistoryAggregateTable') THEN @@ -1178,3 +1189,46 @@ BEGIN END $EF$; COMMIT; +START TRANSACTION; + + +DO $EF$ +BEGIN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240117153350_AddPackageCodeAggregateHistoryTable') THEN + CREATE TABLE package_code_aggregate_history ( + id bigint GENERATED BY DEFAULT AS IDENTITY, + from_state_version bigint NOT NULL, + package_entity_id bigint NOT NULL, + package_code_ids bigint[] NOT NULL, + CONSTRAINT "PK_package_code_aggregate_history" PRIMARY KEY (id) + ); + END IF; +END $EF$; + +DO $EF$ +BEGIN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240117153350_AddPackageCodeAggregateHistoryTable') THEN + CREATE INDEX "IX_package_code_aggregate_history_package_entity_id_from_state~" ON package_code_aggregate_history (package_entity_id, from_state_version); + END IF; +END $EF$; + +DO $EF$ +BEGIN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240117153350_AddPackageCodeAggregateHistoryTable') THEN + + INSERT INTO package_code_aggregate_history (from_state_version, package_entity_id, package_code_ids) + SELECT MIN(from_state_version) from_state_version, package_entity_id, array_agg(id order by id asc) package_code_ids + FROM package_code_history + GROUP BY package_entity_id + END IF; +END $EF$; + +DO $EF$ +BEGIN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240117153350_AddPackageCodeAggregateHistoryTable') THEN + INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") + VALUES ('20240117153350_AddPackageCodeAggregateHistoryTable', '7.0.11'); + END IF; +END $EF$; +COMMIT; + diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs index c6c15ee2c..17d3b3522 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs @@ -1204,6 +1204,35 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("package_blueprint_history"); }); + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageCodeAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property>("PackageCodeIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("package_code_ids"); + + b.Property("PackageEntityId") + .HasColumnType("bigint") + .HasColumnName("package_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("PackageEntityId", "FromStateVersion"); + + b.ToTable("package_code_aggregate_history"); + }); + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageCodeHistory", b => { b.Property("Id") diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/PackageCodeAggregateHistory.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/PackageCodeAggregateHistory.cs new file mode 100644 index 000000000..2d05e5072 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/PackageCodeAggregateHistory.cs @@ -0,0 +1,86 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace RadixDlt.NetworkGateway.PostgresIntegration.Models; + +[Table("package_code_aggregate_history")] +internal class PackageCodeAggregateHistory +{ + [Key] + [Column("id")] + public long Id { get; set; } + + [Column("from_state_version")] + public long FromStateVersion { get; set; } + + [Column("package_entity_id")] + public long PackageEntityId { get; set; } + + [Column("package_code_ids")] + public List PackageCodeIds { get; set; } +} diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntityStateQuerier.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntityStateQuerier.cs index 88316e6ad..dce6081d0 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntityStateQuerier.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntityStateQuerier.cs @@ -217,9 +217,9 @@ public EntityStateQuerier( case GlobalPackageEntity pe: var packageRoyaltyVaultBalance = royaltyVaultsBalance?.SingleOrDefault(x => x.OwnerEntityId == pe.Id)?.Balance; - var codeHistory = packageCodeHistory[pe.Id]; var blueprints = new List(); var schemas = new List(); + var codeItems = new List(); if (packageBlueprintHistory.TryGetValue(pe.Id, out var packageBlueprints)) { @@ -231,7 +231,17 @@ public EntityStateQuerier( authTemplate: pb.AuthTemplate != null ? new JRaw(pb.AuthTemplate) : null, authTemplateIsLocked: pb.AuthTemplateIsLocked, royaltyConfig: pb.RoyaltyConfig != null ? new JRaw(pb.RoyaltyConfig) : null, - royaltyConfigIsLocked: pb.RoyaltyConfigIsLocked))); + royaltyConfigIsLocked: pb.RoyaltyConfigIsLocked + ))); + } + + if (packageCodeHistory.TryGetValue(pe.Id, out var packageCodes)) + { + codeItems.AddRange(packageCodes.Select(pb => new GatewayModel.PackageCodeCollectionItem( + vmType: pb.VmType.ToGatewayModel(), + codeHashHex: pb.CodeHash.ToHex(), + codeHex: pb.Code.ToHex() + ))); } if (packageSchemaHistory.TryGetValue(pe.Id, out var packageSchemas)) @@ -242,9 +252,10 @@ public EntityStateQuerier( } details = new GatewayModel.StateEntityDetailsResponsePackageDetails( - vmType: codeHistory.VmType.ToGatewayModel(), - codeHashHex: codeHistory.CodeHash.ToHex(), - codeHex: codeHistory.Code.ToHex(), + vmType: default, + codeHashHex: string.Empty, + codeHex: string.Empty, + codes: new GatewayModel.StateEntityDetailsResponsePackageDetailsCodeCollection(totalCount: codeItems.Count, items: codeItems), royaltyVaultBalance: packageRoyaltyVaultBalance != null ? TokenAmount.FromSubUnitsString(packageRoyaltyVaultBalance).ToString() : null, blueprints: new GatewayModel.StateEntityDetailsResponsePackageDetailsBlueprintCollection(totalCount: blueprints.Count, items: blueprints), schemas: new GatewayModel.StateEntityDetailsResponsePackageDetailsSchemaCollection(totalCount: schemas.Count, items: schemas)); @@ -912,7 +923,7 @@ LIMIT 1 activeInEpoch, metadataById[v.Id], effectiveFeeFactor - ); + ); }) .ToList(); @@ -1468,28 +1479,39 @@ ORDER BY array_position(mrpb.package_blueprint_ids, pbh.id) .ToDictionary(g => g.Key, g => g.ToArray()); } - private async Task> GetPackageCodeHistory(long[] packageEntityIds, GatewayModel.LedgerState ledgerState, CancellationToken token) + private async Task> GetPackageCodeHistory(long[] packageEntityIds, GatewayModel.LedgerState ledgerState, CancellationToken token) { if (!packageEntityIds.Any()) { - return new Dictionary(); + return new Dictionary(); } - return await _dbContext - .PackageCodeHistory - .FromSqlInterpolated($@" -WITH variables (entity_id) AS (SELECT UNNEST({packageEntityIds})) + return (await _dbContext + .PackageCodeHistory + .FromSqlInterpolated($@" +WITH variables (package_entity_id) AS (SELECT UNNEST({packageEntityIds})), +most_recent_package_codes AS +( + SELECT + package_code_ids + FROM variables var + INNER JOIN LATERAL ( + SELECT * + FROM package_code_aggregate_history + WHERE from_state_version <= {ledgerState.StateVersion} AND package_entity_id = var.package_entity_id + ORDER BY from_state_version DESC + LIMIT 1 + ) pcah ON TRUE +) SELECT pch.* -FROM variables -INNER JOIN LATERAL( - SELECT * - FROM package_code_history - WHERE package_entity_id = variables.entity_id AND from_state_version <= {ledgerState.StateVersion} - ORDER BY from_state_version DESC - LIMIT 1 -) pch ON true") - .AnnotateMetricName() - .ToDictionaryAsync(e => e.PackageEntityId, token); +FROM most_recent_package_codes mrpc +INNER JOIN package_code_history pch +ON pch.id = ANY(mrpc.package_code_ids) +ORDER BY array_position(mrpc.package_code_ids, pch.id)") + .AnnotateMetricName() + .ToListAsync(token)) + .GroupBy(b => b.PackageEntityId) + .ToDictionary(g => g.Key, g => g.ToArray()); } private async Task> GetPackageSchemaHistory(long[] packageEntityIds, GatewayModel.LedgerState ledgerState, CancellationToken token) From ebc9b491baaeaa073fa5e757550cd657170a63c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Pawelec?= Date: Thu, 18 Jan 2024 12:57:15 +0100 Subject: [PATCH 09/19] merge all transactions into one to guarante that they will be executed before protocol update. --- ...094622_AddFlashTransactionType.Designer.cs | 2348 ---------------- .../20240110094622_AddFlashTransactionType.cs | 90 - ...8_MoveVmTypeToCodeHistoryTable.Designer.cs | 2357 ---------------- ...0116140418_MoveVmTypeToCodeHistoryTable.cs | 106 - ...BlueprintHistoryAggregateTable.Designer.cs | 2386 ----------------- ...93225_AddBlueprintHistoryAggregateTable.cs | 113 - ...8114735_SupportProtocolUpdate.Designer.cs} | 4 +- ...> 20240118114735_SupportProtocolUpdate.cs} | 67 +- .../Migrations/IdempotentApplyMigrations.sql | 91 +- 9 files changed, 81 insertions(+), 7481 deletions(-) delete mode 100644 src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240110094622_AddFlashTransactionType.Designer.cs delete mode 100644 src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240110094622_AddFlashTransactionType.cs delete mode 100644 src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240116140418_MoveVmTypeToCodeHistoryTable.Designer.cs delete mode 100644 src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240116140418_MoveVmTypeToCodeHistoryTable.cs delete mode 100644 src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117093225_AddBlueprintHistoryAggregateTable.Designer.cs delete mode 100644 src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117093225_AddBlueprintHistoryAggregateTable.cs rename src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/{20240117153350_AddPackageCodeAggregateHistoryTable.Designer.cs => 20240118114735_SupportProtocolUpdate.Designer.cs} (99%) rename src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/{20240117153350_AddPackageCodeAggregateHistoryTable.cs => 20240118114735_SupportProtocolUpdate.cs} (64%) diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240110094622_AddFlashTransactionType.Designer.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240110094622_AddFlashTransactionType.Designer.cs deleted file mode 100644 index f3b8bcedd..000000000 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240110094622_AddFlashTransactionType.Designer.cs +++ /dev/null @@ -1,2348 +0,0 @@ -/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). - * - * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this - * file except in compliance with the License. You may obtain a copy of the License at: - * - * radixfoundation.org/licenses/LICENSE-v1 - * - * The Licensor hereby grants permission for the Canonical version of the Work to be - * published, distributed and used under or by reference to the Licensor’s trademark - * Radix ® and use of any unregistered trade names, logos or get-up. - * - * The Licensor provides the Work (and each Contributor provides its Contributions) on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, - * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, - * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. - * - * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create - * a distributed ledger it is your responsibility to test and validate the code, together - * with all logic and performance of that code under all foreseeable scenarios. - * - * The Licensor does not make or purport to make and hereby excludes liability for all - * and any representation, warranty or undertaking in any form whatsoever, whether express - * or implied, to any entity or person, including any representation, warranty or - * undertaking, as to the functionality security use, value or other characteristics of - * any distributed ledger nor in respect the functioning or value of any tokens which may - * be created stored or transferred using the Work. The Licensor does not warrant that the - * Work or any use of the Work complies with any law or regulation in any territory where - * it may be implemented or used or that it will be appropriate for any specific purpose. - * - * Neither the licensor nor any current or former employees, officers, directors, partners, - * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor - * shall be liable for any direct or indirect, special, incidental, consequential or other - * losses of any kind, in tort, contract or otherwise (including but not limited to loss - * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss - * of any economic or other opportunity of whatsoever nature or howsoever arising), arising - * out of or in connection with (without limitation of any use, misuse, of any ledger system - * or use made or its functionality or any performance or operation of any code or protocol - * caused by bugs or programming or logic errors or otherwise); - * - * A. any offer, purchase, holding, use, sale, exchange or transmission of any - * cryptographic keys, tokens or assets created, exchanged, stored or arising from any - * interaction with the Work; - * - * B. any failure in a transmission or loss of any token or assets keys or other digital - * artefacts due to errors in transmission; - * - * C. bugs, hacks, logic errors or faults in the Work or any communication; - * - * D. system software or apparatus including but not limited to losses caused by errors - * in holding or transmitting tokens by any third-party; - * - * E. breaches or failure of security including hacker attacks, loss or disclosure of - * password, loss of private key, unauthorised use or misuse of such passwords or keys; - * - * F. any losses including loss of anticipated savings or other benefits resulting from - * use of the Work or any changes to the Work (however implemented). - * - * You are solely responsible for; testing, validating and evaluation of all operation - * logic, functionality, security and appropriateness of using the Work for any commercial - * or non-commercial purpose and for any reproduction or redistribution by You of the - * Work. You assume all risks associated with Your use of the Work and the exercise of - * permissions under this License. - */ - -// -using System; -using System.Collections.Generic; -using System.Numerics; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using RadixDlt.NetworkGateway.Abstractions.Addressing; -using RadixDlt.NetworkGateway.Abstractions.Model; -using RadixDlt.NetworkGateway.PostgresIntegration; -using RadixDlt.NetworkGateway.PostgresIntegration.Models; - -#nullable disable - -namespace RadixDlt.NetworkGateway.PostgresIntegration.Migrations -{ - [DbContext(typeof(MigrationsDbContext))] - [Migration("20240110094622_AddFlashTransactionType")] - partial class AddFlashTransactionType - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "account_default_deposit_rule", new[] { "accept", "reject", "allow_existing" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "account_resource_preference_rule", new[] { "allowed", "disallowed" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "entity_type", new[] { "global_consensus_manager", "global_fungible_resource", "global_non_fungible_resource", "global_generic_component", "internal_generic_component", "global_account_component", "global_package", "internal_key_value_store", "internal_fungible_vault", "internal_non_fungible_vault", "global_validator", "global_access_controller", "global_identity", "global_one_resource_pool", "global_two_resource_pool", "global_multi_resource_pool", "global_transaction_tracker" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_event_type", new[] { "withdrawal", "deposit" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_operation_type", new[] { "resource_in_use", "account_deposited_into", "account_withdrawn_from" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_origin_type", new[] { "user", "epoch_change" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_type", new[] { "origin", "event", "manifest_address", "affected_global_entity" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_status", new[] { "succeeded", "failed" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_type", new[] { "genesis", "user", "round_update", "flash" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "module_id", new[] { "main", "metadata", "royalty", "role_assignment" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "non_fungible_id_type", new[] { "string", "integer", "bytes", "ruid" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "package_vm_type", new[] { "native", "scrypto_v1" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "pending_transaction_intent_ledger_status", new[] { "unknown", "committed", "commit_pending", "permanent_rejection", "possible_to_commit", "likely_but_not_certain_rejection" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "pending_transaction_payload_ledger_status", new[] { "unknown", "committed", "commit_pending", "clashing_commit", "permanently_rejected", "transiently_accepted", "transiently_rejected" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "public_key_type", new[] { "ecdsa_secp256k1", "eddsa_ed25519" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "resource_type", new[] { "fungible", "non_fungible" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "sbor_type_kind", new[] { "well_known", "schema_local" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "state_type", new[] { "json", "sbor" }); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AccountDefaultDepositRuleHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountEntityId") - .HasColumnType("bigint") - .HasColumnName("account_entity_id"); - - b.Property("DefaultDepositRule") - .HasColumnType("account_default_deposit_rule") - .HasColumnName("default_deposit_rule"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.HasKey("Id"); - - b.HasIndex("AccountEntityId", "FromStateVersion"); - - b.ToTable("account_default_deposit_rule_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AccountResourcePreferenceRuleHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountEntityId") - .HasColumnType("bigint") - .HasColumnName("account_entity_id"); - - b.Property("AccountResourcePreferenceRule") - .HasColumnType("account_resource_preference_rule") - .HasColumnName("account_resource_preference_rule"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("IsDeleted") - .HasColumnType("boolean") - .HasColumnName("is_deleted"); - - b.Property("ResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.HasKey("Id"); - - b.HasIndex("AccountEntityId", "ResourceEntityId", "FromStateVersion"); - - b.ToTable("account_resource_preference_rule_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ComponentMethodRoyaltyEntryHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("IsLocked") - .HasColumnType("boolean") - .HasColumnName("is_locked"); - - b.Property("MethodName") - .IsRequired() - .HasColumnType("text") - .HasColumnName("method_name"); - - b.Property("RoyaltyAmount") - .HasColumnType("jsonb") - .HasColumnName("royalty_amount"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "FromStateVersion"); - - b.HasIndex("EntityId", "MethodName", "FromStateVersion"); - - b.ToTable("component_method_royalty_entry_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Address") - .IsRequired() - .HasColumnType("text") - .HasColumnName("address"); - - b.Property>("AncestorIds") - .HasColumnType("bigint[]") - .HasColumnName("ancestor_ids"); - - b.Property>("CorrelatedEntities") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("correlated_entities"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("GlobalAncestorId") - .HasColumnType("bigint") - .HasColumnName("global_ancestor_id"); - - b.Property("IsGlobal") - .HasColumnType("boolean") - .HasColumnName("is_global"); - - b.Property("OwnerAncestorId") - .HasColumnType("bigint") - .HasColumnName("owner_ancestor_id"); - - b.Property("ParentAncestorId") - .HasColumnType("bigint") - .HasColumnName("parent_ancestor_id"); - - b.Property("discriminator") - .HasColumnType("entity_type"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("FromStateVersion") - .HasFilter("discriminator = 'global_validator'"); - - b.ToTable("entities"); - - b.HasDiscriminator("discriminator"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityMetadataAggregateHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property>("MetadataIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("metadata_ids"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "FromStateVersion"); - - b.ToTable("entity_metadata_aggregate_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityMetadataHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("IsDeleted") - .HasColumnType("boolean") - .HasColumnName("is_deleted"); - - b.Property("IsLocked") - .HasColumnType("boolean") - .HasColumnName("is_locked"); - - b.Property("Key") - .IsRequired() - .HasColumnType("text") - .HasColumnName("key"); - - b.Property("Value") - .HasColumnType("bytea") - .HasColumnName("value"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "Key", "FromStateVersion"); - - b.ToTable("entity_metadata_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregateHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property>("FungibleResourceEntityIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("fungible_resource_entity_ids"); - - b.Property>("FungibleResourceSignificantUpdateStateVersions") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("fungible_resource_significant_update_state_versions"); - - b.Property>("NonFungibleResourceEntityIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("non_fungible_resource_entity_ids"); - - b.Property>("NonFungibleResourceSignificantUpdateStateVersions") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("non_fungible_resource_significant_update_state_versions"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "FromStateVersion"); - - b.ToTable("entity_resource_aggregate_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregatedVaultsHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("ResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.Property("discriminator") - .HasColumnType("resource_type"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "ResourceEntityId", "FromStateVersion"); - - b.ToTable("entity_resource_aggregated_vaults_history"); - - b.HasDiscriminator("discriminator"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceVaultAggregateHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("ResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.Property>("VaultEntityIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("vault_entity_ids"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "ResourceEntityId", "FromStateVersion"); - - b.ToTable("entity_resource_vault_aggregate_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityRoleAssignmentsAggregateHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property>("EntryIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("entry_ids"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("OwnerRoleId") - .HasColumnType("bigint") - .HasColumnName("owner_role_id"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "FromStateVersion"); - - b.ToTable("entity_role_assignments_aggregate_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityRoleAssignmentsEntryHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("IsDeleted") - .HasColumnType("boolean") - .HasColumnName("is_deleted"); - - b.Property("KeyModule") - .HasColumnType("module_id") - .HasColumnName("key_module"); - - b.Property("KeyRole") - .IsRequired() - .HasColumnType("text") - .HasColumnName("key_role"); - - b.Property("RoleAssignments") - .HasColumnType("jsonb") - .HasColumnName("role_assignments"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "KeyRole", "KeyModule", "FromStateVersion"); - - b.ToTable("entity_role_assignments_entry_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityRoleAssignmentsOwnerRoleHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("RoleAssignments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("role_assignments"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "FromStateVersion"); - - b.ToTable("entity_role_assignments_owner_role_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityVaultHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("GlobalEntityId") - .HasColumnType("bigint") - .HasColumnName("global_entity_id"); - - b.Property("OwnerEntityId") - .HasColumnType("bigint") - .HasColumnName("owner_entity_id"); - - b.Property("ResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.Property("VaultEntityId") - .HasColumnType("bigint") - .HasColumnName("vault_entity_id"); - - b.Property("discriminator") - .HasColumnType("resource_type"); - - b.HasKey("Id"); - - b.HasIndex("GlobalEntityId", "FromStateVersion") - .HasFilter("is_royalty_vault = true"); - - b.HasIndex("OwnerEntityId", "FromStateVersion") - .HasFilter("is_royalty_vault = true"); - - b.HasIndex("VaultEntityId", "FromStateVersion") - .HasFilter("discriminator = 'non_fungible'"); - - b.HasIndex("GlobalEntityId", "VaultEntityId", "FromStateVersion"); - - b.HasIndex("Id", "ResourceEntityId", "FromStateVersion"); - - b.HasIndex("OwnerEntityId", "VaultEntityId", "FromStateVersion"); - - b.ToTable("entity_vault_history"); - - b.HasDiscriminator("discriminator"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.KeyValueStoreEntryHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("IsDeleted") - .HasColumnType("boolean") - .HasColumnName("is_deleted"); - - b.Property("IsLocked") - .HasColumnType("boolean") - .HasColumnName("is_locked"); - - b.Property("Key") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("key"); - - b.Property("KeyValueStoreEntityId") - .HasColumnType("bigint") - .HasColumnName("key_value_store_entity_id"); - - b.Property("Value") - .HasColumnType("bytea") - .HasColumnName("value"); - - b.HasKey("Id"); - - b.HasIndex("KeyValueStoreEntityId", "Key", "FromStateVersion"); - - b.ToTable("key_value_store_entry_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.KeyValueStoreSchemaHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("KeySborTypeKind") - .HasColumnType("sbor_type_kind") - .HasColumnName("key_sbor_type_kind"); - - b.Property("KeySchemaDefiningEntityId") - .HasColumnType("bigint") - .HasColumnName("key_schema_defining_entity_id"); - - b.Property("KeySchemaHash") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("key_schema_hash"); - - b.Property("KeyTypeIndex") - .HasColumnType("bigint") - .HasColumnName("key_type_index"); - - b.Property("KeyValueStoreEntityId") - .HasColumnType("bigint") - .HasColumnName("key_value_store_entity_id"); - - b.Property("ValueSborTypeKind") - .HasColumnType("sbor_type_kind") - .HasColumnName("value_sbor_type_kind"); - - b.Property("ValueSchemaDefiningEntityId") - .HasColumnType("bigint") - .HasColumnName("value_schema_defining_entity_id"); - - b.Property("ValueSchemaHash") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("value_schema_hash"); - - b.Property("ValueTypeIndex") - .HasColumnType("bigint") - .HasColumnName("value_type_index"); - - b.HasKey("Id"); - - b.HasIndex("KeyValueStoreEntityId", "FromStateVersion"); - - b.ToTable("key_value_store_schema_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction", b => - { - b.Property("StateVersion") - .HasColumnType("bigint") - .HasColumnName("state_version"); - - b.Property("AffectedGlobalEntities") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("affected_global_entities"); - - b.Property("BalanceChanges") - .HasColumnType("jsonb") - .HasColumnName("balance_changes"); - - b.Property("CreatedTimestamp") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_timestamp"); - - b.Property("Epoch") - .HasColumnType("bigint") - .HasColumnName("epoch"); - - b.Property("FeePaid") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("fee_paid"); - - b.Property("IndexInEpoch") - .HasColumnType("bigint") - .HasColumnName("index_in_epoch"); - - b.Property("IndexInRound") - .HasColumnType("bigint") - .HasColumnName("index_in_round"); - - b.Property("NormalizedRoundTimestamp") - .HasColumnType("timestamp with time zone") - .HasColumnName("normalized_round_timestamp"); - - b.Property("ReceiptCostingParameters") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("receipt_costing_parameters"); - - b.Property("ReceiptErrorMessage") - .HasColumnType("text") - .HasColumnName("receipt_error_message"); - - b.Property("ReceiptEventEmitters") - .IsRequired() - .HasColumnType("jsonb[]") - .HasColumnName("receipt_event_emitters"); - - b.Property("ReceiptEventNames") - .IsRequired() - .HasColumnType("text[]") - .HasColumnName("receipt_event_names"); - - b.Property("ReceiptEventSborTypeKinds") - .IsRequired() - .HasColumnType("sbor_type_kind[]") - .HasColumnName("receipt_event_sbor_type_kinds"); - - b.Property("ReceiptEventSbors") - .IsRequired() - .HasColumnType("bytea[]") - .HasColumnName("receipt_event_sbors"); - - b.Property("ReceiptEventSchemaEntityIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("receipt_event_schema_entity_ids"); - - b.Property("ReceiptEventSchemaHashes") - .IsRequired() - .HasColumnType("bytea[]") - .HasColumnName("receipt_event_schema_hashes"); - - b.Property("ReceiptEventTypeIndexes") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("receipt_event_type_indexes"); - - b.Property("ReceiptFeeDestination") - .HasColumnType("jsonb") - .HasColumnName("receipt_fee_destination"); - - b.Property("ReceiptFeeSource") - .HasColumnType("jsonb") - .HasColumnName("receipt_fee_source"); - - b.Property("ReceiptFeeSummary") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("receipt_fee_summary"); - - b.Property("ReceiptNextEpoch") - .HasColumnType("jsonb") - .HasColumnName("receipt_next_epoch"); - - b.Property("ReceiptOutput") - .HasColumnType("jsonb") - .HasColumnName("receipt_output"); - - b.Property("ReceiptStateUpdates") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("receipt_state_updates"); - - b.Property("ReceiptStatus") - .HasColumnType("ledger_transaction_status") - .HasColumnName("receipt_status"); - - b.Property("ReceiptTreeHash") - .IsRequired() - .HasColumnType("text") - .HasColumnName("receipt_tree_hash"); - - b.Property("RoundInEpoch") - .HasColumnType("bigint") - .HasColumnName("round_in_epoch"); - - b.Property("RoundTimestamp") - .HasColumnType("timestamp with time zone") - .HasColumnName("round_timestamp"); - - b.Property("StateTreeHash") - .IsRequired() - .HasColumnType("text") - .HasColumnName("state_tree_hash"); - - b.Property("TipPaid") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("tip_paid"); - - b.Property("TransactionTreeHash") - .IsRequired() - .HasColumnType("text") - .HasColumnName("transaction_tree_hash"); - - b.Property("discriminator") - .HasColumnType("ledger_transaction_type"); - - b.HasKey("StateVersion"); - - b.HasIndex("RoundTimestamp"); - - b.HasIndex("Epoch", "RoundInEpoch") - .IsUnique() - .HasFilter("index_in_round = 0"); - - b.ToTable("ledger_transactions"); - - b.HasDiscriminator("discriminator"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("StateVersion") - .HasColumnType("bigint") - .HasColumnName("state_version"); - - b.Property("discriminator") - .HasColumnType("ledger_transaction_marker_type"); - - b.HasKey("Id"); - - b.HasIndex("StateVersion"); - - b.ToTable("ledger_transaction_markers"); - - b.HasDiscriminator("discriminator"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NetworkConfiguration", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id"); - - b.Property("AddressTypeDefinitions") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("address_type_definitions"); - - b.Property("GenesisEpoch") - .HasColumnType("bigint") - .HasColumnName("genesis_epoch"); - - b.Property("GenesisRound") - .HasColumnType("bigint") - .HasColumnName("genesis_round"); - - b.Property("HrpDefinition") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("hrp_definition"); - - b.Property("NetworkHrpSuffix") - .IsRequired() - .HasColumnType("text") - .HasColumnName("network_hrp_suffix"); - - b.Property("NetworkId") - .HasColumnType("smallint") - .HasColumnName("network_id"); - - b.Property("NetworkName") - .IsRequired() - .HasColumnType("text") - .HasColumnName("network_name"); - - b.Property("WellKnownAddresses") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("well_known_addresses"); - - b.HasKey("Id"); - - b.ToTable("network_configuration"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdData", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("NonFungibleId") - .IsRequired() - .HasColumnType("text") - .HasColumnName("non_fungible_id"); - - b.Property("NonFungibleResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("non_fungible_resource_entity_id"); - - b.HasKey("Id"); - - b.HasIndex("NonFungibleResourceEntityId", "FromStateVersion"); - - b.HasIndex("NonFungibleResourceEntityId", "NonFungibleId", "FromStateVersion") - .IsUnique(); - - b.ToTable("non_fungible_id_data"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdDataHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Data") - .HasColumnType("bytea") - .HasColumnName("data"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("IsDeleted") - .HasColumnType("boolean") - .HasColumnName("is_deleted"); - - b.Property("IsLocked") - .HasColumnType("boolean") - .HasColumnName("is_locked"); - - b.Property("NonFungibleIdDataId") - .HasColumnType("bigint") - .HasColumnName("non_fungible_id_data_id"); - - b.HasKey("Id"); - - b.HasIndex("NonFungibleIdDataId", "FromStateVersion"); - - b.ToTable("non_fungible_id_data_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdLocationHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("NonFungibleIdDataId") - .HasColumnType("bigint") - .HasColumnName("non_fungible_id_data_id"); - - b.Property("VaultEntityId") - .HasColumnType("bigint") - .HasColumnName("vault_entity_id"); - - b.HasKey("Id"); - - b.HasIndex("NonFungibleIdDataId", "FromStateVersion"); - - b.ToTable("non_fungible_id_location_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdStoreHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property>("NonFungibleIdDataIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("non_fungible_id_data_ids"); - - b.Property("NonFungibleResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("non_fungible_resource_entity_id"); - - b.HasKey("Id"); - - b.HasIndex("NonFungibleResourceEntityId", "FromStateVersion"); - - b.ToTable("non_fungible_id_store_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleSchemaHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("ResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.Property("SborTypeKind") - .HasColumnType("sbor_type_kind") - .HasColumnName("sbor_type_kind"); - - b.Property("SchemaDefiningEntityId") - .HasColumnType("bigint") - .HasColumnName("schema_defining_entity_id"); - - b.Property("SchemaHash") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("schema_hash"); - - b.Property("TypeIndex") - .HasColumnType("bigint") - .HasColumnName("type_index"); - - b.HasKey("Id"); - - b.HasIndex("ResourceEntityId", "FromStateVersion"); - - b.ToTable("non_fungible_schema_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageBlueprintHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AuthTemplate") - .HasColumnType("jsonb") - .HasColumnName("auth_template"); - - b.Property("AuthTemplateIsLocked") - .HasColumnType("boolean") - .HasColumnName("auth_template_is_locked"); - - b.Property("Definition") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("definition"); - - b.Property>("DependantEntityIds") - .HasColumnType("bigint[]") - .HasColumnName("dependant_entity_ids"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text") - .HasColumnName("name"); - - b.Property("PackageEntityId") - .HasColumnType("bigint") - .HasColumnName("package_entity_id"); - - b.Property("RoyaltyConfig") - .HasColumnType("jsonb") - .HasColumnName("royalty_config"); - - b.Property("RoyaltyConfigIsLocked") - .HasColumnType("boolean") - .HasColumnName("royalty_config_is_locked"); - - b.Property("Version") - .IsRequired() - .HasColumnType("text") - .HasColumnName("version"); - - b.HasKey("Id"); - - b.HasIndex("PackageEntityId", "FromStateVersion"); - - b.HasIndex("PackageEntityId", "Name", "Version", "FromStateVersion"); - - b.ToTable("package_blueprint_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageCodeHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Code") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("code"); - - b.Property("CodeHash") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("code_hash"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("PackageEntityId") - .HasColumnType("bigint") - .HasColumnName("package_entity_id"); - - b.HasKey("Id"); - - b.HasIndex("PackageEntityId", "FromStateVersion"); - - b.ToTable("package_code_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EndEpochExclusive") - .HasColumnType("numeric(20,0)") - .HasColumnName("end_epoch_exclusive"); - - b.Property("IntentHash") - .IsRequired() - .HasColumnType("text") - .HasColumnName("intent_hash"); - - b.Property("PayloadHash") - .IsRequired() - .HasColumnType("text") - .HasColumnName("payload_hash"); - - b.Property("PayloadId") - .HasColumnType("bigint") - .HasColumnName("payload_id"); - - b.Property("VersionControl") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("Id"); - - b.HasIndex("IntentHash"); - - b.HasIndex("PayloadHash") - .IsUnique(); - - b.ToTable("pending_transactions"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionPayload", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("NotarizedTransactionBlob") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("notarized_transaction_blob"); - - b.Property("PendingTransactionId") - .HasColumnType("bigint") - .HasColumnName("pending_transaction_id"); - - b.HasKey("Id"); - - b.HasIndex("PendingTransactionId") - .IsUnique(); - - b.ToTable("pending_transaction_payloads"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ResourceEntitySupplyHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("ResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.Property("TotalBurned") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("total_burned"); - - b.Property("TotalMinted") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("total_minted"); - - b.Property("TotalSupply") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("total_supply"); - - b.HasKey("Id"); - - b.HasIndex("ResourceEntityId", "FromStateVersion"); - - b.ToTable("resource_entity_supply_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.SchemaHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("Schema") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("schema"); - - b.Property("SchemaHash") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("schema_hash"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "FromStateVersion"); - - b.HasIndex("SchemaHash", "FromStateVersion"); - - b.ToTable("schema_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.StateHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("discriminator") - .HasColumnType("state_type"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "FromStateVersion"); - - b.ToTable("state_history"); - - b.HasDiscriminator("discriminator"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorActiveSetHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Epoch") - .HasColumnType("bigint") - .HasColumnName("epoch"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("Stake") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("stake"); - - b.Property("ValidatorPublicKeyHistoryId") - .HasColumnType("bigint") - .HasColumnName("validator_public_key_history_id"); - - b.HasKey("Id"); - - b.HasIndex("Epoch"); - - b.HasIndex("FromStateVersion"); - - b.HasIndex("ValidatorPublicKeyHistoryId"); - - b.ToTable("validator_active_set_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorEmissionStatistics", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EpochNumber") - .HasColumnType("bigint") - .HasColumnName("epoch_number"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("ProposalsMade") - .HasColumnType("bigint") - .HasColumnName("proposals_made"); - - b.Property("ProposalsMissed") - .HasColumnType("bigint") - .HasColumnName("proposals_missed"); - - b.Property("ValidatorEntityId") - .HasColumnType("bigint") - .HasColumnName("validator_entity_id"); - - b.HasKey("Id"); - - b.HasIndex("ValidatorEntityId", "EpochNumber"); - - b.ToTable("validator_emission_statistics"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorPublicKeyHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("Key") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("key"); - - b.Property("KeyType") - .HasColumnType("public_key_type") - .HasColumnName("key_type"); - - b.Property("ValidatorEntityId") - .HasColumnType("bigint") - .HasColumnName("validator_entity_id"); - - b.HasKey("Id"); - - b.HasIndex("ValidatorEntityId", "FromStateVersion"); - - b.HasIndex("ValidatorEntityId", "KeyType", "Key"); - - b.ToTable("validator_public_key_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalAccessControllerEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalAccessController); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalAccountEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalAccountComponent); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalConsensusManager", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalConsensusManager); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalFungibleResourceEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("Divisibility") - .HasColumnType("integer") - .HasColumnName("divisibility"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalFungibleResource); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalGenericComponentEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalGenericComponent); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalIdentityEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalIdentity); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalMultiResourcePoolEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalMultiResourcePool); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalNonFungibleResourceEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("NonFungibleIdType") - .HasColumnType("non_fungible_id_type") - .HasColumnName("non_fungible_id_type"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalNonFungibleResource); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalOneResourcePoolEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalOneResourcePool); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalPackageEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.Property("VmType") - .HasColumnType("package_vm_type") - .HasColumnName("vm_type"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalPackage); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalTransactionTrackerEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalTransactionTracker); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalTwoResourcePoolEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalTwoResourcePool); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalValidatorEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("LockedOwnerStakeUnitVault") - .HasColumnType("bigint") - .HasColumnName("locked_owner_stake_unit_vault_entity_id"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.Property("PendingOwnerStakeUnitUnlockVault") - .HasColumnType("bigint") - .HasColumnName("pending_owner_stake_unit_unlock_vault_entity_id"); - - b.Property("PendingXrdWithdrawVault") - .HasColumnType("bigint") - .HasColumnName("pending_xrd_withdraw_vault_entity_id"); - - b.Property("StakeVaultEntityId") - .HasColumnType("bigint") - .HasColumnName("stake_vault_entity_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalValidator); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalFungibleVaultEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.Property("ResourceEntityId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.Property("RoyaltyVaultOfEntityId") - .HasColumnType("bigint") - .HasColumnName("royalty_vault_of_entity_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.InternalFungibleVault); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalGenericComponentEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.InternalGenericComponent); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalKeyValueStoreEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.InternalKeyValueStore); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalNonFungibleVaultEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.Property("ResourceEntityId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.InternalNonFungibleVault); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityFungibleResourceAggregatedVaultsHistory", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregatedVaultsHistory"); - - b.Property("Balance") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("balance"); - - b.ToTable("entity_resource_aggregated_vaults_history"); - - b.HasDiscriminator().HasValue(ResourceType.Fungible); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityNonFungibleResourceAggregatedVaultsHistory", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregatedVaultsHistory"); - - b.Property("TotalCount") - .HasColumnType("bigint") - .HasColumnName("total_count"); - - b.ToTable("entity_resource_aggregated_vaults_history"); - - b.HasDiscriminator().HasValue(ResourceType.NonFungible); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityFungibleVaultHistory", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityVaultHistory"); - - b.Property("Balance") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("balance"); - - b.Property("IsRoyaltyVault") - .HasColumnType("boolean") - .HasColumnName("is_royalty_vault"); - - b.ToTable("entity_vault_history"); - - b.HasDiscriminator().HasValue(ResourceType.Fungible); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityNonFungibleVaultHistory", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityVaultHistory"); - - b.Property>("NonFungibleIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("non_fungible_ids"); - - b.ToTable("entity_vault_history"); - - b.HasDiscriminator().HasValue(ResourceType.NonFungible); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GenesisLedgerTransaction", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); - - b.ToTable("ledger_transactions"); - - b.HasDiscriminator().HasValue(LedgerTransactionType.Flash); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.RoundUpdateLedgerTransaction", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); - - b.ToTable("ledger_transactions"); - - b.HasDiscriminator().HasValue(LedgerTransactionType.RoundUpdate); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.UserLedgerTransaction", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); - - b.Property("IntentHash") - .IsRequired() - .HasColumnType("text") - .HasColumnName("intent_hash"); - - b.Property("Message") - .HasColumnType("jsonb") - .HasColumnName("message"); - - b.Property("PayloadHash") - .IsRequired() - .HasColumnType("text") - .HasColumnName("payload_hash"); - - b.Property("RawPayload") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("raw_payload"); - - b.Property("SignedIntentHash") - .IsRequired() - .HasColumnType("text") - .HasColumnName("signed_intent_hash"); - - b.HasIndex("IntentHash") - .HasFilter("intent_hash IS NOT NULL"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("IntentHash"), "hash"); - - b.ToTable("ledger_transactions"); - - b.HasDiscriminator().HasValue(LedgerTransactionType.User); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AffectedGlobalEntityTransactionMarker", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); - - b.Property("EntityId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.HasIndex("EntityId", "StateVersion") - .HasFilter("discriminator = 'affected_global_entity'"); - - b.ToTable("ledger_transaction_markers"); - - b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.AffectedGlobalEntity); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EventLedgerTransactionMarker", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); - - b.Property("EntityId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("EventType") - .HasColumnType("ledger_transaction_marker_event_type") - .HasColumnName("event_type"); - - b.Property("Quantity") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("quantity"); - - b.Property("ResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.HasIndex("EventType", "EntityId", "StateVersion") - .HasFilter("discriminator = 'event'"); - - b.ToTable("ledger_transaction_markers"); - - b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.Event); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ManifestAddressLedgerTransactionMarker", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); - - b.Property("EntityId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("OperationType") - .HasColumnType("ledger_transaction_marker_operation_type") - .HasColumnName("operation_type"); - - b.HasIndex("OperationType", "EntityId", "StateVersion") - .HasFilter("discriminator = 'manifest_address'"); - - b.ToTable("ledger_transaction_markers"); - - b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.ManifestAddress); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.OriginLedgerTransactionMarker", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); - - b.Property("OriginType") - .HasColumnType("ledger_transaction_marker_origin_type") - .HasColumnName("origin_type"); - - b.HasIndex("OriginType", "StateVersion") - .HasFilter("discriminator = 'origin'"); - - b.ToTable("ledger_transaction_markers"); - - b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.Origin); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.JsonStateHistory", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.StateHistory"); - - b.Property("JsonState") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("json_state"); - - b.ToTable("state_history"); - - b.HasDiscriminator().HasValue(StateType.Json); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.SborStateHistory", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.StateHistory"); - - b.Property("SborState") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("sbor_state"); - - b.Property("SborTypeKind") - .HasColumnType("sbor_type_kind") - .HasColumnName("sbor_type_kind"); - - b.Property("SchemaDefiningEntityId") - .HasColumnType("bigint") - .HasColumnName("schema_defining_entity_id"); - - b.Property("SchemaHash") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("schema_hash"); - - b.Property("TypeIndex") - .HasColumnType("bigint") - .HasColumnName("type_index"); - - b.ToTable("state_history"); - - b.HasDiscriminator().HasValue(StateType.Sbor); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", b => - { - b.OwnsOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionGatewayHandling", "GatewayHandling", b1 => - { - b1.Property("PendingTransactionId") - .HasColumnType("bigint"); - - b1.Property("AttemptedSubmissionToNodesCount") - .HasColumnType("integer") - .HasColumnName("node_submission_count"); - - b1.Property("FirstSubmittedToGatewayTimestamp") - .HasColumnType("timestamp with time zone") - .HasColumnName("first_submitted_to_gateway_timestamp"); - - b1.Property("HandlingStatusReason") - .HasColumnType("text") - .HasColumnName("handling_status_reason"); - - b1.Property("ResubmitFromTimestamp") - .HasColumnType("timestamp with time zone") - .HasColumnName("resubmit_from_timestamp"); - - b1.HasKey("PendingTransactionId"); - - b1.HasIndex("FirstSubmittedToGatewayTimestamp"); - - b1.HasIndex("ResubmitFromTimestamp"); - - b1.ToTable("pending_transactions"); - - b1.WithOwner() - .HasForeignKey("PendingTransactionId"); - }); - - b.OwnsOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionLedgerDetails", "LedgerDetails", b1 => - { - b1.Property("PendingTransactionId") - .HasColumnType("bigint"); - - b1.Property("CommitTimestamp") - .HasColumnType("timestamp with time zone") - .HasColumnName("commit_timestamp"); - - b1.Property("InitialRejectionReason") - .HasColumnType("text") - .HasColumnName("initial_rejection_reason"); - - b1.Property("IntentLedgerStatus") - .HasColumnType("pending_transaction_intent_ledger_status") - .HasColumnName("intent_status"); - - b1.Property("LatestRejectionReason") - .HasColumnType("text") - .HasColumnName("latest_rejection_reason"); - - b1.Property("LatestRejectionTimestamp") - .HasColumnType("timestamp with time zone") - .HasColumnName("latest_rejection_timestamp"); - - b1.Property("PayloadLedgerStatus") - .HasColumnType("pending_transaction_payload_ledger_status") - .HasColumnName("payload_status"); - - b1.HasKey("PendingTransactionId"); - - b1.ToTable("pending_transactions"); - - b1.WithOwner() - .HasForeignKey("PendingTransactionId"); - }); - - b.OwnsOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionNetworkDetails", "NetworkDetails", b1 => - { - b1.Property("PendingTransactionId") - .HasColumnType("bigint"); - - b1.Property("LastSubmitErrorTitle") - .HasColumnType("text") - .HasColumnName("last_submit_error"); - - b1.Property("LatestNodeSubmissionTimestamp") - .HasColumnType("timestamp with time zone") - .HasColumnName("latest_node_submission_timestamp"); - - b1.Property("LatestNodeSubmissionWasAccepted") - .HasColumnType("boolean") - .HasColumnName("latest_node_submission_was_accepted"); - - b1.Property("LatestSubmittedToNodeName") - .HasColumnType("text") - .HasColumnName("latest_submitted_to_node_name"); - - b1.HasKey("PendingTransactionId"); - - b1.ToTable("pending_transactions"); - - b1.WithOwner() - .HasForeignKey("PendingTransactionId"); - }); - - b.Navigation("GatewayHandling") - .IsRequired(); - - b.Navigation("LedgerDetails") - .IsRequired(); - - b.Navigation("NetworkDetails") - .IsRequired(); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionPayload", b => - { - b.HasOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", "PendingTransaction") - .WithOne("Payload") - .HasForeignKey("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionPayload", "PendingTransactionId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("PendingTransaction"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorActiveSetHistory", b => - { - b.HasOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorPublicKeyHistory", "PublicKey") - .WithMany() - .HasForeignKey("ValidatorPublicKeyHistoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PublicKey"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", b => - { - b.Navigation("Payload"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240110094622_AddFlashTransactionType.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240110094622_AddFlashTransactionType.cs deleted file mode 100644 index 029423f97..000000000 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240110094622_AddFlashTransactionType.cs +++ /dev/null @@ -1,90 +0,0 @@ -/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). - * - * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this - * file except in compliance with the License. You may obtain a copy of the License at: - * - * radixfoundation.org/licenses/LICENSE-v1 - * - * The Licensor hereby grants permission for the Canonical version of the Work to be - * published, distributed and used under or by reference to the Licensor’s trademark - * Radix ® and use of any unregistered trade names, logos or get-up. - * - * The Licensor provides the Work (and each Contributor provides its Contributions) on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, - * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, - * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. - * - * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create - * a distributed ledger it is your responsibility to test and validate the code, together - * with all logic and performance of that code under all foreseeable scenarios. - * - * The Licensor does not make or purport to make and hereby excludes liability for all - * and any representation, warranty or undertaking in any form whatsoever, whether express - * or implied, to any entity or person, including any representation, warranty or - * undertaking, as to the functionality security use, value or other characteristics of - * any distributed ledger nor in respect the functioning or value of any tokens which may - * be created stored or transferred using the Work. The Licensor does not warrant that the - * Work or any use of the Work complies with any law or regulation in any territory where - * it may be implemented or used or that it will be appropriate for any specific purpose. - * - * Neither the licensor nor any current or former employees, officers, directors, partners, - * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor - * shall be liable for any direct or indirect, special, incidental, consequential or other - * losses of any kind, in tort, contract or otherwise (including but not limited to loss - * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss - * of any economic or other opportunity of whatsoever nature or howsoever arising), arising - * out of or in connection with (without limitation of any use, misuse, of any ledger system - * or use made or its functionality or any performance or operation of any code or protocol - * caused by bugs or programming or logic errors or otherwise); - * - * A. any offer, purchase, holding, use, sale, exchange or transmission of any - * cryptographic keys, tokens or assets created, exchanged, stored or arising from any - * interaction with the Work; - * - * B. any failure in a transmission or loss of any token or assets keys or other digital - * artefacts due to errors in transmission; - * - * C. bugs, hacks, logic errors or faults in the Work or any communication; - * - * D. system software or apparatus including but not limited to losses caused by errors - * in holding or transmitting tokens by any third-party; - * - * E. breaches or failure of security including hacker attacks, loss or disclosure of - * password, loss of private key, unauthorised use or misuse of such passwords or keys; - * - * F. any losses including loss of anticipated savings or other benefits resulting from - * use of the Work or any changes to the Work (however implemented). - * - * You are solely responsible for; testing, validating and evaluation of all operation - * logic, functionality, security and appropriateness of using the Work for any commercial - * or non-commercial purpose and for any reproduction or redistribution by You of the - * Work. You assume all risks associated with Your use of the Work and the exercise of - * permissions under this License. - */ - -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace RadixDlt.NetworkGateway.PostgresIntegration.Migrations -{ - /// - public partial class AddFlashTransactionType : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterDatabase() - .Annotation("Npgsql:Enum:ledger_transaction_type", "genesis,user,round_update,flash") - .OldAnnotation("Npgsql:Enum:ledger_transaction_type", "genesis,user,round_update"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterDatabase() - .Annotation("Npgsql:Enum:ledger_transaction_type", "genesis,user,round_update") - .OldAnnotation("Npgsql:Enum:ledger_transaction_type", "genesis,user,round_update,flash"); - } - } -} diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240116140418_MoveVmTypeToCodeHistoryTable.Designer.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240116140418_MoveVmTypeToCodeHistoryTable.Designer.cs deleted file mode 100644 index 12d9e1ef8..000000000 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240116140418_MoveVmTypeToCodeHistoryTable.Designer.cs +++ /dev/null @@ -1,2357 +0,0 @@ -/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). - * - * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this - * file except in compliance with the License. You may obtain a copy of the License at: - * - * radixfoundation.org/licenses/LICENSE-v1 - * - * The Licensor hereby grants permission for the Canonical version of the Work to be - * published, distributed and used under or by reference to the Licensor’s trademark - * Radix ® and use of any unregistered trade names, logos or get-up. - * - * The Licensor provides the Work (and each Contributor provides its Contributions) on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, - * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, - * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. - * - * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create - * a distributed ledger it is your responsibility to test and validate the code, together - * with all logic and performance of that code under all foreseeable scenarios. - * - * The Licensor does not make or purport to make and hereby excludes liability for all - * and any representation, warranty or undertaking in any form whatsoever, whether express - * or implied, to any entity or person, including any representation, warranty or - * undertaking, as to the functionality security use, value or other characteristics of - * any distributed ledger nor in respect the functioning or value of any tokens which may - * be created stored or transferred using the Work. The Licensor does not warrant that the - * Work or any use of the Work complies with any law or regulation in any territory where - * it may be implemented or used or that it will be appropriate for any specific purpose. - * - * Neither the licensor nor any current or former employees, officers, directors, partners, - * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor - * shall be liable for any direct or indirect, special, incidental, consequential or other - * losses of any kind, in tort, contract or otherwise (including but not limited to loss - * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss - * of any economic or other opportunity of whatsoever nature or howsoever arising), arising - * out of or in connection with (without limitation of any use, misuse, of any ledger system - * or use made or its functionality or any performance or operation of any code or protocol - * caused by bugs or programming or logic errors or otherwise); - * - * A. any offer, purchase, holding, use, sale, exchange or transmission of any - * cryptographic keys, tokens or assets created, exchanged, stored or arising from any - * interaction with the Work; - * - * B. any failure in a transmission or loss of any token or assets keys or other digital - * artefacts due to errors in transmission; - * - * C. bugs, hacks, logic errors or faults in the Work or any communication; - * - * D. system software or apparatus including but not limited to losses caused by errors - * in holding or transmitting tokens by any third-party; - * - * E. breaches or failure of security including hacker attacks, loss or disclosure of - * password, loss of private key, unauthorised use or misuse of such passwords or keys; - * - * F. any losses including loss of anticipated savings or other benefits resulting from - * use of the Work or any changes to the Work (however implemented). - * - * You are solely responsible for; testing, validating and evaluation of all operation - * logic, functionality, security and appropriateness of using the Work for any commercial - * or non-commercial purpose and for any reproduction or redistribution by You of the - * Work. You assume all risks associated with Your use of the Work and the exercise of - * permissions under this License. - */ - -// -using System; -using System.Collections.Generic; -using System.Numerics; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using RadixDlt.NetworkGateway.Abstractions.Addressing; -using RadixDlt.NetworkGateway.Abstractions.Model; -using RadixDlt.NetworkGateway.PostgresIntegration; -using RadixDlt.NetworkGateway.PostgresIntegration.Models; - -#nullable disable - -namespace RadixDlt.NetworkGateway.PostgresIntegration.Migrations -{ - [DbContext(typeof(MigrationsDbContext))] - [Migration("20240116140418_MoveVmTypeToCodeHistoryTable")] - partial class MoveVmTypeToCodeHistoryTable - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "account_default_deposit_rule", new[] { "accept", "reject", "allow_existing" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "account_resource_preference_rule", new[] { "allowed", "disallowed" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "entity_type", new[] { "global_consensus_manager", "global_fungible_resource", "global_non_fungible_resource", "global_generic_component", "internal_generic_component", "global_account_component", "global_package", "internal_key_value_store", "internal_fungible_vault", "internal_non_fungible_vault", "global_validator", "global_access_controller", "global_identity", "global_one_resource_pool", "global_two_resource_pool", "global_multi_resource_pool", "global_transaction_tracker" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_event_type", new[] { "withdrawal", "deposit" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_operation_type", new[] { "resource_in_use", "account_deposited_into", "account_withdrawn_from" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_origin_type", new[] { "user", "epoch_change" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_type", new[] { "origin", "event", "manifest_address", "affected_global_entity" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_status", new[] { "succeeded", "failed" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_type", new[] { "genesis", "user", "round_update", "flash" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "module_id", new[] { "main", "metadata", "royalty", "role_assignment" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "non_fungible_id_type", new[] { "string", "integer", "bytes", "ruid" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "package_vm_type", new[] { "native", "scrypto_v1" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "pending_transaction_intent_ledger_status", new[] { "unknown", "committed", "commit_pending", "permanent_rejection", "possible_to_commit", "likely_but_not_certain_rejection" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "pending_transaction_payload_ledger_status", new[] { "unknown", "committed", "commit_pending", "clashing_commit", "permanently_rejected", "transiently_accepted", "transiently_rejected" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "public_key_type", new[] { "ecdsa_secp256k1", "eddsa_ed25519" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "resource_type", new[] { "fungible", "non_fungible" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "sbor_type_kind", new[] { "well_known", "schema_local" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "state_type", new[] { "json", "sbor" }); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AccountDefaultDepositRuleHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountEntityId") - .HasColumnType("bigint") - .HasColumnName("account_entity_id"); - - b.Property("DefaultDepositRule") - .HasColumnType("account_default_deposit_rule") - .HasColumnName("default_deposit_rule"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.HasKey("Id"); - - b.HasIndex("AccountEntityId", "FromStateVersion"); - - b.ToTable("account_default_deposit_rule_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AccountResourcePreferenceRuleHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountEntityId") - .HasColumnType("bigint") - .HasColumnName("account_entity_id"); - - b.Property("AccountResourcePreferenceRule") - .HasColumnType("account_resource_preference_rule") - .HasColumnName("account_resource_preference_rule"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("IsDeleted") - .HasColumnType("boolean") - .HasColumnName("is_deleted"); - - b.Property("ResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.HasKey("Id"); - - b.HasIndex("AccountEntityId", "ResourceEntityId", "FromStateVersion"); - - b.ToTable("account_resource_preference_rule_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ComponentMethodRoyaltyEntryHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("IsLocked") - .HasColumnType("boolean") - .HasColumnName("is_locked"); - - b.Property("MethodName") - .IsRequired() - .HasColumnType("text") - .HasColumnName("method_name"); - - b.Property("RoyaltyAmount") - .HasColumnType("jsonb") - .HasColumnName("royalty_amount"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "FromStateVersion"); - - b.HasIndex("EntityId", "MethodName", "FromStateVersion"); - - b.ToTable("component_method_royalty_entry_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Address") - .IsRequired() - .HasColumnType("text") - .HasColumnName("address"); - - b.Property>("AncestorIds") - .HasColumnType("bigint[]") - .HasColumnName("ancestor_ids"); - - b.Property>("CorrelatedEntities") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("correlated_entities"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("GlobalAncestorId") - .HasColumnType("bigint") - .HasColumnName("global_ancestor_id"); - - b.Property("IsGlobal") - .HasColumnType("boolean") - .HasColumnName("is_global"); - - b.Property("OwnerAncestorId") - .HasColumnType("bigint") - .HasColumnName("owner_ancestor_id"); - - b.Property("ParentAncestorId") - .HasColumnType("bigint") - .HasColumnName("parent_ancestor_id"); - - b.Property("discriminator") - .HasColumnType("entity_type"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("FromStateVersion") - .HasFilter("discriminator = 'global_validator'"); - - b.ToTable("entities"); - - b.HasDiscriminator("discriminator"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityMetadataAggregateHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property>("MetadataIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("metadata_ids"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "FromStateVersion"); - - b.ToTable("entity_metadata_aggregate_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityMetadataHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("IsDeleted") - .HasColumnType("boolean") - .HasColumnName("is_deleted"); - - b.Property("IsLocked") - .HasColumnType("boolean") - .HasColumnName("is_locked"); - - b.Property("Key") - .IsRequired() - .HasColumnType("text") - .HasColumnName("key"); - - b.Property("Value") - .HasColumnType("bytea") - .HasColumnName("value"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "Key", "FromStateVersion"); - - b.ToTable("entity_metadata_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregateHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property>("FungibleResourceEntityIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("fungible_resource_entity_ids"); - - b.Property>("FungibleResourceSignificantUpdateStateVersions") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("fungible_resource_significant_update_state_versions"); - - b.Property>("NonFungibleResourceEntityIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("non_fungible_resource_entity_ids"); - - b.Property>("NonFungibleResourceSignificantUpdateStateVersions") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("non_fungible_resource_significant_update_state_versions"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "FromStateVersion"); - - b.ToTable("entity_resource_aggregate_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregatedVaultsHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("ResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.Property("discriminator") - .HasColumnType("resource_type"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "ResourceEntityId", "FromStateVersion"); - - b.ToTable("entity_resource_aggregated_vaults_history"); - - b.HasDiscriminator("discriminator"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceVaultAggregateHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("ResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.Property>("VaultEntityIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("vault_entity_ids"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "ResourceEntityId", "FromStateVersion"); - - b.ToTable("entity_resource_vault_aggregate_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityRoleAssignmentsAggregateHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property>("EntryIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("entry_ids"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("OwnerRoleId") - .HasColumnType("bigint") - .HasColumnName("owner_role_id"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "FromStateVersion"); - - b.ToTable("entity_role_assignments_aggregate_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityRoleAssignmentsEntryHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("IsDeleted") - .HasColumnType("boolean") - .HasColumnName("is_deleted"); - - b.Property("KeyModule") - .HasColumnType("module_id") - .HasColumnName("key_module"); - - b.Property("KeyRole") - .IsRequired() - .HasColumnType("text") - .HasColumnName("key_role"); - - b.Property("RoleAssignments") - .HasColumnType("jsonb") - .HasColumnName("role_assignments"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "KeyRole", "KeyModule", "FromStateVersion"); - - b.ToTable("entity_role_assignments_entry_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityRoleAssignmentsOwnerRoleHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("RoleAssignments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("role_assignments"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "FromStateVersion"); - - b.ToTable("entity_role_assignments_owner_role_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityVaultHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("GlobalEntityId") - .HasColumnType("bigint") - .HasColumnName("global_entity_id"); - - b.Property("OwnerEntityId") - .HasColumnType("bigint") - .HasColumnName("owner_entity_id"); - - b.Property("ResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.Property("VaultEntityId") - .HasColumnType("bigint") - .HasColumnName("vault_entity_id"); - - b.Property("discriminator") - .HasColumnType("resource_type"); - - b.HasKey("Id"); - - b.HasIndex("GlobalEntityId", "FromStateVersion") - .HasFilter("is_royalty_vault = true"); - - b.HasIndex("OwnerEntityId", "FromStateVersion") - .HasFilter("is_royalty_vault = true"); - - b.HasIndex("VaultEntityId", "FromStateVersion") - .HasFilter("discriminator = 'non_fungible'"); - - b.HasIndex("GlobalEntityId", "VaultEntityId", "FromStateVersion"); - - b.HasIndex("Id", "ResourceEntityId", "FromStateVersion"); - - b.HasIndex("OwnerEntityId", "VaultEntityId", "FromStateVersion"); - - b.ToTable("entity_vault_history"); - - b.HasDiscriminator("discriminator"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.KeyValueStoreEntryHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("IsDeleted") - .HasColumnType("boolean") - .HasColumnName("is_deleted"); - - b.Property("IsLocked") - .HasColumnType("boolean") - .HasColumnName("is_locked"); - - b.Property("Key") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("key"); - - b.Property("KeyValueStoreEntityId") - .HasColumnType("bigint") - .HasColumnName("key_value_store_entity_id"); - - b.Property("Value") - .HasColumnType("bytea") - .HasColumnName("value"); - - b.HasKey("Id"); - - b.HasIndex("KeyValueStoreEntityId", "Key", "FromStateVersion"); - - b.ToTable("key_value_store_entry_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.KeyValueStoreSchemaHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("KeySborTypeKind") - .HasColumnType("sbor_type_kind") - .HasColumnName("key_sbor_type_kind"); - - b.Property("KeySchemaDefiningEntityId") - .HasColumnType("bigint") - .HasColumnName("key_schema_defining_entity_id"); - - b.Property("KeySchemaHash") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("key_schema_hash"); - - b.Property("KeyTypeIndex") - .HasColumnType("bigint") - .HasColumnName("key_type_index"); - - b.Property("KeyValueStoreEntityId") - .HasColumnType("bigint") - .HasColumnName("key_value_store_entity_id"); - - b.Property("ValueSborTypeKind") - .HasColumnType("sbor_type_kind") - .HasColumnName("value_sbor_type_kind"); - - b.Property("ValueSchemaDefiningEntityId") - .HasColumnType("bigint") - .HasColumnName("value_schema_defining_entity_id"); - - b.Property("ValueSchemaHash") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("value_schema_hash"); - - b.Property("ValueTypeIndex") - .HasColumnType("bigint") - .HasColumnName("value_type_index"); - - b.HasKey("Id"); - - b.HasIndex("KeyValueStoreEntityId", "FromStateVersion"); - - b.ToTable("key_value_store_schema_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction", b => - { - b.Property("StateVersion") - .HasColumnType("bigint") - .HasColumnName("state_version"); - - b.Property("AffectedGlobalEntities") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("affected_global_entities"); - - b.Property("BalanceChanges") - .HasColumnType("jsonb") - .HasColumnName("balance_changes"); - - b.Property("CreatedTimestamp") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_timestamp"); - - b.Property("Epoch") - .HasColumnType("bigint") - .HasColumnName("epoch"); - - b.Property("FeePaid") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("fee_paid"); - - b.Property("IndexInEpoch") - .HasColumnType("bigint") - .HasColumnName("index_in_epoch"); - - b.Property("IndexInRound") - .HasColumnType("bigint") - .HasColumnName("index_in_round"); - - b.Property("NormalizedRoundTimestamp") - .HasColumnType("timestamp with time zone") - .HasColumnName("normalized_round_timestamp"); - - b.Property("ReceiptCostingParameters") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("receipt_costing_parameters"); - - b.Property("ReceiptErrorMessage") - .HasColumnType("text") - .HasColumnName("receipt_error_message"); - - b.Property("ReceiptEventEmitters") - .IsRequired() - .HasColumnType("jsonb[]") - .HasColumnName("receipt_event_emitters"); - - b.Property("ReceiptEventNames") - .IsRequired() - .HasColumnType("text[]") - .HasColumnName("receipt_event_names"); - - b.Property("ReceiptEventSborTypeKinds") - .IsRequired() - .HasColumnType("sbor_type_kind[]") - .HasColumnName("receipt_event_sbor_type_kinds"); - - b.Property("ReceiptEventSbors") - .IsRequired() - .HasColumnType("bytea[]") - .HasColumnName("receipt_event_sbors"); - - b.Property("ReceiptEventSchemaEntityIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("receipt_event_schema_entity_ids"); - - b.Property("ReceiptEventSchemaHashes") - .IsRequired() - .HasColumnType("bytea[]") - .HasColumnName("receipt_event_schema_hashes"); - - b.Property("ReceiptEventTypeIndexes") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("receipt_event_type_indexes"); - - b.Property("ReceiptFeeDestination") - .HasColumnType("jsonb") - .HasColumnName("receipt_fee_destination"); - - b.Property("ReceiptFeeSource") - .HasColumnType("jsonb") - .HasColumnName("receipt_fee_source"); - - b.Property("ReceiptFeeSummary") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("receipt_fee_summary"); - - b.Property("ReceiptNextEpoch") - .HasColumnType("jsonb") - .HasColumnName("receipt_next_epoch"); - - b.Property("ReceiptOutput") - .HasColumnType("jsonb") - .HasColumnName("receipt_output"); - - b.Property("ReceiptStateUpdates") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("receipt_state_updates"); - - b.Property("ReceiptStatus") - .HasColumnType("ledger_transaction_status") - .HasColumnName("receipt_status"); - - b.Property("ReceiptTreeHash") - .IsRequired() - .HasColumnType("text") - .HasColumnName("receipt_tree_hash"); - - b.Property("RoundInEpoch") - .HasColumnType("bigint") - .HasColumnName("round_in_epoch"); - - b.Property("RoundTimestamp") - .HasColumnType("timestamp with time zone") - .HasColumnName("round_timestamp"); - - b.Property("StateTreeHash") - .IsRequired() - .HasColumnType("text") - .HasColumnName("state_tree_hash"); - - b.Property("TipPaid") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("tip_paid"); - - b.Property("TransactionTreeHash") - .IsRequired() - .HasColumnType("text") - .HasColumnName("transaction_tree_hash"); - - b.Property("discriminator") - .HasColumnType("ledger_transaction_type"); - - b.HasKey("StateVersion"); - - b.HasIndex("RoundTimestamp"); - - b.HasIndex("Epoch", "RoundInEpoch") - .IsUnique() - .HasFilter("index_in_round = 0"); - - b.ToTable("ledger_transactions"); - - b.HasDiscriminator("discriminator"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("StateVersion") - .HasColumnType("bigint") - .HasColumnName("state_version"); - - b.Property("discriminator") - .HasColumnType("ledger_transaction_marker_type"); - - b.HasKey("Id"); - - b.HasIndex("StateVersion"); - - b.ToTable("ledger_transaction_markers"); - - b.HasDiscriminator("discriminator"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NetworkConfiguration", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id"); - - b.Property("AddressTypeDefinitions") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("address_type_definitions"); - - b.Property("GenesisEpoch") - .HasColumnType("bigint") - .HasColumnName("genesis_epoch"); - - b.Property("GenesisRound") - .HasColumnType("bigint") - .HasColumnName("genesis_round"); - - b.Property("HrpDefinition") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("hrp_definition"); - - b.Property("NetworkHrpSuffix") - .IsRequired() - .HasColumnType("text") - .HasColumnName("network_hrp_suffix"); - - b.Property("NetworkId") - .HasColumnType("smallint") - .HasColumnName("network_id"); - - b.Property("NetworkName") - .IsRequired() - .HasColumnType("text") - .HasColumnName("network_name"); - - b.Property("WellKnownAddresses") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("well_known_addresses"); - - b.HasKey("Id"); - - b.ToTable("network_configuration"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdData", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("NonFungibleId") - .IsRequired() - .HasColumnType("text") - .HasColumnName("non_fungible_id"); - - b.Property("NonFungibleResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("non_fungible_resource_entity_id"); - - b.HasKey("Id"); - - b.HasIndex("NonFungibleResourceEntityId", "FromStateVersion"); - - b.HasIndex("NonFungibleResourceEntityId", "NonFungibleId", "FromStateVersion") - .IsUnique(); - - b.ToTable("non_fungible_id_data"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdDataHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Data") - .HasColumnType("bytea") - .HasColumnName("data"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("IsDeleted") - .HasColumnType("boolean") - .HasColumnName("is_deleted"); - - b.Property("IsLocked") - .HasColumnType("boolean") - .HasColumnName("is_locked"); - - b.Property("NonFungibleIdDataId") - .HasColumnType("bigint") - .HasColumnName("non_fungible_id_data_id"); - - b.HasKey("Id"); - - b.HasIndex("NonFungibleIdDataId", "FromStateVersion"); - - b.ToTable("non_fungible_id_data_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdLocationHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("NonFungibleIdDataId") - .HasColumnType("bigint") - .HasColumnName("non_fungible_id_data_id"); - - b.Property("VaultEntityId") - .HasColumnType("bigint") - .HasColumnName("vault_entity_id"); - - b.HasKey("Id"); - - b.HasIndex("NonFungibleIdDataId", "FromStateVersion"); - - b.ToTable("non_fungible_id_location_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdStoreHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property>("NonFungibleIdDataIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("non_fungible_id_data_ids"); - - b.Property("NonFungibleResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("non_fungible_resource_entity_id"); - - b.HasKey("Id"); - - b.HasIndex("NonFungibleResourceEntityId", "FromStateVersion"); - - b.ToTable("non_fungible_id_store_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleSchemaHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("ResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.Property("SborTypeKind") - .HasColumnType("sbor_type_kind") - .HasColumnName("sbor_type_kind"); - - b.Property("SchemaDefiningEntityId") - .HasColumnType("bigint") - .HasColumnName("schema_defining_entity_id"); - - b.Property("SchemaHash") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("schema_hash"); - - b.Property("TypeIndex") - .HasColumnType("bigint") - .HasColumnName("type_index"); - - b.HasKey("Id"); - - b.HasIndex("ResourceEntityId", "FromStateVersion"); - - b.ToTable("non_fungible_schema_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageBlueprintHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AuthTemplate") - .HasColumnType("jsonb") - .HasColumnName("auth_template"); - - b.Property("AuthTemplateIsLocked") - .HasColumnType("boolean") - .HasColumnName("auth_template_is_locked"); - - b.Property("Definition") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("definition"); - - b.Property>("DependantEntityIds") - .HasColumnType("bigint[]") - .HasColumnName("dependant_entity_ids"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text") - .HasColumnName("name"); - - b.Property("PackageEntityId") - .HasColumnType("bigint") - .HasColumnName("package_entity_id"); - - b.Property("RoyaltyConfig") - .HasColumnType("jsonb") - .HasColumnName("royalty_config"); - - b.Property("RoyaltyConfigIsLocked") - .HasColumnType("boolean") - .HasColumnName("royalty_config_is_locked"); - - b.Property("Version") - .IsRequired() - .HasColumnType("text") - .HasColumnName("version"); - - b.HasKey("Id"); - - b.HasIndex("PackageEntityId", "FromStateVersion"); - - b.HasIndex("PackageEntityId", "Name", "Version", "FromStateVersion"); - - b.ToTable("package_blueprint_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageCodeHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Code") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("code"); - - b.Property("CodeHash") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("code_hash"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("PackageEntityId") - .HasColumnType("bigint") - .HasColumnName("package_entity_id"); - - b.Property("VmType") - .HasColumnType("package_vm_type") - .HasColumnName("vm_type"); - - b.HasKey("Id"); - - b.HasIndex("PackageEntityId", "FromStateVersion"); - - b.ToTable("package_code_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EndEpochExclusive") - .HasColumnType("numeric(20,0)") - .HasColumnName("end_epoch_exclusive"); - - b.Property("IntentHash") - .IsRequired() - .HasColumnType("text") - .HasColumnName("intent_hash"); - - b.Property("PayloadHash") - .IsRequired() - .HasColumnType("text") - .HasColumnName("payload_hash"); - - b.Property("PayloadId") - .HasColumnType("bigint") - .HasColumnName("payload_id"); - - b.Property("VersionControl") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("Id"); - - b.HasIndex("IntentHash"); - - b.HasIndex("PayloadHash") - .IsUnique(); - - b.ToTable("pending_transactions"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionPayload", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("NotarizedTransactionBlob") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("notarized_transaction_blob"); - - b.Property("PendingTransactionId") - .HasColumnType("bigint") - .HasColumnName("pending_transaction_id"); - - b.HasKey("Id"); - - b.HasIndex("PendingTransactionId") - .IsUnique(); - - b.ToTable("pending_transaction_payloads"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ResourceEntitySupplyHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("ResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.Property("TotalBurned") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("total_burned"); - - b.Property("TotalMinted") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("total_minted"); - - b.Property("TotalSupply") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("total_supply"); - - b.HasKey("Id"); - - b.HasIndex("ResourceEntityId", "FromStateVersion"); - - b.ToTable("resource_entity_supply_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.SchemaHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("Schema") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("schema"); - - b.Property("SchemaHash") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("schema_hash"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "FromStateVersion"); - - b.HasIndex("SchemaHash", "FromStateVersion"); - - b.ToTable("schema_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.StateHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("discriminator") - .HasColumnType("state_type"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "FromStateVersion"); - - b.ToTable("state_history"); - - b.HasDiscriminator("discriminator"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorActiveSetHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Epoch") - .HasColumnType("bigint") - .HasColumnName("epoch"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("Stake") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("stake"); - - b.Property("ValidatorPublicKeyHistoryId") - .HasColumnType("bigint") - .HasColumnName("validator_public_key_history_id"); - - b.HasKey("Id"); - - b.HasIndex("Epoch"); - - b.HasIndex("FromStateVersion"); - - b.HasIndex("ValidatorPublicKeyHistoryId"); - - b.ToTable("validator_active_set_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorEmissionStatistics", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EpochNumber") - .HasColumnType("bigint") - .HasColumnName("epoch_number"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("ProposalsMade") - .HasColumnType("bigint") - .HasColumnName("proposals_made"); - - b.Property("ProposalsMissed") - .HasColumnType("bigint") - .HasColumnName("proposals_missed"); - - b.Property("ValidatorEntityId") - .HasColumnType("bigint") - .HasColumnName("validator_entity_id"); - - b.HasKey("Id"); - - b.HasIndex("ValidatorEntityId", "EpochNumber"); - - b.ToTable("validator_emission_statistics"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorPublicKeyHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("Key") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("key"); - - b.Property("KeyType") - .HasColumnType("public_key_type") - .HasColumnName("key_type"); - - b.Property("ValidatorEntityId") - .HasColumnType("bigint") - .HasColumnName("validator_entity_id"); - - b.HasKey("Id"); - - b.HasIndex("ValidatorEntityId", "FromStateVersion"); - - b.HasIndex("ValidatorEntityId", "KeyType", "Key"); - - b.ToTable("validator_public_key_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalAccessControllerEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalAccessController); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalAccountEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalAccountComponent); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalConsensusManager", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalConsensusManager); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalFungibleResourceEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("Divisibility") - .HasColumnType("integer") - .HasColumnName("divisibility"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalFungibleResource); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalGenericComponentEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalGenericComponent); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalIdentityEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalIdentity); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalMultiResourcePoolEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalMultiResourcePool); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalNonFungibleResourceEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("NonFungibleIdType") - .HasColumnType("non_fungible_id_type") - .HasColumnName("non_fungible_id_type"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalNonFungibleResource); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalOneResourcePoolEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalOneResourcePool); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalPackageEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalPackage); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalTransactionTrackerEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalTransactionTracker); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalTwoResourcePoolEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalTwoResourcePool); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalValidatorEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("LockedOwnerStakeUnitVault") - .HasColumnType("bigint") - .HasColumnName("locked_owner_stake_unit_vault_entity_id"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.Property("PendingOwnerStakeUnitUnlockVault") - .HasColumnType("bigint") - .HasColumnName("pending_owner_stake_unit_unlock_vault_entity_id"); - - b.Property("PendingXrdWithdrawVault") - .HasColumnType("bigint") - .HasColumnName("pending_xrd_withdraw_vault_entity_id"); - - b.Property("StakeVaultEntityId") - .HasColumnType("bigint") - .HasColumnName("stake_vault_entity_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalValidator); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalFungibleVaultEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.Property("ResourceEntityId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.Property("RoyaltyVaultOfEntityId") - .HasColumnType("bigint") - .HasColumnName("royalty_vault_of_entity_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.InternalFungibleVault); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalGenericComponentEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.InternalGenericComponent); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalKeyValueStoreEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.InternalKeyValueStore); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalNonFungibleVaultEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.Property("ResourceEntityId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.InternalNonFungibleVault); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityFungibleResourceAggregatedVaultsHistory", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregatedVaultsHistory"); - - b.Property("Balance") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("balance"); - - b.ToTable("entity_resource_aggregated_vaults_history"); - - b.HasDiscriminator().HasValue(ResourceType.Fungible); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityNonFungibleResourceAggregatedVaultsHistory", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregatedVaultsHistory"); - - b.Property("TotalCount") - .HasColumnType("bigint") - .HasColumnName("total_count"); - - b.ToTable("entity_resource_aggregated_vaults_history"); - - b.HasDiscriminator().HasValue(ResourceType.NonFungible); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityFungibleVaultHistory", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityVaultHistory"); - - b.Property("Balance") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("balance"); - - b.Property("IsRoyaltyVault") - .HasColumnType("boolean") - .HasColumnName("is_royalty_vault"); - - b.ToTable("entity_vault_history"); - - b.HasDiscriminator().HasValue(ResourceType.Fungible); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityNonFungibleVaultHistory", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityVaultHistory"); - - b.Property>("NonFungibleIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("non_fungible_ids"); - - b.ToTable("entity_vault_history"); - - b.HasDiscriminator().HasValue(ResourceType.NonFungible); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.FlashLedgerTransaction", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); - - b.ToTable("ledger_transactions"); - - b.HasDiscriminator().HasValue(LedgerTransactionType.Flash); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GenesisLedgerTransaction", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); - - b.ToTable("ledger_transactions"); - - b.HasDiscriminator().HasValue(LedgerTransactionType.Genesis); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.RoundUpdateLedgerTransaction", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); - - b.ToTable("ledger_transactions"); - - b.HasDiscriminator().HasValue(LedgerTransactionType.RoundUpdate); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.UserLedgerTransaction", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); - - b.Property("IntentHash") - .IsRequired() - .HasColumnType("text") - .HasColumnName("intent_hash"); - - b.Property("Message") - .HasColumnType("jsonb") - .HasColumnName("message"); - - b.Property("PayloadHash") - .IsRequired() - .HasColumnType("text") - .HasColumnName("payload_hash"); - - b.Property("RawPayload") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("raw_payload"); - - b.Property("SignedIntentHash") - .IsRequired() - .HasColumnType("text") - .HasColumnName("signed_intent_hash"); - - b.HasIndex("IntentHash") - .HasFilter("intent_hash IS NOT NULL"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("IntentHash"), "hash"); - - b.ToTable("ledger_transactions"); - - b.HasDiscriminator().HasValue(LedgerTransactionType.User); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AffectedGlobalEntityTransactionMarker", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); - - b.Property("EntityId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.HasIndex("EntityId", "StateVersion") - .HasFilter("discriminator = 'affected_global_entity'"); - - b.ToTable("ledger_transaction_markers"); - - b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.AffectedGlobalEntity); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EventLedgerTransactionMarker", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); - - b.Property("EntityId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("EventType") - .HasColumnType("ledger_transaction_marker_event_type") - .HasColumnName("event_type"); - - b.Property("Quantity") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("quantity"); - - b.Property("ResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.HasIndex("EventType", "EntityId", "StateVersion") - .HasFilter("discriminator = 'event'"); - - b.ToTable("ledger_transaction_markers"); - - b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.Event); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ManifestAddressLedgerTransactionMarker", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); - - b.Property("EntityId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("OperationType") - .HasColumnType("ledger_transaction_marker_operation_type") - .HasColumnName("operation_type"); - - b.HasIndex("OperationType", "EntityId", "StateVersion") - .HasFilter("discriminator = 'manifest_address'"); - - b.ToTable("ledger_transaction_markers"); - - b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.ManifestAddress); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.OriginLedgerTransactionMarker", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); - - b.Property("OriginType") - .HasColumnType("ledger_transaction_marker_origin_type") - .HasColumnName("origin_type"); - - b.HasIndex("OriginType", "StateVersion") - .HasFilter("discriminator = 'origin'"); - - b.ToTable("ledger_transaction_markers"); - - b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.Origin); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.JsonStateHistory", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.StateHistory"); - - b.Property("JsonState") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("json_state"); - - b.ToTable("state_history"); - - b.HasDiscriminator().HasValue(StateType.Json); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.SborStateHistory", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.StateHistory"); - - b.Property("SborState") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("sbor_state"); - - b.Property("SborTypeKind") - .HasColumnType("sbor_type_kind") - .HasColumnName("sbor_type_kind"); - - b.Property("SchemaDefiningEntityId") - .HasColumnType("bigint") - .HasColumnName("schema_defining_entity_id"); - - b.Property("SchemaHash") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("schema_hash"); - - b.Property("TypeIndex") - .HasColumnType("bigint") - .HasColumnName("type_index"); - - b.ToTable("state_history"); - - b.HasDiscriminator().HasValue(StateType.Sbor); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", b => - { - b.OwnsOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionGatewayHandling", "GatewayHandling", b1 => - { - b1.Property("PendingTransactionId") - .HasColumnType("bigint"); - - b1.Property("AttemptedSubmissionToNodesCount") - .HasColumnType("integer") - .HasColumnName("node_submission_count"); - - b1.Property("FirstSubmittedToGatewayTimestamp") - .HasColumnType("timestamp with time zone") - .HasColumnName("first_submitted_to_gateway_timestamp"); - - b1.Property("HandlingStatusReason") - .HasColumnType("text") - .HasColumnName("handling_status_reason"); - - b1.Property("ResubmitFromTimestamp") - .HasColumnType("timestamp with time zone") - .HasColumnName("resubmit_from_timestamp"); - - b1.HasKey("PendingTransactionId"); - - b1.HasIndex("FirstSubmittedToGatewayTimestamp"); - - b1.HasIndex("ResubmitFromTimestamp"); - - b1.ToTable("pending_transactions"); - - b1.WithOwner() - .HasForeignKey("PendingTransactionId"); - }); - - b.OwnsOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionLedgerDetails", "LedgerDetails", b1 => - { - b1.Property("PendingTransactionId") - .HasColumnType("bigint"); - - b1.Property("CommitTimestamp") - .HasColumnType("timestamp with time zone") - .HasColumnName("commit_timestamp"); - - b1.Property("InitialRejectionReason") - .HasColumnType("text") - .HasColumnName("initial_rejection_reason"); - - b1.Property("IntentLedgerStatus") - .HasColumnType("pending_transaction_intent_ledger_status") - .HasColumnName("intent_status"); - - b1.Property("LatestRejectionReason") - .HasColumnType("text") - .HasColumnName("latest_rejection_reason"); - - b1.Property("LatestRejectionTimestamp") - .HasColumnType("timestamp with time zone") - .HasColumnName("latest_rejection_timestamp"); - - b1.Property("PayloadLedgerStatus") - .HasColumnType("pending_transaction_payload_ledger_status") - .HasColumnName("payload_status"); - - b1.HasKey("PendingTransactionId"); - - b1.ToTable("pending_transactions"); - - b1.WithOwner() - .HasForeignKey("PendingTransactionId"); - }); - - b.OwnsOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionNetworkDetails", "NetworkDetails", b1 => - { - b1.Property("PendingTransactionId") - .HasColumnType("bigint"); - - b1.Property("LastSubmitErrorTitle") - .HasColumnType("text") - .HasColumnName("last_submit_error"); - - b1.Property("LatestNodeSubmissionTimestamp") - .HasColumnType("timestamp with time zone") - .HasColumnName("latest_node_submission_timestamp"); - - b1.Property("LatestNodeSubmissionWasAccepted") - .HasColumnType("boolean") - .HasColumnName("latest_node_submission_was_accepted"); - - b1.Property("LatestSubmittedToNodeName") - .HasColumnType("text") - .HasColumnName("latest_submitted_to_node_name"); - - b1.HasKey("PendingTransactionId"); - - b1.ToTable("pending_transactions"); - - b1.WithOwner() - .HasForeignKey("PendingTransactionId"); - }); - - b.Navigation("GatewayHandling") - .IsRequired(); - - b.Navigation("LedgerDetails") - .IsRequired(); - - b.Navigation("NetworkDetails") - .IsRequired(); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionPayload", b => - { - b.HasOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", "PendingTransaction") - .WithOne("Payload") - .HasForeignKey("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionPayload", "PendingTransactionId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("PendingTransaction"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorActiveSetHistory", b => - { - b.HasOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorPublicKeyHistory", "PublicKey") - .WithMany() - .HasForeignKey("ValidatorPublicKeyHistoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PublicKey"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", b => - { - b.Navigation("Payload"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240116140418_MoveVmTypeToCodeHistoryTable.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240116140418_MoveVmTypeToCodeHistoryTable.cs deleted file mode 100644 index f958413e9..000000000 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240116140418_MoveVmTypeToCodeHistoryTable.cs +++ /dev/null @@ -1,106 +0,0 @@ -/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). - * - * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this - * file except in compliance with the License. You may obtain a copy of the License at: - * - * radixfoundation.org/licenses/LICENSE-v1 - * - * The Licensor hereby grants permission for the Canonical version of the Work to be - * published, distributed and used under or by reference to the Licensor’s trademark - * Radix ® and use of any unregistered trade names, logos or get-up. - * - * The Licensor provides the Work (and each Contributor provides its Contributions) on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, - * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, - * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. - * - * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create - * a distributed ledger it is your responsibility to test and validate the code, together - * with all logic and performance of that code under all foreseeable scenarios. - * - * The Licensor does not make or purport to make and hereby excludes liability for all - * and any representation, warranty or undertaking in any form whatsoever, whether express - * or implied, to any entity or person, including any representation, warranty or - * undertaking, as to the functionality security use, value or other characteristics of - * any distributed ledger nor in respect the functioning or value of any tokens which may - * be created stored or transferred using the Work. The Licensor does not warrant that the - * Work or any use of the Work complies with any law or regulation in any territory where - * it may be implemented or used or that it will be appropriate for any specific purpose. - * - * Neither the licensor nor any current or former employees, officers, directors, partners, - * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor - * shall be liable for any direct or indirect, special, incidental, consequential or other - * losses of any kind, in tort, contract or otherwise (including but not limited to loss - * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss - * of any economic or other opportunity of whatsoever nature or howsoever arising), arising - * out of or in connection with (without limitation of any use, misuse, of any ledger system - * or use made or its functionality or any performance or operation of any code or protocol - * caused by bugs or programming or logic errors or otherwise); - * - * A. any offer, purchase, holding, use, sale, exchange or transmission of any - * cryptographic keys, tokens or assets created, exchanged, stored or arising from any - * interaction with the Work; - * - * B. any failure in a transmission or loss of any token or assets keys or other digital - * artefacts due to errors in transmission; - * - * C. bugs, hacks, logic errors or faults in the Work or any communication; - * - * D. system software or apparatus including but not limited to losses caused by errors - * in holding or transmitting tokens by any third-party; - * - * E. breaches or failure of security including hacker attacks, loss or disclosure of - * password, loss of private key, unauthorised use or misuse of such passwords or keys; - * - * F. any losses including loss of anticipated savings or other benefits resulting from - * use of the Work or any changes to the Work (however implemented). - * - * You are solely responsible for; testing, validating and evaluation of all operation - * logic, functionality, security and appropriateness of using the Work for any commercial - * or non-commercial purpose and for any reproduction or redistribution by You of the - * Work. You assume all risks associated with Your use of the Work and the exercise of - * permissions under this License. - */ - -using Microsoft.EntityFrameworkCore.Migrations; -using RadixDlt.NetworkGateway.Abstractions.Model; - -#nullable disable - -namespace RadixDlt.NetworkGateway.PostgresIntegration.Migrations -{ - /// - public partial class MoveVmTypeToCodeHistoryTable : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "vm_type", - table: "package_code_history", - type: "package_vm_type", - nullable: false, - defaultValue: PackageVmType.Native); - - migrationBuilder.Sql("update package_code_history pch set vm_type = (select vm_type from entities e where e.id = pch.package_entity_id)"); - - migrationBuilder.DropColumn( - name: "vm_type", - table: "entities"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "vm_type", - table: "entities", - type: "package_vm_type", - nullable: true); - - migrationBuilder.DropColumn( - name: "vm_type", - table: "package_code_history"); - } - } -} diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117093225_AddBlueprintHistoryAggregateTable.Designer.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117093225_AddBlueprintHistoryAggregateTable.Designer.cs deleted file mode 100644 index 677187385..000000000 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117093225_AddBlueprintHistoryAggregateTable.Designer.cs +++ /dev/null @@ -1,2386 +0,0 @@ -/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). - * - * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this - * file except in compliance with the License. You may obtain a copy of the License at: - * - * radixfoundation.org/licenses/LICENSE-v1 - * - * The Licensor hereby grants permission for the Canonical version of the Work to be - * published, distributed and used under or by reference to the Licensor’s trademark - * Radix ® and use of any unregistered trade names, logos or get-up. - * - * The Licensor provides the Work (and each Contributor provides its Contributions) on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, - * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, - * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. - * - * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create - * a distributed ledger it is your responsibility to test and validate the code, together - * with all logic and performance of that code under all foreseeable scenarios. - * - * The Licensor does not make or purport to make and hereby excludes liability for all - * and any representation, warranty or undertaking in any form whatsoever, whether express - * or implied, to any entity or person, including any representation, warranty or - * undertaking, as to the functionality security use, value or other characteristics of - * any distributed ledger nor in respect the functioning or value of any tokens which may - * be created stored or transferred using the Work. The Licensor does not warrant that the - * Work or any use of the Work complies with any law or regulation in any territory where - * it may be implemented or used or that it will be appropriate for any specific purpose. - * - * Neither the licensor nor any current or former employees, officers, directors, partners, - * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor - * shall be liable for any direct or indirect, special, incidental, consequential or other - * losses of any kind, in tort, contract or otherwise (including but not limited to loss - * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss - * of any economic or other opportunity of whatsoever nature or howsoever arising), arising - * out of or in connection with (without limitation of any use, misuse, of any ledger system - * or use made or its functionality or any performance or operation of any code or protocol - * caused by bugs or programming or logic errors or otherwise); - * - * A. any offer, purchase, holding, use, sale, exchange or transmission of any - * cryptographic keys, tokens or assets created, exchanged, stored or arising from any - * interaction with the Work; - * - * B. any failure in a transmission or loss of any token or assets keys or other digital - * artefacts due to errors in transmission; - * - * C. bugs, hacks, logic errors or faults in the Work or any communication; - * - * D. system software or apparatus including but not limited to losses caused by errors - * in holding or transmitting tokens by any third-party; - * - * E. breaches or failure of security including hacker attacks, loss or disclosure of - * password, loss of private key, unauthorised use or misuse of such passwords or keys; - * - * F. any losses including loss of anticipated savings or other benefits resulting from - * use of the Work or any changes to the Work (however implemented). - * - * You are solely responsible for; testing, validating and evaluation of all operation - * logic, functionality, security and appropriateness of using the Work for any commercial - * or non-commercial purpose and for any reproduction or redistribution by You of the - * Work. You assume all risks associated with Your use of the Work and the exercise of - * permissions under this License. - */ - -// -using System; -using System.Collections.Generic; -using System.Numerics; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using RadixDlt.NetworkGateway.Abstractions.Addressing; -using RadixDlt.NetworkGateway.Abstractions.Model; -using RadixDlt.NetworkGateway.PostgresIntegration; -using RadixDlt.NetworkGateway.PostgresIntegration.Models; - -#nullable disable - -namespace RadixDlt.NetworkGateway.PostgresIntegration.Migrations -{ - [DbContext(typeof(MigrationsDbContext))] - [Migration("20240117093225_AddBlueprintHistoryAggregateTable")] - partial class AddBlueprintHistoryAggregateTable - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "account_default_deposit_rule", new[] { "accept", "reject", "allow_existing" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "account_resource_preference_rule", new[] { "allowed", "disallowed" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "entity_type", new[] { "global_consensus_manager", "global_fungible_resource", "global_non_fungible_resource", "global_generic_component", "internal_generic_component", "global_account_component", "global_package", "internal_key_value_store", "internal_fungible_vault", "internal_non_fungible_vault", "global_validator", "global_access_controller", "global_identity", "global_one_resource_pool", "global_two_resource_pool", "global_multi_resource_pool", "global_transaction_tracker" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_event_type", new[] { "withdrawal", "deposit" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_operation_type", new[] { "resource_in_use", "account_deposited_into", "account_withdrawn_from" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_origin_type", new[] { "user", "epoch_change" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_type", new[] { "origin", "event", "manifest_address", "affected_global_entity" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_status", new[] { "succeeded", "failed" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_type", new[] { "genesis", "user", "round_update", "flash" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "module_id", new[] { "main", "metadata", "royalty", "role_assignment" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "non_fungible_id_type", new[] { "string", "integer", "bytes", "ruid" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "package_vm_type", new[] { "native", "scrypto_v1" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "pending_transaction_intent_ledger_status", new[] { "unknown", "committed", "commit_pending", "permanent_rejection", "possible_to_commit", "likely_but_not_certain_rejection" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "pending_transaction_payload_ledger_status", new[] { "unknown", "committed", "commit_pending", "clashing_commit", "permanently_rejected", "transiently_accepted", "transiently_rejected" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "public_key_type", new[] { "ecdsa_secp256k1", "eddsa_ed25519" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "resource_type", new[] { "fungible", "non_fungible" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "sbor_type_kind", new[] { "well_known", "schema_local" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "state_type", new[] { "json", "sbor" }); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AccountDefaultDepositRuleHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountEntityId") - .HasColumnType("bigint") - .HasColumnName("account_entity_id"); - - b.Property("DefaultDepositRule") - .HasColumnType("account_default_deposit_rule") - .HasColumnName("default_deposit_rule"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.HasKey("Id"); - - b.HasIndex("AccountEntityId", "FromStateVersion"); - - b.ToTable("account_default_deposit_rule_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AccountResourcePreferenceRuleHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountEntityId") - .HasColumnType("bigint") - .HasColumnName("account_entity_id"); - - b.Property("AccountResourcePreferenceRule") - .HasColumnType("account_resource_preference_rule") - .HasColumnName("account_resource_preference_rule"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("IsDeleted") - .HasColumnType("boolean") - .HasColumnName("is_deleted"); - - b.Property("ResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.HasKey("Id"); - - b.HasIndex("AccountEntityId", "ResourceEntityId", "FromStateVersion"); - - b.ToTable("account_resource_preference_rule_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ComponentMethodRoyaltyEntryHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("IsLocked") - .HasColumnType("boolean") - .HasColumnName("is_locked"); - - b.Property("MethodName") - .IsRequired() - .HasColumnType("text") - .HasColumnName("method_name"); - - b.Property("RoyaltyAmount") - .HasColumnType("jsonb") - .HasColumnName("royalty_amount"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "FromStateVersion"); - - b.HasIndex("EntityId", "MethodName", "FromStateVersion"); - - b.ToTable("component_method_royalty_entry_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Address") - .IsRequired() - .HasColumnType("text") - .HasColumnName("address"); - - b.Property>("AncestorIds") - .HasColumnType("bigint[]") - .HasColumnName("ancestor_ids"); - - b.Property>("CorrelatedEntities") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("correlated_entities"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("GlobalAncestorId") - .HasColumnType("bigint") - .HasColumnName("global_ancestor_id"); - - b.Property("IsGlobal") - .HasColumnType("boolean") - .HasColumnName("is_global"); - - b.Property("OwnerAncestorId") - .HasColumnType("bigint") - .HasColumnName("owner_ancestor_id"); - - b.Property("ParentAncestorId") - .HasColumnType("bigint") - .HasColumnName("parent_ancestor_id"); - - b.Property("discriminator") - .HasColumnType("entity_type"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("FromStateVersion") - .HasFilter("discriminator = 'global_validator'"); - - b.ToTable("entities"); - - b.HasDiscriminator("discriminator"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityMetadataAggregateHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property>("MetadataIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("metadata_ids"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "FromStateVersion"); - - b.ToTable("entity_metadata_aggregate_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityMetadataHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("IsDeleted") - .HasColumnType("boolean") - .HasColumnName("is_deleted"); - - b.Property("IsLocked") - .HasColumnType("boolean") - .HasColumnName("is_locked"); - - b.Property("Key") - .IsRequired() - .HasColumnType("text") - .HasColumnName("key"); - - b.Property("Value") - .HasColumnType("bytea") - .HasColumnName("value"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "Key", "FromStateVersion"); - - b.ToTable("entity_metadata_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregateHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property>("FungibleResourceEntityIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("fungible_resource_entity_ids"); - - b.Property>("FungibleResourceSignificantUpdateStateVersions") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("fungible_resource_significant_update_state_versions"); - - b.Property>("NonFungibleResourceEntityIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("non_fungible_resource_entity_ids"); - - b.Property>("NonFungibleResourceSignificantUpdateStateVersions") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("non_fungible_resource_significant_update_state_versions"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "FromStateVersion"); - - b.ToTable("entity_resource_aggregate_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregatedVaultsHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("ResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.Property("discriminator") - .HasColumnType("resource_type"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "ResourceEntityId", "FromStateVersion"); - - b.ToTable("entity_resource_aggregated_vaults_history"); - - b.HasDiscriminator("discriminator"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceVaultAggregateHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("ResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.Property>("VaultEntityIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("vault_entity_ids"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "ResourceEntityId", "FromStateVersion"); - - b.ToTable("entity_resource_vault_aggregate_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityRoleAssignmentsAggregateHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property>("EntryIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("entry_ids"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("OwnerRoleId") - .HasColumnType("bigint") - .HasColumnName("owner_role_id"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "FromStateVersion"); - - b.ToTable("entity_role_assignments_aggregate_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityRoleAssignmentsEntryHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("IsDeleted") - .HasColumnType("boolean") - .HasColumnName("is_deleted"); - - b.Property("KeyModule") - .HasColumnType("module_id") - .HasColumnName("key_module"); - - b.Property("KeyRole") - .IsRequired() - .HasColumnType("text") - .HasColumnName("key_role"); - - b.Property("RoleAssignments") - .HasColumnType("jsonb") - .HasColumnName("role_assignments"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "KeyRole", "KeyModule", "FromStateVersion"); - - b.ToTable("entity_role_assignments_entry_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityRoleAssignmentsOwnerRoleHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("RoleAssignments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("role_assignments"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "FromStateVersion"); - - b.ToTable("entity_role_assignments_owner_role_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityVaultHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("GlobalEntityId") - .HasColumnType("bigint") - .HasColumnName("global_entity_id"); - - b.Property("OwnerEntityId") - .HasColumnType("bigint") - .HasColumnName("owner_entity_id"); - - b.Property("ResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.Property("VaultEntityId") - .HasColumnType("bigint") - .HasColumnName("vault_entity_id"); - - b.Property("discriminator") - .HasColumnType("resource_type"); - - b.HasKey("Id"); - - b.HasIndex("GlobalEntityId", "FromStateVersion") - .HasFilter("is_royalty_vault = true"); - - b.HasIndex("OwnerEntityId", "FromStateVersion") - .HasFilter("is_royalty_vault = true"); - - b.HasIndex("VaultEntityId", "FromStateVersion") - .HasFilter("discriminator = 'non_fungible'"); - - b.HasIndex("GlobalEntityId", "VaultEntityId", "FromStateVersion"); - - b.HasIndex("Id", "ResourceEntityId", "FromStateVersion"); - - b.HasIndex("OwnerEntityId", "VaultEntityId", "FromStateVersion"); - - b.ToTable("entity_vault_history"); - - b.HasDiscriminator("discriminator"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.KeyValueStoreEntryHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("IsDeleted") - .HasColumnType("boolean") - .HasColumnName("is_deleted"); - - b.Property("IsLocked") - .HasColumnType("boolean") - .HasColumnName("is_locked"); - - b.Property("Key") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("key"); - - b.Property("KeyValueStoreEntityId") - .HasColumnType("bigint") - .HasColumnName("key_value_store_entity_id"); - - b.Property("Value") - .HasColumnType("bytea") - .HasColumnName("value"); - - b.HasKey("Id"); - - b.HasIndex("KeyValueStoreEntityId", "Key", "FromStateVersion"); - - b.ToTable("key_value_store_entry_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.KeyValueStoreSchemaHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("KeySborTypeKind") - .HasColumnType("sbor_type_kind") - .HasColumnName("key_sbor_type_kind"); - - b.Property("KeySchemaDefiningEntityId") - .HasColumnType("bigint") - .HasColumnName("key_schema_defining_entity_id"); - - b.Property("KeySchemaHash") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("key_schema_hash"); - - b.Property("KeyTypeIndex") - .HasColumnType("bigint") - .HasColumnName("key_type_index"); - - b.Property("KeyValueStoreEntityId") - .HasColumnType("bigint") - .HasColumnName("key_value_store_entity_id"); - - b.Property("ValueSborTypeKind") - .HasColumnType("sbor_type_kind") - .HasColumnName("value_sbor_type_kind"); - - b.Property("ValueSchemaDefiningEntityId") - .HasColumnType("bigint") - .HasColumnName("value_schema_defining_entity_id"); - - b.Property("ValueSchemaHash") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("value_schema_hash"); - - b.Property("ValueTypeIndex") - .HasColumnType("bigint") - .HasColumnName("value_type_index"); - - b.HasKey("Id"); - - b.HasIndex("KeyValueStoreEntityId", "FromStateVersion"); - - b.ToTable("key_value_store_schema_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction", b => - { - b.Property("StateVersion") - .HasColumnType("bigint") - .HasColumnName("state_version"); - - b.Property("AffectedGlobalEntities") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("affected_global_entities"); - - b.Property("BalanceChanges") - .HasColumnType("jsonb") - .HasColumnName("balance_changes"); - - b.Property("CreatedTimestamp") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_timestamp"); - - b.Property("Epoch") - .HasColumnType("bigint") - .HasColumnName("epoch"); - - b.Property("FeePaid") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("fee_paid"); - - b.Property("IndexInEpoch") - .HasColumnType("bigint") - .HasColumnName("index_in_epoch"); - - b.Property("IndexInRound") - .HasColumnType("bigint") - .HasColumnName("index_in_round"); - - b.Property("NormalizedRoundTimestamp") - .HasColumnType("timestamp with time zone") - .HasColumnName("normalized_round_timestamp"); - - b.Property("ReceiptCostingParameters") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("receipt_costing_parameters"); - - b.Property("ReceiptErrorMessage") - .HasColumnType("text") - .HasColumnName("receipt_error_message"); - - b.Property("ReceiptEventEmitters") - .IsRequired() - .HasColumnType("jsonb[]") - .HasColumnName("receipt_event_emitters"); - - b.Property("ReceiptEventNames") - .IsRequired() - .HasColumnType("text[]") - .HasColumnName("receipt_event_names"); - - b.Property("ReceiptEventSborTypeKinds") - .IsRequired() - .HasColumnType("sbor_type_kind[]") - .HasColumnName("receipt_event_sbor_type_kinds"); - - b.Property("ReceiptEventSbors") - .IsRequired() - .HasColumnType("bytea[]") - .HasColumnName("receipt_event_sbors"); - - b.Property("ReceiptEventSchemaEntityIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("receipt_event_schema_entity_ids"); - - b.Property("ReceiptEventSchemaHashes") - .IsRequired() - .HasColumnType("bytea[]") - .HasColumnName("receipt_event_schema_hashes"); - - b.Property("ReceiptEventTypeIndexes") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("receipt_event_type_indexes"); - - b.Property("ReceiptFeeDestination") - .HasColumnType("jsonb") - .HasColumnName("receipt_fee_destination"); - - b.Property("ReceiptFeeSource") - .HasColumnType("jsonb") - .HasColumnName("receipt_fee_source"); - - b.Property("ReceiptFeeSummary") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("receipt_fee_summary"); - - b.Property("ReceiptNextEpoch") - .HasColumnType("jsonb") - .HasColumnName("receipt_next_epoch"); - - b.Property("ReceiptOutput") - .HasColumnType("jsonb") - .HasColumnName("receipt_output"); - - b.Property("ReceiptStateUpdates") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("receipt_state_updates"); - - b.Property("ReceiptStatus") - .HasColumnType("ledger_transaction_status") - .HasColumnName("receipt_status"); - - b.Property("ReceiptTreeHash") - .IsRequired() - .HasColumnType("text") - .HasColumnName("receipt_tree_hash"); - - b.Property("RoundInEpoch") - .HasColumnType("bigint") - .HasColumnName("round_in_epoch"); - - b.Property("RoundTimestamp") - .HasColumnType("timestamp with time zone") - .HasColumnName("round_timestamp"); - - b.Property("StateTreeHash") - .IsRequired() - .HasColumnType("text") - .HasColumnName("state_tree_hash"); - - b.Property("TipPaid") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("tip_paid"); - - b.Property("TransactionTreeHash") - .IsRequired() - .HasColumnType("text") - .HasColumnName("transaction_tree_hash"); - - b.Property("discriminator") - .HasColumnType("ledger_transaction_type"); - - b.HasKey("StateVersion"); - - b.HasIndex("RoundTimestamp"); - - b.HasIndex("Epoch", "RoundInEpoch") - .IsUnique() - .HasFilter("index_in_round = 0"); - - b.ToTable("ledger_transactions"); - - b.HasDiscriminator("discriminator"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("StateVersion") - .HasColumnType("bigint") - .HasColumnName("state_version"); - - b.Property("discriminator") - .HasColumnType("ledger_transaction_marker_type"); - - b.HasKey("Id"); - - b.HasIndex("StateVersion"); - - b.ToTable("ledger_transaction_markers"); - - b.HasDiscriminator("discriminator"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NetworkConfiguration", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id"); - - b.Property("AddressTypeDefinitions") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("address_type_definitions"); - - b.Property("GenesisEpoch") - .HasColumnType("bigint") - .HasColumnName("genesis_epoch"); - - b.Property("GenesisRound") - .HasColumnType("bigint") - .HasColumnName("genesis_round"); - - b.Property("HrpDefinition") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("hrp_definition"); - - b.Property("NetworkHrpSuffix") - .IsRequired() - .HasColumnType("text") - .HasColumnName("network_hrp_suffix"); - - b.Property("NetworkId") - .HasColumnType("smallint") - .HasColumnName("network_id"); - - b.Property("NetworkName") - .IsRequired() - .HasColumnType("text") - .HasColumnName("network_name"); - - b.Property("WellKnownAddresses") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("well_known_addresses"); - - b.HasKey("Id"); - - b.ToTable("network_configuration"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdData", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("NonFungibleId") - .IsRequired() - .HasColumnType("text") - .HasColumnName("non_fungible_id"); - - b.Property("NonFungibleResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("non_fungible_resource_entity_id"); - - b.HasKey("Id"); - - b.HasIndex("NonFungibleResourceEntityId", "FromStateVersion"); - - b.HasIndex("NonFungibleResourceEntityId", "NonFungibleId", "FromStateVersion") - .IsUnique(); - - b.ToTable("non_fungible_id_data"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdDataHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Data") - .HasColumnType("bytea") - .HasColumnName("data"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("IsDeleted") - .HasColumnType("boolean") - .HasColumnName("is_deleted"); - - b.Property("IsLocked") - .HasColumnType("boolean") - .HasColumnName("is_locked"); - - b.Property("NonFungibleIdDataId") - .HasColumnType("bigint") - .HasColumnName("non_fungible_id_data_id"); - - b.HasKey("Id"); - - b.HasIndex("NonFungibleIdDataId", "FromStateVersion"); - - b.ToTable("non_fungible_id_data_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdLocationHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("NonFungibleIdDataId") - .HasColumnType("bigint") - .HasColumnName("non_fungible_id_data_id"); - - b.Property("VaultEntityId") - .HasColumnType("bigint") - .HasColumnName("vault_entity_id"); - - b.HasKey("Id"); - - b.HasIndex("NonFungibleIdDataId", "FromStateVersion"); - - b.ToTable("non_fungible_id_location_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdStoreHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property>("NonFungibleIdDataIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("non_fungible_id_data_ids"); - - b.Property("NonFungibleResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("non_fungible_resource_entity_id"); - - b.HasKey("Id"); - - b.HasIndex("NonFungibleResourceEntityId", "FromStateVersion"); - - b.ToTable("non_fungible_id_store_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleSchemaHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("ResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.Property("SborTypeKind") - .HasColumnType("sbor_type_kind") - .HasColumnName("sbor_type_kind"); - - b.Property("SchemaDefiningEntityId") - .HasColumnType("bigint") - .HasColumnName("schema_defining_entity_id"); - - b.Property("SchemaHash") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("schema_hash"); - - b.Property("TypeIndex") - .HasColumnType("bigint") - .HasColumnName("type_index"); - - b.HasKey("Id"); - - b.HasIndex("ResourceEntityId", "FromStateVersion"); - - b.ToTable("non_fungible_schema_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageBlueprintAggregateHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property>("PackageBlueprintIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("package_blueprint_ids"); - - b.Property("PackageEntityId") - .HasColumnType("bigint") - .HasColumnName("package_entity_id"); - - b.HasKey("Id"); - - b.HasIndex("PackageEntityId", "FromStateVersion"); - - b.ToTable("package_blueprint_aggregate_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageBlueprintHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AuthTemplate") - .HasColumnType("jsonb") - .HasColumnName("auth_template"); - - b.Property("AuthTemplateIsLocked") - .HasColumnType("boolean") - .HasColumnName("auth_template_is_locked"); - - b.Property("Definition") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("definition"); - - b.Property>("DependantEntityIds") - .HasColumnType("bigint[]") - .HasColumnName("dependant_entity_ids"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text") - .HasColumnName("name"); - - b.Property("PackageEntityId") - .HasColumnType("bigint") - .HasColumnName("package_entity_id"); - - b.Property("RoyaltyConfig") - .HasColumnType("jsonb") - .HasColumnName("royalty_config"); - - b.Property("RoyaltyConfigIsLocked") - .HasColumnType("boolean") - .HasColumnName("royalty_config_is_locked"); - - b.Property("Version") - .IsRequired() - .HasColumnType("text") - .HasColumnName("version"); - - b.HasKey("Id"); - - b.HasIndex("PackageEntityId", "FromStateVersion"); - - b.HasIndex("PackageEntityId", "Name", "Version", "FromStateVersion"); - - b.ToTable("package_blueprint_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageCodeHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Code") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("code"); - - b.Property("CodeHash") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("code_hash"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("PackageEntityId") - .HasColumnType("bigint") - .HasColumnName("package_entity_id"); - - b.Property("VmType") - .HasColumnType("package_vm_type") - .HasColumnName("vm_type"); - - b.HasKey("Id"); - - b.HasIndex("PackageEntityId", "FromStateVersion"); - - b.ToTable("package_code_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EndEpochExclusive") - .HasColumnType("numeric(20,0)") - .HasColumnName("end_epoch_exclusive"); - - b.Property("IntentHash") - .IsRequired() - .HasColumnType("text") - .HasColumnName("intent_hash"); - - b.Property("PayloadHash") - .IsRequired() - .HasColumnType("text") - .HasColumnName("payload_hash"); - - b.Property("PayloadId") - .HasColumnType("bigint") - .HasColumnName("payload_id"); - - b.Property("VersionControl") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("Id"); - - b.HasIndex("IntentHash"); - - b.HasIndex("PayloadHash") - .IsUnique(); - - b.ToTable("pending_transactions"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionPayload", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("NotarizedTransactionBlob") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("notarized_transaction_blob"); - - b.Property("PendingTransactionId") - .HasColumnType("bigint") - .HasColumnName("pending_transaction_id"); - - b.HasKey("Id"); - - b.HasIndex("PendingTransactionId") - .IsUnique(); - - b.ToTable("pending_transaction_payloads"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ResourceEntitySupplyHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("ResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.Property("TotalBurned") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("total_burned"); - - b.Property("TotalMinted") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("total_minted"); - - b.Property("TotalSupply") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("total_supply"); - - b.HasKey("Id"); - - b.HasIndex("ResourceEntityId", "FromStateVersion"); - - b.ToTable("resource_entity_supply_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.SchemaHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("Schema") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("schema"); - - b.Property("SchemaHash") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("schema_hash"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "FromStateVersion"); - - b.HasIndex("SchemaHash", "FromStateVersion"); - - b.ToTable("schema_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.StateHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityId") - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("discriminator") - .HasColumnType("state_type"); - - b.HasKey("Id"); - - b.HasIndex("EntityId", "FromStateVersion"); - - b.ToTable("state_history"); - - b.HasDiscriminator("discriminator"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorActiveSetHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Epoch") - .HasColumnType("bigint") - .HasColumnName("epoch"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("Stake") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("stake"); - - b.Property("ValidatorPublicKeyHistoryId") - .HasColumnType("bigint") - .HasColumnName("validator_public_key_history_id"); - - b.HasKey("Id"); - - b.HasIndex("Epoch"); - - b.HasIndex("FromStateVersion"); - - b.HasIndex("ValidatorPublicKeyHistoryId"); - - b.ToTable("validator_active_set_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorEmissionStatistics", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EpochNumber") - .HasColumnType("bigint") - .HasColumnName("epoch_number"); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("ProposalsMade") - .HasColumnType("bigint") - .HasColumnName("proposals_made"); - - b.Property("ProposalsMissed") - .HasColumnType("bigint") - .HasColumnName("proposals_missed"); - - b.Property("ValidatorEntityId") - .HasColumnType("bigint") - .HasColumnName("validator_entity_id"); - - b.HasKey("Id"); - - b.HasIndex("ValidatorEntityId", "EpochNumber"); - - b.ToTable("validator_emission_statistics"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorPublicKeyHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasColumnName("id"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FromStateVersion") - .HasColumnType("bigint") - .HasColumnName("from_state_version"); - - b.Property("Key") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("key"); - - b.Property("KeyType") - .HasColumnType("public_key_type") - .HasColumnName("key_type"); - - b.Property("ValidatorEntityId") - .HasColumnType("bigint") - .HasColumnName("validator_entity_id"); - - b.HasKey("Id"); - - b.HasIndex("ValidatorEntityId", "FromStateVersion"); - - b.HasIndex("ValidatorEntityId", "KeyType", "Key"); - - b.ToTable("validator_public_key_history"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalAccessControllerEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalAccessController); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalAccountEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalAccountComponent); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalConsensusManager", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalConsensusManager); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalFungibleResourceEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("Divisibility") - .HasColumnType("integer") - .HasColumnName("divisibility"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalFungibleResource); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalGenericComponentEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalGenericComponent); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalIdentityEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalIdentity); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalMultiResourcePoolEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalMultiResourcePool); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalNonFungibleResourceEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("NonFungibleIdType") - .HasColumnType("non_fungible_id_type") - .HasColumnName("non_fungible_id_type"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalNonFungibleResource); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalOneResourcePoolEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalOneResourcePool); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalPackageEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalPackage); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalTransactionTrackerEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalTransactionTracker); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalTwoResourcePoolEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalTwoResourcePool); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalValidatorEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("LockedOwnerStakeUnitVault") - .HasColumnType("bigint") - .HasColumnName("locked_owner_stake_unit_vault_entity_id"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.Property("PendingOwnerStakeUnitUnlockVault") - .HasColumnType("bigint") - .HasColumnName("pending_owner_stake_unit_unlock_vault_entity_id"); - - b.Property("PendingXrdWithdrawVault") - .HasColumnType("bigint") - .HasColumnName("pending_xrd_withdraw_vault_entity_id"); - - b.Property("StakeVaultEntityId") - .HasColumnType("bigint") - .HasColumnName("stake_vault_entity_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalValidator); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalFungibleVaultEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.Property("ResourceEntityId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.Property("RoyaltyVaultOfEntityId") - .HasColumnType("bigint") - .HasColumnName("royalty_vault_of_entity_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.InternalFungibleVault); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalGenericComponentEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.InternalGenericComponent); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalKeyValueStoreEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.InternalKeyValueStore); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalNonFungibleVaultEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.Property("ResourceEntityId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.InternalNonFungibleVault); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityFungibleResourceAggregatedVaultsHistory", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregatedVaultsHistory"); - - b.Property("Balance") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("balance"); - - b.ToTable("entity_resource_aggregated_vaults_history"); - - b.HasDiscriminator().HasValue(ResourceType.Fungible); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityNonFungibleResourceAggregatedVaultsHistory", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregatedVaultsHistory"); - - b.Property("TotalCount") - .HasColumnType("bigint") - .HasColumnName("total_count"); - - b.ToTable("entity_resource_aggregated_vaults_history"); - - b.HasDiscriminator().HasValue(ResourceType.NonFungible); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityFungibleVaultHistory", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityVaultHistory"); - - b.Property("Balance") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("balance"); - - b.Property("IsRoyaltyVault") - .HasColumnType("boolean") - .HasColumnName("is_royalty_vault"); - - b.ToTable("entity_vault_history"); - - b.HasDiscriminator().HasValue(ResourceType.Fungible); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityNonFungibleVaultHistory", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityVaultHistory"); - - b.Property>("NonFungibleIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("non_fungible_ids"); - - b.ToTable("entity_vault_history"); - - b.HasDiscriminator().HasValue(ResourceType.NonFungible); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.FlashLedgerTransaction", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); - - b.ToTable("ledger_transactions"); - - b.HasDiscriminator().HasValue(LedgerTransactionType.Flash); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GenesisLedgerTransaction", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); - - b.ToTable("ledger_transactions"); - - b.HasDiscriminator().HasValue(LedgerTransactionType.Genesis); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.RoundUpdateLedgerTransaction", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); - - b.ToTable("ledger_transactions"); - - b.HasDiscriminator().HasValue(LedgerTransactionType.RoundUpdate); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.UserLedgerTransaction", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); - - b.Property("IntentHash") - .IsRequired() - .HasColumnType("text") - .HasColumnName("intent_hash"); - - b.Property("Message") - .HasColumnType("jsonb") - .HasColumnName("message"); - - b.Property("PayloadHash") - .IsRequired() - .HasColumnType("text") - .HasColumnName("payload_hash"); - - b.Property("RawPayload") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("raw_payload"); - - b.Property("SignedIntentHash") - .IsRequired() - .HasColumnType("text") - .HasColumnName("signed_intent_hash"); - - b.HasIndex("IntentHash") - .HasFilter("intent_hash IS NOT NULL"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("IntentHash"), "hash"); - - b.ToTable("ledger_transactions"); - - b.HasDiscriminator().HasValue(LedgerTransactionType.User); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AffectedGlobalEntityTransactionMarker", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); - - b.Property("EntityId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.HasIndex("EntityId", "StateVersion") - .HasFilter("discriminator = 'affected_global_entity'"); - - b.ToTable("ledger_transaction_markers"); - - b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.AffectedGlobalEntity); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EventLedgerTransactionMarker", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); - - b.Property("EntityId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("EventType") - .HasColumnType("ledger_transaction_marker_event_type") - .HasColumnName("event_type"); - - b.Property("Quantity") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("quantity"); - - b.Property("ResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.HasIndex("EventType", "EntityId", "StateVersion") - .HasFilter("discriminator = 'event'"); - - b.ToTable("ledger_transaction_markers"); - - b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.Event); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ManifestAddressLedgerTransactionMarker", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); - - b.Property("EntityId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("entity_id"); - - b.Property("OperationType") - .HasColumnType("ledger_transaction_marker_operation_type") - .HasColumnName("operation_type"); - - b.HasIndex("OperationType", "EntityId", "StateVersion") - .HasFilter("discriminator = 'manifest_address'"); - - b.ToTable("ledger_transaction_markers"); - - b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.ManifestAddress); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.OriginLedgerTransactionMarker", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); - - b.Property("OriginType") - .HasColumnType("ledger_transaction_marker_origin_type") - .HasColumnName("origin_type"); - - b.HasIndex("OriginType", "StateVersion") - .HasFilter("discriminator = 'origin'"); - - b.ToTable("ledger_transaction_markers"); - - b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.Origin); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.JsonStateHistory", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.StateHistory"); - - b.Property("JsonState") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("json_state"); - - b.ToTable("state_history"); - - b.HasDiscriminator().HasValue(StateType.Json); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.SborStateHistory", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.StateHistory"); - - b.Property("SborState") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("sbor_state"); - - b.Property("SborTypeKind") - .HasColumnType("sbor_type_kind") - .HasColumnName("sbor_type_kind"); - - b.Property("SchemaDefiningEntityId") - .HasColumnType("bigint") - .HasColumnName("schema_defining_entity_id"); - - b.Property("SchemaHash") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("schema_hash"); - - b.Property("TypeIndex") - .HasColumnType("bigint") - .HasColumnName("type_index"); - - b.ToTable("state_history"); - - b.HasDiscriminator().HasValue(StateType.Sbor); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", b => - { - b.OwnsOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionGatewayHandling", "GatewayHandling", b1 => - { - b1.Property("PendingTransactionId") - .HasColumnType("bigint"); - - b1.Property("AttemptedSubmissionToNodesCount") - .HasColumnType("integer") - .HasColumnName("node_submission_count"); - - b1.Property("FirstSubmittedToGatewayTimestamp") - .HasColumnType("timestamp with time zone") - .HasColumnName("first_submitted_to_gateway_timestamp"); - - b1.Property("HandlingStatusReason") - .HasColumnType("text") - .HasColumnName("handling_status_reason"); - - b1.Property("ResubmitFromTimestamp") - .HasColumnType("timestamp with time zone") - .HasColumnName("resubmit_from_timestamp"); - - b1.HasKey("PendingTransactionId"); - - b1.HasIndex("FirstSubmittedToGatewayTimestamp"); - - b1.HasIndex("ResubmitFromTimestamp"); - - b1.ToTable("pending_transactions"); - - b1.WithOwner() - .HasForeignKey("PendingTransactionId"); - }); - - b.OwnsOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionLedgerDetails", "LedgerDetails", b1 => - { - b1.Property("PendingTransactionId") - .HasColumnType("bigint"); - - b1.Property("CommitTimestamp") - .HasColumnType("timestamp with time zone") - .HasColumnName("commit_timestamp"); - - b1.Property("InitialRejectionReason") - .HasColumnType("text") - .HasColumnName("initial_rejection_reason"); - - b1.Property("IntentLedgerStatus") - .HasColumnType("pending_transaction_intent_ledger_status") - .HasColumnName("intent_status"); - - b1.Property("LatestRejectionReason") - .HasColumnType("text") - .HasColumnName("latest_rejection_reason"); - - b1.Property("LatestRejectionTimestamp") - .HasColumnType("timestamp with time zone") - .HasColumnName("latest_rejection_timestamp"); - - b1.Property("PayloadLedgerStatus") - .HasColumnType("pending_transaction_payload_ledger_status") - .HasColumnName("payload_status"); - - b1.HasKey("PendingTransactionId"); - - b1.ToTable("pending_transactions"); - - b1.WithOwner() - .HasForeignKey("PendingTransactionId"); - }); - - b.OwnsOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionNetworkDetails", "NetworkDetails", b1 => - { - b1.Property("PendingTransactionId") - .HasColumnType("bigint"); - - b1.Property("LastSubmitErrorTitle") - .HasColumnType("text") - .HasColumnName("last_submit_error"); - - b1.Property("LatestNodeSubmissionTimestamp") - .HasColumnType("timestamp with time zone") - .HasColumnName("latest_node_submission_timestamp"); - - b1.Property("LatestNodeSubmissionWasAccepted") - .HasColumnType("boolean") - .HasColumnName("latest_node_submission_was_accepted"); - - b1.Property("LatestSubmittedToNodeName") - .HasColumnType("text") - .HasColumnName("latest_submitted_to_node_name"); - - b1.HasKey("PendingTransactionId"); - - b1.ToTable("pending_transactions"); - - b1.WithOwner() - .HasForeignKey("PendingTransactionId"); - }); - - b.Navigation("GatewayHandling") - .IsRequired(); - - b.Navigation("LedgerDetails") - .IsRequired(); - - b.Navigation("NetworkDetails") - .IsRequired(); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionPayload", b => - { - b.HasOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", "PendingTransaction") - .WithOne("Payload") - .HasForeignKey("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionPayload", "PendingTransactionId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("PendingTransaction"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorActiveSetHistory", b => - { - b.HasOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorPublicKeyHistory", "PublicKey") - .WithMany() - .HasForeignKey("ValidatorPublicKeyHistoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PublicKey"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", b => - { - b.Navigation("Payload"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117093225_AddBlueprintHistoryAggregateTable.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117093225_AddBlueprintHistoryAggregateTable.cs deleted file mode 100644 index 6fb3750dd..000000000 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117093225_AddBlueprintHistoryAggregateTable.cs +++ /dev/null @@ -1,113 +0,0 @@ -/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). - * - * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this - * file except in compliance with the License. You may obtain a copy of the License at: - * - * radixfoundation.org/licenses/LICENSE-v1 - * - * The Licensor hereby grants permission for the Canonical version of the Work to be - * published, distributed and used under or by reference to the Licensor’s trademark - * Radix ® and use of any unregistered trade names, logos or get-up. - * - * The Licensor provides the Work (and each Contributor provides its Contributions) on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, - * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, - * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. - * - * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create - * a distributed ledger it is your responsibility to test and validate the code, together - * with all logic and performance of that code under all foreseeable scenarios. - * - * The Licensor does not make or purport to make and hereby excludes liability for all - * and any representation, warranty or undertaking in any form whatsoever, whether express - * or implied, to any entity or person, including any representation, warranty or - * undertaking, as to the functionality security use, value or other characteristics of - * any distributed ledger nor in respect the functioning or value of any tokens which may - * be created stored or transferred using the Work. The Licensor does not warrant that the - * Work or any use of the Work complies with any law or regulation in any territory where - * it may be implemented or used or that it will be appropriate for any specific purpose. - * - * Neither the licensor nor any current or former employees, officers, directors, partners, - * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor - * shall be liable for any direct or indirect, special, incidental, consequential or other - * losses of any kind, in tort, contract or otherwise (including but not limited to loss - * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss - * of any economic or other opportunity of whatsoever nature or howsoever arising), arising - * out of or in connection with (without limitation of any use, misuse, of any ledger system - * or use made or its functionality or any performance or operation of any code or protocol - * caused by bugs or programming or logic errors or otherwise); - * - * A. any offer, purchase, holding, use, sale, exchange or transmission of any - * cryptographic keys, tokens or assets created, exchanged, stored or arising from any - * interaction with the Work; - * - * B. any failure in a transmission or loss of any token or assets keys or other digital - * artefacts due to errors in transmission; - * - * C. bugs, hacks, logic errors or faults in the Work or any communication; - * - * D. system software or apparatus including but not limited to losses caused by errors - * in holding or transmitting tokens by any third-party; - * - * E. breaches or failure of security including hacker attacks, loss or disclosure of - * password, loss of private key, unauthorised use or misuse of such passwords or keys; - * - * F. any losses including loss of anticipated savings or other benefits resulting from - * use of the Work or any changes to the Work (however implemented). - * - * You are solely responsible for; testing, validating and evaluation of all operation - * logic, functionality, security and appropriateness of using the Work for any commercial - * or non-commercial purpose and for any reproduction or redistribution by You of the - * Work. You assume all risks associated with Your use of the Work and the exercise of - * permissions under this License. - */ - -using System.Collections.Generic; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace RadixDlt.NetworkGateway.PostgresIntegration.Migrations -{ - /// - public partial class AddBlueprintHistoryAggregateTable : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "package_blueprint_aggregate_history", - columns: table => new - { - id = table.Column(type: "bigint", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - from_state_version = table.Column(type: "bigint", nullable: false), - package_entity_id = table.Column(type: "bigint", nullable: false), - package_blueprint_ids = table.Column>(type: "bigint[]", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_package_blueprint_aggregate_history", x => x.id); - }); - - migrationBuilder.CreateIndex( - name: "IX_package_blueprint_aggregate_history_package_entity_id_from_~", - table: "package_blueprint_aggregate_history", - columns: new[] { "package_entity_id", "from_state_version" }); - - migrationBuilder.Sql(@" -INSERT INTO package_blueprint_aggregate_history (from_state_version, package_entity_id, package_blueprint_ids) -SELECT MIN(from_state_version) from_state_version, package_entity_id, array_agg(id order by id asc) package_blueprint_ids -FROM package_blueprint_history -GROUP BY package_entity_id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "package_blueprint_aggregate_history"); - } - } -} diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117153350_AddPackageCodeAggregateHistoryTable.Designer.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240118114735_SupportProtocolUpdate.Designer.cs similarity index 99% rename from src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117153350_AddPackageCodeAggregateHistoryTable.Designer.cs rename to src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240118114735_SupportProtocolUpdate.Designer.cs index 14cfe7a76..6e63427ad 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117153350_AddPackageCodeAggregateHistoryTable.Designer.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240118114735_SupportProtocolUpdate.Designer.cs @@ -81,8 +81,8 @@ namespace RadixDlt.NetworkGateway.PostgresIntegration.Migrations { [DbContext(typeof(MigrationsDbContext))] - [Migration("20240117153350_AddPackageCodeAggregateHistoryTable")] - partial class AddPackageCodeAggregateHistoryTable + [Migration("20240118114735_SupportProtocolUpdate")] + partial class SupportProtocolUpdate { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117153350_AddPackageCodeAggregateHistoryTable.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240118114735_SupportProtocolUpdate.cs similarity index 64% rename from src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117153350_AddPackageCodeAggregateHistoryTable.cs rename to src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240118114735_SupportProtocolUpdate.cs index d90ffe50e..07d6ebb11 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240117153350_AddPackageCodeAggregateHistoryTable.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240118114735_SupportProtocolUpdate.cs @@ -65,17 +65,65 @@ using System.Collections.Generic; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using RadixDlt.NetworkGateway.Abstractions.Model; #nullable disable namespace RadixDlt.NetworkGateway.PostgresIntegration.Migrations { /// - public partial class AddPackageCodeAggregateHistoryTable : Migration + public partial class SupportProtocolUpdate : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { + // Support flash transaction type. + migrationBuilder.AlterDatabase() + .Annotation("Npgsql:Enum:ledger_transaction_type", "genesis,user,round_update,flash") + .OldAnnotation("Npgsql:Enum:ledger_transaction_type", "genesis,user,round_update"); + + // Store package vm type on package_code_history + migrationBuilder.AddColumn( + name: "vm_type", + table: "package_code_history", + type: "package_vm_type", + nullable: false, + defaultValue: PackageVmType.Native); + + migrationBuilder.Sql("update package_code_history pch set vm_type = (select vm_type from entities e where e.id = pch.package_entity_id)"); + + migrationBuilder.DropColumn( + name: "vm_type", + table: "entities"); + + // Create aggregate for package blueprint. + migrationBuilder.CreateTable( + name: "package_blueprint_aggregate_history", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + from_state_version = table.Column(type: "bigint", nullable: false), + package_entity_id = table.Column(type: "bigint", nullable: false), + package_blueprint_ids = table.Column>(type: "bigint[]", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_package_blueprint_aggregate_history", x => x.id); + }); + + migrationBuilder.CreateIndex( + name: "IX_package_blueprint_aggregate_history_package_entity_id_from_~", + table: "package_blueprint_aggregate_history", + columns: new[] { "package_entity_id", "from_state_version" }); + + migrationBuilder.Sql(@" + INSERT INTO package_blueprint_aggregate_history (from_state_version, package_entity_id, package_blueprint_ids) + SELECT MIN(from_state_version) from_state_version, package_entity_id, array_agg(id order by id asc) package_blueprint_ids + FROM package_blueprint_history + GROUP BY package_entity_id"); + + // Create aggregate for package code. migrationBuilder.CreateTable( name: "package_code_aggregate_history", columns: table => new @@ -106,8 +154,25 @@ FROM package_code_history /// protected override void Down(MigrationBuilder migrationBuilder) { + migrationBuilder.DropTable( + name: "package_blueprint_aggregate_history"); + migrationBuilder.DropTable( name: "package_code_aggregate_history"); + + migrationBuilder.DropColumn( + name: "vm_type", + table: "package_code_history"); + + migrationBuilder.AddColumn( + name: "vm_type", + table: "entities", + type: "package_vm_type", + nullable: true); + + migrationBuilder.AlterDatabase() + .Annotation("Npgsql:Enum:ledger_transaction_type", "genesis,user,round_update") + .OldAnnotation("Npgsql:Enum:ledger_transaction_type", "genesis,user,round_update,flash"); } } } diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql index c6b2e8084..fd4cd0bde 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql @@ -1099,59 +1099,28 @@ START TRANSACTION; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240110094622_AddFlashTransactionType') THEN - ALTER TYPE ledger_transaction_type ADD VALUE 'flash'; + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240118114735_SupportProtocolUpdate') THEN + ALTER TABLE entities DROP COLUMN vm_type; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240110094622_AddFlashTransactionType') THEN - INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") - VALUES ('20240110094622_AddFlashTransactionType', '7.0.11'); + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240118114735_SupportProtocolUpdate') THEN + ALTER TYPE ledger_transaction_type ADD VALUE 'flash'; END IF; END $EF$; -COMMIT; - -START TRANSACTION; - DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240116140418_MoveVmTypeToCodeHistoryTable') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240118114735_SupportProtocolUpdate') THEN ALTER TABLE package_code_history ADD vm_type package_vm_type NOT NULL DEFAULT 'native'::package_vm_type; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240116140418_MoveVmTypeToCodeHistoryTable') THEN - update package_code_history pch set vm_type = (select vm_type from entities e where e.id = pch.package_entity_id) - END IF; -END $EF$; - -DO $EF$ -BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240116140418_MoveVmTypeToCodeHistoryTable') THEN - ALTER TABLE entities DROP COLUMN vm_type; - END IF; -END $EF$; - -DO $EF$ -BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240116140418_MoveVmTypeToCodeHistoryTable') THEN - INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") - VALUES ('20240116140418_MoveVmTypeToCodeHistoryTable', '7.0.11'); - END IF; -END $EF$; -COMMIT; - -START TRANSACTION; - - -DO $EF$ -BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240117093225_AddBlueprintHistoryAggregateTable') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240118114735_SupportProtocolUpdate') THEN CREATE TABLE package_blueprint_aggregate_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -1164,37 +1133,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240117093225_AddBlueprintHistoryAggregateTable') THEN - CREATE INDEX "IX_package_blueprint_aggregate_history_package_entity_id_from_~" ON package_blueprint_aggregate_history (package_entity_id, from_state_version); - END IF; -END $EF$; - -DO $EF$ -BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240117093225_AddBlueprintHistoryAggregateTable') THEN - - INSERT INTO package_blueprint_aggregate_history (from_state_version, package_entity_id, package_blueprint_ids) - SELECT MIN(from_state_version) from_state_version, package_entity_id, array_agg(id order by id asc) package_blueprint_ids - FROM package_blueprint_history - GROUP BY package_entity_id - END IF; -END $EF$; - -DO $EF$ -BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240117093225_AddBlueprintHistoryAggregateTable') THEN - INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") - VALUES ('20240117093225_AddBlueprintHistoryAggregateTable', '7.0.11'); - END IF; -END $EF$; -COMMIT; - -START TRANSACTION; - - -DO $EF$ -BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240117153350_AddPackageCodeAggregateHistoryTable') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240118114735_SupportProtocolUpdate') THEN CREATE TABLE package_code_aggregate_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -1207,27 +1146,23 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240117153350_AddPackageCodeAggregateHistoryTable') THEN - CREATE INDEX "IX_package_code_aggregate_history_package_entity_id_from_state~" ON package_code_aggregate_history (package_entity_id, from_state_version); + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240118114735_SupportProtocolUpdate') THEN + CREATE INDEX "IX_package_blueprint_aggregate_history_package_entity_id_from_~" ON package_blueprint_aggregate_history (package_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240117153350_AddPackageCodeAggregateHistoryTable') THEN - - INSERT INTO package_code_aggregate_history (from_state_version, package_entity_id, package_code_ids) - SELECT MIN(from_state_version) from_state_version, package_entity_id, array_agg(id order by id asc) package_code_ids - FROM package_code_history - GROUP BY package_entity_id + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240118114735_SupportProtocolUpdate') THEN + CREATE INDEX "IX_package_code_aggregate_history_package_entity_id_from_state~" ON package_code_aggregate_history (package_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240117153350_AddPackageCodeAggregateHistoryTable') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240118114735_SupportProtocolUpdate') THEN INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") - VALUES ('20240117153350_AddPackageCodeAggregateHistoryTable', '7.0.11'); + VALUES ('20240118114735_SupportProtocolUpdate', '7.0.11'); END IF; END $EF$; COMMIT; From ccad6d99c1146be90e34ddfcbfcf580f03d24381 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Pawelec?= Date: Thu, 18 Jan 2024 13:21:16 +0100 Subject: [PATCH 10/19] cleanup. --- .../gateway-api-schema.yaml | 2 +- ...tateEntityDetailsResponsePackageDetails.cs | 11 +++++-- ...ntityDetailsResponsePackageDetailsAllOf.cs | 11 +++++-- .../PackageBlueprintAggregator.cs | 24 +++++++------- .../LedgerExtension/PackageCodeAggregator.cs | 18 +++++----- .../PostgresLedgerExtenderService.cs | 33 ++++++++++--------- .../LedgerExtension/ReadHelper.cs | 10 +++--- .../LedgerExtension/Records.cs | 4 --- 8 files changed, 62 insertions(+), 51 deletions(-) diff --git a/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml b/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml index 5ee437346..c0577a109 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml +++ b/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml @@ -3111,7 +3111,7 @@ components: - $ref: "#/components/schemas/StateEntityDetailsResponseItemDetails" - type: object required: - - code_items + - codes - vm_type - code_hash_hex - code_hex diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetails.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetails.cs index 921a43873..d127015ec 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetails.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetails.cs @@ -117,7 +117,7 @@ protected StateEntityDetailsResponsePackageDetails() { } /// /// Initializes a new instance of the class. /// - /// codes. + /// codes (required). /// vmType (required). /// Hex-encoded binary blob. (required). /// Hex-encoded binary blob. (required). @@ -127,6 +127,12 @@ protected StateEntityDetailsResponsePackageDetails() { } /// type (required) (default to StateEntityDetailsResponseItemDetailsType.Package). public StateEntityDetailsResponsePackageDetails(StateEntityDetailsResponsePackageDetailsCodeCollection codes = default(StateEntityDetailsResponsePackageDetailsCodeCollection), PackageVmType vmType = default(PackageVmType), string codeHashHex = default(string), string codeHex = default(string), string royaltyVaultBalance = default(string), StateEntityDetailsResponsePackageDetailsBlueprintCollection blueprints = default(StateEntityDetailsResponsePackageDetailsBlueprintCollection), StateEntityDetailsResponsePackageDetailsSchemaCollection schemas = default(StateEntityDetailsResponsePackageDetailsSchemaCollection), StateEntityDetailsResponseItemDetailsType type = StateEntityDetailsResponseItemDetailsType.Package) : base(type) { + // to ensure "codes" is required (not null) + if (codes == null) + { + throw new ArgumentNullException("codes is a required property for StateEntityDetailsResponsePackageDetails and cannot be null"); + } + this.Codes = codes; this.VmType = vmType; // to ensure "codeHashHex" is required (not null) if (codeHashHex == null) @@ -140,7 +146,6 @@ protected StateEntityDetailsResponsePackageDetails() { } throw new ArgumentNullException("codeHex is a required property for StateEntityDetailsResponsePackageDetails and cannot be null"); } this.CodeHex = codeHex; - this.Codes = codes; this.RoyaltyVaultBalance = royaltyVaultBalance; this.Blueprints = blueprints; this.Schemas = schemas; @@ -149,7 +154,7 @@ protected StateEntityDetailsResponsePackageDetails() { } /// /// Gets or Sets Codes /// - [DataMember(Name = "codes", EmitDefaultValue = true)] + [DataMember(Name = "codes", IsRequired = true, EmitDefaultValue = true)] public StateEntityDetailsResponsePackageDetailsCodeCollection Codes { get; set; } /// diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetailsAllOf.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetailsAllOf.cs index 4f5e2db6f..3790668bb 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetailsAllOf.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetailsAllOf.cs @@ -109,7 +109,7 @@ protected StateEntityDetailsResponsePackageDetailsAllOf() { } /// /// Initializes a new instance of the class. /// - /// codes. + /// codes (required). /// vmType (required). /// Hex-encoded binary blob. (required). /// Hex-encoded binary blob. (required). @@ -118,6 +118,12 @@ protected StateEntityDetailsResponsePackageDetailsAllOf() { } /// schemas. public StateEntityDetailsResponsePackageDetailsAllOf(StateEntityDetailsResponsePackageDetailsCodeCollection codes = default(StateEntityDetailsResponsePackageDetailsCodeCollection), PackageVmType vmType = default(PackageVmType), string codeHashHex = default(string), string codeHex = default(string), string royaltyVaultBalance = default(string), StateEntityDetailsResponsePackageDetailsBlueprintCollection blueprints = default(StateEntityDetailsResponsePackageDetailsBlueprintCollection), StateEntityDetailsResponsePackageDetailsSchemaCollection schemas = default(StateEntityDetailsResponsePackageDetailsSchemaCollection)) { + // to ensure "codes" is required (not null) + if (codes == null) + { + throw new ArgumentNullException("codes is a required property for StateEntityDetailsResponsePackageDetailsAllOf and cannot be null"); + } + this.Codes = codes; this.VmType = vmType; // to ensure "codeHashHex" is required (not null) if (codeHashHex == null) @@ -131,7 +137,6 @@ protected StateEntityDetailsResponsePackageDetailsAllOf() { } throw new ArgumentNullException("codeHex is a required property for StateEntityDetailsResponsePackageDetailsAllOf and cannot be null"); } this.CodeHex = codeHex; - this.Codes = codes; this.RoyaltyVaultBalance = royaltyVaultBalance; this.Blueprints = blueprints; this.Schemas = schemas; @@ -140,7 +145,7 @@ protected StateEntityDetailsResponsePackageDetailsAllOf() { } /// /// Gets or Sets Codes /// - [DataMember(Name = "codes", EmitDefaultValue = true)] + [DataMember(Name = "codes", IsRequired = true, EmitDefaultValue = true)] public StateEntityDetailsResponsePackageDetailsCodeCollection Codes { get; set; } /// diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageBlueprintAggregator.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageBlueprintAggregator.cs index 1414e804d..33f2a5afc 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageBlueprintAggregator.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageBlueprintAggregator.cs @@ -69,19 +69,21 @@ namespace RadixDlt.NetworkGateway.PostgresIntegration.LedgerExtension; -internal abstract record PackageBlueprintChange(long StateVersion, long PackageEntityId, string Name, string Version); +internal record struct PackageBlueprintLookup(long PackageEntityId, string Name, string Version); -internal record PackageBlueprintDefinitionChange(long StateVersion, long PackageEntityId, string Name, string Version, string Definition) - : PackageBlueprintChange(StateVersion, PackageEntityId, Name, Version); +internal abstract record PackageBlueprintChange(long StateVersion, PackageBlueprintLookup Lookup); -internal record PackageBlueprintDependantEntityIdsChange(long StateVersion, long PackageEntityId, string Name, string Version, List? DependantEntityIds = null) - : PackageBlueprintChange(StateVersion, PackageEntityId, Name, Version); +internal record PackageBlueprintDefinitionChange(long StateVersion, PackageBlueprintLookup Lookup, string Definition) + : PackageBlueprintChange(StateVersion, Lookup); -internal record PackageBlueprintAuthTemplateChange(long StateVersion, long PackageEntityId, string Name, string Version, string? AuthTemplate = null, bool? AuthTemplateIsLocked = null) - : PackageBlueprintChange(StateVersion, PackageEntityId, Name, Version); +internal record PackageBlueprintDependantEntityIdsChange(long StateVersion, PackageBlueprintLookup Lookup, List? DependantEntityIds = null) + : PackageBlueprintChange(StateVersion, Lookup); -internal record PackageBlueprintRoyaltyConfigChange(long StateVersion, long PackageEntityId, string Name, string Version, string? RoyaltyConfig = null, bool? RoyaltyConfigIsLocked = null) - : PackageBlueprintChange(StateVersion, PackageEntityId, Name, Version); +internal record PackageBlueprintAuthTemplateChange(long StateVersion, PackageBlueprintLookup Lookup, string? AuthTemplate = null, bool? AuthTemplateIsLocked = null) + : PackageBlueprintChange(StateVersion, Lookup); + +internal record PackageBlueprintRoyaltyConfigChange(long StateVersion, PackageBlueprintLookup Lookup, string? RoyaltyConfig = null, bool? RoyaltyConfigIsLocked = null) + : PackageBlueprintChange(StateVersion, Lookup); internal static class PackageBlueprintAggregator { @@ -94,7 +96,7 @@ public static (List PackageBlueprintHistoryToAdd, List< var packageBlueprintHistoryToAdd = new List(); var packageBlueprintAggregateHistoryToAdd = new List(); - var packageGroups = packageBlueprintChanges.GroupBy(x => new { x.PackageEntityId, x.StateVersion }); + var packageGroups = packageBlueprintChanges.GroupBy(x => new { x.Lookup.PackageEntityId, x.StateVersion }); foreach (var packageGroup in packageGroups) { @@ -124,7 +126,7 @@ public static (List PackageBlueprintHistoryToAdd, List< } var packageBlueprintGroups = packageGroup - .GroupBy(x => new { x.PackageEntityId, x.Name, x.Version, x.StateVersion }); + .GroupBy(x => new { x.Lookup.PackageEntityId, x.Lookup.Name, x.Lookup.Version, x.StateVersion }); foreach (var packageBlueprintGroup in packageBlueprintGroups) { diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageCodeAggregator.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageCodeAggregator.cs index 3d13975fd..c5394c286 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageCodeAggregator.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageCodeAggregator.cs @@ -71,11 +71,13 @@ namespace RadixDlt.NetworkGateway.PostgresIntegration.LedgerExtension; -internal abstract record PackageCodeChange(long StateVersion, long PackageEntityId, byte[] CodeHash); +internal record struct PackageCodeLookup(long PackageEntityId, ValueBytes CodeHash); -internal record PackageCodeByteChange(long StateVersion, long PackageEntityId, byte[] CodeHash, byte[] Code) : PackageCodeChange(StateVersion, PackageEntityId, CodeHash); +internal abstract record PackageCodeChange(long StateVersion, PackageCodeLookup Lookup); -internal record PackageCodeVmChange(long StateVersion, long PackageEntityId, byte[] CodeHash, PackageVmType VmType) : PackageCodeChange(StateVersion, PackageEntityId, CodeHash); +internal record PackageCodeByteChange(long StateVersion, PackageCodeLookup Lookup, byte[] Code) : PackageCodeChange(StateVersion, Lookup); + +internal record PackageCodeVmChange(long StateVersion, PackageCodeLookup Lookup, PackageVmType VmType) : PackageCodeChange(StateVersion, Lookup); internal static class PackageCodeAggregator { @@ -88,7 +90,7 @@ public static (List PackageCodeHistoryToAdd, List(); var packageCodeAggregateHistoryToAdd = new List(); - var packageGroups = packageCodeChanges.GroupBy(x => new { x.PackageEntityId, x.StateVersion }); + var packageGroups = packageCodeChanges.GroupBy(x => new { x.Lookup.PackageEntityId, x.StateVersion }); foreach (var packageGroup in packageGroups) { @@ -119,7 +121,7 @@ public static (List PackageCodeHistoryToAdd, List new { x.PackageEntityId, CodeHash = (ValueBytes)x.CodeHash, x.StateVersion }); + .GroupBy(x => new { x.Lookup.PackageEntityId, x.Lookup.CodeHash, x.StateVersion }); foreach (var packageCodeGroup in packageCodeGroups) { @@ -130,13 +132,13 @@ public static (List PackageCodeHistoryToAdd, List PackageCodeHistoryToAdd, List ProcessTransactions(ReadWriteDbContext db if (substateData is CoreModel.PackageBlueprintDefinitionEntrySubstate packageBlueprintDefinition) { + var lookup = new PackageBlueprintLookup(referencedEntity.DatabaseId, packageBlueprintDefinition.Key.BlueprintName, packageBlueprintDefinition.Key.BlueprintVersion); + packageBlueprintChanges.Add( new PackageBlueprintDefinitionChange( stateVersion, - referencedEntity.DatabaseId, - packageBlueprintDefinition.Key.BlueprintName, - packageBlueprintDefinition.Key.BlueprintVersion, + lookup, packageBlueprintDefinition.Value.Definition.ToJson() )); } if (substateData is CoreModel.PackageBlueprintDependenciesEntrySubstate packageBlueprintDependencies) { + var lookup = new PackageBlueprintLookup(referencedEntity.DatabaseId, packageBlueprintDependencies.Key.BlueprintName, packageBlueprintDependencies.Key.BlueprintVersion); packageBlueprintChanges.Add( new PackageBlueprintDependantEntityIdsChange( stateVersion, - referencedEntity.DatabaseId, - packageBlueprintDependencies.Key.BlueprintName, - packageBlueprintDependencies.Key.BlueprintVersion, + lookup, packageBlueprintDependencies.Value.Dependencies.Dependencies.Select(address => referencedEntities.Get((EntityAddress)address).DatabaseId).ToList() )); } if (substateData is CoreModel.PackageBlueprintRoyaltyEntrySubstate packageBlueprintRoyalty) { + var lookup = new PackageBlueprintLookup(referencedEntity.DatabaseId, packageBlueprintRoyalty.Key.BlueprintName, packageBlueprintRoyalty.Key.BlueprintVersion); + packageBlueprintChanges.Add( new PackageBlueprintRoyaltyConfigChange( stateVersion, - referencedEntity.DatabaseId, - packageBlueprintRoyalty.Key.BlueprintName, - packageBlueprintRoyalty.Key.BlueprintVersion, + lookup, packageBlueprintRoyalty.Value.RoyaltyConfig.ToJson(), packageBlueprintRoyalty.IsLocked )); @@ -994,12 +993,12 @@ private async Task ProcessTransactions(ReadWriteDbContext db if (substateData is CoreModel.PackageBlueprintAuthTemplateEntrySubstate packageBlueprintAuthTemplate) { + var lookup = new PackageBlueprintLookup(referencedEntity.DatabaseId, packageBlueprintAuthTemplate.Key.BlueprintName, packageBlueprintAuthTemplate.Key.BlueprintVersion); + packageBlueprintChanges.Add( new PackageBlueprintAuthTemplateChange( stateVersion, - referencedEntity.DatabaseId, - packageBlueprintAuthTemplate.Key.BlueprintName, - packageBlueprintAuthTemplate.Key.BlueprintVersion, + lookup, packageBlueprintAuthTemplate.Value.AuthConfig.ToJson(), packageBlueprintAuthTemplate.IsLocked )); @@ -1007,20 +1006,22 @@ private async Task ProcessTransactions(ReadWriteDbContext db if (substateData is CoreModel.PackageCodeOriginalCodeEntrySubstate packageCodeOriginalCode) { + var lookup = new PackageCodeLookup(referencedEntity.DatabaseId, (ValueBytes)packageCodeOriginalCode.Key.CodeHash.ConvertFromHex()); + packageCodeChanges.Add(new PackageCodeByteChange( stateVersion, - referencedEntity.DatabaseId, - packageCodeOriginalCode.Key.CodeHash.ConvertFromHex(), + lookup, packageCodeOriginalCode.Value.CodeHex.ConvertFromHex() )); } if (substateData is CoreModel.PackageCodeVmTypeEntrySubstate packageCodeVmType) { + var lookup = new PackageCodeLookup(referencedEntity.DatabaseId, (ValueBytes)packageCodeVmType.Key.CodeHash.ConvertFromHex()); + packageCodeChanges.Add(new PackageCodeVmChange( stateVersion, - referencedEntity.DatabaseId, - packageCodeVmType.Key.CodeHash.ConvertFromHex(), + lookup, packageCodeVmType.Value.VmType.ToModel() )); } diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/ReadHelper.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/ReadHelper.cs index fdb6cc12b..60ab078fb 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/ReadHelper.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/ReadHelper.cs @@ -109,7 +109,7 @@ public async Task> M foreach (var change in packageBlueprintChanges) { - lookupSet.Add(new PackageBlueprintLookup(change.PackageEntityId, change.Name, change.Version)); + lookupSet.Add(change.Lookup); } foreach (var lookup in lookupSet) @@ -158,13 +158,13 @@ public async Task> MostRecentP foreach (var change in packageCodeChanges) { - lookupSet.Add(new PackageCodeLookup(change.PackageEntityId, change.CodeHash)); + lookupSet.Add(change.Lookup); } foreach (var lookup in lookupSet) { entityIds.Add(lookup.PackageEntityId); - codeHashes.Add(lookup.CodeHex); + codeHashes.Add(lookup.CodeHash); } var result = await _dbContext @@ -246,7 +246,7 @@ public async Task> MostRecentPacka } var sw = Stopwatch.GetTimestamp(); - var packageEntityIds = packageCodeChanges.Select(x => x.PackageEntityId).Distinct().ToList(); + var packageEntityIds = packageCodeChanges.Select(x => x.Lookup.PackageEntityId).Distinct().ToList(); var result = await _dbContext .PackageCodeAggregateHistory @@ -280,7 +280,7 @@ public async Task> MostRecent } var sw = Stopwatch.GetTimestamp(); - var packageEntityIds = packageBlueprintChanges.Select(x => x.PackageEntityId).Distinct().ToList(); + var packageEntityIds = packageBlueprintChanges.Select(x => x.Lookup.PackageEntityId).Distinct().ToList(); var result = await _dbContext .PackageBlueprintAggregateHistory diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Records.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Records.cs index 5dbc2404c..713cad701 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Records.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Records.cs @@ -109,10 +109,6 @@ internal record ValidatorSetChange(long Epoch, IDictionary Date: Thu, 18 Jan 2024 15:34:10 +0100 Subject: [PATCH 11/19] match builder style with previous aggregated tables --- .../PackageBlueprintAggregator.cs | 148 ++++++++---------- .../LedgerExtension/PackageCodeAggregator.cs | 110 ++++++------- .../PostgresLedgerExtenderService.cs | 98 ++++++------ .../LedgerExtension/ReadHelper.cs | 22 +-- 4 files changed, 161 insertions(+), 217 deletions(-) diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageBlueprintAggregator.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageBlueprintAggregator.cs index 33f2a5afc..96b6dbc9e 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageBlueprintAggregator.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageBlueprintAggregator.cs @@ -62,143 +62,119 @@ * permissions under this License. */ +using RadixDlt.NetworkGateway.Abstractions; using RadixDlt.NetworkGateway.PostgresIntegration.Models; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; +using CoreModel = RadixDlt.CoreApiSdk.Model; namespace RadixDlt.NetworkGateway.PostgresIntegration.LedgerExtension; internal record struct PackageBlueprintLookup(long PackageEntityId, string Name, string Version); -internal abstract record PackageBlueprintChange(long StateVersion, PackageBlueprintLookup Lookup); - -internal record PackageBlueprintDefinitionChange(long StateVersion, PackageBlueprintLookup Lookup, string Definition) - : PackageBlueprintChange(StateVersion, Lookup); +internal record PackageBlueprintChange(long StateVersion) +{ + public CoreModel.PackageBlueprintDefinitionEntrySubstate? PackageBlueprintDefinition { get; set; } -internal record PackageBlueprintDependantEntityIdsChange(long StateVersion, PackageBlueprintLookup Lookup, List? DependantEntityIds = null) - : PackageBlueprintChange(StateVersion, Lookup); + public CoreModel.PackageBlueprintDependenciesEntrySubstate? PackageBlueprintDependencies { get; set; } -internal record PackageBlueprintAuthTemplateChange(long StateVersion, PackageBlueprintLookup Lookup, string? AuthTemplate = null, bool? AuthTemplateIsLocked = null) - : PackageBlueprintChange(StateVersion, Lookup); + public CoreModel.PackageBlueprintRoyaltyEntrySubstate? PackageBlueprintRoyalty { get; set; } -internal record PackageBlueprintRoyaltyConfigChange(long StateVersion, PackageBlueprintLookup Lookup, string? RoyaltyConfig = null, bool? RoyaltyConfigIsLocked = null) - : PackageBlueprintChange(StateVersion, Lookup); + public CoreModel.PackageBlueprintAuthTemplateEntrySubstate? PackageBlueprintAuthTemplate { get; set; } +} internal static class PackageBlueprintAggregator { public static (List PackageBlueprintHistoryToAdd, List PackageBlueprintAggregateHistoryToAdd) AggregatePackageBlueprint( - List packageBlueprintChanges, + Dictionary packageBlueprintChanges, Dictionary mostRecentPackageBlueprintHistory, Dictionary mostRecentPackageBlueprintAggregateHistory, + ReferencedEntityDictionary referencedEntities, SequencesHolder sequences) { var packageBlueprintHistoryToAdd = new List(); var packageBlueprintAggregateHistoryToAdd = new List(); - var packageGroups = packageBlueprintChanges.GroupBy(x => new { x.Lookup.PackageEntityId, x.StateVersion }); - - foreach (var packageGroup in packageGroups) + foreach (var change in packageBlueprintChanges) { - var packageEntityId = packageGroup.Key.PackageEntityId; - var stateVersion = packageGroup.Key.StateVersion; + var packageEntityId = change.Key.PackageEntityId; + var stateVersion = change.Value.StateVersion; mostRecentPackageBlueprintAggregateHistory.TryGetValue(packageEntityId, out var existingPackageBlueprintAggregate); PackageBlueprintAggregateHistory packageBlueprintAggregate; - if (existingPackageBlueprintAggregate == null) + if (existingPackageBlueprintAggregate == null || existingPackageBlueprintAggregate.FromStateVersion != change.Value.StateVersion) { packageBlueprintAggregate = new PackageBlueprintAggregateHistory { Id = sequences.PackageBlueprintAggregateHistorySequence++, FromStateVersion = stateVersion, PackageEntityId = packageEntityId, - PackageBlueprintIds = new List(), + PackageBlueprintIds = existingPackageBlueprintAggregate?.PackageBlueprintIds ?? new List(), }; mostRecentPackageBlueprintAggregateHistory[packageEntityId] = packageBlueprintAggregate; + packageBlueprintAggregateHistoryToAdd.Add(packageBlueprintAggregate); } else { packageBlueprintAggregate = existingPackageBlueprintAggregate; - packageBlueprintAggregate.Id = sequences.PackageBlueprintAggregateHistorySequence++; - packageBlueprintAggregate.FromStateVersion = stateVersion; } - var packageBlueprintGroups = packageGroup - .GroupBy(x => new { x.Lookup.PackageEntityId, x.Lookup.Name, x.Lookup.Version, x.StateVersion }); + mostRecentPackageBlueprintHistory.TryGetValue(change.Key, out var existingPackageBlueprint); + + PackageBlueprintHistory packageBlueprintHistory; - foreach (var packageBlueprintGroup in packageBlueprintGroups) + if (existingPackageBlueprint != null) { - var lookup = new PackageBlueprintLookup(packageEntityId, packageBlueprintGroup.Key.Name, packageBlueprintGroup.Key.Version); - mostRecentPackageBlueprintHistory.TryGetValue(lookup, out var existingPackageBlueprint); + var previousPackageBlueprintHistoryId = existingPackageBlueprint.Id; - PackageBlueprintHistory packageBlueprintHistory; + packageBlueprintHistory = existingPackageBlueprint; + packageBlueprintHistory.Id = sequences.PackageBlueprintHistorySequence++; + packageBlueprintHistory.FromStateVersion = change.Value.StateVersion; - if (existingPackageBlueprint != null) + packageBlueprintAggregate.PackageBlueprintIds.Remove(previousPackageBlueprintHistoryId); + packageBlueprintAggregate.PackageBlueprintIds.Add(packageBlueprintHistory.Id); + } + else + { + packageBlueprintHistory = new PackageBlueprintHistory { - var previousPackageBlueprintHistoryId = existingPackageBlueprint.Id; + Id = sequences.PackageBlueprintHistorySequence++, + PackageEntityId = packageEntityId, + FromStateVersion = stateVersion, + Name = change.Key.Name, + Version = change.Key.Version, + }; + mostRecentPackageBlueprintHistory[change.Key] = packageBlueprintHistory; + + packageBlueprintAggregate.PackageBlueprintIds.Add(packageBlueprintHistory.Id); + } - packageBlueprintHistory = existingPackageBlueprint; - packageBlueprintHistory.Id = sequences.PackageBlueprintHistorySequence++; - packageBlueprintHistory.FromStateVersion = packageBlueprintGroup.Key.StateVersion; + if (change.Value.PackageBlueprintDefinition != null) + { + packageBlueprintHistory.Definition = change.Value.PackageBlueprintDefinition.Value.Definition.ToJson(); + } - packageBlueprintAggregate.PackageBlueprintIds.Remove(previousPackageBlueprintHistoryId); - packageBlueprintAggregate.PackageBlueprintIds.Add(packageBlueprintHistory.Id); - } - else - { - packageBlueprintHistory = new PackageBlueprintHistory - { - Id = sequences.PackageBlueprintHistorySequence++, - PackageEntityId = packageEntityId, - FromStateVersion = stateVersion, - Name = lookup.Name, - Version = lookup.Version, - }; - mostRecentPackageBlueprintHistory[lookup] = packageBlueprintHistory; - - packageBlueprintAggregate.PackageBlueprintIds.Add(packageBlueprintHistory.Id); - } - - foreach (var change in packageBlueprintGroup) - { - switch (change) - { - case PackageBlueprintDefinitionChange definitionChange: - { - packageBlueprintHistory.Definition = definitionChange.Definition; - break; - } - - case PackageBlueprintAuthTemplateChange authTemplateChange: - { - packageBlueprintHistory.AuthTemplate = authTemplateChange.AuthTemplate; - packageBlueprintHistory.AuthTemplateIsLocked = authTemplateChange.AuthTemplateIsLocked; - break; - } - - case PackageBlueprintRoyaltyConfigChange royaltyConfigChange: - { - packageBlueprintHistory.RoyaltyConfig = royaltyConfigChange.RoyaltyConfig; - packageBlueprintHistory.RoyaltyConfigIsLocked = royaltyConfigChange.RoyaltyConfigIsLocked; - break; - } - - case PackageBlueprintDependantEntityIdsChange dependantEntityIdsChange: - { - packageBlueprintHistory.DependantEntityIds = dependantEntityIdsChange.DependantEntityIds; - break; - } - - default: throw new UnreachableException($"Unexpected type of package blueprint change: {change.GetType()}"); - } - } - - packageBlueprintHistoryToAdd.Add(packageBlueprintHistory); + if (change.Value.PackageBlueprintDependencies != null) + { + packageBlueprintHistory.DependantEntityIds = + change.Value.PackageBlueprintDependencies.Value.Dependencies.Dependencies.Select(address => referencedEntities.Get((EntityAddress)address).DatabaseId).ToList(); + } + + if (change.Value.PackageBlueprintRoyalty != null) + { + packageBlueprintHistory.RoyaltyConfig = change.Value.PackageBlueprintRoyalty.Value.RoyaltyConfig.ToJson(); + packageBlueprintHistory.RoyaltyConfigIsLocked = change.Value.PackageBlueprintRoyalty.IsLocked; + } + + if (change.Value.PackageBlueprintAuthTemplate != null) + { + packageBlueprintHistory.AuthTemplate = change.Value.PackageBlueprintAuthTemplate.Value.AuthConfig.ToJson(); + packageBlueprintHistory.AuthTemplateIsLocked = change.Value.PackageBlueprintAuthTemplate.IsLocked; } - packageBlueprintAggregateHistoryToAdd.Add(packageBlueprintAggregate); + packageBlueprintHistoryToAdd.Add(packageBlueprintHistory); } return (packageBlueprintHistoryToAdd, packageBlueprintAggregateHistoryToAdd); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageCodeAggregator.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageCodeAggregator.cs index c5394c286..27e7de942 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageCodeAggregator.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageCodeAggregator.cs @@ -63,26 +63,26 @@ */ using RadixDlt.NetworkGateway.Abstractions; -using RadixDlt.NetworkGateway.Abstractions.Model; +using RadixDlt.NetworkGateway.Abstractions.Extensions; using RadixDlt.NetworkGateway.PostgresIntegration.Models; using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; +using CoreModel = RadixDlt.CoreApiSdk.Model; namespace RadixDlt.NetworkGateway.PostgresIntegration.LedgerExtension; internal record struct PackageCodeLookup(long PackageEntityId, ValueBytes CodeHash); -internal abstract record PackageCodeChange(long StateVersion, PackageCodeLookup Lookup); - -internal record PackageCodeByteChange(long StateVersion, PackageCodeLookup Lookup, byte[] Code) : PackageCodeChange(StateVersion, Lookup); +internal record PackageCodeChange(long StateVersion) +{ + public CoreModel.PackageCodeOriginalCodeEntrySubstate? PackageCodeOriginalCode { get; set; } -internal record PackageCodeVmChange(long StateVersion, PackageCodeLookup Lookup, PackageVmType VmType) : PackageCodeChange(StateVersion, Lookup); + public CoreModel.PackageCodeVmTypeEntrySubstate? PackageCodeVmType { get; set; } +} internal static class PackageCodeAggregator { public static (List PackageCodeHistoryToAdd, List PackageCodeAggregateHistoryToAdd) AggregatePackageCode( - List packageCodeChanges, + Dictionary packageCodeChanges, Dictionary mostRecentPackageCodeHistory, Dictionary mostRecentPackageCodeAggregateHistory, SequencesHolder sequences) @@ -90,96 +90,74 @@ public static (List PackageCodeHistoryToAdd, List(); var packageCodeAggregateHistoryToAdd = new List(); - var packageGroups = packageCodeChanges.GroupBy(x => new { x.Lookup.PackageEntityId, x.StateVersion }); - - foreach (var packageGroup in packageGroups) + foreach (var change in packageCodeChanges) { - var packageEntityId = packageGroup.Key.PackageEntityId; - var stateVersion = packageGroup.Key.StateVersion; + var packageEntityId = change.Key.PackageEntityId; + var stateVersion = change.Value.StateVersion; mostRecentPackageCodeAggregateHistory.TryGetValue(packageEntityId, out var existingPackageCodeAggregate); PackageCodeAggregateHistory packageCodeAggregate; - if (existingPackageCodeAggregate == null) + if (existingPackageCodeAggregate == null || existingPackageCodeAggregate.FromStateVersion != change.Value.StateVersion) { packageCodeAggregate = new PackageCodeAggregateHistory { Id = sequences.PackageCodeAggregateHistorySequence++, FromStateVersion = stateVersion, PackageEntityId = packageEntityId, - PackageCodeIds = new List(), + PackageCodeIds = existingPackageCodeAggregate?.PackageCodeIds ?? new List(), }; mostRecentPackageCodeAggregateHistory[packageEntityId] = packageCodeAggregate; + packageCodeAggregateHistoryToAdd.Add(packageCodeAggregate); } else { packageCodeAggregate = existingPackageCodeAggregate; - packageCodeAggregate.Id = sequences.PackageCodeAggregateHistorySequence++; - packageCodeAggregate.FromStateVersion = stateVersion; } - var packageCodeGroups = packageGroup - .GroupBy(x => new { x.Lookup.PackageEntityId, x.Lookup.CodeHash, x.StateVersion }); + mostRecentPackageCodeHistory.TryGetValue(change.Key, out var existingPackageCode); + + PackageCodeHistory packageCodeHistory; - foreach (var packageCodeGroup in packageCodeGroups) + if (existingPackageCode != null) { - var lookup = new PackageCodeLookup(packageEntityId, packageCodeGroup.Key.CodeHash); - mostRecentPackageCodeHistory.TryGetValue(lookup, out var existingPackageCode); + var previousPackageCodeId = existingPackageCode.Id; - PackageCodeHistory packageCodeHistory; + packageCodeHistory = existingPackageCode; + packageCodeHistory.Id = sequences.PackageCodeHistorySequence++; + packageCodeHistory.FromStateVersion = change.Value.StateVersion; - if (existingPackageCode != null) + packageCodeAggregate.PackageCodeIds.Remove(previousPackageCodeId); + packageCodeAggregate.PackageCodeIds.Add(packageCodeHistory.Id); + } + else + { + packageCodeHistory = new PackageCodeHistory { - var previousPackageCodeId = existingPackageCode.Id; - - packageCodeHistory = existingPackageCode; - packageCodeHistory.Id = sequences.PackageCodeHistorySequence++; - packageCodeHistory.FromStateVersion = packageCodeGroup.Key.StateVersion; + Id = sequences.PackageCodeHistorySequence++, + PackageEntityId = packageEntityId, + FromStateVersion = stateVersion, + CodeHash = change.Key.CodeHash, + }; - packageCodeAggregate.PackageCodeIds.Remove(previousPackageCodeId); - packageCodeAggregate.PackageCodeIds.Add(packageCodeHistory.Id); - } - else - { - packageCodeHistory = new PackageCodeHistory - { - Id = sequences.PackageCodeHistorySequence++, - PackageEntityId = packageEntityId, - FromStateVersion = stateVersion, - CodeHash = lookup.CodeHash, - }; + mostRecentPackageCodeHistory[change.Key] = packageCodeHistory; - mostRecentPackageCodeHistory[lookup] = packageCodeHistory; + packageCodeAggregate.PackageCodeIds.Add(packageCodeHistory.Id); + } - packageCodeAggregate.PackageCodeIds.Add(packageCodeHistory.Id); - } + if (change.Value.PackageCodeVmType != null) + { + packageCodeHistory.VmType = change.Value.PackageCodeVmType.Value.VmType.ToModel(); + } - foreach (var change in packageCodeGroup) - { - switch (change) - { - case PackageCodeByteChange codeByteChange: - { - packageCodeHistory.Code = codeByteChange.Code; - break; - } - - case PackageCodeVmChange vmChange: - { - packageCodeHistory.VmType = vmChange.VmType; - break; - } - - default: throw new UnreachableException($"Unexpected type of package code change: {change.GetType()}"); - } - } - - packageCodeHistoryToAdd.Add(packageCodeHistory); + if (change.Value.PackageCodeOriginalCode != null) + { + packageCodeHistory.Code = change.Value.PackageCodeOriginalCode.Value.CodeHex.ConvertFromHex(); } - packageCodeAggregateHistoryToAdd.Add(packageCodeAggregate); + packageCodeHistoryToAdd.Add(packageCodeHistory); } return (packageCodeHistoryToAdd, packageCodeAggregateHistoryToAdd); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs index 5c9c84082..3c745b9c1 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs @@ -702,8 +702,6 @@ private async Task ProcessTransactions(ReadWriteDbContext db var metadataChanges = new List(); var resourceSupplyChanges = new List(); var validatorSetChanges = new List(); - var packageBlueprintChanges = new List(); - var packageCodeChanges = new List(); var stateToAdd = new List(); var vaultHistoryToAdd = new List(); var keyValueStoreEntryHistoryToAdd = new List(); @@ -716,6 +714,9 @@ private async Task ProcessTransactions(ReadWriteDbContext db var accountResourcePreferenceRuleHistoryToAdd = new List(); var roleAssignmentsChangePointers = new Dictionary(); var roleAssignmentChanges = new List(); + var packageCodeChanges = new Dictionary(); + var packageBlueprintChanges = new Dictionary(); + var validatorEmissionStatisticsToAdd = new List(); // step: scan all substates & events to figure out changes @@ -957,73 +958,62 @@ private async Task ProcessTransactions(ReadWriteDbContext db if (substateData is CoreModel.PackageBlueprintDefinitionEntrySubstate packageBlueprintDefinition) { - var lookup = new PackageBlueprintLookup(referencedEntity.DatabaseId, packageBlueprintDefinition.Key.BlueprintName, packageBlueprintDefinition.Key.BlueprintVersion); - - packageBlueprintChanges.Add( - new PackageBlueprintDefinitionChange( - stateVersion, - lookup, - packageBlueprintDefinition.Value.Definition.ToJson() - )); + packageBlueprintChanges + .GetOrAdd( + new PackageBlueprintLookup(referencedEntity.DatabaseId, packageBlueprintDefinition.Key.BlueprintName, packageBlueprintDefinition.Key.BlueprintVersion), + _ => new PackageBlueprintChange(stateVersion) + ) + .PackageBlueprintDefinition = packageBlueprintDefinition; } if (substateData is CoreModel.PackageBlueprintDependenciesEntrySubstate packageBlueprintDependencies) { - var lookup = new PackageBlueprintLookup(referencedEntity.DatabaseId, packageBlueprintDependencies.Key.BlueprintName, packageBlueprintDependencies.Key.BlueprintVersion); - packageBlueprintChanges.Add( - new PackageBlueprintDependantEntityIdsChange( - stateVersion, - lookup, - packageBlueprintDependencies.Value.Dependencies.Dependencies.Select(address => referencedEntities.Get((EntityAddress)address).DatabaseId).ToList() - )); + packageBlueprintChanges + .GetOrAdd( + new PackageBlueprintLookup(referencedEntity.DatabaseId, packageBlueprintDependencies.Key.BlueprintName, packageBlueprintDependencies.Key.BlueprintVersion), + _ => new PackageBlueprintChange(stateVersion) + ) + .PackageBlueprintDependencies = packageBlueprintDependencies; } if (substateData is CoreModel.PackageBlueprintRoyaltyEntrySubstate packageBlueprintRoyalty) { - var lookup = new PackageBlueprintLookup(referencedEntity.DatabaseId, packageBlueprintRoyalty.Key.BlueprintName, packageBlueprintRoyalty.Key.BlueprintVersion); - - packageBlueprintChanges.Add( - new PackageBlueprintRoyaltyConfigChange( - stateVersion, - lookup, - packageBlueprintRoyalty.Value.RoyaltyConfig.ToJson(), - packageBlueprintRoyalty.IsLocked - )); + packageBlueprintChanges + .GetOrAdd( + new PackageBlueprintLookup(referencedEntity.DatabaseId, packageBlueprintRoyalty.Key.BlueprintName, packageBlueprintRoyalty.Key.BlueprintVersion), + _ => new PackageBlueprintChange(stateVersion) + ) + .PackageBlueprintRoyalty = packageBlueprintRoyalty; } if (substateData is CoreModel.PackageBlueprintAuthTemplateEntrySubstate packageBlueprintAuthTemplate) { - var lookup = new PackageBlueprintLookup(referencedEntity.DatabaseId, packageBlueprintAuthTemplate.Key.BlueprintName, packageBlueprintAuthTemplate.Key.BlueprintVersion); - - packageBlueprintChanges.Add( - new PackageBlueprintAuthTemplateChange( - stateVersion, - lookup, - packageBlueprintAuthTemplate.Value.AuthConfig.ToJson(), - packageBlueprintAuthTemplate.IsLocked - )); + packageBlueprintChanges + .GetOrAdd( + new PackageBlueprintLookup(referencedEntity.DatabaseId, packageBlueprintAuthTemplate.Key.BlueprintName, packageBlueprintAuthTemplate.Key.BlueprintVersion), + _ => new PackageBlueprintChange(stateVersion) + ) + .PackageBlueprintAuthTemplate = packageBlueprintAuthTemplate; } if (substateData is CoreModel.PackageCodeOriginalCodeEntrySubstate packageCodeOriginalCode) { - var lookup = new PackageCodeLookup(referencedEntity.DatabaseId, (ValueBytes)packageCodeOriginalCode.Key.CodeHash.ConvertFromHex()); - - packageCodeChanges.Add(new PackageCodeByteChange( - stateVersion, - lookup, - packageCodeOriginalCode.Value.CodeHex.ConvertFromHex() - )); + packageCodeChanges + .GetOrAdd( + new PackageCodeLookup(referencedEntity.DatabaseId, (ValueBytes)packageCodeOriginalCode.Key.CodeHash.ConvertFromHex()), + _ => new PackageCodeChange(stateVersion) + ) + .PackageCodeOriginalCode = packageCodeOriginalCode; } if (substateData is CoreModel.PackageCodeVmTypeEntrySubstate packageCodeVmType) { - var lookup = new PackageCodeLookup(referencedEntity.DatabaseId, (ValueBytes)packageCodeVmType.Key.CodeHash.ConvertFromHex()); - - packageCodeChanges.Add(new PackageCodeVmChange( - stateVersion, - lookup, - packageCodeVmType.Value.VmType.ToModel() - )); + packageCodeChanges + .GetOrAdd( + new PackageCodeLookup(referencedEntity.DatabaseId, (ValueBytes)packageCodeVmType.Key.CodeHash.ConvertFromHex()), + _ => new PackageCodeChange(stateVersion) + ) + .PackageCodeVmType = packageCodeVmType; } if (substateData is CoreModel.SchemaEntrySubstate schema) @@ -1333,8 +1323,6 @@ private async Task ProcessTransactions(ReadWriteDbContext db { var sw = Stopwatch.StartNew(); - var mostRecentPackageBlueprintHistory = await readHelper.MostRecentPackageBlueprintHistoryFor(packageBlueprintChanges, token); - var mostRecentPackageCodeHistory = await readHelper.MostRecentPackageCodeHistoryFor(packageCodeChanges, token); var mostRecentMetadataHistory = await readHelper.MostRecentEntityMetadataHistoryFor(metadataChanges, token); var mostRecentAggregatedMetadataHistory = await readHelper.MostRecentEntityAggregateMetadataHistoryFor(metadataChanges, token); var mostRecentAccessRulesEntryHistory = await readHelper.MostRecentEntityRoleAssignmentsEntryHistoryFor(roleAssignmentsChangePointers.Values, token); @@ -1347,8 +1335,10 @@ private async Task ProcessTransactions(ReadWriteDbContext db var mostRecentEntityNonFungibleVaultHistory = await readHelper.MostRecentEntityNonFungibleVaultHistory(vaultSnapshots.OfType().ToList(), token); var existingNonFungibleIdData = await readHelper.ExistingNonFungibleIdDataFor(nonFungibleIdChanges, vaultSnapshots.OfType().ToList(), token); var existingValidatorKeys = await readHelper.ExistingValidatorKeysFor(validatorSetChanges, token); - var mostRecentPackageBlueprintAggregateHistory = await readHelper.MostRecentPackageBlueprintAggregateHistoryFor(packageBlueprintChanges, token); - var mostRecentPackageCodeAggregateHistory = await readHelper.MostRecentPackageCodeAggregateHistoryFor(packageCodeChanges, token); + var mostRecentPackageBlueprintAggregateHistory = await readHelper.MostRecentPackageBlueprintAggregateHistoryFor(packageBlueprintChanges.Keys, token); + var mostRecentPackageBlueprintHistory = await readHelper.MostRecentPackageBlueprintHistoryFor(packageBlueprintChanges.Keys, token); + var mostRecentPackageCodeHistory = await readHelper.MostRecentPackageCodeHistoryFor(packageCodeChanges.Keys, token); + var mostRecentPackageCodeAggregateHistory = await readHelper.MostRecentPackageCodeAggregateHistoryFor(packageCodeChanges.Keys, token); dbReadDuration += sw.Elapsed; @@ -1366,7 +1356,7 @@ private async Task ProcessTransactions(ReadWriteDbContext db var nonFungibleIdsMutableDataHistoryToAdd = new List(); var (packageBlueprintHistoryToAdd, packageBlueprintAggregateHistoryToAdd) = - PackageBlueprintAggregator.AggregatePackageBlueprint(packageBlueprintChanges, mostRecentPackageBlueprintHistory, mostRecentPackageBlueprintAggregateHistory, sequences); + PackageBlueprintAggregator.AggregatePackageBlueprint(packageBlueprintChanges, mostRecentPackageBlueprintHistory, mostRecentPackageBlueprintAggregateHistory, referencedEntities, sequences); var (packageCodeHistoryToAdd, packageCodeAggregateHistoryToAdd) = PackageCodeAggregator.AggregatePackageCode(packageCodeChanges, mostRecentPackageCodeHistory, mostRecentPackageCodeAggregateHistory, sequences); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/ReadHelper.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/ReadHelper.cs index 60ab078fb..296f7c83e 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/ReadHelper.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/ReadHelper.cs @@ -93,9 +93,9 @@ public ReadHelper(ReadWriteDbContext dbContext, IEnumerable> MostRecentPackageBlueprintHistoryFor(List packageBlueprintChanges, CancellationToken token) + public async Task> MostRecentPackageBlueprintHistoryFor(ICollection packageBlueprintLookups, CancellationToken token) { - if (!packageBlueprintChanges.Any()) + if (!packageBlueprintLookups.Any()) { return new Dictionary(); } @@ -107,9 +107,9 @@ public async Task> M var versions = new List(); var lookupSet = new HashSet(); - foreach (var change in packageBlueprintChanges) + foreach (var lookup in packageBlueprintLookups) { - lookupSet.Add(change.Lookup); + lookupSet.Add(lookup); } foreach (var lookup in lookupSet) @@ -143,7 +143,7 @@ LIMIT 1 return result; } - public async Task> MostRecentPackageCodeHistoryFor(List packageCodeChanges, CancellationToken token) + public async Task> MostRecentPackageCodeHistoryFor(ICollection packageCodeChanges, CancellationToken token) { if (!packageCodeChanges.Any()) { @@ -156,9 +156,9 @@ public async Task> MostRecentP var codeHashes = new List(); var lookupSet = new HashSet(); - foreach (var change in packageCodeChanges) + foreach (var lookup in packageCodeChanges) { - lookupSet.Add(change.Lookup); + lookupSet.Add(lookup); } foreach (var lookup in lookupSet) @@ -238,7 +238,7 @@ LIMIT 1 return result; } - public async Task> MostRecentPackageCodeAggregateHistoryFor(List packageCodeChanges, CancellationToken token) + public async Task> MostRecentPackageCodeAggregateHistoryFor(ICollection packageCodeChanges, CancellationToken token) { if (!packageCodeChanges.Any()) { @@ -246,7 +246,7 @@ public async Task> MostRecentPacka } var sw = Stopwatch.GetTimestamp(); - var packageEntityIds = packageCodeChanges.Select(x => x.Lookup.PackageEntityId).Distinct().ToList(); + var packageEntityIds = packageCodeChanges.Select(x => x.PackageEntityId).Distinct().ToList(); var result = await _dbContext .PackageCodeAggregateHistory @@ -272,7 +272,7 @@ LIMIT 1 return result; } - public async Task> MostRecentPackageBlueprintAggregateHistoryFor(List packageBlueprintChanges, CancellationToken token) + public async Task> MostRecentPackageBlueprintAggregateHistoryFor(ICollection packageBlueprintChanges, CancellationToken token) { if (!packageBlueprintChanges.Any()) { @@ -280,7 +280,7 @@ public async Task> MostRecent } var sw = Stopwatch.GetTimestamp(); - var packageEntityIds = packageBlueprintChanges.Select(x => x.Lookup.PackageEntityId).Distinct().ToList(); + var packageEntityIds = packageBlueprintChanges.Select(x => x.PackageEntityId).Distinct().ToList(); var result = await _dbContext .PackageBlueprintAggregateHistory From 25994bf25f29288b82788f9565ed9f491444a765 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Pawelec?= Date: Thu, 18 Jan 2024 15:47:15 +0100 Subject: [PATCH 12/19] add proper description why we're changing contract. --- CHANGELOG.md | 2 +- src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml | 2 +- .../generated/Model/StateEntityDetailsResponsePackageDetails.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1440a55e4..1e185417e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ Release Date: _unreleased_ - add support for new transaction types (flash transactions) that are gonna occur on protocol update. - move vm_type to `package_code_history` table from package in `entity` table. -- fix and return `vm_type`, `code_hash_hex` and `code_hex` as collection (it's allowed to have multiple codes per package). previous properties will return empty strings to keep contract compatibility. +- fix and return `vm_type`, `code_hash_hex` and `code_hex` as collection (it's allowed after protocol update to have multiple codes per package). previous properties will return empty strings to keep contract compatibility. - create new `package_blueprint_aggregate_history` table which will hold pointers to all current package blueprints. - create new `package_code_aggregate_history` table which will hold pointers to all current package codes. diff --git a/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml b/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml index c0577a109..fc8a70241 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml +++ b/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml @@ -3106,7 +3106,7 @@ components: $ref: "#/components/schemas/NonFungibleResourcesCollectionItemVaultAggregatedVaultItem" StateEntityDetailsResponsePackageDetails: - description: "vm_type, code_hash_hex and code_hex are always going to be empty, use `codes` property which will return code collection" + description: "vm_type, code_hash_hex and code_hex are always going to be empty, use `codes` property which will return collection (it's possible after protocol update that package might have multiple codes)" allOf: - $ref: "#/components/schemas/StateEntityDetailsResponseItemDetails" - type: object diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetails.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetails.cs index d127015ec..34bfa48ae 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetails.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StateEntityDetailsResponsePackageDetails.cs @@ -91,7 +91,7 @@ namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model { /// - /// vm_type, code_hash_hex and code_hex are always going to be empty, use `codes` property which will return code collection + /// vm_type, code_hash_hex and code_hex are always going to be empty, use `codes` property which will return collection (it's possible after protocol update that package might have multiple codes) /// [DataContract(Name = "StateEntityDetailsResponsePackageDetails")] [JsonConverter(typeof(JsonSubtypes), "type")] From 4002639dde8e16faa92980a057c9c8ecdfa01e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Pawelec?= Date: Thu, 18 Jan 2024 16:28:38 +0100 Subject: [PATCH 13/19] pull request fixes. --- CHANGELOG.md | 10 +++--- .../gateway-api-schema.yaml | 7 +++++ .../Model/PackageCodeCollectionItem.cs | 31 ++++++++++++++----- .../LedgerExtension/ReadHelper.cs | 16 ++-------- .../20240118114735_SupportProtocolUpdate.cs | 6 ++++ .../Services/EntityStateQuerier.cs | 6 ++-- 6 files changed, 47 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e185417e..9592c6143 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,11 @@ ## 1.3.0 Release Date: _unreleased_ -- add support for new transaction types (flash transactions) that are gonna occur on protocol update. -- move vm_type to `package_code_history` table from package in `entity` table. -- fix and return `vm_type`, `code_hash_hex` and `code_hex` as collection (it's allowed after protocol update to have multiple codes per package). previous properties will return empty strings to keep contract compatibility. -- create new `package_blueprint_aggregate_history` table which will hold pointers to all current package blueprints. -- create new `package_code_aggregate_history` table which will hold pointers to all current package codes. +- added support for new transaction types (flash transactions) that are gonna occur on protocol updates. +- moved vm_type to `package_code_history` table from package in `entity` table. +- `vm_type`, `code_hash_hex` and `code_hex` are returned as collection (it's allowed after protocol update to have multiple codes per package). Previous properties will return empty strings to keep contract compatibility. +- created new `package_blueprint_aggregate_history` table which will hold pointers to all package blueprints. +- created new `package_code_aggregate_history` table which will hold pointers to all package codes. ## 1.2.4 Release Date: 4.01.2024 diff --git a/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml b/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml index fc8a70241..0ae739c1f 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml +++ b/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml @@ -3119,10 +3119,13 @@ components: codes: $ref: "#/components/schemas/StateEntityDetailsResponsePackageDetailsCodeCollection" vm_type: + description: "Obsolete! Use codes collection" $ref: "#/components/schemas/PackageVmType" code_hash_hex: + description: "Obsolete! Use codes collection" $ref: "#/components/schemas/HexString" code_hex: + description: "Obsolete! Use codes collection" $ref: "#/components/schemas/HexString" royalty_vault_balance: $ref: "#/components/schemas/BigDecimal" @@ -3143,6 +3146,10 @@ components: $ref: "#/components/schemas/PackageCodeCollectionItem" PackageCodeCollectionItem: type: object + required: + - vm_type + - code_hash_hex + - code_hex properties: vm_type: $ref: "#/components/schemas/PackageVmType" diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/PackageCodeCollectionItem.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/PackageCodeCollectionItem.cs index a61f3a70f..d806f3c2c 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/PackageCodeCollectionItem.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/PackageCodeCollectionItem.cs @@ -99,18 +99,33 @@ public partial class PackageCodeCollectionItem : IEquatable /// Gets or Sets VmType /// - [DataMember(Name = "vm_type", EmitDefaultValue = true)] - public PackageVmType? VmType { get; set; } + [DataMember(Name = "vm_type", IsRequired = true, EmitDefaultValue = true)] + public PackageVmType VmType { get; set; } /// /// Initializes a new instance of the class. /// - /// vmType. - /// Hex-encoded binary blob.. - /// Hex-encoded binary blob.. - public PackageCodeCollectionItem(PackageVmType? vmType = default(PackageVmType?), string codeHashHex = default(string), string codeHex = default(string)) + [JsonConstructorAttribute] + protected PackageCodeCollectionItem() { } + /// + /// Initializes a new instance of the class. + /// + /// vmType (required). + /// Hex-encoded binary blob. (required). + /// Hex-encoded binary blob. (required). + public PackageCodeCollectionItem(PackageVmType vmType = default(PackageVmType), string codeHashHex = default(string), string codeHex = default(string)) { this.VmType = vmType; + // to ensure "codeHashHex" is required (not null) + if (codeHashHex == null) + { + throw new ArgumentNullException("codeHashHex is a required property for PackageCodeCollectionItem and cannot be null"); + } this.CodeHashHex = codeHashHex; + // to ensure "codeHex" is required (not null) + if (codeHex == null) + { + throw new ArgumentNullException("codeHex is a required property for PackageCodeCollectionItem and cannot be null"); + } this.CodeHex = codeHex; } @@ -118,14 +133,14 @@ public partial class PackageCodeCollectionItem : IEquatable /// Hex-encoded binary blob. - [DataMember(Name = "code_hash_hex", EmitDefaultValue = true)] + [DataMember(Name = "code_hash_hex", IsRequired = true, EmitDefaultValue = true)] public string CodeHashHex { get; set; } /// /// Hex-encoded binary blob. /// /// Hex-encoded binary blob. - [DataMember(Name = "code_hex", EmitDefaultValue = true)] + [DataMember(Name = "code_hex", IsRequired = true, EmitDefaultValue = true)] public string CodeHex { get; set; } /// diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/ReadHelper.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/ReadHelper.cs index 296f7c83e..a7cd26b71 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/ReadHelper.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/ReadHelper.cs @@ -105,12 +105,7 @@ public async Task> M var entityIds = new List(); var names = new List(); var versions = new List(); - var lookupSet = new HashSet(); - - foreach (var lookup in packageBlueprintLookups) - { - lookupSet.Add(lookup); - } + var lookupSet = packageBlueprintLookups.ToHashSet(); foreach (var lookup in lookupSet) { @@ -154,12 +149,7 @@ public async Task> MostRecentP var entityIds = new List(); var codeHashes = new List(); - var lookupSet = new HashSet(); - - foreach (var lookup in packageCodeChanges) - { - lookupSet.Add(lookup); - } + var lookupSet = packageCodeChanges.ToHashSet(); foreach (var lookup in lookupSet) { @@ -267,7 +257,7 @@ LIMIT 1 .AnnotateMetricName() .ToDictionaryAsync(e => e.PackageEntityId, token); - await _observers.ForEachAsync(x => x.StageCompleted(nameof(MostRecentPackageBlueprintAggregateHistoryFor), Stopwatch.GetElapsedTime(sw), result.Count)); + await _observers.ForEachAsync(x => x.StageCompleted(nameof(MostRecentPackageCodeAggregateHistoryFor), Stopwatch.GetElapsedTime(sw), result.Count)); return result; } diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240118114735_SupportProtocolUpdate.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240118114735_SupportProtocolUpdate.cs index 07d6ebb11..1376ed9ca 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240118114735_SupportProtocolUpdate.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240118114735_SupportProtocolUpdate.cs @@ -92,6 +92,12 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.Sql("update package_code_history pch set vm_type = (select vm_type from entities e where e.id = pch.package_entity_id)"); + migrationBuilder.AlterColumn( + name: "vm_type", + table: "package_code_history", + oldDefaultValue: PackageVmType.Native, + defaultValue: null); + migrationBuilder.DropColumn( name: "vm_type", table: "entities"); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntityStateQuerier.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntityStateQuerier.cs index dce6081d0..1589a6f64 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntityStateQuerier.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntityStateQuerier.cs @@ -252,9 +252,9 @@ public EntityStateQuerier( } details = new GatewayModel.StateEntityDetailsResponsePackageDetails( - vmType: default, - codeHashHex: string.Empty, - codeHex: string.Empty, + vmType: codeItems[0].VmType, + codeHashHex: codeItems[0].CodeHashHex, + codeHex: codeItems[0].CodeHex, codes: new GatewayModel.StateEntityDetailsResponsePackageDetailsCodeCollection(totalCount: codeItems.Count, items: codeItems), royaltyVaultBalance: packageRoyaltyVaultBalance != null ? TokenAmount.FromSubUnitsString(packageRoyaltyVaultBalance).ToString() : null, blueprints: new GatewayModel.StateEntityDetailsResponsePackageDetailsBlueprintCollection(totalCount: blueprints.Count, items: blueprints), From f5ff307dc9437f87a0e3deeca28e658a55f6a72d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Pawelec?= Date: Thu, 18 Jan 2024 16:40:47 +0100 Subject: [PATCH 14/19] regenerate core api client/contracts. --- .../core-api-spec-copy.yaml | 104 +++++++- .../AccessControllerFieldStateSubstate.cs | 1 + ...AccountAuthorizedDepositorEntrySubstate.cs | 1 + .../Model/AccountFieldStateSubstate.cs | 1 + .../AccountResourcePreferenceEntrySubstate.cs | 1 + .../Model/AccountVaultEntrySubstate.cs | 1 + .../BootLoaderModuleFieldVmBootSubstate.cs | 247 ++++++++++++++++++ ...ootLoaderModuleFieldVmBootSubstateAllOf.cs | 193 ++++++++++++++ .../Model/BootLoaderModuleFieldVmBootValue.cs | 184 +++++++++++++ .../Model/ConsensusLedgerProofOrigin.cs | 225 ++++++++++++++++ .../Model/ConsensusLedgerProofOriginAllOf.cs | 218 ++++++++++++++++ .../ConsensusManagerFieldConfigSubstate.cs | 1 + ...erFieldCurrentProposalStatisticSubstate.cs | 1 + ...ieldCurrentTimeRoundedToMinutesSubstate.cs | 1 + ...onsensusManagerFieldCurrentTimeSubstate.cs | 1 + ...ManagerFieldCurrentValidatorSetSubstate.cs | 1 + .../ConsensusManagerFieldStateSubstate.cs | 1 + ...susManagerFieldValidatorRewardsSubstate.cs | 1 + ...eredValidatorsByStakeIndexEntrySubstate.cs | 1 + .../generated/Model/EntityModule.cs | 8 +- ...esourceManagerFieldDivisibilitySubstate.cs | 1 + ...ResourceManagerFieldTotalSupplySubstate.cs | 1 + .../FungibleVaultFieldBalanceSubstate.cs | 1 + .../FungibleVaultFieldFrozenStatusSubstate.cs | 1 + .../GenericKeyValueStoreEntrySubstate.cs | 1 + ...nericScryptoComponentFieldStateSubstate.cs | 1 + .../Model/GenesisLedgerProofOrigin.cs | 200 ++++++++++++++ .../Model/GenesisLedgerProofOriginAllOf.cs | 193 ++++++++++++++ .../generated/Model/LedgerProof.cs | 55 ++-- .../generated/Model/LedgerProofOrigin.cs | 192 ++++++++++++++ .../generated/Model/LedgerProofOriginType.cs | 118 +++++++++ .../Model/MetadataModuleEntrySubstate.cs | 1 + .../MultiResourcePoolFieldStateSubstate.cs | 1 + .../generated/Model/NextEpoch.cs | 21 +- ...ungibleResourceManagerDataEntrySubstate.cs | 1 + ...gibleResourceManagerFieldIdTypeSubstate.cs | 1 + ...sourceManagerFieldMutableFieldsSubstate.cs | 1 + ...ResourceManagerFieldTotalSupplySubstate.cs | 1 + ...FungibleVaultContentsIndexEntrySubstate.cs | 1 + .../NonFungibleVaultFieldBalanceSubstate.cs | 1 + ...nFungibleVaultFieldFrozenStatusSubstate.cs | 1 + .../OneResourcePoolFieldStateSubstate.cs | 1 + ...ckageBlueprintAuthTemplateEntrySubstate.cs | 1 + ...PackageBlueprintDefinitionEntrySubstate.cs | 1 + ...ckageBlueprintDependenciesEntrySubstate.cs | 1 + .../PackageBlueprintRoyaltyEntrySubstate.cs | 1 + ...ackageCodeInstrumentedCodeEntrySubstate.cs | 1 + .../PackageCodeOriginalCodeEntrySubstate.cs | 1 + .../Model/PackageCodeVmTypeEntrySubstate.cs | 1 + .../PackageFieldRoyaltyAccumulatorSubstate.cs | 1 + .../Model/ProtocolUpdateLedgerProofOrigin.cs | 214 +++++++++++++++ .../ProtocolUpdateLedgerProofOriginAllOf.cs | 207 +++++++++++++++ ...eAssignmentModuleFieldOwnerRoleSubstate.cs | 1 + .../RoleAssignmentModuleRuleEntrySubstate.cs | 1 + .../Model/RoyaltyModuleFieldStateSubstate.cs | 1 + ...RoyaltyModuleMethodRoyaltyEntrySubstate.cs | 1 + .../generated/Model/SchemaEntrySubstate.cs | 1 + ...SignificantProtocolUpdateReadinessEntry.cs | 216 +++++++++++++++ .../generated/Model/Substate.cs | 2 + .../generated/Model/SubstateType.cs | 106 ++++---- .../generated/Model/SystemFieldKind.cs | 8 +- ...ansactionTrackerCollectionEntrySubstate.cs | 1 + .../TransactionTrackerFieldStateSubstate.cs | 1 + .../TwoResourcePoolFieldStateSubstate.cs | 1 + .../TypeInfoModuleFieldTypeInfoSubstate.cs | 1 + ...ldProtocolUpdateReadinessSignalSubstate.cs | 1 + .../Model/ValidatorFieldStateSubstate.cs | 1 + 67 files changed, 2658 insertions(+), 101 deletions(-) create mode 100644 src/RadixDlt.CoreApiSdk/generated/Model/BootLoaderModuleFieldVmBootSubstate.cs create mode 100644 src/RadixDlt.CoreApiSdk/generated/Model/BootLoaderModuleFieldVmBootSubstateAllOf.cs create mode 100644 src/RadixDlt.CoreApiSdk/generated/Model/BootLoaderModuleFieldVmBootValue.cs create mode 100644 src/RadixDlt.CoreApiSdk/generated/Model/ConsensusLedgerProofOrigin.cs create mode 100644 src/RadixDlt.CoreApiSdk/generated/Model/ConsensusLedgerProofOriginAllOf.cs create mode 100644 src/RadixDlt.CoreApiSdk/generated/Model/GenesisLedgerProofOrigin.cs create mode 100644 src/RadixDlt.CoreApiSdk/generated/Model/GenesisLedgerProofOriginAllOf.cs create mode 100644 src/RadixDlt.CoreApiSdk/generated/Model/LedgerProofOrigin.cs create mode 100644 src/RadixDlt.CoreApiSdk/generated/Model/LedgerProofOriginType.cs create mode 100644 src/RadixDlt.CoreApiSdk/generated/Model/ProtocolUpdateLedgerProofOrigin.cs create mode 100644 src/RadixDlt.CoreApiSdk/generated/Model/ProtocolUpdateLedgerProofOriginAllOf.cs create mode 100644 src/RadixDlt.CoreApiSdk/generated/Model/SignificantProtocolUpdateReadinessEntry.cs diff --git a/src/RadixDlt.CoreApiSdk/core-api-spec-copy.yaml b/src/RadixDlt.CoreApiSdk/core-api-spec-copy.yaml index 1068f0781..1fc4050f7 100644 --- a/src/RadixDlt.CoreApiSdk/core-api-spec-copy.yaml +++ b/src/RadixDlt.CoreApiSdk/core-api-spec-copy.yaml @@ -1907,6 +1907,20 @@ components: items: $ref: '#/components/schemas/ActiveValidator' description: Active validator set for the new epoch, ordered by stake descending. + significant_protocol_update_readiness: + type: array + items: + $ref: '#/components/schemas/SignificantProtocolUpdateReadinessEntry' + SignificantProtocolUpdateReadinessEntry: + type: object + required: + - readiness_signal_name + - signalled_stake + properties: + readiness_signal_name: + type: string + signalled_stake: + type: string CreatedSubstate: type: object required: @@ -2022,6 +2036,7 @@ components: - Royalty - Main - Schema + - BootLoader PartitionKind: type: string description: | @@ -3131,6 +3146,7 @@ components: SystemFieldKind: type: string enum: + - BootLoader - TypeInfo ObjectSubstateTypeReferenceType: type: string @@ -3649,6 +3665,7 @@ components: # - value - which references the type [SubstateValue] # - key (if it's in a collection partition) - which references a substate key type [X]Key for some X. # - is_locked - this is added to all substates via inclusion on the `Substate` object + BootLoaderModuleFieldVmBoot: '#/components/schemas/BootLoaderModuleFieldVmBootSubstate' TypeInfoModuleFieldTypeInfo: '#/components/schemas/TypeInfoModuleFieldTypeInfoSubstate' RoleAssignmentModuleFieldOwnerRole: '#/components/schemas/RoleAssignmentModuleFieldOwnerRoleSubstate' RoleAssignmentModuleRuleEntry: '#/components/schemas/RoleAssignmentModuleRuleEntrySubstate' @@ -3700,6 +3717,7 @@ components: SubstateType: type: string enum: + - BootLoaderModuleFieldVmBoot - TypeInfoModuleFieldTypeInfo - RoleAssignmentModuleFieldOwnerRole - RoleAssignmentModuleRuleEntry @@ -3895,6 +3913,25 @@ components: ################################################ # GENERAL / SHARED MODELS - specific substates # ################################################ + BootLoaderModuleFieldVmBootSubstate: + allOf: + - $ref: '#/components/schemas/Substate' + - type: object + required: + - value + properties: + value: + $ref: '#/components/schemas/BootLoaderModuleFieldVmBootValue' + BootLoaderModuleFieldVmBootValue: + type: object + required: + - scrypto_v1_minor_version + properties: + scrypto_v1_minor_version: + type: integer + format: int64 + minimum: 0 + maximum: 10000000000 TypeInfoModuleFieldTypeInfoSubstate: allOf: - $ref: '#/components/schemas/Substate' @@ -7182,21 +7219,72 @@ components: type: array items: $ref: "#/components/schemas/LtsEntityNonFungibleBalanceChanges" + LedgerProofOriginType: + type: string + enum: + - Genesis + - Consensus + - ProtocolUpdate + LedgerProofOrigin: + type: object + required: + - type + properties: + type: + $ref: "#/components/schemas/LedgerProofOriginType" + discriminator: + propertyName: type + mapping: + # NOTE: These need to match LedgerProofOriginType + Genesis: '#/components/schemas/GenesisLedgerProofOrigin' + Consensus: '#/components/schemas/ConsensusLedgerProofOrigin' + ProtocolUpdate: '#/components/schemas/ProtocolUpdateLedgerProofOrigin' + GenesisLedgerProofOrigin: + allOf: + - $ref: "#/components/schemas/LedgerProofOrigin" + - type: object + required: + - genesis_opaque_hash + properties: + genesis_opaque_hash: + type: string + ConsensusLedgerProofOrigin: + allOf: + - $ref: "#/components/schemas/LedgerProofOrigin" + - type: object + required: + - opaque_hash + - timestamped_signatures + properties: + opaque_hash: + $ref: "#/components/schemas/OpaqueHash" + timestamped_signatures: + type: array + items: + $ref: "#/components/schemas/TimestampedValidatorSignature" + ProtocolUpdateLedgerProofOrigin: + allOf: + - $ref: "#/components/schemas/LedgerProofOrigin" + - type: object + required: + - protocol_version_name + - batch_idx + properties: + protocol_version_name: + type: string + batch_idx: + type: integer + format: int64 LedgerProof: type: object required: - - opaque_hash - ledger_header - - timestamped_signatures + - origin properties: - opaque_hash: - $ref: "#/components/schemas/OpaqueHash" ledger_header: $ref: "#/components/schemas/LedgerHeader" - timestamped_signatures: - type: array - items: - $ref: "#/components/schemas/TimestampedValidatorSignature" + origin: + $ref: "#/components/schemas/LedgerProofOrigin" LedgerHeader: type: object required: diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/AccessControllerFieldStateSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/AccessControllerFieldStateSubstate.cs index 723c9d0e9..aaaa19787 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/AccessControllerFieldStateSubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/AccessControllerFieldStateSubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/AccountAuthorizedDepositorEntrySubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/AccountAuthorizedDepositorEntrySubstate.cs index dd1ff6ff4..6fefa2efd 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/AccountAuthorizedDepositorEntrySubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/AccountAuthorizedDepositorEntrySubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/AccountFieldStateSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/AccountFieldStateSubstate.cs index 8cd230fb0..39fe261f5 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/AccountFieldStateSubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/AccountFieldStateSubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/AccountResourcePreferenceEntrySubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/AccountResourcePreferenceEntrySubstate.cs index a7da7a855..166f48208 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/AccountResourcePreferenceEntrySubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/AccountResourcePreferenceEntrySubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/AccountVaultEntrySubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/AccountVaultEntrySubstate.cs index ddfa4b7b7..4b59be1b6 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/AccountVaultEntrySubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/AccountVaultEntrySubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/BootLoaderModuleFieldVmBootSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/BootLoaderModuleFieldVmBootSubstate.cs new file mode 100644 index 000000000..a2e52aa27 --- /dev/null +++ b/src/RadixDlt.CoreApiSdk/generated/Model/BootLoaderModuleFieldVmBootSubstate.cs @@ -0,0 +1,247 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Core API - Babylon + * + * This API is exposed by the Babylon Radix node to give clients access to the Radix Engine, Mempool and State in the node. The default configuration is intended for use by node-runners on a private network, and is not intended to be exposed publicly. Very heavy load may impact the node's function. The node exposes a configuration flag which allows disabling certain endpoints which may be problematic, but monitoring is advised. This configuration parameter is `api.core.flags.enable_unbounded_endpoints` / `RADIXDLT_CORE_API_FLAGS_ENABLE_UNBOUNDED_ENDPOINTS`. This API exposes queries against the node's current state (see `/lts/state/` or `/state/`), and streams of transaction history (under `/lts/stream/` or `/stream`). If you require queries against snapshots of historical ledger state, you may also wish to consider using the [Gateway API](https://docs-babylon.radixdlt.com/). ## Integration and forward compatibility guarantees Integrators (such as exchanges) are recommended to use the `/lts/` endpoints - they have been designed to be clear and simple for integrators wishing to create and monitor transactions involving fungible transfers to/from accounts. All endpoints under `/lts/` have high guarantees of forward compatibility in future node versions. We may add new fields, but existing fields will not be changed. Assuming the integrating code uses a permissive JSON parser which ignores unknown fields, any additions will not affect existing code. Other endpoints may be changed with new node versions carrying protocol-updates, although any breaking changes will be flagged clearly in the corresponding release notes. All responses may have additional fields added, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. + * + * The version of the OpenAPI document: v1.0.4 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using JsonSubTypes; +using FileParameter = RadixDlt.CoreApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.CoreApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.CoreApiSdk.Model +{ + /// + /// BootLoaderModuleFieldVmBootSubstate + /// + [DataContract(Name = "BootLoaderModuleFieldVmBootSubstate")] + [JsonConverter(typeof(JsonSubtypes), "substate_type")] + [JsonSubtypes.KnownSubType(typeof(AccessControllerFieldStateSubstate), "AccessControllerFieldState")] + [JsonSubtypes.KnownSubType(typeof(AccountAuthorizedDepositorEntrySubstate), "AccountAuthorizedDepositorEntry")] + [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] + [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] + [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] + [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] + [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] + [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] + [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeRoundedToMinutesSubstate), "ConsensusManagerFieldCurrentTimeRoundedToMinutes")] + [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentValidatorSetSubstate), "ConsensusManagerFieldCurrentValidatorSet")] + [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldStateSubstate), "ConsensusManagerFieldState")] + [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldValidatorRewardsSubstate), "ConsensusManagerFieldValidatorRewards")] + [JsonSubtypes.KnownSubType(typeof(ConsensusManagerRegisteredValidatorsByStakeIndexEntrySubstate), "ConsensusManagerRegisteredValidatorsByStakeIndexEntry")] + [JsonSubtypes.KnownSubType(typeof(FungibleResourceManagerFieldDivisibilitySubstate), "FungibleResourceManagerFieldDivisibility")] + [JsonSubtypes.KnownSubType(typeof(FungibleResourceManagerFieldTotalSupplySubstate), "FungibleResourceManagerFieldTotalSupply")] + [JsonSubtypes.KnownSubType(typeof(FungibleVaultFieldBalanceSubstate), "FungibleVaultFieldBalance")] + [JsonSubtypes.KnownSubType(typeof(FungibleVaultFieldFrozenStatusSubstate), "FungibleVaultFieldFrozenStatus")] + [JsonSubtypes.KnownSubType(typeof(GenericKeyValueStoreEntrySubstate), "GenericKeyValueStoreEntry")] + [JsonSubtypes.KnownSubType(typeof(GenericScryptoComponentFieldStateSubstate), "GenericScryptoComponentFieldState")] + [JsonSubtypes.KnownSubType(typeof(MetadataModuleEntrySubstate), "MetadataModuleEntry")] + [JsonSubtypes.KnownSubType(typeof(MultiResourcePoolFieldStateSubstate), "MultiResourcePoolFieldState")] + [JsonSubtypes.KnownSubType(typeof(NonFungibleResourceManagerDataEntrySubstate), "NonFungibleResourceManagerDataEntry")] + [JsonSubtypes.KnownSubType(typeof(NonFungibleResourceManagerFieldIdTypeSubstate), "NonFungibleResourceManagerFieldIdType")] + [JsonSubtypes.KnownSubType(typeof(NonFungibleResourceManagerFieldMutableFieldsSubstate), "NonFungibleResourceManagerFieldMutableFields")] + [JsonSubtypes.KnownSubType(typeof(NonFungibleResourceManagerFieldTotalSupplySubstate), "NonFungibleResourceManagerFieldTotalSupply")] + [JsonSubtypes.KnownSubType(typeof(NonFungibleVaultContentsIndexEntrySubstate), "NonFungibleVaultContentsIndexEntry")] + [JsonSubtypes.KnownSubType(typeof(NonFungibleVaultFieldBalanceSubstate), "NonFungibleVaultFieldBalance")] + [JsonSubtypes.KnownSubType(typeof(NonFungibleVaultFieldFrozenStatusSubstate), "NonFungibleVaultFieldFrozenStatus")] + [JsonSubtypes.KnownSubType(typeof(OneResourcePoolFieldStateSubstate), "OneResourcePoolFieldState")] + [JsonSubtypes.KnownSubType(typeof(PackageBlueprintAuthTemplateEntrySubstate), "PackageBlueprintAuthTemplateEntry")] + [JsonSubtypes.KnownSubType(typeof(PackageBlueprintDefinitionEntrySubstate), "PackageBlueprintDefinitionEntry")] + [JsonSubtypes.KnownSubType(typeof(PackageBlueprintDependenciesEntrySubstate), "PackageBlueprintDependenciesEntry")] + [JsonSubtypes.KnownSubType(typeof(PackageBlueprintRoyaltyEntrySubstate), "PackageBlueprintRoyaltyEntry")] + [JsonSubtypes.KnownSubType(typeof(PackageCodeInstrumentedCodeEntrySubstate), "PackageCodeInstrumentedCodeEntry")] + [JsonSubtypes.KnownSubType(typeof(PackageCodeOriginalCodeEntrySubstate), "PackageCodeOriginalCodeEntry")] + [JsonSubtypes.KnownSubType(typeof(PackageCodeVmTypeEntrySubstate), "PackageCodeVmTypeEntry")] + [JsonSubtypes.KnownSubType(typeof(PackageFieldRoyaltyAccumulatorSubstate), "PackageFieldRoyaltyAccumulator")] + [JsonSubtypes.KnownSubType(typeof(RoleAssignmentModuleFieldOwnerRoleSubstate), "RoleAssignmentModuleFieldOwnerRole")] + [JsonSubtypes.KnownSubType(typeof(RoleAssignmentModuleRuleEntrySubstate), "RoleAssignmentModuleRuleEntry")] + [JsonSubtypes.KnownSubType(typeof(RoyaltyModuleFieldStateSubstate), "RoyaltyModuleFieldState")] + [JsonSubtypes.KnownSubType(typeof(RoyaltyModuleMethodRoyaltyEntrySubstate), "RoyaltyModuleMethodRoyaltyEntry")] + [JsonSubtypes.KnownSubType(typeof(SchemaEntrySubstate), "SchemaEntry")] + [JsonSubtypes.KnownSubType(typeof(TransactionTrackerCollectionEntrySubstate), "TransactionTrackerCollectionEntry")] + [JsonSubtypes.KnownSubType(typeof(TransactionTrackerFieldStateSubstate), "TransactionTrackerFieldState")] + [JsonSubtypes.KnownSubType(typeof(TwoResourcePoolFieldStateSubstate), "TwoResourcePoolFieldState")] + [JsonSubtypes.KnownSubType(typeof(TypeInfoModuleFieldTypeInfoSubstate), "TypeInfoModuleFieldTypeInfo")] + [JsonSubtypes.KnownSubType(typeof(ValidatorFieldProtocolUpdateReadinessSignalSubstate), "ValidatorFieldProtocolUpdateReadinessSignal")] + [JsonSubtypes.KnownSubType(typeof(ValidatorFieldStateSubstate), "ValidatorFieldState")] + public partial class BootLoaderModuleFieldVmBootSubstate : Substate, IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BootLoaderModuleFieldVmBootSubstate() { } + /// + /// Initializes a new instance of the class. + /// + /// value (required). + /// substateType (required) (default to SubstateType.BootLoaderModuleFieldVmBoot). + /// isLocked (required). + public BootLoaderModuleFieldVmBootSubstate(BootLoaderModuleFieldVmBootValue value = default(BootLoaderModuleFieldVmBootValue), SubstateType substateType = SubstateType.BootLoaderModuleFieldVmBoot, bool isLocked = default(bool)) : base(substateType, isLocked) + { + // to ensure "value" is required (not null) + if (value == null) + { + throw new ArgumentNullException("value is a required property for BootLoaderModuleFieldVmBootSubstate and cannot be null"); + } + this.Value = value; + } + + /// + /// Gets or Sets Value + /// + [DataMember(Name = "value", IsRequired = true, EmitDefaultValue = true)] + public BootLoaderModuleFieldVmBootValue Value { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BootLoaderModuleFieldVmBootSubstate {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" Value: ").Append(Value).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BootLoaderModuleFieldVmBootSubstate); + } + + /// + /// Returns true if BootLoaderModuleFieldVmBootSubstate instances are equal + /// + /// Instance of BootLoaderModuleFieldVmBootSubstate to be compared + /// Boolean + public bool Equals(BootLoaderModuleFieldVmBootSubstate input) + { + if (input == null) + { + return false; + } + return base.Equals(input) && + ( + this.Value == input.Value || + (this.Value != null && + this.Value.Equals(input.Value)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + if (this.Value != null) + { + hashCode = (hashCode * 59) + this.Value.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/BootLoaderModuleFieldVmBootSubstateAllOf.cs b/src/RadixDlt.CoreApiSdk/generated/Model/BootLoaderModuleFieldVmBootSubstateAllOf.cs new file mode 100644 index 000000000..9290bdda4 --- /dev/null +++ b/src/RadixDlt.CoreApiSdk/generated/Model/BootLoaderModuleFieldVmBootSubstateAllOf.cs @@ -0,0 +1,193 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Core API - Babylon + * + * This API is exposed by the Babylon Radix node to give clients access to the Radix Engine, Mempool and State in the node. The default configuration is intended for use by node-runners on a private network, and is not intended to be exposed publicly. Very heavy load may impact the node's function. The node exposes a configuration flag which allows disabling certain endpoints which may be problematic, but monitoring is advised. This configuration parameter is `api.core.flags.enable_unbounded_endpoints` / `RADIXDLT_CORE_API_FLAGS_ENABLE_UNBOUNDED_ENDPOINTS`. This API exposes queries against the node's current state (see `/lts/state/` or `/state/`), and streams of transaction history (under `/lts/stream/` or `/stream`). If you require queries against snapshots of historical ledger state, you may also wish to consider using the [Gateway API](https://docs-babylon.radixdlt.com/). ## Integration and forward compatibility guarantees Integrators (such as exchanges) are recommended to use the `/lts/` endpoints - they have been designed to be clear and simple for integrators wishing to create and monitor transactions involving fungible transfers to/from accounts. All endpoints under `/lts/` have high guarantees of forward compatibility in future node versions. We may add new fields, but existing fields will not be changed. Assuming the integrating code uses a permissive JSON parser which ignores unknown fields, any additions will not affect existing code. Other endpoints may be changed with new node versions carrying protocol-updates, although any breaking changes will be flagged clearly in the corresponding release notes. All responses may have additional fields added, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. + * + * The version of the OpenAPI document: v1.0.4 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using FileParameter = RadixDlt.CoreApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.CoreApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.CoreApiSdk.Model +{ + /// + /// BootLoaderModuleFieldVmBootSubstateAllOf + /// + [DataContract(Name = "BootLoaderModuleFieldVmBootSubstate_allOf")] + public partial class BootLoaderModuleFieldVmBootSubstateAllOf : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BootLoaderModuleFieldVmBootSubstateAllOf() { } + /// + /// Initializes a new instance of the class. + /// + /// value (required). + public BootLoaderModuleFieldVmBootSubstateAllOf(BootLoaderModuleFieldVmBootValue value = default(BootLoaderModuleFieldVmBootValue)) + { + // to ensure "value" is required (not null) + if (value == null) + { + throw new ArgumentNullException("value is a required property for BootLoaderModuleFieldVmBootSubstateAllOf and cannot be null"); + } + this.Value = value; + } + + /// + /// Gets or Sets Value + /// + [DataMember(Name = "value", IsRequired = true, EmitDefaultValue = true)] + public BootLoaderModuleFieldVmBootValue Value { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BootLoaderModuleFieldVmBootSubstateAllOf {\n"); + sb.Append(" Value: ").Append(Value).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BootLoaderModuleFieldVmBootSubstateAllOf); + } + + /// + /// Returns true if BootLoaderModuleFieldVmBootSubstateAllOf instances are equal + /// + /// Instance of BootLoaderModuleFieldVmBootSubstateAllOf to be compared + /// Boolean + public bool Equals(BootLoaderModuleFieldVmBootSubstateAllOf input) + { + if (input == null) + { + return false; + } + return + ( + this.Value == input.Value || + (this.Value != null && + this.Value.Equals(input.Value)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Value != null) + { + hashCode = (hashCode * 59) + this.Value.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/BootLoaderModuleFieldVmBootValue.cs b/src/RadixDlt.CoreApiSdk/generated/Model/BootLoaderModuleFieldVmBootValue.cs new file mode 100644 index 000000000..601f35598 --- /dev/null +++ b/src/RadixDlt.CoreApiSdk/generated/Model/BootLoaderModuleFieldVmBootValue.cs @@ -0,0 +1,184 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Core API - Babylon + * + * This API is exposed by the Babylon Radix node to give clients access to the Radix Engine, Mempool and State in the node. The default configuration is intended for use by node-runners on a private network, and is not intended to be exposed publicly. Very heavy load may impact the node's function. The node exposes a configuration flag which allows disabling certain endpoints which may be problematic, but monitoring is advised. This configuration parameter is `api.core.flags.enable_unbounded_endpoints` / `RADIXDLT_CORE_API_FLAGS_ENABLE_UNBOUNDED_ENDPOINTS`. This API exposes queries against the node's current state (see `/lts/state/` or `/state/`), and streams of transaction history (under `/lts/stream/` or `/stream`). If you require queries against snapshots of historical ledger state, you may also wish to consider using the [Gateway API](https://docs-babylon.radixdlt.com/). ## Integration and forward compatibility guarantees Integrators (such as exchanges) are recommended to use the `/lts/` endpoints - they have been designed to be clear and simple for integrators wishing to create and monitor transactions involving fungible transfers to/from accounts. All endpoints under `/lts/` have high guarantees of forward compatibility in future node versions. We may add new fields, but existing fields will not be changed. Assuming the integrating code uses a permissive JSON parser which ignores unknown fields, any additions will not affect existing code. Other endpoints may be changed with new node versions carrying protocol-updates, although any breaking changes will be flagged clearly in the corresponding release notes. All responses may have additional fields added, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. + * + * The version of the OpenAPI document: v1.0.4 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using FileParameter = RadixDlt.CoreApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.CoreApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.CoreApiSdk.Model +{ + /// + /// BootLoaderModuleFieldVmBootValue + /// + [DataContract(Name = "BootLoaderModuleFieldVmBootValue")] + public partial class BootLoaderModuleFieldVmBootValue : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BootLoaderModuleFieldVmBootValue() { } + /// + /// Initializes a new instance of the class. + /// + /// scryptoV1MinorVersion (required). + public BootLoaderModuleFieldVmBootValue(long scryptoV1MinorVersion = default(long)) + { + this.ScryptoV1MinorVersion = scryptoV1MinorVersion; + } + + /// + /// Gets or Sets ScryptoV1MinorVersion + /// + [DataMember(Name = "scrypto_v1_minor_version", IsRequired = true, EmitDefaultValue = true)] + public long ScryptoV1MinorVersion { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BootLoaderModuleFieldVmBootValue {\n"); + sb.Append(" ScryptoV1MinorVersion: ").Append(ScryptoV1MinorVersion).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BootLoaderModuleFieldVmBootValue); + } + + /// + /// Returns true if BootLoaderModuleFieldVmBootValue instances are equal + /// + /// Instance of BootLoaderModuleFieldVmBootValue to be compared + /// Boolean + public bool Equals(BootLoaderModuleFieldVmBootValue input) + { + if (input == null) + { + return false; + } + return + ( + this.ScryptoV1MinorVersion == input.ScryptoV1MinorVersion || + this.ScryptoV1MinorVersion.Equals(input.ScryptoV1MinorVersion) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.ScryptoV1MinorVersion.GetHashCode(); + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusLedgerProofOrigin.cs b/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusLedgerProofOrigin.cs new file mode 100644 index 000000000..324cb0e5c --- /dev/null +++ b/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusLedgerProofOrigin.cs @@ -0,0 +1,225 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Core API - Babylon + * + * This API is exposed by the Babylon Radix node to give clients access to the Radix Engine, Mempool and State in the node. The default configuration is intended for use by node-runners on a private network, and is not intended to be exposed publicly. Very heavy load may impact the node's function. The node exposes a configuration flag which allows disabling certain endpoints which may be problematic, but monitoring is advised. This configuration parameter is `api.core.flags.enable_unbounded_endpoints` / `RADIXDLT_CORE_API_FLAGS_ENABLE_UNBOUNDED_ENDPOINTS`. This API exposes queries against the node's current state (see `/lts/state/` or `/state/`), and streams of transaction history (under `/lts/stream/` or `/stream`). If you require queries against snapshots of historical ledger state, you may also wish to consider using the [Gateway API](https://docs-babylon.radixdlt.com/). ## Integration and forward compatibility guarantees Integrators (such as exchanges) are recommended to use the `/lts/` endpoints - they have been designed to be clear and simple for integrators wishing to create and monitor transactions involving fungible transfers to/from accounts. All endpoints under `/lts/` have high guarantees of forward compatibility in future node versions. We may add new fields, but existing fields will not be changed. Assuming the integrating code uses a permissive JSON parser which ignores unknown fields, any additions will not affect existing code. Other endpoints may be changed with new node versions carrying protocol-updates, although any breaking changes will be flagged clearly in the corresponding release notes. All responses may have additional fields added, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. + * + * The version of the OpenAPI document: v1.0.4 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using JsonSubTypes; +using FileParameter = RadixDlt.CoreApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.CoreApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.CoreApiSdk.Model +{ + /// + /// ConsensusLedgerProofOrigin + /// + [DataContract(Name = "ConsensusLedgerProofOrigin")] + [JsonConverter(typeof(JsonSubtypes), "type")] + [JsonSubtypes.KnownSubType(typeof(ConsensusLedgerProofOrigin), "Consensus")] + [JsonSubtypes.KnownSubType(typeof(GenesisLedgerProofOrigin), "Genesis")] + [JsonSubtypes.KnownSubType(typeof(ProtocolUpdateLedgerProofOrigin), "ProtocolUpdate")] + public partial class ConsensusLedgerProofOrigin : LedgerProofOrigin, IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ConsensusLedgerProofOrigin() { } + /// + /// Initializes a new instance of the class. + /// + /// A hex-encoded 32-byte vertex VoteData hash on the consensus side, opaque to ledger. (required). + /// timestampedSignatures (required). + /// type (required) (default to LedgerProofOriginType.Consensus). + public ConsensusLedgerProofOrigin(string opaqueHash = default(string), List timestampedSignatures = default(List), LedgerProofOriginType type = LedgerProofOriginType.Consensus) : base(type) + { + // to ensure "opaqueHash" is required (not null) + if (opaqueHash == null) + { + throw new ArgumentNullException("opaqueHash is a required property for ConsensusLedgerProofOrigin and cannot be null"); + } + this.OpaqueHash = opaqueHash; + // to ensure "timestampedSignatures" is required (not null) + if (timestampedSignatures == null) + { + throw new ArgumentNullException("timestampedSignatures is a required property for ConsensusLedgerProofOrigin and cannot be null"); + } + this.TimestampedSignatures = timestampedSignatures; + } + + /// + /// A hex-encoded 32-byte vertex VoteData hash on the consensus side, opaque to ledger. + /// + /// A hex-encoded 32-byte vertex VoteData hash on the consensus side, opaque to ledger. + [DataMember(Name = "opaque_hash", IsRequired = true, EmitDefaultValue = true)] + public string OpaqueHash { get; set; } + + /// + /// Gets or Sets TimestampedSignatures + /// + [DataMember(Name = "timestamped_signatures", IsRequired = true, EmitDefaultValue = true)] + public List TimestampedSignatures { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ConsensusLedgerProofOrigin {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" OpaqueHash: ").Append(OpaqueHash).Append("\n"); + sb.Append(" TimestampedSignatures: ").Append(TimestampedSignatures).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ConsensusLedgerProofOrigin); + } + + /// + /// Returns true if ConsensusLedgerProofOrigin instances are equal + /// + /// Instance of ConsensusLedgerProofOrigin to be compared + /// Boolean + public bool Equals(ConsensusLedgerProofOrigin input) + { + if (input == null) + { + return false; + } + return base.Equals(input) && + ( + this.OpaqueHash == input.OpaqueHash || + (this.OpaqueHash != null && + this.OpaqueHash.Equals(input.OpaqueHash)) + ) && base.Equals(input) && + ( + this.TimestampedSignatures == input.TimestampedSignatures || + this.TimestampedSignatures != null && + input.TimestampedSignatures != null && + this.TimestampedSignatures.SequenceEqual(input.TimestampedSignatures) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + if (this.OpaqueHash != null) + { + hashCode = (hashCode * 59) + this.OpaqueHash.GetHashCode(); + } + if (this.TimestampedSignatures != null) + { + hashCode = (hashCode * 59) + this.TimestampedSignatures.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusLedgerProofOriginAllOf.cs b/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusLedgerProofOriginAllOf.cs new file mode 100644 index 000000000..9602dd5b3 --- /dev/null +++ b/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusLedgerProofOriginAllOf.cs @@ -0,0 +1,218 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Core API - Babylon + * + * This API is exposed by the Babylon Radix node to give clients access to the Radix Engine, Mempool and State in the node. The default configuration is intended for use by node-runners on a private network, and is not intended to be exposed publicly. Very heavy load may impact the node's function. The node exposes a configuration flag which allows disabling certain endpoints which may be problematic, but monitoring is advised. This configuration parameter is `api.core.flags.enable_unbounded_endpoints` / `RADIXDLT_CORE_API_FLAGS_ENABLE_UNBOUNDED_ENDPOINTS`. This API exposes queries against the node's current state (see `/lts/state/` or `/state/`), and streams of transaction history (under `/lts/stream/` or `/stream`). If you require queries against snapshots of historical ledger state, you may also wish to consider using the [Gateway API](https://docs-babylon.radixdlt.com/). ## Integration and forward compatibility guarantees Integrators (such as exchanges) are recommended to use the `/lts/` endpoints - they have been designed to be clear and simple for integrators wishing to create and monitor transactions involving fungible transfers to/from accounts. All endpoints under `/lts/` have high guarantees of forward compatibility in future node versions. We may add new fields, but existing fields will not be changed. Assuming the integrating code uses a permissive JSON parser which ignores unknown fields, any additions will not affect existing code. Other endpoints may be changed with new node versions carrying protocol-updates, although any breaking changes will be flagged clearly in the corresponding release notes. All responses may have additional fields added, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. + * + * The version of the OpenAPI document: v1.0.4 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using FileParameter = RadixDlt.CoreApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.CoreApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.CoreApiSdk.Model +{ + /// + /// ConsensusLedgerProofOriginAllOf + /// + [DataContract(Name = "ConsensusLedgerProofOrigin_allOf")] + public partial class ConsensusLedgerProofOriginAllOf : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ConsensusLedgerProofOriginAllOf() { } + /// + /// Initializes a new instance of the class. + /// + /// A hex-encoded 32-byte vertex VoteData hash on the consensus side, opaque to ledger. (required). + /// timestampedSignatures (required). + public ConsensusLedgerProofOriginAllOf(string opaqueHash = default(string), List timestampedSignatures = default(List)) + { + // to ensure "opaqueHash" is required (not null) + if (opaqueHash == null) + { + throw new ArgumentNullException("opaqueHash is a required property for ConsensusLedgerProofOriginAllOf and cannot be null"); + } + this.OpaqueHash = opaqueHash; + // to ensure "timestampedSignatures" is required (not null) + if (timestampedSignatures == null) + { + throw new ArgumentNullException("timestampedSignatures is a required property for ConsensusLedgerProofOriginAllOf and cannot be null"); + } + this.TimestampedSignatures = timestampedSignatures; + } + + /// + /// A hex-encoded 32-byte vertex VoteData hash on the consensus side, opaque to ledger. + /// + /// A hex-encoded 32-byte vertex VoteData hash on the consensus side, opaque to ledger. + [DataMember(Name = "opaque_hash", IsRequired = true, EmitDefaultValue = true)] + public string OpaqueHash { get; set; } + + /// + /// Gets or Sets TimestampedSignatures + /// + [DataMember(Name = "timestamped_signatures", IsRequired = true, EmitDefaultValue = true)] + public List TimestampedSignatures { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ConsensusLedgerProofOriginAllOf {\n"); + sb.Append(" OpaqueHash: ").Append(OpaqueHash).Append("\n"); + sb.Append(" TimestampedSignatures: ").Append(TimestampedSignatures).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ConsensusLedgerProofOriginAllOf); + } + + /// + /// Returns true if ConsensusLedgerProofOriginAllOf instances are equal + /// + /// Instance of ConsensusLedgerProofOriginAllOf to be compared + /// Boolean + public bool Equals(ConsensusLedgerProofOriginAllOf input) + { + if (input == null) + { + return false; + } + return + ( + this.OpaqueHash == input.OpaqueHash || + (this.OpaqueHash != null && + this.OpaqueHash.Equals(input.OpaqueHash)) + ) && + ( + this.TimestampedSignatures == input.TimestampedSignatures || + this.TimestampedSignatures != null && + input.TimestampedSignatures != null && + this.TimestampedSignatures.SequenceEqual(input.TimestampedSignatures) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.OpaqueHash != null) + { + hashCode = (hashCode * 59) + this.OpaqueHash.GetHashCode(); + } + if (this.TimestampedSignatures != null) + { + hashCode = (hashCode * 59) + this.TimestampedSignatures.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldConfigSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldConfigSubstate.cs index a72e0e817..a273e5167 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldConfigSubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldConfigSubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldCurrentProposalStatisticSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldCurrentProposalStatisticSubstate.cs index 7e3601421..293d442ee 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldCurrentProposalStatisticSubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldCurrentProposalStatisticSubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldCurrentTimeRoundedToMinutesSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldCurrentTimeRoundedToMinutesSubstate.cs index fd13fffb1..a855b33e1 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldCurrentTimeRoundedToMinutesSubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldCurrentTimeRoundedToMinutesSubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldCurrentTimeSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldCurrentTimeSubstate.cs index c715b59f5..2369610ad 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldCurrentTimeSubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldCurrentTimeSubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldCurrentValidatorSetSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldCurrentValidatorSetSubstate.cs index 615d6a52a..d202c5c62 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldCurrentValidatorSetSubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldCurrentValidatorSetSubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldStateSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldStateSubstate.cs index a9536820c..fb1771615 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldStateSubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldStateSubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldValidatorRewardsSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldValidatorRewardsSubstate.cs index e90f7642e..ae5e76927 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldValidatorRewardsSubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerFieldValidatorRewardsSubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerRegisteredValidatorsByStakeIndexEntrySubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerRegisteredValidatorsByStakeIndexEntrySubstate.cs index 3cc9daa7b..f2de39ff4 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerRegisteredValidatorsByStakeIndexEntrySubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/ConsensusManagerRegisteredValidatorsByStakeIndexEntrySubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/EntityModule.cs b/src/RadixDlt.CoreApiSdk/generated/Model/EntityModule.cs index 9e8a5875e..53c7ee607 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/EntityModule.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/EntityModule.cs @@ -129,7 +129,13 @@ public enum EntityModule /// Enum Schema for value: Schema /// [EnumMember(Value = "Schema")] - Schema = 6 + Schema = 6, + + /// + /// Enum BootLoader for value: BootLoader + /// + [EnumMember(Value = "BootLoader")] + BootLoader = 7 } diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/FungibleResourceManagerFieldDivisibilitySubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/FungibleResourceManagerFieldDivisibilitySubstate.cs index adab09f6c..ccb12607c 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/FungibleResourceManagerFieldDivisibilitySubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/FungibleResourceManagerFieldDivisibilitySubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/FungibleResourceManagerFieldTotalSupplySubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/FungibleResourceManagerFieldTotalSupplySubstate.cs index 32fad8ee3..c183e7dad 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/FungibleResourceManagerFieldTotalSupplySubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/FungibleResourceManagerFieldTotalSupplySubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/FungibleVaultFieldBalanceSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/FungibleVaultFieldBalanceSubstate.cs index e8b150a18..576696a95 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/FungibleVaultFieldBalanceSubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/FungibleVaultFieldBalanceSubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/FungibleVaultFieldFrozenStatusSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/FungibleVaultFieldFrozenStatusSubstate.cs index 3b95f8da0..793cf8ee7 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/FungibleVaultFieldFrozenStatusSubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/FungibleVaultFieldFrozenStatusSubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/GenericKeyValueStoreEntrySubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/GenericKeyValueStoreEntrySubstate.cs index ceb3b2294..9b91f3e9e 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/GenericKeyValueStoreEntrySubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/GenericKeyValueStoreEntrySubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/GenericScryptoComponentFieldStateSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/GenericScryptoComponentFieldStateSubstate.cs index 9abcd9ba3..c301d8d4d 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/GenericScryptoComponentFieldStateSubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/GenericScryptoComponentFieldStateSubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/GenesisLedgerProofOrigin.cs b/src/RadixDlt.CoreApiSdk/generated/Model/GenesisLedgerProofOrigin.cs new file mode 100644 index 000000000..5c877c5c8 --- /dev/null +++ b/src/RadixDlt.CoreApiSdk/generated/Model/GenesisLedgerProofOrigin.cs @@ -0,0 +1,200 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Core API - Babylon + * + * This API is exposed by the Babylon Radix node to give clients access to the Radix Engine, Mempool and State in the node. The default configuration is intended for use by node-runners on a private network, and is not intended to be exposed publicly. Very heavy load may impact the node's function. The node exposes a configuration flag which allows disabling certain endpoints which may be problematic, but monitoring is advised. This configuration parameter is `api.core.flags.enable_unbounded_endpoints` / `RADIXDLT_CORE_API_FLAGS_ENABLE_UNBOUNDED_ENDPOINTS`. This API exposes queries against the node's current state (see `/lts/state/` or `/state/`), and streams of transaction history (under `/lts/stream/` or `/stream`). If you require queries against snapshots of historical ledger state, you may also wish to consider using the [Gateway API](https://docs-babylon.radixdlt.com/). ## Integration and forward compatibility guarantees Integrators (such as exchanges) are recommended to use the `/lts/` endpoints - they have been designed to be clear and simple for integrators wishing to create and monitor transactions involving fungible transfers to/from accounts. All endpoints under `/lts/` have high guarantees of forward compatibility in future node versions. We may add new fields, but existing fields will not be changed. Assuming the integrating code uses a permissive JSON parser which ignores unknown fields, any additions will not affect existing code. Other endpoints may be changed with new node versions carrying protocol-updates, although any breaking changes will be flagged clearly in the corresponding release notes. All responses may have additional fields added, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. + * + * The version of the OpenAPI document: v1.0.4 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using JsonSubTypes; +using FileParameter = RadixDlt.CoreApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.CoreApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.CoreApiSdk.Model +{ + /// + /// GenesisLedgerProofOrigin + /// + [DataContract(Name = "GenesisLedgerProofOrigin")] + [JsonConverter(typeof(JsonSubtypes), "type")] + [JsonSubtypes.KnownSubType(typeof(ConsensusLedgerProofOrigin), "Consensus")] + [JsonSubtypes.KnownSubType(typeof(GenesisLedgerProofOrigin), "Genesis")] + [JsonSubtypes.KnownSubType(typeof(ProtocolUpdateLedgerProofOrigin), "ProtocolUpdate")] + public partial class GenesisLedgerProofOrigin : LedgerProofOrigin, IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GenesisLedgerProofOrigin() { } + /// + /// Initializes a new instance of the class. + /// + /// genesisOpaqueHash (required). + /// type (required) (default to LedgerProofOriginType.Genesis). + public GenesisLedgerProofOrigin(string genesisOpaqueHash = default(string), LedgerProofOriginType type = LedgerProofOriginType.Genesis) : base(type) + { + // to ensure "genesisOpaqueHash" is required (not null) + if (genesisOpaqueHash == null) + { + throw new ArgumentNullException("genesisOpaqueHash is a required property for GenesisLedgerProofOrigin and cannot be null"); + } + this.GenesisOpaqueHash = genesisOpaqueHash; + } + + /// + /// Gets or Sets GenesisOpaqueHash + /// + [DataMember(Name = "genesis_opaque_hash", IsRequired = true, EmitDefaultValue = true)] + public string GenesisOpaqueHash { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GenesisLedgerProofOrigin {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" GenesisOpaqueHash: ").Append(GenesisOpaqueHash).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GenesisLedgerProofOrigin); + } + + /// + /// Returns true if GenesisLedgerProofOrigin instances are equal + /// + /// Instance of GenesisLedgerProofOrigin to be compared + /// Boolean + public bool Equals(GenesisLedgerProofOrigin input) + { + if (input == null) + { + return false; + } + return base.Equals(input) && + ( + this.GenesisOpaqueHash == input.GenesisOpaqueHash || + (this.GenesisOpaqueHash != null && + this.GenesisOpaqueHash.Equals(input.GenesisOpaqueHash)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + if (this.GenesisOpaqueHash != null) + { + hashCode = (hashCode * 59) + this.GenesisOpaqueHash.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/GenesisLedgerProofOriginAllOf.cs b/src/RadixDlt.CoreApiSdk/generated/Model/GenesisLedgerProofOriginAllOf.cs new file mode 100644 index 000000000..fd6e51d7c --- /dev/null +++ b/src/RadixDlt.CoreApiSdk/generated/Model/GenesisLedgerProofOriginAllOf.cs @@ -0,0 +1,193 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Core API - Babylon + * + * This API is exposed by the Babylon Radix node to give clients access to the Radix Engine, Mempool and State in the node. The default configuration is intended for use by node-runners on a private network, and is not intended to be exposed publicly. Very heavy load may impact the node's function. The node exposes a configuration flag which allows disabling certain endpoints which may be problematic, but monitoring is advised. This configuration parameter is `api.core.flags.enable_unbounded_endpoints` / `RADIXDLT_CORE_API_FLAGS_ENABLE_UNBOUNDED_ENDPOINTS`. This API exposes queries against the node's current state (see `/lts/state/` or `/state/`), and streams of transaction history (under `/lts/stream/` or `/stream`). If you require queries against snapshots of historical ledger state, you may also wish to consider using the [Gateway API](https://docs-babylon.radixdlt.com/). ## Integration and forward compatibility guarantees Integrators (such as exchanges) are recommended to use the `/lts/` endpoints - they have been designed to be clear and simple for integrators wishing to create and monitor transactions involving fungible transfers to/from accounts. All endpoints under `/lts/` have high guarantees of forward compatibility in future node versions. We may add new fields, but existing fields will not be changed. Assuming the integrating code uses a permissive JSON parser which ignores unknown fields, any additions will not affect existing code. Other endpoints may be changed with new node versions carrying protocol-updates, although any breaking changes will be flagged clearly in the corresponding release notes. All responses may have additional fields added, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. + * + * The version of the OpenAPI document: v1.0.4 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using FileParameter = RadixDlt.CoreApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.CoreApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.CoreApiSdk.Model +{ + /// + /// GenesisLedgerProofOriginAllOf + /// + [DataContract(Name = "GenesisLedgerProofOrigin_allOf")] + public partial class GenesisLedgerProofOriginAllOf : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GenesisLedgerProofOriginAllOf() { } + /// + /// Initializes a new instance of the class. + /// + /// genesisOpaqueHash (required). + public GenesisLedgerProofOriginAllOf(string genesisOpaqueHash = default(string)) + { + // to ensure "genesisOpaqueHash" is required (not null) + if (genesisOpaqueHash == null) + { + throw new ArgumentNullException("genesisOpaqueHash is a required property for GenesisLedgerProofOriginAllOf and cannot be null"); + } + this.GenesisOpaqueHash = genesisOpaqueHash; + } + + /// + /// Gets or Sets GenesisOpaqueHash + /// + [DataMember(Name = "genesis_opaque_hash", IsRequired = true, EmitDefaultValue = true)] + public string GenesisOpaqueHash { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GenesisLedgerProofOriginAllOf {\n"); + sb.Append(" GenesisOpaqueHash: ").Append(GenesisOpaqueHash).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GenesisLedgerProofOriginAllOf); + } + + /// + /// Returns true if GenesisLedgerProofOriginAllOf instances are equal + /// + /// Instance of GenesisLedgerProofOriginAllOf to be compared + /// Boolean + public bool Equals(GenesisLedgerProofOriginAllOf input) + { + if (input == null) + { + return false; + } + return + ( + this.GenesisOpaqueHash == input.GenesisOpaqueHash || + (this.GenesisOpaqueHash != null && + this.GenesisOpaqueHash.Equals(input.GenesisOpaqueHash)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.GenesisOpaqueHash != null) + { + hashCode = (hashCode * 59) + this.GenesisOpaqueHash.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/LedgerProof.cs b/src/RadixDlt.CoreApiSdk/generated/Model/LedgerProof.cs index d573b42d7..2c24089f2 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/LedgerProof.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/LedgerProof.cs @@ -103,38 +103,24 @@ protected LedgerProof() { } /// /// Initializes a new instance of the class. /// - /// A hex-encoded 32-byte vertex VoteData hash on the consensus side, opaque to ledger. (required). /// ledgerHeader (required). - /// timestampedSignatures (required). - public LedgerProof(string opaqueHash = default(string), LedgerHeader ledgerHeader = default(LedgerHeader), List timestampedSignatures = default(List)) + /// origin (required). + public LedgerProof(LedgerHeader ledgerHeader = default(LedgerHeader), LedgerProofOrigin origin = default(LedgerProofOrigin)) { - // to ensure "opaqueHash" is required (not null) - if (opaqueHash == null) - { - throw new ArgumentNullException("opaqueHash is a required property for LedgerProof and cannot be null"); - } - this.OpaqueHash = opaqueHash; // to ensure "ledgerHeader" is required (not null) if (ledgerHeader == null) { throw new ArgumentNullException("ledgerHeader is a required property for LedgerProof and cannot be null"); } this.LedgerHeader = ledgerHeader; - // to ensure "timestampedSignatures" is required (not null) - if (timestampedSignatures == null) + // to ensure "origin" is required (not null) + if (origin == null) { - throw new ArgumentNullException("timestampedSignatures is a required property for LedgerProof and cannot be null"); + throw new ArgumentNullException("origin is a required property for LedgerProof and cannot be null"); } - this.TimestampedSignatures = timestampedSignatures; + this.Origin = origin; } - /// - /// A hex-encoded 32-byte vertex VoteData hash on the consensus side, opaque to ledger. - /// - /// A hex-encoded 32-byte vertex VoteData hash on the consensus side, opaque to ledger. - [DataMember(Name = "opaque_hash", IsRequired = true, EmitDefaultValue = true)] - public string OpaqueHash { get; set; } - /// /// Gets or Sets LedgerHeader /// @@ -142,10 +128,10 @@ protected LedgerProof() { } public LedgerHeader LedgerHeader { get; set; } /// - /// Gets or Sets TimestampedSignatures + /// Gets or Sets Origin /// - [DataMember(Name = "timestamped_signatures", IsRequired = true, EmitDefaultValue = true)] - public List TimestampedSignatures { get; set; } + [DataMember(Name = "origin", IsRequired = true, EmitDefaultValue = true)] + public LedgerProofOrigin Origin { get; set; } /// /// Returns the string presentation of the object @@ -155,9 +141,8 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class LedgerProof {\n"); - sb.Append(" OpaqueHash: ").Append(OpaqueHash).Append("\n"); sb.Append(" LedgerHeader: ").Append(LedgerHeader).Append("\n"); - sb.Append(" TimestampedSignatures: ").Append(TimestampedSignatures).Append("\n"); + sb.Append(" Origin: ").Append(Origin).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -193,21 +178,15 @@ public bool Equals(LedgerProof input) return false; } return - ( - this.OpaqueHash == input.OpaqueHash || - (this.OpaqueHash != null && - this.OpaqueHash.Equals(input.OpaqueHash)) - ) && ( this.LedgerHeader == input.LedgerHeader || (this.LedgerHeader != null && this.LedgerHeader.Equals(input.LedgerHeader)) ) && ( - this.TimestampedSignatures == input.TimestampedSignatures || - this.TimestampedSignatures != null && - input.TimestampedSignatures != null && - this.TimestampedSignatures.SequenceEqual(input.TimestampedSignatures) + this.Origin == input.Origin || + (this.Origin != null && + this.Origin.Equals(input.Origin)) ); } @@ -220,17 +199,13 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = 41; - if (this.OpaqueHash != null) - { - hashCode = (hashCode * 59) + this.OpaqueHash.GetHashCode(); - } if (this.LedgerHeader != null) { hashCode = (hashCode * 59) + this.LedgerHeader.GetHashCode(); } - if (this.TimestampedSignatures != null) + if (this.Origin != null) { - hashCode = (hashCode * 59) + this.TimestampedSignatures.GetHashCode(); + hashCode = (hashCode * 59) + this.Origin.GetHashCode(); } return hashCode; } diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/LedgerProofOrigin.cs b/src/RadixDlt.CoreApiSdk/generated/Model/LedgerProofOrigin.cs new file mode 100644 index 000000000..a8fbe53c3 --- /dev/null +++ b/src/RadixDlt.CoreApiSdk/generated/Model/LedgerProofOrigin.cs @@ -0,0 +1,192 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Core API - Babylon + * + * This API is exposed by the Babylon Radix node to give clients access to the Radix Engine, Mempool and State in the node. The default configuration is intended for use by node-runners on a private network, and is not intended to be exposed publicly. Very heavy load may impact the node's function. The node exposes a configuration flag which allows disabling certain endpoints which may be problematic, but monitoring is advised. This configuration parameter is `api.core.flags.enable_unbounded_endpoints` / `RADIXDLT_CORE_API_FLAGS_ENABLE_UNBOUNDED_ENDPOINTS`. This API exposes queries against the node's current state (see `/lts/state/` or `/state/`), and streams of transaction history (under `/lts/stream/` or `/stream`). If you require queries against snapshots of historical ledger state, you may also wish to consider using the [Gateway API](https://docs-babylon.radixdlt.com/). ## Integration and forward compatibility guarantees Integrators (such as exchanges) are recommended to use the `/lts/` endpoints - they have been designed to be clear and simple for integrators wishing to create and monitor transactions involving fungible transfers to/from accounts. All endpoints under `/lts/` have high guarantees of forward compatibility in future node versions. We may add new fields, but existing fields will not be changed. Assuming the integrating code uses a permissive JSON parser which ignores unknown fields, any additions will not affect existing code. Other endpoints may be changed with new node versions carrying protocol-updates, although any breaking changes will be flagged clearly in the corresponding release notes. All responses may have additional fields added, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. + * + * The version of the OpenAPI document: v1.0.4 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using JsonSubTypes; +using FileParameter = RadixDlt.CoreApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.CoreApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.CoreApiSdk.Model +{ + /// + /// LedgerProofOrigin + /// + [DataContract(Name = "LedgerProofOrigin")] + [JsonConverter(typeof(JsonSubtypes), "type")] + [JsonSubtypes.KnownSubType(typeof(ConsensusLedgerProofOrigin), "Consensus")] + [JsonSubtypes.KnownSubType(typeof(ConsensusLedgerProofOrigin), "ConsensusLedgerProofOrigin")] + [JsonSubtypes.KnownSubType(typeof(GenesisLedgerProofOrigin), "Genesis")] + [JsonSubtypes.KnownSubType(typeof(GenesisLedgerProofOrigin), "GenesisLedgerProofOrigin")] + [JsonSubtypes.KnownSubType(typeof(ProtocolUpdateLedgerProofOrigin), "ProtocolUpdate")] + [JsonSubtypes.KnownSubType(typeof(ProtocolUpdateLedgerProofOrigin), "ProtocolUpdateLedgerProofOrigin")] + public partial class LedgerProofOrigin : IEquatable + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public LedgerProofOriginType Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected LedgerProofOrigin() { } + /// + /// Initializes a new instance of the class. + /// + /// type (required). + public LedgerProofOrigin(LedgerProofOriginType type = default(LedgerProofOriginType)) + { + this.Type = type; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class LedgerProofOrigin {\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as LedgerProofOrigin); + } + + /// + /// Returns true if LedgerProofOrigin instances are equal + /// + /// Instance of LedgerProofOrigin to be compared + /// Boolean + public bool Equals(LedgerProofOrigin input) + { + if (input == null) + { + return false; + } + return + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/LedgerProofOriginType.cs b/src/RadixDlt.CoreApiSdk/generated/Model/LedgerProofOriginType.cs new file mode 100644 index 000000000..d5bc6533c --- /dev/null +++ b/src/RadixDlt.CoreApiSdk/generated/Model/LedgerProofOriginType.cs @@ -0,0 +1,118 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Core API - Babylon + * + * This API is exposed by the Babylon Radix node to give clients access to the Radix Engine, Mempool and State in the node. The default configuration is intended for use by node-runners on a private network, and is not intended to be exposed publicly. Very heavy load may impact the node's function. The node exposes a configuration flag which allows disabling certain endpoints which may be problematic, but monitoring is advised. This configuration parameter is `api.core.flags.enable_unbounded_endpoints` / `RADIXDLT_CORE_API_FLAGS_ENABLE_UNBOUNDED_ENDPOINTS`. This API exposes queries against the node's current state (see `/lts/state/` or `/state/`), and streams of transaction history (under `/lts/stream/` or `/stream`). If you require queries against snapshots of historical ledger state, you may also wish to consider using the [Gateway API](https://docs-babylon.radixdlt.com/). ## Integration and forward compatibility guarantees Integrators (such as exchanges) are recommended to use the `/lts/` endpoints - they have been designed to be clear and simple for integrators wishing to create and monitor transactions involving fungible transfers to/from accounts. All endpoints under `/lts/` have high guarantees of forward compatibility in future node versions. We may add new fields, but existing fields will not be changed. Assuming the integrating code uses a permissive JSON parser which ignores unknown fields, any additions will not affect existing code. Other endpoints may be changed with new node versions carrying protocol-updates, although any breaking changes will be flagged clearly in the corresponding release notes. All responses may have additional fields added, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. + * + * The version of the OpenAPI document: v1.0.4 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using FileParameter = RadixDlt.CoreApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.CoreApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.CoreApiSdk.Model +{ + /// + /// Defines LedgerProofOriginType + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum LedgerProofOriginType + { + /// + /// Enum Genesis for value: Genesis + /// + [EnumMember(Value = "Genesis")] + Genesis = 1, + + /// + /// Enum Consensus for value: Consensus + /// + [EnumMember(Value = "Consensus")] + Consensus = 2, + + /// + /// Enum ProtocolUpdate for value: ProtocolUpdate + /// + [EnumMember(Value = "ProtocolUpdate")] + ProtocolUpdate = 3 + + } + +} diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/MetadataModuleEntrySubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/MetadataModuleEntrySubstate.cs index c16f167be..e66d1d55b 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/MetadataModuleEntrySubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/MetadataModuleEntrySubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/MultiResourcePoolFieldStateSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/MultiResourcePoolFieldStateSubstate.cs index e115fcbe4..b9b0eb299 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/MultiResourcePoolFieldStateSubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/MultiResourcePoolFieldStateSubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/NextEpoch.cs b/src/RadixDlt.CoreApiSdk/generated/Model/NextEpoch.cs index 708e0fa57..1ead0dbb0 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/NextEpoch.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/NextEpoch.cs @@ -105,7 +105,8 @@ protected NextEpoch() { } /// /// An integer between `0` and `10^10`, marking the new epoch (required). /// Active validator set for the new epoch, ordered by stake descending. (required). - public NextEpoch(long epoch = default(long), List validators = default(List)) + /// significantProtocolUpdateReadiness. + public NextEpoch(long epoch = default(long), List validators = default(List), List significantProtocolUpdateReadiness = default(List)) { this.Epoch = epoch; // to ensure "validators" is required (not null) @@ -114,6 +115,7 @@ protected NextEpoch() { } throw new ArgumentNullException("validators is a required property for NextEpoch and cannot be null"); } this.Validators = validators; + this.SignificantProtocolUpdateReadiness = significantProtocolUpdateReadiness; } /// @@ -130,6 +132,12 @@ protected NextEpoch() { } [DataMember(Name = "validators", IsRequired = true, EmitDefaultValue = true)] public List Validators { get; set; } + /// + /// Gets or Sets SignificantProtocolUpdateReadiness + /// + [DataMember(Name = "significant_protocol_update_readiness", EmitDefaultValue = true)] + public List SignificantProtocolUpdateReadiness { get; set; } + /// /// Returns the string presentation of the object /// @@ -140,6 +148,7 @@ public override string ToString() sb.Append("class NextEpoch {\n"); sb.Append(" Epoch: ").Append(Epoch).Append("\n"); sb.Append(" Validators: ").Append(Validators).Append("\n"); + sb.Append(" SignificantProtocolUpdateReadiness: ").Append(SignificantProtocolUpdateReadiness).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -184,6 +193,12 @@ public bool Equals(NextEpoch input) this.Validators != null && input.Validators != null && this.Validators.SequenceEqual(input.Validators) + ) && + ( + this.SignificantProtocolUpdateReadiness == input.SignificantProtocolUpdateReadiness || + this.SignificantProtocolUpdateReadiness != null && + input.SignificantProtocolUpdateReadiness != null && + this.SignificantProtocolUpdateReadiness.SequenceEqual(input.SignificantProtocolUpdateReadiness) ); } @@ -201,6 +216,10 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + this.Validators.GetHashCode(); } + if (this.SignificantProtocolUpdateReadiness != null) + { + hashCode = (hashCode * 59) + this.SignificantProtocolUpdateReadiness.GetHashCode(); + } return hashCode; } } diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleResourceManagerDataEntrySubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleResourceManagerDataEntrySubstate.cs index c406b9179..47ceb7b04 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleResourceManagerDataEntrySubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleResourceManagerDataEntrySubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleResourceManagerFieldIdTypeSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleResourceManagerFieldIdTypeSubstate.cs index 59deb1831..577ffd8cf 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleResourceManagerFieldIdTypeSubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleResourceManagerFieldIdTypeSubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleResourceManagerFieldMutableFieldsSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleResourceManagerFieldMutableFieldsSubstate.cs index 0d4a29ebe..4dc426402 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleResourceManagerFieldMutableFieldsSubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleResourceManagerFieldMutableFieldsSubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleResourceManagerFieldTotalSupplySubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleResourceManagerFieldTotalSupplySubstate.cs index 207bd9868..4cdd63636 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleResourceManagerFieldTotalSupplySubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleResourceManagerFieldTotalSupplySubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleVaultContentsIndexEntrySubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleVaultContentsIndexEntrySubstate.cs index cd46790ca..fcb65b32a 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleVaultContentsIndexEntrySubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleVaultContentsIndexEntrySubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleVaultFieldBalanceSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleVaultFieldBalanceSubstate.cs index 83db9cced..9a3a57c2f 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleVaultFieldBalanceSubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleVaultFieldBalanceSubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleVaultFieldFrozenStatusSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleVaultFieldFrozenStatusSubstate.cs index 70940ca6a..2cce4f45e 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleVaultFieldFrozenStatusSubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/NonFungibleVaultFieldFrozenStatusSubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/OneResourcePoolFieldStateSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/OneResourcePoolFieldStateSubstate.cs index b46ccb949..47ca34f09 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/OneResourcePoolFieldStateSubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/OneResourcePoolFieldStateSubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/PackageBlueprintAuthTemplateEntrySubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/PackageBlueprintAuthTemplateEntrySubstate.cs index 96e570b7c..c8bb767f1 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/PackageBlueprintAuthTemplateEntrySubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/PackageBlueprintAuthTemplateEntrySubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/PackageBlueprintDefinitionEntrySubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/PackageBlueprintDefinitionEntrySubstate.cs index c4a5e9eb3..d4304b1d7 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/PackageBlueprintDefinitionEntrySubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/PackageBlueprintDefinitionEntrySubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/PackageBlueprintDependenciesEntrySubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/PackageBlueprintDependenciesEntrySubstate.cs index fbe7ca1f9..a2414bc2a 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/PackageBlueprintDependenciesEntrySubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/PackageBlueprintDependenciesEntrySubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/PackageBlueprintRoyaltyEntrySubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/PackageBlueprintRoyaltyEntrySubstate.cs index 8e5a22c97..f0154dac4 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/PackageBlueprintRoyaltyEntrySubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/PackageBlueprintRoyaltyEntrySubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/PackageCodeInstrumentedCodeEntrySubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/PackageCodeInstrumentedCodeEntrySubstate.cs index 660ffca0b..559be6994 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/PackageCodeInstrumentedCodeEntrySubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/PackageCodeInstrumentedCodeEntrySubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/PackageCodeOriginalCodeEntrySubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/PackageCodeOriginalCodeEntrySubstate.cs index a1d97de42..9e7a54c66 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/PackageCodeOriginalCodeEntrySubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/PackageCodeOriginalCodeEntrySubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/PackageCodeVmTypeEntrySubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/PackageCodeVmTypeEntrySubstate.cs index 2c251099f..464370afe 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/PackageCodeVmTypeEntrySubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/PackageCodeVmTypeEntrySubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/PackageFieldRoyaltyAccumulatorSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/PackageFieldRoyaltyAccumulatorSubstate.cs index c4374d512..6f8ebcd3e 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/PackageFieldRoyaltyAccumulatorSubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/PackageFieldRoyaltyAccumulatorSubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/ProtocolUpdateLedgerProofOrigin.cs b/src/RadixDlt.CoreApiSdk/generated/Model/ProtocolUpdateLedgerProofOrigin.cs new file mode 100644 index 000000000..62a8eb98a --- /dev/null +++ b/src/RadixDlt.CoreApiSdk/generated/Model/ProtocolUpdateLedgerProofOrigin.cs @@ -0,0 +1,214 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Core API - Babylon + * + * This API is exposed by the Babylon Radix node to give clients access to the Radix Engine, Mempool and State in the node. The default configuration is intended for use by node-runners on a private network, and is not intended to be exposed publicly. Very heavy load may impact the node's function. The node exposes a configuration flag which allows disabling certain endpoints which may be problematic, but monitoring is advised. This configuration parameter is `api.core.flags.enable_unbounded_endpoints` / `RADIXDLT_CORE_API_FLAGS_ENABLE_UNBOUNDED_ENDPOINTS`. This API exposes queries against the node's current state (see `/lts/state/` or `/state/`), and streams of transaction history (under `/lts/stream/` or `/stream`). If you require queries against snapshots of historical ledger state, you may also wish to consider using the [Gateway API](https://docs-babylon.radixdlt.com/). ## Integration and forward compatibility guarantees Integrators (such as exchanges) are recommended to use the `/lts/` endpoints - they have been designed to be clear and simple for integrators wishing to create and monitor transactions involving fungible transfers to/from accounts. All endpoints under `/lts/` have high guarantees of forward compatibility in future node versions. We may add new fields, but existing fields will not be changed. Assuming the integrating code uses a permissive JSON parser which ignores unknown fields, any additions will not affect existing code. Other endpoints may be changed with new node versions carrying protocol-updates, although any breaking changes will be flagged clearly in the corresponding release notes. All responses may have additional fields added, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. + * + * The version of the OpenAPI document: v1.0.4 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using JsonSubTypes; +using FileParameter = RadixDlt.CoreApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.CoreApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.CoreApiSdk.Model +{ + /// + /// ProtocolUpdateLedgerProofOrigin + /// + [DataContract(Name = "ProtocolUpdateLedgerProofOrigin")] + [JsonConverter(typeof(JsonSubtypes), "type")] + [JsonSubtypes.KnownSubType(typeof(ConsensusLedgerProofOrigin), "Consensus")] + [JsonSubtypes.KnownSubType(typeof(GenesisLedgerProofOrigin), "Genesis")] + [JsonSubtypes.KnownSubType(typeof(ProtocolUpdateLedgerProofOrigin), "ProtocolUpdate")] + public partial class ProtocolUpdateLedgerProofOrigin : LedgerProofOrigin, IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ProtocolUpdateLedgerProofOrigin() { } + /// + /// Initializes a new instance of the class. + /// + /// protocolVersionName (required). + /// batchIdx (required). + /// type (required) (default to LedgerProofOriginType.ProtocolUpdate). + public ProtocolUpdateLedgerProofOrigin(string protocolVersionName = default(string), long batchIdx = default(long), LedgerProofOriginType type = LedgerProofOriginType.ProtocolUpdate) : base(type) + { + // to ensure "protocolVersionName" is required (not null) + if (protocolVersionName == null) + { + throw new ArgumentNullException("protocolVersionName is a required property for ProtocolUpdateLedgerProofOrigin and cannot be null"); + } + this.ProtocolVersionName = protocolVersionName; + this.BatchIdx = batchIdx; + } + + /// + /// Gets or Sets ProtocolVersionName + /// + [DataMember(Name = "protocol_version_name", IsRequired = true, EmitDefaultValue = true)] + public string ProtocolVersionName { get; set; } + + /// + /// Gets or Sets BatchIdx + /// + [DataMember(Name = "batch_idx", IsRequired = true, EmitDefaultValue = true)] + public long BatchIdx { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ProtocolUpdateLedgerProofOrigin {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" ProtocolVersionName: ").Append(ProtocolVersionName).Append("\n"); + sb.Append(" BatchIdx: ").Append(BatchIdx).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ProtocolUpdateLedgerProofOrigin); + } + + /// + /// Returns true if ProtocolUpdateLedgerProofOrigin instances are equal + /// + /// Instance of ProtocolUpdateLedgerProofOrigin to be compared + /// Boolean + public bool Equals(ProtocolUpdateLedgerProofOrigin input) + { + if (input == null) + { + return false; + } + return base.Equals(input) && + ( + this.ProtocolVersionName == input.ProtocolVersionName || + (this.ProtocolVersionName != null && + this.ProtocolVersionName.Equals(input.ProtocolVersionName)) + ) && base.Equals(input) && + ( + this.BatchIdx == input.BatchIdx || + this.BatchIdx.Equals(input.BatchIdx) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + if (this.ProtocolVersionName != null) + { + hashCode = (hashCode * 59) + this.ProtocolVersionName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.BatchIdx.GetHashCode(); + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/ProtocolUpdateLedgerProofOriginAllOf.cs b/src/RadixDlt.CoreApiSdk/generated/Model/ProtocolUpdateLedgerProofOriginAllOf.cs new file mode 100644 index 000000000..56eafc42e --- /dev/null +++ b/src/RadixDlt.CoreApiSdk/generated/Model/ProtocolUpdateLedgerProofOriginAllOf.cs @@ -0,0 +1,207 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Core API - Babylon + * + * This API is exposed by the Babylon Radix node to give clients access to the Radix Engine, Mempool and State in the node. The default configuration is intended for use by node-runners on a private network, and is not intended to be exposed publicly. Very heavy load may impact the node's function. The node exposes a configuration flag which allows disabling certain endpoints which may be problematic, but monitoring is advised. This configuration parameter is `api.core.flags.enable_unbounded_endpoints` / `RADIXDLT_CORE_API_FLAGS_ENABLE_UNBOUNDED_ENDPOINTS`. This API exposes queries against the node's current state (see `/lts/state/` or `/state/`), and streams of transaction history (under `/lts/stream/` or `/stream`). If you require queries against snapshots of historical ledger state, you may also wish to consider using the [Gateway API](https://docs-babylon.radixdlt.com/). ## Integration and forward compatibility guarantees Integrators (such as exchanges) are recommended to use the `/lts/` endpoints - they have been designed to be clear and simple for integrators wishing to create and monitor transactions involving fungible transfers to/from accounts. All endpoints under `/lts/` have high guarantees of forward compatibility in future node versions. We may add new fields, but existing fields will not be changed. Assuming the integrating code uses a permissive JSON parser which ignores unknown fields, any additions will not affect existing code. Other endpoints may be changed with new node versions carrying protocol-updates, although any breaking changes will be flagged clearly in the corresponding release notes. All responses may have additional fields added, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. + * + * The version of the OpenAPI document: v1.0.4 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using FileParameter = RadixDlt.CoreApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.CoreApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.CoreApiSdk.Model +{ + /// + /// ProtocolUpdateLedgerProofOriginAllOf + /// + [DataContract(Name = "ProtocolUpdateLedgerProofOrigin_allOf")] + public partial class ProtocolUpdateLedgerProofOriginAllOf : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ProtocolUpdateLedgerProofOriginAllOf() { } + /// + /// Initializes a new instance of the class. + /// + /// protocolVersionName (required). + /// batchIdx (required). + public ProtocolUpdateLedgerProofOriginAllOf(string protocolVersionName = default(string), long batchIdx = default(long)) + { + // to ensure "protocolVersionName" is required (not null) + if (protocolVersionName == null) + { + throw new ArgumentNullException("protocolVersionName is a required property for ProtocolUpdateLedgerProofOriginAllOf and cannot be null"); + } + this.ProtocolVersionName = protocolVersionName; + this.BatchIdx = batchIdx; + } + + /// + /// Gets or Sets ProtocolVersionName + /// + [DataMember(Name = "protocol_version_name", IsRequired = true, EmitDefaultValue = true)] + public string ProtocolVersionName { get; set; } + + /// + /// Gets or Sets BatchIdx + /// + [DataMember(Name = "batch_idx", IsRequired = true, EmitDefaultValue = true)] + public long BatchIdx { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ProtocolUpdateLedgerProofOriginAllOf {\n"); + sb.Append(" ProtocolVersionName: ").Append(ProtocolVersionName).Append("\n"); + sb.Append(" BatchIdx: ").Append(BatchIdx).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ProtocolUpdateLedgerProofOriginAllOf); + } + + /// + /// Returns true if ProtocolUpdateLedgerProofOriginAllOf instances are equal + /// + /// Instance of ProtocolUpdateLedgerProofOriginAllOf to be compared + /// Boolean + public bool Equals(ProtocolUpdateLedgerProofOriginAllOf input) + { + if (input == null) + { + return false; + } + return + ( + this.ProtocolVersionName == input.ProtocolVersionName || + (this.ProtocolVersionName != null && + this.ProtocolVersionName.Equals(input.ProtocolVersionName)) + ) && + ( + this.BatchIdx == input.BatchIdx || + this.BatchIdx.Equals(input.BatchIdx) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ProtocolVersionName != null) + { + hashCode = (hashCode * 59) + this.ProtocolVersionName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.BatchIdx.GetHashCode(); + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/RoleAssignmentModuleFieldOwnerRoleSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/RoleAssignmentModuleFieldOwnerRoleSubstate.cs index 9f0c42b4a..90540ff49 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/RoleAssignmentModuleFieldOwnerRoleSubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/RoleAssignmentModuleFieldOwnerRoleSubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/RoleAssignmentModuleRuleEntrySubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/RoleAssignmentModuleRuleEntrySubstate.cs index c2c3cc0d6..34bcc3ff7 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/RoleAssignmentModuleRuleEntrySubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/RoleAssignmentModuleRuleEntrySubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/RoyaltyModuleFieldStateSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/RoyaltyModuleFieldStateSubstate.cs index 91e11addc..c4ed361e4 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/RoyaltyModuleFieldStateSubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/RoyaltyModuleFieldStateSubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/RoyaltyModuleMethodRoyaltyEntrySubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/RoyaltyModuleMethodRoyaltyEntrySubstate.cs index 8378b4e0f..ca4b058ec 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/RoyaltyModuleMethodRoyaltyEntrySubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/RoyaltyModuleMethodRoyaltyEntrySubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/SchemaEntrySubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/SchemaEntrySubstate.cs index 606b25403..a47b0b587 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/SchemaEntrySubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/SchemaEntrySubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/SignificantProtocolUpdateReadinessEntry.cs b/src/RadixDlt.CoreApiSdk/generated/Model/SignificantProtocolUpdateReadinessEntry.cs new file mode 100644 index 000000000..037b9071b --- /dev/null +++ b/src/RadixDlt.CoreApiSdk/generated/Model/SignificantProtocolUpdateReadinessEntry.cs @@ -0,0 +1,216 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Core API - Babylon + * + * This API is exposed by the Babylon Radix node to give clients access to the Radix Engine, Mempool and State in the node. The default configuration is intended for use by node-runners on a private network, and is not intended to be exposed publicly. Very heavy load may impact the node's function. The node exposes a configuration flag which allows disabling certain endpoints which may be problematic, but monitoring is advised. This configuration parameter is `api.core.flags.enable_unbounded_endpoints` / `RADIXDLT_CORE_API_FLAGS_ENABLE_UNBOUNDED_ENDPOINTS`. This API exposes queries against the node's current state (see `/lts/state/` or `/state/`), and streams of transaction history (under `/lts/stream/` or `/stream`). If you require queries against snapshots of historical ledger state, you may also wish to consider using the [Gateway API](https://docs-babylon.radixdlt.com/). ## Integration and forward compatibility guarantees Integrators (such as exchanges) are recommended to use the `/lts/` endpoints - they have been designed to be clear and simple for integrators wishing to create and monitor transactions involving fungible transfers to/from accounts. All endpoints under `/lts/` have high guarantees of forward compatibility in future node versions. We may add new fields, but existing fields will not be changed. Assuming the integrating code uses a permissive JSON parser which ignores unknown fields, any additions will not affect existing code. Other endpoints may be changed with new node versions carrying protocol-updates, although any breaking changes will be flagged clearly in the corresponding release notes. All responses may have additional fields added, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. + * + * The version of the OpenAPI document: v1.0.4 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using FileParameter = RadixDlt.CoreApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.CoreApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.CoreApiSdk.Model +{ + /// + /// SignificantProtocolUpdateReadinessEntry + /// + [DataContract(Name = "SignificantProtocolUpdateReadinessEntry")] + public partial class SignificantProtocolUpdateReadinessEntry : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SignificantProtocolUpdateReadinessEntry() { } + /// + /// Initializes a new instance of the class. + /// + /// readinessSignalName (required). + /// signalledStake (required). + public SignificantProtocolUpdateReadinessEntry(string readinessSignalName = default(string), string signalledStake = default(string)) + { + // to ensure "readinessSignalName" is required (not null) + if (readinessSignalName == null) + { + throw new ArgumentNullException("readinessSignalName is a required property for SignificantProtocolUpdateReadinessEntry and cannot be null"); + } + this.ReadinessSignalName = readinessSignalName; + // to ensure "signalledStake" is required (not null) + if (signalledStake == null) + { + throw new ArgumentNullException("signalledStake is a required property for SignificantProtocolUpdateReadinessEntry and cannot be null"); + } + this.SignalledStake = signalledStake; + } + + /// + /// Gets or Sets ReadinessSignalName + /// + [DataMember(Name = "readiness_signal_name", IsRequired = true, EmitDefaultValue = true)] + public string ReadinessSignalName { get; set; } + + /// + /// Gets or Sets SignalledStake + /// + [DataMember(Name = "signalled_stake", IsRequired = true, EmitDefaultValue = true)] + public string SignalledStake { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SignificantProtocolUpdateReadinessEntry {\n"); + sb.Append(" ReadinessSignalName: ").Append(ReadinessSignalName).Append("\n"); + sb.Append(" SignalledStake: ").Append(SignalledStake).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SignificantProtocolUpdateReadinessEntry); + } + + /// + /// Returns true if SignificantProtocolUpdateReadinessEntry instances are equal + /// + /// Instance of SignificantProtocolUpdateReadinessEntry to be compared + /// Boolean + public bool Equals(SignificantProtocolUpdateReadinessEntry input) + { + if (input == null) + { + return false; + } + return + ( + this.ReadinessSignalName == input.ReadinessSignalName || + (this.ReadinessSignalName != null && + this.ReadinessSignalName.Equals(input.ReadinessSignalName)) + ) && + ( + this.SignalledStake == input.SignalledStake || + (this.SignalledStake != null && + this.SignalledStake.Equals(input.SignalledStake)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ReadinessSignalName != null) + { + hashCode = (hashCode * 59) + this.ReadinessSignalName.GetHashCode(); + } + if (this.SignalledStake != null) + { + hashCode = (hashCode * 59) + this.SignalledStake.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/Substate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/Substate.cs index 10b76c72b..cf51b7ecd 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/Substate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/Substate.cs @@ -105,6 +105,8 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntrySubstate")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntrySubstate")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBootSubstate")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfigSubstate")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/SubstateType.cs b/src/RadixDlt.CoreApiSdk/generated/Model/SubstateType.cs index 5ce34c6be..3fe6f3072 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/SubstateType.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/SubstateType.cs @@ -95,305 +95,311 @@ namespace RadixDlt.CoreApiSdk.Model [JsonConverter(typeof(StringEnumConverter))] public enum SubstateType { + /// + /// Enum BootLoaderModuleFieldVmBoot for value: BootLoaderModuleFieldVmBoot + /// + [EnumMember(Value = "BootLoaderModuleFieldVmBoot")] + BootLoaderModuleFieldVmBoot = 1, + /// /// Enum TypeInfoModuleFieldTypeInfo for value: TypeInfoModuleFieldTypeInfo /// [EnumMember(Value = "TypeInfoModuleFieldTypeInfo")] - TypeInfoModuleFieldTypeInfo = 1, + TypeInfoModuleFieldTypeInfo = 2, /// /// Enum RoleAssignmentModuleFieldOwnerRole for value: RoleAssignmentModuleFieldOwnerRole /// [EnumMember(Value = "RoleAssignmentModuleFieldOwnerRole")] - RoleAssignmentModuleFieldOwnerRole = 2, + RoleAssignmentModuleFieldOwnerRole = 3, /// /// Enum RoleAssignmentModuleRuleEntry for value: RoleAssignmentModuleRuleEntry /// [EnumMember(Value = "RoleAssignmentModuleRuleEntry")] - RoleAssignmentModuleRuleEntry = 3, + RoleAssignmentModuleRuleEntry = 4, /// /// Enum RoleAssignmentModuleMutabilityEntry for value: RoleAssignmentModuleMutabilityEntry /// [EnumMember(Value = "RoleAssignmentModuleMutabilityEntry")] - RoleAssignmentModuleMutabilityEntry = 4, + RoleAssignmentModuleMutabilityEntry = 5, /// /// Enum RoyaltyModuleFieldState for value: RoyaltyModuleFieldState /// [EnumMember(Value = "RoyaltyModuleFieldState")] - RoyaltyModuleFieldState = 5, + RoyaltyModuleFieldState = 6, /// /// Enum RoyaltyModuleMethodRoyaltyEntry for value: RoyaltyModuleMethodRoyaltyEntry /// [EnumMember(Value = "RoyaltyModuleMethodRoyaltyEntry")] - RoyaltyModuleMethodRoyaltyEntry = 6, + RoyaltyModuleMethodRoyaltyEntry = 7, /// /// Enum MetadataModuleEntry for value: MetadataModuleEntry /// [EnumMember(Value = "MetadataModuleEntry")] - MetadataModuleEntry = 7, + MetadataModuleEntry = 8, /// /// Enum PackageFieldRoyaltyAccumulator for value: PackageFieldRoyaltyAccumulator /// [EnumMember(Value = "PackageFieldRoyaltyAccumulator")] - PackageFieldRoyaltyAccumulator = 8, + PackageFieldRoyaltyAccumulator = 9, /// /// Enum PackageCodeVmTypeEntry for value: PackageCodeVmTypeEntry /// [EnumMember(Value = "PackageCodeVmTypeEntry")] - PackageCodeVmTypeEntry = 9, + PackageCodeVmTypeEntry = 10, /// /// Enum PackageCodeOriginalCodeEntry for value: PackageCodeOriginalCodeEntry /// [EnumMember(Value = "PackageCodeOriginalCodeEntry")] - PackageCodeOriginalCodeEntry = 10, + PackageCodeOriginalCodeEntry = 11, /// /// Enum PackageCodeInstrumentedCodeEntry for value: PackageCodeInstrumentedCodeEntry /// [EnumMember(Value = "PackageCodeInstrumentedCodeEntry")] - PackageCodeInstrumentedCodeEntry = 11, + PackageCodeInstrumentedCodeEntry = 12, /// /// Enum SchemaEntry for value: SchemaEntry /// [EnumMember(Value = "SchemaEntry")] - SchemaEntry = 12, + SchemaEntry = 13, /// /// Enum PackageBlueprintDefinitionEntry for value: PackageBlueprintDefinitionEntry /// [EnumMember(Value = "PackageBlueprintDefinitionEntry")] - PackageBlueprintDefinitionEntry = 13, + PackageBlueprintDefinitionEntry = 14, /// /// Enum PackageBlueprintDependenciesEntry for value: PackageBlueprintDependenciesEntry /// [EnumMember(Value = "PackageBlueprintDependenciesEntry")] - PackageBlueprintDependenciesEntry = 14, + PackageBlueprintDependenciesEntry = 15, /// /// Enum PackageBlueprintRoyaltyEntry for value: PackageBlueprintRoyaltyEntry /// [EnumMember(Value = "PackageBlueprintRoyaltyEntry")] - PackageBlueprintRoyaltyEntry = 15, + PackageBlueprintRoyaltyEntry = 16, /// /// Enum PackageBlueprintAuthTemplateEntry for value: PackageBlueprintAuthTemplateEntry /// [EnumMember(Value = "PackageBlueprintAuthTemplateEntry")] - PackageBlueprintAuthTemplateEntry = 16, + PackageBlueprintAuthTemplateEntry = 17, /// /// Enum PackageFieldFunctionAccessRules for value: PackageFieldFunctionAccessRules /// [EnumMember(Value = "PackageFieldFunctionAccessRules")] - PackageFieldFunctionAccessRules = 17, + PackageFieldFunctionAccessRules = 18, /// /// Enum FungibleResourceManagerFieldDivisibility for value: FungibleResourceManagerFieldDivisibility /// [EnumMember(Value = "FungibleResourceManagerFieldDivisibility")] - FungibleResourceManagerFieldDivisibility = 18, + FungibleResourceManagerFieldDivisibility = 19, /// /// Enum FungibleResourceManagerFieldTotalSupply for value: FungibleResourceManagerFieldTotalSupply /// [EnumMember(Value = "FungibleResourceManagerFieldTotalSupply")] - FungibleResourceManagerFieldTotalSupply = 19, + FungibleResourceManagerFieldTotalSupply = 20, /// /// Enum NonFungibleResourceManagerFieldIdType for value: NonFungibleResourceManagerFieldIdType /// [EnumMember(Value = "NonFungibleResourceManagerFieldIdType")] - NonFungibleResourceManagerFieldIdType = 20, + NonFungibleResourceManagerFieldIdType = 21, /// /// Enum NonFungibleResourceManagerFieldTotalSupply for value: NonFungibleResourceManagerFieldTotalSupply /// [EnumMember(Value = "NonFungibleResourceManagerFieldTotalSupply")] - NonFungibleResourceManagerFieldTotalSupply = 21, + NonFungibleResourceManagerFieldTotalSupply = 22, /// /// Enum NonFungibleResourceManagerFieldMutableFields for value: NonFungibleResourceManagerFieldMutableFields /// [EnumMember(Value = "NonFungibleResourceManagerFieldMutableFields")] - NonFungibleResourceManagerFieldMutableFields = 22, + NonFungibleResourceManagerFieldMutableFields = 23, /// /// Enum NonFungibleResourceManagerDataEntry for value: NonFungibleResourceManagerDataEntry /// [EnumMember(Value = "NonFungibleResourceManagerDataEntry")] - NonFungibleResourceManagerDataEntry = 23, + NonFungibleResourceManagerDataEntry = 24, /// /// Enum FungibleVaultFieldBalance for value: FungibleVaultFieldBalance /// [EnumMember(Value = "FungibleVaultFieldBalance")] - FungibleVaultFieldBalance = 24, + FungibleVaultFieldBalance = 25, /// /// Enum FungibleVaultFieldFrozenStatus for value: FungibleVaultFieldFrozenStatus /// [EnumMember(Value = "FungibleVaultFieldFrozenStatus")] - FungibleVaultFieldFrozenStatus = 25, + FungibleVaultFieldFrozenStatus = 26, /// /// Enum NonFungibleVaultFieldBalance for value: NonFungibleVaultFieldBalance /// [EnumMember(Value = "NonFungibleVaultFieldBalance")] - NonFungibleVaultFieldBalance = 26, + NonFungibleVaultFieldBalance = 27, /// /// Enum NonFungibleVaultFieldFrozenStatus for value: NonFungibleVaultFieldFrozenStatus /// [EnumMember(Value = "NonFungibleVaultFieldFrozenStatus")] - NonFungibleVaultFieldFrozenStatus = 27, + NonFungibleVaultFieldFrozenStatus = 28, /// /// Enum NonFungibleVaultContentsIndexEntry for value: NonFungibleVaultContentsIndexEntry /// [EnumMember(Value = "NonFungibleVaultContentsIndexEntry")] - NonFungibleVaultContentsIndexEntry = 28, + NonFungibleVaultContentsIndexEntry = 29, /// /// Enum ConsensusManagerFieldConfig for value: ConsensusManagerFieldConfig /// [EnumMember(Value = "ConsensusManagerFieldConfig")] - ConsensusManagerFieldConfig = 29, + ConsensusManagerFieldConfig = 30, /// /// Enum ConsensusManagerFieldState for value: ConsensusManagerFieldState /// [EnumMember(Value = "ConsensusManagerFieldState")] - ConsensusManagerFieldState = 30, + ConsensusManagerFieldState = 31, /// /// Enum ConsensusManagerFieldCurrentValidatorSet for value: ConsensusManagerFieldCurrentValidatorSet /// [EnumMember(Value = "ConsensusManagerFieldCurrentValidatorSet")] - ConsensusManagerFieldCurrentValidatorSet = 31, + ConsensusManagerFieldCurrentValidatorSet = 32, /// /// Enum ConsensusManagerFieldCurrentProposalStatistic for value: ConsensusManagerFieldCurrentProposalStatistic /// [EnumMember(Value = "ConsensusManagerFieldCurrentProposalStatistic")] - ConsensusManagerFieldCurrentProposalStatistic = 32, + ConsensusManagerFieldCurrentProposalStatistic = 33, /// /// Enum ConsensusManagerFieldCurrentTimeRoundedToMinutes for value: ConsensusManagerFieldCurrentTimeRoundedToMinutes /// [EnumMember(Value = "ConsensusManagerFieldCurrentTimeRoundedToMinutes")] - ConsensusManagerFieldCurrentTimeRoundedToMinutes = 33, + ConsensusManagerFieldCurrentTimeRoundedToMinutes = 34, /// /// Enum ConsensusManagerFieldCurrentTime for value: ConsensusManagerFieldCurrentTime /// [EnumMember(Value = "ConsensusManagerFieldCurrentTime")] - ConsensusManagerFieldCurrentTime = 34, + ConsensusManagerFieldCurrentTime = 35, /// /// Enum ConsensusManagerFieldValidatorRewards for value: ConsensusManagerFieldValidatorRewards /// [EnumMember(Value = "ConsensusManagerFieldValidatorRewards")] - ConsensusManagerFieldValidatorRewards = 35, + ConsensusManagerFieldValidatorRewards = 36, /// /// Enum ConsensusManagerRegisteredValidatorsByStakeIndexEntry for value: ConsensusManagerRegisteredValidatorsByStakeIndexEntry /// [EnumMember(Value = "ConsensusManagerRegisteredValidatorsByStakeIndexEntry")] - ConsensusManagerRegisteredValidatorsByStakeIndexEntry = 36, + ConsensusManagerRegisteredValidatorsByStakeIndexEntry = 37, /// /// Enum ValidatorFieldState for value: ValidatorFieldState /// [EnumMember(Value = "ValidatorFieldState")] - ValidatorFieldState = 37, + ValidatorFieldState = 38, /// /// Enum ValidatorFieldProtocolUpdateReadinessSignal for value: ValidatorFieldProtocolUpdateReadinessSignal /// [EnumMember(Value = "ValidatorFieldProtocolUpdateReadinessSignal")] - ValidatorFieldProtocolUpdateReadinessSignal = 38, + ValidatorFieldProtocolUpdateReadinessSignal = 39, /// /// Enum AccountFieldState for value: AccountFieldState /// [EnumMember(Value = "AccountFieldState")] - AccountFieldState = 39, + AccountFieldState = 40, /// /// Enum AccountVaultEntry for value: AccountVaultEntry /// [EnumMember(Value = "AccountVaultEntry")] - AccountVaultEntry = 40, + AccountVaultEntry = 41, /// /// Enum AccountResourcePreferenceEntry for value: AccountResourcePreferenceEntry /// [EnumMember(Value = "AccountResourcePreferenceEntry")] - AccountResourcePreferenceEntry = 41, + AccountResourcePreferenceEntry = 42, /// /// Enum AccountAuthorizedDepositorEntry for value: AccountAuthorizedDepositorEntry /// [EnumMember(Value = "AccountAuthorizedDepositorEntry")] - AccountAuthorizedDepositorEntry = 42, + AccountAuthorizedDepositorEntry = 43, /// /// Enum AccessControllerFieldState for value: AccessControllerFieldState /// [EnumMember(Value = "AccessControllerFieldState")] - AccessControllerFieldState = 43, + AccessControllerFieldState = 44, /// /// Enum GenericScryptoComponentFieldState for value: GenericScryptoComponentFieldState /// [EnumMember(Value = "GenericScryptoComponentFieldState")] - GenericScryptoComponentFieldState = 44, + GenericScryptoComponentFieldState = 45, /// /// Enum GenericKeyValueStoreEntry for value: GenericKeyValueStoreEntry /// [EnumMember(Value = "GenericKeyValueStoreEntry")] - GenericKeyValueStoreEntry = 45, + GenericKeyValueStoreEntry = 46, /// /// Enum OneResourcePoolFieldState for value: OneResourcePoolFieldState /// [EnumMember(Value = "OneResourcePoolFieldState")] - OneResourcePoolFieldState = 46, + OneResourcePoolFieldState = 47, /// /// Enum TwoResourcePoolFieldState for value: TwoResourcePoolFieldState /// [EnumMember(Value = "TwoResourcePoolFieldState")] - TwoResourcePoolFieldState = 47, + TwoResourcePoolFieldState = 48, /// /// Enum MultiResourcePoolFieldState for value: MultiResourcePoolFieldState /// [EnumMember(Value = "MultiResourcePoolFieldState")] - MultiResourcePoolFieldState = 48, + MultiResourcePoolFieldState = 49, /// /// Enum TransactionTrackerFieldState for value: TransactionTrackerFieldState /// [EnumMember(Value = "TransactionTrackerFieldState")] - TransactionTrackerFieldState = 49, + TransactionTrackerFieldState = 50, /// /// Enum TransactionTrackerCollectionEntry for value: TransactionTrackerCollectionEntry /// [EnumMember(Value = "TransactionTrackerCollectionEntry")] - TransactionTrackerCollectionEntry = 50 + TransactionTrackerCollectionEntry = 51 } diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/SystemFieldKind.cs b/src/RadixDlt.CoreApiSdk/generated/Model/SystemFieldKind.cs index 3ad6f2ea5..230451837 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/SystemFieldKind.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/SystemFieldKind.cs @@ -95,11 +95,17 @@ namespace RadixDlt.CoreApiSdk.Model [JsonConverter(typeof(StringEnumConverter))] public enum SystemFieldKind { + /// + /// Enum BootLoader for value: BootLoader + /// + [EnumMember(Value = "BootLoader")] + BootLoader = 1, + /// /// Enum TypeInfo for value: TypeInfo /// [EnumMember(Value = "TypeInfo")] - TypeInfo = 1 + TypeInfo = 2 } diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/TransactionTrackerCollectionEntrySubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/TransactionTrackerCollectionEntrySubstate.cs index a8831649d..42e8ea04a 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/TransactionTrackerCollectionEntrySubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/TransactionTrackerCollectionEntrySubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/TransactionTrackerFieldStateSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/TransactionTrackerFieldStateSubstate.cs index c1e119e5b..ff62df84d 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/TransactionTrackerFieldStateSubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/TransactionTrackerFieldStateSubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/TwoResourcePoolFieldStateSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/TwoResourcePoolFieldStateSubstate.cs index 31ce66aed..f9bf13ae9 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/TwoResourcePoolFieldStateSubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/TwoResourcePoolFieldStateSubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/TypeInfoModuleFieldTypeInfoSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/TypeInfoModuleFieldTypeInfoSubstate.cs index 472030f64..4374a1b0c 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/TypeInfoModuleFieldTypeInfoSubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/TypeInfoModuleFieldTypeInfoSubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/ValidatorFieldProtocolUpdateReadinessSignalSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/ValidatorFieldProtocolUpdateReadinessSignalSubstate.cs index e04f264c5..0998da241 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/ValidatorFieldProtocolUpdateReadinessSignalSubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/ValidatorFieldProtocolUpdateReadinessSignalSubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/ValidatorFieldStateSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/ValidatorFieldStateSubstate.cs index 1c18d1eac..26845124e 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/ValidatorFieldStateSubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/ValidatorFieldStateSubstate.cs @@ -100,6 +100,7 @@ namespace RadixDlt.CoreApiSdk.Model [JsonSubtypes.KnownSubType(typeof(AccountFieldStateSubstate), "AccountFieldState")] [JsonSubtypes.KnownSubType(typeof(AccountResourcePreferenceEntrySubstate), "AccountResourcePreferenceEntry")] [JsonSubtypes.KnownSubType(typeof(AccountVaultEntrySubstate), "AccountVaultEntry")] + [JsonSubtypes.KnownSubType(typeof(BootLoaderModuleFieldVmBootSubstate), "BootLoaderModuleFieldVmBoot")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldConfigSubstate), "ConsensusManagerFieldConfig")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentProposalStatisticSubstate), "ConsensusManagerFieldCurrentProposalStatistic")] [JsonSubtypes.KnownSubType(typeof(ConsensusManagerFieldCurrentTimeSubstate), "ConsensusManagerFieldCurrentTime")] From b0283c6a6e83a6a90f1c11d19b4cc9ac6cf49ab2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Pawelec?= Date: Thu, 18 Jan 2024 16:49:02 +0100 Subject: [PATCH 15/19] use deprecated for obsolete properties. --- src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml b/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml index 0ae739c1f..6ec729a9d 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml +++ b/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml @@ -3120,12 +3120,15 @@ components: $ref: "#/components/schemas/StateEntityDetailsResponsePackageDetailsCodeCollection" vm_type: description: "Obsolete! Use codes collection" + deprecated: true $ref: "#/components/schemas/PackageVmType" code_hash_hex: description: "Obsolete! Use codes collection" + deprecated: true $ref: "#/components/schemas/HexString" code_hex: description: "Obsolete! Use codes collection" + deprecated: true $ref: "#/components/schemas/HexString" royalty_vault_balance: $ref: "#/components/schemas/BigDecimal" From 52eb80f57943d792537fc7f149e54c2fe68af258 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=81abu=C5=9B?= Date: Fri, 19 Jan 2024 15:58:59 +0100 Subject: [PATCH 16/19] Fixed transient exception on missing balance changes in TransactionBalanceChangesService --- CHANGELOG.md | 8 ++++---- .../Services/TransactionBalanceChangesService.cs | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9592c6143..205db0658 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,11 @@ ## 1.3.0 Release Date: _unreleased_ -- added support for new transaction types (flash transactions) that are gonna occur on protocol updates. -- moved vm_type to `package_code_history` table from package in `entity` table. +- Added support for new transaction types (flash transactions) that are gonna occur on protocol updates. +- Moved vm_type to `package_code_history` table from package in `entity` table. - `vm_type`, `code_hash_hex` and `code_hex` are returned as collection (it's allowed after protocol update to have multiple codes per package). Previous properties will return empty strings to keep contract compatibility. -- created new `package_blueprint_aggregate_history` table which will hold pointers to all package blueprints. -- created new `package_code_aggregate_history` table which will hold pointers to all package codes. +- Created new `package_blueprint_aggregate_history` table which will hold pointers to all package blueprints. +- Created new `package_code_aggregate_history` table which will hold pointers to all package codes. ## 1.2.4 Release Date: 4.01.2024 diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/TransactionBalanceChangesService.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/TransactionBalanceChangesService.cs index f9e1a7137..069822801 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/TransactionBalanceChangesService.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/TransactionBalanceChangesService.cs @@ -147,7 +147,12 @@ await Parallel.ForEachAsync(transactions, options, async (transaction, cancellat throw balanceChangesResult.FailureResponse.OriginalApiException; } - var balanceChanges = balanceChangesResult.SuccessResponse.CommittedTransactionOutcomes.Single(); + var balanceChanges = balanceChangesResult.SuccessResponse.CommittedTransactionOutcomes.FirstOrDefault(); + + if (balanceChanges == null) + { + return; + } await _observers.ForEachAsync(x => x.PostHandleOutcomeRequest(transaction.StateVersion, selectedNode.Name)); From 6cdd1f9bc2c829ffc23ee4ed038f63376cd3d65d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Pawelec?= Date: Fri, 19 Jan 2024 11:04:59 +0100 Subject: [PATCH 17/19] add support to delete package code. --- .../LedgerExtension/PackageCodeAggregator.cs | 40 ++++++++++++++----- .../PostgresLedgerExtenderService.cs | 30 +++++++++++++- .../LedgerExtension/WriteHelper.cs | 3 +- ...9095226_SupportProtocolUpdate.Designer.cs} | 6 ++- ...> 20240119095226_SupportProtocolUpdate.cs} | 25 ++++++++++-- .../Migrations/IdempotentApplyMigrations.sql | 25 +++++++----- .../MigrationsDbContextModelSnapshot.cs | 4 ++ .../Models/PackageCodeHistory.cs | 3 ++ .../ScryptoSborUtils.cs | 7 ++++ .../Services/EntityStateQuerier.cs | 8 ++-- 10 files changed, 119 insertions(+), 32 deletions(-) rename src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/{20240118114735_SupportProtocolUpdate.Designer.cs => 20240119095226_SupportProtocolUpdate.Designer.cs} (99%) rename src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/{20240118114735_SupportProtocolUpdate.cs => 20240119095226_SupportProtocolUpdate.cs} (94%) diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageCodeAggregator.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageCodeAggregator.cs index 27e7de942..b61d29e4f 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageCodeAggregator.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageCodeAggregator.cs @@ -66,6 +66,7 @@ using RadixDlt.NetworkGateway.Abstractions.Extensions; using RadixDlt.NetworkGateway.PostgresIntegration.Models; using System.Collections.Generic; +using System.Diagnostics; using CoreModel = RadixDlt.CoreApiSdk.Model; namespace RadixDlt.NetworkGateway.PostgresIntegration.LedgerExtension; @@ -77,6 +78,10 @@ internal record PackageCodeChange(long StateVersion) public CoreModel.PackageCodeOriginalCodeEntrySubstate? PackageCodeOriginalCode { get; set; } public CoreModel.PackageCodeVmTypeEntrySubstate? PackageCodeVmType { get; set; } + + public bool CodeVmTypeIsDeleted { get; set; } + + public bool PackageCodeIsDeleted { get; set; } } internal static class PackageCodeAggregator @@ -144,17 +149,30 @@ public static (List PackageCodeHistoryToAdd, List ProcessTransactions(ReadWriteDbContext db var resourceManagerEntityId = substateId.EntityAddress; var resourceManagerEntity = referencedEntities.Get((EntityAddress)resourceManagerEntityId); - var nonFungibleId = ScryptoSborUtils.GetNonFungibleId((substateId.SubstateKey as CoreModel.MapSubstateKey)!.KeyHex); + var nonFungibleId = ScryptoSborUtils.GetNonFungibleId(((CoreModel.MapSubstateKey)substateId.SubstateKey).KeyHex); nonFungibleIdChanges.Add(new NonFungibleIdChange( resourceManagerEntity, @@ -1144,10 +1144,36 @@ private async Task ProcessTransactions(ReadWriteDbContext db if (substateId.SubstateType == CoreModel.SubstateType.NonFungibleVaultContentsIndexEntry) { var resourceEntity = referencedEntities.GetByDatabaseId(referencedEntity.GetDatabaseEntity().ResourceEntityId); - var simpleRep = ScryptoSborUtils.GetNonFungibleId((substateId.SubstateKey as CoreModel.MapSubstateKey)!.KeyHex); + var simpleRep = ScryptoSborUtils.GetNonFungibleId(((CoreModel.MapSubstateKey)substateId.SubstateKey).KeyHex); vaultSnapshots.Add(new NonFungibleVaultSnapshot(referencedEntity, resourceEntity, simpleRep, true, stateVersion)); } + + if (substateId.SubstateType == CoreModel.SubstateType.PackageCodeVmTypeEntry) + { + var keyHex = ((CoreModel.MapSubstateKey)substateId.SubstateKey).KeyHex; + var code_hash = ScryptoSborUtils.DataToProgrammaticScryptoSborValueBytes(keyHex.ConvertFromHex(), _networkConfigurationProvider.GetNetworkId()); + + packageCodeChanges + .GetOrAdd( + new PackageCodeLookup(referencedEntity.DatabaseId, (ValueBytes)code_hash.Hex.ConvertFromHex()), + _ => new PackageCodeChange(stateVersion) + ) + .CodeVmTypeIsDeleted = true; + } + + if (substateId.SubstateType == CoreModel.SubstateType.PackageCodeOriginalCodeEntry) + { + var keyHex = ((CoreModel.MapSubstateKey)substateId.SubstateKey).KeyHex; + var code_hash = ScryptoSborUtils.DataToProgrammaticScryptoSborValueBytes(keyHex.ConvertFromHex(), _networkConfigurationProvider.GetNetworkId()); + + packageCodeChanges + .GetOrAdd( + new PackageCodeLookup(referencedEntity.DatabaseId, (ValueBytes)code_hash.Hex.ConvertFromHex()), + _ => new PackageCodeChange(stateVersion) + ) + .PackageCodeIsDeleted = true; + } } var transaction = ledgerTransactionsToAdd.Single(x => x.StateVersion == stateVersion); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/WriteHelper.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/WriteHelper.cs index 31d93da39..63086801f 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/WriteHelper.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/WriteHelper.cs @@ -1123,7 +1123,7 @@ public async Task CopyPackageCodeHistory(ICollection en var sw = Stopwatch.GetTimestamp(); - await using var writer = await _connection.BeginBinaryImportAsync("COPY package_code_history (id, from_state_version, package_entity_id, code_hash, code, vm_type) FROM STDIN (FORMAT BINARY)", token); + await using var writer = await _connection.BeginBinaryImportAsync("COPY package_code_history (id, from_state_version, package_entity_id, code_hash, code, vm_type, is_deleted) FROM STDIN (FORMAT BINARY)", token); foreach (var e in entities) { @@ -1134,6 +1134,7 @@ public async Task CopyPackageCodeHistory(ICollection en await writer.WriteAsync(e.CodeHash, NpgsqlDbType.Bytea, token); await writer.WriteAsync(e.Code, NpgsqlDbType.Bytea, token); await writer.WriteAsync(e.VmType, "package_vm_type", token); + await writer.WriteAsync(e.IsDeleted, NpgsqlDbType.Boolean, token); } await writer.CompleteAsync(token); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240118114735_SupportProtocolUpdate.Designer.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240119095226_SupportProtocolUpdate.Designer.cs similarity index 99% rename from src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240118114735_SupportProtocolUpdate.Designer.cs rename to src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240119095226_SupportProtocolUpdate.Designer.cs index 6e63427ad..86f49c952 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240118114735_SupportProtocolUpdate.Designer.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240119095226_SupportProtocolUpdate.Designer.cs @@ -81,7 +81,7 @@ namespace RadixDlt.NetworkGateway.PostgresIntegration.Migrations { [DbContext(typeof(MigrationsDbContext))] - [Migration("20240118114735_SupportProtocolUpdate")] + [Migration("20240119095226_SupportProtocolUpdate")] partial class SupportProtocolUpdate { /// @@ -1259,6 +1259,10 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("bigint") .HasColumnName("from_state_version"); + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted"); + b.Property("PackageEntityId") .HasColumnType("bigint") .HasColumnName("package_entity_id"); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240118114735_SupportProtocolUpdate.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240119095226_SupportProtocolUpdate.cs similarity index 94% rename from src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240118114735_SupportProtocolUpdate.cs rename to src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240119095226_SupportProtocolUpdate.cs index 1376ed9ca..a0cd37ab0 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240118114735_SupportProtocolUpdate.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240119095226_SupportProtocolUpdate.cs @@ -90,6 +90,13 @@ protected override void Up(MigrationBuilder migrationBuilder) nullable: false, defaultValue: PackageVmType.Native); + migrationBuilder.AddColumn( + name: "is_deleted", + table: "package_code_history", + type: "boolean", + nullable: false, + defaultValue: false); + migrationBuilder.Sql("update package_code_history pch set vm_type = (select vm_type from entities e where e.id = pch.package_entity_id)"); migrationBuilder.AlterColumn( @@ -98,6 +105,12 @@ protected override void Up(MigrationBuilder migrationBuilder) oldDefaultValue: PackageVmType.Native, defaultValue: null); + migrationBuilder.AlterColumn( + name: "is_deleted", + table: "package_code_history", + oldDefaultValue: false, + defaultValue: null); + migrationBuilder.DropColumn( name: "vm_type", table: "entities"); @@ -166,19 +179,23 @@ protected override void Down(MigrationBuilder migrationBuilder) migrationBuilder.DropTable( name: "package_code_aggregate_history"); + migrationBuilder.DropColumn( + name: "is_deleted", + table: "package_code_history"); + migrationBuilder.DropColumn( name: "vm_type", table: "package_code_history"); + migrationBuilder.AlterDatabase() + .Annotation("Npgsql:Enum:ledger_transaction_type", "genesis,user,round_update") + .OldAnnotation("Npgsql:Enum:ledger_transaction_type", "genesis,user,round_update,flash"); + migrationBuilder.AddColumn( name: "vm_type", table: "entities", type: "package_vm_type", nullable: true); - - migrationBuilder.AlterDatabase() - .Annotation("Npgsql:Enum:ledger_transaction_type", "genesis,user,round_update") - .OldAnnotation("Npgsql:Enum:ledger_transaction_type", "genesis,user,round_update,flash"); } } } diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql index fd4cd0bde..b69e5d09c 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql @@ -1099,28 +1099,35 @@ START TRANSACTION; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240118114735_SupportProtocolUpdate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240119095226_SupportProtocolUpdate') THEN ALTER TABLE entities DROP COLUMN vm_type; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240118114735_SupportProtocolUpdate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240119095226_SupportProtocolUpdate') THEN ALTER TYPE ledger_transaction_type ADD VALUE 'flash'; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240118114735_SupportProtocolUpdate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240119095226_SupportProtocolUpdate') THEN + ALTER TABLE package_code_history ADD is_deleted boolean NOT NULL DEFAULT FALSE; + END IF; +END $EF$; + +DO $EF$ +BEGIN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240119095226_SupportProtocolUpdate') THEN ALTER TABLE package_code_history ADD vm_type package_vm_type NOT NULL DEFAULT 'native'::package_vm_type; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240118114735_SupportProtocolUpdate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240119095226_SupportProtocolUpdate') THEN CREATE TABLE package_blueprint_aggregate_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -1133,7 +1140,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240118114735_SupportProtocolUpdate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240119095226_SupportProtocolUpdate') THEN CREATE TABLE package_code_aggregate_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -1146,23 +1153,23 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240118114735_SupportProtocolUpdate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240119095226_SupportProtocolUpdate') THEN CREATE INDEX "IX_package_blueprint_aggregate_history_package_entity_id_from_~" ON package_blueprint_aggregate_history (package_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240118114735_SupportProtocolUpdate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240119095226_SupportProtocolUpdate') THEN CREATE INDEX "IX_package_code_aggregate_history_package_entity_id_from_state~" ON package_code_aggregate_history (package_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240118114735_SupportProtocolUpdate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240119095226_SupportProtocolUpdate') THEN INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") - VALUES ('20240118114735_SupportProtocolUpdate', '7.0.11'); + VALUES ('20240119095226_SupportProtocolUpdate', '7.0.11'); END IF; END $EF$; COMMIT; diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs index 17d3b3522..ac091e190 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs @@ -1256,6 +1256,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("bigint") .HasColumnName("from_state_version"); + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted"); + b.Property("PackageEntityId") .HasColumnType("bigint") .HasColumnName("package_entity_id"); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/PackageCodeHistory.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/PackageCodeHistory.cs index d02551d8c..9e448a8ef 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/PackageCodeHistory.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/PackageCodeHistory.cs @@ -89,4 +89,7 @@ internal class PackageCodeHistory [Column("vm_type")] public PackageVmType VmType { get; set; } + + [Column("is_deleted")] + public bool IsDeleted { get; set; } } diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/ScryptoSborUtils.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/ScryptoSborUtils.cs index c1394662a..6aa42f201 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/ScryptoSborUtils.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/ScryptoSborUtils.cs @@ -109,6 +109,13 @@ public static GatewayModel.ProgrammaticScryptoSborValue DataToProgrammaticJson(b return JsonConvert.DeserializeObject(json) ?? throw new ArgumentException("Invalid input Scrypto SBOR"); } + public static GatewayModel.ProgrammaticScryptoSborValueBytes DataToProgrammaticScryptoSborValueBytes(byte[] rawScryptoSbor, byte networkId) + { + var json = ToolkitModel.RadixEngineToolkitUniffiMethods.ScryptoSborDecodeToStringRepresentation(rawScryptoSbor, ToolkitModel.SerializationMode.PROGRAMMATIC, networkId, null); + + return JsonConvert.DeserializeObject(json) ?? throw new ArgumentException("Invalid input Scrypto SBOR"); + } + public static GatewayModel.MetadataTypedValue DecodeToGatewayMetadataItemValue(byte[] rawScryptoSbor, byte networkId) { using var metadataValue = ToolkitModel.RadixEngineToolkitUniffiMethods.MetadataSborDecode(rawScryptoSbor, networkId); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntityStateQuerier.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntityStateQuerier.cs index 1589a6f64..9f2dfb054 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntityStateQuerier.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntityStateQuerier.cs @@ -238,10 +238,10 @@ public EntityStateQuerier( if (packageCodeHistory.TryGetValue(pe.Id, out var packageCodes)) { codeItems.AddRange(packageCodes.Select(pb => new GatewayModel.PackageCodeCollectionItem( - vmType: pb.VmType.ToGatewayModel(), - codeHashHex: pb.CodeHash.ToHex(), - codeHex: pb.Code.ToHex() - ))); + vmType: pb.VmType.ToGatewayModel(), + codeHashHex: pb.CodeHash.ToHex(), + codeHex: pb.Code.ToHex() + ))); } if (packageSchemaHistory.TryGetValue(pe.Id, out var packageSchemas)) From 7fe21d4ad21a337857f3169200e5e1de1131be49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Pawelec?= Date: Mon, 22 Jan 2024 17:33:24 +0100 Subject: [PATCH 18/19] update core api to newest schema. fix removing code for package. --- .../core-api-spec-copy.yaml | 46 ++++--- .../generated/Model/FlashLedgerTransaction.cs | 30 ++--- .../Model/FlashLedgerTransactionAllOf.cs | 30 ++--- ...lashTransaction.cs => FlashSetSubstate.cs} | 76 +++++++---- ...shedSubstate.cs => FlashedStateUpdates.cs} | 127 ++++++++---------- .../LedgerExtension/PackageCodeAggregator.cs | 41 +++--- 6 files changed, 180 insertions(+), 170 deletions(-) rename src/RadixDlt.CoreApiSdk/generated/Model/{FlashTransaction.cs => FlashSetSubstate.cs} (76%) rename src/RadixDlt.CoreApiSdk/generated/Model/{FlashedSubstate.cs => FlashedStateUpdates.cs} (66%) diff --git a/src/RadixDlt.CoreApiSdk/core-api-spec-copy.yaml b/src/RadixDlt.CoreApiSdk/core-api-spec-copy.yaml index 1fc4050f7..8249c9cb8 100644 --- a/src/RadixDlt.CoreApiSdk/core-api-spec-copy.yaml +++ b/src/RadixDlt.CoreApiSdk/core-api-spec-copy.yaml @@ -7413,10 +7413,10 @@ components: - $ref: "#/components/schemas/LedgerTransaction" - type: object required: - - flash_transaction + - flashed_state_updates properties: - flash_transaction: - $ref: "#/components/schemas/FlashTransaction" + flashed_state_updates: + $ref: "#/components/schemas/FlashedStateUpdates" RoundUpdateTransaction: type: object required: @@ -7444,35 +7444,37 @@ components: leader_proposal_history: $ref: '#/components/schemas/LeaderProposalHistory' description: A recent history (i.e. since the previous `RoundUpdateValidatorTransaction`) of consensus round leaders' reliability. Used for validator emissions calculation. - FlashTransaction: + FlashedStateUpdates: type: object + description: Direct state updates performed by a Flash Transaction. required: - - flashed_substates + - deleted_partitions + - set_substates + - deleted_substates properties: - flashed_substates: + deleted_partitions: + type: array + items: + $ref: "#/components/schemas/PartitionId" + set_substates: type: array items: - $ref: "#/components/schemas/FlashedSubstate" - FlashedSubstate: + $ref: "#/components/schemas/FlashSetSubstate" + deleted_substates: + type: array + items: + $ref: "#/components/schemas/SubstateId" + FlashSetSubstate: type: object required: - - entity_address - - partition_number - - substate_key + - substate_id - value properties: - entity_address: - $ref: "#/components/schemas/EntityAddress" - partition_number: - type: integer - format: int32 - minimum: 0 - maximum: 255 - substate_key: - $ref: "#/components/schemas/SubstateKey" + substate_id: + $ref: "#/components/schemas/SubstateId" value: - type: string - description: The hex-encoded, SBOR-encoded substate data bytes. + $ref: "#/components/schemas/SubstateValue" + description: The new value set on the substate. LeaderProposalHistory: type: object required: diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/FlashLedgerTransaction.cs b/src/RadixDlt.CoreApiSdk/generated/Model/FlashLedgerTransaction.cs index c4aa21ded..61c9a9639 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/FlashLedgerTransaction.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/FlashLedgerTransaction.cs @@ -109,24 +109,24 @@ protected FlashLedgerTransaction() { } /// /// Initializes a new instance of the class. /// - /// flashTransaction (required). + /// flashedStateUpdates (required). /// type (required) (default to LedgerTransactionType.Flash). /// The hex-encoded full ledger transaction payload. Only returned if enabled in TransactionFormatOptions on your request.. - public FlashLedgerTransaction(FlashTransaction flashTransaction = default(FlashTransaction), LedgerTransactionType type = LedgerTransactionType.Flash, string payloadHex = default(string)) : base(type, payloadHex) + public FlashLedgerTransaction(FlashedStateUpdates flashedStateUpdates = default(FlashedStateUpdates), LedgerTransactionType type = LedgerTransactionType.Flash, string payloadHex = default(string)) : base(type, payloadHex) { - // to ensure "flashTransaction" is required (not null) - if (flashTransaction == null) + // to ensure "flashedStateUpdates" is required (not null) + if (flashedStateUpdates == null) { - throw new ArgumentNullException("flashTransaction is a required property for FlashLedgerTransaction and cannot be null"); + throw new ArgumentNullException("flashedStateUpdates is a required property for FlashLedgerTransaction and cannot be null"); } - this.FlashTransaction = flashTransaction; + this.FlashedStateUpdates = flashedStateUpdates; } /// - /// Gets or Sets FlashTransaction + /// Gets or Sets FlashedStateUpdates /// - [DataMember(Name = "flash_transaction", IsRequired = true, EmitDefaultValue = true)] - public FlashTransaction FlashTransaction { get; set; } + [DataMember(Name = "flashed_state_updates", IsRequired = true, EmitDefaultValue = true)] + public FlashedStateUpdates FlashedStateUpdates { get; set; } /// /// Returns the string presentation of the object @@ -137,7 +137,7 @@ public override string ToString() StringBuilder sb = new StringBuilder(); sb.Append("class FlashLedgerTransaction {\n"); sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); - sb.Append(" FlashTransaction: ").Append(FlashTransaction).Append("\n"); + sb.Append(" FlashedStateUpdates: ").Append(FlashedStateUpdates).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -174,9 +174,9 @@ public bool Equals(FlashLedgerTransaction input) } return base.Equals(input) && ( - this.FlashTransaction == input.FlashTransaction || - (this.FlashTransaction != null && - this.FlashTransaction.Equals(input.FlashTransaction)) + this.FlashedStateUpdates == input.FlashedStateUpdates || + (this.FlashedStateUpdates != null && + this.FlashedStateUpdates.Equals(input.FlashedStateUpdates)) ); } @@ -189,9 +189,9 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = base.GetHashCode(); - if (this.FlashTransaction != null) + if (this.FlashedStateUpdates != null) { - hashCode = (hashCode * 59) + this.FlashTransaction.GetHashCode(); + hashCode = (hashCode * 59) + this.FlashedStateUpdates.GetHashCode(); } return hashCode; } diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/FlashLedgerTransactionAllOf.cs b/src/RadixDlt.CoreApiSdk/generated/Model/FlashLedgerTransactionAllOf.cs index 44be04391..d6a828da7 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/FlashLedgerTransactionAllOf.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/FlashLedgerTransactionAllOf.cs @@ -103,22 +103,22 @@ protected FlashLedgerTransactionAllOf() { } /// /// Initializes a new instance of the class. /// - /// flashTransaction (required). - public FlashLedgerTransactionAllOf(FlashTransaction flashTransaction = default(FlashTransaction)) + /// flashedStateUpdates (required). + public FlashLedgerTransactionAllOf(FlashedStateUpdates flashedStateUpdates = default(FlashedStateUpdates)) { - // to ensure "flashTransaction" is required (not null) - if (flashTransaction == null) + // to ensure "flashedStateUpdates" is required (not null) + if (flashedStateUpdates == null) { - throw new ArgumentNullException("flashTransaction is a required property for FlashLedgerTransactionAllOf and cannot be null"); + throw new ArgumentNullException("flashedStateUpdates is a required property for FlashLedgerTransactionAllOf and cannot be null"); } - this.FlashTransaction = flashTransaction; + this.FlashedStateUpdates = flashedStateUpdates; } /// - /// Gets or Sets FlashTransaction + /// Gets or Sets FlashedStateUpdates /// - [DataMember(Name = "flash_transaction", IsRequired = true, EmitDefaultValue = true)] - public FlashTransaction FlashTransaction { get; set; } + [DataMember(Name = "flashed_state_updates", IsRequired = true, EmitDefaultValue = true)] + public FlashedStateUpdates FlashedStateUpdates { get; set; } /// /// Returns the string presentation of the object @@ -128,7 +128,7 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class FlashLedgerTransactionAllOf {\n"); - sb.Append(" FlashTransaction: ").Append(FlashTransaction).Append("\n"); + sb.Append(" FlashedStateUpdates: ").Append(FlashedStateUpdates).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -165,9 +165,9 @@ public bool Equals(FlashLedgerTransactionAllOf input) } return ( - this.FlashTransaction == input.FlashTransaction || - (this.FlashTransaction != null && - this.FlashTransaction.Equals(input.FlashTransaction)) + this.FlashedStateUpdates == input.FlashedStateUpdates || + (this.FlashedStateUpdates != null && + this.FlashedStateUpdates.Equals(input.FlashedStateUpdates)) ); } @@ -180,9 +180,9 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = 41; - if (this.FlashTransaction != null) + if (this.FlashedStateUpdates != null) { - hashCode = (hashCode * 59) + this.FlashTransaction.GetHashCode(); + hashCode = (hashCode * 59) + this.FlashedStateUpdates.GetHashCode(); } return hashCode; } diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/FlashTransaction.cs b/src/RadixDlt.CoreApiSdk/generated/Model/FlashSetSubstate.cs similarity index 76% rename from src/RadixDlt.CoreApiSdk/generated/Model/FlashTransaction.cs rename to src/RadixDlt.CoreApiSdk/generated/Model/FlashSetSubstate.cs index ce01c0707..4cd342210 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/FlashTransaction.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/FlashSetSubstate.cs @@ -90,35 +90,48 @@ namespace RadixDlt.CoreApiSdk.Model { /// - /// FlashTransaction + /// FlashSetSubstate /// - [DataContract(Name = "FlashTransaction")] - public partial class FlashTransaction : IEquatable + [DataContract(Name = "FlashSetSubstate")] + public partial class FlashSetSubstate : IEquatable { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected FlashTransaction() { } + protected FlashSetSubstate() { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// flashedSubstates (required). - public FlashTransaction(List flashedSubstates = default(List)) + /// substateId (required). + /// value (required). + public FlashSetSubstate(SubstateId substateId = default(SubstateId), SubstateValue value = default(SubstateValue)) { - // to ensure "flashedSubstates" is required (not null) - if (flashedSubstates == null) + // to ensure "substateId" is required (not null) + if (substateId == null) { - throw new ArgumentNullException("flashedSubstates is a required property for FlashTransaction and cannot be null"); + throw new ArgumentNullException("substateId is a required property for FlashSetSubstate and cannot be null"); } - this.FlashedSubstates = flashedSubstates; + this.SubstateId = substateId; + // to ensure "value" is required (not null) + if (value == null) + { + throw new ArgumentNullException("value is a required property for FlashSetSubstate and cannot be null"); + } + this.Value = value; } /// - /// Gets or Sets FlashedSubstates + /// Gets or Sets SubstateId + /// + [DataMember(Name = "substate_id", IsRequired = true, EmitDefaultValue = true)] + public SubstateId SubstateId { get; set; } + + /// + /// Gets or Sets Value /// - [DataMember(Name = "flashed_substates", IsRequired = true, EmitDefaultValue = true)] - public List FlashedSubstates { get; set; } + [DataMember(Name = "value", IsRequired = true, EmitDefaultValue = true)] + public SubstateValue Value { get; set; } /// /// Returns the string presentation of the object @@ -127,8 +140,9 @@ protected FlashTransaction() { } public override string ToString() { StringBuilder sb = new StringBuilder(); - sb.Append("class FlashTransaction {\n"); - sb.Append(" FlashedSubstates: ").Append(FlashedSubstates).Append("\n"); + sb.Append("class FlashSetSubstate {\n"); + sb.Append(" SubstateId: ").Append(SubstateId).Append("\n"); + sb.Append(" Value: ").Append(Value).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -149,15 +163,15 @@ public virtual string ToJson() /// Boolean public override bool Equals(object input) { - return this.Equals(input as FlashTransaction); + return this.Equals(input as FlashSetSubstate); } /// - /// Returns true if FlashTransaction instances are equal + /// Returns true if FlashSetSubstate instances are equal /// - /// Instance of FlashTransaction to be compared + /// Instance of FlashSetSubstate to be compared /// Boolean - public bool Equals(FlashTransaction input) + public bool Equals(FlashSetSubstate input) { if (input == null) { @@ -165,10 +179,14 @@ public bool Equals(FlashTransaction input) } return ( - this.FlashedSubstates == input.FlashedSubstates || - this.FlashedSubstates != null && - input.FlashedSubstates != null && - this.FlashedSubstates.SequenceEqual(input.FlashedSubstates) + this.SubstateId == input.SubstateId || + (this.SubstateId != null && + this.SubstateId.Equals(input.SubstateId)) + ) && + ( + this.Value == input.Value || + (this.Value != null && + this.Value.Equals(input.Value)) ); } @@ -181,9 +199,13 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = 41; - if (this.FlashedSubstates != null) + if (this.SubstateId != null) + { + hashCode = (hashCode * 59) + this.SubstateId.GetHashCode(); + } + if (this.Value != null) { - hashCode = (hashCode * 59) + this.FlashedSubstates.GetHashCode(); + hashCode = (hashCode * 59) + this.Value.GetHashCode(); } return hashCode; } diff --git a/src/RadixDlt.CoreApiSdk/generated/Model/FlashedSubstate.cs b/src/RadixDlt.CoreApiSdk/generated/Model/FlashedStateUpdates.cs similarity index 66% rename from src/RadixDlt.CoreApiSdk/generated/Model/FlashedSubstate.cs rename to src/RadixDlt.CoreApiSdk/generated/Model/FlashedStateUpdates.cs index c82627abc..1232e796b 100644 --- a/src/RadixDlt.CoreApiSdk/generated/Model/FlashedSubstate.cs +++ b/src/RadixDlt.CoreApiSdk/generated/Model/FlashedStateUpdates.cs @@ -90,71 +90,61 @@ namespace RadixDlt.CoreApiSdk.Model { /// - /// FlashedSubstate + /// Direct state updates performed by a Flash Transaction. /// - [DataContract(Name = "FlashedSubstate")] - public partial class FlashedSubstate : IEquatable + [DataContract(Name = "FlashedStateUpdates")] + public partial class FlashedStateUpdates : IEquatable { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected FlashedSubstate() { } + protected FlashedStateUpdates() { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// Bech32m-encoded human readable version of the entity's address (ie the entity's node id) (required). - /// partitionNumber (required). - /// substateKey (required). - /// The hex-encoded, SBOR-encoded substate data bytes. (required). - public FlashedSubstate(string entityAddress = default(string), int partitionNumber = default(int), SubstateKey substateKey = default(SubstateKey), string value = default(string)) + /// deletedPartitions (required). + /// setSubstates (required). + /// deletedSubstates (required). + public FlashedStateUpdates(List deletedPartitions = default(List), List setSubstates = default(List), List deletedSubstates = default(List)) { - // to ensure "entityAddress" is required (not null) - if (entityAddress == null) + // to ensure "deletedPartitions" is required (not null) + if (deletedPartitions == null) { - throw new ArgumentNullException("entityAddress is a required property for FlashedSubstate and cannot be null"); + throw new ArgumentNullException("deletedPartitions is a required property for FlashedStateUpdates and cannot be null"); } - this.EntityAddress = entityAddress; - this.PartitionNumber = partitionNumber; - // to ensure "substateKey" is required (not null) - if (substateKey == null) + this.DeletedPartitions = deletedPartitions; + // to ensure "setSubstates" is required (not null) + if (setSubstates == null) { - throw new ArgumentNullException("substateKey is a required property for FlashedSubstate and cannot be null"); + throw new ArgumentNullException("setSubstates is a required property for FlashedStateUpdates and cannot be null"); } - this.SubstateKey = substateKey; - // to ensure "value" is required (not null) - if (value == null) + this.SetSubstates = setSubstates; + // to ensure "deletedSubstates" is required (not null) + if (deletedSubstates == null) { - throw new ArgumentNullException("value is a required property for FlashedSubstate and cannot be null"); + throw new ArgumentNullException("deletedSubstates is a required property for FlashedStateUpdates and cannot be null"); } - this.Value = value; + this.DeletedSubstates = deletedSubstates; } /// - /// Bech32m-encoded human readable version of the entity's address (ie the entity's node id) + /// Gets or Sets DeletedPartitions /// - /// Bech32m-encoded human readable version of the entity's address (ie the entity's node id) - [DataMember(Name = "entity_address", IsRequired = true, EmitDefaultValue = true)] - public string EntityAddress { get; set; } + [DataMember(Name = "deleted_partitions", IsRequired = true, EmitDefaultValue = true)] + public List DeletedPartitions { get; set; } /// - /// Gets or Sets PartitionNumber + /// Gets or Sets SetSubstates /// - [DataMember(Name = "partition_number", IsRequired = true, EmitDefaultValue = true)] - public int PartitionNumber { get; set; } + [DataMember(Name = "set_substates", IsRequired = true, EmitDefaultValue = true)] + public List SetSubstates { get; set; } /// - /// Gets or Sets SubstateKey + /// Gets or Sets DeletedSubstates /// - [DataMember(Name = "substate_key", IsRequired = true, EmitDefaultValue = true)] - public SubstateKey SubstateKey { get; set; } - - /// - /// The hex-encoded, SBOR-encoded substate data bytes. - /// - /// The hex-encoded, SBOR-encoded substate data bytes. - [DataMember(Name = "value", IsRequired = true, EmitDefaultValue = true)] - public string Value { get; set; } + [DataMember(Name = "deleted_substates", IsRequired = true, EmitDefaultValue = true)] + public List DeletedSubstates { get; set; } /// /// Returns the string presentation of the object @@ -163,11 +153,10 @@ protected FlashedSubstate() { } public override string ToString() { StringBuilder sb = new StringBuilder(); - sb.Append("class FlashedSubstate {\n"); - sb.Append(" EntityAddress: ").Append(EntityAddress).Append("\n"); - sb.Append(" PartitionNumber: ").Append(PartitionNumber).Append("\n"); - sb.Append(" SubstateKey: ").Append(SubstateKey).Append("\n"); - sb.Append(" Value: ").Append(Value).Append("\n"); + sb.Append("class FlashedStateUpdates {\n"); + sb.Append(" DeletedPartitions: ").Append(DeletedPartitions).Append("\n"); + sb.Append(" SetSubstates: ").Append(SetSubstates).Append("\n"); + sb.Append(" DeletedSubstates: ").Append(DeletedSubstates).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -188,15 +177,15 @@ public virtual string ToJson() /// Boolean public override bool Equals(object input) { - return this.Equals(input as FlashedSubstate); + return this.Equals(input as FlashedStateUpdates); } /// - /// Returns true if FlashedSubstate instances are equal + /// Returns true if FlashedStateUpdates instances are equal /// - /// Instance of FlashedSubstate to be compared + /// Instance of FlashedStateUpdates to be compared /// Boolean - public bool Equals(FlashedSubstate input) + public bool Equals(FlashedStateUpdates input) { if (input == null) { @@ -204,23 +193,22 @@ public bool Equals(FlashedSubstate input) } return ( - this.EntityAddress == input.EntityAddress || - (this.EntityAddress != null && - this.EntityAddress.Equals(input.EntityAddress)) - ) && - ( - this.PartitionNumber == input.PartitionNumber || - this.PartitionNumber.Equals(input.PartitionNumber) + this.DeletedPartitions == input.DeletedPartitions || + this.DeletedPartitions != null && + input.DeletedPartitions != null && + this.DeletedPartitions.SequenceEqual(input.DeletedPartitions) ) && ( - this.SubstateKey == input.SubstateKey || - (this.SubstateKey != null && - this.SubstateKey.Equals(input.SubstateKey)) + this.SetSubstates == input.SetSubstates || + this.SetSubstates != null && + input.SetSubstates != null && + this.SetSubstates.SequenceEqual(input.SetSubstates) ) && ( - this.Value == input.Value || - (this.Value != null && - this.Value.Equals(input.Value)) + this.DeletedSubstates == input.DeletedSubstates || + this.DeletedSubstates != null && + input.DeletedSubstates != null && + this.DeletedSubstates.SequenceEqual(input.DeletedSubstates) ); } @@ -233,18 +221,17 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = 41; - if (this.EntityAddress != null) + if (this.DeletedPartitions != null) { - hashCode = (hashCode * 59) + this.EntityAddress.GetHashCode(); + hashCode = (hashCode * 59) + this.DeletedPartitions.GetHashCode(); } - hashCode = (hashCode * 59) + this.PartitionNumber.GetHashCode(); - if (this.SubstateKey != null) + if (this.SetSubstates != null) { - hashCode = (hashCode * 59) + this.SubstateKey.GetHashCode(); + hashCode = (hashCode * 59) + this.SetSubstates.GetHashCode(); } - if (this.Value != null) + if (this.DeletedSubstates != null) { - hashCode = (hashCode * 59) + this.Value.GetHashCode(); + hashCode = (hashCode * 59) + this.DeletedSubstates.GetHashCode(); } return hashCode; } diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageCodeAggregator.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageCodeAggregator.cs index b61d29e4f..ae75f1080 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageCodeAggregator.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PackageCodeAggregator.cs @@ -135,7 +135,6 @@ public static (List PackageCodeHistoryToAdd, List PackageCodeHistoryToAdd, List Date: Tue, 23 Jan 2024 13:24:54 +0100 Subject: [PATCH 19/19] update networks config --- sdk/typescript/lib/helpers/networks.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sdk/typescript/lib/helpers/networks.ts b/sdk/typescript/lib/helpers/networks.ts index 2d04a3079..47a3a5b87 100644 --- a/sdk/typescript/lib/helpers/networks.ts +++ b/sdk/typescript/lib/helpers/networks.ts @@ -50,6 +50,12 @@ export const RadixNetworkConfig: Record = { gatewayUrl: 'https://rcnet.radixdlt.com', dashboardUrl: 'https://rcnet-dashboard.radixdlt.com', }, + Mardunet: { + networkName: 'Mardunet', + networkId: RadixNetwork.Mardunet, + gatewayUrl: 'https://mardunet-gateway.radixdlt.com', + dashboardUrl: 'https://mardunet-dashboard.rdx-works-main.extratools.works', + }, Zabanet: { networkName: 'Zabanet', networkId: RadixNetwork.Zabanet, @@ -66,7 +72,7 @@ export const RadixNetworkConfig: Record = { networkName: 'Gilganet', networkId: RadixNetwork.Gilganet, gatewayUrl: 'https://gilganet-gateway.radixdlt.com', - dashboardUrl: '', + dashboardUrl: 'https://gilganet-dashboard.rdx-works-main.extratools.works', }, Enkinet: { networkName: 'Enkinet',