diff --git a/app/export.go b/app/export.go index c1361e1d..db240d2b 100644 --- a/app/export.go +++ b/app/export.go @@ -1,7 +1,7 @@ package app import ( -"encoding/json" + "encoding/json" "fmt" "log" diff --git a/app/simulation_test.go b/app/simulation_test.go index 91c38d3e..9d0e5304 100644 --- a/app/simulation_test.go +++ b/app/simulation_test.go @@ -39,7 +39,6 @@ import ( "github.com/mycel-domain/mycel/app" ) - type storeKeysPrefixes struct { A storetypes.StoreKey B storetypes.StoreKey diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index f9337440..e70979f5 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -49967,110 +49967,30 @@ paths: type: string tags: - Query - /mycel/registry/domain: + /mycel-domain/mycel/registry/top_level_domain: get: - operationId: MycelRegistryDomainAll + operationId: MycelRegistryTopLevelDomainAll responses: '200': description: A successful response. schema: type: object properties: - domain: + topLevelDomain: type: array items: type: object properties: name: type: string - parent: - type: string - owner: - type: string expirationDate: type: string format: int64 - dnsRecords: - type: object - additionalProperties: - type: object - properties: - dnsRecordType: - type: string - enum: - - A - - AAAA - - CNAME - - NS - - MX - - PTR - - SOA - - SRV - - TXT - default: A - value: - type: string - walletRecords: - type: object - additionalProperties: - type: object - properties: - walletRecordType: - type: string - enum: - - BITCOIN_MAINNET_MAINNET - - BITCOIN_TESTNET_TESTNET - - ETHEREUM_MAINNET_MAINNET - - ETHEREUM_TESTNET_GOERLI - - ETHEREUM_TESTNET_SEPOLIA - - POLYGON_MAINNET_MAINNET - - POLYGON_TESTNET_MUMBAI - - BNB_MAINNET_MAINNET - - BNB_TESTNET_TESTNET - - AVALANCHE_MAINNET_CCHAIN - - AVALANCHE_TESTNET_FUJI - - GNOSIS_MAINNET_MAINNET - - GNOSIS_TESTNET_CHIADO - - OPTIMISM_MAINNET_MAINNET - - OPTIMISM_TESTNET_GOERLI - - ARBITRUM_MAINNET_MAINNET - - ARBITRUM_TESTNET_GOERLI - - SHARDEUM_BETANET_SPHINX - - ZETA_TESTNET_ATHENS - - APTOS_MAINNET_MAINNET - - APTOS_TESTNET_TESTNET - - SUI_MAINNET_MAINNET - - SUI_TESTNET_TESTNET - - SOLANA_MAINNET_MAINNET - - SOLANA_TESTNET_TESTNET - default: BITCOIN_MAINNET_MAINNET - description: |- - - BITCOIN_MAINNET_MAINNET: BTC 0xxx - - ETHEREUM_MAINNET_MAINNET: EVM 1xxxx - Etheruem - - POLYGON_MAINNET_MAINNET: Polygon - - BNB_MAINNET_MAINNET: BNB Chain - - AVALANCHE_MAINNET_CCHAIN: Avalanche - - GNOSIS_MAINNET_MAINNET: Gnosis - - OPTIMISM_MAINNET_MAINNET: Optimism - - ARBITRUM_MAINNET_MAINNET: Arbitrum - - SHARDEUM_BETANET_SPHINX: Shardeum - SHARDEUM_MAINNET_ = 10015; - SHARDEUM_TESTNET_ = 10016; - - ZETA_TESTNET_ATHENS: Zetachain - ZETA_MAINNET_MAINNET = 10018; - - APTOS_MAINNET_MAINNET: MOVE 2xxxx - Aptos - - SUI_MAINNET_MAINNET: Sui - - SOLANA_MAINNET_MAINNET: SOLANA 3xxxx - title: 'Rule: CHAINNAME_ENVIROMENT_NETWORK' - value: - type: string metadata: type: object additionalProperties: type: string - subdomainRegistrationConfig: + subdomainConfig: type: object properties: maxSubdomainRegistrations: @@ -50144,6 +50064,13 @@ paths: subdomainCount: type: string format: uint64 + accessControl: + type: object + additionalProperties: + type: object + properties: + owner: + type: string pagination: type: object properties: @@ -50249,109 +50176,29 @@ paths: type: boolean tags: - Query - /mycel/registry/domain/{name}/{parent}: + /mycel-domain/mycel/registry/top_level_domain/{name}: get: - summary: Queries a list of Domain items. - operationId: MycelRegistryDomain + summary: Queries a list of TopLevelDomain items. + operationId: MycelRegistryTopLevelDomain responses: '200': description: A successful response. schema: type: object properties: - domain: + topLevelDomain: type: object properties: name: type: string - parent: - type: string - owner: - type: string expirationDate: type: string format: int64 - dnsRecords: - type: object - additionalProperties: - type: object - properties: - dnsRecordType: - type: string - enum: - - A - - AAAA - - CNAME - - NS - - MX - - PTR - - SOA - - SRV - - TXT - default: A - value: - type: string - walletRecords: - type: object - additionalProperties: - type: object - properties: - walletRecordType: - type: string - enum: - - BITCOIN_MAINNET_MAINNET - - BITCOIN_TESTNET_TESTNET - - ETHEREUM_MAINNET_MAINNET - - ETHEREUM_TESTNET_GOERLI - - ETHEREUM_TESTNET_SEPOLIA - - POLYGON_MAINNET_MAINNET - - POLYGON_TESTNET_MUMBAI - - BNB_MAINNET_MAINNET - - BNB_TESTNET_TESTNET - - AVALANCHE_MAINNET_CCHAIN - - AVALANCHE_TESTNET_FUJI - - GNOSIS_MAINNET_MAINNET - - GNOSIS_TESTNET_CHIADO - - OPTIMISM_MAINNET_MAINNET - - OPTIMISM_TESTNET_GOERLI - - ARBITRUM_MAINNET_MAINNET - - ARBITRUM_TESTNET_GOERLI - - SHARDEUM_BETANET_SPHINX - - ZETA_TESTNET_ATHENS - - APTOS_MAINNET_MAINNET - - APTOS_TESTNET_TESTNET - - SUI_MAINNET_MAINNET - - SUI_TESTNET_TESTNET - - SOLANA_MAINNET_MAINNET - - SOLANA_TESTNET_TESTNET - default: BITCOIN_MAINNET_MAINNET - description: |- - - BITCOIN_MAINNET_MAINNET: BTC 0xxx - - ETHEREUM_MAINNET_MAINNET: EVM 1xxxx - Etheruem - - POLYGON_MAINNET_MAINNET: Polygon - - BNB_MAINNET_MAINNET: BNB Chain - - AVALANCHE_MAINNET_CCHAIN: Avalanche - - GNOSIS_MAINNET_MAINNET: Gnosis - - OPTIMISM_MAINNET_MAINNET: Optimism - - ARBITRUM_MAINNET_MAINNET: Arbitrum - - SHARDEUM_BETANET_SPHINX: Shardeum - SHARDEUM_MAINNET_ = 10015; - SHARDEUM_TESTNET_ = 10016; - - ZETA_TESTNET_ATHENS: Zetachain - ZETA_MAINNET_MAINNET = 10018; - - APTOS_MAINNET_MAINNET: MOVE 2xxxx - Aptos - - SUI_MAINNET_MAINNET: Sui - - SOLANA_MAINNET_MAINNET: SOLANA 3xxxx - title: 'Rule: CHAINNAME_ENVIROMENT_NETWORK' - value: - type: string metadata: type: object additionalProperties: type: string - subdomainRegistrationConfig: + subdomainConfig: type: object properties: maxSubdomainRegistrations: @@ -50425,6 +50272,402 @@ paths: subdomainCount: type: string format: uint64 + accessControl: + type: object + additionalProperties: + type: object + properties: + owner: + type: string + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: name + in: path + required: true + type: string + tags: + - Query + /mycel/registry/params: + get: + summary: Parameters queries the parameters of the module. + operationId: MycelRegistryParams + responses: + '200': + description: A successful response. + schema: + type: object + properties: + params: + description: params holds all the parameters of this module. + type: object + description: >- + QueryParamsResponse is response type for the Query/Params RPC + method. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + tags: + - Query + /mycel/registry/second_level_domain: + get: + operationId: MycelRegistrySecondLevelDomainAll + responses: + '200': + description: A successful response. + schema: + type: object + properties: + secondLevelDomain: + type: array + items: + type: object + properties: + name: + type: string + parent: + type: string + owner: + type: string + expirationDate: + type: string + format: int64 + dnsRecords: + type: object + additionalProperties: + type: object + properties: + dnsRecordType: + type: string + enum: + - A + - AAAA + - CNAME + - NS + - MX + - PTR + - SOA + - SRV + - TXT + default: A + value: + type: string + walletRecords: + type: object + additionalProperties: + type: object + properties: + walletRecordType: + type: string + enum: + - BITCOIN_MAINNET_MAINNET + - BITCOIN_TESTNET_TESTNET + - ETHEREUM_MAINNET_MAINNET + - ETHEREUM_TESTNET_GOERLI + - ETHEREUM_TESTNET_SEPOLIA + - POLYGON_MAINNET_MAINNET + - POLYGON_TESTNET_MUMBAI + - BNB_MAINNET_MAINNET + - BNB_TESTNET_TESTNET + - AVALANCHE_MAINNET_CCHAIN + - AVALANCHE_TESTNET_FUJI + - GNOSIS_MAINNET_MAINNET + - GNOSIS_TESTNET_CHIADO + - OPTIMISM_MAINNET_MAINNET + - OPTIMISM_TESTNET_GOERLI + - ARBITRUM_MAINNET_MAINNET + - ARBITRUM_TESTNET_GOERLI + - SHARDEUM_BETANET_SPHINX + - ZETA_TESTNET_ATHENS + - APTOS_MAINNET_MAINNET + - APTOS_TESTNET_TESTNET + - SUI_MAINNET_MAINNET + - SUI_TESTNET_TESTNET + - SOLANA_MAINNET_MAINNET + - SOLANA_TESTNET_TESTNET + default: BITCOIN_MAINNET_MAINNET + description: |- + - BITCOIN_MAINNET_MAINNET: BTC 0xxx + - ETHEREUM_MAINNET_MAINNET: EVM 1xxxx + Etheruem + - POLYGON_MAINNET_MAINNET: Polygon + - BNB_MAINNET_MAINNET: BNB Chain + - AVALANCHE_MAINNET_CCHAIN: Avalanche + - GNOSIS_MAINNET_MAINNET: Gnosis + - OPTIMISM_MAINNET_MAINNET: Optimism + - ARBITRUM_MAINNET_MAINNET: Arbitrum + - SHARDEUM_BETANET_SPHINX: Shardeum + SHARDEUM_MAINNET_ = 10015; + SHARDEUM_TESTNET_ = 10016; + - ZETA_TESTNET_ATHENS: Zetachain + ZETA_MAINNET_MAINNET = 10018; + - APTOS_MAINNET_MAINNET: MOVE 2xxxx + Aptos + - SUI_MAINNET_MAINNET: Sui + - SOLANA_MAINNET_MAINNET: SOLANA 3xxxx + title: 'Rule: CHAINNAME_ENVIROMENT_NETWORK' + value: + type: string + metadata: + type: object + additionalProperties: + type: string + accessControl: + type: object + additionalProperties: + type: object + properties: + owner: + type: string + recordEditor: + type: string + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + PageResponse is to be embedded in gRPC response messages where + the + + corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + offset is a numeric offset that can be used when key is unavailable. + + It is less efficient than using key. Only one of offset or key + should + + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + limit is the total number of results to be returned in the result + page. + + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + count_total is set to true to indicate that the result set should + include + + a count of the total number of items available for pagination in + UIs. + + count_total is only respected when offset is used. It is ignored + when key + + is set. + in: query + required: false + type: boolean + - name: pagination.reverse + description: >- + reverse is set to true if results are to be returned in the + descending order. + + + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean + tags: + - Query + /mycel/registry/second_level_domain/{name}/{parent}: + get: + summary: Queries a list of SecondLevelDomain items. + operationId: MycelRegistrySecondLevelDomain + responses: + '200': + description: A successful response. + schema: + type: object + properties: + secondLevelDomain: + type: object + properties: + name: + type: string + parent: + type: string + owner: + type: string + expirationDate: + type: string + format: int64 + dnsRecords: + type: object + additionalProperties: + type: object + properties: + dnsRecordType: + type: string + enum: + - A + - AAAA + - CNAME + - NS + - MX + - PTR + - SOA + - SRV + - TXT + default: A + value: + type: string + walletRecords: + type: object + additionalProperties: + type: object + properties: + walletRecordType: + type: string + enum: + - BITCOIN_MAINNET_MAINNET + - BITCOIN_TESTNET_TESTNET + - ETHEREUM_MAINNET_MAINNET + - ETHEREUM_TESTNET_GOERLI + - ETHEREUM_TESTNET_SEPOLIA + - POLYGON_MAINNET_MAINNET + - POLYGON_TESTNET_MUMBAI + - BNB_MAINNET_MAINNET + - BNB_TESTNET_TESTNET + - AVALANCHE_MAINNET_CCHAIN + - AVALANCHE_TESTNET_FUJI + - GNOSIS_MAINNET_MAINNET + - GNOSIS_TESTNET_CHIADO + - OPTIMISM_MAINNET_MAINNET + - OPTIMISM_TESTNET_GOERLI + - ARBITRUM_MAINNET_MAINNET + - ARBITRUM_TESTNET_GOERLI + - SHARDEUM_BETANET_SPHINX + - ZETA_TESTNET_ATHENS + - APTOS_MAINNET_MAINNET + - APTOS_TESTNET_TESTNET + - SUI_MAINNET_MAINNET + - SUI_TESTNET_TESTNET + - SOLANA_MAINNET_MAINNET + - SOLANA_TESTNET_TESTNET + default: BITCOIN_MAINNET_MAINNET + description: |- + - BITCOIN_MAINNET_MAINNET: BTC 0xxx + - ETHEREUM_MAINNET_MAINNET: EVM 1xxxx + Etheruem + - POLYGON_MAINNET_MAINNET: Polygon + - BNB_MAINNET_MAINNET: BNB Chain + - AVALANCHE_MAINNET_CCHAIN: Avalanche + - GNOSIS_MAINNET_MAINNET: Gnosis + - OPTIMISM_MAINNET_MAINNET: Optimism + - ARBITRUM_MAINNET_MAINNET: Arbitrum + - SHARDEUM_BETANET_SPHINX: Shardeum + SHARDEUM_MAINNET_ = 10015; + SHARDEUM_TESTNET_ = 10016; + - ZETA_TESTNET_ATHENS: Zetachain + ZETA_MAINNET_MAINNET = 10018; + - APTOS_MAINNET_MAINNET: MOVE 2xxxx + Aptos + - SUI_MAINNET_MAINNET: Sui + - SOLANA_MAINNET_MAINNET: SOLANA 3xxxx + title: 'Rule: CHAINNAME_ENVIROMENT_NETWORK' + value: + type: string + metadata: + type: object + additionalProperties: + type: string + accessControl: + type: object + additionalProperties: + type: object + properties: + owner: + type: string + recordEditor: + type: string default: description: An unexpected error response. schema: @@ -50454,42 +50697,6 @@ paths: type: string tags: - Query - /mycel/registry/params: - get: - summary: Parameters queries the parameters of the module. - operationId: MycelRegistryParams - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - description: >- - QueryParamsResponse is response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query definitions: cosmos.auth.v1beta1.AddressBytesToStringResponse: type: object @@ -80265,169 +80472,6 @@ definitions: - SRV - TXT default: A - mycel.registry.Domain: - type: object - properties: - name: - type: string - parent: - type: string - owner: - type: string - expirationDate: - type: string - format: int64 - dnsRecords: - type: object - additionalProperties: - type: object - properties: - dnsRecordType: - type: string - enum: - - A - - AAAA - - CNAME - - NS - - MX - - PTR - - SOA - - SRV - - TXT - default: A - value: - type: string - walletRecords: - type: object - additionalProperties: - type: object - properties: - walletRecordType: - type: string - enum: - - BITCOIN_MAINNET_MAINNET - - BITCOIN_TESTNET_TESTNET - - ETHEREUM_MAINNET_MAINNET - - ETHEREUM_TESTNET_GOERLI - - ETHEREUM_TESTNET_SEPOLIA - - POLYGON_MAINNET_MAINNET - - POLYGON_TESTNET_MUMBAI - - BNB_MAINNET_MAINNET - - BNB_TESTNET_TESTNET - - AVALANCHE_MAINNET_CCHAIN - - AVALANCHE_TESTNET_FUJI - - GNOSIS_MAINNET_MAINNET - - GNOSIS_TESTNET_CHIADO - - OPTIMISM_MAINNET_MAINNET - - OPTIMISM_TESTNET_GOERLI - - ARBITRUM_MAINNET_MAINNET - - ARBITRUM_TESTNET_GOERLI - - SHARDEUM_BETANET_SPHINX - - ZETA_TESTNET_ATHENS - - APTOS_MAINNET_MAINNET - - APTOS_TESTNET_TESTNET - - SUI_MAINNET_MAINNET - - SUI_TESTNET_TESTNET - - SOLANA_MAINNET_MAINNET - - SOLANA_TESTNET_TESTNET - default: BITCOIN_MAINNET_MAINNET - description: |- - - BITCOIN_MAINNET_MAINNET: BTC 0xxx - - ETHEREUM_MAINNET_MAINNET: EVM 1xxxx - Etheruem - - POLYGON_MAINNET_MAINNET: Polygon - - BNB_MAINNET_MAINNET: BNB Chain - - AVALANCHE_MAINNET_CCHAIN: Avalanche - - GNOSIS_MAINNET_MAINNET: Gnosis - - OPTIMISM_MAINNET_MAINNET: Optimism - - ARBITRUM_MAINNET_MAINNET: Arbitrum - - SHARDEUM_BETANET_SPHINX: Shardeum - SHARDEUM_MAINNET_ = 10015; - SHARDEUM_TESTNET_ = 10016; - - ZETA_TESTNET_ATHENS: Zetachain - ZETA_MAINNET_MAINNET = 10018; - - APTOS_MAINNET_MAINNET: MOVE 2xxxx - Aptos - - SUI_MAINNET_MAINNET: Sui - - SOLANA_MAINNET_MAINNET: SOLANA 3xxxx - title: 'Rule: CHAINNAME_ENVIROMENT_NETWORK' - value: - type: string - metadata: - type: object - additionalProperties: - type: string - subdomainRegistrationConfig: - type: object - properties: - maxSubdomainRegistrations: - type: string - format: uint64 - subdomainRegistrationFees: - type: object - properties: - feeByLength: - type: object - additionalProperties: - type: object - properties: - isRegistrable: - type: boolean - fee: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - feeByName: - type: object - additionalProperties: - type: object - properties: - isRegistrable: - type: boolean - fee: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - defaultFee: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - subdomainCount: - type: string - format: uint64 mycel.registry.DomainOwnership: type: object properties: @@ -80569,10 +80613,10 @@ definitions: repeated Bar results = 1; PageResponse page = 2; } - mycel.registry.QueryAllDomainResponse: + mycel.registry.QueryAllSecondLevelDomainResponse: type: object properties: - domain: + secondLevelDomain: type: array items: type: object @@ -80666,7 +80710,59 @@ definitions: type: object additionalProperties: type: string - subdomainRegistrationConfig: + accessControl: + type: object + additionalProperties: + type: object + properties: + owner: + type: string + recordEditor: + type: string + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: |- + PageResponse is to be embedded in gRPC response messages where the + corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + mycel.registry.QueryAllTopLevelDomainResponse: + type: object + properties: + topLevelDomain: + type: array + items: + type: object + properties: + name: + type: string + expirationDate: + type: string + format: int64 + metadata: + type: object + additionalProperties: + type: string + subdomainConfig: type: object properties: maxSubdomainRegistrations: @@ -80739,6 +80835,13 @@ definitions: subdomainCount: type: string format: uint64 + accessControl: + type: object + additionalProperties: + type: object + properties: + owner: + type: string pagination: type: object properties: @@ -80797,10 +80900,10 @@ definitions: type: string parent: type: string - mycel.registry.QueryGetDomainResponse: + mycel.registry.QueryGetSecondLevelDomainResponse: type: object properties: - domain: + secondLevelDomain: type: object properties: name: @@ -80892,7 +80995,31 @@ definitions: type: object additionalProperties: type: string - subdomainRegistrationConfig: + accessControl: + type: object + additionalProperties: + type: object + properties: + owner: + type: string + recordEditor: + type: string + mycel.registry.QueryGetTopLevelDomainResponse: + type: object + properties: + topLevelDomain: + type: object + properties: + name: + type: string + expirationDate: + type: string + format: int64 + metadata: + type: object + additionalProperties: + type: string + subdomainConfig: type: object properties: maxSubdomainRegistrations: @@ -80965,6 +81092,13 @@ definitions: subdomainCount: type: string format: uint64 + accessControl: + type: object + additionalProperties: + type: object + properties: + owner: + type: string mycel.registry.QueryIsRegistrableDomainResponse: type: object properties: @@ -80979,7 +81113,108 @@ definitions: description: params holds all the parameters of this module. type: object description: QueryParamsResponse is response type for the Query/Params RPC method. - mycel.registry.SubdomainRegistrationConfig: + mycel.registry.SecondLevelDomain: + type: object + properties: + name: + type: string + parent: + type: string + owner: + type: string + expirationDate: + type: string + format: int64 + dnsRecords: + type: object + additionalProperties: + type: object + properties: + dnsRecordType: + type: string + enum: + - A + - AAAA + - CNAME + - NS + - MX + - PTR + - SOA + - SRV + - TXT + default: A + value: + type: string + walletRecords: + type: object + additionalProperties: + type: object + properties: + walletRecordType: + type: string + enum: + - BITCOIN_MAINNET_MAINNET + - BITCOIN_TESTNET_TESTNET + - ETHEREUM_MAINNET_MAINNET + - ETHEREUM_TESTNET_GOERLI + - ETHEREUM_TESTNET_SEPOLIA + - POLYGON_MAINNET_MAINNET + - POLYGON_TESTNET_MUMBAI + - BNB_MAINNET_MAINNET + - BNB_TESTNET_TESTNET + - AVALANCHE_MAINNET_CCHAIN + - AVALANCHE_TESTNET_FUJI + - GNOSIS_MAINNET_MAINNET + - GNOSIS_TESTNET_CHIADO + - OPTIMISM_MAINNET_MAINNET + - OPTIMISM_TESTNET_GOERLI + - ARBITRUM_MAINNET_MAINNET + - ARBITRUM_TESTNET_GOERLI + - SHARDEUM_BETANET_SPHINX + - ZETA_TESTNET_ATHENS + - APTOS_MAINNET_MAINNET + - APTOS_TESTNET_TESTNET + - SUI_MAINNET_MAINNET + - SUI_TESTNET_TESTNET + - SOLANA_MAINNET_MAINNET + - SOLANA_TESTNET_TESTNET + default: BITCOIN_MAINNET_MAINNET + description: |- + - BITCOIN_MAINNET_MAINNET: BTC 0xxx + - ETHEREUM_MAINNET_MAINNET: EVM 1xxxx + Etheruem + - POLYGON_MAINNET_MAINNET: Polygon + - BNB_MAINNET_MAINNET: BNB Chain + - AVALANCHE_MAINNET_CCHAIN: Avalanche + - GNOSIS_MAINNET_MAINNET: Gnosis + - OPTIMISM_MAINNET_MAINNET: Optimism + - ARBITRUM_MAINNET_MAINNET: Arbitrum + - SHARDEUM_BETANET_SPHINX: Shardeum + SHARDEUM_MAINNET_ = 10015; + SHARDEUM_TESTNET_ = 10016; + - ZETA_TESTNET_ATHENS: Zetachain + ZETA_MAINNET_MAINNET = 10018; + - APTOS_MAINNET_MAINNET: MOVE 2xxxx + Aptos + - SUI_MAINNET_MAINNET: Sui + - SOLANA_MAINNET_MAINNET: SOLANA 3xxxx + title: 'Rule: CHAINNAME_ENVIROMENT_NETWORK' + value: + type: string + metadata: + type: object + additionalProperties: + type: string + accessControl: + type: object + additionalProperties: + type: object + properties: + owner: + type: string + recordEditor: + type: string + mycel.registry.SubdomainConfig: type: object properties: maxSubdomainRegistrations: @@ -81106,6 +81341,108 @@ definitions: NOTE: The amount field is an Int which implements the custom method signatures required by gogoproto. + mycel.registry.SubdomainRole: + type: object + properties: + owner: + type: string + recordEditor: + type: string + mycel.registry.TopLevelDomain: + type: object + properties: + name: + type: string + expirationDate: + type: string + format: int64 + metadata: + type: object + additionalProperties: + type: string + subdomainConfig: + type: object + properties: + maxSubdomainRegistrations: + type: string + format: uint64 + subdomainRegistrationFees: + type: object + properties: + feeByLength: + type: object + additionalProperties: + type: object + properties: + isRegistrable: + type: boolean + fee: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + feeByName: + type: object + additionalProperties: + type: object + properties: + isRegistrable: + type: boolean + fee: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + defaultFee: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + subdomainCount: + type: string + format: uint64 + accessControl: + type: object + additionalProperties: + type: object + properties: + owner: + type: string + mycel.registry.TopLevelDomainRole: + type: object + properties: + owner: + type: string mycel.registry.WalletRecord: type: object properties: diff --git a/proto/mycel/registry/domain_ownership.proto b/proto/mycel/registry/domain_ownership.proto index d630cbdd..34e5f6bc 100644 --- a/proto/mycel/registry/domain_ownership.proto +++ b/proto/mycel/registry/domain_ownership.proto @@ -11,6 +11,5 @@ message OwnedDomain { message DomainOwnership { string owner = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - repeated OwnedDomain domains = 2; + repeated OwnedDomain domains = 2; } - diff --git a/proto/mycel/registry/genesis.proto b/proto/mycel/registry/genesis.proto index c878a7e5..8b67c43f 100644 --- a/proto/mycel/registry/genesis.proto +++ b/proto/mycel/registry/genesis.proto @@ -1,17 +1,19 @@ syntax = "proto3"; + package mycel.registry; import "gogoproto/gogo.proto"; import "mycel/registry/params.proto"; -import "mycel/registry/domain.proto"; +import "mycel/registry/top_level_domain.proto"; +import "mycel/registry/second_level_domain.proto"; import "mycel/registry/domain_ownership.proto"; option go_package = "github.com/mycel-domain/mycel/x/registry/types"; // GenesisState defines the registry module's genesis state. message GenesisState { - Params params = 1 [(gogoproto.nullable) = false]; - repeated Domain domains = 2 [(gogoproto.nullable) = false]; - repeated DomainOwnership domainOwnerships = 3 [(gogoproto.nullable) = false]; + Params params = 1 [(gogoproto.nullable) = false]; + repeated TopLevelDomain topLevelDomains = 2 [(gogoproto.nullable) = false]; + repeated SecondLevelDomain secondLevelDomains = 3 [(gogoproto.nullable) = false]; + repeated DomainOwnership domainOwnerships = 4 [(gogoproto.nullable) = false]; } - diff --git a/proto/mycel/registry/query.proto b/proto/mycel/registry/query.proto index f3d315b9..68d7a16b 100644 --- a/proto/mycel/registry/query.proto +++ b/proto/mycel/registry/query.proto @@ -6,7 +6,8 @@ import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; import "mycel/registry/params.proto"; -import "mycel/registry/domain.proto"; +import "mycel/registry/top_level_domain.proto"; +import "mycel/registry/second_level_domain.proto"; import "mycel/registry/domain_ownership.proto"; import "cosmos/base/v1beta1/coin.proto"; @@ -14,43 +15,53 @@ option go_package = "github.com/mycel-domain/mycel/x/registry/types"; // Query defines the gRPC querier service. service Query { - + // Parameters queries the parameters of the module. rpc Params (QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/mycel/registry/params"; - + + } + + // Queries a list of TopLevelDomain items. + rpc TopLevelDomain (QueryGetTopLevelDomainRequest) returns (QueryGetTopLevelDomainResponse) { + option (google.api.http).get = "/mycel-domain/mycel/registry/top_level_domain/{name}"; + + } + rpc TopLevelDomainAll (QueryAllTopLevelDomainRequest) returns (QueryAllTopLevelDomainResponse) { + option (google.api.http).get = "/mycel-domain/mycel/registry/top_level_domain"; + } - - // Queries a list of Domain items. - rpc Domain (QueryGetDomainRequest) returns (QueryGetDomainResponse) { - option (google.api.http).get = "/mycel/registry/domain/{name}/{parent}"; - + + // Queries a list of SecondLevelDomain items. + rpc SecondLevelDomain (QueryGetSecondLevelDomainRequest) returns (QueryGetSecondLevelDomainResponse) { + option (google.api.http).get = "/mycel/registry/second_level_domain/{name}/{parent}"; + } - rpc DomainAll (QueryAllDomainRequest) returns (QueryAllDomainResponse) { - option (google.api.http).get = "/mycel/registry/domain"; - + rpc SecondLevelDomainAll (QueryAllSecondLevelDomainRequest) returns (QueryAllSecondLevelDomainResponse) { + option (google.api.http).get = "/mycel/registry/second_level_domain"; + } - + // Queries a list of DomainOwnership items. rpc DomainOwnership (QueryGetDomainOwnershipRequest) returns (QueryGetDomainOwnershipResponse) { option (google.api.http).get = "/mycel-domain/mycel/registry/domain_ownership/{owner}"; - + } rpc DomainOwnershipAll (QueryAllDomainOwnershipRequest) returns (QueryAllDomainOwnershipResponse) { option (google.api.http).get = "/mycel-domain/mycel/registry/domain_ownership"; - + } - + // Queries a list of DomainRegistrationFee items. rpc DomainRegistrationFee (QueryDomainRegistrationFeeRequest) returns (QueryDomainRegistrationFeeResponse) { option (google.api.http).get = "/mycel-domain/mycel/registry/domain_registration_fee/{name}/{parent}"; - + } - + // Queries a list of IsRegistrableDomain items. rpc IsRegistrableDomain (QueryIsRegistrableDomainRequest) returns (QueryIsRegistrableDomainResponse) { option (google.api.http).get = "/mycel-domain/mycel/registry/is_registrable_domain/{name}/{parent}"; - + } } // QueryParamsRequest is request type for the Query/Params RPC method. @@ -58,27 +69,44 @@ message QueryParamsRequest {} // QueryParamsResponse is response type for the Query/Params RPC method. message QueryParamsResponse { - + // params holds all the parameters of this module. Params params = 1 [(gogoproto.nullable) = false]; } -message QueryGetDomainRequest { +message QueryGetTopLevelDomainRequest { + string name = 1; +} + +message QueryGetTopLevelDomainResponse { + TopLevelDomain topLevelDomain = 1 [(gogoproto.nullable) = false]; +} + +message QueryAllTopLevelDomainRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryAllTopLevelDomainResponse { + repeated TopLevelDomain topLevelDomain = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +message QueryGetSecondLevelDomainRequest { string name = 1; string parent = 2; } -message QueryGetDomainResponse { - Domain domain = 1 [(gogoproto.nullable) = false]; +message QueryGetSecondLevelDomainResponse { + SecondLevelDomain secondLevelDomain = 1 [(gogoproto.nullable) = false]; } -message QueryAllDomainRequest { +message QueryAllSecondLevelDomainRequest { cosmos.base.query.v1beta1.PageRequest pagination = 1; } -message QueryAllDomainResponse { - repeated Domain domain = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; +message QueryAllSecondLevelDomainResponse { + repeated SecondLevelDomain secondLevelDomain = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; } message QueryGetDomainOwnershipRequest { diff --git a/proto/mycel/registry/domain.proto b/proto/mycel/registry/second_level_domain.proto similarity index 65% rename from proto/mycel/registry/domain.proto rename to proto/mycel/registry/second_level_domain.proto index 04fcb817..42f75164 100644 --- a/proto/mycel/registry/domain.proto +++ b/proto/mycel/registry/second_level_domain.proto @@ -3,7 +3,6 @@ package mycel.registry; import "mycel/registry/dns_record.proto"; import "mycel/registry/network_name.proto"; -import "mycel/registry/subdomain_registration_config.proto"; option go_package = "github.com/mycel-domain/mycel/x/registry/types"; @@ -18,14 +17,18 @@ message WalletRecord { string value = 2; } -message Domain { - string name = 1; - string parent = 2; - string owner = 3; - int64 expirationDate = 4; +message SubdomainRole { + string owner = 1; + string recordEditor = 2; +} + +message SecondLevelDomain { + string name = 1; + string parent = 2; + string owner = 3; + int64 expirationDate = 4; map dnsRecords = 5; map walletRecords = 6; map metadata = 7; - SubdomainRegistrationConfig subdomainRegistrationConfig = 8; - uint64 subdomainCount = 9; + map accessControl = 8; } diff --git a/proto/mycel/registry/subdomain_registration_config.proto b/proto/mycel/registry/subdomain_config.proto similarity index 84% rename from proto/mycel/registry/subdomain_registration_config.proto rename to proto/mycel/registry/subdomain_config.proto index 1a6c03c1..a6cd835f 100644 --- a/proto/mycel/registry/subdomain_registration_config.proto +++ b/proto/mycel/registry/subdomain_config.proto @@ -9,7 +9,7 @@ option go_package = "github.com/mycel-domain/mycel/x/registry/types"; message SubdomainRegistrationFees { map feeByLength = 1; map feeByName = 2; - cosmos.base.v1beta1.Coin defaultFee = 3; + cosmos.base.v1beta1.Coin defaultFee = 3; } message Fee { @@ -17,9 +17,7 @@ message Fee { cosmos.base.v1beta1.Coin fee = 2; } -message SubdomainRegistrationConfig { +message SubdomainConfig { uint64 maxSubdomainRegistrations = 1; SubdomainRegistrationFees subdomainRegistrationFees = 2; } - - diff --git a/proto/mycel/registry/top_level_domain.proto b/proto/mycel/registry/top_level_domain.proto new file mode 100644 index 00000000..5271d933 --- /dev/null +++ b/proto/mycel/registry/top_level_domain.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; +package mycel.registry; + +import "mycel/registry/subdomain_config.proto"; + +option go_package = "github.com/mycel-domain/mycel/x/registry/types"; + +message TopLevelDomainRole { + string owner = 1; +} + +message TopLevelDomain { + string name = 1; + int64 expirationDate = 2; + map metadata = 3; + SubdomainConfig subdomainConfig = 4; + uint64 subdomainCount = 5; + map accessControl = 6; +} diff --git a/testutil/keeper/epochs.go b/testutil/keeper/epochs.go index fbbe5c68..82559d8b 100644 --- a/testutil/keeper/epochs.go +++ b/testutil/keeper/epochs.go @@ -6,6 +6,9 @@ import ( "github.com/mycel-domain/mycel/x/epochs/keeper" "github.com/mycel-domain/mycel/x/epochs/types" + tmdb "github.com/cometbft/cometbft-db" + "github.com/cometbft/cometbft/libs/log" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/store" @@ -13,9 +16,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" typesparams "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/stretchr/testify/require" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - tmdb "github.com/cometbft/cometbft-db" ) func EpochsKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { diff --git a/testutil/keeper/registry.go b/testutil/keeper/registry.go index ad5ea55d..13e542b8 100644 --- a/testutil/keeper/registry.go +++ b/testutil/keeper/registry.go @@ -6,6 +6,9 @@ import ( "github.com/mycel-domain/mycel/x/registry/keeper" "github.com/mycel-domain/mycel/x/registry/types" + tmdb "github.com/cometbft/cometbft-db" + "github.com/cometbft/cometbft/libs/log" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/store" @@ -13,9 +16,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" typesparams "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/stretchr/testify/require" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - tmdb "github.com/cometbft/cometbft-db" ) func RegistryKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { diff --git a/x/epochs/client/cli/query_epoch_info_test.go b/x/epochs/client/cli/query_epoch_info_test.go index eeb35d4a..631c3cfd 100644 --- a/x/epochs/client/cli/query_epoch_info_test.go +++ b/x/epochs/client/cli/query_epoch_info_test.go @@ -5,10 +5,10 @@ import ( "strconv" "testing" + tmcli "github.com/cometbft/cometbft/libs/cli" "github.com/cosmos/cosmos-sdk/client/flags" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" "github.com/stretchr/testify/require" - tmcli "github.com/cometbft/cometbft/libs/cli" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" diff --git a/x/epochs/client/cli/query_params.go b/x/epochs/client/cli/query_params.go index ed3521b5..c1774347 100644 --- a/x/epochs/client/cli/query_params.go +++ b/x/epochs/client/cli/query_params.go @@ -5,8 +5,8 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" "github.com/mycel-domain/mycel/x/epochs/types" + "github.com/spf13/cobra" ) func CmdQueryParams() *cobra.Command { diff --git a/x/epochs/keeper/epoch_info_test.go b/x/epochs/keeper/epoch_info_test.go index f33b62dc..94c67917 100644 --- a/x/epochs/keeper/epoch_info_test.go +++ b/x/epochs/keeper/epoch_info_test.go @@ -5,11 +5,11 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" keepertest "github.com/mycel-domain/mycel/testutil/keeper" "github.com/mycel-domain/mycel/testutil/nullify" "github.com/mycel-domain/mycel/x/epochs/keeper" "github.com/mycel-domain/mycel/x/epochs/types" + "github.com/stretchr/testify/require" ) // Prevent strconv unused error diff --git a/x/epochs/keeper/keeper.go b/x/epochs/keeper/keeper.go index e87d039c..eee861bb 100644 --- a/x/epochs/keeper/keeper.go +++ b/x/epochs/keeper/keeper.go @@ -3,11 +3,11 @@ package keeper import ( "fmt" + "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/cometbft/cometbft/libs/log" "github.com/mycel-domain/mycel/x/epochs/types" ) diff --git a/x/epochs/keeper/params_test.go b/x/epochs/keeper/params_test.go index c8411bf8..4f400cd9 100644 --- a/x/epochs/keeper/params_test.go +++ b/x/epochs/keeper/params_test.go @@ -3,9 +3,9 @@ package keeper_test import ( "testing" - "github.com/stretchr/testify/require" testkeeper "github.com/mycel-domain/mycel/testutil/keeper" "github.com/mycel-domain/mycel/x/epochs/types" + "github.com/stretchr/testify/require" ) func TestGetParams(t *testing.T) { diff --git a/x/epochs/keeper/query_epoch_info.go b/x/epochs/keeper/query_epoch_info.go index 51316681..3969729f 100644 --- a/x/epochs/keeper/query_epoch_info.go +++ b/x/epochs/keeper/query_epoch_info.go @@ -6,9 +6,9 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" + "github.com/mycel-domain/mycel/x/epochs/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "github.com/mycel-domain/mycel/x/epochs/types" ) func (k Keeper) EpochInfoAll(goCtx context.Context, req *types.QueryAllEpochInfoRequest) (*types.QueryAllEpochInfoResponse, error) { diff --git a/x/epochs/keeper/query_params.go b/x/epochs/keeper/query_params.go index 68fa96f3..234aaf15 100644 --- a/x/epochs/keeper/query_params.go +++ b/x/epochs/keeper/query_params.go @@ -4,9 +4,9 @@ import ( "context" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/mycel-domain/mycel/x/epochs/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "github.com/mycel-domain/mycel/x/epochs/types" ) func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { diff --git a/x/epochs/keeper/query_params_test.go b/x/epochs/keeper/query_params_test.go index 15d0f20b..98154fb0 100644 --- a/x/epochs/keeper/query_params_test.go +++ b/x/epochs/keeper/query_params_test.go @@ -4,9 +4,9 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" testkeeper "github.com/mycel-domain/mycel/testutil/keeper" "github.com/mycel-domain/mycel/x/epochs/types" + "github.com/stretchr/testify/require" ) func TestParamsQuery(t *testing.T) { diff --git a/x/epochs/keeper/setup_test.go b/x/epochs/keeper/setup_test.go index 9b80da7f..669060ee 100644 --- a/x/epochs/keeper/setup_test.go +++ b/x/epochs/keeper/setup_test.go @@ -6,10 +6,10 @@ import ( "testing" "time" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" ) type KeeperTestSuite struct { diff --git a/x/registry/client/cli/query.go b/x/registry/client/cli/query.go index 7f227d72..9c3676c1 100644 --- a/x/registry/client/cli/query.go +++ b/x/registry/client/cli/query.go @@ -25,14 +25,18 @@ func GetQueryCmd(queryRoute string) *cobra.Command { } cmd.AddCommand(CmdQueryParams()) - cmd.AddCommand(CmdListDomain()) - cmd.AddCommand(CmdShowDomain()) + cmd.AddCommand(CmdListTopLevelDomain()) + cmd.AddCommand(CmdShowTopLevelDomain()) + cmd.AddCommand(CmdListSecondLevelDomain()) + cmd.AddCommand(CmdShowSecondLevelDomain()) cmd.AddCommand(CmdListDomainOwnership()) cmd.AddCommand(CmdShowDomainOwnership()) cmd.AddCommand(CmdDomainRegistrationFee()) cmd.AddCommand(CmdIsRegistrableDomain()) + cmd.AddCommand(CmdListTopLevelDomain()) + cmd.AddCommand(CmdShowTopLevelDomain()) // this line is used by starport scaffolding # 1 return cmd diff --git a/x/registry/client/cli/query_domain_ownership_test.go b/x/registry/client/cli/query_domain_ownership_test.go index 652208a7..e6dbbe8f 100644 --- a/x/registry/client/cli/query_domain_ownership_test.go +++ b/x/registry/client/cli/query_domain_ownership_test.go @@ -5,10 +5,10 @@ import ( "strconv" "testing" + tmcli "github.com/cometbft/cometbft/libs/cli" "github.com/cosmos/cosmos-sdk/client/flags" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" "github.com/stretchr/testify/require" - tmcli "github.com/cometbft/cometbft/libs/cli" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" diff --git a/x/registry/client/cli/query_domain.go b/x/registry/client/cli/query_second_level_domain.go similarity index 68% rename from x/registry/client/cli/query_domain.go rename to x/registry/client/cli/query_second_level_domain.go index 5eb95174..7a5be438 100644 --- a/x/registry/client/cli/query_domain.go +++ b/x/registry/client/cli/query_second_level_domain.go @@ -9,10 +9,10 @@ import ( "github.com/spf13/cobra" ) -func CmdListDomain() *cobra.Command { +func CmdListSecondLevelDomain() *cobra.Command { cmd := &cobra.Command{ - Use: "list-domain", - Short: "list all domain", + Use: "list-second-level-domain", + Short: "list all secondLevelDomains", RunE: func(cmd *cobra.Command, args []string) error { clientCtx := client.GetClientContextFromCmd(cmd) @@ -23,11 +23,11 @@ func CmdListDomain() *cobra.Command { queryClient := types.NewQueryClient(clientCtx) - params := &types.QueryAllDomainRequest{ + params := &types.QueryAllSecondLevelDomainRequest{ Pagination: pageReq, } - res, err := queryClient.DomainAll(context.Background(), params) + res, err := queryClient.SecondLevelDomainAll(context.Background(), params) if err != nil { return err } @@ -42,10 +42,10 @@ func CmdListDomain() *cobra.Command { return cmd } -func CmdShowDomain() *cobra.Command { +func CmdShowSecondLevelDomain() *cobra.Command { cmd := &cobra.Command{ - Use: "show-domain [name] [parent]", - Short: "shows a domain", + Use: "show-second-level-domain [name] [parent]", + Short: "shows a secondLevelDomain", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) (err error) { clientCtx := client.GetClientContextFromCmd(cmd) @@ -55,12 +55,12 @@ func CmdShowDomain() *cobra.Command { argName := args[0] argParent := args[1] - params := &types.QueryGetDomainRequest{ + params := &types.QueryGetSecondLevelDomainRequest{ Name: argName, Parent: argParent, } - res, err := queryClient.Domain(context.Background(), params) + res, err := queryClient.SecondLevelDomain(context.Background(), params) if err != nil { return err } diff --git a/x/registry/client/cli/query_domain_test.go b/x/registry/client/cli/query_second_level_domain_test.go similarity index 71% rename from x/registry/client/cli/query_domain_test.go rename to x/registry/client/cli/query_second_level_domain_test.go index 4aa0b4c0..c12a1eb4 100644 --- a/x/registry/client/cli/query_domain_test.go +++ b/x/registry/client/cli/query_second_level_domain_test.go @@ -5,10 +5,10 @@ import ( "strconv" "testing" + tmcli "github.com/cometbft/cometbft/libs/cli" "github.com/cosmos/cosmos-sdk/client/flags" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" "github.com/stretchr/testify/require" - tmcli "github.com/cometbft/cometbft/libs/cli" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -21,28 +21,28 @@ import ( // Prevent strconv unused error var _ = strconv.IntSize -func networkWithDomainObjects(t *testing.T, n int) (*network.Network, []types.Domain) { +func networkWithDomainObjects(t *testing.T, n int) (*network.Network, []types.SecondLevelDomain) { t.Helper() cfg := network.DefaultConfig() state := types.GenesisState{} require.NoError(t, cfg.Codec.UnmarshalJSON(cfg.GenesisState[types.ModuleName], &state)) for i := 0; i < n; i++ { - domain := types.Domain{ + secondLevelDomain := types.SecondLevelDomain{ Name: strconv.Itoa(i), Parent: strconv.Itoa(i), } - nullify.Fill(&domain) - state.DomainList = append(state.DomainList, domain) + nullify.Fill(&secondLevelDomain) + state.SecondLevelDomainList = append(state.SecondLevelDomainList, secondLevelDomain) } buf, err := cfg.Codec.MarshalJSON(&state) require.NoError(t, err) cfg.GenesisState[types.ModuleName] = buf - return network.New(t, cfg), state.DomainList + return network.New(t, cfg), state.SecondLevelDomainList } -func TestShowDomain(t *testing.T) { - net, objs := networkWithDomainObjects(t, 2) +func TestShowSecondLevelDomain(t *testing.T) { + net, objs := networkWithSecondLevelDomainObjects(t, 2) ctx := net.Validators[0].ClientCtx common := []string{ @@ -55,7 +55,7 @@ func TestShowDomain(t *testing.T) { args []string err error - obj types.Domain + obj types.SecondLevelDomain }{ { desc: "found", @@ -80,27 +80,27 @@ func TestShowDomain(t *testing.T) { tc.idParent, } args = append(args, tc.args...) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowDomain(), args) + out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowSecondLevelDomain(), args) if tc.err != nil { stat, ok := status.FromError(tc.err) require.True(t, ok) require.ErrorIs(t, stat.Err(), tc.err) } else { require.NoError(t, err) - var resp types.QueryGetDomainResponse + var resp types.QueryGetSecondLevelDomainResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NotNil(t, resp.Domain) + require.NotNil(t, resp.SecondLevelDomain) require.Equal(t, nullify.Fill(&tc.obj), - nullify.Fill(&resp.Domain), + nullify.Fill(&resp.SecondLevelDomain), ) } }) } } -func TestListDomain(t *testing.T) { - net, objs := networkWithDomainObjects(t, 5) +func TestListSecondLevelDomain(t *testing.T) { + net, objs := networkWithSecondLevelDomainObjects(t, 5) ctx := net.Validators[0].ClientCtx request := func(next []byte, offset, limit uint64, total bool) []string { @@ -122,14 +122,14 @@ func TestListDomain(t *testing.T) { step := 2 for i := 0; i < len(objs); i += step { args := request(nil, uint64(i), uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListDomain(), args) + out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListSecondLevelDomain(), args) require.NoError(t, err) - var resp types.QueryAllDomainResponse + var resp types.QueryAllSecondLevelDomainResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.Domain), step) + require.LessOrEqual(t, len(resp.SecondLevelDomain), step) require.Subset(t, nullify.Fill(objs), - nullify.Fill(resp.Domain), + nullify.Fill(resp.SecondLevelDomain), ) } }) @@ -138,29 +138,29 @@ func TestListDomain(t *testing.T) { var next []byte for i := 0; i < len(objs); i += step { args := request(next, 0, uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListDomain(), args) + out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListSecondLevelDomain(), args) require.NoError(t, err) - var resp types.QueryAllDomainResponse + var resp types.QueryAllSecondLevelDomainResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.Domain), step) + require.LessOrEqual(t, len(resp.SecondLevelDomain), step) require.Subset(t, nullify.Fill(objs), - nullify.Fill(resp.Domain), + nullify.Fill(resp.SecondLevelDomain), ) next = resp.Pagination.NextKey } }) t.Run("Total", func(t *testing.T) { args := request(nil, 0, uint64(len(objs)), true) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListDomain(), args) + out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListSecondLevelDomain(), args) require.NoError(t, err) - var resp types.QueryAllDomainResponse + var resp types.QueryAllSecondLevelDomainResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) require.NoError(t, err) require.Equal(t, len(objs), int(resp.Pagination.Total)) require.ElementsMatch(t, nullify.Fill(objs), - nullify.Fill(resp.Domain), + nullify.Fill(resp.SecondLevelDomain), ) }) } diff --git a/x/registry/client/cli/query_top_level_domain.go b/x/registry/client/cli/query_top_level_domain.go new file mode 100644 index 00000000..3e48e6dc --- /dev/null +++ b/x/registry/client/cli/query_top_level_domain.go @@ -0,0 +1,78 @@ +package cli + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + "github.com/mycel-domain/mycel/x/registry/types" +) + +func CmdListTopLevelDomain() *cobra.Command { + cmd := &cobra.Command{ + Use: "list-top-level-domain", + Short: "list all topLevelDomain", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryAllTopLevelDomainRequest{ + Pagination: pageReq, + } + + res, err := queryClient.TopLevelDomainAll(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, cmd.Use) + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdShowTopLevelDomain() *cobra.Command { + cmd := &cobra.Command{ + Use: "show-top-level-domain [name]", + Short: "shows a topLevelDomain", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + argName := args[0] + + params := &types.QueryGetTopLevelDomainRequest{ + Name: argName, + } + + res, err := queryClient.TopLevelDomain(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/registry/client/cli/query_top_level_domain_test.go b/x/registry/client/cli/query_top_level_domain_test.go new file mode 100644 index 00000000..9143fc3d --- /dev/null +++ b/x/registry/client/cli/query_top_level_domain_test.go @@ -0,0 +1,160 @@ +package cli_test + +import ( + "fmt" + "strconv" + "testing" + + tmcli "github.com/cometbft/cometbft/libs/cli" + "github.com/cosmos/cosmos-sdk/client/flags" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/mycel-domain/mycel/testutil/network" + "github.com/mycel-domain/mycel/testutil/nullify" + "github.com/mycel-domain/mycel/x/registry/client/cli" + "github.com/mycel-domain/mycel/x/registry/types" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func networkWithTopLevelDomainObjects(t *testing.T, n int) (*network.Network, []types.TopLevelDomain) { + t.Helper() + cfg := network.DefaultConfig() + state := types.GenesisState{} + for i := 0; i < n; i++ { + topLevelDomain := types.TopLevelDomain{ + Name: strconv.Itoa(i), + } + nullify.Fill(&topLevelDomain) + state.TopLevelDomains = append(state.TopLevelDomains, topLevelDomain) + } + buf, err := cfg.Codec.MarshalJSON(&state) + require.NoError(t, err) + cfg.GenesisState[types.ModuleName] = buf + return network.New(t, cfg), state.TopLevelDomains +} + +func TestShowTopLevelDomain(t *testing.T) { + net, objs := networkWithTopLevelDomainObjects(t, 2) + + ctx := net.Validators[0].ClientCtx + common := []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + } + tests := []struct { + desc string + idName string + + args []string + err error + obj types.TopLevelDomain + }{ + { + desc: "found", + idName: objs[0].Name, + + args: common, + obj: objs[0], + }, + { + desc: "not found", + idName: strconv.Itoa(100000), + + args: common, + err: status.Error(codes.NotFound, "not found"), + }, + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + args := []string{ + tc.idName, + } + args = append(args, tc.args...) + out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowTopLevelDomain(), args) + if tc.err != nil { + stat, ok := status.FromError(tc.err) + require.True(t, ok) + require.ErrorIs(t, stat.Err(), tc.err) + } else { + require.NoError(t, err) + var resp types.QueryGetTopLevelDomainResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.NotNil(t, resp.TopLevelDomain) + require.Equal(t, + nullify.Fill(&tc.obj), + nullify.Fill(&resp.TopLevelDomain), + ) + } + }) + } +} + +func TestListTopLevelDomain(t *testing.T) { + net, objs := networkWithTopLevelDomainObjects(t, 5) + + ctx := net.Validators[0].ClientCtx + request := func(next []byte, offset, limit uint64, total bool) []string { + args := []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + } + if next == nil { + args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset)) + } else { + args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next)) + } + args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit)) + if total { + args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal)) + } + return args + } + t.Run("ByOffset", func(t *testing.T) { + step := 2 + for i := 0; i < len(objs); i += step { + args := request(nil, uint64(i), uint64(step), false) + out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListTopLevelDomain(), args) + require.NoError(t, err) + var resp types.QueryAllTopLevelDomainResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.LessOrEqual(t, len(resp.TopLevelDomain), step) + require.Subset(t, + nullify.Fill(objs), + nullify.Fill(resp.TopLevelDomain), + ) + } + }) + t.Run("ByKey", func(t *testing.T) { + step := 2 + var next []byte + for i := 0; i < len(objs); i += step { + args := request(next, 0, uint64(step), false) + out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListTopLevelDomain(), args) + require.NoError(t, err) + var resp types.QueryAllTopLevelDomainResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.LessOrEqual(t, len(resp.TopLevelDomain), step) + require.Subset(t, + nullify.Fill(objs), + nullify.Fill(resp.TopLevelDomain), + ) + next = resp.Pagination.NextKey + } + }) + t.Run("Total", func(t *testing.T) { + args := request(nil, 0, uint64(len(objs)), true) + out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListTopLevelDomain(), args) + require.NoError(t, err) + var resp types.QueryAllTopLevelDomainResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.NoError(t, err) + require.Equal(t, len(objs), int(resp.Pagination.Total)) + require.ElementsMatch(t, + nullify.Fill(objs), + nullify.Fill(resp.TopLevelDomain), + ) + }) +} diff --git a/x/registry/genesis.go b/x/registry/genesis.go index 70de2088..517a0269 100644 --- a/x/registry/genesis.go +++ b/x/registry/genesis.go @@ -8,9 +8,13 @@ import ( // InitGenesis initializes the module's state from a provided genesis state. func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - // Set all the domain - for _, elem := range genState.Domains { - k.SetDomain(ctx, elem) + // Set all the topLevelDomain + for _, elem := range genState.TopLevelDomains { + k.SetTopLevelDomain(ctx, elem) + } + // Set all the secondLevelDomain + for _, elem := range genState.SecondLevelDomains { + k.SetSecondLevelDomain(ctx, elem) } // Set all the domainOwnership for _, elem := range genState.DomainOwnerships { @@ -25,7 +29,8 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() genesis.Params = k.GetParams(ctx) - genesis.Domains = k.GetAllDomain(ctx) + genesis.TopLevelDomains = k.GetAllTopLevelDomain(ctx) + genesis.SecondLevelDomains = k.GetAllSecondLevelDomain(ctx) genesis.DomainOwnerships = k.GetAllDomainOwnership(ctx) // this line is used by starport scaffolding # genesis/module/export diff --git a/x/registry/genesis_test.go b/x/registry/genesis_test.go index 33679c7c..bc1f54e0 100644 --- a/x/registry/genesis_test.go +++ b/x/registry/genesis_test.go @@ -14,7 +14,15 @@ func TestGenesis(t *testing.T) { genesisState := types.GenesisState{ Params: types.DefaultParams(), - Domains: []types.Domain{ + TopLevelDomains: []types.TopLevelDomain{ + { + Name: "0", + }, + { + Name: "1", + }, + }, + SecondLevelDomains: []types.SecondLevelDomain{ { Name: "0", Parent: "0", @@ -43,7 +51,8 @@ func TestGenesis(t *testing.T) { nullify.Fill(&genesisState) nullify.Fill(got) - require.ElementsMatch(t, genesisState.Domains, got.DomainList) - require.ElementsMatch(t, genesisState.DomainOwnerships, got.DomainOwnershipList) + require.ElementsMatch(t, genesisState.TopLevelDomains, got.TopLevelDomains) + require.ElementsMatch(t, genesisState.SecondLevelDomains, got.SecondLevelDomains) + require.ElementsMatch(t, genesisState.DomainOwnerships, got.DomainOwnerships) // this line is used by starport scaffolding # genesis/test/assert } diff --git a/x/registry/keeper/keeper.go b/x/registry/keeper/keeper.go index 629e69b7..7361ee95 100644 --- a/x/registry/keeper/keeper.go +++ b/x/registry/keeper/keeper.go @@ -3,11 +3,11 @@ package keeper import ( "fmt" + "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/cometbft/cometbft/libs/log" "github.com/mycel-domain/mycel/x/registry/types" ) @@ -19,7 +19,7 @@ type ( memKey storetypes.StoreKey paramstore paramtypes.Subspace - bankKeeper types.BankKeeper + bankKeeper types.BankKeeper } ) @@ -42,7 +42,7 @@ func NewKeeper( memKey: memKey, paramstore: ps, - bankKeeper: bankKeeper, + bankKeeper: bankKeeper, } } diff --git a/x/registry/keeper/msg_server_register_domain.go b/x/registry/keeper/msg_server_register_second_level_domain.go similarity index 97% rename from x/registry/keeper/msg_server_register_domain.go rename to x/registry/keeper/msg_server_register_second_level_domain.go index 789313f2..2299e07f 100644 --- a/x/registry/keeper/msg_server_register_domain.go +++ b/x/registry/keeper/msg_server_register_second_level_domain.go @@ -26,7 +26,7 @@ func (k msgServer) RegisterDomain(goCtx context.Context, msg *types.MsgRegisterD currentTime := ctx.BlockTime() expirationDate := currentTime.AddDate(int(msg.RegistrationPeriodInYear), 0, 0) - domain := types.Domain{ + domain := types.SecondLevelDomain{ Name: msg.Name, Owner: msg.Creator, ExpirationDate: expirationDate.UnixNano(), diff --git a/x/registry/keeper/msg_server_register_domain_test.go b/x/registry/keeper/msg_server_register_second_level_domain_test.go similarity index 74% rename from x/registry/keeper/msg_server_register_domain_test.go rename to x/registry/keeper/msg_server_register_second_level_domain_test.go index 9e325115..ed2e9f54 100644 --- a/x/registry/keeper/msg_server_register_domain_test.go +++ b/x/registry/keeper/msg_server_register_second_level_domain_test.go @@ -11,13 +11,12 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -func (suite *KeeperTestSuite) TestRegisterSubdomain() { +func (suite *KeeperTestSuite) TestRegisterSecondLevelDomain() { testCases := []struct { creator string name string parent string registrationPeriodInYear uint64 - domainLevel string domainOwnership types.DomainOwnership expErr error fn func() @@ -27,7 +26,6 @@ func (suite *KeeperTestSuite) TestRegisterSubdomain() { name: "foo", parent: "cel", registrationPeriodInYear: 1, - domainLevel: "2", domainOwnership: types.DomainOwnership{ Owner: testutil.Alice, Domains: []*types.OwnedDomain{{Name: "foo", Parent: "cel"}}, @@ -40,7 +38,6 @@ func (suite *KeeperTestSuite) TestRegisterSubdomain() { name: "foo", parent: "cel", registrationPeriodInYear: 4, - domainLevel: "2", domainOwnership: types.DomainOwnership{ Owner: testutil.Alice, Domains: []*types.OwnedDomain{{Name: "foo", Parent: "cel"}}, @@ -53,7 +50,6 @@ func (suite *KeeperTestSuite) TestRegisterSubdomain() { name: "foo", parent: "cel", registrationPeriodInYear: 1, - domainLevel: "2", expErr: sdkerrors.Wrapf(errors.New(fmt.Sprintf("foo.cel")), types.ErrDomainIsAlreadyTaken.Error()), fn: func() { // Register domain once @@ -67,6 +63,15 @@ func (suite *KeeperTestSuite) TestRegisterSubdomain() { suite.Require().Nil(err) }, }, + { + creator: testutil.Alice, + name: "foo", + parent: "xxx", + registrationPeriodInYear: 1, + expErr: sdkerrors.Wrapf(errors.New(fmt.Sprintf("xxx")), types.ErrParentDomainDoesNotExist.Error()), + fn: func() { + }, + }, } for i, tc := range testCases { @@ -80,38 +85,37 @@ func (suite *KeeperTestSuite) TestRegisterSubdomain() { RegistrationPeriodInYear: tc.registrationPeriodInYear, } - domain := &types.Domain{ - Name: tc.name, - Parent: tc.parent, - } - parentsName, parentsParent := domain.ParseParent() - parent, found := suite.app.RegistryKeeper.GetDomain(suite.ctx, parentsName, parentsParent) - suite.Require().True(found) - beforeSubdomainCount := parent.SubdomainCount + // domain := &types.SecondLevelDomain{ + // Name: tc.name, + // Parent: tc.parent, + // } + // parentsName := domain.ParseParent() + // parent, found := suite.app.RegistryKeeper.GetTopLevelDomain(suite.ctx, parentsName) + // suite.Require().True(found) + // beforeSubdomainCount := parent.SubdomainCount // Run test case function tc.fn() - - // Register domain _, err := suite.msgServer.RegisterDomain(suite.ctx, registerMsg) + fmt.Println("----Case_", i , "---01", err) - if tc.expErr == nil { + if err == nil { // Evalute domain ownership domainOwnership, found := suite.app.RegistryKeeper.GetDomainOwnership(suite.ctx, tc.creator) suite.Require().True(found) suite.Require().Equal(tc.domainOwnership, domainOwnership) // Evalute if domain is registered - _, found = suite.app.RegistryKeeper.GetDomain(suite.ctx, tc.name, tc.parent) + _, found = suite.app.RegistryKeeper.GetTopLevelDomain(suite.ctx, tc.parent) suite.Require().True(found) - // Evalute if parent's subdomainCount is increased - parent, found = suite.app.RegistryKeeper.GetDomain(suite.ctx, parentsName, parentsParent) - suite.Require().True(found) - afterSubdomainCount := parent.SubdomainCount - suite.Require().Equal(beforeSubdomainCount+1, afterSubdomainCount) + // // Evalute if parent's subdomainCount is increased + // parent, found = suite.app.RegistryKeeper.GetTopLevelDomain(suite.ctx, parentsName) + // suite.Require().True(found) + // afterSubdomainCount := parent.SubdomainCount + // suite.Require().Equal(beforeSubdomainCount+1, afterSubdomainCount) // Evalute events suite.Require().Nil(err) @@ -123,7 +127,6 @@ func (suite *KeeperTestSuite) TestRegisterSubdomain() { {Key: types.AttributeRegisterDomainEventName, Value: tc.name}, {Key: types.AttributeRegisterDomainEventParent, Value: tc.parent}, {Key: types.AttributeRegisterDomainEventExpirationDate, Value: events[eventIndex].Attributes[2].Value}, - {Key: types.AttributeRegisterDomainLevel, Value: tc.domainLevel}, }, }, events[eventIndex]) } else { diff --git a/x/registry/keeper/msg_server_update_dns_record.go b/x/registry/keeper/msg_server_update_dns_record.go index 1414e01b..321022cc 100644 --- a/x/registry/keeper/msg_server_update_dns_record.go +++ b/x/registry/keeper/msg_server_update_dns_record.go @@ -14,7 +14,7 @@ import ( func (k msgServer) UpdateDnsRecord(goCtx context.Context, msg *types.MsgUpdateDnsRecord) (*types.MsgUpdateDnsRecordResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - domain, isFound := k.Keeper.GetDomain(ctx, msg.Name, msg.Parent) + domain, isFound := k.Keeper.GetSecondLevelDomain(ctx, msg.Name, msg.Parent) if !isFound { return nil, sdkerrors.Wrapf(errors.New(fmt.Sprintf("%s.%s", msg.Name, msg.Parent)), types.ErrDomainNotFound.Error()) } @@ -28,7 +28,7 @@ func (k msgServer) UpdateDnsRecord(goCtx context.Context, msg *types.MsgUpdateDn if err != nil { return nil, err } - k.Keeper.SetDomain(ctx, domain) + k.Keeper.SetSecondLevelDomain(ctx, domain) // Emit event ctx.EventManager().EmitEvent( sdk.NewEvent(types.EventTypeUpdateDnsRecord, diff --git a/x/registry/keeper/msg_server_update_dns_record_test.go b/x/registry/keeper/msg_server_update_dns_record_test.go index 10d94752..990adbe0 100644 --- a/x/registry/keeper/msg_server_update_dns_record_test.go +++ b/x/registry/keeper/msg_server_update_dns_record_test.go @@ -96,7 +96,7 @@ func (suite *KeeperTestSuite) TestUpdateDnsRecord() { if tc.expErr == nil { // Evalute events suite.Require().Nil(err) - res, _ := suite.app.RegistryKeeper.GetDomain(suite.ctx, domain.Name, domain.Parent) + res, _ := suite.app.RegistryKeeper.GetSecondLevelDomain(suite.ctx, domain.Name, domain.Parent) suite.Require().Equal(tc.value, res.DnsRecords[tc.dnsRecordType].Value) // Event check diff --git a/x/registry/keeper/msg_server_update_wallet_record.go b/x/registry/keeper/msg_server_update_wallet_record.go index 1b53b797..71551308 100644 --- a/x/registry/keeper/msg_server_update_wallet_record.go +++ b/x/registry/keeper/msg_server_update_wallet_record.go @@ -14,7 +14,7 @@ import ( func (k msgServer) UpdateWalletRecord(goCtx context.Context, msg *types.MsgUpdateWalletRecord) (*types.MsgUpdateWalletRecordResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - domain, isFound := k.Keeper.GetDomain(ctx, msg.Name, msg.Parent) + domain, isFound := k.Keeper.GetSecondLevelDomain(ctx, msg.Name, msg.Parent) if !isFound { return nil, sdkerrors.Wrapf(errors.New(fmt.Sprintf("%s.%s", msg.Name, msg.Parent)), types.ErrDomainNotFound.Error()) } @@ -28,7 +28,7 @@ func (k msgServer) UpdateWalletRecord(goCtx context.Context, msg *types.MsgUpdat if err != nil { return nil, err } - k.Keeper.SetDomain(ctx, domain) + k.Keeper.SetSecondLevelDomain(ctx, domain) // Emit event ctx.EventManager().EmitEvent( sdk.NewEvent(types.EventTypeUpdateWalletRecord, diff --git a/x/registry/keeper/msg_server_update_wallet_record_test.go b/x/registry/keeper/msg_server_update_wallet_record_test.go index 02241b0d..6009a186 100644 --- a/x/registry/keeper/msg_server_update_wallet_record_test.go +++ b/x/registry/keeper/msg_server_update_wallet_record_test.go @@ -115,7 +115,7 @@ func (suite *KeeperTestSuite) TestUpdateWalletRecord() { if tc.expErr == nil { // Evalute events suite.Require().Nil(err) - res, _ := suite.app.RegistryKeeper.GetDomain(suite.ctx, domain.Name, domain.Parent) + res, _ := suite.app.RegistryKeeper.GetSecondLevelDomain(suite.ctx, domain.Name, domain.Parent) suite.Require().Equal(tc.value, res.WalletRecords[tc.walletRecordType].Value) // Event check diff --git a/x/registry/keeper/query_domain_registration_fee.go b/x/registry/keeper/query_domain_registration_fee.go index 7f7ff9e2..5925c2ad 100644 --- a/x/registry/keeper/query_domain_registration_fee.go +++ b/x/registry/keeper/query_domain_registration_fee.go @@ -18,8 +18,8 @@ func (k Keeper) DomainRegistrationFee(goCtx context.Context, req *types.QueryDom // TODO: Process the query _ = ctx - domain := types.Domain{Name: req.Name, Parent: req.Parent} - config := k.GetParentsSubdomainRegistraionConfig(ctx, domain) + domain := types.SecondLevelDomain{Name: req.Name, Parent: req.Parent} + config := k.GetParentsSubdomainConfig(ctx, domain) fee, err := config.GetRegistrationFee(domain.Name, 1) if err != nil { return nil, err diff --git a/x/registry/keeper/query_is_registrable_domain.go b/x/registry/keeper/query_is_registrable_domain.go index 54aab7cf..b7b2683f 100644 --- a/x/registry/keeper/query_is_registrable_domain.go +++ b/x/registry/keeper/query_is_registrable_domain.go @@ -18,8 +18,8 @@ func (k Keeper) IsRegistrableDomain(goCtx context.Context, req *types.QueryIsReg // TODO: Process the query _ = ctx - domain := types.Domain{Name: req.Name, Parent: req.Parent} - err := k.ValidateDomain(ctx, domain) + domain := types.SecondLevelDomain{Name: req.Name, Parent: req.Parent} + err := k.ValidateSecondLevelDomain(ctx, domain) if err != nil { return &types.QueryIsRegistrableDomainResponse{IsRegstrable: false, ErrorMessage: err.Error()}, nil } diff --git a/x/registry/keeper/query_domain.go b/x/registry/keeper/query_second_level_domain.go similarity index 58% rename from x/registry/keeper/query_domain.go rename to x/registry/keeper/query_second_level_domain.go index bd306b69..ddbd6e2b 100644 --- a/x/registry/keeper/query_domain.go +++ b/x/registry/keeper/query_second_level_domain.go @@ -11,19 +11,19 @@ import ( "google.golang.org/grpc/status" ) -func (k Keeper) DomainAll(goCtx context.Context, req *types.QueryAllDomainRequest) (*types.QueryAllDomainResponse, error) { +func (k Keeper) SecondLevelDomainAll(goCtx context.Context, req *types.QueryAllSecondLevelDomainRequest) (*types.QueryAllSecondLevelDomainResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - var domains []types.Domain + var domains []types.SecondLevelDomain ctx := sdk.UnwrapSDKContext(goCtx) store := ctx.KVStore(k.storeKey) - domainStore := prefix.NewStore(store, types.KeyPrefix(types.DomainKeyPrefix)) + domainStore := prefix.NewStore(store, types.KeyPrefix(types.SecondLevelDomainKeyPrefix)) pageRes, err := query.Paginate(domainStore, req.Pagination, func(key []byte, value []byte) error { - var domain types.Domain + var domain types.SecondLevelDomain if err := k.cdc.Unmarshal(value, &domain); err != nil { return err } @@ -36,16 +36,16 @@ func (k Keeper) DomainAll(goCtx context.Context, req *types.QueryAllDomainReques return nil, status.Error(codes.Internal, err.Error()) } - return &types.QueryAllDomainResponse{Domain: domains, Pagination: pageRes}, nil + return &types.QueryAllSecondLevelDomainResponse{SecondLevelDomain: domains, Pagination: pageRes}, nil } -func (k Keeper) Domain(goCtx context.Context, req *types.QueryGetDomainRequest) (*types.QueryGetDomainResponse, error) { +func (k Keeper) SecondLevelDomain(goCtx context.Context, req *types.QueryGetSecondLevelDomainRequest) (*types.QueryGetSecondLevelDomainResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } ctx := sdk.UnwrapSDKContext(goCtx) - val, found := k.GetDomain( + val, found := k.GetSecondLevelDomain( ctx, req.Name, req.Parent, @@ -54,5 +54,5 @@ func (k Keeper) Domain(goCtx context.Context, req *types.QueryGetDomainRequest) return nil, status.Error(codes.NotFound, "not found") } - return &types.QueryGetDomainResponse{Domain: val}, nil + return &types.QueryGetSecondLevelDomainResponse{SecondLevelDomain: val}, nil } diff --git a/x/registry/keeper/query_domain_test.go b/x/registry/keeper/query_second_level_domain_test.go similarity index 65% rename from x/registry/keeper/query_domain_test.go rename to x/registry/keeper/query_second_level_domain_test.go index 8de19415..96d39d5d 100644 --- a/x/registry/keeper/query_domain_test.go +++ b/x/registry/keeper/query_second_level_domain_test.go @@ -18,35 +18,35 @@ import ( // Prevent strconv unused error var _ = strconv.IntSize -func TestDomainQuerySingle(t *testing.T) { +func TestSecondLevelDomainQuerySingle(t *testing.T) { keeper, ctx := keepertest.RegistryKeeper(t) wctx := sdk.WrapSDKContext(ctx) msgs := createNDomain(keeper, ctx, 2) for _, tc := range []struct { desc string - request *types.QueryGetDomainRequest - response *types.QueryGetDomainResponse + request *types.QueryGetSecondLevelDomainRequest + response *types.QueryGetSecondLevelDomainResponse err error }{ { desc: "First", - request: &types.QueryGetDomainRequest{ + request: &types.QueryGetSecondLevelDomainRequest{ Name: msgs[0].Name, Parent: msgs[0].Parent, }, - response: &types.QueryGetDomainResponse{Domain: msgs[0]}, + response: &types.QueryGetSecondLevelDomainResponse{SecondLevelDomain: msgs[0]}, }, { desc: "Second", - request: &types.QueryGetDomainRequest{ + request: &types.QueryGetSecondLevelDomainRequest{ Name: msgs[1].Name, Parent: msgs[1].Parent, }, - response: &types.QueryGetDomainResponse{Domain: msgs[1]}, + response: &types.QueryGetSecondLevelDomainResponse{SecondLevelDomain: msgs[1]}, }, { desc: "KeyNotFound", - request: &types.QueryGetDomainRequest{ + request: &types.QueryGetSecondLevelDomainRequest{ Name: strconv.Itoa(100000), Parent: strconv.Itoa(100000), }, @@ -58,7 +58,7 @@ func TestDomainQuerySingle(t *testing.T) { }, } { t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.Domain(wctx, tc.request) + response, err := keeper.SecondLevelDomain(wctx, tc.request) if tc.err != nil { require.ErrorIs(t, err, tc.err) } else { @@ -72,13 +72,13 @@ func TestDomainQuerySingle(t *testing.T) { } } -func TestDomainQueryPaginated(t *testing.T) { +func TestSecondLevelDomainQueryPaginated(t *testing.T) { keeper, ctx := keepertest.RegistryKeeper(t) wctx := sdk.WrapSDKContext(ctx) msgs := createNDomain(keeper, ctx, 5) - request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllDomainRequest { - return &types.QueryAllDomainRequest{ + request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllSecondLevelDomainRequest { + return &types.QueryAllSecondLevelDomainRequest{ Pagination: &query.PageRequest{ Key: next, Offset: offset, @@ -90,12 +90,12 @@ func TestDomainQueryPaginated(t *testing.T) { t.Run("ByOffset", func(t *testing.T) { step := 2 for i := 0; i < len(msgs); i += step { - resp, err := keeper.DomainAll(wctx, request(nil, uint64(i), uint64(step), false)) + resp, err := keeper.SecondLevelDomainAll(wctx, request(nil, uint64(i), uint64(step), false)) require.NoError(t, err) - require.LessOrEqual(t, len(resp.Domain), step) + require.LessOrEqual(t, len(resp.SecondLevelDomain), step) require.Subset(t, nullify.Fill(msgs), - nullify.Fill(resp.Domain), + nullify.Fill(resp.SecondLevelDomain), ) } }) @@ -103,27 +103,27 @@ func TestDomainQueryPaginated(t *testing.T) { step := 2 var next []byte for i := 0; i < len(msgs); i += step { - resp, err := keeper.DomainAll(wctx, request(next, 0, uint64(step), false)) + resp, err := keeper.SecondLevelDomainAll(wctx, request(next, 0, uint64(step), false)) require.NoError(t, err) - require.LessOrEqual(t, len(resp.Domain), step) + require.LessOrEqual(t, len(resp.SecondLevelDomain), step) require.Subset(t, nullify.Fill(msgs), - nullify.Fill(resp.Domain), + nullify.Fill(resp.SecondLevelDomain), ) next = resp.Pagination.NextKey } }) t.Run("Total", func(t *testing.T) { - resp, err := keeper.DomainAll(wctx, request(nil, 0, 0, true)) + resp, err := keeper.SecondLevelDomainAll(wctx, request(nil, 0, 0, true)) require.NoError(t, err) require.Equal(t, len(msgs), int(resp.Pagination.Total)) require.ElementsMatch(t, nullify.Fill(msgs), - nullify.Fill(resp.Domain), + nullify.Fill(resp.SecondLevelDomain), ) }) t.Run("InvalidRequest", func(t *testing.T) { - _, err := keeper.DomainAll(wctx, nil) + _, err := keeper.SecondLevelDomainAll(wctx, nil) require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) }) } diff --git a/x/registry/keeper/query_top_level_domain.go b/x/registry/keeper/query_top_level_domain.go new file mode 100644 index 00000000..c6dfb12d --- /dev/null +++ b/x/registry/keeper/query_top_level_domain.go @@ -0,0 +1,57 @@ +package keeper + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/mycel-domain/mycel/x/registry/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) TopLevelDomainAll(goCtx context.Context, req *types.QueryAllTopLevelDomainRequest) (*types.QueryAllTopLevelDomainResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + var topLevelDomains []types.TopLevelDomain + ctx := sdk.UnwrapSDKContext(goCtx) + + store := ctx.KVStore(k.storeKey) + topLevelDomainStore := prefix.NewStore(store, types.KeyPrefix(types.TopLevelDomainKeyPrefix)) + + pageRes, err := query.Paginate(topLevelDomainStore, req.Pagination, func(key []byte, value []byte) error { + var topLevelDomain types.TopLevelDomain + if err := k.cdc.Unmarshal(value, &topLevelDomain); err != nil { + return err + } + + topLevelDomains = append(topLevelDomains, topLevelDomain) + return nil + }) + + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryAllTopLevelDomainResponse{TopLevelDomain: topLevelDomains, Pagination: pageRes}, nil +} + +func (k Keeper) TopLevelDomain(goCtx context.Context, req *types.QueryGetTopLevelDomainRequest) (*types.QueryGetTopLevelDomainResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + + val, found := k.GetTopLevelDomain( + ctx, + req.Name, + ) + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + return &types.QueryGetTopLevelDomainResponse{TopLevelDomain: val}, nil +} diff --git a/x/registry/keeper/query_top_level_domain_test.go b/x/registry/keeper/query_top_level_domain_test.go new file mode 100644 index 00000000..2bf2370f --- /dev/null +++ b/x/registry/keeper/query_top_level_domain_test.go @@ -0,0 +1,127 @@ +package keeper_test + +import ( + "strconv" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + keepertest "github.com/mycel-domain/mycel/testutil/keeper" + "github.com/mycel-domain/mycel/testutil/nullify" + "github.com/mycel-domain/mycel/x/registry/types" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func TestTopLevelDomainQuerySingle(t *testing.T) { + keeper, ctx := keepertest.RegistryKeeper(t) + wctx := sdk.WrapSDKContext(ctx) + msgs := createNTopLevelDomain(keeper, ctx, 2) + tests := []struct { + desc string + request *types.QueryGetTopLevelDomainRequest + response *types.QueryGetTopLevelDomainResponse + err error + }{ + { + desc: "First", + request: &types.QueryGetTopLevelDomainRequest{ + Name: msgs[0].Name, + }, + response: &types.QueryGetTopLevelDomainResponse{TopLevelDomain: msgs[0]}, + }, + { + desc: "Second", + request: &types.QueryGetTopLevelDomainRequest{ + Name: msgs[1].Name, + }, + response: &types.QueryGetTopLevelDomainResponse{TopLevelDomain: msgs[1]}, + }, + { + desc: "KeyNotFound", + request: &types.QueryGetTopLevelDomainRequest{ + Name: strconv.Itoa(100000), + }, + err: status.Error(codes.NotFound, "not found"), + }, + { + desc: "InvalidRequest", + err: status.Error(codes.InvalidArgument, "invalid request"), + }, + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + response, err := keeper.TopLevelDomain(wctx, tc.request) + if tc.err != nil { + require.ErrorIs(t, err, tc.err) + } else { + require.NoError(t, err) + require.Equal(t, + nullify.Fill(tc.response), + nullify.Fill(response), + ) + } + }) + } +} + +func TestTopLevelDomainQueryPaginated(t *testing.T) { + keeper, ctx := keepertest.RegistryKeeper(t) + wctx := sdk.WrapSDKContext(ctx) + msgs := createNTopLevelDomain(keeper, ctx, 5) + + request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllTopLevelDomainRequest { + return &types.QueryAllTopLevelDomainRequest{ + Pagination: &query.PageRequest{ + Key: next, + Offset: offset, + Limit: limit, + CountTotal: total, + }, + } + } + t.Run("ByOffset", func(t *testing.T) { + step := 2 + for i := 0; i < len(msgs); i += step { + resp, err := keeper.TopLevelDomainAll(wctx, request(nil, uint64(i), uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.TopLevelDomain), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.TopLevelDomain), + ) + } + }) + t.Run("ByKey", func(t *testing.T) { + step := 2 + var next []byte + for i := 0; i < len(msgs); i += step { + resp, err := keeper.TopLevelDomainAll(wctx, request(next, 0, uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.TopLevelDomain), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.TopLevelDomain), + ) + next = resp.Pagination.NextKey + } + }) + t.Run("Total", func(t *testing.T) { + resp, err := keeper.TopLevelDomainAll(wctx, request(nil, 0, 0, true)) + require.NoError(t, err) + require.Equal(t, len(msgs), int(resp.Pagination.Total)) + require.ElementsMatch(t, + nullify.Fill(msgs), + nullify.Fill(resp.TopLevelDomain), + ) + }) + t.Run("InvalidRequest", func(t *testing.T) { + _, err := keeper.TopLevelDomainAll(wctx, nil) + require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) + }) +} diff --git a/x/registry/keeper/register_domain.go b/x/registry/keeper/register_domain.go deleted file mode 100644 index 376f92b4..00000000 --- a/x/registry/keeper/register_domain.go +++ /dev/null @@ -1,136 +0,0 @@ -package keeper - -import ( - "errors" - "fmt" - "github.com/mycel-domain/mycel/x/registry/types" - "strconv" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -func (k Keeper) GetParentDomain(ctx sdk.Context, domain types.Domain) (parentDomain types.Domain, found bool) { - // Check if domain is not TLD - level := domain.GetDomainLevel() - if level == 1 { - found = false - } else { - // Get parent domain - parentsName, parentsParent := domain.ParseParent() - parentDomain, found = k.GetDomain(ctx, parentsName, parentsParent) - } - return parentDomain, found -} - -func (k Keeper) GetParentsSubdomainRegistraionConfig(ctx sdk.Context, domain types.Domain) types.SubdomainRegistrationConfig { - // Get parent domain - parentDomain, found := k.GetParentDomain(ctx, domain) - if !found || parentDomain.SubdomainRegistrationConfig == nil { - panic("parent domain or config not found") - } - return *parentDomain.SubdomainRegistrationConfig -} - -// Pay SLD registration fee -func (k Keeper) PaySLDRegstrationFee(ctx sdk.Context, payer sdk.AccAddress, domain types.Domain, registrationPeriodInYear uint64) (err error) { - config := k.GetParentsSubdomainRegistraionConfig(ctx, domain) - - fee, err := config.GetRegistrationFee(domain.Name, registrationPeriodInYear) - if err != nil { - return err - } - - // TODO: Pay fee - fee = fee - return err -} - -func (k Keeper) AppendToOwnedDomain(ctx sdk.Context, owner string, name string, parent string) { - domainOwnership, found := k.GetDomainOwnership(ctx, owner) - if found { - domainOwnership.Domains = append(domainOwnership.Domains, &types.OwnedDomain{Name: name, Parent: parent}) - k.SetDomainOwnership(ctx, domainOwnership) - } else { - k.SetDomainOwnership(ctx, types.DomainOwnership{Owner: owner, Domains: []*types.OwnedDomain{{Name: name, Parent: parent}}}) - } -} - -func (k Keeper) IncrementParentsSubdomainCount(ctx sdk.Context, domain types.Domain) { - // Check if domain is not TLD - level := domain.GetDomainLevel() - if level == 1 { - panic("domain is TLD") - } - - // Increment parent's subdomain count - parentsName, parentsParent := domain.ParseParent() - parentDomain, found := k.GetDomain(ctx, parentsName, parentsParent) - if !found { - panic("parent not found") - } - parentDomain.SubdomainCount++ - k.SetDomain(ctx, parentDomain) -} - -func (k Keeper) RegisterDomain(ctx sdk.Context, domain types.Domain, owner sdk.AccAddress, registrationPeriodIYear uint64) (err error) { - // Validate domain - err = k.ValidateDomain(ctx, domain) - if err != nil { - return err - } - - // Pay registration fee - domainLevel := domain.GetDomainLevel() - switch domainLevel { - case 1: // TLD - // TODO: Register TLD - return - case 2: // SLD - parentDomain, found := k.GetParentDomain(ctx, domain) - - if !found { - panic("parent not found") - } - - // Check if parent domain has subdomain registration config - if parentDomain.SubdomainRegistrationConfig.MaxSubdomainRegistrations <= parentDomain.SubdomainCount { - err = sdkerrors.Wrapf(errors.New(fmt.Sprintf("%d", parentDomain.SubdomainCount)), types.ErrMaxSubdomainCountReached.Error()) - return err - } - - // Set subdomain registration config - domain.SubdomainRegistrationConfig = &types.SubdomainRegistrationConfig{ - MaxSubdomainRegistrations: 100, - } - - // Increment parents subdomain SubdomainCount - k.IncrementParentsSubdomainCount(ctx, domain) - // Pay SLD registration fee - err = k.PaySLDRegstrationFee(ctx, owner, domain, registrationPeriodIYear) - if err != nil { - return err - } - default: // Subdomain - // Increment parents subdomain SubdomainCount - k.IncrementParentsSubdomainCount(ctx, domain) - } - - // Append to owned domain - k.AppendToOwnedDomain(ctx, owner.String(), domain.Name, domain.Parent) - - // Set domain - k.SetDomain(ctx, domain) - - // Emit event - ctx.EventManager().EmitEvent( - sdk.NewEvent(types.EventTypeRegsterDomain, - sdk.NewAttribute(types.AttributeRegisterDomainEventName, domain.Name), - sdk.NewAttribute(types.AttributeRegisterDomainEventParent, domain.Parent), - sdk.NewAttribute(types.AttributeRegisterDomainEventExpirationDate, strconv.FormatInt(domain.ExpirationDate, 10)), - sdk.NewAttribute(types.AttributeRegisterDomainLevel, strconv.Itoa(domainLevel)), - ), - ) - - return err -} diff --git a/x/registry/keeper/register_second_level_domain.go b/x/registry/keeper/register_second_level_domain.go new file mode 100644 index 00000000..1d6244f5 --- /dev/null +++ b/x/registry/keeper/register_second_level_domain.go @@ -0,0 +1,113 @@ +package keeper + +import ( + "errors" + "fmt" + "github.com/mycel-domain/mycel/x/registry/types" + "strconv" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +func (k Keeper) GetParentDomain(ctx sdk.Context, domain types.SecondLevelDomain) (parentDomain types.TopLevelDomain, found bool) { + // Get parent domain + parent := domain.ParseParent() + parentDomain, found = k.GetTopLevelDomain(ctx, parent) + return parentDomain, found +} + +func (k Keeper) GetParentsSubdomainConfig(ctx sdk.Context, domain types.SecondLevelDomain) types.SubdomainConfig { + // Get parent domain + parentDomain, found := k.GetParentDomain(ctx, domain) + if !found || parentDomain.SubdomainConfig == nil { + panic("parent domain or config not found") + } + return *parentDomain.SubdomainConfig +} + +// Pay SLD registration fee +func (k Keeper) PaySLDRegstrationFee(ctx sdk.Context, payer sdk.AccAddress, domain types.SecondLevelDomain, registrationPeriodInYear uint64) (err error) { + config := k.GetParentsSubdomainConfig(ctx, domain) + + fee, err := config.GetRegistrationFee(domain.Name, registrationPeriodInYear) + if err != nil { + return err + } + + // TODO: Pay fee + fee = fee + return err +} + +func (k Keeper) AppendToOwnedDomain(ctx sdk.Context, owner string, name string, parent string) { + domainOwnership, found := k.GetDomainOwnership(ctx, owner) + if found { + domainOwnership.Domains = append(domainOwnership.Domains, &types.OwnedDomain{Name: name, Parent: parent}) + k.SetDomainOwnership(ctx, domainOwnership) + } else { + k.SetDomainOwnership(ctx, types.DomainOwnership{Owner: owner, Domains: []*types.OwnedDomain{{Name: name, Parent: parent}}}) + } +} + +func (k Keeper) IncrementParentsSubdomainCount(ctx sdk.Context, domain types.SecondLevelDomain) { + // Increment parent's subdomain count + parent := domain.ParseParent() + parentDomain, found := k.GetTopLevelDomain(ctx, parent) + if !found { + panic("parent not found") + } + parentDomain.SubdomainCount++ + k.SetTopLevelDomain(ctx, parentDomain) +} + +func (k Keeper) RegisterDomain(ctx sdk.Context, domain types.SecondLevelDomain, owner sdk.AccAddress, registrationPeriodIYear uint64) (err error) { + // Validate domain + err = k.ValidateSecondLevelDomain(ctx, domain) + if err != nil { + return err + } + + // Pay registration fee + parentDomain, found := k.GetParentDomain(ctx, domain) + + if !found { + panic("parent not found") + } + + // Check if parent domain has subdomain registration config + if parentDomain.SubdomainConfig.MaxSubdomainRegistrations <= parentDomain.SubdomainCount { + err = sdkerrors.Wrapf(errors.New(fmt.Sprintf("%d", parentDomain.SubdomainCount)), types.ErrMaxSubdomainCountReached.Error()) + return err + } + + // Set subdomain registration config + parentDomain.SubdomainConfig = &types.SubdomainConfig{ + MaxSubdomainRegistrations: 100, + } + + // Increment parents subdomain SubdomainCount + k.IncrementParentsSubdomainCount(ctx, domain) + // Pay SLD registration fee + err = k.PaySLDRegstrationFee(ctx, owner, domain, registrationPeriodIYear) + if err != nil { + return err + } + + // Append to owned domain + k.AppendToOwnedDomain(ctx, owner.String(), domain.Name, domain.Parent) + + // Set domain + k.SetSecondLevelDomain(ctx, domain) + + // Emit event + ctx.EventManager().EmitEvent( + sdk.NewEvent(types.EventTypeRegsterDomain, + sdk.NewAttribute(types.AttributeRegisterDomainEventName, domain.Name), + sdk.NewAttribute(types.AttributeRegisterDomainEventParent, domain.Parent), + sdk.NewAttribute(types.AttributeRegisterDomainEventExpirationDate, strconv.FormatInt(domain.ExpirationDate, 10)), + ), + ) + + return err +} diff --git a/x/registry/keeper/domain.go b/x/registry/keeper/second_level_domain.go similarity index 51% rename from x/registry/keeper/domain.go rename to x/registry/keeper/second_level_domain.go index 9a670775..a3f165ff 100644 --- a/x/registry/keeper/domain.go +++ b/x/registry/keeper/second_level_domain.go @@ -7,26 +7,26 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// SetDomain set a specific domain in the store from its index -func (k Keeper) SetDomain(ctx sdk.Context, domain types.Domain) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.DomainKeyPrefix)) +// SetSecondLevelDomain set a specific second-level-domain in the store from its index +func (k Keeper) SetSecondLevelDomain(ctx sdk.Context, domain types.SecondLevelDomain) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.SecondLevelDomainKeyPrefix)) b := k.cdc.MustMarshal(&domain) - store.Set(types.DomainKey( + store.Set(types.SecondLevelDomainKey( domain.Name, domain.Parent, ), b) } -// GetDomain returns a domain from its index -func (k Keeper) GetDomain( +// GetSecondLevelDomain returns a second-level-domain from its index +func (k Keeper) GetSecondLevelDomain( ctx sdk.Context, name string, parent string, -) (val types.Domain, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.DomainKeyPrefix)) +) (val types.SecondLevelDomain, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.SecondLevelDomainKeyPrefix)) - b := store.Get(types.DomainKey( + b := store.Get(types.SecondLevelDomainKey( name, parent, )) @@ -38,29 +38,29 @@ func (k Keeper) GetDomain( return val, true } -// RemoveDomain removes a domain from the store -func (k Keeper) RemoveDomain( +// RemoveSecondLevelDomain removes a second-level-domain from the store +func (k Keeper) RemoveSecondLevelDomain( ctx sdk.Context, name string, parent string, ) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.DomainKeyPrefix)) - store.Delete(types.DomainKey( + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.SecondLevelDomainKeyPrefix)) + store.Delete(types.SecondLevelDomainKey( name, parent, )) } -// GetAllDomain returns all domain -func (k Keeper) GetAllDomain(ctx sdk.Context) (list []types.Domain) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.DomainKeyPrefix)) +// GetAllSecondLevelDomain returns all second-level-domain +func (k Keeper) GetAllSecondLevelDomain(ctx sdk.Context) (list []types.SecondLevelDomain) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.SecondLevelDomainKeyPrefix)) iterator := sdk.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - var val types.Domain + var val types.SecondLevelDomain k.cdc.MustUnmarshal(iterator.Value(), &val) list = append(list, val) } diff --git a/x/registry/keeper/domain_test.go b/x/registry/keeper/second_level_domain_test.go similarity index 80% rename from x/registry/keeper/domain_test.go rename to x/registry/keeper/second_level_domain_test.go index 114db8fe..be4703d1 100644 --- a/x/registry/keeper/domain_test.go +++ b/x/registry/keeper/second_level_domain_test.go @@ -16,13 +16,13 @@ import ( // Prevent strconv unused error var _ = strconv.IntSize -func createNDomain(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.Domain { - items := make([]types.Domain, n) +func createNDomain(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.SecondLevelDomain { + items := make([]types.SecondLevelDomain, n) for i := range items { items[i].Name = strconv.Itoa(i) items[i].Parent = strconv.Itoa(i) - keeper.SetDomain(ctx, items[i]) + keeper.SetSecondLevelDomain(ctx, items[i]) } return items } @@ -31,7 +31,7 @@ func TestDomainGet(t *testing.T) { keeper, ctx := keepertest.RegistryKeeper(t) items := createNDomain(keeper, ctx, 10) for _, item := range items { - rst, found := keeper.GetDomain(ctx, + rst, found := keeper.GetSecondLevelDomain(ctx, item.Name, item.Parent, ) @@ -46,11 +46,11 @@ func TestDomainRemove(t *testing.T) { keeper, ctx := keepertest.RegistryKeeper(t) items := createNDomain(keeper, ctx, 10) for _, item := range items { - keeper.RemoveDomain(ctx, + keeper.RemoveSecondLevelDomain(ctx, item.Name, item.Parent, ) - _, found := keeper.GetDomain(ctx, + _, found := keeper.GetSecondLevelDomain(ctx, item.Name, item.Parent, ) @@ -63,6 +63,6 @@ func TestDomainGetAll(t *testing.T) { items := createNDomain(keeper, ctx, 10) require.ElementsMatch(t, nullify.Fill(items), - nullify.Fill(keeper.GetAllDomain(ctx)), + nullify.Fill(keeper.GetAllSecondLevelDomain(ctx)), ) } diff --git a/x/registry/keeper/setup_test.go b/x/registry/keeper/setup_test.go index 39a1ffa1..b47e1877 100644 --- a/x/registry/keeper/setup_test.go +++ b/x/registry/keeper/setup_test.go @@ -7,8 +7,8 @@ import ( "testing" "time" - epochstypes "github.com/mycel-domain/mycel/x/epochs/types" "github.com/mycel-domain/mycel/testutil" + epochstypes "github.com/mycel-domain/mycel/x/epochs/types" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/baseapp" diff --git a/x/registry/keeper/top_level_domain.go b/x/registry/keeper/top_level_domain.go new file mode 100644 index 00000000..7544f22b --- /dev/null +++ b/x/registry/keeper/top_level_domain.go @@ -0,0 +1,63 @@ +package keeper + +import ( + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/mycel-domain/mycel/x/registry/types" +) + +// SetTopLevelDomain set a specific topLevelDomain in the store from its index +func (k Keeper) SetTopLevelDomain(ctx sdk.Context, topLevelDomain types.TopLevelDomain) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.TopLevelDomainKeyPrefix)) + b := k.cdc.MustMarshal(&topLevelDomain) + store.Set(types.TopLevelDomainKey( + topLevelDomain.Name, + ), b) +} + +// GetTopLevelDomain returns a topLevelDomain from its index +func (k Keeper) GetTopLevelDomain( + ctx sdk.Context, + name string, + +) (val types.TopLevelDomain, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.TopLevelDomainKeyPrefix)) + + b := store.Get(types.TopLevelDomainKey( + name, + )) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +// RemoveTopLevelDomain removes a topLevelDomain from the store +func (k Keeper) RemoveTopLevelDomain( + ctx sdk.Context, + name string, + +) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.TopLevelDomainKeyPrefix)) + store.Delete(types.TopLevelDomainKey( + name, + )) +} + +// GetAllTopLevelDomain returns all topLevelDomain +func (k Keeper) GetAllTopLevelDomain(ctx sdk.Context) (list []types.TopLevelDomain) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.TopLevelDomainKeyPrefix)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.TopLevelDomain + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/x/registry/keeper/top_level_domain_test.go b/x/registry/keeper/top_level_domain_test.go new file mode 100644 index 00000000..728a02a6 --- /dev/null +++ b/x/registry/keeper/top_level_domain_test.go @@ -0,0 +1,63 @@ +package keeper_test + +import ( + "strconv" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + keepertest "github.com/mycel-domain/mycel/testutil/keeper" + "github.com/mycel-domain/mycel/testutil/nullify" + "github.com/mycel-domain/mycel/x/registry/keeper" + "github.com/mycel-domain/mycel/x/registry/types" + "github.com/stretchr/testify/require" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func createNTopLevelDomain(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.TopLevelDomain { + items := make([]types.TopLevelDomain, n) + for i := range items { + items[i].Name = strconv.Itoa(i) + + keeper.SetTopLevelDomain(ctx, items[i]) + } + return items +} + +func TestTopLevelDomainGet(t *testing.T) { + keeper, ctx := keepertest.RegistryKeeper(t) + items := createNTopLevelDomain(keeper, ctx, 10) + for _, item := range items { + rst, found := keeper.GetTopLevelDomain(ctx, + item.Name, + ) + require.True(t, found) + require.Equal(t, + nullify.Fill(&item), + nullify.Fill(&rst), + ) + } +} +func TestTopLevelDomainRemove(t *testing.T) { + keeper, ctx := keepertest.RegistryKeeper(t) + items := createNTopLevelDomain(keeper, ctx, 10) + for _, item := range items { + keeper.RemoveTopLevelDomain(ctx, + item.Name, + ) + _, found := keeper.GetTopLevelDomain(ctx, + item.Name, + ) + require.False(t, found) + } +} + +func TestTopLevelDomainGetAll(t *testing.T) { + keeper, ctx := keepertest.RegistryKeeper(t) + items := createNTopLevelDomain(keeper, ctx, 10) + require.ElementsMatch(t, + nullify.Fill(items), + nullify.Fill(keeper.GetAllTopLevelDomain(ctx)), + ) +} diff --git a/x/registry/keeper/validate_registration.go b/x/registry/keeper/validate_registration.go index cc95f9b6..36c59f8a 100644 --- a/x/registry/keeper/validate_registration.go +++ b/x/registry/keeper/validate_registration.go @@ -10,20 +10,20 @@ import ( ) // Get is domain already taken -func (k Keeper) GetIsDomainAlreadyTaken(ctx sdk.Context, domain types.Domain) (isDomainAlreadyTaken bool) { - _, isDomainAlreadyTaken = k.GetDomain(ctx, domain.Name, domain.Parent) +func (k Keeper) GetIsDomainAlreadyTaken(ctx sdk.Context, domain types.SecondLevelDomain) (isDomainAlreadyTaken bool) { + _, isDomainAlreadyTaken = k.GetSecondLevelDomain(ctx, domain.Name, domain.Parent) return isDomainAlreadyTaken } // Get is parent domain exist -func (k Keeper) GetIsParentDomainExist(ctx sdk.Context, domain types.Domain) (isParentDomainExist bool) { - name, parent := domain.ParseParent() - _, isParentDomainExist = k.GetDomain(ctx, name, parent) +func (k Keeper) GetIsParentDomainExist(ctx sdk.Context, domain types.SecondLevelDomain) (isParentDomainExist bool) { + parent := domain.ParseParent() + _, isParentDomainExist = k.GetTopLevelDomain(ctx, parent) return isParentDomainExist } // Validate TLD registration -func (k Keeper) ValidateRegisterTLD(ctx sdk.Context, domain types.Domain) (err error) { +func (k Keeper) ValidateRegisterTLD(ctx sdk.Context, domain types.SecondLevelDomain) (err error) { if domain.Parent != "" { err = sdkerrors.Wrapf(errors.New(domain.Parent), types.ErrParentDomainMustBeEmpty.Error()) @@ -33,7 +33,7 @@ func (k Keeper) ValidateRegisterTLD(ctx sdk.Context, domain types.Domain) (err e } // Validate SLD registration -func (k Keeper) ValidateRegisterSLD(ctx sdk.Context, domain types.Domain) (err error) { +func (k Keeper) ValidateRegisterSLD(ctx sdk.Context, domain types.SecondLevelDomain) (err error) { isParentDomainExist := k.GetIsParentDomainExist(ctx, domain) if !isParentDomainExist { err = sdkerrors.Wrapf(errors.New(domain.Parent), @@ -44,7 +44,7 @@ func (k Keeper) ValidateRegisterSLD(ctx sdk.Context, domain types.Domain) (err e } // Validate subdomain GetRegistrationFee -func (k Keeper) ValidateRegsiterSubdomain(ctx sdk.Context, domain types.Domain) (err error) { +func (k Keeper) ValidateRegsiterSubdomain(ctx sdk.Context, domain types.SecondLevelDomain) (err error) { isParentDomainExist := k.GetIsParentDomainExist(ctx, domain) if !isParentDomainExist { err = sdkerrors.Wrapf(errors.New(domain.Parent), @@ -53,8 +53,8 @@ func (k Keeper) ValidateRegsiterSubdomain(ctx sdk.Context, domain types.Domain) return err } -// Validate domain -func (k Keeper) ValidateDomain(ctx sdk.Context, domain types.Domain) (err error) { +// Validate second-level-domain +func (k Keeper) ValidateSecondLevelDomain(ctx sdk.Context, domain types.SecondLevelDomain) (err error) { // Type check err = domain.Validate() if err != nil { @@ -68,27 +68,19 @@ func (k Keeper) ValidateDomain(ctx sdk.Context, domain types.Domain) (err error) return err } - domainLevel := domain.GetDomainLevel() - switch domainLevel { - case 1: // TLD - // Validate TLD - err = k.ValidateRegisterTLD(ctx, domain) - if err != nil { - return err - } - case 2: // TLD - // Validate SLD - err = k.ValidateRegisterSLD(ctx, domain) - if err != nil { - return err - } - default: // Subdomain - // Validate Subdomain - err = k.ValidateRegsiterSubdomain(ctx, domain) - if err != nil { - return err - } + // Validate SLD + err = k.ValidateRegisterSLD(ctx, domain) + if err != nil { + return err } + // TODO: check is there any subdomain registration case? + // default: // Subdomain + // // Validate Subdomain + // err = k.ValidateRegsiterSubdomain(ctx, domain) + // if err != nil { + // return err + // } + // } return err } diff --git a/x/registry/module.go b/x/registry/module.go index 2d43515d..49d94117 100644 --- a/x/registry/module.go +++ b/x/registry/module.go @@ -93,9 +93,9 @@ func (AppModuleBasic) GetQueryCmd() *cobra.Command { type AppModule struct { AppModuleBasic - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper + keeper keeper.Keeper + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper } func NewAppModule( @@ -105,10 +105,10 @@ func NewAppModule( bankKeeper types.BankKeeper, ) AppModule { return AppModule{ - AppModuleBasic: NewAppModuleBasic(cdc), - keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, } } diff --git a/x/registry/types/errors.go b/x/registry/types/errors.go index 3388ea05..99e273e8 100644 --- a/x/registry/types/errors.go +++ b/x/registry/types/errors.go @@ -8,19 +8,19 @@ import ( // x/mycel module sentinel errors var ( - ErrSample = sdkerrors.Register(ModuleName, 1100, "sample error") - ErrDomainIsAlreadyTaken = sdkerrors.Register(ModuleName, 1101, "domain is already taken") - ErrInvalidDomainName = sdkerrors.Register(ModuleName, 1102, "invalid name") - ErrInvalidDomainParent = sdkerrors.Register(ModuleName, 1103, "invalid parent") - ErrDomainNotFound = sdkerrors.Register(ModuleName, 1104, "domain not found") - ErrInvalidWalletAddress = sdkerrors.Register(ModuleName, 1105, "invalid wallet address") - ErrInvalidWalletRecordType = sdkerrors.Register(ModuleName, 1106, "invalid wallet record type") - ErrInvalidDnsRecordValue = sdkerrors.Register(ModuleName, 1107, "invalid dns record value") - ErrInvalidDnsRecordType = sdkerrors.Register(ModuleName, 1108, "invalid dns record type") - ErrDomainNotOwned = sdkerrors.Register(ModuleName, 1109, "domain not owned by msg creator") - ErrParentDomainDoesNotExist = sdkerrors.Register(ModuleName, 1110, "parent domain does not exist") - ErrParentDomainMustBeEmpty = sdkerrors.Register(ModuleName, 1111, "parent domain must be empty") - ErrDomainNotRegistrable = sdkerrors.Register(ModuleName, 1112, "domain is not registrable") - ErrMaxSubdomainCountReached = sdkerrors.Register(ModuleName, 1113, "max subdomain count reached") + ErrSample = sdkerrors.Register(ModuleName, 1100, "sample error") + ErrDomainIsAlreadyTaken = sdkerrors.Register(ModuleName, 1101, "domain is already taken") + ErrInvalidDomainName = sdkerrors.Register(ModuleName, 1102, "invalid name") + ErrInvalidDomainParent = sdkerrors.Register(ModuleName, 1103, "invalid parent") + ErrDomainNotFound = sdkerrors.Register(ModuleName, 1104, "domain not found") + ErrInvalidWalletAddress = sdkerrors.Register(ModuleName, 1105, "invalid wallet address") + ErrInvalidWalletRecordType = sdkerrors.Register(ModuleName, 1106, "invalid wallet record type") + ErrInvalidDnsRecordValue = sdkerrors.Register(ModuleName, 1107, "invalid dns record value") + ErrInvalidDnsRecordType = sdkerrors.Register(ModuleName, 1108, "invalid dns record type") + ErrDomainNotOwned = sdkerrors.Register(ModuleName, 1109, "domain not owned by msg creator") + ErrParentDomainDoesNotExist = sdkerrors.Register(ModuleName, 1110, "parent domain does not exist") + ErrParentDomainMustBeEmpty = sdkerrors.Register(ModuleName, 1111, "parent domain must be empty") + ErrDomainNotRegistrable = sdkerrors.Register(ModuleName, 1112, "domain is not registrable") + ErrMaxSubdomainCountReached = sdkerrors.Register(ModuleName, 1113, "max subdomain count reached") ErrInvalidRegistrationPeriod = sdkerrors.Register(ModuleName, 1114, "invalid registration period") ) diff --git a/x/registry/types/events.go b/x/registry/types/events.go index 1b82c1c1..b5c62bbb 100644 --- a/x/registry/types/events.go +++ b/x/registry/types/events.go @@ -7,7 +7,6 @@ const ( AttributeRegisterDomainEventName = "name" AttributeRegisterDomainEventParent = "parent" AttributeRegisterDomainEventExpirationDate = "expiration-date" - AttributeRegisterDomainLevel = "domain-level" ) // Update wallet record event diff --git a/x/registry/types/expected_keepers.go b/x/registry/types/expected_keepers.go index e20b7666..c3347381 100644 --- a/x/registry/types/expected_keepers.go +++ b/x/registry/types/expected_keepers.go @@ -19,4 +19,3 @@ type BankKeeper interface { SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error } - diff --git a/x/registry/types/genesis.go b/x/registry/types/genesis.go index e1f1527f..80a7eb02 100644 --- a/x/registry/types/genesis.go +++ b/x/registry/types/genesis.go @@ -14,12 +14,12 @@ func GetDefaultTLDNames() []string { } // Get default TLDs -func GetDefaultTLDs() (defaultTLDs []Domain) { - defaultRegistrationConfig := GetDefaultSubdomainRegistrationConfig(3030) +func GetDefaultTLDs() (defaultTLDs []TopLevelDomain) { + defaultRegistrationConfig := GetDefaultSubdomainConfig(3030) for _, v := range GetDefaultTLDNames() { - defaultTLDs = append(defaultTLDs, Domain{ - Name: v, - SubdomainRegistrationConfig: &defaultRegistrationConfig, + defaultTLDs = append(defaultTLDs, TopLevelDomain{ + Name: v, + SubdomainConfig: &defaultRegistrationConfig, }) } return defaultTLDs @@ -28,8 +28,9 @@ func GetDefaultTLDs() (defaultTLDs []Domain) { // DefaultGenesis returns the default genesis state func DefaultGenesis() *GenesisState { return &GenesisState{ - Domains: GetDefaultTLDs(), - DomainOwnerships: []DomainOwnership{}, + TopLevelDomains: GetDefaultTLDs(), + SecondLevelDomains: []SecondLevelDomain{}, + DomainOwnerships: []DomainOwnership{}, // this line is used by starport scaffolding # genesis/types/default Params: DefaultParams(), } @@ -38,15 +39,25 @@ func DefaultGenesis() *GenesisState { // Validate performs basic genesis state validation returning an error upon any // failure. func (gs GenesisState) Validate() error { - // Check for duplicated index in domain - domainIndexMap := make(map[string]struct{}) + // Check for duplicated index in topLevelDomain + topLevelDomainIndexMap := make(map[string]struct{}) - for _, elem := range gs.Domains { - index := string(DomainKey(elem.Name, elem.Parent)) - if _, ok := domainIndexMap[index]; ok { - return fmt.Errorf("duplicated index for domain") + for _, elem := range gs.TopLevelDomains { + index := string(TopLevelDomainKey(elem.Name)) + if _, ok := topLevelDomainIndexMap[index]; ok { + return fmt.Errorf("duplicated index for topLevelDomain") } - domainIndexMap[index] = struct{}{} + topLevelDomainIndexMap[index] = struct{}{} + } + // Check for duplicated index in secondLevelDomain + secondLevelDomainIndexMap := make(map[string]struct{}) + + for _, elem := range gs.SecondLevelDomains { + index := string(SecondLevelDomainKey(elem.Name, elem.Parent)) + if _, ok := secondLevelDomainIndexMap[index]; ok { + return fmt.Errorf("duplicated index for secondLevelDomain") + } + secondLevelDomainIndexMap[index] = struct{}{} } // Check for duplicated index in domainOwnership domainOwnershipIndexMap := make(map[string]struct{}) diff --git a/x/registry/types/genesis.pb.go b/x/registry/types/genesis.pb.go index a1d81308..5ba353fd 100644 --- a/x/registry/types/genesis.pb.go +++ b/x/registry/types/genesis.pb.go @@ -25,9 +25,10 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the registry module's genesis state. type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - Domains []Domain `protobuf:"bytes,2,rep,name=domains,proto3" json:"domains"` - DomainOwnerships []DomainOwnership `protobuf:"bytes,3,rep,name=domainOwnerships,proto3" json:"domainOwnerships"` + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + TopLevelDomains []TopLevelDomain `protobuf:"bytes,2,rep,name=topLevelDomains,proto3" json:"topLevelDomains"` + SecondLevelDomains []SecondLevelDomain `protobuf:"bytes,3,rep,name=secondLevelDomains,proto3" json:"secondLevelDomains"` + DomainOwnerships []DomainOwnership `protobuf:"bytes,4,rep,name=domainOwnerships,proto3" json:"domainOwnerships"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -70,9 +71,16 @@ func (m *GenesisState) GetParams() Params { return Params{} } -func (m *GenesisState) GetDomains() []Domain { +func (m *GenesisState) GetTopLevelDomains() []TopLevelDomain { if m != nil { - return m.Domains + return m.TopLevelDomains + } + return nil +} + +func (m *GenesisState) GetSecondLevelDomains() []SecondLevelDomain { + if m != nil { + return m.SecondLevelDomains } return nil } @@ -91,24 +99,27 @@ func init() { func init() { proto.RegisterFile("mycel/registry/genesis.proto", fileDescriptor_4928ed81aada19cd) } var fileDescriptor_4928ed81aada19cd = []byte{ - // 259 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xc9, 0xad, 0x4c, 0x4e, - 0xcd, 0xd1, 0x2f, 0x4a, 0x4d, 0xcf, 0x2c, 0x2e, 0x29, 0xaa, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, - 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x03, 0xcb, 0xea, 0xc1, 0x64, 0xa5, - 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x52, 0xfa, 0x20, 0x16, 0x44, 0x95, 0x94, 0x34, 0x9a, 0x19, - 0x05, 0x89, 0x45, 0x89, 0xb9, 0xc5, 0x38, 0x24, 0x53, 0xf2, 0x73, 0x13, 0x33, 0xf3, 0xa0, 0x92, - 0xaa, 0x58, 0x25, 0xe3, 0xf3, 0xcb, 0xf3, 0x52, 0x8b, 0x8a, 0x33, 0x32, 0x0b, 0x20, 0xca, 0x94, - 0xce, 0x33, 0x72, 0xf1, 0xb8, 0x43, 0x1c, 0x16, 0x5c, 0x92, 0x58, 0x92, 0x2a, 0x64, 0xc2, 0xc5, - 0x06, 0xb1, 0x44, 0x82, 0x51, 0x81, 0x51, 0x83, 0xdb, 0x48, 0x4c, 0x0f, 0xd5, 0xa1, 0x7a, 0x01, - 0x60, 0x59, 0x27, 0x96, 0x13, 0xf7, 0xe4, 0x19, 0x82, 0xa0, 0x6a, 0x85, 0xcc, 0xb8, 0xd8, 0x21, - 0x16, 0x14, 0x4b, 0x30, 0x29, 0x30, 0x63, 0xd3, 0xe6, 0x02, 0x96, 0x86, 0x6a, 0x83, 0x29, 0x16, - 0x0a, 0xe4, 0x12, 0x80, 0x30, 0xfd, 0x61, 0xee, 0x2a, 0x96, 0x60, 0x06, 0x1b, 0x20, 0x8f, 0xdd, - 0x00, 0xb8, 0x3a, 0xa8, 0x49, 0x18, 0xda, 0x9d, 0x3c, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, - 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, - 0x58, 0x8e, 0x21, 0x4a, 0x2f, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, - 0x6c, 0xb8, 0x2e, 0x44, 0x33, 0x84, 0xa3, 0x5f, 0x81, 0x08, 0xac, 0x92, 0xca, 0x82, 0xd4, 0xe2, - 0x24, 0x36, 0x70, 0x10, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x4d, 0x8c, 0x31, 0xe7, 0xc9, - 0x01, 0x00, 0x00, + // 319 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xcf, 0x4a, 0xc3, 0x30, + 0x1c, 0xc7, 0xdb, 0x6d, 0xec, 0x90, 0x89, 0x4a, 0x10, 0x29, 0x55, 0xb2, 0x29, 0x08, 0xbd, 0x98, + 0xc2, 0xf4, 0x09, 0xc6, 0x40, 0x0f, 0xe2, 0xbf, 0x09, 0x82, 0x97, 0xd2, 0x75, 0xa1, 0x2b, 0xb4, + 0x4d, 0x68, 0xe2, 0x9f, 0xbe, 0x85, 0x8f, 0xe4, 0x71, 0xc7, 0x1d, 0x3d, 0x89, 0xb4, 0x2f, 0x22, + 0x4b, 0x32, 0xb0, 0xd9, 0x6e, 0x2d, 0xdf, 0xcf, 0xf7, 0x93, 0xfc, 0xf2, 0x03, 0xc7, 0x59, 0x19, + 0x91, 0xd4, 0x2f, 0x48, 0x9c, 0x70, 0x51, 0x94, 0x7e, 0x4c, 0x72, 0xc2, 0x13, 0x8e, 0x59, 0x41, + 0x05, 0x85, 0xbb, 0x32, 0xc5, 0xeb, 0xd4, 0x3d, 0x88, 0x69, 0x4c, 0x65, 0xe4, 0xaf, 0xbe, 0x14, + 0xe5, 0x1e, 0x19, 0x0e, 0x16, 0x16, 0x61, 0xa6, 0x15, 0xee, 0x99, 0x11, 0x0a, 0xca, 0x82, 0x94, + 0xbc, 0x91, 0x34, 0x98, 0xd1, 0x2c, 0x4c, 0x72, 0x8d, 0x79, 0x06, 0xc6, 0x49, 0x44, 0xf3, 0xd9, + 0x36, 0xd2, 0x14, 0xaa, 0x30, 0xa0, 0xef, 0x39, 0x29, 0xf8, 0x3c, 0x61, 0x0a, 0x3b, 0xfd, 0x6a, + 0x81, 0x9d, 0x2b, 0x35, 0xcc, 0x44, 0x84, 0x82, 0xc0, 0x4b, 0xd0, 0x55, 0x17, 0x73, 0xec, 0x81, + 0xed, 0xf5, 0x86, 0x87, 0xb8, 0x39, 0x1c, 0xbe, 0x97, 0xe9, 0xa8, 0xb3, 0xf8, 0xe9, 0x5b, 0x8f, + 0x9a, 0x85, 0xb7, 0x60, 0x4f, 0x50, 0x76, 0xb3, 0xba, 0xc6, 0x58, 0x1e, 0xc4, 0x9d, 0xd6, 0xa0, + 0xed, 0xf5, 0x86, 0xc8, 0xac, 0x3f, 0x35, 0x30, 0xad, 0x31, 0xcb, 0xf0, 0x19, 0x40, 0x35, 0x5a, + 0x43, 0xd9, 0x96, 0xca, 0x13, 0x53, 0x39, 0x31, 0x49, 0x6d, 0xdd, 0xa2, 0x80, 0x0f, 0x60, 0x5f, + 0xbd, 0xc4, 0xdd, 0xfa, 0x21, 0xb8, 0xd3, 0x91, 0xda, 0xbe, 0xa9, 0x1d, 0x37, 0x39, 0x2d, 0xdd, + 0xa8, 0x8f, 0xae, 0x17, 0x15, 0xb2, 0x97, 0x15, 0xb2, 0x7f, 0x2b, 0x64, 0x7f, 0xd6, 0xc8, 0x5a, + 0xd6, 0xc8, 0xfa, 0xae, 0x91, 0xf5, 0x82, 0xe3, 0x44, 0xcc, 0x5f, 0xa7, 0x38, 0xa2, 0x99, 0x2f, + 0xe5, 0xe7, 0xaa, 0xac, 0x7e, 0xfc, 0x8f, 0x7f, 0xeb, 0x2e, 0x19, 0xe1, 0xd3, 0xae, 0xdc, 0xc9, + 0xc5, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2c, 0x5e, 0xec, 0x64, 0x6e, 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -142,13 +153,27 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- + dAtA[i] = 0x22 + } + } + if len(m.SecondLevelDomains) > 0 { + for iNdEx := len(m.SecondLevelDomains) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.SecondLevelDomains[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x1a } } - if len(m.Domains) > 0 { - for iNdEx := len(m.Domains) - 1; iNdEx >= 0; iNdEx-- { + if len(m.TopLevelDomains) > 0 { + for iNdEx := len(m.TopLevelDomains) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Domains[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.TopLevelDomains[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -191,8 +216,14 @@ func (m *GenesisState) Size() (n int) { _ = l l = m.Params.Size() n += 1 + l + sovGenesis(uint64(l)) - if len(m.Domains) > 0 { - for _, e := range m.Domains { + if len(m.TopLevelDomains) > 0 { + for _, e := range m.TopLevelDomains { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.SecondLevelDomains) > 0 { + for _, e := range m.SecondLevelDomains { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } @@ -276,7 +307,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Domains", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TopLevelDomains", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -303,12 +334,46 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Domains = append(m.Domains, Domain{}) - if err := m.Domains[len(m.Domains)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.TopLevelDomains = append(m.TopLevelDomains, TopLevelDomain{}) + if err := m.TopLevelDomains[len(m.TopLevelDomains)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SecondLevelDomains", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SecondLevelDomains = append(m.SecondLevelDomains, SecondLevelDomain{}) + if err := m.SecondLevelDomains[len(m.SecondLevelDomains)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DomainOwnerships", wireType) } diff --git a/x/registry/types/genesis_test.go b/x/registry/types/genesis_test.go index 26a27641..232f0d17 100644 --- a/x/registry/types/genesis_test.go +++ b/x/registry/types/genesis_test.go @@ -22,7 +22,15 @@ func TestGenesisState_Validate(t *testing.T) { desc: "valid genesis state", genState: &types.GenesisState{ - Domains: []types.Domain{ + TopLevelDomains: []types.TopLevelDomain{ + { + Name: "0", + }, + { + Name: "1", + }, + }, + SecondLevelDomains: []types.SecondLevelDomain{ { Name: "0", Parent: "0", @@ -45,9 +53,23 @@ func TestGenesisState_Validate(t *testing.T) { valid: true, }, { - desc: "duplicated domain", + desc: "duplicated topLevelDomain", + genState: &types.GenesisState{ + TopLevelDomains: []types.TopLevelDomain{ + { + Name: "0", + }, + { + Name: "0", + }, + }, + }, + valid: false, + }, + { + desc: "duplicated secondLevelDomain", genState: &types.GenesisState{ - Domains: []types.Domain{ + SecondLevelDomains: []types.SecondLevelDomain{ { Name: "0", Parent: "0", diff --git a/x/registry/types/key_domain.go b/x/registry/types/key_second_level_domain.go similarity index 58% rename from x/registry/types/key_domain.go rename to x/registry/types/key_second_level_domain.go index 449a1ac0..34915497 100644 --- a/x/registry/types/key_domain.go +++ b/x/registry/types/key_second_level_domain.go @@ -5,12 +5,12 @@ import "encoding/binary" var _ binary.ByteOrder const ( - // DomainKeyPrefix is the prefix to retrieve all Domain - DomainKeyPrefix = "Domain/value/" + // SecondLevelDomainKeyPrefix is the prefix to retrieve all Domain + SecondLevelDomainKeyPrefix = "SecondLevelDomain/value/" ) -// DomainKey returns the store key to retrieve a Domain from the index fields -func DomainKey( +// SecondLevelDomainKey returns the store key to retrieve a Domain from the index fields +func SecondLevelDomainKey( name string, parent string, ) []byte { diff --git a/x/registry/types/key_top_level_domain.go b/x/registry/types/key_top_level_domain.go new file mode 100644 index 00000000..ceda54f8 --- /dev/null +++ b/x/registry/types/key_top_level_domain.go @@ -0,0 +1,23 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // TopLevelDomainKeyPrefix is the prefix to retrieve all TopLevelDomain + TopLevelDomainKeyPrefix = "TopLevelDomain/value/" +) + +// TopLevelDomainKey returns the store key to retrieve a TopLevelDomain from the index fields +func TopLevelDomainKey( + name string, +) []byte { + var key []byte + + nameBytes := []byte(name) + key = append(key, nameBytes...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/registry/types/query.pb.go b/x/registry/types/query.pb.go index 55cf8fc7..ba8083aa 100644 --- a/x/registry/types/query.pb.go +++ b/x/registry/types/query.pb.go @@ -114,23 +114,207 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } -type QueryGetDomainRequest struct { +type QueryGetTopLevelDomainRequest struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (m *QueryGetTopLevelDomainRequest) Reset() { *m = QueryGetTopLevelDomainRequest{} } +func (m *QueryGetTopLevelDomainRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetTopLevelDomainRequest) ProtoMessage() {} +func (*QueryGetTopLevelDomainRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_0f2c8f2d33ba1956, []int{2} +} +func (m *QueryGetTopLevelDomainRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetTopLevelDomainRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetTopLevelDomainRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetTopLevelDomainRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetTopLevelDomainRequest.Merge(m, src) +} +func (m *QueryGetTopLevelDomainRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetTopLevelDomainRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetTopLevelDomainRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetTopLevelDomainRequest proto.InternalMessageInfo + +func (m *QueryGetTopLevelDomainRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +type QueryGetTopLevelDomainResponse struct { + TopLevelDomain TopLevelDomain `protobuf:"bytes,1,opt,name=topLevelDomain,proto3" json:"topLevelDomain"` +} + +func (m *QueryGetTopLevelDomainResponse) Reset() { *m = QueryGetTopLevelDomainResponse{} } +func (m *QueryGetTopLevelDomainResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetTopLevelDomainResponse) ProtoMessage() {} +func (*QueryGetTopLevelDomainResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0f2c8f2d33ba1956, []int{3} +} +func (m *QueryGetTopLevelDomainResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetTopLevelDomainResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetTopLevelDomainResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetTopLevelDomainResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetTopLevelDomainResponse.Merge(m, src) +} +func (m *QueryGetTopLevelDomainResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetTopLevelDomainResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetTopLevelDomainResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetTopLevelDomainResponse proto.InternalMessageInfo + +func (m *QueryGetTopLevelDomainResponse) GetTopLevelDomain() TopLevelDomain { + if m != nil { + return m.TopLevelDomain + } + return TopLevelDomain{} +} + +type QueryAllTopLevelDomainRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllTopLevelDomainRequest) Reset() { *m = QueryAllTopLevelDomainRequest{} } +func (m *QueryAllTopLevelDomainRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllTopLevelDomainRequest) ProtoMessage() {} +func (*QueryAllTopLevelDomainRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_0f2c8f2d33ba1956, []int{4} +} +func (m *QueryAllTopLevelDomainRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllTopLevelDomainRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllTopLevelDomainRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAllTopLevelDomainRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllTopLevelDomainRequest.Merge(m, src) +} +func (m *QueryAllTopLevelDomainRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllTopLevelDomainRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllTopLevelDomainRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllTopLevelDomainRequest proto.InternalMessageInfo + +func (m *QueryAllTopLevelDomainRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryAllTopLevelDomainResponse struct { + TopLevelDomain []TopLevelDomain `protobuf:"bytes,1,rep,name=topLevelDomain,proto3" json:"topLevelDomain"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllTopLevelDomainResponse) Reset() { *m = QueryAllTopLevelDomainResponse{} } +func (m *QueryAllTopLevelDomainResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllTopLevelDomainResponse) ProtoMessage() {} +func (*QueryAllTopLevelDomainResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0f2c8f2d33ba1956, []int{5} +} +func (m *QueryAllTopLevelDomainResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllTopLevelDomainResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllTopLevelDomainResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAllTopLevelDomainResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllTopLevelDomainResponse.Merge(m, src) +} +func (m *QueryAllTopLevelDomainResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllTopLevelDomainResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllTopLevelDomainResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllTopLevelDomainResponse proto.InternalMessageInfo + +func (m *QueryAllTopLevelDomainResponse) GetTopLevelDomain() []TopLevelDomain { + if m != nil { + return m.TopLevelDomain + } + return nil +} + +func (m *QueryAllTopLevelDomainResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryGetSecondLevelDomainRequest struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Parent string `protobuf:"bytes,2,opt,name=parent,proto3" json:"parent,omitempty"` } -func (m *QueryGetDomainRequest) Reset() { *m = QueryGetDomainRequest{} } -func (m *QueryGetDomainRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGetDomainRequest) ProtoMessage() {} -func (*QueryGetDomainRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_0f2c8f2d33ba1956, []int{2} +func (m *QueryGetSecondLevelDomainRequest) Reset() { *m = QueryGetSecondLevelDomainRequest{} } +func (m *QueryGetSecondLevelDomainRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetSecondLevelDomainRequest) ProtoMessage() {} +func (*QueryGetSecondLevelDomainRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_0f2c8f2d33ba1956, []int{6} } -func (m *QueryGetDomainRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryGetSecondLevelDomainRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetDomainRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryGetSecondLevelDomainRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetDomainRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryGetSecondLevelDomainRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -140,48 +324,48 @@ func (m *QueryGetDomainRequest) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *QueryGetDomainRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetDomainRequest.Merge(m, src) +func (m *QueryGetSecondLevelDomainRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetSecondLevelDomainRequest.Merge(m, src) } -func (m *QueryGetDomainRequest) XXX_Size() int { +func (m *QueryGetSecondLevelDomainRequest) XXX_Size() int { return m.Size() } -func (m *QueryGetDomainRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetDomainRequest.DiscardUnknown(m) +func (m *QueryGetSecondLevelDomainRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetSecondLevelDomainRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetDomainRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryGetSecondLevelDomainRequest proto.InternalMessageInfo -func (m *QueryGetDomainRequest) GetName() string { +func (m *QueryGetSecondLevelDomainRequest) GetName() string { if m != nil { return m.Name } return "" } -func (m *QueryGetDomainRequest) GetParent() string { +func (m *QueryGetSecondLevelDomainRequest) GetParent() string { if m != nil { return m.Parent } return "" } -type QueryGetDomainResponse struct { - Domain Domain `protobuf:"bytes,1,opt,name=domain,proto3" json:"domain"` +type QueryGetSecondLevelDomainResponse struct { + SecondLevelDomain SecondLevelDomain `protobuf:"bytes,1,opt,name=secondLevelDomain,proto3" json:"secondLevelDomain"` } -func (m *QueryGetDomainResponse) Reset() { *m = QueryGetDomainResponse{} } -func (m *QueryGetDomainResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGetDomainResponse) ProtoMessage() {} -func (*QueryGetDomainResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_0f2c8f2d33ba1956, []int{3} +func (m *QueryGetSecondLevelDomainResponse) Reset() { *m = QueryGetSecondLevelDomainResponse{} } +func (m *QueryGetSecondLevelDomainResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetSecondLevelDomainResponse) ProtoMessage() {} +func (*QueryGetSecondLevelDomainResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0f2c8f2d33ba1956, []int{7} } -func (m *QueryGetDomainResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryGetSecondLevelDomainResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetDomainResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryGetSecondLevelDomainResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetDomainResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryGetSecondLevelDomainResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -191,41 +375,41 @@ func (m *QueryGetDomainResponse) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } -func (m *QueryGetDomainResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetDomainResponse.Merge(m, src) +func (m *QueryGetSecondLevelDomainResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetSecondLevelDomainResponse.Merge(m, src) } -func (m *QueryGetDomainResponse) XXX_Size() int { +func (m *QueryGetSecondLevelDomainResponse) XXX_Size() int { return m.Size() } -func (m *QueryGetDomainResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetDomainResponse.DiscardUnknown(m) +func (m *QueryGetSecondLevelDomainResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetSecondLevelDomainResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetDomainResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryGetSecondLevelDomainResponse proto.InternalMessageInfo -func (m *QueryGetDomainResponse) GetDomain() Domain { +func (m *QueryGetSecondLevelDomainResponse) GetSecondLevelDomain() SecondLevelDomain { if m != nil { - return m.Domain + return m.SecondLevelDomain } - return Domain{} + return SecondLevelDomain{} } -type QueryAllDomainRequest struct { +type QueryAllSecondLevelDomainRequest struct { Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryAllDomainRequest) Reset() { *m = QueryAllDomainRequest{} } -func (m *QueryAllDomainRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllDomainRequest) ProtoMessage() {} -func (*QueryAllDomainRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_0f2c8f2d33ba1956, []int{4} +func (m *QueryAllSecondLevelDomainRequest) Reset() { *m = QueryAllSecondLevelDomainRequest{} } +func (m *QueryAllSecondLevelDomainRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllSecondLevelDomainRequest) ProtoMessage() {} +func (*QueryAllSecondLevelDomainRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_0f2c8f2d33ba1956, []int{8} } -func (m *QueryAllDomainRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryAllSecondLevelDomainRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllDomainRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllSecondLevelDomainRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllDomainRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllSecondLevelDomainRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -235,42 +419,42 @@ func (m *QueryAllDomainRequest) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *QueryAllDomainRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllDomainRequest.Merge(m, src) +func (m *QueryAllSecondLevelDomainRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllSecondLevelDomainRequest.Merge(m, src) } -func (m *QueryAllDomainRequest) XXX_Size() int { +func (m *QueryAllSecondLevelDomainRequest) XXX_Size() int { return m.Size() } -func (m *QueryAllDomainRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllDomainRequest.DiscardUnknown(m) +func (m *QueryAllSecondLevelDomainRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllSecondLevelDomainRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllDomainRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryAllSecondLevelDomainRequest proto.InternalMessageInfo -func (m *QueryAllDomainRequest) GetPagination() *query.PageRequest { +func (m *QueryAllSecondLevelDomainRequest) GetPagination() *query.PageRequest { if m != nil { return m.Pagination } return nil } -type QueryAllDomainResponse struct { - Domain []Domain `protobuf:"bytes,1,rep,name=domain,proto3" json:"domain"` - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +type QueryAllSecondLevelDomainResponse struct { + SecondLevelDomain []SecondLevelDomain `protobuf:"bytes,1,rep,name=secondLevelDomain,proto3" json:"secondLevelDomain"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryAllDomainResponse) Reset() { *m = QueryAllDomainResponse{} } -func (m *QueryAllDomainResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllDomainResponse) ProtoMessage() {} -func (*QueryAllDomainResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_0f2c8f2d33ba1956, []int{5} +func (m *QueryAllSecondLevelDomainResponse) Reset() { *m = QueryAllSecondLevelDomainResponse{} } +func (m *QueryAllSecondLevelDomainResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllSecondLevelDomainResponse) ProtoMessage() {} +func (*QueryAllSecondLevelDomainResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0f2c8f2d33ba1956, []int{9} } -func (m *QueryAllDomainResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryAllSecondLevelDomainResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllDomainResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllSecondLevelDomainResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllDomainResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllSecondLevelDomainResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -280,26 +464,26 @@ func (m *QueryAllDomainResponse) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } -func (m *QueryAllDomainResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllDomainResponse.Merge(m, src) +func (m *QueryAllSecondLevelDomainResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllSecondLevelDomainResponse.Merge(m, src) } -func (m *QueryAllDomainResponse) XXX_Size() int { +func (m *QueryAllSecondLevelDomainResponse) XXX_Size() int { return m.Size() } -func (m *QueryAllDomainResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllDomainResponse.DiscardUnknown(m) +func (m *QueryAllSecondLevelDomainResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllSecondLevelDomainResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllDomainResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryAllSecondLevelDomainResponse proto.InternalMessageInfo -func (m *QueryAllDomainResponse) GetDomain() []Domain { +func (m *QueryAllSecondLevelDomainResponse) GetSecondLevelDomain() []SecondLevelDomain { if m != nil { - return m.Domain + return m.SecondLevelDomain } return nil } -func (m *QueryAllDomainResponse) GetPagination() *query.PageResponse { +func (m *QueryAllSecondLevelDomainResponse) GetPagination() *query.PageResponse { if m != nil { return m.Pagination } @@ -314,7 +498,7 @@ func (m *QueryGetDomainOwnershipRequest) Reset() { *m = QueryGetDomainOw func (m *QueryGetDomainOwnershipRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetDomainOwnershipRequest) ProtoMessage() {} func (*QueryGetDomainOwnershipRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_0f2c8f2d33ba1956, []int{6} + return fileDescriptor_0f2c8f2d33ba1956, []int{10} } func (m *QueryGetDomainOwnershipRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -358,7 +542,7 @@ func (m *QueryGetDomainOwnershipResponse) Reset() { *m = QueryGetDomainO func (m *QueryGetDomainOwnershipResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetDomainOwnershipResponse) ProtoMessage() {} func (*QueryGetDomainOwnershipResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_0f2c8f2d33ba1956, []int{7} + return fileDescriptor_0f2c8f2d33ba1956, []int{11} } func (m *QueryGetDomainOwnershipResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -402,7 +586,7 @@ func (m *QueryAllDomainOwnershipRequest) Reset() { *m = QueryAllDomainOw func (m *QueryAllDomainOwnershipRequest) String() string { return proto.CompactTextString(m) } func (*QueryAllDomainOwnershipRequest) ProtoMessage() {} func (*QueryAllDomainOwnershipRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_0f2c8f2d33ba1956, []int{8} + return fileDescriptor_0f2c8f2d33ba1956, []int{12} } func (m *QueryAllDomainOwnershipRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -447,7 +631,7 @@ func (m *QueryAllDomainOwnershipResponse) Reset() { *m = QueryAllDomainO func (m *QueryAllDomainOwnershipResponse) String() string { return proto.CompactTextString(m) } func (*QueryAllDomainOwnershipResponse) ProtoMessage() {} func (*QueryAllDomainOwnershipResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_0f2c8f2d33ba1956, []int{9} + return fileDescriptor_0f2c8f2d33ba1956, []int{13} } func (m *QueryAllDomainOwnershipResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -499,7 +683,7 @@ func (m *QueryDomainRegistrationFeeRequest) Reset() { *m = QueryDomainRe func (m *QueryDomainRegistrationFeeRequest) String() string { return proto.CompactTextString(m) } func (*QueryDomainRegistrationFeeRequest) ProtoMessage() {} func (*QueryDomainRegistrationFeeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_0f2c8f2d33ba1956, []int{10} + return fileDescriptor_0f2c8f2d33ba1956, []int{14} } func (m *QueryDomainRegistrationFeeRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -550,7 +734,7 @@ func (m *QueryDomainRegistrationFeeResponse) Reset() { *m = QueryDomainR func (m *QueryDomainRegistrationFeeResponse) String() string { return proto.CompactTextString(m) } func (*QueryDomainRegistrationFeeResponse) ProtoMessage() {} func (*QueryDomainRegistrationFeeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_0f2c8f2d33ba1956, []int{11} + return fileDescriptor_0f2c8f2d33ba1956, []int{15} } func (m *QueryDomainRegistrationFeeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -595,7 +779,7 @@ func (m *QueryIsRegistrableDomainRequest) Reset() { *m = QueryIsRegistra func (m *QueryIsRegistrableDomainRequest) String() string { return proto.CompactTextString(m) } func (*QueryIsRegistrableDomainRequest) ProtoMessage() {} func (*QueryIsRegistrableDomainRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_0f2c8f2d33ba1956, []int{12} + return fileDescriptor_0f2c8f2d33ba1956, []int{16} } func (m *QueryIsRegistrableDomainRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -647,7 +831,7 @@ func (m *QueryIsRegistrableDomainResponse) Reset() { *m = QueryIsRegistr func (m *QueryIsRegistrableDomainResponse) String() string { return proto.CompactTextString(m) } func (*QueryIsRegistrableDomainResponse) ProtoMessage() {} func (*QueryIsRegistrableDomainResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_0f2c8f2d33ba1956, []int{13} + return fileDescriptor_0f2c8f2d33ba1956, []int{17} } func (m *QueryIsRegistrableDomainResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -693,10 +877,14 @@ func (m *QueryIsRegistrableDomainResponse) GetErrorMessage() string { func init() { proto.RegisterType((*QueryParamsRequest)(nil), "mycel.registry.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "mycel.registry.QueryParamsResponse") - proto.RegisterType((*QueryGetDomainRequest)(nil), "mycel.registry.QueryGetDomainRequest") - proto.RegisterType((*QueryGetDomainResponse)(nil), "mycel.registry.QueryGetDomainResponse") - proto.RegisterType((*QueryAllDomainRequest)(nil), "mycel.registry.QueryAllDomainRequest") - proto.RegisterType((*QueryAllDomainResponse)(nil), "mycel.registry.QueryAllDomainResponse") + proto.RegisterType((*QueryGetTopLevelDomainRequest)(nil), "mycel.registry.QueryGetTopLevelDomainRequest") + proto.RegisterType((*QueryGetTopLevelDomainResponse)(nil), "mycel.registry.QueryGetTopLevelDomainResponse") + proto.RegisterType((*QueryAllTopLevelDomainRequest)(nil), "mycel.registry.QueryAllTopLevelDomainRequest") + proto.RegisterType((*QueryAllTopLevelDomainResponse)(nil), "mycel.registry.QueryAllTopLevelDomainResponse") + proto.RegisterType((*QueryGetSecondLevelDomainRequest)(nil), "mycel.registry.QueryGetSecondLevelDomainRequest") + proto.RegisterType((*QueryGetSecondLevelDomainResponse)(nil), "mycel.registry.QueryGetSecondLevelDomainResponse") + proto.RegisterType((*QueryAllSecondLevelDomainRequest)(nil), "mycel.registry.QueryAllSecondLevelDomainRequest") + proto.RegisterType((*QueryAllSecondLevelDomainResponse)(nil), "mycel.registry.QueryAllSecondLevelDomainResponse") proto.RegisterType((*QueryGetDomainOwnershipRequest)(nil), "mycel.registry.QueryGetDomainOwnershipRequest") proto.RegisterType((*QueryGetDomainOwnershipResponse)(nil), "mycel.registry.QueryGetDomainOwnershipResponse") proto.RegisterType((*QueryAllDomainOwnershipRequest)(nil), "mycel.registry.QueryAllDomainOwnershipRequest") @@ -710,58 +898,68 @@ func init() { func init() { proto.RegisterFile("mycel/registry/query.proto", fileDescriptor_0f2c8f2d33ba1956) } var fileDescriptor_0f2c8f2d33ba1956 = []byte{ - // 808 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0x3b, 0x4f, 0xdc, 0x4a, - 0x14, 0xc7, 0xd7, 0x3c, 0x56, 0x30, 0xf7, 0xea, 0x22, 0x0d, 0xb0, 0xe2, 0xfa, 0x5e, 0x19, 0x32, - 0x11, 0x04, 0x45, 0xc2, 0x93, 0x25, 0x21, 0xa9, 0x52, 0xf0, 0x10, 0xe4, 0x45, 0x20, 0xdb, 0x44, - 0x4a, 0xb3, 0xf2, 0x2e, 0x83, 0x71, 0xe4, 0xf5, 0x2c, 0x1e, 0x93, 0x64, 0x83, 0x68, 0xd2, 0xa4, - 0x8d, 0x94, 0x22, 0x5f, 0x22, 0x4d, 0xea, 0xb4, 0x29, 0x28, 0x52, 0x20, 0xa5, 0x49, 0x15, 0x45, - 0x90, 0x2f, 0x91, 0x2e, 0xf2, 0xcc, 0xf1, 0xb2, 0xf6, 0xda, 0x66, 0x41, 0x74, 0x5e, 0x9f, 0x33, - 0xff, 0xf3, 0x3b, 0xff, 0x99, 0x39, 0x5e, 0xa4, 0x37, 0x5a, 0x75, 0xe6, 0x52, 0x9f, 0xd9, 0x8e, - 0x08, 0xfc, 0x16, 0xdd, 0xdd, 0x63, 0x7e, 0xcb, 0x6c, 0xfa, 0x3c, 0xe0, 0xf8, 0x1f, 0x19, 0x33, - 0xa3, 0x98, 0x3e, 0x66, 0x73, 0x9b, 0xcb, 0x10, 0x0d, 0x9f, 0x54, 0x96, 0xfe, 0xbf, 0xcd, 0xb9, - 0xed, 0x32, 0x6a, 0x35, 0x1d, 0x6a, 0x79, 0x1e, 0x0f, 0xac, 0xc0, 0xe1, 0x9e, 0x80, 0xe8, 0xf5, - 0x3a, 0x17, 0x0d, 0x2e, 0x68, 0xcd, 0x12, 0x4c, 0x89, 0xd3, 0x17, 0xe5, 0x1a, 0x0b, 0xac, 0x32, - 0x6d, 0x5a, 0xb6, 0xe3, 0xc9, 0x64, 0xc8, 0xfd, 0x2f, 0xc1, 0xd2, 0xb4, 0x7c, 0xab, 0x21, 0x32, - 0x82, 0x5b, 0xbc, 0x61, 0x39, 0xd1, 0xca, 0xe9, 0xd4, 0x60, 0x95, 0xbf, 0xf4, 0x98, 0x2f, 0x76, - 0x9c, 0x26, 0xa4, 0x19, 0x9d, 0x30, 0x11, 0x46, 0x9d, 0x47, 0x32, 0x64, 0x0c, 0xe1, 0x27, 0x21, - 0xe2, 0xa6, 0x2c, 0x5c, 0x61, 0xbb, 0x7b, 0x4c, 0x04, 0xe4, 0x21, 0x1a, 0x8d, 0xbd, 0x15, 0x4d, - 0xee, 0x09, 0x86, 0x6f, 0xa1, 0xa2, 0x02, 0x9c, 0xd0, 0xa6, 0xb4, 0xd9, 0xbf, 0xe6, 0x4b, 0x66, - 0xdc, 0x2e, 0x53, 0xe5, 0x2f, 0x0d, 0x1c, 0xfe, 0x98, 0x2c, 0x54, 0x20, 0x97, 0x2c, 0xa3, 0x71, - 0x29, 0xb6, 0xc6, 0x82, 0x15, 0x09, 0x09, 0x55, 0x30, 0x46, 0x03, 0x9e, 0xd5, 0x60, 0x52, 0x6c, - 0xb8, 0x22, 0x9f, 0x71, 0x49, 0x96, 0x60, 0x5e, 0x30, 0xd1, 0x27, 0xdf, 0xc2, 0x2f, 0xf2, 0x18, - 0x95, 0x92, 0x22, 0xa7, 0x50, 0xaa, 0xf7, 0x2c, 0x28, 0x95, 0x1f, 0x41, 0xa9, 0x5c, 0x52, 0x05, - 0xa8, 0x45, 0xd7, 0x8d, 0x43, 0xad, 0x22, 0x74, 0xba, 0x4b, 0x20, 0x39, 0x63, 0x2a, 0x17, 0xcd, - 0xd0, 0x45, 0x53, 0x9d, 0x17, 0xf0, 0xd2, 0xdc, 0xb4, 0x6c, 0x06, 0x6b, 0x2b, 0x1d, 0x2b, 0xc9, - 0x07, 0x0d, 0x88, 0x3b, 0x2a, 0xa4, 0x10, 0xf7, 0xf7, 0x4a, 0x8c, 0xd7, 0x62, 0x60, 0x7d, 0x12, - 0xec, 0xda, 0x99, 0x60, 0xaa, 0x64, 0x8c, 0xec, 0x36, 0x32, 0xe2, 0x56, 0x6e, 0x44, 0x67, 0x26, - 0xf2, 0x60, 0x0c, 0x0d, 0xca, 0x73, 0x04, 0x3b, 0xa3, 0x7e, 0x10, 0x1f, 0x4d, 0x66, 0xae, 0x83, - 0xce, 0x36, 0xd0, 0xc8, 0x56, 0x3c, 0x04, 0x0e, 0x4e, 0xa6, 0xb7, 0xd8, 0x4e, 0x83, 0x5e, 0x93, - 0xab, 0xc9, 0x0e, 0xb0, 0xb6, 0x4d, 0xec, 0x62, 0xbd, 0xac, 0xfd, 0xfa, 0xac, 0x41, 0x7b, 0x69, - 0xa5, 0xf2, 0xda, 0xeb, 0xbf, 0x78, 0x7b, 0x97, 0xb7, 0xa7, 0x1b, 0xe8, 0x8a, 0x84, 0x8f, 0x4e, - 0x9a, 0xc4, 0x90, 0xa1, 0x55, 0xc6, 0x2e, 0x72, 0xdf, 0x9e, 0x22, 0x92, 0x27, 0x08, 0x86, 0x94, - 0x51, 0xff, 0x36, 0x63, 0xe0, 0xfa, 0xbf, 0x31, 0xf0, 0x08, 0x79, 0x99, 0xb7, 0x4f, 0x72, 0x98, - 0x4b, 0xd6, 0xc1, 0xe6, 0xfb, 0x22, 0x12, 0xad, 0xb9, 0xec, 0xe2, 0x73, 0xe1, 0x39, 0x9a, 0xca, - 0x96, 0x03, 0x4a, 0x82, 0xfe, 0x76, 0xc2, 0x30, 0x44, 0xa5, 0xee, 0x50, 0x25, 0xf6, 0x2e, 0xcc, - 0x61, 0xbe, 0xcf, 0xfd, 0x75, 0x26, 0x84, 0x65, 0x33, 0xa8, 0x12, 0x7b, 0x37, 0xff, 0x7b, 0x08, - 0x0d, 0xca, 0x62, 0x78, 0x17, 0x15, 0xd5, 0xa8, 0xc3, 0x24, 0xb9, 0xf3, 0xdd, 0xd3, 0x54, 0xbf, - 0x9a, 0x9b, 0xa3, 0x20, 0x89, 0xf1, 0xe6, 0xdb, 0xaf, 0xf7, 0x7d, 0x13, 0xb8, 0x44, 0x53, 0x3f, - 0x09, 0xf8, 0xad, 0x86, 0x8a, 0xaa, 0x2f, 0x3c, 0x9d, 0xaa, 0x97, 0x1c, 0xaf, 0xfa, 0xcc, 0x59, - 0x69, 0x50, 0xd9, 0x94, 0x95, 0x67, 0xf1, 0x0c, 0x4d, 0xfd, 0xa4, 0xd0, 0xfd, 0x70, 0x03, 0x0e, - 0xe8, 0xbe, 0x72, 0xfc, 0x00, 0xbf, 0x46, 0xc3, 0x4a, 0x61, 0xd1, 0x75, 0x33, 0x58, 0x92, 0x53, - 0x35, 0x83, 0xa5, 0x6b, 0x34, 0x66, 0xbb, 0x00, 0x43, 0xf0, 0x93, 0x86, 0x46, 0x12, 0x77, 0x0b, - 0x9b, 0xf9, 0x7d, 0x26, 0x27, 0x86, 0x4e, 0x7b, 0xce, 0x07, 0xa8, 0xbb, 0x12, 0xea, 0x0e, 0x5e, - 0x50, 0x50, 0x73, 0xe0, 0xcb, 0x19, 0x1f, 0x60, 0xba, 0x2f, 0x1f, 0x0f, 0xf0, 0x47, 0x0d, 0xe1, - 0x84, 0x74, 0xe8, 0x9c, 0x99, 0x6f, 0x49, 0x8f, 0xd8, 0xd9, 0xd3, 0x8a, 0x2c, 0x48, 0x6c, 0x8a, - 0xe7, 0xce, 0x85, 0x8d, 0xbf, 0x6a, 0x68, 0x3c, 0xf5, 0xd6, 0xe3, 0x72, 0x2a, 0x41, 0xde, 0xc8, - 0xd1, 0xe7, 0xcf, 0xb3, 0x04, 0xb8, 0x1f, 0x49, 0xee, 0x55, 0xbc, 0xd2, 0x0b, 0xb7, 0xdf, 0x21, - 0x52, 0xdd, 0x66, 0xac, 0xeb, 0xb4, 0x7e, 0xd1, 0xd0, 0x68, 0xca, 0x70, 0xc0, 0xe9, 0x76, 0x66, - 0x4f, 0x25, 0xfd, 0x46, 0xef, 0x0b, 0xa0, 0x91, 0x07, 0xb2, 0x91, 0x15, 0xbc, 0x94, 0xdb, 0x88, - 0x23, 0xda, 0x4d, 0xd4, 0x5c, 0x56, 0x4d, 0xbf, 0x74, 0x4b, 0xf7, 0x0e, 0x8f, 0x0d, 0xed, 0xe8, - 0xd8, 0xd0, 0x7e, 0x1e, 0x1b, 0xda, 0xbb, 0x13, 0xa3, 0x70, 0x74, 0x62, 0x14, 0xbe, 0x9f, 0x18, - 0x85, 0x67, 0xa6, 0xed, 0x04, 0x3b, 0x7b, 0x35, 0xb3, 0xce, 0x1b, 0x69, 0x75, 0x5e, 0x9d, 0x56, - 0x0a, 0x5a, 0x4d, 0x26, 0x6a, 0x45, 0xf9, 0xc7, 0xef, 0xe6, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x46, 0xc0, 0x0f, 0x8d, 0x07, 0x0b, 0x00, 0x00, + // 966 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x97, 0xcf, 0x6f, 0xdc, 0x44, + 0x14, 0xc7, 0x77, 0xba, 0x6d, 0x44, 0x87, 0x2a, 0x55, 0xa6, 0x4b, 0x54, 0x0c, 0x38, 0xed, 0x54, + 0x85, 0x0a, 0x14, 0x4f, 0x36, 0x69, 0xca, 0x01, 0x38, 0x24, 0x44, 0x29, 0x3f, 0x52, 0x52, 0x16, + 0x10, 0x12, 0x97, 0x95, 0x77, 0x33, 0x75, 0x8c, 0xbc, 0x1e, 0xc7, 0xe3, 0x14, 0x96, 0x28, 0x17, + 0xfe, 0x02, 0x24, 0xfe, 0x09, 0x90, 0xe0, 0x00, 0x12, 0xe2, 0xc0, 0x11, 0x0e, 0x3d, 0x70, 0x88, + 0xc4, 0x85, 0x13, 0x42, 0x09, 0x7f, 0x08, 0xf2, 0xf8, 0x39, 0x59, 0xcf, 0x7a, 0x9c, 0xdd, 0xed, + 0xde, 0xbc, 0x7e, 0x6f, 0xde, 0x7c, 0xbe, 0xef, 0xbd, 0x99, 0xe7, 0xc5, 0x56, 0xaf, 0xdf, 0xe5, + 0x01, 0x8b, 0xb9, 0xe7, 0xcb, 0x24, 0xee, 0xb3, 0xbd, 0x7d, 0x1e, 0xf7, 0x9d, 0x28, 0x16, 0x89, + 0x20, 0xb3, 0xca, 0xe6, 0xe4, 0x36, 0xab, 0xe1, 0x09, 0x4f, 0x28, 0x13, 0x4b, 0x9f, 0x32, 0x2f, + 0xeb, 0x45, 0x4f, 0x08, 0x2f, 0xe0, 0xcc, 0x8d, 0x7c, 0xe6, 0x86, 0xa1, 0x48, 0xdc, 0xc4, 0x17, + 0xa1, 0x04, 0xeb, 0xab, 0x5d, 0x21, 0x7b, 0x42, 0xb2, 0x8e, 0x2b, 0x79, 0x16, 0x9c, 0x3d, 0x6e, + 0x76, 0x78, 0xe2, 0x36, 0x59, 0xe4, 0x7a, 0x7e, 0xa8, 0x9c, 0xc1, 0xf7, 0x05, 0x8d, 0x25, 0x72, + 0x63, 0xb7, 0x97, 0x07, 0xba, 0xad, 0x19, 0x13, 0x11, 0xb5, 0x03, 0xfe, 0x98, 0x07, 0xed, 0x1d, + 0xd1, 0x73, 0xfd, 0x3c, 0xc6, 0x1d, 0xcd, 0x4d, 0xf2, 0xae, 0x08, 0x77, 0xca, 0x3c, 0xf5, 0x80, + 0x99, 0xb1, 0x2d, 0xbe, 0x08, 0x79, 0x2c, 0x77, 0xfd, 0x08, 0xdc, 0xec, 0x41, 0x01, 0x39, 0x7a, + 0x57, 0xe4, 0x61, 0x68, 0x03, 0x93, 0x0f, 0x53, 0x59, 0x0f, 0x15, 0x6c, 0x8b, 0xef, 0xed, 0x73, + 0x99, 0xd0, 0xf7, 0xf1, 0xb5, 0xc2, 0x5b, 0x19, 0x89, 0x50, 0x72, 0x72, 0x17, 0xcf, 0x64, 0xa2, + 0xae, 0xa3, 0x1b, 0xe8, 0xce, 0xb3, 0xcb, 0xf3, 0x4e, 0x31, 0xc5, 0x4e, 0xe6, 0xbf, 0x7e, 0xf1, + 0xc9, 0x3f, 0x0b, 0xb5, 0x16, 0xf8, 0xd2, 0x15, 0xfc, 0x92, 0x0a, 0x76, 0x9f, 0x27, 0x1f, 0x8b, + 0x68, 0x2b, 0x95, 0xb2, 0xa1, 0x60, 0x61, 0x37, 0x42, 0xf0, 0xc5, 0xd0, 0xed, 0x71, 0x15, 0xf4, + 0x72, 0x4b, 0x3d, 0xd3, 0x10, 0xdb, 0xa6, 0x45, 0x00, 0xb3, 0x85, 0x67, 0x93, 0x82, 0x05, 0xa0, + 0x6c, 0x1d, 0xaa, 0xb8, 0x1e, 0xe0, 0xb4, 0xb5, 0xd4, 0x03, 0xc8, 0xb5, 0x20, 0x28, 0x87, 0xdc, + 0xc4, 0xf8, 0xac, 0xe2, 0xb0, 0xd5, 0xcb, 0x4e, 0x96, 0x5d, 0x27, 0xcd, 0xae, 0x93, 0xf5, 0x1e, + 0xe4, 0xd8, 0x79, 0xe8, 0x7a, 0x1c, 0xd6, 0xb6, 0x06, 0x56, 0xd2, 0x5f, 0x11, 0x28, 0x2b, 0xd9, + 0xa9, 0x42, 0x59, 0x7d, 0x52, 0x65, 0xe4, 0x7e, 0x01, 0xfc, 0x82, 0x02, 0x7f, 0xe5, 0x5c, 0xf0, + 0x0c, 0xa5, 0x40, 0xfe, 0x01, 0xbe, 0x91, 0x97, 0xe4, 0x23, 0xd5, 0x96, 0xa3, 0x95, 0x92, 0xcc, + 0xab, 0xae, 0xe1, 0x61, 0xa2, 0x36, 0xbf, 0xdc, 0x82, 0x5f, 0xf4, 0x2b, 0x7c, 0xb3, 0x22, 0x1e, + 0xe4, 0xe2, 0x13, 0x3c, 0x27, 0x75, 0x23, 0x64, 0xff, 0xa6, 0x9e, 0x8e, 0xa1, 0x28, 0x90, 0x91, + 0xe1, 0x08, 0xf4, 0x73, 0xd0, 0xb2, 0x16, 0x04, 0x46, 0x2d, 0xd3, 0xaa, 0xf8, 0xef, 0x08, 0x84, + 0x96, 0x6f, 0x56, 0x2d, 0xb4, 0xfe, 0x74, 0x42, 0xa7, 0x57, 0xfd, 0x7b, 0x67, 0x07, 0x32, 0x0b, + 0xbd, 0x9d, 0xdf, 0x34, 0x79, 0xbe, 0x1a, 0xf8, 0x92, 0xba, 0x7d, 0xa0, 0xf8, 0xd9, 0x0f, 0x1a, + 0xe3, 0x05, 0xe3, 0x3a, 0x90, 0xbe, 0x8d, 0xaf, 0xee, 0x14, 0x4d, 0x90, 0xed, 0x05, 0x5d, 0xb8, + 0x16, 0x01, 0x64, 0xeb, 0xab, 0xe9, 0xee, 0xd9, 0x11, 0x33, 0xb0, 0x4e, 0xab, 0xb6, 0xbf, 0x21, + 0x90, 0x57, 0xb6, 0x55, 0x95, 0xbc, 0xfa, 0xe4, 0xf2, 0xa6, 0x57, 0xd3, 0x6d, 0x68, 0xcc, 0xbc, + 0x15, 0x15, 0x86, 0x32, 0x6d, 0x72, 0x3e, 0xc9, 0x91, 0xfe, 0x14, 0xd3, 0xaa, 0x80, 0x90, 0x90, + 0x26, 0xae, 0x3f, 0xe2, 0x1c, 0xb2, 0xfe, 0x7c, 0x01, 0x3c, 0x47, 0x7e, 0x5b, 0x9c, 0x36, 0x75, + 0xea, 0x4b, 0x1f, 0x40, 0x9a, 0xdf, 0x95, 0x79, 0xd0, 0x4e, 0xc0, 0x27, 0xbf, 0x7a, 0xf2, 0xe3, + 0x5f, 0x1a, 0x0e, 0x28, 0x29, 0xbe, 0xe2, 0xa7, 0x66, 0xb0, 0xaa, 0xb8, 0xcf, 0xb4, 0x0a, 0xef, + 0x52, 0x1f, 0x1e, 0xc7, 0x22, 0x7e, 0xc0, 0xa5, 0x74, 0x3d, 0x0e, 0xbb, 0x14, 0xde, 0x2d, 0xff, + 0x7c, 0x05, 0x5f, 0x52, 0x9b, 0x91, 0x3d, 0x3c, 0x93, 0x0d, 0x48, 0x42, 0xf5, 0xca, 0x0f, 0xcf, + 0x60, 0xeb, 0x56, 0xa5, 0x4f, 0x06, 0x49, 0xed, 0xaf, 0xff, 0xfa, 0xef, 0xdb, 0x0b, 0xd7, 0xc9, + 0x3c, 0x2b, 0xfd, 0xf8, 0x20, 0x3f, 0x22, 0x3c, 0x5b, 0x9c, 0x12, 0x64, 0xb1, 0x34, 0xae, 0x69, + 0x38, 0x5b, 0xce, 0xa8, 0xee, 0x40, 0xf4, 0xa6, 0x22, 0xba, 0x47, 0xee, 0x66, 0x44, 0x8b, 0x59, + 0xf3, 0xb2, 0x73, 0x3e, 0x7f, 0xd8, 0x41, 0x5a, 0xaf, 0x43, 0xf2, 0x3d, 0xc2, 0x73, 0xc5, 0xc0, + 0x6b, 0x41, 0x60, 0x40, 0x36, 0x8d, 0x6a, 0x03, 0xb2, 0x71, 0xde, 0xd2, 0x55, 0x85, 0xcc, 0xc8, + 0xe2, 0x58, 0xc8, 0xe4, 0x17, 0x84, 0xe7, 0x86, 0x6e, 0x62, 0xb2, 0x64, 0xca, 0x97, 0x69, 0xce, + 0x58, 0xcd, 0x31, 0x56, 0x00, 0xf1, 0x1b, 0x8a, 0x78, 0x95, 0xac, 0xb0, 0xf3, 0xbf, 0x17, 0x21, + 0xb5, 0xec, 0x20, 0xeb, 0xfd, 0x43, 0xf2, 0x1d, 0xc2, 0x8d, 0xa1, 0xd0, 0x69, 0x9a, 0x97, 0x4c, + 0x79, 0x1b, 0x13, 0xbd, 0x6a, 0xce, 0xd1, 0xd7, 0x14, 0xfa, 0x6d, 0x72, 0x6b, 0x04, 0x74, 0xf2, + 0x13, 0xc2, 0x57, 0xb5, 0x4b, 0x91, 0x18, 0x1b, 0xb2, 0xfc, 0xaa, 0xb7, 0xd8, 0xc8, 0xfe, 0x40, + 0xf8, 0x96, 0x22, 0x7c, 0x9d, 0xac, 0x56, 0xb6, 0x83, 0xfe, 0xbd, 0xcd, 0x0e, 0xd4, 0xe3, 0x21, + 0xf9, 0x01, 0x61, 0xa2, 0x85, 0x4e, 0x93, 0x6b, 0x6c, 0xca, 0xb1, 0xb0, 0xcd, 0x63, 0x66, 0xc4, + 0x2e, 0xd6, 0xb1, 0xc9, 0x9f, 0x08, 0x3f, 0x57, 0x7a, 0x5d, 0x93, 0xf2, 0xe2, 0x56, 0xcd, 0x0a, + 0x6b, 0x79, 0x9c, 0x25, 0xc0, 0xbd, 0xa5, 0xb8, 0x37, 0xc9, 0xc6, 0x28, 0xdc, 0xf1, 0x40, 0x90, + 0xf6, 0x23, 0xce, 0x87, 0x9a, 0xfb, 0x0f, 0x84, 0xaf, 0x95, 0xdc, 0xea, 0xa4, 0x3c, 0x9d, 0xe6, + 0x71, 0x62, 0x2d, 0x8d, 0xbe, 0x00, 0x84, 0xbc, 0xa7, 0x84, 0x6c, 0x90, 0xf5, 0x4a, 0x21, 0xbe, + 0x3c, 0x15, 0xd1, 0x09, 0xb8, 0xe1, 0x8c, 0xae, 0xbf, 0xf3, 0xe4, 0xd8, 0x46, 0x47, 0xc7, 0x36, + 0xfa, 0xf7, 0xd8, 0x46, 0xdf, 0x9c, 0xd8, 0xb5, 0xa3, 0x13, 0xbb, 0xf6, 0xf7, 0x89, 0x5d, 0xfb, + 0xcc, 0xf1, 0xfc, 0x64, 0x77, 0xbf, 0xe3, 0x74, 0x45, 0xaf, 0x6c, 0x9f, 0x2f, 0x07, 0x2e, 0xac, + 0x7e, 0xc4, 0x65, 0x67, 0x46, 0xfd, 0xcf, 0x5b, 0xf9, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x12, 0xa4, + 0x1b, 0x47, 0x2a, 0x0f, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -778,9 +976,12 @@ const _ = grpc.SupportPackageIsVersion4 type QueryClient interface { // Parameters queries the parameters of the module. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // Queries a list of Domain items. - Domain(ctx context.Context, in *QueryGetDomainRequest, opts ...grpc.CallOption) (*QueryGetDomainResponse, error) - DomainAll(ctx context.Context, in *QueryAllDomainRequest, opts ...grpc.CallOption) (*QueryAllDomainResponse, error) + // Queries a list of TopLevelDomain items. + TopLevelDomain(ctx context.Context, in *QueryGetTopLevelDomainRequest, opts ...grpc.CallOption) (*QueryGetTopLevelDomainResponse, error) + TopLevelDomainAll(ctx context.Context, in *QueryAllTopLevelDomainRequest, opts ...grpc.CallOption) (*QueryAllTopLevelDomainResponse, error) + // Queries a list of SecondLevelDomain items. + SecondLevelDomain(ctx context.Context, in *QueryGetSecondLevelDomainRequest, opts ...grpc.CallOption) (*QueryGetSecondLevelDomainResponse, error) + SecondLevelDomainAll(ctx context.Context, in *QueryAllSecondLevelDomainRequest, opts ...grpc.CallOption) (*QueryAllSecondLevelDomainResponse, error) // Queries a list of DomainOwnership items. DomainOwnership(ctx context.Context, in *QueryGetDomainOwnershipRequest, opts ...grpc.CallOption) (*QueryGetDomainOwnershipResponse, error) DomainOwnershipAll(ctx context.Context, in *QueryAllDomainOwnershipRequest, opts ...grpc.CallOption) (*QueryAllDomainOwnershipResponse, error) @@ -807,18 +1008,36 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . return out, nil } -func (c *queryClient) Domain(ctx context.Context, in *QueryGetDomainRequest, opts ...grpc.CallOption) (*QueryGetDomainResponse, error) { - out := new(QueryGetDomainResponse) - err := c.cc.Invoke(ctx, "/mycel.registry.Query/Domain", in, out, opts...) +func (c *queryClient) TopLevelDomain(ctx context.Context, in *QueryGetTopLevelDomainRequest, opts ...grpc.CallOption) (*QueryGetTopLevelDomainResponse, error) { + out := new(QueryGetTopLevelDomainResponse) + err := c.cc.Invoke(ctx, "/mycel.registry.Query/TopLevelDomain", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) TopLevelDomainAll(ctx context.Context, in *QueryAllTopLevelDomainRequest, opts ...grpc.CallOption) (*QueryAllTopLevelDomainResponse, error) { + out := new(QueryAllTopLevelDomainResponse) + err := c.cc.Invoke(ctx, "/mycel.registry.Query/TopLevelDomainAll", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) SecondLevelDomain(ctx context.Context, in *QueryGetSecondLevelDomainRequest, opts ...grpc.CallOption) (*QueryGetSecondLevelDomainResponse, error) { + out := new(QueryGetSecondLevelDomainResponse) + err := c.cc.Invoke(ctx, "/mycel.registry.Query/SecondLevelDomain", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryClient) DomainAll(ctx context.Context, in *QueryAllDomainRequest, opts ...grpc.CallOption) (*QueryAllDomainResponse, error) { - out := new(QueryAllDomainResponse) - err := c.cc.Invoke(ctx, "/mycel.registry.Query/DomainAll", in, out, opts...) +func (c *queryClient) SecondLevelDomainAll(ctx context.Context, in *QueryAllSecondLevelDomainRequest, opts ...grpc.CallOption) (*QueryAllSecondLevelDomainResponse, error) { + out := new(QueryAllSecondLevelDomainResponse) + err := c.cc.Invoke(ctx, "/mycel.registry.Query/SecondLevelDomainAll", in, out, opts...) if err != nil { return nil, err } @@ -865,9 +1084,12 @@ func (c *queryClient) IsRegistrableDomain(ctx context.Context, in *QueryIsRegist type QueryServer interface { // Parameters queries the parameters of the module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // Queries a list of Domain items. - Domain(context.Context, *QueryGetDomainRequest) (*QueryGetDomainResponse, error) - DomainAll(context.Context, *QueryAllDomainRequest) (*QueryAllDomainResponse, error) + // Queries a list of TopLevelDomain items. + TopLevelDomain(context.Context, *QueryGetTopLevelDomainRequest) (*QueryGetTopLevelDomainResponse, error) + TopLevelDomainAll(context.Context, *QueryAllTopLevelDomainRequest) (*QueryAllTopLevelDomainResponse, error) + // Queries a list of SecondLevelDomain items. + SecondLevelDomain(context.Context, *QueryGetSecondLevelDomainRequest) (*QueryGetSecondLevelDomainResponse, error) + SecondLevelDomainAll(context.Context, *QueryAllSecondLevelDomainRequest) (*QueryAllSecondLevelDomainResponse, error) // Queries a list of DomainOwnership items. DomainOwnership(context.Context, *QueryGetDomainOwnershipRequest) (*QueryGetDomainOwnershipResponse, error) DomainOwnershipAll(context.Context, *QueryAllDomainOwnershipRequest) (*QueryAllDomainOwnershipResponse, error) @@ -884,11 +1106,17 @@ type UnimplementedQueryServer struct { func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } -func (*UnimplementedQueryServer) Domain(ctx context.Context, req *QueryGetDomainRequest) (*QueryGetDomainResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Domain not implemented") +func (*UnimplementedQueryServer) TopLevelDomain(ctx context.Context, req *QueryGetTopLevelDomainRequest) (*QueryGetTopLevelDomainResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TopLevelDomain not implemented") } -func (*UnimplementedQueryServer) DomainAll(ctx context.Context, req *QueryAllDomainRequest) (*QueryAllDomainResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DomainAll not implemented") +func (*UnimplementedQueryServer) TopLevelDomainAll(ctx context.Context, req *QueryAllTopLevelDomainRequest) (*QueryAllTopLevelDomainResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TopLevelDomainAll not implemented") +} +func (*UnimplementedQueryServer) SecondLevelDomain(ctx context.Context, req *QueryGetSecondLevelDomainRequest) (*QueryGetSecondLevelDomainResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SecondLevelDomain not implemented") +} +func (*UnimplementedQueryServer) SecondLevelDomainAll(ctx context.Context, req *QueryAllSecondLevelDomainRequest) (*QueryAllSecondLevelDomainResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SecondLevelDomainAll not implemented") } func (*UnimplementedQueryServer) DomainOwnership(ctx context.Context, req *QueryGetDomainOwnershipRequest) (*QueryGetDomainOwnershipResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DomainOwnership not implemented") @@ -925,38 +1153,74 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } -func _Query_Domain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetDomainRequest) +func _Query_TopLevelDomain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetTopLevelDomainRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TopLevelDomain(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/mycel.registry.Query/TopLevelDomain", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TopLevelDomain(ctx, req.(*QueryGetTopLevelDomainRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_TopLevelDomainAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllTopLevelDomainRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TopLevelDomainAll(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/mycel.registry.Query/TopLevelDomainAll", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TopLevelDomainAll(ctx, req.(*QueryAllTopLevelDomainRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_SecondLevelDomain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetSecondLevelDomainRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).Domain(ctx, in) + return srv.(QueryServer).SecondLevelDomain(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/mycel.registry.Query/Domain", + FullMethod: "/mycel.registry.Query/SecondLevelDomain", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Domain(ctx, req.(*QueryGetDomainRequest)) + return srv.(QueryServer).SecondLevelDomain(ctx, req.(*QueryGetSecondLevelDomainRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_DomainAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllDomainRequest) +func _Query_SecondLevelDomainAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllSecondLevelDomainRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).DomainAll(ctx, in) + return srv.(QueryServer).SecondLevelDomainAll(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/mycel.registry.Query/DomainAll", + FullMethod: "/mycel.registry.Query/SecondLevelDomainAll", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).DomainAll(ctx, req.(*QueryAllDomainRequest)) + return srv.(QueryServer).SecondLevelDomainAll(ctx, req.(*QueryAllSecondLevelDomainRequest)) } return interceptor(ctx, in, info, handler) } @@ -1042,12 +1306,20 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_Params_Handler, }, { - MethodName: "Domain", - Handler: _Query_Domain_Handler, + MethodName: "TopLevelDomain", + Handler: _Query_TopLevelDomain_Handler, }, { - MethodName: "DomainAll", - Handler: _Query_DomainAll_Handler, + MethodName: "TopLevelDomainAll", + Handler: _Query_TopLevelDomainAll_Handler, + }, + { + MethodName: "SecondLevelDomain", + Handler: _Query_SecondLevelDomain_Handler, + }, + { + MethodName: "SecondLevelDomainAll", + Handler: _Query_SecondLevelDomainAll_Handler, }, { MethodName: "DomainOwnership", @@ -1126,7 +1398,7 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryGetDomainRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryGetTopLevelDomainRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1136,23 +1408,16 @@ func (m *QueryGetDomainRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryGetDomainRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryGetTopLevelDomainRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGetDomainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryGetTopLevelDomainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Parent) > 0 { - i -= len(m.Parent) - copy(dAtA[i:], m.Parent) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Parent))) - i-- - dAtA[i] = 0x12 - } if len(m.Name) > 0 { i -= len(m.Name) copy(dAtA[i:], m.Name) @@ -1163,7 +1428,7 @@ func (m *QueryGetDomainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryGetDomainResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryGetTopLevelDomainResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1173,18 +1438,18 @@ func (m *QueryGetDomainResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryGetDomainResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryGetTopLevelDomainResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGetDomainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryGetTopLevelDomainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size, err := m.Domain.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.TopLevelDomain.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1196,7 +1461,7 @@ func (m *QueryGetDomainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *QueryAllDomainRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryAllTopLevelDomainRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1206,12 +1471,12 @@ func (m *QueryAllDomainRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryAllDomainRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllTopLevelDomainRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllDomainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllTopLevelDomainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1231,7 +1496,7 @@ func (m *QueryAllDomainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryAllDomainResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryAllTopLevelDomainResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1241,12 +1506,12 @@ func (m *QueryAllDomainResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryAllDomainResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllTopLevelDomainResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllDomainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllTopLevelDomainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1263,10 +1528,10 @@ func (m *QueryAllDomainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) i-- dAtA[i] = 0x12 } - if len(m.Domain) > 0 { - for iNdEx := len(m.Domain) - 1; iNdEx >= 0; iNdEx-- { + if len(m.TopLevelDomain) > 0 { + for iNdEx := len(m.TopLevelDomain) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Domain[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.TopLevelDomain[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1280,7 +1545,7 @@ func (m *QueryAllDomainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *QueryGetDomainOwnershipRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryGetSecondLevelDomainRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1290,27 +1555,34 @@ func (m *QueryGetDomainOwnershipRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryGetDomainOwnershipRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryGetSecondLevelDomainRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGetDomainOwnershipRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryGetSecondLevelDomainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Owner))) + if len(m.Parent) > 0 { + i -= len(m.Parent) + copy(dAtA[i:], m.Parent) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Parent))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Name))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryGetDomainOwnershipResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryGetSecondLevelDomainResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1320,18 +1592,18 @@ func (m *QueryGetDomainOwnershipResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryGetDomainOwnershipResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryGetSecondLevelDomainResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGetDomainOwnershipResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryGetSecondLevelDomainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size, err := m.DomainOwnership.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.SecondLevelDomain.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1343,7 +1615,7 @@ func (m *QueryGetDomainOwnershipResponse) MarshalToSizedBuffer(dAtA []byte) (int return len(dAtA) - i, nil } -func (m *QueryAllDomainOwnershipRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryAllSecondLevelDomainRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1353,12 +1625,12 @@ func (m *QueryAllDomainOwnershipRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryAllDomainOwnershipRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllSecondLevelDomainRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllDomainOwnershipRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllSecondLevelDomainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1378,7 +1650,7 @@ func (m *QueryAllDomainOwnershipRequest) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *QueryAllDomainOwnershipResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryAllSecondLevelDomainResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1388,12 +1660,12 @@ func (m *QueryAllDomainOwnershipResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryAllDomainOwnershipResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllSecondLevelDomainResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllDomainOwnershipResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllSecondLevelDomainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1410,10 +1682,10 @@ func (m *QueryAllDomainOwnershipResponse) MarshalToSizedBuffer(dAtA []byte) (int i-- dAtA[i] = 0x12 } - if len(m.DomainOwnership) > 0 { - for iNdEx := len(m.DomainOwnership) - 1; iNdEx >= 0; iNdEx-- { + if len(m.SecondLevelDomain) > 0 { + for iNdEx := len(m.SecondLevelDomain) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.DomainOwnership[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.SecondLevelDomain[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1427,7 +1699,7 @@ func (m *QueryAllDomainOwnershipResponse) MarshalToSizedBuffer(dAtA []byte) (int return len(dAtA) - i, nil } -func (m *QueryDomainRegistrationFeeRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryGetDomainOwnershipRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1437,34 +1709,27 @@ func (m *QueryDomainRegistrationFeeRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryDomainRegistrationFeeRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryGetDomainOwnershipRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryDomainRegistrationFeeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryGetDomainOwnershipRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Parent) > 0 { - i -= len(m.Parent) - copy(dAtA[i:], m.Parent) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Parent))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Name))) + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Owner))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryDomainRegistrationFeeResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryGetDomainOwnershipResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1474,18 +1739,18 @@ func (m *QueryDomainRegistrationFeeResponse) Marshal() (dAtA []byte, err error) return dAtA[:n], nil } -func (m *QueryDomainRegistrationFeeResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryGetDomainOwnershipResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryDomainRegistrationFeeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryGetDomainOwnershipResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size, err := m.Fee.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.DomainOwnership.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1497,7 +1762,7 @@ func (m *QueryDomainRegistrationFeeResponse) MarshalToSizedBuffer(dAtA []byte) ( return len(dAtA) - i, nil } -func (m *QueryIsRegistrableDomainRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryAllDomainOwnershipRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1507,19 +1772,173 @@ func (m *QueryIsRegistrableDomainRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryIsRegistrableDomainRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllDomainOwnershipRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryIsRegistrableDomainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllDomainOwnershipRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Parent) > 0 { - i -= len(m.Parent) - copy(dAtA[i:], m.Parent) + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllDomainOwnershipResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAllDomainOwnershipResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllDomainOwnershipResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.DomainOwnership) > 0 { + for iNdEx := len(m.DomainOwnership) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DomainOwnership[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryDomainRegistrationFeeRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryDomainRegistrationFeeRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDomainRegistrationFeeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Parent) > 0 { + i -= len(m.Parent) + copy(dAtA[i:], m.Parent) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Parent))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDomainRegistrationFeeResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryDomainRegistrationFeeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDomainRegistrationFeeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Fee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryIsRegistrableDomainRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryIsRegistrableDomainRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryIsRegistrableDomainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Parent) > 0 { + i -= len(m.Parent) + copy(dAtA[i:], m.Parent) i = encodeVarintQuery(dAtA, i, uint64(len(m.Parent))) i-- dAtA[i] = 0x12 @@ -1605,7 +2024,63 @@ func (m *QueryParamsResponse) Size() (n int) { return n } -func (m *QueryGetDomainRequest) Size() (n int) { +func (m *QueryGetTopLevelDomainRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetTopLevelDomainResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.TopLevelDomain.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryAllTopLevelDomainRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllTopLevelDomainResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.TopLevelDomain) > 0 { + for _, e := range m.TopLevelDomain { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetSecondLevelDomainRequest) Size() (n int) { if m == nil { return 0 } @@ -1622,18 +2097,18 @@ func (m *QueryGetDomainRequest) Size() (n int) { return n } -func (m *QueryGetDomainResponse) Size() (n int) { +func (m *QueryGetSecondLevelDomainResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.Domain.Size() + l = m.SecondLevelDomain.Size() n += 1 + l + sovQuery(uint64(l)) return n } -func (m *QueryAllDomainRequest) Size() (n int) { +func (m *QueryAllSecondLevelDomainRequest) Size() (n int) { if m == nil { return 0 } @@ -1646,14 +2121,14 @@ func (m *QueryAllDomainRequest) Size() (n int) { return n } -func (m *QueryAllDomainResponse) Size() (n int) { +func (m *QueryAllSecondLevelDomainResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.Domain) > 0 { - for _, e := range m.Domain { + if len(m.SecondLevelDomain) > 0 { + for _, e := range m.SecondLevelDomain { l = e.Size() n += 1 + l + sovQuery(uint64(l)) } @@ -1921,7 +2396,378 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetDomainRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetTopLevelDomainRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetTopLevelDomainRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetTopLevelDomainRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetTopLevelDomainResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetTopLevelDomainResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetTopLevelDomainResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TopLevelDomain", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TopLevelDomain.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllTopLevelDomainRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllTopLevelDomainRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllTopLevelDomainRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllTopLevelDomainResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllTopLevelDomainResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllTopLevelDomainResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TopLevelDomain", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TopLevelDomain = append(m.TopLevelDomain, TopLevelDomain{}) + if err := m.TopLevelDomain[len(m.TopLevelDomain)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetSecondLevelDomainRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1944,10 +2790,10 @@ func (m *QueryGetDomainRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetDomainRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetSecondLevelDomainRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetDomainRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetSecondLevelDomainRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2035,7 +2881,7 @@ func (m *QueryGetDomainRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetDomainResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetSecondLevelDomainResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2058,15 +2904,15 @@ func (m *QueryGetDomainResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetDomainResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetSecondLevelDomainResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetDomainResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetSecondLevelDomainResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Domain", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SecondLevelDomain", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2093,7 +2939,7 @@ func (m *QueryGetDomainResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Domain.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.SecondLevelDomain.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2118,7 +2964,7 @@ func (m *QueryGetDomainResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllDomainRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAllSecondLevelDomainRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2141,10 +2987,10 @@ func (m *QueryAllDomainRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllDomainRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllSecondLevelDomainRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllDomainRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllSecondLevelDomainRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2204,7 +3050,7 @@ func (m *QueryAllDomainRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllDomainResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllSecondLevelDomainResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2227,15 +3073,15 @@ func (m *QueryAllDomainResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllDomainResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllSecondLevelDomainResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllDomainResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllSecondLevelDomainResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Domain", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SecondLevelDomain", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2262,8 +3108,8 @@ func (m *QueryAllDomainResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Domain = append(m.Domain, Domain{}) - if err := m.Domain[len(m.Domain)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.SecondLevelDomain = append(m.SecondLevelDomain, SecondLevelDomain{}) + if err := m.SecondLevelDomain[len(m.SecondLevelDomain)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/registry/types/query.pb.gw.go b/x/registry/types/query.pb.gw.go index 7f07eab4..e393e20b 100644 --- a/x/registry/types/query.pb.gw.go +++ b/x/registry/types/query.pb.gw.go @@ -51,8 +51,98 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal } -func request_Query_Domain_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetDomainRequest +func request_Query_TopLevelDomain_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetTopLevelDomainRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := client.TopLevelDomain(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_TopLevelDomain_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetTopLevelDomainRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := server.TopLevelDomain(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_TopLevelDomainAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_TopLevelDomainAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllTopLevelDomainRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_TopLevelDomainAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.TopLevelDomainAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_TopLevelDomainAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllTopLevelDomainRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_TopLevelDomainAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.TopLevelDomainAll(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_SecondLevelDomain_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetSecondLevelDomainRequest var metadata runtime.ServerMetadata var ( @@ -84,13 +174,13 @@ func request_Query_Domain_0(ctx context.Context, marshaler runtime.Marshaler, cl return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) } - msg, err := client.Domain(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.SecondLevelDomain(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_Domain_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetDomainRequest +func local_request_Query_SecondLevelDomain_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetSecondLevelDomainRequest var metadata runtime.ServerMetadata var ( @@ -122,43 +212,43 @@ func local_request_Query_Domain_0(ctx context.Context, marshaler runtime.Marshal return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) } - msg, err := server.Domain(ctx, &protoReq) + msg, err := server.SecondLevelDomain(ctx, &protoReq) return msg, metadata, err } var ( - filter_Query_DomainAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Query_SecondLevelDomainAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Query_DomainAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllDomainRequest +func request_Query_SecondLevelDomainAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllSecondLevelDomainRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DomainAll_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_SecondLevelDomainAll_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.DomainAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.SecondLevelDomainAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_DomainAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllDomainRequest +func local_request_Query_SecondLevelDomainAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllSecondLevelDomainRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DomainAll_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_SecondLevelDomainAll_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.DomainAll(ctx, &protoReq) + msg, err := server.SecondLevelDomainAll(ctx, &protoReq) return msg, metadata, err } @@ -434,7 +524,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_Domain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_TopLevelDomain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -445,7 +535,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_Domain_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_TopLevelDomain_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -453,11 +543,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_Domain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_TopLevelDomain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_DomainAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_TopLevelDomainAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -468,7 +558,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_DomainAll_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_TopLevelDomainAll_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -476,7 +566,53 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_DomainAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_TopLevelDomainAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_SecondLevelDomain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_SecondLevelDomain_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_SecondLevelDomain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_SecondLevelDomainAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_SecondLevelDomainAll_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_SecondLevelDomainAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -633,7 +769,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_Domain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_TopLevelDomain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -642,18 +778,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_Domain_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_TopLevelDomain_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_Domain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_TopLevelDomain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_DomainAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_TopLevelDomainAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -662,14 +798,54 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_DomainAll_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_TopLevelDomainAll_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_DomainAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_TopLevelDomainAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_SecondLevelDomain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_SecondLevelDomain_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_SecondLevelDomain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_SecondLevelDomainAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_SecondLevelDomainAll_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_SecondLevelDomainAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -759,9 +935,13 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie var ( pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"mycel", "registry", "params"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_Domain_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"mycel", "registry", "domain", "name", "parent"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_TopLevelDomain_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"mycel-domain", "mycel", "registry", "top_level_domain", "name"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_DomainAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"mycel", "registry", "domain"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_TopLevelDomainAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"mycel-domain", "mycel", "registry", "top_level_domain"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_SecondLevelDomain_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"mycel", "registry", "second_level_domain", "name", "parent"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_SecondLevelDomainAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"mycel", "registry", "second_level_domain"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_DomainOwnership_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"mycel-domain", "mycel", "registry", "domain_ownership", "owner"}, "", runtime.AssumeColonVerbOpt(true))) @@ -775,9 +955,13 @@ var ( var ( forward_Query_Params_0 = runtime.ForwardResponseMessage - forward_Query_Domain_0 = runtime.ForwardResponseMessage + forward_Query_TopLevelDomain_0 = runtime.ForwardResponseMessage + + forward_Query_TopLevelDomainAll_0 = runtime.ForwardResponseMessage + + forward_Query_SecondLevelDomain_0 = runtime.ForwardResponseMessage - forward_Query_DomainAll_0 = runtime.ForwardResponseMessage + forward_Query_SecondLevelDomainAll_0 = runtime.ForwardResponseMessage forward_Query_DomainOwnership_0 = runtime.ForwardResponseMessage diff --git a/x/registry/types/domain.go b/x/registry/types/secend_level_domain.go similarity index 58% rename from x/registry/types/domain.go rename to x/registry/types/secend_level_domain.go index 4d7c2a29..25d84077 100644 --- a/x/registry/types/domain.go +++ b/x/registry/types/secend_level_domain.go @@ -6,29 +6,15 @@ import ( ) const ( - BaseFee = 303 + BaseFee = 303 ) -func (domain Domain) GetDomainLevel() (domainLevel int) { - if domain.Parent == "" { - domainLevel = 1 - } else { - domainLevel = len(strings.Split(domain.Parent, ".")) + 1 +func (secondLevelDomain SecondLevelDomain) ParseParent() (parent string) { + if secondLevelDomain.Parent != "" { + split := strings.Split(secondLevelDomain.Parent, ".") + parent = split[len(split)-1] } - return domainLevel -} - -func (domain Domain) ParseParent() (name string, parent string) { - if domain.Parent != "" { - split := strings.Split(domain.Parent, ".") - if len(split) == 1 { - name = split[0] - } else { - parent = split[len(split)-1] - name = strings.Join(split[:len(split)-1], ".") - } - } - return name, parent + return parent } func GetWalletAddressFormat(walletRecordType string) (walletAddressFormat string, err error) { @@ -45,7 +31,7 @@ func GetWalletAddressFormat(walletRecordType string) (walletAddressFormat string return walletAddressFormat, err } -func (domain *Domain) UpdateWalletRecord(walletRecordType string, address string) (err error) { +func (secondLevelDomain *SecondLevelDomain) UpdateWalletRecord(walletRecordType string, address string) (err error) { // Get wallet address format from wallet record type walletAddressFormat, err := GetWalletAddressFormat(walletRecordType) @@ -59,16 +45,16 @@ func (domain *Domain) UpdateWalletRecord(walletRecordType string, address string } walletRecord := &WalletRecord{ - WalletRecordType: NetworkName(NetworkName_value[walletRecordType]), - Value: address, + WalletRecordType: NetworkName(NetworkName_value[walletRecordType]), + Value: address, } // Initialize WalletRecords map if it is nil - if domain.WalletRecords == nil { - domain.WalletRecords = make(map[string]*WalletRecord) + if secondLevelDomain.WalletRecords == nil { + secondLevelDomain.WalletRecords = make(map[string]*WalletRecord) } - domain.WalletRecords[walletRecordType] = walletRecord + secondLevelDomain.WalletRecords[walletRecordType] = walletRecord return err } @@ -85,7 +71,7 @@ func GetDnsRecordValueFormat(dnsRecordType string) (dnsRecordTypeFormat string, return dnsRecordTypeFormat, err } -func (domain *Domain) UpdateDnsRecord(dnsRecordType string, value string) (err error) { +func (secondLevelDomain *SecondLevelDomain) UpdateDnsRecord(dnsRecordType string, value string) (err error) { // Get wallet address format from dns record type dnsRecordFormat, err := GetDnsRecordValueFormat(dnsRecordType) @@ -99,16 +85,16 @@ func (domain *Domain) UpdateDnsRecord(dnsRecordType string, value string) (err e } dnsRecord := &DnsRecord{ - DnsRecordType: DnsRecordType(DnsRecordType_value[dnsRecordType]), - Value: value, + DnsRecordType: DnsRecordType(DnsRecordType_value[dnsRecordType]), + Value: value, } // Initialize WalletRecords map if it is nil - if domain.DnsRecords == nil { - domain.DnsRecords = make(map[string]*DnsRecord) + if secondLevelDomain.DnsRecords == nil { + secondLevelDomain.DnsRecords = make(map[string]*DnsRecord) } - domain.DnsRecords[dnsRecordType] = dnsRecord + secondLevelDomain.DnsRecords[dnsRecordType] = dnsRecord return err } diff --git a/x/registry/types/domain.pb.go b/x/registry/types/second_level_domain.pb.go similarity index 53% rename from x/registry/types/domain.pb.go rename to x/registry/types/second_level_domain.pb.go index fd110310..2b28d220 100644 --- a/x/registry/types/domain.pb.go +++ b/x/registry/types/second_level_domain.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: mycel/registry/domain.proto +// source: mycel/registry/second_level_domain.proto package types @@ -31,7 +31,7 @@ func (m *DnsRecord) Reset() { *m = DnsRecord{} } func (m *DnsRecord) String() string { return proto.CompactTextString(m) } func (*DnsRecord) ProtoMessage() {} func (*DnsRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_cfd012ed897e4b87, []int{0} + return fileDescriptor_71a2ae6361ebd509, []int{0} } func (m *DnsRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -83,7 +83,7 @@ func (m *WalletRecord) Reset() { *m = WalletRecord{} } func (m *WalletRecord) String() string { return proto.CompactTextString(m) } func (*WalletRecord) ProtoMessage() {} func (*WalletRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_cfd012ed897e4b87, []int{1} + return fileDescriptor_71a2ae6361ebd509, []int{1} } func (m *WalletRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -126,30 +126,23 @@ func (m *WalletRecord) GetValue() string { return "" } -type Domain struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Parent string `protobuf:"bytes,2,opt,name=parent,proto3" json:"parent,omitempty"` - Owner string `protobuf:"bytes,3,opt,name=owner,proto3" json:"owner,omitempty"` - ExpirationDate int64 `protobuf:"varint,4,opt,name=expirationDate,proto3" json:"expirationDate,omitempty"` - DnsRecords map[string]*DnsRecord `protobuf:"bytes,5,rep,name=dnsRecords,proto3" json:"dnsRecords,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - WalletRecords map[string]*WalletRecord `protobuf:"bytes,6,rep,name=walletRecords,proto3" json:"walletRecords,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Metadata map[string]string `protobuf:"bytes,7,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - SubdomainRegistrationConfig *SubdomainRegistrationConfig `protobuf:"bytes,8,opt,name=subdomainRegistrationConfig,proto3" json:"subdomainRegistrationConfig,omitempty"` - SubdomainCount uint64 `protobuf:"varint,9,opt,name=subdomainCount,proto3" json:"subdomainCount,omitempty"` +type SubdomainRole struct { + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + RecordEditor string `protobuf:"bytes,2,opt,name=recordEditor,proto3" json:"recordEditor,omitempty"` } -func (m *Domain) Reset() { *m = Domain{} } -func (m *Domain) String() string { return proto.CompactTextString(m) } -func (*Domain) ProtoMessage() {} -func (*Domain) Descriptor() ([]byte, []int) { - return fileDescriptor_cfd012ed897e4b87, []int{2} +func (m *SubdomainRole) Reset() { *m = SubdomainRole{} } +func (m *SubdomainRole) String() string { return proto.CompactTextString(m) } +func (*SubdomainRole) ProtoMessage() {} +func (*SubdomainRole) Descriptor() ([]byte, []int) { + return fileDescriptor_71a2ae6361ebd509, []int{2} } -func (m *Domain) XXX_Unmarshal(b []byte) error { +func (m *SubdomainRole) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *Domain) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *SubdomainRole) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_Domain.Marshal(b, m, deterministic) + return xxx_messageInfo_SubdomainRole.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -159,127 +152,183 @@ func (m *Domain) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *Domain) XXX_Merge(src proto.Message) { - xxx_messageInfo_Domain.Merge(m, src) +func (m *SubdomainRole) XXX_Merge(src proto.Message) { + xxx_messageInfo_SubdomainRole.Merge(m, src) } -func (m *Domain) XXX_Size() int { +func (m *SubdomainRole) XXX_Size() int { return m.Size() } -func (m *Domain) XXX_DiscardUnknown() { - xxx_messageInfo_Domain.DiscardUnknown(m) +func (m *SubdomainRole) XXX_DiscardUnknown() { + xxx_messageInfo_SubdomainRole.DiscardUnknown(m) } -var xxx_messageInfo_Domain proto.InternalMessageInfo +var xxx_messageInfo_SubdomainRole proto.InternalMessageInfo -func (m *Domain) GetName() string { +func (m *SubdomainRole) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *SubdomainRole) GetRecordEditor() string { + if m != nil { + return m.RecordEditor + } + return "" +} + +type SecondLevelDomain struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Parent string `protobuf:"bytes,2,opt,name=parent,proto3" json:"parent,omitempty"` + Owner string `protobuf:"bytes,3,opt,name=owner,proto3" json:"owner,omitempty"` + ExpirationDate int64 `protobuf:"varint,4,opt,name=expirationDate,proto3" json:"expirationDate,omitempty"` + DnsRecords map[string]*DnsRecord `protobuf:"bytes,5,rep,name=dnsRecords,proto3" json:"dnsRecords,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + WalletRecords map[string]*WalletRecord `protobuf:"bytes,6,rep,name=walletRecords,proto3" json:"walletRecords,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Metadata map[string]string `protobuf:"bytes,7,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + AccessControl map[string]*SubdomainRole `protobuf:"bytes,8,rep,name=accessControl,proto3" json:"accessControl,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (m *SecondLevelDomain) Reset() { *m = SecondLevelDomain{} } +func (m *SecondLevelDomain) String() string { return proto.CompactTextString(m) } +func (*SecondLevelDomain) ProtoMessage() {} +func (*SecondLevelDomain) Descriptor() ([]byte, []int) { + return fileDescriptor_71a2ae6361ebd509, []int{3} +} +func (m *SecondLevelDomain) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SecondLevelDomain) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SecondLevelDomain.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SecondLevelDomain) XXX_Merge(src proto.Message) { + xxx_messageInfo_SecondLevelDomain.Merge(m, src) +} +func (m *SecondLevelDomain) XXX_Size() int { + return m.Size() +} +func (m *SecondLevelDomain) XXX_DiscardUnknown() { + xxx_messageInfo_SecondLevelDomain.DiscardUnknown(m) +} + +var xxx_messageInfo_SecondLevelDomain proto.InternalMessageInfo + +func (m *SecondLevelDomain) GetName() string { if m != nil { return m.Name } return "" } -func (m *Domain) GetParent() string { +func (m *SecondLevelDomain) GetParent() string { if m != nil { return m.Parent } return "" } -func (m *Domain) GetOwner() string { +func (m *SecondLevelDomain) GetOwner() string { if m != nil { return m.Owner } return "" } -func (m *Domain) GetExpirationDate() int64 { +func (m *SecondLevelDomain) GetExpirationDate() int64 { if m != nil { return m.ExpirationDate } return 0 } -func (m *Domain) GetDnsRecords() map[string]*DnsRecord { +func (m *SecondLevelDomain) GetDnsRecords() map[string]*DnsRecord { if m != nil { return m.DnsRecords } return nil } -func (m *Domain) GetWalletRecords() map[string]*WalletRecord { +func (m *SecondLevelDomain) GetWalletRecords() map[string]*WalletRecord { if m != nil { return m.WalletRecords } return nil } -func (m *Domain) GetMetadata() map[string]string { +func (m *SecondLevelDomain) GetMetadata() map[string]string { if m != nil { return m.Metadata } return nil } -func (m *Domain) GetSubdomainRegistrationConfig() *SubdomainRegistrationConfig { +func (m *SecondLevelDomain) GetAccessControl() map[string]*SubdomainRole { if m != nil { - return m.SubdomainRegistrationConfig + return m.AccessControl } return nil } -func (m *Domain) GetSubdomainCount() uint64 { - if m != nil { - return m.SubdomainCount - } - return 0 -} - func init() { proto.RegisterType((*DnsRecord)(nil), "mycel.registry.DnsRecord") proto.RegisterType((*WalletRecord)(nil), "mycel.registry.WalletRecord") - proto.RegisterType((*Domain)(nil), "mycel.registry.Domain") - proto.RegisterMapType((map[string]*DnsRecord)(nil), "mycel.registry.Domain.DnsRecordsEntry") - proto.RegisterMapType((map[string]string)(nil), "mycel.registry.Domain.MetadataEntry") - proto.RegisterMapType((map[string]*WalletRecord)(nil), "mycel.registry.Domain.WalletRecordsEntry") + proto.RegisterType((*SubdomainRole)(nil), "mycel.registry.SubdomainRole") + proto.RegisterType((*SecondLevelDomain)(nil), "mycel.registry.SecondLevelDomain") + proto.RegisterMapType((map[string]*SubdomainRole)(nil), "mycel.registry.SecondLevelDomain.AccessControlEntry") + proto.RegisterMapType((map[string]*DnsRecord)(nil), "mycel.registry.SecondLevelDomain.DnsRecordsEntry") + proto.RegisterMapType((map[string]string)(nil), "mycel.registry.SecondLevelDomain.MetadataEntry") + proto.RegisterMapType((map[string]*WalletRecord)(nil), "mycel.registry.SecondLevelDomain.WalletRecordsEntry") } -func init() { proto.RegisterFile("mycel/registry/domain.proto", fileDescriptor_cfd012ed897e4b87) } +func init() { + proto.RegisterFile("mycel/registry/second_level_domain.proto", fileDescriptor_71a2ae6361ebd509) +} -var fileDescriptor_cfd012ed897e4b87 = []byte{ - // 515 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x94, 0xcd, 0x8e, 0xd3, 0x30, - 0x14, 0x85, 0xeb, 0xe9, 0x0f, 0xd3, 0x5b, 0x5a, 0x46, 0x16, 0x42, 0xa1, 0x85, 0x10, 0x46, 0x68, - 0x14, 0x84, 0x48, 0xa5, 0xb0, 0x41, 0xb0, 0x41, 0xb4, 0xfc, 0x6c, 0x18, 0x24, 0x83, 0x04, 0x62, - 0x41, 0xe5, 0xb6, 0x9e, 0x12, 0x4d, 0x63, 0x57, 0x89, 0x4b, 0x27, 0x6f, 0xc1, 0x63, 0xb1, 0x9c, - 0x25, 0x12, 0x1b, 0xd4, 0xbe, 0x08, 0xaa, 0x9d, 0x09, 0x4e, 0xda, 0xb0, 0xcb, 0xb5, 0xef, 0xf9, - 0xae, 0x7d, 0x72, 0x64, 0xe8, 0x85, 0xc9, 0x84, 0xcd, 0xfb, 0x11, 0x9b, 0x05, 0xb1, 0x8c, 0x92, - 0xfe, 0x54, 0x84, 0x34, 0xe0, 0xde, 0x22, 0x12, 0x52, 0xe0, 0x8e, 0xda, 0xf4, 0xae, 0x36, 0xbb, - 0xf7, 0x8a, 0xcd, 0x3c, 0x1e, 0x45, 0x6c, 0x22, 0xa2, 0xa9, 0x16, 0x74, 0xef, 0x17, 0x1a, 0x38, - 0x93, 0x2b, 0x11, 0x9d, 0x8f, 0x38, 0x0d, 0x59, 0xda, 0xe2, 0x17, 0x5a, 0xe2, 0xe5, 0x58, 0xcf, - 0x1c, 0xa5, 0x4b, 0x54, 0x06, 0x82, 0x8f, 0x26, 0x82, 0x9f, 0x05, 0x33, 0xad, 0x39, 0x3e, 0x83, - 0xe6, 0x90, 0xc7, 0x44, 0x4d, 0xc2, 0x03, 0x68, 0x4f, 0xaf, 0x8a, 0x8f, 0xc9, 0x82, 0x59, 0xc8, - 0x41, 0x6e, 0xc7, 0xbf, 0xeb, 0xe5, 0x0f, 0xeb, 0x0d, 0xcd, 0x26, 0x92, 0xd7, 0xe0, 0x9b, 0x50, - 0xff, 0x4e, 0xe7, 0x4b, 0x66, 0x1d, 0x38, 0xc8, 0x6d, 0x12, 0x5d, 0x1c, 0x87, 0x70, 0xfd, 0x13, - 0x9d, 0xcf, 0x99, 0x4c, 0x47, 0xbd, 0x81, 0xa3, 0x95, 0x51, 0x1b, 0xd3, 0x7a, 0xc5, 0x69, 0xa7, - 0xfa, 0xa6, 0xa7, 0x34, 0x64, 0x64, 0x47, 0x54, 0x32, 0xee, 0x77, 0x1d, 0x1a, 0x43, 0x75, 0x77, - 0x8c, 0xa1, 0xb6, 0xf5, 0x48, 0xd1, 0x9b, 0x44, 0x7d, 0xe3, 0x5b, 0xd0, 0x58, 0xd0, 0x88, 0x71, - 0x99, 0xaa, 0xd2, 0x6a, 0x0b, 0x13, 0x2b, 0xce, 0x22, 0xab, 0xaa, 0x61, 0xaa, 0xc0, 0x27, 0xd0, - 0x61, 0x17, 0x8b, 0x40, 0xdb, 0x37, 0xa4, 0x92, 0x59, 0x35, 0x07, 0xb9, 0x55, 0x52, 0x58, 0xc5, - 0xaf, 0x01, 0x32, 0x2b, 0x62, 0xab, 0xee, 0x54, 0xdd, 0x96, 0x7f, 0xb2, 0xe3, 0x9d, 0x4e, 0x41, - 0x66, 0x61, 0xfc, 0x8a, 0xcb, 0x28, 0x21, 0x86, 0x12, 0xbf, 0x87, 0xb6, 0x79, 0xcd, 0xd8, 0x6a, - 0x28, 0xd4, 0xc3, 0x12, 0x94, 0xe9, 0x6b, 0x4a, 0xcb, 0xeb, 0xf1, 0x0b, 0x38, 0x0c, 0x99, 0xa4, - 0x53, 0x2a, 0xa9, 0x75, 0x4d, 0xb1, 0x1e, 0x94, 0xb0, 0xde, 0xa5, 0x6d, 0x1a, 0x93, 0xa9, 0x70, - 0x08, 0xbd, 0x2c, 0x4d, 0xc4, 0x08, 0xd3, 0x40, 0x65, 0xc9, 0x3a, 0x74, 0x90, 0xdb, 0xf2, 0x1f, - 0x15, 0xa1, 0x1f, 0xca, 0x25, 0xe4, 0x7f, 0xbc, 0xad, 0xe3, 0xd9, 0xf6, 0x40, 0x2c, 0xb9, 0xb4, - 0x9a, 0x0e, 0x72, 0x6b, 0xa4, 0xb0, 0xda, 0xfd, 0x0c, 0x37, 0x0a, 0x46, 0xe2, 0x23, 0xa8, 0x9e, - 0xb3, 0x24, 0xfd, 0xdb, 0xdb, 0x4f, 0xdc, 0x37, 0x13, 0xd2, 0xf2, 0x6f, 0x97, 0xa6, 0x39, 0x0d, - 0xcf, 0xb3, 0x83, 0xa7, 0xa8, 0xfb, 0x15, 0xf0, 0xae, 0xaf, 0x7b, 0xe0, 0x7e, 0x1e, 0x7e, 0xa7, - 0x08, 0x37, 0x21, 0x26, 0xff, 0x39, 0xb4, 0x73, 0x5e, 0xef, 0x41, 0xef, 0x4d, 0xf6, 0x56, 0xfc, - 0xf2, 0xed, 0xcf, 0xb5, 0x8d, 0x2e, 0xd7, 0x36, 0xfa, 0xb3, 0xb6, 0xd1, 0x8f, 0x8d, 0x5d, 0xb9, - 0xdc, 0xd8, 0x95, 0x5f, 0x1b, 0xbb, 0xf2, 0xc5, 0x9b, 0x05, 0xf2, 0xdb, 0x72, 0xec, 0x4d, 0x44, - 0xd8, 0x57, 0x27, 0x79, 0xac, 0xed, 0xd2, 0x45, 0xff, 0xe2, 0xdf, 0xe3, 0x20, 0x93, 0x05, 0x8b, - 0xc7, 0x0d, 0xf5, 0x0a, 0x3c, 0xf9, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x8e, 0x21, 0x52, 0xdc, 0xac, - 0x04, 0x00, 0x00, +var fileDescriptor_71a2ae6361ebd509 = []byte{ + // 538 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xc1, 0x6e, 0xd3, 0x40, + 0x10, 0x86, 0xe3, 0xa6, 0x0d, 0xcd, 0xb4, 0x09, 0x65, 0x85, 0x90, 0x09, 0x60, 0x42, 0x0e, 0x28, + 0x17, 0x6c, 0x91, 0x72, 0x40, 0x70, 0x82, 0xa6, 0x02, 0x04, 0x54, 0xc2, 0x45, 0x02, 0xf5, 0x40, + 0xb4, 0xb1, 0x87, 0x62, 0xd5, 0xde, 0x8d, 0xd6, 0x9b, 0xa6, 0x7e, 0x0b, 0x5e, 0x84, 0xf7, 0xe0, + 0xd8, 0x23, 0x47, 0x94, 0xbc, 0x08, 0xca, 0x7a, 0xdb, 0xac, 0x9d, 0x54, 0xe5, 0xe6, 0xb1, 0xe6, + 0xff, 0xfe, 0xd1, 0x3f, 0xbb, 0x0b, 0xdd, 0x24, 0x0b, 0x30, 0xf6, 0x04, 0x1e, 0x47, 0xa9, 0x14, + 0x99, 0x97, 0x62, 0xc0, 0x59, 0x38, 0x88, 0xf1, 0x14, 0xe3, 0x41, 0xc8, 0x13, 0x1a, 0x31, 0x77, + 0x24, 0xb8, 0xe4, 0xa4, 0xa9, 0x3a, 0xdd, 0x8b, 0xce, 0xd6, 0xc3, 0x92, 0x32, 0x64, 0xe9, 0x40, + 0x60, 0xc0, 0x45, 0x98, 0x0b, 0x5a, 0x8f, 0x4a, 0x0d, 0x0c, 0xe5, 0x84, 0x8b, 0x93, 0x01, 0xa3, + 0x09, 0xe6, 0x2d, 0x9d, 0xef, 0x50, 0xef, 0xb3, 0xd4, 0x57, 0x2a, 0xb2, 0x07, 0x8d, 0xf0, 0xa2, + 0xf8, 0x9c, 0x8d, 0xd0, 0xb6, 0xda, 0x56, 0xb7, 0xd9, 0x7b, 0xe0, 0x16, 0x8d, 0xdd, 0xbe, 0xd9, + 0xe4, 0x17, 0x35, 0xe4, 0x36, 0x6c, 0x9c, 0xd2, 0x78, 0x8c, 0xf6, 0x5a, 0xdb, 0xea, 0xd6, 0xfd, + 0xbc, 0xe8, 0x24, 0xb0, 0xfd, 0x85, 0xc6, 0x31, 0x4a, 0x6d, 0xf5, 0x06, 0x76, 0x26, 0x46, 0x6d, + 0xb8, 0xdd, 0x2b, 0xbb, 0x1d, 0xe4, 0x53, 0x1f, 0xd0, 0x04, 0xfd, 0x25, 0xd1, 0x15, 0x76, 0xef, + 0xa0, 0x71, 0x38, 0x1e, 0xe6, 0xe9, 0xf9, 0x3c, 0x56, 0x6d, 0x7c, 0xc2, 0x50, 0x28, 0x93, 0xba, + 0x9f, 0x17, 0xa4, 0x03, 0xdb, 0x79, 0x60, 0xfb, 0x61, 0x24, 0xb9, 0xd0, 0x8c, 0xc2, 0xbf, 0xce, + 0xaf, 0x1a, 0xdc, 0x3a, 0x54, 0x3b, 0xf9, 0x30, 0x5f, 0x49, 0x5f, 0x31, 0x09, 0x81, 0xf5, 0x79, + 0x8a, 0x1a, 0xa7, 0xbe, 0xc9, 0x1d, 0xa8, 0x8d, 0xa8, 0x40, 0x26, 0x35, 0x47, 0x57, 0x0b, 0xef, + 0xaa, 0xe9, 0xfd, 0x18, 0x9a, 0x78, 0x36, 0x8a, 0x04, 0x95, 0x11, 0x67, 0x7d, 0x2a, 0xd1, 0x5e, + 0x6f, 0x5b, 0xdd, 0xaa, 0x5f, 0xfa, 0x4b, 0x3e, 0x01, 0x5c, 0x06, 0x9c, 0xda, 0x1b, 0xed, 0x6a, + 0x77, 0xab, 0xf7, 0xb4, 0x9c, 0xd1, 0xd2, 0x80, 0x8b, 0x1d, 0xa5, 0xfb, 0x4c, 0x8a, 0xcc, 0x37, + 0x20, 0xe4, 0x08, 0x1a, 0x66, 0x8e, 0xa9, 0x5d, 0x53, 0xd4, 0x67, 0xd7, 0x53, 0xcd, 0x1d, 0x6a, + 0x70, 0x11, 0x45, 0xde, 0xc3, 0x66, 0x82, 0x92, 0x86, 0x54, 0x52, 0xfb, 0x86, 0xc2, 0x7a, 0xd7, + 0x63, 0x3f, 0x6a, 0x45, 0x4e, 0xbc, 0x04, 0xcc, 0x07, 0xa5, 0x41, 0x80, 0x69, 0xba, 0xc7, 0x99, + 0x14, 0x3c, 0xb6, 0x37, 0xff, 0x77, 0xd0, 0x57, 0xa6, 0x4c, 0x0f, 0x5a, 0x40, 0xb5, 0xbe, 0xc2, + 0xcd, 0x52, 0x46, 0x64, 0x07, 0xaa, 0x27, 0x98, 0xe9, 0x9d, 0xce, 0x3f, 0x89, 0x67, 0x9e, 0xae, + 0xad, 0xde, 0xdd, 0x2b, 0x6f, 0x82, 0x3e, 0x78, 0x2f, 0xd6, 0x9e, 0x5b, 0xad, 0x6f, 0x40, 0x96, + 0x73, 0x5a, 0x01, 0xef, 0x15, 0xe1, 0xf7, 0xcb, 0x70, 0x13, 0x62, 0xf2, 0x5f, 0x42, 0xa3, 0x10, + 0xd8, 0x0a, 0xf4, 0xca, 0x5b, 0xa1, 0xc4, 0x03, 0x20, 0xcb, 0xd9, 0xac, 0x20, 0xec, 0x16, 0x87, + 0x5b, 0x7a, 0x03, 0x0a, 0xd7, 0xcb, 0x30, 0x78, 0xfd, 0xf6, 0xf7, 0xd4, 0xb1, 0xce, 0xa7, 0x8e, + 0xf5, 0x77, 0xea, 0x58, 0x3f, 0x67, 0x4e, 0xe5, 0x7c, 0xe6, 0x54, 0xfe, 0xcc, 0x9c, 0xca, 0x91, + 0x7b, 0x1c, 0xc9, 0x1f, 0xe3, 0xa1, 0x1b, 0xf0, 0xc4, 0x53, 0xb4, 0x27, 0x39, 0x21, 0x2f, 0xbc, + 0xb3, 0xc5, 0x43, 0x25, 0xb3, 0x11, 0xa6, 0xc3, 0x9a, 0x7a, 0xa2, 0x76, 0xff, 0x05, 0x00, 0x00, + 0xff, 0xff, 0x91, 0x27, 0xb8, 0x8c, 0x22, 0x05, 0x00, 0x00, } func (m *DnsRecord) Marshal() (dAtA []byte, err error) { @@ -305,12 +354,12 @@ func (m *DnsRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { if len(m.Value) > 0 { i -= len(m.Value) copy(dAtA[i:], m.Value) - i = encodeVarintDomain(dAtA, i, uint64(len(m.Value))) + i = encodeVarintSecondLevelDomain(dAtA, i, uint64(len(m.Value))) i-- dAtA[i] = 0x12 } if m.DnsRecordType != 0 { - i = encodeVarintDomain(dAtA, i, uint64(m.DnsRecordType)) + i = encodeVarintSecondLevelDomain(dAtA, i, uint64(m.DnsRecordType)) i-- dAtA[i] = 0x8 } @@ -340,19 +389,19 @@ func (m *WalletRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { if len(m.Value) > 0 { i -= len(m.Value) copy(dAtA[i:], m.Value) - i = encodeVarintDomain(dAtA, i, uint64(len(m.Value))) + i = encodeVarintSecondLevelDomain(dAtA, i, uint64(len(m.Value))) i-- dAtA[i] = 0x12 } if m.WalletRecordType != 0 { - i = encodeVarintDomain(dAtA, i, uint64(m.WalletRecordType)) + i = encodeVarintSecondLevelDomain(dAtA, i, uint64(m.WalletRecordType)) i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } -func (m *Domain) Marshal() (dAtA []byte, err error) { +func (m *SubdomainRole) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -362,32 +411,78 @@ func (m *Domain) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Domain) MarshalTo(dAtA []byte) (int, error) { +func (m *SubdomainRole) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Domain) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *SubdomainRole) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.SubdomainCount != 0 { - i = encodeVarintDomain(dAtA, i, uint64(m.SubdomainCount)) + if len(m.RecordEditor) > 0 { + i -= len(m.RecordEditor) + copy(dAtA[i:], m.RecordEditor) + i = encodeVarintSecondLevelDomain(dAtA, i, uint64(len(m.RecordEditor))) i-- - dAtA[i] = 0x48 + dAtA[i] = 0x12 } - if m.SubdomainRegistrationConfig != nil { - { - size, err := m.SubdomainRegistrationConfig.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintSecondLevelDomain(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SecondLevelDomain) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SecondLevelDomain) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SecondLevelDomain) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AccessControl) > 0 { + for k := range m.AccessControl { + v := m.AccessControl[k] + baseI := i + if v != nil { + { + size, err := v.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSecondLevelDomain(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - i -= size - i = encodeVarintDomain(dAtA, i, uint64(size)) + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintSecondLevelDomain(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintSecondLevelDomain(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x42 } - i-- - dAtA[i] = 0x42 } if len(m.Metadata) > 0 { for k := range m.Metadata { @@ -395,15 +490,15 @@ func (m *Domain) MarshalToSizedBuffer(dAtA []byte) (int, error) { baseI := i i -= len(v) copy(dAtA[i:], v) - i = encodeVarintDomain(dAtA, i, uint64(len(v))) + i = encodeVarintSecondLevelDomain(dAtA, i, uint64(len(v))) i-- dAtA[i] = 0x12 i -= len(k) copy(dAtA[i:], k) - i = encodeVarintDomain(dAtA, i, uint64(len(k))) + i = encodeVarintSecondLevelDomain(dAtA, i, uint64(len(k))) i-- dAtA[i] = 0xa - i = encodeVarintDomain(dAtA, i, uint64(baseI-i)) + i = encodeVarintSecondLevelDomain(dAtA, i, uint64(baseI-i)) i-- dAtA[i] = 0x3a } @@ -419,17 +514,17 @@ func (m *Domain) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintDomain(dAtA, i, uint64(size)) + i = encodeVarintSecondLevelDomain(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 } i -= len(k) copy(dAtA[i:], k) - i = encodeVarintDomain(dAtA, i, uint64(len(k))) + i = encodeVarintSecondLevelDomain(dAtA, i, uint64(len(k))) i-- dAtA[i] = 0xa - i = encodeVarintDomain(dAtA, i, uint64(baseI-i)) + i = encodeVarintSecondLevelDomain(dAtA, i, uint64(baseI-i)) i-- dAtA[i] = 0x32 } @@ -445,52 +540,52 @@ func (m *Domain) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintDomain(dAtA, i, uint64(size)) + i = encodeVarintSecondLevelDomain(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 } i -= len(k) copy(dAtA[i:], k) - i = encodeVarintDomain(dAtA, i, uint64(len(k))) + i = encodeVarintSecondLevelDomain(dAtA, i, uint64(len(k))) i-- dAtA[i] = 0xa - i = encodeVarintDomain(dAtA, i, uint64(baseI-i)) + i = encodeVarintSecondLevelDomain(dAtA, i, uint64(baseI-i)) i-- dAtA[i] = 0x2a } } if m.ExpirationDate != 0 { - i = encodeVarintDomain(dAtA, i, uint64(m.ExpirationDate)) + i = encodeVarintSecondLevelDomain(dAtA, i, uint64(m.ExpirationDate)) i-- dAtA[i] = 0x20 } if len(m.Owner) > 0 { i -= len(m.Owner) copy(dAtA[i:], m.Owner) - i = encodeVarintDomain(dAtA, i, uint64(len(m.Owner))) + i = encodeVarintSecondLevelDomain(dAtA, i, uint64(len(m.Owner))) i-- dAtA[i] = 0x1a } if len(m.Parent) > 0 { i -= len(m.Parent) copy(dAtA[i:], m.Parent) - i = encodeVarintDomain(dAtA, i, uint64(len(m.Parent))) + i = encodeVarintSecondLevelDomain(dAtA, i, uint64(len(m.Parent))) i-- dAtA[i] = 0x12 } if len(m.Name) > 0 { i -= len(m.Name) copy(dAtA[i:], m.Name) - i = encodeVarintDomain(dAtA, i, uint64(len(m.Name))) + i = encodeVarintSecondLevelDomain(dAtA, i, uint64(len(m.Name))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func encodeVarintDomain(dAtA []byte, offset int, v uint64) int { - offset -= sovDomain(v) +func encodeVarintSecondLevelDomain(dAtA []byte, offset int, v uint64) int { + offset -= sovSecondLevelDomain(v) base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) @@ -507,11 +602,11 @@ func (m *DnsRecord) Size() (n int) { var l int _ = l if m.DnsRecordType != 0 { - n += 1 + sovDomain(uint64(m.DnsRecordType)) + n += 1 + sovSecondLevelDomain(uint64(m.DnsRecordType)) } l = len(m.Value) if l > 0 { - n += 1 + l + sovDomain(uint64(l)) + n += 1 + l + sovSecondLevelDomain(uint64(l)) } return n } @@ -523,16 +618,33 @@ func (m *WalletRecord) Size() (n int) { var l int _ = l if m.WalletRecordType != 0 { - n += 1 + sovDomain(uint64(m.WalletRecordType)) + n += 1 + sovSecondLevelDomain(uint64(m.WalletRecordType)) } l = len(m.Value) if l > 0 { - n += 1 + l + sovDomain(uint64(l)) + n += 1 + l + sovSecondLevelDomain(uint64(l)) + } + return n +} + +func (m *SubdomainRole) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovSecondLevelDomain(uint64(l)) + } + l = len(m.RecordEditor) + if l > 0 { + n += 1 + l + sovSecondLevelDomain(uint64(l)) } return n } -func (m *Domain) Size() (n int) { +func (m *SecondLevelDomain) Size() (n int) { if m == nil { return 0 } @@ -540,18 +652,18 @@ func (m *Domain) Size() (n int) { _ = l l = len(m.Name) if l > 0 { - n += 1 + l + sovDomain(uint64(l)) + n += 1 + l + sovSecondLevelDomain(uint64(l)) } l = len(m.Parent) if l > 0 { - n += 1 + l + sovDomain(uint64(l)) + n += 1 + l + sovSecondLevelDomain(uint64(l)) } l = len(m.Owner) if l > 0 { - n += 1 + l + sovDomain(uint64(l)) + n += 1 + l + sovSecondLevelDomain(uint64(l)) } if m.ExpirationDate != 0 { - n += 1 + sovDomain(uint64(m.ExpirationDate)) + n += 1 + sovSecondLevelDomain(uint64(m.ExpirationDate)) } if len(m.DnsRecords) > 0 { for k, v := range m.DnsRecords { @@ -560,10 +672,10 @@ func (m *Domain) Size() (n int) { l = 0 if v != nil { l = v.Size() - l += 1 + sovDomain(uint64(l)) + l += 1 + sovSecondLevelDomain(uint64(l)) } - mapEntrySize := 1 + len(k) + sovDomain(uint64(len(k))) + l - n += mapEntrySize + 1 + sovDomain(uint64(mapEntrySize)) + mapEntrySize := 1 + len(k) + sovSecondLevelDomain(uint64(len(k))) + l + n += mapEntrySize + 1 + sovSecondLevelDomain(uint64(mapEntrySize)) } } if len(m.WalletRecords) > 0 { @@ -573,35 +685,41 @@ func (m *Domain) Size() (n int) { l = 0 if v != nil { l = v.Size() - l += 1 + sovDomain(uint64(l)) + l += 1 + sovSecondLevelDomain(uint64(l)) } - mapEntrySize := 1 + len(k) + sovDomain(uint64(len(k))) + l - n += mapEntrySize + 1 + sovDomain(uint64(mapEntrySize)) + mapEntrySize := 1 + len(k) + sovSecondLevelDomain(uint64(len(k))) + l + n += mapEntrySize + 1 + sovSecondLevelDomain(uint64(mapEntrySize)) } } if len(m.Metadata) > 0 { for k, v := range m.Metadata { _ = k _ = v - mapEntrySize := 1 + len(k) + sovDomain(uint64(len(k))) + 1 + len(v) + sovDomain(uint64(len(v))) - n += mapEntrySize + 1 + sovDomain(uint64(mapEntrySize)) + mapEntrySize := 1 + len(k) + sovSecondLevelDomain(uint64(len(k))) + 1 + len(v) + sovSecondLevelDomain(uint64(len(v))) + n += mapEntrySize + 1 + sovSecondLevelDomain(uint64(mapEntrySize)) } } - if m.SubdomainRegistrationConfig != nil { - l = m.SubdomainRegistrationConfig.Size() - n += 1 + l + sovDomain(uint64(l)) - } - if m.SubdomainCount != 0 { - n += 1 + sovDomain(uint64(m.SubdomainCount)) + if len(m.AccessControl) > 0 { + for k, v := range m.AccessControl { + _ = k + _ = v + l = 0 + if v != nil { + l = v.Size() + l += 1 + sovSecondLevelDomain(uint64(l)) + } + mapEntrySize := 1 + len(k) + sovSecondLevelDomain(uint64(len(k))) + l + n += mapEntrySize + 1 + sovSecondLevelDomain(uint64(mapEntrySize)) + } } return n } -func sovDomain(x uint64) (n int) { +func sovSecondLevelDomain(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } -func sozDomain(x uint64) (n int) { - return sovDomain(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +func sozSecondLevelDomain(x uint64) (n int) { + return sovSecondLevelDomain(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (m *DnsRecord) Unmarshal(dAtA []byte) error { l := len(dAtA) @@ -611,7 +729,7 @@ func (m *DnsRecord) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDomain + return ErrIntOverflowSecondLevelDomain } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -639,7 +757,7 @@ func (m *DnsRecord) Unmarshal(dAtA []byte) error { m.DnsRecordType = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDomain + return ErrIntOverflowSecondLevelDomain } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -658,7 +776,7 @@ func (m *DnsRecord) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDomain + return ErrIntOverflowSecondLevelDomain } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -672,11 +790,11 @@ func (m *DnsRecord) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } if postIndex > l { return io.ErrUnexpectedEOF @@ -685,12 +803,12 @@ func (m *DnsRecord) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipDomain(dAtA[iNdEx:]) + skippy, err := skipSecondLevelDomain(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -712,7 +830,7 @@ func (m *WalletRecord) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDomain + return ErrIntOverflowSecondLevelDomain } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -740,7 +858,7 @@ func (m *WalletRecord) Unmarshal(dAtA []byte) error { m.WalletRecordType = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDomain + return ErrIntOverflowSecondLevelDomain } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -759,7 +877,7 @@ func (m *WalletRecord) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDomain + return ErrIntOverflowSecondLevelDomain } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -773,11 +891,11 @@ func (m *WalletRecord) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } if postIndex > l { return io.ErrUnexpectedEOF @@ -786,12 +904,12 @@ func (m *WalletRecord) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipDomain(dAtA[iNdEx:]) + skippy, err := skipSecondLevelDomain(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -805,7 +923,7 @@ func (m *WalletRecord) Unmarshal(dAtA []byte) error { } return nil } -func (m *Domain) Unmarshal(dAtA []byte) error { +func (m *SubdomainRole) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -813,7 +931,7 @@ func (m *Domain) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDomain + return ErrIntOverflowSecondLevelDomain } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -828,10 +946,124 @@ func (m *Domain) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Domain: wiretype end group for non-group") + return fmt.Errorf("proto: SubdomainRole: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Domain: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: SubdomainRole: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSecondLevelDomain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSecondLevelDomain + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSecondLevelDomain + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RecordEditor", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSecondLevelDomain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSecondLevelDomain + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSecondLevelDomain + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RecordEditor = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSecondLevelDomain(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSecondLevelDomain + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SecondLevelDomain) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSecondLevelDomain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SecondLevelDomain: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SecondLevelDomain: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -841,7 +1073,7 @@ func (m *Domain) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDomain + return ErrIntOverflowSecondLevelDomain } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -855,11 +1087,11 @@ func (m *Domain) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } if postIndex > l { return io.ErrUnexpectedEOF @@ -873,7 +1105,7 @@ func (m *Domain) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDomain + return ErrIntOverflowSecondLevelDomain } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -887,11 +1119,11 @@ func (m *Domain) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } if postIndex > l { return io.ErrUnexpectedEOF @@ -905,7 +1137,7 @@ func (m *Domain) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDomain + return ErrIntOverflowSecondLevelDomain } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -919,11 +1151,11 @@ func (m *Domain) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } if postIndex > l { return io.ErrUnexpectedEOF @@ -937,7 +1169,7 @@ func (m *Domain) Unmarshal(dAtA []byte) error { m.ExpirationDate = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDomain + return ErrIntOverflowSecondLevelDomain } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -956,7 +1188,7 @@ func (m *Domain) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDomain + return ErrIntOverflowSecondLevelDomain } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -969,11 +1201,11 @@ func (m *Domain) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } if postIndex > l { return io.ErrUnexpectedEOF @@ -988,7 +1220,7 @@ func (m *Domain) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDomain + return ErrIntOverflowSecondLevelDomain } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1005,7 +1237,7 @@ func (m *Domain) Unmarshal(dAtA []byte) error { var stringLenmapkey uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDomain + return ErrIntOverflowSecondLevelDomain } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1019,11 +1251,11 @@ func (m *Domain) Unmarshal(dAtA []byte) error { } intStringLenmapkey := int(stringLenmapkey) if intStringLenmapkey < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } postStringIndexmapkey := iNdEx + intStringLenmapkey if postStringIndexmapkey < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } if postStringIndexmapkey > l { return io.ErrUnexpectedEOF @@ -1034,7 +1266,7 @@ func (m *Domain) Unmarshal(dAtA []byte) error { var mapmsglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDomain + return ErrIntOverflowSecondLevelDomain } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1047,11 +1279,11 @@ func (m *Domain) Unmarshal(dAtA []byte) error { } } if mapmsglen < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } postmsgIndex := iNdEx + mapmsglen if postmsgIndex < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } if postmsgIndex > l { return io.ErrUnexpectedEOF @@ -1063,12 +1295,12 @@ func (m *Domain) Unmarshal(dAtA []byte) error { iNdEx = postmsgIndex } else { iNdEx = entryPreIndex - skippy, err := skipDomain(dAtA[iNdEx:]) + skippy, err := skipSecondLevelDomain(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF @@ -1085,7 +1317,7 @@ func (m *Domain) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDomain + return ErrIntOverflowSecondLevelDomain } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1098,11 +1330,11 @@ func (m *Domain) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } if postIndex > l { return io.ErrUnexpectedEOF @@ -1117,7 +1349,7 @@ func (m *Domain) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDomain + return ErrIntOverflowSecondLevelDomain } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1134,7 +1366,7 @@ func (m *Domain) Unmarshal(dAtA []byte) error { var stringLenmapkey uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDomain + return ErrIntOverflowSecondLevelDomain } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1148,11 +1380,11 @@ func (m *Domain) Unmarshal(dAtA []byte) error { } intStringLenmapkey := int(stringLenmapkey) if intStringLenmapkey < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } postStringIndexmapkey := iNdEx + intStringLenmapkey if postStringIndexmapkey < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } if postStringIndexmapkey > l { return io.ErrUnexpectedEOF @@ -1163,7 +1395,7 @@ func (m *Domain) Unmarshal(dAtA []byte) error { var mapmsglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDomain + return ErrIntOverflowSecondLevelDomain } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1176,11 +1408,11 @@ func (m *Domain) Unmarshal(dAtA []byte) error { } } if mapmsglen < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } postmsgIndex := iNdEx + mapmsglen if postmsgIndex < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } if postmsgIndex > l { return io.ErrUnexpectedEOF @@ -1192,12 +1424,12 @@ func (m *Domain) Unmarshal(dAtA []byte) error { iNdEx = postmsgIndex } else { iNdEx = entryPreIndex - skippy, err := skipDomain(dAtA[iNdEx:]) + skippy, err := skipSecondLevelDomain(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF @@ -1214,7 +1446,7 @@ func (m *Domain) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDomain + return ErrIntOverflowSecondLevelDomain } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1227,11 +1459,11 @@ func (m *Domain) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } if postIndex > l { return io.ErrUnexpectedEOF @@ -1246,7 +1478,7 @@ func (m *Domain) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDomain + return ErrIntOverflowSecondLevelDomain } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1263,7 +1495,7 @@ func (m *Domain) Unmarshal(dAtA []byte) error { var stringLenmapkey uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDomain + return ErrIntOverflowSecondLevelDomain } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1277,11 +1509,11 @@ func (m *Domain) Unmarshal(dAtA []byte) error { } intStringLenmapkey := int(stringLenmapkey) if intStringLenmapkey < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } postStringIndexmapkey := iNdEx + intStringLenmapkey if postStringIndexmapkey < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } if postStringIndexmapkey > l { return io.ErrUnexpectedEOF @@ -1292,7 +1524,7 @@ func (m *Domain) Unmarshal(dAtA []byte) error { var stringLenmapvalue uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDomain + return ErrIntOverflowSecondLevelDomain } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1306,11 +1538,11 @@ func (m *Domain) Unmarshal(dAtA []byte) error { } intStringLenmapvalue := int(stringLenmapvalue) if intStringLenmapvalue < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } postStringIndexmapvalue := iNdEx + intStringLenmapvalue if postStringIndexmapvalue < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } if postStringIndexmapvalue > l { return io.ErrUnexpectedEOF @@ -1319,12 +1551,12 @@ func (m *Domain) Unmarshal(dAtA []byte) error { iNdEx = postStringIndexmapvalue } else { iNdEx = entryPreIndex - skippy, err := skipDomain(dAtA[iNdEx:]) + skippy, err := skipSecondLevelDomain(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF @@ -1336,12 +1568,12 @@ func (m *Domain) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 8: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SubdomainRegistrationConfig", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AccessControl", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDomain + return ErrIntOverflowSecondLevelDomain } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1354,49 +1586,123 @@ func (m *Domain) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } if postIndex > l { return io.ErrUnexpectedEOF } - if m.SubdomainRegistrationConfig == nil { - m.SubdomainRegistrationConfig = &SubdomainRegistrationConfig{} - } - if err := m.SubdomainRegistrationConfig.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + if m.AccessControl == nil { + m.AccessControl = make(map[string]*SubdomainRole) } - iNdEx = postIndex - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SubdomainCount", wireType) - } - m.SubdomainCount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDomain - } - if iNdEx >= l { - return io.ErrUnexpectedEOF + var mapkey string + var mapvalue *SubdomainRole + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSecondLevelDomain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - b := dAtA[iNdEx] - iNdEx++ - m.SubdomainCount |= uint64(b&0x7F) << shift - if b < 0x80 { - break + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSecondLevelDomain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthSecondLevelDomain + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthSecondLevelDomain + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSecondLevelDomain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthSecondLevelDomain + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLengthSecondLevelDomain + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &SubdomainRole{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipSecondLevelDomain(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSecondLevelDomain + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy } } + m.AccessControl[mapkey] = mapvalue + iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipDomain(dAtA[iNdEx:]) + skippy, err := skipSecondLevelDomain(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthDomain + return ErrInvalidLengthSecondLevelDomain } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -1410,7 +1716,7 @@ func (m *Domain) Unmarshal(dAtA []byte) error { } return nil } -func skipDomain(dAtA []byte) (n int, err error) { +func skipSecondLevelDomain(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 depth := 0 @@ -1418,7 +1724,7 @@ func skipDomain(dAtA []byte) (n int, err error) { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowDomain + return 0, ErrIntOverflowSecondLevelDomain } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -1435,7 +1741,7 @@ func skipDomain(dAtA []byte) (n int, err error) { case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowDomain + return 0, ErrIntOverflowSecondLevelDomain } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -1451,7 +1757,7 @@ func skipDomain(dAtA []byte) (n int, err error) { var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowDomain + return 0, ErrIntOverflowSecondLevelDomain } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -1464,14 +1770,14 @@ func skipDomain(dAtA []byte) (n int, err error) { } } if length < 0 { - return 0, ErrInvalidLengthDomain + return 0, ErrInvalidLengthSecondLevelDomain } iNdEx += length case 3: depth++ case 4: if depth == 0 { - return 0, ErrUnexpectedEndOfGroupDomain + return 0, ErrUnexpectedEndOfGroupSecondLevelDomain } depth-- case 5: @@ -1480,7 +1786,7 @@ func skipDomain(dAtA []byte) (n int, err error) { return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } if iNdEx < 0 { - return 0, ErrInvalidLengthDomain + return 0, ErrInvalidLengthSecondLevelDomain } if depth == 0 { return iNdEx, nil @@ -1490,7 +1796,7 @@ func skipDomain(dAtA []byte) (n int, err error) { } var ( - ErrInvalidLengthDomain = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowDomain = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupDomain = fmt.Errorf("proto: unexpected end of group") + ErrInvalidLengthSecondLevelDomain = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowSecondLevelDomain = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupSecondLevelDomain = fmt.Errorf("proto: unexpected end of group") ) diff --git a/x/registry/types/domain_test.go b/x/registry/types/second_level_domain_test.go similarity index 76% rename from x/registry/types/domain_test.go rename to x/registry/types/second_level_domain_test.go index b63d9607..8a074bd0 100644 --- a/x/registry/types/domain_test.go +++ b/x/registry/types/second_level_domain_test.go @@ -9,10 +9,9 @@ import ( ) type DomainTest struct { - Domain Domain - DomainLevel int - DomainParent Domain - DomainPrice sdk.Coins + SecondLevelDomain SecondLevelDomain + DomainParent TopLevelDomain + DomainPrice sdk.Coins } type WalletRecordTest struct { @@ -24,75 +23,42 @@ type WalletRecordTest struct { func TestDomainValidate(t *testing.T) { testCases := []struct { - domain Domain - expDomainLevel int - expDomainParent Domain + domain SecondLevelDomain + expDomainParent TopLevelDomain expErr string }{ // Valid domains { - domain: Domain{Name: "foo", Parent: "myc"}, - expDomainLevel: 2, - expDomainParent: Domain{Name: "myc", Parent: ""}, - }, - { - domain: Domain{Name: "12345", Parent: ""}, - expDomainLevel: 1, - expDomainParent: Domain{Name: "", Parent: ""}, - expErr: "", - }, - { - domain: Domain{Name: "1234", Parent: "foo.myc"}, - expDomainLevel: 3, - expDomainParent: Domain{Name: "foo", Parent: "myc"}, - }, - { - domain: Domain{Name: "123", Parent: "foo.myc"}, - expDomainLevel: 3, - expDomainParent: Domain{Name: "foo", Parent: "myc"}, - }, - { - domain: Domain{Name: "12", Parent: "foo.myc"}, - expDomainLevel: 3, - expDomainParent: Domain{Name: "foo", Parent: "myc"}, - }, - { - domain: Domain{Name: "🍭", Parent: "foo.🍭"}, - expDomainLevel: 3, - expDomainParent: Domain{Name: "foo", Parent: "🍭"}, - }, - { - domain: Domain{Name: "🍭", Parent: "foo.🍭.myc"}, - expDomainLevel: 4, - expDomainParent: Domain{Name: "foo.🍭", Parent: "myc"}, + domain: SecondLevelDomain{Name: "foo", Parent: "myc"}, + expDomainParent: TopLevelDomain{Name: "myc"}, }, // Invalid name - {domain: Domain{Name: ".foo", Parent: "myc"}, + {domain: SecondLevelDomain{Name: ".foo", Parent: "myc"}, expErr: fmt.Sprintf("invalid name: .foo"), }, - {domain: Domain{Name: "", Parent: "myc"}, + {domain: SecondLevelDomain{Name: "", Parent: "myc"}, expErr: fmt.Sprintf("invalid name: "), }, - {domain: Domain{Name: "bar.foo", Parent: "myc"}, + {domain: SecondLevelDomain{Name: "bar.foo", Parent: "myc"}, expErr: fmt.Sprintf("invalid name: bar.foo"), }, - {domain: Domain{Name: ".", Parent: "myc"}, + {domain: SecondLevelDomain{Name: ".", Parent: "myc"}, expErr: fmt.Sprintf("invalid name: ."), }, - {domain: Domain{Name: "##", Parent: "myc"}, + {domain: SecondLevelDomain{Name: "##", Parent: "myc"}, expErr: fmt.Sprintf("invalid name: ##"), }, // Invalid parent { - domain: Domain{Name: "foo", Parent: ".##"}, + domain: SecondLevelDomain{Name: "foo", Parent: ".##"}, expErr: fmt.Sprintf("invalid parent: .##"), }, { - domain: Domain{Name: "foo", Parent: ".myc"}, + domain: SecondLevelDomain{Name: "foo", Parent: ".myc"}, expErr: fmt.Sprintf("invalid parent: .myc"), }, { - domain: Domain{Name: "foo", Parent: ".foo.myc"}, + domain: SecondLevelDomain{Name: "foo", Parent: ".foo.myc"}, expErr: fmt.Sprintf("invalid parent: .foo.myc"), }, } @@ -101,13 +67,13 @@ func TestDomainValidate(t *testing.T) { err := tc.domain.Validate() if tc.expErr == "" { require.Nil(t, err) - // Check domain level - require.Equal(t, tc.expDomainLevel, tc.domain.GetDomainLevel()) // Check domain parent - name, parent := tc.domain.ParseParent() - require.Equal(t, tc.expDomainParent.Name, name) - require.Equal(t, tc.expDomainParent.Parent, parent) + parent := tc.domain.ParseParent() + require.Equal(t, tc.expDomainParent.Name, parent) + // TODO: review test case + // require.Equal(t, tc.expDomainParent.Name, name) + // require.Equal(t, tc.expDomainParent.Parent, parent) } else { require.EqualError(t, err, tc.expErr) @@ -179,7 +145,7 @@ func TestDomainUpdateWalletRecord(t *testing.T) { }, } for _, tc := range testCases { - domain := Domain{Name: "foo", Parent: "myc"} + domain := SecondLevelDomain{Name: "foo", Parent: "myc"} err := domain.UpdateWalletRecord(tc.walletRecordType, tc.address) if tc.expErr == "" { require.Nil(t, err) @@ -222,7 +188,7 @@ func TestDomainUpdateDnsRecord(t *testing.T) { }, } for _, tc := range testCases { - domain := Domain{Name: "foo", Parent: "myc"} + domain := SecondLevelDomain{Name: "foo", Parent: "myc"} err := domain.UpdateDnsRecord(tc.dnsRecordType, tc.value) if tc.expErr == "" { require.Nil(t, err) diff --git a/x/registry/types/subdomain_registration_config.go b/x/registry/types/subdomain_config.go similarity index 85% rename from x/registry/types/subdomain_registration_config.go rename to x/registry/types/subdomain_config.go index bcdef77f..58f1d925 100644 --- a/x/registry/types/subdomain_registration_config.go +++ b/x/registry/types/subdomain_config.go @@ -7,11 +7,11 @@ import ( math "math" ) -func GetDefaultSubdomainRegistrationConfig(baseFee int64) SubdomainRegistrationConfig { +func GetDefaultSubdomainConfig(baseFee int64) SubdomainConfig { defaultFee := sdk.NewCoin(MycelDenom, sdk.NewInt(baseFee)) fees := GetFeeByNameLength(10, int(baseFee)) - return SubdomainRegistrationConfig{ + return SubdomainConfig{ MaxSubdomainRegistrations: math.MaxUint64, SubdomainRegistrationFees: &SubdomainRegistrationFees{ FeeByLength: fees, @@ -33,7 +33,7 @@ func GetFeeByNameLength(base int, baseFee int) map[uint32]*Fee { return fees } -func (config *SubdomainRegistrationConfig) GetRegistrationFee(name string, registrationPeriodInYear uint64) (amount *sdk.Coin, err error) { +func (config *SubdomainConfig) GetRegistrationFee(name string, registrationPeriodInYear uint64) (amount *sdk.Coin, err error) { amount = config.SubdomainRegistrationFees.DefaultFee // Set amout if bylength found diff --git a/x/registry/types/subdomain_registration_config.pb.go b/x/registry/types/subdomain_config.pb.go similarity index 67% rename from x/registry/types/subdomain_registration_config.pb.go rename to x/registry/types/subdomain_config.pb.go index a7c6ea6e..fbe825d3 100644 --- a/x/registry/types/subdomain_registration_config.pb.go +++ b/x/registry/types/subdomain_config.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: mycel/registry/subdomain_registration_config.proto +// source: mycel/registry/subdomain_config.proto package types @@ -33,7 +33,7 @@ func (m *SubdomainRegistrationFees) Reset() { *m = SubdomainRegistration func (m *SubdomainRegistrationFees) String() string { return proto.CompactTextString(m) } func (*SubdomainRegistrationFees) ProtoMessage() {} func (*SubdomainRegistrationFees) Descriptor() ([]byte, []int) { - return fileDescriptor_93c8ca252d69a2bc, []int{0} + return fileDescriptor_a1e8e4d1516ffeeb, []int{0} } func (m *SubdomainRegistrationFees) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -92,7 +92,7 @@ func (m *Fee) Reset() { *m = Fee{} } func (m *Fee) String() string { return proto.CompactTextString(m) } func (*Fee) ProtoMessage() {} func (*Fee) Descriptor() ([]byte, []int) { - return fileDescriptor_93c8ca252d69a2bc, []int{1} + return fileDescriptor_a1e8e4d1516ffeeb, []int{1} } func (m *Fee) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -135,23 +135,23 @@ func (m *Fee) GetFee() *types.Coin { return nil } -type SubdomainRegistrationConfig struct { +type SubdomainConfig struct { MaxSubdomainRegistrations uint64 `protobuf:"varint,1,opt,name=maxSubdomainRegistrations,proto3" json:"maxSubdomainRegistrations,omitempty"` SubdomainRegistrationFees *SubdomainRegistrationFees `protobuf:"bytes,2,opt,name=subdomainRegistrationFees,proto3" json:"subdomainRegistrationFees,omitempty"` } -func (m *SubdomainRegistrationConfig) Reset() { *m = SubdomainRegistrationConfig{} } -func (m *SubdomainRegistrationConfig) String() string { return proto.CompactTextString(m) } -func (*SubdomainRegistrationConfig) ProtoMessage() {} -func (*SubdomainRegistrationConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_93c8ca252d69a2bc, []int{2} +func (m *SubdomainConfig) Reset() { *m = SubdomainConfig{} } +func (m *SubdomainConfig) String() string { return proto.CompactTextString(m) } +func (*SubdomainConfig) ProtoMessage() {} +func (*SubdomainConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_a1e8e4d1516ffeeb, []int{2} } -func (m *SubdomainRegistrationConfig) XXX_Unmarshal(b []byte) error { +func (m *SubdomainConfig) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *SubdomainRegistrationConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *SubdomainConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_SubdomainRegistrationConfig.Marshal(b, m, deterministic) + return xxx_messageInfo_SubdomainConfig.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -161,26 +161,26 @@ func (m *SubdomainRegistrationConfig) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *SubdomainRegistrationConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_SubdomainRegistrationConfig.Merge(m, src) +func (m *SubdomainConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_SubdomainConfig.Merge(m, src) } -func (m *SubdomainRegistrationConfig) XXX_Size() int { +func (m *SubdomainConfig) XXX_Size() int { return m.Size() } -func (m *SubdomainRegistrationConfig) XXX_DiscardUnknown() { - xxx_messageInfo_SubdomainRegistrationConfig.DiscardUnknown(m) +func (m *SubdomainConfig) XXX_DiscardUnknown() { + xxx_messageInfo_SubdomainConfig.DiscardUnknown(m) } -var xxx_messageInfo_SubdomainRegistrationConfig proto.InternalMessageInfo +var xxx_messageInfo_SubdomainConfig proto.InternalMessageInfo -func (m *SubdomainRegistrationConfig) GetMaxSubdomainRegistrations() uint64 { +func (m *SubdomainConfig) GetMaxSubdomainRegistrations() uint64 { if m != nil { return m.MaxSubdomainRegistrations } return 0 } -func (m *SubdomainRegistrationConfig) GetSubdomainRegistrationFees() *SubdomainRegistrationFees { +func (m *SubdomainConfig) GetSubdomainRegistrationFees() *SubdomainRegistrationFees { if m != nil { return m.SubdomainRegistrationFees } @@ -192,42 +192,42 @@ func init() { proto.RegisterMapType((map[uint32]*Fee)(nil), "mycel.registry.SubdomainRegistrationFees.FeeByLengthEntry") proto.RegisterMapType((map[string]*Fee)(nil), "mycel.registry.SubdomainRegistrationFees.FeeByNameEntry") proto.RegisterType((*Fee)(nil), "mycel.registry.Fee") - proto.RegisterType((*SubdomainRegistrationConfig)(nil), "mycel.registry.SubdomainRegistrationConfig") + proto.RegisterType((*SubdomainConfig)(nil), "mycel.registry.SubdomainConfig") } func init() { - proto.RegisterFile("mycel/registry/subdomain_registration_config.proto", fileDescriptor_93c8ca252d69a2bc) + proto.RegisterFile("mycel/registry/subdomain_config.proto", fileDescriptor_a1e8e4d1516ffeeb) } -var fileDescriptor_93c8ca252d69a2bc = []byte{ - // 422 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0x41, 0x6b, 0xd4, 0x40, - 0x18, 0x86, 0x77, 0x1a, 0x15, 0xfb, 0x2d, 0x2d, 0x65, 0xbc, 0x6c, 0x56, 0x08, 0xcb, 0xe2, 0x61, - 0x8b, 0x38, 0xa1, 0xeb, 0xa5, 0x16, 0x4f, 0x2d, 0x06, 0x0f, 0x22, 0x38, 0x05, 0x11, 0x11, 0xca, - 0x24, 0xfd, 0x92, 0x0e, 0x26, 0x99, 0x92, 0x99, 0x94, 0xe6, 0x5f, 0xf8, 0x63, 0xfc, 0x09, 0x1e, - 0x3c, 0xf6, 0xe8, 0x51, 0x76, 0xff, 0x88, 0x64, 0xb2, 0x61, 0xb3, 0xa5, 0x11, 0xed, 0x2d, 0x33, - 0xbc, 0xef, 0xf3, 0xbd, 0xbc, 0x99, 0x0f, 0xe6, 0x59, 0x15, 0x61, 0xea, 0x17, 0x98, 0x48, 0x6d, - 0x8a, 0xca, 0xd7, 0x65, 0x78, 0xae, 0x32, 0x21, 0xf3, 0xb3, 0xd5, 0x95, 0x30, 0x52, 0xe5, 0x67, - 0x91, 0xca, 0x63, 0x99, 0xb0, 0xcb, 0x42, 0x19, 0x45, 0x77, 0xad, 0x87, 0xb5, 0x9e, 0xb1, 0x17, - 0x29, 0x9d, 0x29, 0xed, 0x87, 0x42, 0xa3, 0x7f, 0x75, 0x10, 0xa2, 0x11, 0x07, 0x7e, 0xa4, 0x64, - 0xde, 0xe8, 0xa7, 0xdf, 0x1d, 0x70, 0x4f, 0x5b, 0x2e, 0xef, 0x60, 0x03, 0x44, 0x4d, 0xbf, 0xc0, - 0x30, 0x46, 0x3c, 0xae, 0xde, 0x61, 0x9e, 0x98, 0x8b, 0x11, 0x99, 0x38, 0xb3, 0xe1, 0xfc, 0x88, - 0x6d, 0xce, 0x60, 0xbd, 0x7e, 0x16, 0xac, 0xcd, 0x6f, 0x72, 0x53, 0x54, 0xbc, 0x8b, 0xa3, 0x1f, - 0x61, 0xdb, 0x1e, 0xdf, 0x8b, 0x0c, 0x47, 0x5b, 0x96, 0x7d, 0xf8, 0x9f, 0xec, 0xda, 0xda, 0x90, - 0xd7, 0x28, 0xfa, 0x0a, 0xe0, 0x1c, 0x63, 0x51, 0xa6, 0x26, 0x40, 0x1c, 0x39, 0x13, 0x32, 0x1b, - 0xce, 0x5d, 0xd6, 0x14, 0xc1, 0xea, 0x22, 0xd8, 0xaa, 0x08, 0x76, 0xa2, 0x64, 0xce, 0x3b, 0xe2, - 0xf1, 0x29, 0xec, 0xdd, 0xce, 0x4c, 0xf7, 0xc0, 0xf9, 0x8a, 0xd5, 0x88, 0x4c, 0xc8, 0x6c, 0x87, - 0xd7, 0x9f, 0x74, 0x1f, 0x1e, 0x5e, 0x89, 0xb4, 0xac, 0x43, 0xd7, 0xec, 0x27, 0xb7, 0x43, 0x07, - 0x88, 0xbc, 0x51, 0x1c, 0x6d, 0x1d, 0x92, 0xf1, 0x07, 0xd8, 0xdd, 0x0c, 0xdb, 0x45, 0x6e, 0xdf, - 0x07, 0x39, 0xfd, 0x04, 0x4e, 0x80, 0x48, 0x9f, 0xc1, 0x8e, 0xd4, 0x6d, 0x33, 0x61, 0x8a, 0x96, - 0xf8, 0x98, 0x6f, 0x5e, 0xd2, 0xe7, 0xe0, 0xc4, 0xd8, 0x92, 0xff, 0x52, 0x44, 0xad, 0x9a, 0xfe, - 0x20, 0xf0, 0xf4, 0xce, 0xd2, 0x4f, 0xec, 0x33, 0xa3, 0xaf, 0xc1, 0xcd, 0xc4, 0xf5, 0x9d, 0x0a, - 0x6d, 0xc7, 0x3f, 0xe0, 0xfd, 0x02, 0x9a, 0x80, 0xab, 0xfb, 0xfe, 0xe8, 0x2a, 0xe0, 0xfe, 0x3f, - 0x3f, 0x01, 0xde, 0xcf, 0x3a, 0x7e, 0xfb, 0x73, 0xe1, 0x91, 0x9b, 0x85, 0x47, 0x7e, 0x2f, 0x3c, - 0xf2, 0x6d, 0xe9, 0x0d, 0x6e, 0x96, 0xde, 0xe0, 0xd7, 0xd2, 0x1b, 0x7c, 0x66, 0x89, 0x34, 0x17, - 0x65, 0xc8, 0x22, 0x95, 0xf9, 0x76, 0xd2, 0x8b, 0x06, 0xd1, 0x1c, 0xfc, 0xeb, 0xf5, 0xbe, 0x99, - 0xea, 0x12, 0x75, 0xf8, 0xc8, 0x2e, 0xca, 0xcb, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf2, 0xae, - 0x3a, 0x8a, 0x8e, 0x03, 0x00, 0x00, +var fileDescriptor_a1e8e4d1516ffeeb = []byte{ + // 419 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0x4f, 0x6b, 0xd4, 0x40, + 0x18, 0xc6, 0x77, 0x1a, 0x15, 0xfb, 0x2e, 0xad, 0x65, 0xbc, 0x24, 0x7b, 0x08, 0xcb, 0xa2, 0xb0, + 0x45, 0x9c, 0xd0, 0x7a, 0xa9, 0xc5, 0x53, 0x8b, 0xc1, 0x83, 0x08, 0x4e, 0x41, 0x44, 0x04, 0x99, + 0xa4, 0x6f, 0xd2, 0xc1, 0x24, 0x53, 0x32, 0x93, 0xd2, 0x7c, 0x0b, 0x3f, 0x8c, 0x07, 0x3f, 0x82, + 0xc7, 0x1e, 0x3d, 0xca, 0xee, 0x17, 0x91, 0x4c, 0x36, 0xee, 0x1f, 0x8c, 0x68, 0x6f, 0x99, 0xf0, + 0x3c, 0xbf, 0xf7, 0xe1, 0x79, 0x67, 0xe0, 0x71, 0x5e, 0xc7, 0x98, 0x05, 0x25, 0xa6, 0x52, 0x9b, + 0xb2, 0x0e, 0x74, 0x15, 0x9d, 0xab, 0x5c, 0xc8, 0xe2, 0x53, 0xac, 0x8a, 0x44, 0xa6, 0xec, 0xb2, + 0x54, 0x46, 0xd1, 0x5d, 0x2b, 0x63, 0x9d, 0x6c, 0xe4, 0xc7, 0x4a, 0xe7, 0x4a, 0x07, 0x91, 0xd0, + 0x18, 0x5c, 0x1d, 0x44, 0x68, 0xc4, 0x41, 0x10, 0x2b, 0x59, 0xb4, 0xfa, 0xc9, 0x57, 0x07, 0xbc, + 0xb3, 0x0e, 0xc5, 0x5b, 0x97, 0x30, 0x52, 0x15, 0x21, 0xa2, 0xa6, 0x1f, 0x61, 0x98, 0x20, 0x9e, + 0xd4, 0xaf, 0xb1, 0x48, 0xcd, 0x85, 0x4b, 0xc6, 0xce, 0x74, 0x78, 0x78, 0xcc, 0xd6, 0x67, 0xb0, + 0x5e, 0x3f, 0x0b, 0x97, 0xe6, 0x97, 0x85, 0x29, 0x6b, 0xbe, 0x8a, 0xa3, 0xef, 0x60, 0xdb, 0x1e, + 0xdf, 0x88, 0x1c, 0xdd, 0x2d, 0xcb, 0x3e, 0xfa, 0x4f, 0x76, 0x63, 0x6d, 0xc9, 0x4b, 0x14, 0x7d, + 0x0e, 0x70, 0x8e, 0x89, 0xa8, 0x32, 0x13, 0x22, 0xba, 0xce, 0x98, 0x4c, 0x87, 0x87, 0x1e, 0x6b, + 0x8b, 0x60, 0x4d, 0x11, 0x6c, 0x51, 0x04, 0x3b, 0x55, 0xb2, 0xe0, 0x2b, 0xe2, 0xd1, 0x19, 0xec, + 0x6d, 0x66, 0xa6, 0x7b, 0xe0, 0x7c, 0xc6, 0xda, 0x25, 0x63, 0x32, 0xdd, 0xe1, 0xcd, 0x27, 0xdd, + 0x87, 0xbb, 0x57, 0x22, 0xab, 0x9a, 0xd0, 0x0d, 0xfb, 0xe1, 0x66, 0xe8, 0x10, 0x91, 0xb7, 0x8a, + 0xe3, 0xad, 0x23, 0x32, 0x7a, 0x0b, 0xbb, 0xeb, 0x61, 0x57, 0x91, 0xdb, 0xb7, 0x41, 0x4e, 0xde, + 0x83, 0x13, 0x22, 0xd2, 0x47, 0xb0, 0x23, 0x75, 0xd7, 0x4c, 0x94, 0xa1, 0x25, 0xde, 0xe7, 0xeb, + 0x3f, 0xe9, 0x13, 0x70, 0x12, 0xec, 0xc8, 0x7f, 0x29, 0xa2, 0x51, 0x4d, 0xbe, 0x11, 0x78, 0xf0, + 0xbb, 0xf4, 0x53, 0x7b, 0xb5, 0xe8, 0x0b, 0xf0, 0x72, 0x71, 0xfd, 0xc7, 0x55, 0x68, 0x3b, 0xf2, + 0x0e, 0xef, 0x17, 0xd0, 0x14, 0x3c, 0xdd, 0xb7, 0xc5, 0x45, 0xa8, 0xfd, 0x7f, 0x5e, 0x3b, 0xef, + 0x67, 0x9d, 0xbc, 0xfa, 0x3e, 0xf3, 0xc9, 0xcd, 0xcc, 0x27, 0x3f, 0x67, 0x3e, 0xf9, 0x32, 0xf7, + 0x07, 0x37, 0x73, 0x7f, 0xf0, 0x63, 0xee, 0x0f, 0x3e, 0xb0, 0x54, 0x9a, 0x8b, 0x2a, 0x62, 0xb1, + 0xca, 0x03, 0x3b, 0xe9, 0x69, 0x8b, 0x68, 0x0f, 0xc1, 0xf5, 0xf2, 0x59, 0x99, 0xfa, 0x12, 0x75, + 0x74, 0xcf, 0x3e, 0x8e, 0x67, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x6d, 0xb2, 0x08, 0xd7, 0x75, + 0x03, 0x00, 0x00, } func (m *SubdomainRegistrationFees) Marshal() (dAtA []byte, err error) { @@ -257,7 +257,7 @@ func (m *SubdomainRegistrationFees) MarshalToSizedBuffer(dAtA []byte) (int, erro return 0, err } i -= size - i = encodeVarintSubdomainRegistrationConfig(dAtA, i, uint64(size)) + i = encodeVarintSubdomainConfig(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a @@ -273,17 +273,17 @@ func (m *SubdomainRegistrationFees) MarshalToSizedBuffer(dAtA []byte) (int, erro return 0, err } i -= size - i = encodeVarintSubdomainRegistrationConfig(dAtA, i, uint64(size)) + i = encodeVarintSubdomainConfig(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 } i -= len(k) copy(dAtA[i:], k) - i = encodeVarintSubdomainRegistrationConfig(dAtA, i, uint64(len(k))) + i = encodeVarintSubdomainConfig(dAtA, i, uint64(len(k))) i-- dAtA[i] = 0xa - i = encodeVarintSubdomainRegistrationConfig(dAtA, i, uint64(baseI-i)) + i = encodeVarintSubdomainConfig(dAtA, i, uint64(baseI-i)) i-- dAtA[i] = 0x12 } @@ -299,15 +299,15 @@ func (m *SubdomainRegistrationFees) MarshalToSizedBuffer(dAtA []byte) (int, erro return 0, err } i -= size - i = encodeVarintSubdomainRegistrationConfig(dAtA, i, uint64(size)) + i = encodeVarintSubdomainConfig(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 } - i = encodeVarintSubdomainRegistrationConfig(dAtA, i, uint64(k)) + i = encodeVarintSubdomainConfig(dAtA, i, uint64(k)) i-- dAtA[i] = 0x8 - i = encodeVarintSubdomainRegistrationConfig(dAtA, i, uint64(baseI-i)) + i = encodeVarintSubdomainConfig(dAtA, i, uint64(baseI-i)) i-- dAtA[i] = 0xa } @@ -342,7 +342,7 @@ func (m *Fee) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintSubdomainRegistrationConfig(dAtA, i, uint64(size)) + i = encodeVarintSubdomainConfig(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 @@ -360,7 +360,7 @@ func (m *Fee) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *SubdomainRegistrationConfig) Marshal() (dAtA []byte, err error) { +func (m *SubdomainConfig) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -370,12 +370,12 @@ func (m *SubdomainRegistrationConfig) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *SubdomainRegistrationConfig) MarshalTo(dAtA []byte) (int, error) { +func (m *SubdomainConfig) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *SubdomainRegistrationConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *SubdomainConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -387,21 +387,21 @@ func (m *SubdomainRegistrationConfig) MarshalToSizedBuffer(dAtA []byte) (int, er return 0, err } i -= size - i = encodeVarintSubdomainRegistrationConfig(dAtA, i, uint64(size)) + i = encodeVarintSubdomainConfig(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 } if m.MaxSubdomainRegistrations != 0 { - i = encodeVarintSubdomainRegistrationConfig(dAtA, i, uint64(m.MaxSubdomainRegistrations)) + i = encodeVarintSubdomainConfig(dAtA, i, uint64(m.MaxSubdomainRegistrations)) i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } -func encodeVarintSubdomainRegistrationConfig(dAtA []byte, offset int, v uint64) int { - offset -= sovSubdomainRegistrationConfig(v) +func encodeVarintSubdomainConfig(dAtA []byte, offset int, v uint64) int { + offset -= sovSubdomainConfig(v) base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) @@ -424,10 +424,10 @@ func (m *SubdomainRegistrationFees) Size() (n int) { l = 0 if v != nil { l = v.Size() - l += 1 + sovSubdomainRegistrationConfig(uint64(l)) + l += 1 + sovSubdomainConfig(uint64(l)) } - mapEntrySize := 1 + sovSubdomainRegistrationConfig(uint64(k)) + l - n += mapEntrySize + 1 + sovSubdomainRegistrationConfig(uint64(mapEntrySize)) + mapEntrySize := 1 + sovSubdomainConfig(uint64(k)) + l + n += mapEntrySize + 1 + sovSubdomainConfig(uint64(mapEntrySize)) } } if len(m.FeeByName) > 0 { @@ -437,15 +437,15 @@ func (m *SubdomainRegistrationFees) Size() (n int) { l = 0 if v != nil { l = v.Size() - l += 1 + sovSubdomainRegistrationConfig(uint64(l)) + l += 1 + sovSubdomainConfig(uint64(l)) } - mapEntrySize := 1 + len(k) + sovSubdomainRegistrationConfig(uint64(len(k))) + l - n += mapEntrySize + 1 + sovSubdomainRegistrationConfig(uint64(mapEntrySize)) + mapEntrySize := 1 + len(k) + sovSubdomainConfig(uint64(len(k))) + l + n += mapEntrySize + 1 + sovSubdomainConfig(uint64(mapEntrySize)) } } if m.DefaultFee != nil { l = m.DefaultFee.Size() - n += 1 + l + sovSubdomainRegistrationConfig(uint64(l)) + n += 1 + l + sovSubdomainConfig(uint64(l)) } return n } @@ -461,32 +461,32 @@ func (m *Fee) Size() (n int) { } if m.Fee != nil { l = m.Fee.Size() - n += 1 + l + sovSubdomainRegistrationConfig(uint64(l)) + n += 1 + l + sovSubdomainConfig(uint64(l)) } return n } -func (m *SubdomainRegistrationConfig) Size() (n int) { +func (m *SubdomainConfig) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.MaxSubdomainRegistrations != 0 { - n += 1 + sovSubdomainRegistrationConfig(uint64(m.MaxSubdomainRegistrations)) + n += 1 + sovSubdomainConfig(uint64(m.MaxSubdomainRegistrations)) } if m.SubdomainRegistrationFees != nil { l = m.SubdomainRegistrationFees.Size() - n += 1 + l + sovSubdomainRegistrationConfig(uint64(l)) + n += 1 + l + sovSubdomainConfig(uint64(l)) } return n } -func sovSubdomainRegistrationConfig(x uint64) (n int) { +func sovSubdomainConfig(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } -func sozSubdomainRegistrationConfig(x uint64) (n int) { - return sovSubdomainRegistrationConfig(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +func sozSubdomainConfig(x uint64) (n int) { + return sovSubdomainConfig(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (m *SubdomainRegistrationFees) Unmarshal(dAtA []byte) error { l := len(dAtA) @@ -496,7 +496,7 @@ func (m *SubdomainRegistrationFees) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowSubdomainRegistrationConfig + return ErrIntOverflowSubdomainConfig } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -524,7 +524,7 @@ func (m *SubdomainRegistrationFees) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowSubdomainRegistrationConfig + return ErrIntOverflowSubdomainConfig } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -537,11 +537,11 @@ func (m *SubdomainRegistrationFees) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthSubdomainRegistrationConfig + return ErrInvalidLengthSubdomainConfig } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthSubdomainRegistrationConfig + return ErrInvalidLengthSubdomainConfig } if postIndex > l { return io.ErrUnexpectedEOF @@ -556,7 +556,7 @@ func (m *SubdomainRegistrationFees) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowSubdomainRegistrationConfig + return ErrIntOverflowSubdomainConfig } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -572,7 +572,7 @@ func (m *SubdomainRegistrationFees) Unmarshal(dAtA []byte) error { if fieldNum == 1 { for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowSubdomainRegistrationConfig + return ErrIntOverflowSubdomainConfig } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -588,7 +588,7 @@ func (m *SubdomainRegistrationFees) Unmarshal(dAtA []byte) error { var mapmsglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowSubdomainRegistrationConfig + return ErrIntOverflowSubdomainConfig } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -601,11 +601,11 @@ func (m *SubdomainRegistrationFees) Unmarshal(dAtA []byte) error { } } if mapmsglen < 0 { - return ErrInvalidLengthSubdomainRegistrationConfig + return ErrInvalidLengthSubdomainConfig } postmsgIndex := iNdEx + mapmsglen if postmsgIndex < 0 { - return ErrInvalidLengthSubdomainRegistrationConfig + return ErrInvalidLengthSubdomainConfig } if postmsgIndex > l { return io.ErrUnexpectedEOF @@ -617,12 +617,12 @@ func (m *SubdomainRegistrationFees) Unmarshal(dAtA []byte) error { iNdEx = postmsgIndex } else { iNdEx = entryPreIndex - skippy, err := skipSubdomainRegistrationConfig(dAtA[iNdEx:]) + skippy, err := skipSubdomainConfig(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSubdomainRegistrationConfig + return ErrInvalidLengthSubdomainConfig } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF @@ -639,7 +639,7 @@ func (m *SubdomainRegistrationFees) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowSubdomainRegistrationConfig + return ErrIntOverflowSubdomainConfig } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -652,11 +652,11 @@ func (m *SubdomainRegistrationFees) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthSubdomainRegistrationConfig + return ErrInvalidLengthSubdomainConfig } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthSubdomainRegistrationConfig + return ErrInvalidLengthSubdomainConfig } if postIndex > l { return io.ErrUnexpectedEOF @@ -671,7 +671,7 @@ func (m *SubdomainRegistrationFees) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowSubdomainRegistrationConfig + return ErrIntOverflowSubdomainConfig } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -688,7 +688,7 @@ func (m *SubdomainRegistrationFees) Unmarshal(dAtA []byte) error { var stringLenmapkey uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowSubdomainRegistrationConfig + return ErrIntOverflowSubdomainConfig } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -702,11 +702,11 @@ func (m *SubdomainRegistrationFees) Unmarshal(dAtA []byte) error { } intStringLenmapkey := int(stringLenmapkey) if intStringLenmapkey < 0 { - return ErrInvalidLengthSubdomainRegistrationConfig + return ErrInvalidLengthSubdomainConfig } postStringIndexmapkey := iNdEx + intStringLenmapkey if postStringIndexmapkey < 0 { - return ErrInvalidLengthSubdomainRegistrationConfig + return ErrInvalidLengthSubdomainConfig } if postStringIndexmapkey > l { return io.ErrUnexpectedEOF @@ -717,7 +717,7 @@ func (m *SubdomainRegistrationFees) Unmarshal(dAtA []byte) error { var mapmsglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowSubdomainRegistrationConfig + return ErrIntOverflowSubdomainConfig } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -730,11 +730,11 @@ func (m *SubdomainRegistrationFees) Unmarshal(dAtA []byte) error { } } if mapmsglen < 0 { - return ErrInvalidLengthSubdomainRegistrationConfig + return ErrInvalidLengthSubdomainConfig } postmsgIndex := iNdEx + mapmsglen if postmsgIndex < 0 { - return ErrInvalidLengthSubdomainRegistrationConfig + return ErrInvalidLengthSubdomainConfig } if postmsgIndex > l { return io.ErrUnexpectedEOF @@ -746,12 +746,12 @@ func (m *SubdomainRegistrationFees) Unmarshal(dAtA []byte) error { iNdEx = postmsgIndex } else { iNdEx = entryPreIndex - skippy, err := skipSubdomainRegistrationConfig(dAtA[iNdEx:]) + skippy, err := skipSubdomainConfig(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSubdomainRegistrationConfig + return ErrInvalidLengthSubdomainConfig } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF @@ -768,7 +768,7 @@ func (m *SubdomainRegistrationFees) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowSubdomainRegistrationConfig + return ErrIntOverflowSubdomainConfig } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -781,11 +781,11 @@ func (m *SubdomainRegistrationFees) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthSubdomainRegistrationConfig + return ErrInvalidLengthSubdomainConfig } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthSubdomainRegistrationConfig + return ErrInvalidLengthSubdomainConfig } if postIndex > l { return io.ErrUnexpectedEOF @@ -799,12 +799,12 @@ func (m *SubdomainRegistrationFees) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipSubdomainRegistrationConfig(dAtA[iNdEx:]) + skippy, err := skipSubdomainConfig(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSubdomainRegistrationConfig + return ErrInvalidLengthSubdomainConfig } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -826,7 +826,7 @@ func (m *Fee) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowSubdomainRegistrationConfig + return ErrIntOverflowSubdomainConfig } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -854,7 +854,7 @@ func (m *Fee) Unmarshal(dAtA []byte) error { var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowSubdomainRegistrationConfig + return ErrIntOverflowSubdomainConfig } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -874,7 +874,7 @@ func (m *Fee) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowSubdomainRegistrationConfig + return ErrIntOverflowSubdomainConfig } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -887,11 +887,11 @@ func (m *Fee) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthSubdomainRegistrationConfig + return ErrInvalidLengthSubdomainConfig } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthSubdomainRegistrationConfig + return ErrInvalidLengthSubdomainConfig } if postIndex > l { return io.ErrUnexpectedEOF @@ -905,12 +905,12 @@ func (m *Fee) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipSubdomainRegistrationConfig(dAtA[iNdEx:]) + skippy, err := skipSubdomainConfig(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSubdomainRegistrationConfig + return ErrInvalidLengthSubdomainConfig } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -924,7 +924,7 @@ func (m *Fee) Unmarshal(dAtA []byte) error { } return nil } -func (m *SubdomainRegistrationConfig) Unmarshal(dAtA []byte) error { +func (m *SubdomainConfig) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -932,7 +932,7 @@ func (m *SubdomainRegistrationConfig) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowSubdomainRegistrationConfig + return ErrIntOverflowSubdomainConfig } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -947,10 +947,10 @@ func (m *SubdomainRegistrationConfig) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: SubdomainRegistrationConfig: wiretype end group for non-group") + return fmt.Errorf("proto: SubdomainConfig: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: SubdomainRegistrationConfig: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: SubdomainConfig: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -960,7 +960,7 @@ func (m *SubdomainRegistrationConfig) Unmarshal(dAtA []byte) error { m.MaxSubdomainRegistrations = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowSubdomainRegistrationConfig + return ErrIntOverflowSubdomainConfig } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -979,7 +979,7 @@ func (m *SubdomainRegistrationConfig) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowSubdomainRegistrationConfig + return ErrIntOverflowSubdomainConfig } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -992,11 +992,11 @@ func (m *SubdomainRegistrationConfig) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthSubdomainRegistrationConfig + return ErrInvalidLengthSubdomainConfig } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthSubdomainRegistrationConfig + return ErrInvalidLengthSubdomainConfig } if postIndex > l { return io.ErrUnexpectedEOF @@ -1010,12 +1010,12 @@ func (m *SubdomainRegistrationConfig) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipSubdomainRegistrationConfig(dAtA[iNdEx:]) + skippy, err := skipSubdomainConfig(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSubdomainRegistrationConfig + return ErrInvalidLengthSubdomainConfig } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -1029,7 +1029,7 @@ func (m *SubdomainRegistrationConfig) Unmarshal(dAtA []byte) error { } return nil } -func skipSubdomainRegistrationConfig(dAtA []byte) (n int, err error) { +func skipSubdomainConfig(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 depth := 0 @@ -1037,7 +1037,7 @@ func skipSubdomainRegistrationConfig(dAtA []byte) (n int, err error) { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowSubdomainRegistrationConfig + return 0, ErrIntOverflowSubdomainConfig } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -1054,7 +1054,7 @@ func skipSubdomainRegistrationConfig(dAtA []byte) (n int, err error) { case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowSubdomainRegistrationConfig + return 0, ErrIntOverflowSubdomainConfig } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -1070,7 +1070,7 @@ func skipSubdomainRegistrationConfig(dAtA []byte) (n int, err error) { var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowSubdomainRegistrationConfig + return 0, ErrIntOverflowSubdomainConfig } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -1083,14 +1083,14 @@ func skipSubdomainRegistrationConfig(dAtA []byte) (n int, err error) { } } if length < 0 { - return 0, ErrInvalidLengthSubdomainRegistrationConfig + return 0, ErrInvalidLengthSubdomainConfig } iNdEx += length case 3: depth++ case 4: if depth == 0 { - return 0, ErrUnexpectedEndOfGroupSubdomainRegistrationConfig + return 0, ErrUnexpectedEndOfGroupSubdomainConfig } depth-- case 5: @@ -1099,7 +1099,7 @@ func skipSubdomainRegistrationConfig(dAtA []byte) (n int, err error) { return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } if iNdEx < 0 { - return 0, ErrInvalidLengthSubdomainRegistrationConfig + return 0, ErrInvalidLengthSubdomainConfig } if depth == 0 { return iNdEx, nil @@ -1109,7 +1109,7 @@ func skipSubdomainRegistrationConfig(dAtA []byte) (n int, err error) { } var ( - ErrInvalidLengthSubdomainRegistrationConfig = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowSubdomainRegistrationConfig = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupSubdomainRegistrationConfig = fmt.Errorf("proto: unexpected end of group") + ErrInvalidLengthSubdomainConfig = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowSubdomainConfig = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupSubdomainConfig = fmt.Errorf("proto: unexpected end of group") ) diff --git a/x/registry/types/top_level_domain.pb.go b/x/registry/types/top_level_domain.pb.go new file mode 100644 index 00000000..0769da53 --- /dev/null +++ b/x/registry/types/top_level_domain.pb.go @@ -0,0 +1,971 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: mycel/registry/top_level_domain.proto + +package types + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type TopLevelDomainRole struct { + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` +} + +func (m *TopLevelDomainRole) Reset() { *m = TopLevelDomainRole{} } +func (m *TopLevelDomainRole) String() string { return proto.CompactTextString(m) } +func (*TopLevelDomainRole) ProtoMessage() {} +func (*TopLevelDomainRole) Descriptor() ([]byte, []int) { + return fileDescriptor_0136e389ac8054f7, []int{0} +} +func (m *TopLevelDomainRole) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TopLevelDomainRole) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TopLevelDomainRole.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TopLevelDomainRole) XXX_Merge(src proto.Message) { + xxx_messageInfo_TopLevelDomainRole.Merge(m, src) +} +func (m *TopLevelDomainRole) XXX_Size() int { + return m.Size() +} +func (m *TopLevelDomainRole) XXX_DiscardUnknown() { + xxx_messageInfo_TopLevelDomainRole.DiscardUnknown(m) +} + +var xxx_messageInfo_TopLevelDomainRole proto.InternalMessageInfo + +func (m *TopLevelDomainRole) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +type TopLevelDomain struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + ExpirationDate int64 `protobuf:"varint,2,opt,name=expirationDate,proto3" json:"expirationDate,omitempty"` + Metadata map[string]string `protobuf:"bytes,3,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + SubdomainConfig *SubdomainConfig `protobuf:"bytes,4,opt,name=subdomainConfig,proto3" json:"subdomainConfig,omitempty"` + SubdomainCount uint64 `protobuf:"varint,5,opt,name=subdomainCount,proto3" json:"subdomainCount,omitempty"` + AccessControl map[string]*TopLevelDomainRole `protobuf:"bytes,6,rep,name=accessControl,proto3" json:"accessControl,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (m *TopLevelDomain) Reset() { *m = TopLevelDomain{} } +func (m *TopLevelDomain) String() string { return proto.CompactTextString(m) } +func (*TopLevelDomain) ProtoMessage() {} +func (*TopLevelDomain) Descriptor() ([]byte, []int) { + return fileDescriptor_0136e389ac8054f7, []int{1} +} +func (m *TopLevelDomain) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TopLevelDomain) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TopLevelDomain.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TopLevelDomain) XXX_Merge(src proto.Message) { + xxx_messageInfo_TopLevelDomain.Merge(m, src) +} +func (m *TopLevelDomain) XXX_Size() int { + return m.Size() +} +func (m *TopLevelDomain) XXX_DiscardUnknown() { + xxx_messageInfo_TopLevelDomain.DiscardUnknown(m) +} + +var xxx_messageInfo_TopLevelDomain proto.InternalMessageInfo + +func (m *TopLevelDomain) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *TopLevelDomain) GetExpirationDate() int64 { + if m != nil { + return m.ExpirationDate + } + return 0 +} + +func (m *TopLevelDomain) GetMetadata() map[string]string { + if m != nil { + return m.Metadata + } + return nil +} + +func (m *TopLevelDomain) GetSubdomainConfig() *SubdomainConfig { + if m != nil { + return m.SubdomainConfig + } + return nil +} + +func (m *TopLevelDomain) GetSubdomainCount() uint64 { + if m != nil { + return m.SubdomainCount + } + return 0 +} + +func (m *TopLevelDomain) GetAccessControl() map[string]*TopLevelDomainRole { + if m != nil { + return m.AccessControl + } + return nil +} + +func init() { + proto.RegisterType((*TopLevelDomainRole)(nil), "mycel.registry.TopLevelDomainRole") + proto.RegisterType((*TopLevelDomain)(nil), "mycel.registry.TopLevelDomain") + proto.RegisterMapType((map[string]*TopLevelDomainRole)(nil), "mycel.registry.TopLevelDomain.AccessControlEntry") + proto.RegisterMapType((map[string]string)(nil), "mycel.registry.TopLevelDomain.MetadataEntry") +} + +func init() { + proto.RegisterFile("mycel/registry/top_level_domain.proto", fileDescriptor_0136e389ac8054f7) +} + +var fileDescriptor_0136e389ac8054f7 = []byte{ + // 392 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x52, 0x41, 0x4b, 0xeb, 0x40, + 0x10, 0xee, 0x36, 0x69, 0x79, 0xdd, 0xd2, 0xbe, 0xc7, 0xf2, 0x0e, 0xa1, 0x87, 0xbc, 0x50, 0x78, + 0x12, 0x44, 0x13, 0xac, 0x97, 0xa2, 0x27, 0x6d, 0x85, 0x0a, 0x7a, 0x89, 0x82, 0xe0, 0xa5, 0x6c, + 0xd3, 0xb5, 0x06, 0x93, 0xdd, 0x90, 0x6c, 0x6a, 0xf3, 0x03, 0xbc, 0xfb, 0xb3, 0x3c, 0xf6, 0xe8, + 0x51, 0xda, 0x3f, 0x22, 0xd9, 0xad, 0x25, 0x89, 0xa2, 0xb7, 0x99, 0xd9, 0xef, 0xfb, 0x66, 0xbe, + 0xd9, 0x81, 0xff, 0x83, 0xd4, 0x25, 0xbe, 0x1d, 0x91, 0x99, 0x17, 0xf3, 0x28, 0xb5, 0x39, 0x0b, + 0xc7, 0x3e, 0x99, 0x13, 0x7f, 0x3c, 0x65, 0x01, 0xf6, 0xa8, 0x15, 0x46, 0x8c, 0x33, 0xd4, 0x16, + 0x30, 0xeb, 0x03, 0xd6, 0x29, 0xd3, 0xe2, 0x64, 0x22, 0xf1, 0x63, 0x97, 0xd1, 0x3b, 0x6f, 0x26, + 0x69, 0xdd, 0x5d, 0x88, 0xae, 0x59, 0x78, 0x91, 0xe9, 0x0d, 0xc5, 0xb3, 0xc3, 0x7c, 0x82, 0xfe, + 0xc2, 0x1a, 0x7b, 0xa4, 0x24, 0xd2, 0x80, 0x01, 0xcc, 0x86, 0x23, 0x93, 0xee, 0x93, 0x0a, 0xdb, + 0x45, 0x30, 0x42, 0x50, 0xa5, 0x38, 0x20, 0x1b, 0x9c, 0x88, 0xd1, 0x0e, 0x6c, 0x93, 0x45, 0xe8, + 0x45, 0x98, 0x7b, 0x8c, 0x0e, 0x31, 0x27, 0x5a, 0xd5, 0x00, 0xa6, 0xe2, 0x94, 0xaa, 0x68, 0x04, + 0x7f, 0x05, 0x84, 0xe3, 0x29, 0xe6, 0x58, 0x53, 0x0c, 0xc5, 0x6c, 0xf6, 0xf6, 0xac, 0xa2, 0x09, + 0xab, 0xd8, 0xcd, 0xba, 0xdc, 0xc0, 0xcf, 0x28, 0x8f, 0x52, 0x67, 0xcb, 0x46, 0xe7, 0xf0, 0xf7, + 0xd6, 0xde, 0x40, 0xb8, 0xd3, 0x54, 0x03, 0x98, 0xcd, 0xde, 0xbf, 0xb2, 0xe0, 0x55, 0x11, 0xe6, + 0x94, 0x79, 0xd9, 0xf0, 0xb9, 0x52, 0x42, 0xb9, 0x56, 0x33, 0x80, 0xa9, 0x3a, 0xa5, 0x2a, 0xba, + 0x81, 0x2d, 0xec, 0xba, 0x24, 0x8e, 0x07, 0x8c, 0xf2, 0x88, 0xf9, 0x5a, 0x5d, 0x38, 0x38, 0xf8, + 0xc1, 0xc1, 0x49, 0x9e, 0x23, 0x6d, 0x14, 0x75, 0x3a, 0xc7, 0xb0, 0x55, 0xb0, 0x89, 0xfe, 0x40, + 0xe5, 0x81, 0xa4, 0x9b, 0x0d, 0x67, 0x61, 0xf6, 0x3b, 0x73, 0xec, 0x27, 0x72, 0xaf, 0x0d, 0x47, + 0x26, 0x47, 0xd5, 0x3e, 0xe8, 0x4c, 0x21, 0xfa, 0xdc, 0xe1, 0x0b, 0x85, 0x7e, 0x5e, 0xa1, 0xd9, + 0xeb, 0x7e, 0x3f, 0x75, 0x76, 0x12, 0xb9, 0x2e, 0xa7, 0xa3, 0x97, 0x95, 0x0e, 0x96, 0x2b, 0x1d, + 0xbc, 0xad, 0x74, 0xf0, 0xbc, 0xd6, 0x2b, 0xcb, 0xb5, 0x5e, 0x79, 0x5d, 0xeb, 0x95, 0x5b, 0x6b, + 0xe6, 0xf1, 0xfb, 0x64, 0x62, 0xb9, 0x2c, 0xb0, 0x85, 0xe4, 0xbe, 0xdc, 0x99, 0x4c, 0xec, 0x45, + 0xee, 0x8a, 0xd3, 0x90, 0xc4, 0x93, 0xba, 0x38, 0xc2, 0xc3, 0xf7, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xbf, 0x03, 0x9b, 0xe0, 0xe4, 0x02, 0x00, 0x00, +} + +func (m *TopLevelDomainRole) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TopLevelDomainRole) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TopLevelDomainRole) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTopLevelDomain(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TopLevelDomain) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TopLevelDomain) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TopLevelDomain) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AccessControl) > 0 { + for k := range m.AccessControl { + v := m.AccessControl[k] + baseI := i + if v != nil { + { + size, err := v.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTopLevelDomain(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintTopLevelDomain(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintTopLevelDomain(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x32 + } + } + if m.SubdomainCount != 0 { + i = encodeVarintTopLevelDomain(dAtA, i, uint64(m.SubdomainCount)) + i-- + dAtA[i] = 0x28 + } + if m.SubdomainConfig != nil { + { + size, err := m.SubdomainConfig.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTopLevelDomain(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if len(m.Metadata) > 0 { + for k := range m.Metadata { + v := m.Metadata[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarintTopLevelDomain(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintTopLevelDomain(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintTopLevelDomain(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x1a + } + } + if m.ExpirationDate != 0 { + i = encodeVarintTopLevelDomain(dAtA, i, uint64(m.ExpirationDate)) + i-- + dAtA[i] = 0x10 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTopLevelDomain(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTopLevelDomain(dAtA []byte, offset int, v uint64) int { + offset -= sovTopLevelDomain(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *TopLevelDomainRole) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovTopLevelDomain(uint64(l)) + } + return n +} + +func (m *TopLevelDomain) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTopLevelDomain(uint64(l)) + } + if m.ExpirationDate != 0 { + n += 1 + sovTopLevelDomain(uint64(m.ExpirationDate)) + } + if len(m.Metadata) > 0 { + for k, v := range m.Metadata { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovTopLevelDomain(uint64(len(k))) + 1 + len(v) + sovTopLevelDomain(uint64(len(v))) + n += mapEntrySize + 1 + sovTopLevelDomain(uint64(mapEntrySize)) + } + } + if m.SubdomainConfig != nil { + l = m.SubdomainConfig.Size() + n += 1 + l + sovTopLevelDomain(uint64(l)) + } + if m.SubdomainCount != 0 { + n += 1 + sovTopLevelDomain(uint64(m.SubdomainCount)) + } + if len(m.AccessControl) > 0 { + for k, v := range m.AccessControl { + _ = k + _ = v + l = 0 + if v != nil { + l = v.Size() + l += 1 + sovTopLevelDomain(uint64(l)) + } + mapEntrySize := 1 + len(k) + sovTopLevelDomain(uint64(len(k))) + l + n += mapEntrySize + 1 + sovTopLevelDomain(uint64(mapEntrySize)) + } + } + return n +} + +func sovTopLevelDomain(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTopLevelDomain(x uint64) (n int) { + return sovTopLevelDomain(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *TopLevelDomainRole) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopLevelDomain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TopLevelDomainRole: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TopLevelDomainRole: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopLevelDomain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTopLevelDomain + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTopLevelDomain + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTopLevelDomain(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTopLevelDomain + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TopLevelDomain) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopLevelDomain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TopLevelDomain: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TopLevelDomain: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopLevelDomain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTopLevelDomain + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTopLevelDomain + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExpirationDate", wireType) + } + m.ExpirationDate = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopLevelDomain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExpirationDate |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopLevelDomain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTopLevelDomain + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTopLevelDomain + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Metadata == nil { + m.Metadata = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopLevelDomain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopLevelDomain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthTopLevelDomain + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthTopLevelDomain + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopLevelDomain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthTopLevelDomain + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return ErrInvalidLengthTopLevelDomain + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skipTopLevelDomain(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTopLevelDomain + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Metadata[mapkey] = mapvalue + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubdomainConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopLevelDomain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTopLevelDomain + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTopLevelDomain + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SubdomainConfig == nil { + m.SubdomainConfig = &SubdomainConfig{} + } + if err := m.SubdomainConfig.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SubdomainCount", wireType) + } + m.SubdomainCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopLevelDomain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SubdomainCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AccessControl", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopLevelDomain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTopLevelDomain + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTopLevelDomain + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.AccessControl == nil { + m.AccessControl = make(map[string]*TopLevelDomainRole) + } + var mapkey string + var mapvalue *TopLevelDomainRole + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopLevelDomain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopLevelDomain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthTopLevelDomain + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthTopLevelDomain + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopLevelDomain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthTopLevelDomain + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLengthTopLevelDomain + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &TopLevelDomainRole{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipTopLevelDomain(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTopLevelDomain + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.AccessControl[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTopLevelDomain(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTopLevelDomain + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTopLevelDomain(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTopLevelDomain + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTopLevelDomain + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTopLevelDomain + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTopLevelDomain + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTopLevelDomain + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTopLevelDomain + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTopLevelDomain = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTopLevelDomain = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTopLevelDomain = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/registry/types/valdiate_domain.go b/x/registry/types/valdiate_second_level_domain.go similarity index 69% rename from x/registry/types/valdiate_domain.go rename to x/registry/types/valdiate_second_level_domain.go index b82f8173..57ff5419 100644 --- a/x/registry/types/valdiate_domain.go +++ b/x/registry/types/valdiate_second_level_domain.go @@ -12,28 +12,28 @@ const ( NamePattern = `-a-z0-9\p{So}\p{Sk}` ) -func (domain Domain) ValidateName() (err error) { +func (secondLevelDomain SecondLevelDomain) ValidateName() (err error) { regex := regexp.MustCompile(fmt.Sprintf(`(^[%s]+$)`, NamePattern)) - if !regex.MatchString(domain.Name) { - err = sdkerrors.Wrapf(errors.New(fmt.Sprintf("%s", domain.Name)), ErrInvalidDomainName.Error()) + if !regex.MatchString(secondLevelDomain.Name) { + err = sdkerrors.Wrapf(errors.New(fmt.Sprintf("%s", secondLevelDomain.Name)), ErrInvalidDomainName.Error()) } return err } -func (domain Domain) ValidateParent() (err error) { +func (secondLevelDomain SecondLevelDomain) ValidateParent() (err error) { regex := regexp.MustCompile(fmt.Sprintf(`(^[%s]+[%[1]s\.]*[%[1]s]$)|^$`, NamePattern)) - if !regex.MatchString(domain.Parent) { - err = sdkerrors.Wrapf(errors.New(fmt.Sprintf("%s", domain.Parent)), ErrInvalidDomainParent.Error()) + if !regex.MatchString(secondLevelDomain.Parent) { + err = sdkerrors.Wrapf(errors.New(fmt.Sprintf("%s", secondLevelDomain.Parent)), ErrInvalidDomainParent.Error()) } return err } -func (domain Domain) Validate() (err error) { - err = domain.ValidateName() +func (secondLevelDomain SecondLevelDomain) Validate() (err error) { + err = secondLevelDomain.ValidateName() if err != nil { return err } - err = domain.ValidateParent() + err = secondLevelDomain.ValidateParent() if err != nil { return err } diff --git a/x/registry/types/wallet_record.go b/x/registry/types/wallet_record.go index b9a7a694..d1fff8cd 100644 --- a/x/registry/types/wallet_record.go +++ b/x/registry/types/wallet_record.go @@ -19,25 +19,25 @@ func WalletRecordFormats() map[string]string { // EVM "ETHEREUM_MAINNET_MAINNET": "ETHEREUM", "ETHEREUM_TESTNET_GOERLI": "ETHEREUM", - "ETHEREUM_TESTNET_SEPOLIA": "ETHEREUM", + "ETHEREUM_TESTNET_SEPOLIA": "ETHEREUM", // Polygon - "POLYGON_MAINNET_MAINNET": "ETHEREUM", - "POLYGON_TESTNET_MUMBAI": "ETHEREUM", + "POLYGON_MAINNET_MAINNET": "ETHEREUM", + "POLYGON_TESTNET_MUMBAI": "ETHEREUM", // BNB - "BNB_MAINNET_MAINNET": "ETHEREUM", - "BNB_TESTNET_TESTNET": "ETHEREUM", + "BNB_MAINNET_MAINNET": "ETHEREUM", + "BNB_TESTNET_TESTNET": "ETHEREUM", // Avalanche "AVALANCHE_MAINNET_CCHAIN": "ETHEREUM", - "AVALANCHE_TESTNET_FUJI": "ETHEREUM", + "AVALANCHE_TESTNET_FUJI": "ETHEREUM", // Gnosis - "GNOSIS_MAINNET_MAINNET": "ETHEREUM", - "GNOSIS_TESTNET_CHIADO": "ETHEREUM", + "GNOSIS_MAINNET_MAINNET": "ETHEREUM", + "GNOSIS_TESTNET_CHIADO": "ETHEREUM", // Optimism - "OPTIMISM_MAINNET_MAINNET": "ETHEREUM", - "OPTIMISM_TESTNET_GOERLI": "ETHEREUM", + "OPTIMISM_MAINNET_MAINNET": "ETHEREUM", + "OPTIMISM_TESTNET_GOERLI": "ETHEREUM", // Arbitrum - "ARBITRUM_MAINNET_MAINNET": "ETHEREUM", - "ARBITRUM_TESTNET_GOERLI": "ETHEREUM", + "ARBITRUM_MAINNET_MAINNET": "ETHEREUM", + "ARBITRUM_TESTNET_GOERLI": "ETHEREUM", // Shardeum "SHARDEUM_BETANET_SPHINX": "ETHEREUM", // ZetaChain