├── .github ├── dependabot.yml └── workflows │ ├── iroha2-allure.yml │ ├── iroha2-ci.yml │ ├── iroha2-pr.yml │ └── iroha2.yml ├── .gitignore ├── MAINTAINERS.md ├── README.md ├── build.gradle ├── docker-compose └── docker-compose.yaml ├── examples └── tutorial │ ├── build.gradle.kts │ └── src │ └── main │ └── kotlin │ └── jp │ └── co │ └── soramitsu │ └── iroha2 │ ├── Main.kt │ ├── Query.kt │ └── SendTransaction.kt ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── jitpack.yml ├── modules ├── admin-client │ ├── README.md │ ├── build.gradle │ └── src │ │ ├── main │ │ └── kotlin │ │ │ └── jp │ │ │ └── co │ │ │ └── soramitsu │ │ │ └── iroha2 │ │ │ ├── AdminIroha2AsyncClient.kt │ │ │ ├── AdminIroha2Client.kt │ │ │ └── PeerStatus.kt │ │ └── test │ │ ├── kotlin │ │ └── jp │ │ │ └── co │ │ │ └── soramitsu │ │ │ └── iroha2 │ │ │ └── ClientTest.kt │ │ └── resources │ │ ├── junit-platform.properties │ │ └── logback-test.xml ├── block │ ├── README.md │ ├── build.gradle │ └── src │ │ ├── main │ │ └── kotlin │ │ │ └── jp │ │ │ └── co │ │ │ └── soramitsu │ │ │ └── iroha2 │ │ │ └── Genesis.kt │ │ └── test │ │ ├── kotlin │ │ └── jp │ │ │ └── co │ │ │ └── soramitsu │ │ │ └── iroha2 │ │ │ ├── DeserializerTest.kt │ │ │ └── SerializerTest.kt │ │ └── resources │ │ └── executor.wasm ├── client │ ├── .DS_Store │ ├── README.md │ ├── build.gradle │ └── src │ │ ├── main │ │ └── kotlin │ │ │ └── jp │ │ │ └── co │ │ │ └── soramitsu │ │ │ └── iroha2 │ │ │ ├── Exceptions.kt │ │ │ ├── Extractors.kt │ │ │ ├── SingletonHolder.kt │ │ │ ├── client │ │ │ ├── Iroha2AsyncClient.kt │ │ │ ├── Iroha2Client.kt │ │ │ ├── balancing │ │ │ │ ├── BalancingStrategy.kt │ │ │ │ ├── RoundRobinStrategy.kt │ │ │ │ └── WithoutBalancingStrategy.kt │ │ │ └── blockstream │ │ │ │ ├── BlockStreamContext.kt │ │ │ │ ├── BlockStreamStorage.kt │ │ │ │ └── BlockStreamSubscription.kt │ │ │ ├── model │ │ │ ├── IrohaUrls.kt │ │ │ └── Page.kt │ │ │ └── query │ │ │ ├── Queries.kt │ │ │ └── QueryBuilder.kt │ │ └── test │ │ ├── java │ │ └── jp │ │ │ └── co │ │ │ └── soramitsu │ │ │ └── iroha2 │ │ │ └── JavaTest.java │ │ ├── kotlin │ │ └── jp │ │ │ └── co │ │ │ └── soramitsu │ │ │ └── iroha2 │ │ │ ├── BlockStreamTest.kt │ │ │ ├── ExampleTest.kt │ │ │ ├── GenesisTest.kt │ │ │ ├── InstructionsTest.kt │ │ │ ├── PeerTest.kt │ │ │ ├── QueriesTest.kt │ │ │ ├── TriggersTest.kt │ │ │ ├── annotations │ │ │ ├── Permission.kt │ │ │ ├── Query.kt │ │ │ ├── Sdk.kt │ │ │ └── SdkTestId.kt │ │ │ ├── testengine │ │ │ └── Genesis.kt │ │ │ └── util │ │ │ ├── CryptoTest.kt │ │ │ └── FixnumTest.kt │ │ └── resources │ │ ├── create_nft_for_alice_smartcontract.wasm │ │ ├── create_nft_for_alice_smartcontract │ │ ├── .cargo │ │ │ └── config.toml │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── build.sh │ │ └── src │ │ │ └── lib.rs │ │ ├── executor.wasm │ │ ├── executor │ │ ├── .cargo │ │ │ └── config.toml │ │ ├── Cargo.toml │ │ ├── build.sh │ │ └── src │ │ │ └── lib.rs │ │ ├── genesis.json │ │ ├── junit-platform.properties │ │ └── logback-test.xml ├── codegen │ ├── README.md │ ├── build.gradle │ └── src │ │ └── main │ │ ├── kotlin │ │ └── jp │ │ │ └── co │ │ │ └── soramitsu │ │ │ └── iroha2 │ │ │ ├── EntryPoint.kt │ │ │ ├── Regex.kt │ │ │ ├── codegen │ │ │ ├── KotlinTypeResolver.kt │ │ │ ├── blueprint │ │ │ │ ├── Blueprint.kt │ │ │ │ ├── EnumBlueprint.kt │ │ │ │ ├── EnumVariantBlueprint.kt │ │ │ │ ├── StructBlueprint.kt │ │ │ │ ├── TupleStructBlueprint.kt │ │ │ │ └── TypeBasedBlueprint.kt │ │ │ └── generator │ │ │ │ ├── AbstractGenerator.kt │ │ │ │ ├── EnumGenerator.kt │ │ │ │ ├── EnumVariantGenerator.kt │ │ │ │ ├── GeneratorEntryPoint.kt │ │ │ │ ├── Scale.kt │ │ │ │ ├── StructGenerator.kt │ │ │ │ └── TupleStructGenerator.kt │ │ │ ├── parse │ │ │ ├── ExtractGeneric.kt │ │ │ ├── SchemaParser.kt │ │ │ ├── SchemaReader.kt │ │ │ └── TypeResolver.kt │ │ │ └── type │ │ │ ├── Common.kt │ │ │ ├── Composite.kt │ │ │ ├── Int.kt │ │ │ ├── Uint.kt │ │ │ └── Wrapper.kt │ │ └── resources │ │ └── schema.json ├── model │ ├── README.md │ ├── build.gradle │ └── src │ │ └── main │ │ └── kotlin │ │ └── jp │ │ └── co │ │ └── soramitsu │ │ └── iroha2 │ │ ├── Comparators.kt │ │ ├── Constants.kt │ │ ├── Crypto.kt │ │ ├── Exceptions.kt │ │ ├── Extensions.kt │ │ ├── Fixnum.kt │ │ ├── ModelCustomInstruction.kt │ │ ├── ModelEnum.kt │ │ ├── ModelParameter.kt │ │ ├── ModelPermission.kt │ │ ├── Serde.kt │ │ ├── TriggerArgs.kt │ │ ├── Util.kt │ │ ├── codec │ │ ├── CompactMode.kt │ │ ├── Extensions.kt │ │ ├── IntMax.kt │ │ ├── ScaleCodecReader.kt │ │ ├── ScaleCodecWriter.kt │ │ ├── ScaleReader.kt │ │ ├── ScaleWriter.kt │ │ ├── UnionValue.kt │ │ ├── reader │ │ │ ├── BoolReader.kt │ │ │ ├── CompactBigIntReader.kt │ │ │ ├── CompactUIntReader.kt │ │ │ ├── EnumReader.kt │ │ │ ├── IntReader.kt │ │ │ ├── ListReader.kt │ │ │ ├── StringReader.kt │ │ │ ├── UByteReader.kt │ │ │ ├── UIntReader.kt │ │ │ ├── UnionReader.kt │ │ │ └── UnsupportedReader.kt │ │ └── writer │ │ │ ├── BoolWriter.kt │ │ │ ├── CompactBigIntWriter.kt │ │ │ ├── CompactUIntWriter.kt │ │ │ ├── CompactULongWriter.kt │ │ │ ├── IntWriter.kt │ │ │ ├── ListWriter.kt │ │ │ ├── UByteWriter.kt │ │ │ ├── UIntWriter.kt │ │ │ └── UnionWriter.kt │ │ ├── generated │ │ ├── Account.kt │ │ ├── AccountEvent.kt │ │ ├── AccountEventFilter.kt │ │ ├── AccountId.kt │ │ ├── AccountIdPredicateAtom.kt │ │ ├── AccountIdProjectionOfPredicateMarker.kt │ │ ├── AccountIdProjectionOfSelectorMarker.kt │ │ ├── AccountPermissionChanged.kt │ │ ├── AccountPredicateAtom.kt │ │ ├── AccountProjectionOfPredicateMarker.kt │ │ ├── AccountProjectionOfSelectorMarker.kt │ │ ├── AccountRoleChanged.kt │ │ ├── Action.kt │ │ ├── ActionPredicateAtom.kt │ │ ├── ActionProjectionOfPredicateMarker.kt │ │ ├── ActionProjectionOfSelectorMarker.kt │ │ ├── Algorithm.kt │ │ ├── Asset.kt │ │ ├── AssetChanged.kt │ │ ├── AssetDefinition.kt │ │ ├── AssetDefinitionEvent.kt │ │ ├── AssetDefinitionEventFilter.kt │ │ ├── AssetDefinitionId.kt │ │ ├── AssetDefinitionIdPredicateAtom.kt │ │ ├── AssetDefinitionIdProjectionOfPredicateMarker.kt │ │ ├── AssetDefinitionIdProjectionOfSelectorMarker.kt │ │ ├── AssetDefinitionOwnerChanged.kt │ │ ├── AssetDefinitionPredicateAtom.kt │ │ ├── AssetDefinitionProjectionOfPredicateMarker.kt │ │ ├── AssetDefinitionProjectionOfSelectorMarker.kt │ │ ├── AssetDefinitionTotalQuantityChanged.kt │ │ ├── AssetEvent.kt │ │ ├── AssetEventFilter.kt │ │ ├── AssetId.kt │ │ ├── AssetIdPredicateAtom.kt │ │ ├── AssetIdProjectionOfPredicateMarker.kt │ │ ├── AssetIdProjectionOfSelectorMarker.kt │ │ ├── AssetPredicateAtom.kt │ │ ├── AssetProjectionOfPredicateMarker.kt │ │ ├── AssetProjectionOfSelectorMarker.kt │ │ ├── AssetTransferBox.kt │ │ ├── AssetType.kt │ │ ├── AssetValue.kt │ │ ├── AssetValuePredicateAtom.kt │ │ ├── AssetValueProjectionOfPredicateMarker.kt │ │ ├── AssetValueProjectionOfSelectorMarker.kt │ │ ├── BlockEvent.kt │ │ ├── BlockEventFilter.kt │ │ ├── BlockHeader.kt │ │ ├── BlockHeaderHashPredicateAtom.kt │ │ ├── BlockHeaderHashProjectionOfPredicateMarker.kt │ │ ├── BlockHeaderHashProjectionOfSelectorMarker.kt │ │ ├── BlockHeaderPredicateAtom.kt │ │ ├── BlockHeaderProjectionOfPredicateMarker.kt │ │ ├── BlockHeaderProjectionOfSelectorMarker.kt │ │ ├── BlockMessage.kt │ │ ├── BlockParameter.kt │ │ ├── BlockParameters.kt │ │ ├── BlockPayload.kt │ │ ├── BlockRejectionReason.kt │ │ ├── BlockSignature.kt │ │ ├── BlockStatus.kt │ │ ├── BlockSubscriptionRequest.kt │ │ ├── BurnBox.kt │ │ ├── BurnOfNumericAndAsset.kt │ │ ├── BurnOfu32AndTrigger.kt │ │ ├── CanBurnAsset.kt │ │ ├── CanBurnAssetWithDefinition.kt │ │ ├── CanExecuteTrigger.kt │ │ ├── CanManagePeers.kt │ │ ├── CanManageRoles.kt │ │ ├── CanMintAsset.kt │ │ ├── CanMintAssetWithDefinition.kt │ │ ├── CanModifyAccountMetadata.kt │ │ ├── CanModifyAssetDefinitionMetadata.kt │ │ ├── CanModifyAssetMetadata.kt │ │ ├── CanModifyDomainMetadata.kt │ │ ├── CanModifyTrigger.kt │ │ ├── CanModifyTriggerMetadata.kt │ │ ├── CanRegisterAccount.kt │ │ ├── CanRegisterAsset.kt │ │ ├── CanRegisterAssetDefinition.kt │ │ ├── CanRegisterAssetWithDefinition.kt │ │ ├── CanRegisterDomain.kt │ │ ├── CanRegisterTrigger.kt │ │ ├── CanSetParameters.kt │ │ ├── CanTransferAsset.kt │ │ ├── CanTransferAssetWithDefinition.kt │ │ ├── CanUnregisterAccount.kt │ │ ├── CanUnregisterAsset.kt │ │ ├── CanUnregisterAssetDefinition.kt │ │ ├── CanUnregisterAssetWithDefinition.kt │ │ ├── CanUnregisterDomain.kt │ │ ├── CanUnregisterTrigger.kt │ │ ├── CanUpgradeExecutor.kt │ │ ├── ChainId.kt │ │ ├── CommittedTransaction.kt │ │ ├── CommittedTransactionPredicateAtom.kt │ │ ├── CommittedTransactionProjectionOfPredicateMarker.kt │ │ ├── CommittedTransactionProjectionOfSelectorMarker.kt │ │ ├── CompoundPredicateOfAccount.kt │ │ ├── CompoundPredicateOfAsset.kt │ │ ├── CompoundPredicateOfAssetDefinition.kt │ │ ├── CompoundPredicateOfBlockHeader.kt │ │ ├── CompoundPredicateOfCommittedTransaction.kt │ │ ├── CompoundPredicateOfDomain.kt │ │ ├── CompoundPredicateOfPeerId.kt │ │ ├── CompoundPredicateOfPermission.kt │ │ ├── CompoundPredicateOfRole.kt │ │ ├── CompoundPredicateOfRoleId.kt │ │ ├── CompoundPredicateOfSignedBlock.kt │ │ ├── CompoundPredicateOfTrigger.kt │ │ ├── CompoundPredicateOfTriggerId.kt │ │ ├── ConfigurationEvent.kt │ │ ├── ConfigurationEventFilter.kt │ │ ├── CustomInstruction.kt │ │ ├── CustomParameter.kt │ │ ├── CustomParameterId.kt │ │ ├── DataEvent.kt │ │ ├── DataEventFilter.kt │ │ ├── Domain.kt │ │ ├── DomainEvent.kt │ │ ├── DomainEventFilter.kt │ │ ├── DomainId.kt │ │ ├── DomainIdPredicateAtom.kt │ │ ├── DomainIdProjectionOfPredicateMarker.kt │ │ ├── DomainIdProjectionOfSelectorMarker.kt │ │ ├── DomainOwnerChanged.kt │ │ ├── DomainPredicateAtom.kt │ │ ├── DomainProjectionOfPredicateMarker.kt │ │ ├── DomainProjectionOfSelectorMarker.kt │ │ ├── EventBox.kt │ │ ├── EventFilterBox.kt │ │ ├── EventMessage.kt │ │ ├── EventSubscriptionRequest.kt │ │ ├── Executable.kt │ │ ├── ExecuteTrigger.kt │ │ ├── ExecuteTriggerEvent.kt │ │ ├── ExecuteTriggerEventFilter.kt │ │ ├── ExecutionTime.kt │ │ ├── Executor.kt │ │ ├── ExecutorDataModel.kt │ │ ├── ExecutorEvent.kt │ │ ├── ExecutorEventFilter.kt │ │ ├── ExecutorUpgrade.kt │ │ ├── FetchSize.kt │ │ ├── FindAccountMetadata.kt │ │ ├── FindAccounts.kt │ │ ├── FindAccountsWithAsset.kt │ │ ├── FindActiveTriggerIds.kt │ │ ├── FindAssetDefinitionMetadata.kt │ │ ├── FindAssetMetadata.kt │ │ ├── FindAssetQuantityById.kt │ │ ├── FindAssets.kt │ │ ├── FindAssetsDefinitions.kt │ │ ├── FindBlockHeaders.kt │ │ ├── FindBlocks.kt │ │ ├── FindDomainMetadata.kt │ │ ├── FindDomains.kt │ │ ├── FindError.kt │ │ ├── FindExecutorDataModel.kt │ │ ├── FindParameters.kt │ │ ├── FindPeers.kt │ │ ├── FindPermissionsByAccountId.kt │ │ ├── FindRoleIds.kt │ │ ├── FindRoles.kt │ │ ├── FindRolesByAccountId.kt │ │ ├── FindTransactions.kt │ │ ├── FindTriggerMetadata.kt │ │ ├── FindTriggers.kt │ │ ├── ForwardCursor.kt │ │ ├── GenesisWasmAction.kt │ │ ├── GenesisWasmTrigger.kt │ │ ├── GrantBox.kt │ │ ├── GrantOfPermissionAndAccount.kt │ │ ├── GrantOfPermissionAndRole.kt │ │ ├── GrantOfRoleIdAndAccount.kt │ │ ├── Hash.kt │ │ ├── HashOf.kt │ │ ├── IdBox.kt │ │ ├── InstructionBox.kt │ │ ├── InstructionEvaluationError.kt │ │ ├── InstructionExecutionError.kt │ │ ├── InstructionExecutionFail.kt │ │ ├── InstructionType.kt │ │ ├── InvalidParameterError.kt │ │ ├── IpfsPath.kt │ │ ├── Ipv4Addr.kt │ │ ├── Ipv6Addr.kt │ │ ├── Json.kt │ │ ├── JsonPredicateAtom.kt │ │ ├── JsonProjectionOfPredicateMarker.kt │ │ ├── JsonProjectionOfSelectorMarker.kt │ │ ├── Level.kt │ │ ├── Log.kt │ │ ├── MathError.kt │ │ ├── Metadata.kt │ │ ├── MetadataChangedOfAccountId.kt │ │ ├── MetadataChangedOfAssetDefinitionId.kt │ │ ├── MetadataChangedOfAssetId.kt │ │ ├── MetadataChangedOfDomainId.kt │ │ ├── MetadataChangedOfTriggerId.kt │ │ ├── MetadataKeyProjectionOfPredicateMarker.kt │ │ ├── MetadataKeyProjectionOfSelectorMarker.kt │ │ ├── MetadataPredicateAtom.kt │ │ ├── MetadataProjectionOfPredicateMarker.kt │ │ ├── MetadataProjectionOfSelectorMarker.kt │ │ ├── MintBox.kt │ │ ├── MintOfNumericAndAsset.kt │ │ ├── MintOfu32AndTrigger.kt │ │ ├── MintabilityError.kt │ │ ├── Mintable.kt │ │ ├── Mismatch.kt │ │ ├── MultisigAccountArgs.kt │ │ ├── MultisigApprove.kt │ │ ├── MultisigInstructionBox.kt │ │ ├── MultisigProposalValue.kt │ │ ├── MultisigPropose.kt │ │ ├── MultisigRegister.kt │ │ ├── MultisigSpec.kt │ │ ├── MultisigTransactionArgs.kt │ │ ├── Name.kt │ │ ├── NameProjectionOfPredicateMarker.kt │ │ ├── NameProjectionOfSelectorMarker.kt │ │ ├── NewAccount.kt │ │ ├── NewAssetDefinition.kt │ │ ├── NewDomain.kt │ │ ├── NewRole.kt │ │ ├── NonZeroOfu16.kt │ │ ├── NonZeroOfu32.kt │ │ ├── NonZeroOfu64.kt │ │ ├── Numeric.kt │ │ ├── NumericPredicateAtom.kt │ │ ├── NumericProjectionOfPredicateMarker.kt │ │ ├── NumericProjectionOfSelectorMarker.kt │ │ ├── NumericSpec.kt │ │ ├── Pagination.kt │ │ ├── Parameter.kt │ │ ├── ParameterChanged.kt │ │ ├── Parameters.kt │ │ ├── Peer.kt │ │ ├── PeerEvent.kt │ │ ├── PeerEventFilter.kt │ │ ├── PeerId.kt │ │ ├── PeerIdPredicateAtom.kt │ │ ├── PeerIdProjectionOfPredicateMarker.kt │ │ ├── PeerIdProjectionOfSelectorMarker.kt │ │ ├── Permission.kt │ │ ├── PermissionPredicateAtom.kt │ │ ├── PermissionProjectionOfPredicateMarker.kt │ │ ├── PermissionProjectionOfSelectorMarker.kt │ │ ├── PipelineEventBox.kt │ │ ├── PipelineEventFilterBox.kt │ │ ├── PublicKey.kt │ │ ├── PublicKeyPredicateAtom.kt │ │ ├── PublicKeyProjectionOfPredicateMarker.kt │ │ ├── PublicKeyProjectionOfSelectorMarker.kt │ │ ├── QueryBox.kt │ │ ├── QueryExecutionFail.kt │ │ ├── QueryOutput.kt │ │ ├── QueryOutputBatchBox.kt │ │ ├── QueryOutputBatchBoxTuple.kt │ │ ├── QueryParams.kt │ │ ├── QueryRequest.kt │ │ ├── QueryRequestWithAuthority.kt │ │ ├── QueryResponse.kt │ │ ├── QuerySignature.kt │ │ ├── QueryWithFilterOfFindAccounts.kt │ │ ├── QueryWithFilterOfFindAccountsWithAsset.kt │ │ ├── QueryWithFilterOfFindActiveTriggerIds.kt │ │ ├── QueryWithFilterOfFindAssets.kt │ │ ├── QueryWithFilterOfFindAssetsDefinitions.kt │ │ ├── QueryWithFilterOfFindBlockHeaders.kt │ │ ├── QueryWithFilterOfFindBlocks.kt │ │ ├── QueryWithFilterOfFindDomains.kt │ │ ├── QueryWithFilterOfFindPeers.kt │ │ ├── QueryWithFilterOfFindPermissionsByAccountId.kt │ │ ├── QueryWithFilterOfFindRoleIds.kt │ │ ├── QueryWithFilterOfFindRoles.kt │ │ ├── QueryWithFilterOfFindRolesByAccountId.kt │ │ ├── QueryWithFilterOfFindTransactions.kt │ │ ├── QueryWithFilterOfFindTriggers.kt │ │ ├── QueryWithParams.kt │ │ ├── RawGenesisTransaction.kt │ │ ├── RegisterBox.kt │ │ ├── RegisterOfAccount.kt │ │ ├── RegisterOfAsset.kt │ │ ├── RegisterOfAssetDefinition.kt │ │ ├── RegisterOfDomain.kt │ │ ├── RegisterOfPeer.kt │ │ ├── RegisterOfRole.kt │ │ ├── RegisterOfTrigger.kt │ │ ├── RemoveKeyValueBox.kt │ │ ├── RemoveKeyValueOfAccount.kt │ │ ├── RemoveKeyValueOfAsset.kt │ │ ├── RemoveKeyValueOfAssetDefinition.kt │ │ ├── RemoveKeyValueOfDomain.kt │ │ ├── RemoveKeyValueOfTrigger.kt │ │ ├── Repeats.kt │ │ ├── RepetitionError.kt │ │ ├── RevokeBox.kt │ │ ├── RevokeOfPermissionAndAccount.kt │ │ ├── RevokeOfPermissionAndRole.kt │ │ ├── RevokeOfRoleIdAndAccount.kt │ │ ├── Role.kt │ │ ├── RoleEvent.kt │ │ ├── RoleEventFilter.kt │ │ ├── RoleId.kt │ │ ├── RoleIdPredicateAtom.kt │ │ ├── RoleIdProjectionOfPredicateMarker.kt │ │ ├── RoleIdProjectionOfSelectorMarker.kt │ │ ├── RolePermissionChanged.kt │ │ ├── RolePredicateAtom.kt │ │ ├── RoleProjectionOfPredicateMarker.kt │ │ ├── RoleProjectionOfSelectorMarker.kt │ │ ├── Schedule.kt │ │ ├── SelectorTupleOfAccount.kt │ │ ├── SelectorTupleOfAsset.kt │ │ ├── SelectorTupleOfAssetDefinition.kt │ │ ├── SelectorTupleOfBlockHeader.kt │ │ ├── SelectorTupleOfCommittedTransaction.kt │ │ ├── SelectorTupleOfDomain.kt │ │ ├── SelectorTupleOfPeerId.kt │ │ ├── SelectorTupleOfPermission.kt │ │ ├── SelectorTupleOfRole.kt │ │ ├── SelectorTupleOfRoleId.kt │ │ ├── SelectorTupleOfSignedBlock.kt │ │ ├── SelectorTupleOfTrigger.kt │ │ ├── SelectorTupleOfTriggerId.kt │ │ ├── SetKeyValueBox.kt │ │ ├── SetKeyValueOfAccount.kt │ │ ├── SetKeyValueOfAsset.kt │ │ ├── SetKeyValueOfAssetDefinition.kt │ │ ├── SetKeyValueOfDomain.kt │ │ ├── SetKeyValueOfTrigger.kt │ │ ├── SetParameter.kt │ │ ├── Signature.kt │ │ ├── SignatureOf.kt │ │ ├── SignedBlock.kt │ │ ├── SignedBlockPredicateAtom.kt │ │ ├── SignedBlockProjectionOfPredicateMarker.kt │ │ ├── SignedBlockProjectionOfSelectorMarker.kt │ │ ├── SignedBlockV1.kt │ │ ├── SignedQuery.kt │ │ ├── SignedQueryV1.kt │ │ ├── SignedTransaction.kt │ │ ├── SignedTransactionPredicateAtom.kt │ │ ├── SignedTransactionProjectionOfPredicateMarker.kt │ │ ├── SignedTransactionProjectionOfSelectorMarker.kt │ │ ├── SignedTransactionV1.kt │ │ ├── SingularQueryBox.kt │ │ ├── SingularQueryOutputBox.kt │ │ ├── SmartContractParameter.kt │ │ ├── SmartContractParameters.kt │ │ ├── SocketAddr.kt │ │ ├── SocketAddrHost.kt │ │ ├── SocketAddrV4.kt │ │ ├── SocketAddrV6.kt │ │ ├── Sorting.kt │ │ ├── StringPredicateAtom.kt │ │ ├── SumeragiParameter.kt │ │ ├── SumeragiParameters.kt │ │ ├── TimeEvent.kt │ │ ├── TimeEventFilter.kt │ │ ├── TimeInterval.kt │ │ ├── TransactionErrorPredicateAtom.kt │ │ ├── TransactionErrorProjectionOfPredicateMarker.kt │ │ ├── TransactionErrorProjectionOfSelectorMarker.kt │ │ ├── TransactionEvent.kt │ │ ├── TransactionEventFilter.kt │ │ ├── TransactionHashPredicateAtom.kt │ │ ├── TransactionHashProjectionOfPredicateMarker.kt │ │ ├── TransactionHashProjectionOfSelectorMarker.kt │ │ ├── TransactionLimitError.kt │ │ ├── TransactionParameter.kt │ │ ├── TransactionParameters.kt │ │ ├── TransactionPayload.kt │ │ ├── TransactionRejectionReason.kt │ │ ├── TransactionSignature.kt │ │ ├── TransactionStatus.kt │ │ ├── TransferBox.kt │ │ ├── TransferOfAccountAndAssetDefinitionIdAndAccount.kt │ │ ├── TransferOfAccountAndDomainIdAndAccount.kt │ │ ├── TransferOfAssetAndMetadataAndAccount.kt │ │ ├── TransferOfAssetAndNumericAndAccount.kt │ │ ├── Trigger.kt │ │ ├── TriggerCompletedEvent.kt │ │ ├── TriggerCompletedEventFilter.kt │ │ ├── TriggerCompletedOutcome.kt │ │ ├── TriggerCompletedOutcomeType.kt │ │ ├── TriggerEvent.kt │ │ ├── TriggerEventFilter.kt │ │ ├── TriggerId.kt │ │ ├── TriggerIdPredicateAtom.kt │ │ ├── TriggerIdProjectionOfPredicateMarker.kt │ │ ├── TriggerIdProjectionOfSelectorMarker.kt │ │ ├── TriggerNumberOfExecutionsChanged.kt │ │ ├── TriggerPredicateAtom.kt │ │ ├── TriggerProjectionOfPredicateMarker.kt │ │ ├── TriggerProjectionOfSelectorMarker.kt │ │ ├── TypeError.kt │ │ ├── UnregisterBox.kt │ │ ├── UnregisterOfAccount.kt │ │ ├── UnregisterOfAsset.kt │ │ ├── UnregisterOfAssetDefinition.kt │ │ ├── UnregisterOfDomain.kt │ │ ├── UnregisterOfPeer.kt │ │ ├── UnregisterOfRole.kt │ │ ├── UnregisterOfTrigger.kt │ │ ├── Upgrade.kt │ │ ├── ValidationFail.kt │ │ ├── WasmExecutionFail.kt │ │ └── WasmSmartContract.kt │ │ └── transaction │ │ ├── Filters.kt │ │ ├── Instructions.kt │ │ └── TransactionBuilder.kt └── test-tools │ ├── README.md │ ├── build.gradle │ └── src │ ├── main │ ├── kotlin │ │ └── jp │ │ │ └── co │ │ │ └── soramitsu │ │ │ └── iroha2 │ │ │ └── testengine │ │ │ ├── IrohaConfig.kt │ │ │ ├── IrohaContainer.kt │ │ │ ├── IrohaRunnerExtension.kt │ │ │ ├── IrohaTest.kt │ │ │ ├── TestConsts.kt │ │ │ └── WithIroha.kt │ └── resources │ │ ├── client.toml │ │ ├── executor.wasm │ │ ├── genesis.json │ │ ├── genesis2.json │ │ ├── genesis3.json │ │ └── start.sh │ └── test │ └── resources │ └── logback-test.xml └── settings.gradle /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | updates: 4 | - package-ecosystem: "docker" 5 | target-branch: "iroha2-dev" 6 | directory: "/" 7 | schedule: 8 | interval: "weekly" 9 | 10 | - package-ecosystem: "github-actions" 11 | target-branch: "iroha2-dev" 12 | directory: "/" 13 | schedule: 14 | interval: "weekly" 15 | 16 | - package-ecosystem: "gradle" 17 | target-branch: "iroha2-dev" 18 | directory: "/" 19 | schedule: 20 | interval: "daily" 21 | -------------------------------------------------------------------------------- /.github/workflows/iroha2-ci.yml: -------------------------------------------------------------------------------- 1 | # This workflow uses actions that are not certified by GitHub. 2 | # They are provided by a third-party and are governed by 3 | # separate terms of service, privacy policy, and support 4 | # documentation. 5 | # This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time 6 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle 7 | 8 | name: Iroha2-java main branch workflow 9 | 10 | on: 11 | push: 12 | branches: [ iroha2-dev, iroha2-main ] 13 | tags: 14 | - '**' 15 | jobs: 16 | publish: 17 | runs-on: ubuntu-latest 18 | steps: 19 | - uses: actions/checkout@v3 20 | - name: Set up JDK 17 21 | uses: actions/setup-java@v3 22 | with: 23 | java-version: '17' 24 | distribution: 'liberica' 25 | - name: Validate Gradle wrapper 26 | uses: gradle/wrapper-validation-action@v1 27 | - name: Publish package 28 | uses: gradle/gradle-build-action@v2.4.2 29 | with: 30 | arguments: publish 31 | env: 32 | NEXUS_USER: ${{ secrets.NEXUS_USER }} 33 | NEXUS_PASS: ${{ secrets.NEXUS_PASS }} 34 | -------------------------------------------------------------------------------- /.github/workflows/iroha2-pr.yml: -------------------------------------------------------------------------------- 1 | name: Iroha2-java pull requests workflow 2 | 3 | on: 4 | pull_request: 5 | branches: [ iroha2-dev, iroha2-main ] 6 | 7 | jobs: 8 | build: 9 | runs-on: [self-hosted, Linux, iroha2] 10 | env: 11 | IROHA_IMAGE_TAG: "2.0.0-pre-rc.22.2" # Place "dev" to run on the last iroha 12 | steps: 13 | - uses: actions/checkout@v4 14 | - name: Set up JDK 17 15 | uses: actions/setup-java@v3 16 | with: 17 | java-version: '17' 18 | distribution: 'liberica' 19 | - name: Cache Gradle packages 20 | uses: actions/cache@v3 21 | with: 22 | path: | 23 | ~/.gradle/caches 24 | ~/.gradle/wrapper 25 | key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} 26 | restore-keys: | 27 | ${{ runner.os }}-gradle- 28 | - name: Build with Gradle 29 | run: ./gradlew build --info 30 | - name: Upload build reports 31 | if: failure() 32 | uses: actions/upload-artifact@v4 33 | with: 34 | name: build-reports 35 | path: /home/runner/work/iroha-java/iroha-java/**/index.html 36 | - name: Cleanup Gradle Cache 37 | # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions. 38 | # Restoring these files from a GitHub Actions cache might cause problems for future builds. 39 | run: | 40 | rm -f ~/.gradle/caches/modules-2/modules-2.lock 41 | rm -f ~/.gradle/caches/modules-2/gc.properties 42 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | .idea/ 3 | .kotlin/ 4 | .gradle/ 5 | */*/out 6 | 7 | # Rust 8 | **/target/ 9 | **/Cargo.lock 10 | **/storage/ 11 | **/*.rs.bk 12 | **/rusty-tags.vi 13 | -------------------------------------------------------------------------------- /MAINTAINERS.md: -------------------------------------------------------------------------------- 1 | See [MAINTAINERS.md](https://github.com/hyperledger/iroha/blob/iroha2-dev/MAINTAINERS.md) in the Iroha repository. 2 | -------------------------------------------------------------------------------- /examples/tutorial/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val ktorVer = project.properties["ktorVer"] as String 2 | 3 | dependencies { 4 | implementation(project(":admin-client")) 5 | 6 | implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0") 7 | implementation("io.ktor:ktor-client-logging:$ktorVer") 8 | } 9 | 10 | tasks.jacocoTestReport { 11 | mustRunAfter(":admin-client:jacocoTestReport") 12 | mustRunAfter(":block:jacocoTestReport") 13 | mustRunAfter(":client:jacocoTestReport") 14 | mustRunAfter(":codegen:jacocoTestReport") 15 | mustRunAfter(":model:jacocoTestReport") 16 | mustRunAfter(":test-tools:jacocoTestReport") 17 | } 18 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # kotlin 2 | kotlinVer=2.0.21 3 | kotlinLinterVer=4.5.0 4 | ktorVer=3.0.1 5 | coroutinesVer=1.9.0 6 | # json serde 7 | jacksonKotlinVer=2.18.1 8 | # codegen 9 | kotlinPoetVer=2.0.0 10 | # crypto 11 | bouncyCastleVer=1.70 12 | i2pCryptoEddsa=0.3.0 13 | multihashVersion=1.3.4 14 | googleTinkVer=1.15.0 15 | # testing 16 | testContainersVer=1.20.3 17 | # logging 18 | logbackVer=1.5.12 19 | org.gradle.jvmargs=-XX:MetaspaceSize=128M -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 20 | systemProp.sonar.host.url=https://sonar.katana.soramitsu.co.jp 21 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger-iroha/iroha-java/5467c487e173f9b472393420dd0b390c640c3f8f/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /jitpack.yml: -------------------------------------------------------------------------------- 1 | jdk: 2 | - openjdk11 -------------------------------------------------------------------------------- /modules/admin-client/README.md: -------------------------------------------------------------------------------- 1 | # Admin client 2 | 3 | The `admin-client` module contains Iroha2Client extension. 4 | 5 | ## Usage 6 | 7 | ```kotlin 8 | val adminIroha2Client = AdminIroha2Client(PEER_URL, TELEMETRY_URL, log = true) 9 | ``` 10 | 11 | ## Examples 12 | 13 | Check [tests](./src/test/kotlin/jp/co/soramitsu/iroha2) for more examples. -------------------------------------------------------------------------------- /modules/admin-client/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | api project(":model") 3 | api project(":client") 4 | 5 | implementation "io.ktor:ktor-client-core:$ktorVer" 6 | implementation "io.ktor:ktor-client-cio:$ktorVer" 7 | implementation "io.ktor:ktor-client-logging:$ktorVer" 8 | 9 | testApi project(":test-tools") 10 | testImplementation "org.jetbrains.kotlin:kotlin-test-junit5:$kotlinVer" 11 | } 12 | -------------------------------------------------------------------------------- /modules/admin-client/src/main/kotlin/jp/co/soramitsu/iroha2/PeerStatus.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2 2 | 3 | import java.time.Duration 4 | 5 | /** 6 | * The status of a peer 7 | * @property peers The number of connected peers, except for the reporting peer itself 8 | * @property blocks The number of commited blocks 9 | * @property txs_accepted Total number of accepted transactions 10 | * @property txs_rejected Total number of rejected transactions 11 | * @property uptime Uptime with nanosecond precision since creation of the genesis block 12 | * @property view_changes The number of view changes in the current round 13 | */ 14 | data class PeerStatus( 15 | val peers: Int, 16 | val blocks: Long, 17 | val txs_approved: Long, 18 | val txs_rejected: Long, 19 | val uptime: Duration, 20 | val view_changes: Long, 21 | val queue_size: Long, 22 | ) 23 | -------------------------------------------------------------------------------- /modules/admin-client/src/test/kotlin/jp/co/soramitsu/iroha2/ClientTest.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2 2 | 3 | import io.ktor.http.HttpStatusCode 4 | import jp.co.soramitsu.iroha2.testengine.IrohaTest 5 | import jp.co.soramitsu.iroha2.testengine.WithIroha 6 | import kotlinx.coroutines.runBlocking 7 | import org.junit.jupiter.api.Test 8 | import org.junit.jupiter.api.Timeout 9 | import kotlin.test.assertEquals 10 | 11 | @Timeout(120) 12 | class ClientTest : IrohaTest() { 13 | @Test 14 | @WithIroha 15 | fun schema(): Unit = 16 | runBlocking { 17 | val schema = client.schema() 18 | assert(schema.isNotEmpty()) 19 | } 20 | 21 | @Test 22 | @WithIroha 23 | fun health(): Unit = 24 | runBlocking { 25 | val health = client.health() 26 | assert(health == HttpStatusCode.OK.value) 27 | } 28 | 29 | @Test 30 | @WithIroha 31 | fun status(): Unit = 32 | runBlocking { 33 | val status = client.status() 34 | assertEquals(1, status.blocks) 35 | } 36 | 37 | @Test 38 | @WithIroha 39 | fun metrics(): Unit = 40 | runBlocking { 41 | val metrics = client.metrics() 42 | assert(metrics.isNotEmpty()) 43 | } 44 | 45 | @Test 46 | @WithIroha 47 | fun getConfigValues(): Unit = 48 | runBlocking { 49 | val configs = client.getConfigs() 50 | assert(configs.isNotEmpty()) 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /modules/admin-client/src/test/resources/junit-platform.properties: -------------------------------------------------------------------------------- 1 | junit.jupiter.execution.parallel.enabled=true 2 | -------------------------------------------------------------------------------- /modules/admin-client/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /modules/block/README.md: -------------------------------------------------------------------------------- 1 | # Block 2 | 3 | The `block` module contains: 4 | 5 | - Genesis classes and some generated serializers and deserializers for data models 6 | - Serializers necessary to serialise Rust-specific models to Kotlin models 7 | - Deserializers necessary to deserialize models into JSON format, which is the format Iroha2 expects, for example, for [genesis.json](../test-tools/src/main/resources/genesis.json) 8 | 9 | Note that you can also use `JSON_SERDE` mapper from [serde.kt](./src/main/kotlin/jp/co/soramitsu/iroha2/serde.kt) to deserialise models into JSON: 10 | 11 | ```kotlin 12 | import jp.co.soramitsu.iroha2.iroha2Mapper 13 | ``` -------------------------------------------------------------------------------- /modules/block/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | implementation project(":model") 3 | 4 | implementation "com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonKotlinVer" 5 | 6 | testImplementation "org.jetbrains.kotlin:kotlin-test-junit5:$kotlinVer" 7 | testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlinVer" 8 | 9 | testImplementation "com.google.crypto.tink:tink:$googleTinkVer" 10 | } 11 | 12 | jacocoTestReport { 13 | mustRunAfter(":admin-client:jacocoTestReport") 14 | } 15 | -------------------------------------------------------------------------------- /modules/block/src/test/resources/executor.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger-iroha/iroha-java/5467c487e173f9b472393420dd0b390c640c3f8f/modules/block/src/test/resources/executor.wasm -------------------------------------------------------------------------------- /modules/client/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger-iroha/iroha-java/5467c487e173f9b472393420dd0b390c640c3f8f/modules/client/.DS_Store -------------------------------------------------------------------------------- /modules/client/README.md: -------------------------------------------------------------------------------- 1 | # Client 2 | 3 | The `client` module contains Kotlin implementation of [Hyperledger Iroha2](https://github.com/hyperledger/iroha/tree/iroha2-dev) library. 4 | 5 | ## Usage 6 | 7 | ```kotlin 8 | val iroha2Client = Iroha2Client(PEER_URL, log = true) 9 | ``` 10 | 11 | ## Examples 12 | 13 | Check [tests](./src/test/kotlin/jp/co/soramitsu/iroha2) to find examples. -------------------------------------------------------------------------------- /modules/client/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.qameta.allure") version "2.11.2" 3 | } 4 | 5 | dependencies { 6 | api project(":model") 7 | 8 | testImplementation project(":admin-client") 9 | testImplementation project(":block") 10 | 11 | // http client 12 | implementation "io.ktor:ktor-client-cio:$ktorVer" 13 | implementation "io.ktor:ktor-client-websockets:$ktorVer" 14 | implementation "io.ktor:ktor-client-logging:$ktorVer" 15 | implementation "io.ktor:ktor-client-content-negotiation:$ktorVer" 16 | implementation "io.ktor:ktor-serialization-jackson:$ktorVer" 17 | implementation "io.ktor:ktor-client-auth:$ktorVer" 18 | 19 | testApi project(":test-tools") 20 | testImplementation "org.jetbrains.kotlin:kotlin-test-junit5:$kotlinVer" 21 | testImplementation("com.github.docker-java:docker-java:3.4.0") 22 | testImplementation("io.qameta.allure:allure-testng:2.29.0") 23 | testImplementation "org.testcontainers:testcontainers:$testContainersVer" 24 | } 25 | 26 | jacocoTestReport { 27 | mustRunAfter(":admin-client:jacocoTestReport") 28 | mustRunAfter(":block:jacocoTestReport") 29 | } 30 | -------------------------------------------------------------------------------- /modules/client/src/main/kotlin/jp/co/soramitsu/iroha2/Exceptions.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2 2 | 3 | import io.ktor.http.HttpStatusCode 4 | 5 | /** 6 | * Throw if query payload can not be extracted 7 | */ 8 | class QueryPayloadExtractionException( 9 | message: String? = null, 10 | cause: Throwable? = null, 11 | ) : IrohaSdkException(message, cause) 12 | 13 | /** 14 | * Throw if there is an unexpected state during WebSocket interaction 15 | */ 16 | class WebSocketProtocolException( 17 | message: String? = null, 18 | cause: Throwable? = null, 19 | ) : IrohaSdkException(message, cause) 20 | 21 | /** 22 | * Throw if a peer is not available or status code not 2xx 23 | */ 24 | class IrohaClientException( 25 | message: String? = null, 26 | cause: Throwable? = null, 27 | val status: HttpStatusCode? = null, 28 | ) : IrohaSdkException(message, cause) 29 | 30 | /** 31 | * Throw if a transaction was rejected by a peer 32 | */ 33 | class TransactionRejectedException( 34 | message: String? = null, 35 | cause: Throwable? = null, 36 | ) : IrohaSdkException(message, cause) 37 | -------------------------------------------------------------------------------- /modules/client/src/main/kotlin/jp/co/soramitsu/iroha2/SingletonHolder.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2 2 | 3 | open class SingletonHolder( 4 | private val creator: (A) -> T, 5 | ) { 6 | @Volatile 7 | private var instance: T? = null 8 | 9 | fun destroy() { 10 | instance = null 11 | } 12 | 13 | fun getInstance(arg: A): T { 14 | val checkInstance = instance 15 | if (checkInstance != null) { 16 | return checkInstance 17 | } 18 | 19 | return synchronized(this) { 20 | val checkInstanceAgain = instance 21 | if (checkInstanceAgain != null) { 22 | checkInstanceAgain 23 | } else { 24 | val created = creator(arg) 25 | instance = created 26 | created 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /modules/client/src/main/kotlin/jp/co/soramitsu/iroha2/client/balancing/BalancingStrategy.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.client.balancing 2 | 3 | import java.net.URL 4 | 5 | interface BalancingStrategy { 6 | fun getApiURL(): URL 7 | } 8 | -------------------------------------------------------------------------------- /modules/client/src/main/kotlin/jp/co/soramitsu/iroha2/client/balancing/RoundRobinStrategy.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.client.balancing 2 | 3 | import java.net.URL 4 | 5 | /** 6 | * Round-robin load balancing strategy 7 | */ 8 | open class RoundRobinStrategy( 9 | private val urls: List, 10 | ) : BalancingStrategy { 11 | private var lastRequestedPeerIdx: Int? = null 12 | 13 | override fun getApiURL(): URL = getUrls() 14 | 15 | private fun getUrls() = 16 | when (lastRequestedPeerIdx) { 17 | null -> urls.first().also { lastRequestedPeerIdx = 0 } 18 | else -> { 19 | lastRequestedPeerIdx = 20 | when (lastRequestedPeerIdx) { 21 | urls.size - 1 -> 0 22 | else -> lastRequestedPeerIdx!! + 1 23 | } 24 | urls[lastRequestedPeerIdx!!] 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /modules/client/src/main/kotlin/jp/co/soramitsu/iroha2/client/balancing/WithoutBalancingStrategy.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.client.balancing 2 | 3 | import jp.co.soramitsu.iroha2.model.IrohaUrls 4 | import java.net.URL 5 | 6 | open class WithoutBalancingStrategy( 7 | private val urls: List, 8 | ) : BalancingStrategy { 9 | override fun getApiURL(): URL = urls.first().apiUrl 10 | } 11 | -------------------------------------------------------------------------------- /modules/client/src/main/kotlin/jp/co/soramitsu/iroha2/client/blockstream/BlockStreamContext.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.client.blockstream 2 | 3 | import io.ktor.client.HttpClient 4 | import java.net.URL 5 | 6 | data class BlockStreamContext( 7 | val apiUrl: URL, 8 | val client: HttpClient, 9 | val from: Long = 1, 10 | val storages: Iterable, 11 | val onClose: () -> Unit, 12 | ) 13 | -------------------------------------------------------------------------------- /modules/client/src/main/kotlin/jp/co/soramitsu/iroha2/client/blockstream/BlockStreamStorage.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.client.blockstream 2 | 3 | import jp.co.soramitsu.iroha2.generated.BlockMessage 4 | import kotlinx.coroutines.channels.Channel 5 | import java.util.UUID 6 | 7 | data class BlockStreamStorage( 8 | val onBlock: (block: BlockMessage) -> Any, 9 | val cancelIf: (suspend (block: BlockMessage) -> Boolean)? = null, 10 | val onFailure: (suspend (t: Throwable) -> Unit)? = null, 11 | ) { 12 | val channel = lazy { Channel() } 13 | 14 | val id: UUID = UUID.randomUUID() 15 | } 16 | -------------------------------------------------------------------------------- /modules/client/src/main/kotlin/jp/co/soramitsu/iroha2/model/IrohaUrls.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.model 2 | 3 | import java.net.URI 4 | import java.net.URL 5 | 6 | data class IrohaUrls( 7 | val apiUrl: URL, 8 | val peerUrl: URL, 9 | ) { 10 | constructor( 11 | apiUrl: String, 12 | peerUrl: String, 13 | ) : this(URI(apiUrl).toURL(), URI(peerUrl).toURL()) 14 | } 15 | -------------------------------------------------------------------------------- /modules/client/src/main/kotlin/jp/co/soramitsu/iroha2/model/Page.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.model 2 | 3 | import java.math.BigInteger 4 | 5 | /** 6 | * Pages contain query results with extracted [data]. 7 | */ 8 | data class Page( 9 | val data: T, 10 | val total: BigInteger, 11 | ) 12 | -------------------------------------------------------------------------------- /modules/client/src/test/kotlin/jp/co/soramitsu/iroha2/annotations/Permission.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.annotations 2 | 3 | import io.qameta.allure.LabelAnnotation 4 | import java.lang.annotation.Inherited 5 | 6 | @MustBeDocumented 7 | @Inherited 8 | @Retention(AnnotationRetention.RUNTIME) 9 | @Target(AnnotationTarget.FUNCTION, AnnotationTarget.CLASS) 10 | @LabelAnnotation(name = "permission") 11 | @Repeatable 12 | annotation class Permission( 13 | val value: String, 14 | ) 15 | -------------------------------------------------------------------------------- /modules/client/src/test/kotlin/jp/co/soramitsu/iroha2/annotations/Query.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.annotations 2 | 3 | import io.qameta.allure.LabelAnnotation 4 | import java.lang.annotation.Inherited 5 | 6 | @MustBeDocumented 7 | @Inherited 8 | @Retention(AnnotationRetention.RUNTIME) 9 | @Target(AnnotationTarget.FUNCTION) 10 | @LabelAnnotation(name = "query") 11 | @Repeatable 12 | annotation class Query( 13 | val value: String, 14 | ) 15 | -------------------------------------------------------------------------------- /modules/client/src/test/kotlin/jp/co/soramitsu/iroha2/annotations/Sdk.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.annotations 2 | 3 | import io.qameta.allure.LabelAnnotation 4 | import java.lang.annotation.Inherited 5 | 6 | @MustBeDocumented 7 | @Inherited 8 | @Retention(AnnotationRetention.RUNTIME) 9 | @Target(AnnotationTarget.FUNCTION, AnnotationTarget.CLASS) 10 | @LabelAnnotation(name = "sdk") 11 | annotation class Sdk( 12 | val value: String, 13 | ) 14 | -------------------------------------------------------------------------------- /modules/client/src/test/kotlin/jp/co/soramitsu/iroha2/annotations/SdkTestId.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.annotations 2 | 3 | import io.qameta.allure.LabelAnnotation 4 | import java.lang.annotation.Inherited 5 | 6 | @MustBeDocumented 7 | @Inherited 8 | @Retention(AnnotationRetention.RUNTIME) 9 | @Target(AnnotationTarget.FUNCTION) 10 | @LabelAnnotation(name = "sdk_test_id") 11 | @Repeatable 12 | annotation class SdkTestId( 13 | val value: String, 14 | ) 15 | -------------------------------------------------------------------------------- /modules/client/src/test/resources/create_nft_for_alice_smartcontract.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger-iroha/iroha-java/5467c487e173f9b472393420dd0b390c640c3f8f/modules/client/src/test/resources/create_nft_for_alice_smartcontract.wasm -------------------------------------------------------------------------------- /modules/client/src/test/resources/create_nft_for_alice_smartcontract/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "wasm32-unknown-unknown" 3 | -------------------------------------------------------------------------------- /modules/client/src/test/resources/create_nft_for_alice_smartcontract/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "create_nft_for_alice_smartcontract" 3 | version = "2.0.0-rc.1.0" 4 | # TODO: teams are being deprecated update the authors URL 5 | authors = ["Iroha 2 team "] 6 | edition = "2021" 7 | 8 | [lib] 9 | # Smartcontract should be linked dynamically so that it may link to functions exported 10 | # from the host environment. Also, host environment executes the smartcontract by 11 | # calling the function which smartcontract exports(entry point of execution) 12 | crate-type = ['cdylib'] 13 | 14 | # Empty workspace to fix "current package believes it's in a workspace when it's not" 15 | [workspace] 16 | 17 | [profile.dev] 18 | panic = "abort" 19 | 20 | [profile.release] 21 | panic = "abort" 22 | 23 | [profile.deploy] 24 | inherits = "release" 25 | strip = "debuginfo" # Remove debugging info from the binary 26 | lto = true # Link-time-optimization produces notable decrease in binary size 27 | opt-level = "z" # Optimize for size vs speed with "s"/"z"(removes vectorization) 28 | codegen-units = 1 # Further reduces binary size but increases compilation time 29 | 30 | [dependencies] 31 | iroha_trigger = { git = "https://github.com/hyperledger/iroha/", tag = "v2.0.0-rc.1.0", features = ["debug"] } 32 | 33 | dlmalloc = { version = "0.2.6", features = ["global"] } 34 | panic-halt = "0.2.0" 35 | -------------------------------------------------------------------------------- /modules/client/src/test/resources/create_nft_for_alice_smartcontract/README.md: -------------------------------------------------------------------------------- 1 | This smart contract can be built using the following commands: 2 | 3 | ```groovy 4 | ./build.sh 5 | ``` -------------------------------------------------------------------------------- /modules/client/src/test/resources/create_nft_for_alice_smartcontract/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cargo +nightly-2024-09-09 build --profile=deploy -Zbuild-std -Zbuild-std-features=panic_immediate_abort 4 | cp ./target/wasm32-unknown-unknown/deploy/create_nft_for_alice_smartcontract.wasm ../create_nft_for_alice_smartcontract.wasm 5 | -------------------------------------------------------------------------------- /modules/client/src/test/resources/executor.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger-iroha/iroha-java/5467c487e173f9b472393420dd0b390c640c3f8f/modules/client/src/test/resources/executor.wasm -------------------------------------------------------------------------------- /modules/client/src/test/resources/executor/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "wasm32-unknown-unknown" 3 | -------------------------------------------------------------------------------- /modules/client/src/test/resources/executor/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "iroha_java_executor" 3 | edition = "2021" 4 | version = "2.0.0-rc.1.0" 5 | # TODO: teams are being deprecated update the authors URL 6 | authors = ["Iroha 2 team "] 7 | 8 | [lib] 9 | crate-type = ['cdylib'] 10 | 11 | [profile.dev] 12 | panic = "abort" 13 | 14 | [profile.release] 15 | panic = "abort" 16 | 17 | [profile.deploy] 18 | inherits = "release" 19 | strip = "debuginfo" # Remove debugging info from the binary 20 | lto = true # Link-time-optimization produces notable decrease in binary size 21 | opt-level = "z" # Optimize for size vs speed with "s"/"z"(removes vectorization) 22 | codegen-units = 1 # Further reduces binary size but increases compilation time 23 | 24 | [dependencies] 25 | iroha_executor = { git = "https://github.com/hyperledger/iroha/", tag = "v2.0.0-rc.1.0", features = ["debug"] } 26 | 27 | dlmalloc = { version = "0.2.6", features = ["global"] } 28 | panic-halt = "0.2.0" 29 | -------------------------------------------------------------------------------- /modules/client/src/test/resources/executor/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cargo +nightly-2024-09-09 build --profile=deploy -Zbuild-std -Zbuild-std-features=panic_immediate_abort 4 | cp ./target/wasm32-unknown-unknown/deploy/iroha_java_executor.wasm ../executor.wasm 5 | -------------------------------------------------------------------------------- /modules/client/src/test/resources/junit-platform.properties: -------------------------------------------------------------------------------- 1 | #junit.jupiter.execution.parallel.enabled=true 2 | #junit.jupiter.execution.logging.level.debug=enabled 3 | -------------------------------------------------------------------------------- /modules/client/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 | 16 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /modules/codegen/README.md: -------------------------------------------------------------------------------- 1 | # Codegen 2 | 3 | The `codegen` module generates models into [model](../model) using Iroha2 [schema](./src/main/resources/schema.json). 4 | 5 | You can use either the Gradle task [generate](./build.gradle) or the Kotlin [script](./src/main/kotlin/jp/co/soramitsu/iroha2/EntryPoint.kt). 6 | -------------------------------------------------------------------------------- /modules/codegen/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | implementation project(":model") 3 | 4 | implementation "com.fasterxml.jackson.core:jackson-databind:$jacksonKotlinVer" 5 | implementation "com.squareup:kotlinpoet:$kotlinPoetVer" 6 | } 7 | 8 | task generate(type: JavaExec) { 9 | group = 'codegen' 10 | mainClass = 'jp.co.soramitsu.iroha2.EntryPoint' 11 | classpath = sourceSets.main.runtimeClasspath 12 | // Folder where to write generated classes 13 | args "outputPath=../model/src/main/kotlin" 14 | // Schema file expected to be found in classpath 15 | args "schemaFileName=schema.json" 16 | finalizedBy ':model:formatKotlin' 17 | } 18 | 19 | jacocoTestReport { 20 | mustRunAfter(":admin-client:jacocoTestReport") 21 | mustRunAfter(":block:jacocoTestReport") 22 | mustRunAfter(":client:jacocoTestReport") 23 | } 24 | -------------------------------------------------------------------------------- /modules/codegen/src/main/kotlin/jp/co/soramitsu/iroha2/EntryPoint.kt: -------------------------------------------------------------------------------- 1 | @file:JvmName("EntryPoint") 2 | 3 | package jp.co.soramitsu.iroha2 4 | 5 | import jp.co.soramitsu.iroha2.codegen.generator.GeneratorEntryPoint 6 | import jp.co.soramitsu.iroha2.parse.SchemaParser 7 | import jp.co.soramitsu.iroha2.parse.SchemaReader 8 | import java.nio.file.Paths 9 | 10 | const val OUTPUT_PATH_ARG_NAME = "outputPath" 11 | const val SCHEMA_FILE_ARG_NAME = "schemaFileName" 12 | 13 | /** 14 | * Generate an entry point from the provided [arguments][args] 15 | */ 16 | fun main(args: Array) { 17 | val argsMap = parseArgs(args) 18 | val outputPath = Paths.get(tryExtractArg(argsMap, OUTPUT_PATH_ARG_NAME)) 19 | val schemaFileName = tryExtractArg(argsMap, SCHEMA_FILE_ARG_NAME) 20 | 21 | val schema = SchemaReader().readSchema(schemaFileName) 22 | val parseResult = SchemaParser().parse(schema) 23 | GeneratorEntryPoint.generate(parseResult, outputPath) 24 | } 25 | 26 | /** 27 | * Parse the [arguments][args] 28 | */ 29 | fun parseArgs(args: Array): Map = 30 | args 31 | .map { it.split("=") } 32 | .onEach { if (it.size != 2) throw RuntimeException("Incorrect format: expected format argumentKey=argumentValue") } 33 | .associateBy({ it[0] }, { it[1] }) 34 | 35 | /** 36 | * Extract a specified [argumnt][argName] from all [arguments][args] 37 | */ 38 | fun tryExtractArg( 39 | args: Map, 40 | argName: String, 41 | ): String = args[argName] ?: throw RuntimeException("Property '$argName' must be specified") 42 | -------------------------------------------------------------------------------- /modules/codegen/src/main/kotlin/jp/co/soramitsu/iroha2/Regex.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2 2 | 3 | import jp.co.soramitsu.iroha2.parse.ArrayResolver 4 | 5 | val COMMON_SCHEMA_GENERIC_REGEX = "^.*\"([^<]*)<(.+)>\".*\$".toRegex() // "type": "PartName" 6 | val DEFINITION_SCHEMA_GENERIC_REGEX = "^\\s{2}\"([^<]*)<(.+)>\".*\$".toRegex() // "PartName": { 7 | val GENERIC_REGEX = "^([^<]*)<(.+)>\$".toRegex() // PartName 8 | val ARRAY_REGEX = "${ArrayResolver.NAME}<(\\S+), (\\S+)\\>".toRegex() 9 | -------------------------------------------------------------------------------- /modules/codegen/src/main/kotlin/jp/co/soramitsu/iroha2/codegen/blueprint/Blueprint.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.codegen.blueprint 2 | 3 | import com.squareup.kotlinpoet.TypeName 4 | import jp.co.soramitsu.iroha2.type.Type 5 | 6 | /** 7 | * Basic blueprint for all kinds of types 8 | */ 9 | abstract class Blueprint( 10 | val source: T, 11 | ) { 12 | abstract val className: String 13 | abstract val packageName: String 14 | abstract val properties: List 15 | 16 | open fun resolveProperties(type: T): List = listOf() 17 | } 18 | 19 | /** 20 | * Type properties 21 | */ 22 | data class Property( 23 | val name: String, 24 | val typeName: TypeName, 25 | val original: Type, 26 | ) 27 | -------------------------------------------------------------------------------- /modules/codegen/src/main/kotlin/jp/co/soramitsu/iroha2/codegen/blueprint/EnumBlueprint.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.codegen.blueprint 2 | 3 | import jp.co.soramitsu.iroha2.type.EnumType 4 | 5 | /** 6 | * Blueprint for [EnumType] 7 | */ 8 | class EnumBlueprint( 9 | type: EnumType, 10 | ) : TypeBasedBlueprint(type) { 11 | val variants = resolveVariants() 12 | 13 | private fun resolveVariants(): List = 14 | source.variants.map { 15 | EnumVariantBlueprint(it.discriminant, this, it) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /modules/codegen/src/main/kotlin/jp/co/soramitsu/iroha2/codegen/blueprint/EnumVariantBlueprint.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.codegen.blueprint 2 | 3 | import jp.co.soramitsu.iroha2.codegen.defineClassName 4 | import jp.co.soramitsu.iroha2.codegen.resolveKotlinType 5 | import jp.co.soramitsu.iroha2.type.EnumType 6 | 7 | /** 8 | * Blueprint for [enum variant][EnumType.Variant] 9 | */ 10 | class EnumVariantBlueprint( 11 | val discriminant: Int, 12 | val parentBlueprint: EnumBlueprint, 13 | source: EnumType.Variant, 14 | ) : Blueprint(source) { 15 | override val className = defineClassName(source.name) 16 | override val packageName = "${parentBlueprint.packageName}.${parentBlueprint.className}" 17 | override val properties = resolveProperties(source) 18 | 19 | override fun resolveProperties(variant: EnumType.Variant): List = 20 | variant.type 21 | ?.requireValue() 22 | ?.let { type -> 23 | Property( 24 | defineClassName(type.name).replaceFirstChar(Char::lowercase), 25 | resolveKotlinType(type), 26 | type, 27 | ) 28 | }?.let { property -> listOf(property) } ?: listOf() 29 | } 30 | -------------------------------------------------------------------------------- /modules/codegen/src/main/kotlin/jp/co/soramitsu/iroha2/codegen/blueprint/StructBlueprint.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.codegen.blueprint 2 | 3 | import jp.co.soramitsu.iroha2.codegen.resolveKotlinType 4 | import jp.co.soramitsu.iroha2.type.StructType 5 | import java.util.StringTokenizer 6 | 7 | /** 8 | * Blueprint for [StructType] 9 | */ 10 | class StructBlueprint( 11 | type: StructType, 12 | ) : TypeBasedBlueprint(type) { 13 | override fun resolveProperties(type: StructType): List = 14 | type.mapping.map { (name, ty) -> 15 | Property( 16 | convertToCamelCase(name), 17 | resolveKotlinType(ty.requireValue()), 18 | ty.requireValue(), 19 | ) 20 | } 21 | 22 | /** 23 | * Create property name by converting from snake case to camel case 24 | */ 25 | private fun convertToCamelCase(name: String): String { 26 | val tokenizer = StringTokenizer(name, "_") 27 | return if (tokenizer.hasMoreTokens()) { 28 | val resultBuilder = StringBuilder(tokenizer.nextToken()) 29 | for (token in tokenizer) { 30 | resultBuilder.append((token as String).replaceFirstChar(Char::uppercase)) 31 | } 32 | resultBuilder.toString() 33 | } else { 34 | name 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /modules/codegen/src/main/kotlin/jp/co/soramitsu/iroha2/codegen/blueprint/TypeBasedBlueprint.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.codegen.blueprint 2 | 3 | import jp.co.soramitsu.iroha2.codegen.defineClassName 4 | import jp.co.soramitsu.iroha2.codegen.definePackageName 5 | import jp.co.soramitsu.iroha2.type.CompositeType 6 | 7 | /** 8 | * Blueprint for a specific type 9 | */ 10 | @ExperimentalUnsignedTypes 11 | abstract class TypeBasedBlueprint( 12 | source: T, 13 | ) : Blueprint(source) { 14 | override val className: String = defineClassName(source.name) 15 | override val packageName: String = definePackageName(className, source) 16 | override val properties = resolveProperties(source) 17 | } 18 | -------------------------------------------------------------------------------- /modules/codegen/src/main/kotlin/jp/co/soramitsu/iroha2/codegen/generator/TupleStructGenerator.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.codegen.generator 2 | 3 | import com.squareup.kotlinpoet.TypeSpec 4 | import jp.co.soramitsu.iroha2.codegen.blueprint.TupleStructBlueprint 5 | 6 | /** 7 | * Generator for [TupleStructBlueprint] 8 | */ 9 | object TupleStructGenerator : AbstractGenerator() { 10 | override fun implKDoc( 11 | blueprint: TupleStructBlueprint, 12 | clazz: TypeSpec.Builder, 13 | ) { 14 | super.implKDoc(blueprint, clazz) 15 | clazz.addKdoc("\n\nGenerated from '${blueprint.source.name}' tuple structure") 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /modules/codegen/src/main/kotlin/jp/co/soramitsu/iroha2/parse/ExtractGeneric.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.parse 2 | 3 | import jp.co.soramitsu.iroha2.GENERIC_REGEX 4 | 5 | private const val TYPE_GROUP_INDEX = 2 // first one will be the entire typeDef, the second one will be raw type 6 | 7 | /** 8 | * Extract generics from [name] using [parser] 9 | */ 10 | fun extractGeneric( 11 | name: String, 12 | parser: SchemaParser, 13 | ): List { 14 | val groups = GENERIC_REGEX.find(name)?.groupValues ?: return listOf() 15 | val rawType = groups.getOrNull(TYPE_GROUP_INDEX) ?: return listOf() 16 | return rawType.split(", ").map { parser.createAndGetNest(it) } 17 | } 18 | -------------------------------------------------------------------------------- /modules/codegen/src/main/kotlin/jp/co/soramitsu/iroha2/parse/SchemaParser.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.parse 2 | 3 | import jp.co.soramitsu.iroha2.type.Type 4 | 5 | /** 6 | * Parser for Iroha2 schema 7 | */ 8 | class SchemaParser { 9 | private val registry = HashMap() 10 | private val resolver = TypeResolver(this) 11 | 12 | /** 13 | * Parse the provided [schema] 14 | * 15 | * @return resolved types 16 | */ 17 | fun parse(schema: Map): Map { 18 | val preprocessed = 19 | schema 20 | .map { entry -> createAndGetNest(entry.key, entry.value) } 21 | .associateBy { it.name } 22 | val notResolvedTypes = 23 | preprocessed 24 | .flatMap { it.value.notResolvedTypes() } 25 | .toSet() 26 | if (notResolvedTypes.isNotEmpty()) { 27 | throw RuntimeException("Some types are not resolved: $notResolvedTypes") 28 | } 29 | return preprocessed.mapValues { it.value.requireValue() } 30 | } 31 | 32 | /** 33 | * Parse the given [name] and return its [TypeNest] 34 | */ 35 | fun createAndGetNest( 36 | name: String, 37 | typeValue: Any? = null, 38 | ): TypeNest = 39 | registry 40 | .getOrPut(name) { 41 | TypeNest(name, null) 42 | }.also { 43 | if (it.value == null) { 44 | it.value = resolver.resolve(name, typeValue) 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /modules/codegen/src/main/kotlin/jp/co/soramitsu/iroha2/type/Common.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.type 2 | 3 | import jp.co.soramitsu.iroha2.parse.TypeNest 4 | 5 | /** 6 | * Basic class for Iroha2 types. 7 | * 8 | * The [type names][name] are resolved with a [TypeResolver]. 9 | */ 10 | sealed class Type( 11 | open val name: String, 12 | ) { 13 | open fun notResolvedTypes(): Set = setOf() 14 | } 15 | 16 | /** 17 | * Unit struct type 18 | */ 19 | object NullType : Type("null") 20 | 21 | /** 22 | * Boolean type 23 | */ 24 | object BooleanType : Type("bool") 25 | 26 | /** 27 | * `MapType` data type 28 | */ 29 | data class MapType( 30 | override val name: String, 31 | val key: TypeNest, 32 | val value: TypeNest, 33 | val sortedByKey: Boolean = false, 34 | ) : Type(name) { 35 | override fun notResolvedTypes(): Set { 36 | val result = mutableSetOf() 37 | if (key.value == null) { 38 | result.add(key.name) 39 | } else if (value.value == null) { 40 | result.add(value.name) 41 | } 42 | return result 43 | } 44 | } 45 | 46 | /** 47 | * String type 48 | */ 49 | object StringType : Type("String") 50 | -------------------------------------------------------------------------------- /modules/codegen/src/main/kotlin/jp/co/soramitsu/iroha2/type/Int.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.type 2 | 3 | /** 4 | * Integer types 5 | */ 6 | abstract class IntType( 7 | name: String, 8 | ) : Type(name) 9 | 10 | /** 11 | * 8-bit integers 12 | */ 13 | object I8Type : IntType("i8") 14 | 15 | /** 16 | * 16-bit integers 17 | */ 18 | object I16Type : IntType("i16") 19 | 20 | /** 21 | * 32-bit integers 22 | */ 23 | object I32Type : IntType("i32") 24 | 25 | /** 26 | * 64-bit integers 27 | */ 28 | object I64Type : IntType("i64") 29 | 30 | /** 31 | * 128-bit integers 32 | */ 33 | object I128Type : IntType("i128") 34 | 35 | /** 36 | * 256-bit integers 37 | */ 38 | object I256Type : IntType("i256") 39 | -------------------------------------------------------------------------------- /modules/codegen/src/main/kotlin/jp/co/soramitsu/iroha2/type/Uint.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.type 2 | 3 | /** 4 | * Unigned integer types 5 | */ 6 | abstract class UIntType( 7 | name: String, 8 | ) : Type(name) 9 | 10 | /** 11 | * 8-bit unsigned integers 12 | */ 13 | object U8Type : UIntType("u8") 14 | 15 | /** 16 | * 16-bit unsigned integers 17 | */ 18 | object U16Type : UIntType("u16") 19 | 20 | /** 21 | * 32-bit unsigned integers 22 | */ 23 | object U32Type : UIntType("u32") 24 | 25 | /** 26 | * 64-bit unsigned integers 27 | */ 28 | object U64Type : UIntType("u64") 29 | 30 | /** 31 | * 128-bit unsigned integers 32 | */ 33 | object U128Type : UIntType("u128") 34 | 35 | /** 36 | * 256-bit unsigned integers 37 | */ 38 | object U256Type : UIntType("u256") 39 | -------------------------------------------------------------------------------- /modules/model/README.md: -------------------------------------------------------------------------------- 1 | # Model 2 | 3 | The `model` module contains models generated by [codegen](../codegen). 4 | 5 | You can find model serializers and deserializers in the [`block` module](../block/src/main/kotlin/jp/co/soramitsu/iroha2). -------------------------------------------------------------------------------- /modules/model/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | implementation "com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonKotlinVer" 3 | 4 | // crypto 5 | implementation "com.github.multiformats:java-multihash:$multihashVersion" 6 | implementation "org.bouncycastle:bcprov-jdk15on:$bouncyCastleVer" 7 | api "net.i2p.crypto:eddsa:$i2pCryptoEddsa" 8 | } 9 | 10 | jacocoTestReport { 11 | mustRunAfter(":admin-client:jacocoTestReport") 12 | mustRunAfter(":block:jacocoTestReport") 13 | mustRunAfter(":client:jacocoTestReport") 14 | mustRunAfter(":codegen:jacocoTestReport") 15 | } 16 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/Constants.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2 2 | 3 | const val DEFAULT_P2P_PORT = 1337 4 | const val DEFAULT_API_PORT = 8080 5 | 6 | const val ASSET_ID_DELIMITER = "#" 7 | const val ACCOUNT_ID_DELIMITER = "@" 8 | const val TRIGGER_ID_DELIMITER = "$" 9 | const val PARAMETER_DELIMITER = "=" 10 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/Exceptions.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2 2 | 3 | /** 4 | * Top-level error that can be thrown by the client 5 | */ 6 | open class IrohaSdkException( 7 | message: String? = null, 8 | cause: Throwable? = null, 9 | ) : Exception(message, cause) 10 | 11 | /** 12 | * Throw if there is an exception during scale encoding/decoding 13 | */ 14 | class ScaleCodecException( 15 | message: String? = null, 16 | cause: Throwable? = null, 17 | ) : IrohaSdkException(message, cause) 18 | 19 | /** 20 | * Throw if there is an exception during conversion from or into a fixed-point number 21 | */ 22 | class FixedPointConversionException( 23 | message: String? = null, 24 | cause: Throwable? = null, 25 | ) : IrohaSdkException(message, cause) 26 | 27 | /** 28 | * Throw if there is an issue with deserialization. 29 | * 30 | * @param message The explanation of the issue 31 | */ 32 | class DeserializationException( 33 | message: String, 34 | ) : RuntimeException(message) 35 | 36 | /** 37 | * Throw if there is an issue with serialization 38 | * 39 | * @param message The explanation of the issue 40 | */ 41 | class SerializationException( 42 | message: String, 43 | ) : RuntimeException(message) 44 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/ModelCustomInstruction.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2 2 | 3 | interface ModelCustomInstruction 4 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/ModelEnum.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2 2 | 3 | /** 4 | * Interface-marker for all types derived from Rust enums 5 | */ 6 | interface ModelEnum 7 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/ModelParameter.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2 2 | 3 | interface ModelParameter 4 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/ModelPermission.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2 2 | 3 | import jp.co.soramitsu.iroha2.generated.Json 4 | import jp.co.soramitsu.iroha2.generated.Permission 5 | 6 | /** 7 | * Permission 8 | */ 9 | interface ModelPermission { 10 | fun asRaw(): Permission = Permission(this.javaClass.simpleName, Json.writeValue(this)) 11 | } 12 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/TriggerArgs.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2 2 | 3 | interface TriggerArgs 4 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/Util.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2 2 | 3 | /** 4 | * The largest power of two that can be represented as an `int`. 5 | */ 6 | const val MAX_POWER_OF_TWO = 1 shl Integer.SIZE - 2 7 | 8 | /** 9 | * The maximum unsigned zero-based value that can be represented by a 32-bit integer 10 | */ 11 | const val U32_MAX_VALUE = (1L shl 32) - 1 12 | 13 | /** 14 | * Wrap an [exception][ex] in `ScaleCodecException` 15 | */ 16 | fun wrapException(ex: Exception): Exception = 17 | when (ex) { 18 | is ScaleCodecException -> ex 19 | else -> ScaleCodecException(cause = ex) 20 | } 21 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/codec/Extensions.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.codec 2 | 3 | import java.nio.ByteBuffer 4 | 5 | fun Long.toBytes(): ByteArray = ByteBuffer.allocate(Long.SIZE_BYTES).also { it.putLong(this) }.array() 6 | 7 | infix fun Short.and(other: Short): Short = (this.toInt() and other.toInt()).toShort() 8 | 9 | infix fun Short.shr(other: Short): Short = (this.toInt() shr other.toInt()).toShort() 10 | 11 | infix fun Short.shl(other: Short): Short = (this.toInt() shl other.toInt()).toShort() 12 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/codec/ScaleReader.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.codec 2 | 3 | /** 4 | * SCALE codec reader for a complex data type 5 | * 6 | * @param type 7 | */ 8 | interface ScaleReader { 9 | /** 10 | * Read SCALE value from the specified reader. The reader must be positioned on the beginning of the value 11 | * 12 | * @param reader reader with the encoded data 13 | * @return read value 14 | */ 15 | fun read(reader: ScaleCodecReader): T 16 | 17 | /** 18 | * Decode data encoded as a SCALE value 19 | */ 20 | fun decode(data: ByteArray) = ScaleCodecReader(data).read(this) 21 | } 22 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/codec/ScaleWriter.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.codec 2 | 3 | import java.io.ByteArrayOutputStream 4 | 5 | /** 6 | * SCALE codec writer for a complex data type 7 | * 8 | * @param type 9 | */ 10 | interface ScaleWriter { 11 | /** 12 | * Write SCALE value to the specified writer. 13 | * 14 | * @param writer writer with the data 15 | * @param instance the data to write 16 | */ 17 | fun write( 18 | writer: ScaleCodecWriter, 19 | instance: T, 20 | ) 21 | 22 | /** 23 | * Encode provided data as a SCALE value 24 | */ 25 | fun encode(data: T): ByteArray { 26 | // resource is freed inside `ScaleCodecWriter` 27 | val buffer = ByteArrayOutputStream() 28 | val scaleCodecWriter = ScaleCodecWriter(buffer) 29 | this.write(scaleCodecWriter, data) 30 | return buffer.toByteArray() 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/codec/UnionValue.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.codec 2 | 3 | import java.util.Objects 4 | 5 | /** 6 | * `UnionValue` type is [enumeration][index] with assigned [value] 7 | */ 8 | class UnionValue( 9 | index: Int, 10 | value: T, 11 | ) { 12 | val index: Int 13 | val value: T 14 | 15 | override fun equals(o: Any?): Boolean { 16 | if (this === o) return true 17 | if (o !is UnionValue<*>) return false 18 | if (!o.canEquals(this)) return false 19 | val that = o 20 | return index == that.index && 21 | value == that.value 22 | } 23 | 24 | fun canEquals(o: Any?): Boolean = o is UnionValue<*> 25 | 26 | override fun hashCode(): Int = Objects.hash(index, value) 27 | 28 | override fun toString(): String = 29 | "UnionValue{" + 30 | "index=" + index + 31 | ", value=" + value + 32 | '}' 33 | 34 | init { 35 | require(index >= 0) { "Index cannot be negative number: $index" } 36 | require(index <= 255) { "Union can have max 255 values. Index: $index" } 37 | this.index = index 38 | this.value = value 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/codec/reader/BoolReader.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.codec.reader 2 | 3 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 4 | import jp.co.soramitsu.iroha2.codec.ScaleReader 5 | 6 | /** 7 | * SCALE codec reader for Boolean values encoded as SCALE values 8 | */ 9 | class BoolReader : ScaleReader { 10 | override fun read(reader: ScaleCodecReader): Boolean = 11 | when (val b = reader.readByte().toInt()) { 12 | 0 -> false 13 | 1 -> true 14 | else -> throw IllegalStateException("Not a boolean option: $b") 15 | } 16 | } 17 | 18 | /** 19 | * SCALE codec reader for Nullable Boolean values encoded as SCALE values 20 | */ 21 | class BoolNullableReader : ScaleReader { 22 | override fun read(reader: ScaleCodecReader): Boolean? = 23 | when (val b = reader.readByte().toInt()) { 24 | 0 -> null 25 | 1 -> false 26 | 2 -> true 27 | else -> throw IllegalStateException("Not a boolean option: $b") 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/codec/reader/CompactBigIntReader.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.codec.reader 2 | 3 | import jp.co.soramitsu.iroha2.codec.CompactMode 4 | import jp.co.soramitsu.iroha2.codec.CompactMode.Companion.byValue 5 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 6 | import jp.co.soramitsu.iroha2.codec.ScaleReader 7 | import jp.co.soramitsu.iroha2.codec.and 8 | import jp.co.soramitsu.iroha2.codec.shr 9 | import java.math.BigInteger 10 | 11 | /** 12 | * [Compact mode][CompactMode] SCALE reader for Big Integers 13 | */ 14 | class CompactBigIntReader : ScaleReader { 15 | override fun read(reader: ScaleCodecReader): BigInteger { 16 | val type = reader.readUByte() 17 | val mode = byValue((type and 3).toByte()) 18 | if (mode !== CompactMode.BIGINT) { 19 | reader.skip(-1) 20 | val value = intReader.read(reader) 21 | return BigInteger.valueOf(value.toLong()) 22 | } 23 | val len = (type shr 2) + 4 24 | val value = reader.readByteArray(len) 25 | // LE encoded, so need to reverse it 26 | for (i in 0 until value.size / 2) { 27 | val temp = value[i] 28 | value[i] = value[value.size - i - 1] 29 | value[value.size - i - 1] = temp 30 | } 31 | // unsigned, i.e. always positive, signum=1 32 | return BigInteger(1, value) 33 | } 34 | 35 | companion object { 36 | private val intReader = CompactUIntReader() 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/codec/reader/CompactUIntReader.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.codec.reader 2 | 3 | import jp.co.soramitsu.iroha2.codec.CompactMode 4 | import jp.co.soramitsu.iroha2.codec.CompactMode.Companion.byValue 5 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 6 | import jp.co.soramitsu.iroha2.codec.ScaleReader 7 | import jp.co.soramitsu.iroha2.codec.and 8 | import jp.co.soramitsu.iroha2.codec.shl 9 | import jp.co.soramitsu.iroha2.codec.shr 10 | 11 | /** 12 | * [Compact mode][CompactMode] SCALE reader for unsigned Integers 13 | */ 14 | class CompactUIntReader : ScaleReader { 15 | /** 16 | * @param reader reader with the encoded data 17 | * @return integer value 18 | * @throws UnsupportedOperationException if the value is encoded with more than four bytes (use [CompactBigIntReader]) 19 | */ 20 | override fun read(reader: ScaleCodecReader): Int { 21 | val i = reader.readUByte() 22 | val mode = byValue((i and 3).toByte()) 23 | if (mode === CompactMode.SINGLE) { 24 | return i shr 2 25 | } 26 | if (mode === CompactMode.TWO) { 27 | return ((i shr 2) + (reader.readUByte() shl 6)) 28 | } 29 | if (mode === CompactMode.FOUR) { 30 | return (i shr 2) + 31 | (reader.readUByte() shl 6) + 32 | (reader.readUByte() shl 6 + 8) + 33 | (reader.readUByte() shl 6 + 2 * 8) 34 | } 35 | throw UnsupportedOperationException("Mode $mode is not implemented") 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/codec/reader/EnumReader.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.codec.reader 2 | 3 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 4 | import jp.co.soramitsu.iroha2.codec.ScaleReader 5 | 6 | /** 7 | * SCALE codec reader for Java enum values. 8 | * 9 | * The reader reads one byte and returns a Enum value with the equal Ordinal value. 10 | * 11 | * If you need to read an enumeration with assigned value, i.e. Rust style enum, you should use [UnionReader] instead. 12 | * 13 | * @param type of Enum 14 | * @see UnionReader 15 | */ 16 | class EnumReader?>( 17 | values: Array, 18 | ) : ScaleReader { 19 | private val values: Array 20 | 21 | override fun read(reader: ScaleCodecReader): T { 22 | val id = reader.readUByte() 23 | for (t in values) { 24 | if (t!!.ordinal == id.toInt()) { 25 | return t 26 | } 27 | } 28 | throw IllegalStateException("Unknown enum value: $id") 29 | } 30 | 31 | /** 32 | * Define reader by specifying the list of possible values. In most cases it would be: 33 | * `new EnumReader(MyEnum.values()`. 34 | * 35 | * @param values list of enum values 36 | */ 37 | init { 38 | require(values.isNotEmpty()) { "List of enums is empty" } 39 | this.values = values 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/codec/reader/ListReader.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.codec.reader 2 | 3 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 4 | import jp.co.soramitsu.iroha2.codec.ScaleReader 5 | 6 | /** 7 | * SCALE codec reader for a list of values encoded as type 8 | */ 9 | class ListReader( 10 | private val scaleReader: ScaleReader, 11 | ) : ScaleReader> { 12 | override fun read(reader: ScaleCodecReader): List { 13 | val size = reader.readCompactInt() 14 | val result: MutableList = ArrayList(size) 15 | for (i in 0 until size) { 16 | reader.read(scaleReader)?.also { result.add(it) } 17 | } 18 | return result 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/codec/reader/StringReader.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.codec.reader 2 | 3 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 4 | import jp.co.soramitsu.iroha2.codec.ScaleReader 5 | 6 | /** 7 | * Read string, encoded as UTF-8 bytes 8 | */ 9 | class StringReader : ScaleReader { 10 | override fun read(reader: ScaleCodecReader): String = reader.readString() 11 | } 12 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/codec/reader/UByteReader.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.codec.reader 2 | 3 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 4 | import jp.co.soramitsu.iroha2.codec.ScaleReader 5 | 6 | /** 7 | * SCALE codec reader for Java Short Integers encoded as unsigned byte SCALE values 8 | */ 9 | class UByteReader : ScaleReader { 10 | override fun read(reader: ScaleCodecReader): Int { 11 | val x = reader.readByte() 12 | return if (x < 0) { 13 | 256 + x.toInt() 14 | } else { 15 | x.toInt() 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/codec/reader/UnionReader.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.codec.reader 2 | 3 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 4 | import jp.co.soramitsu.iroha2.codec.ScaleReader 5 | import jp.co.soramitsu.iroha2.codec.UnionValue 6 | 7 | /** 8 | * SCALE reader for [UnionValue] 9 | */ 10 | class UnionReader( 11 | private val mapping: List>, 12 | ) : ScaleReader> { 13 | constructor(vararg mapping: ScaleReader) : this(listOf>(*mapping)) 14 | 15 | override fun read(reader: ScaleCodecReader): UnionValue { 16 | val index = reader.readUByte() 17 | check(mapping.size > index) { "Unknown type index: $index" } 18 | val value = mapping[index.toInt()].read(reader) 19 | return UnionValue(index.toInt(), value) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/codec/reader/UnsupportedReader.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.codec.reader 2 | 3 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 4 | import jp.co.soramitsu.iroha2.codec.ScaleReader 5 | 6 | /** 7 | * Reader for unsupported values 8 | * 9 | * @throws IllegalStateException 10 | */ 11 | class UnsupportedReader 12 | @JvmOverloads 13 | constructor( 14 | private val message: String = "Reading an unsupported value", 15 | ) : ScaleReader { 16 | override fun read(reader: ScaleCodecReader): T = throw IllegalStateException(message) 17 | } 18 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/codec/writer/BoolWriter.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.codec.writer 2 | 3 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 4 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 5 | 6 | /** 7 | * SCALE codec writer for Boolean values 8 | */ 9 | class BoolWriter : ScaleWriter { 10 | override fun write( 11 | wrt: ScaleCodecWriter, 12 | value: Boolean, 13 | ) { 14 | when (value) { 15 | false -> wrt.directWrite(0) 16 | true -> wrt.directWrite(1) 17 | } 18 | } 19 | } 20 | 21 | /** 22 | * SCALE codec writer for Nullable Boolean values 23 | */ 24 | class BoolNullableWriter : ScaleWriter { 25 | override fun write( 26 | writer: ScaleCodecWriter, 27 | instance: Boolean?, 28 | ) { 29 | when (instance) { 30 | null -> writer.directWrite(0) 31 | false -> writer.directWrite(1) 32 | true -> writer.directWrite(2) 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/codec/writer/CompactBigIntWriter.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.codec.writer 2 | 3 | import jp.co.soramitsu.iroha2.codec.CompactMode 4 | import jp.co.soramitsu.iroha2.codec.CompactMode.Companion.forNumber 5 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 6 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 7 | import java.math.BigInteger 8 | 9 | /** 10 | * [Compact mode][CompactMode] SCALE writer for Big Integers 11 | */ 12 | class CompactBigIntWriter : ScaleWriter { 13 | override fun write( 14 | writer: ScaleCodecWriter, 15 | instance: BigInteger, 16 | ) { 17 | val mode = forNumber(instance) 18 | val data = instance.toByteArray() 19 | var length = data.size 20 | var pos = data.size - 1 21 | var limit = 0 22 | if (mode !== CompactMode.BIGINT) { 23 | LONG_WRITER.write(writer, instance.toLong()) 24 | return 25 | } 26 | 27 | // skip the first byte if it's 0 28 | if (data[0] == 0.toByte()) { 29 | length-- 30 | limit++ 31 | } 32 | writer.directWrite((length - 4 shl 2) + mode.value) 33 | while (pos >= limit) { 34 | writer.directWrite(data[pos].toInt()) 35 | pos-- 36 | } 37 | } 38 | 39 | companion object { 40 | private val LONG_WRITER = CompactULongWriter() 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/codec/writer/CompactUIntWriter.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.codec.writer 2 | 3 | import jp.co.soramitsu.iroha2.codec.CompactMode 4 | import jp.co.soramitsu.iroha2.codec.CompactMode.Companion.forNumber 5 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 6 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 7 | 8 | /** 9 | * [Compact mode][CompactMode] SCALE writer for unsigned Integers 10 | */ 11 | class CompactUIntWriter : ScaleWriter { 12 | override fun write( 13 | writer: ScaleCodecWriter, 14 | instance: Int, 15 | ) { 16 | val mode = forNumber(instance) 17 | var compact: Int 18 | var bytes: Int 19 | if (mode === CompactMode.BIGINT) { 20 | writer.directWrite(mode.value.toInt()) 21 | compact = instance 22 | bytes = 4 23 | } else { 24 | compact = (instance shl 2) + mode.value 25 | bytes = 26 | when (mode) { 27 | CompactMode.SINGLE -> 1 28 | CompactMode.TWO -> 2 29 | else -> 4 30 | } 31 | } 32 | while (bytes > 0) { 33 | writer.directWrite(compact and 0xff) 34 | compact = compact shr 8 35 | bytes-- 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/codec/writer/CompactULongWriter.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.codec.writer 2 | 3 | import jp.co.soramitsu.iroha2.codec.CompactMode 4 | import jp.co.soramitsu.iroha2.codec.CompactMode.Companion.forNumber 5 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 6 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 7 | import java.math.BigInteger 8 | 9 | /** 10 | * [Compact mode][CompactMode] SCALE writer for unsigned Long Integers 11 | */ 12 | class CompactULongWriter : ScaleWriter { 13 | override fun write( 14 | wrt: ScaleCodecWriter, 15 | value: Long, 16 | ) { 17 | val mode = forNumber(value) 18 | var compact: Long 19 | var bytes: Int 20 | if (mode === CompactMode.BIGINT) { 21 | BIGINT_WRITER.write(wrt, BigInteger.valueOf(value)) 22 | return 23 | } else { 24 | compact = (value shl 2) + mode.value 25 | bytes = 26 | when (mode) { 27 | CompactMode.SINGLE -> 1 28 | CompactMode.TWO -> 2 29 | else -> 4 30 | } 31 | } 32 | while (bytes > 0) { 33 | wrt.directWrite(compact.toInt() and 0xff) 34 | compact = compact shr 8 35 | bytes-- 36 | } 37 | } 38 | 39 | companion object { 40 | private val BIGINT_WRITER = CompactBigIntWriter() 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/codec/writer/ListWriter.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.codec.writer 2 | 3 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 4 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 5 | 6 | /** 7 | * SCALE codec writer for a list of values to be encoded as type 8 | */ 9 | class ListWriter( 10 | private val scaleWriter: ScaleWriter, 11 | ) : ScaleWriter> { 12 | override fun write( 13 | writer: ScaleCodecWriter, 14 | instance: List, 15 | ) { 16 | writer.writeCompact(instance.size) 17 | for (item in instance) { 18 | scaleWriter.write(writer, item) 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/codec/writer/UByteWriter.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.codec.writer 2 | 3 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 4 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 5 | 6 | /** 7 | * SCALE codec writer for Java Short Integers to encode them as unsigned byte SCALE values 8 | */ 9 | class UByteWriter : ScaleWriter { 10 | override fun write( 11 | writer: ScaleCodecWriter, 12 | instance: Short, 13 | ) { 14 | require(!(instance < 0 || instance > 0xff)) { "Only values in range 0..255 are supported: $instance" } 15 | writer.directWrite(instance) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/codec/writer/UnionWriter.kt: -------------------------------------------------------------------------------- 1 | package jp.co.soramitsu.iroha2.codec.writer 2 | 3 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 4 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 5 | import jp.co.soramitsu.iroha2.codec.UnionValue 6 | 7 | /** 8 | * SCALE codec writer for [UnionValue] 9 | */ 10 | class UnionWriter( 11 | mapping: List>, 12 | ) : ScaleWriter> { 13 | private val mapping: MutableList> 14 | 15 | constructor(vararg mapping: ScaleWriter) : this(listOf>(*mapping)) 16 | 17 | override fun write( 18 | writer: ScaleCodecWriter, 19 | instance: UnionValue, 20 | ) { 21 | writer.directWrite(instance.index) 22 | val actual = instance.value 23 | mapping[instance.index].write(writer, actual) 24 | } 25 | 26 | init { 27 | this.mapping = ArrayList(mapping.size) 28 | for (t in mapping) { 29 | this.mapping.add(t as ScaleWriter) 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/Account.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * Account 15 | * 16 | * Generated from 'Account' regular structure 17 | */ 18 | public data class Account( 19 | public val id: AccountId, 20 | public val metadata: Metadata, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): Account = 24 | try { 25 | Account( 26 | AccountId.read(reader), 27 | Metadata.read(reader), 28 | ) 29 | } catch (ex: Exception) { 30 | throw wrapException(ex) 31 | } 32 | 33 | override fun write( 34 | writer: ScaleCodecWriter, 35 | instance: Account, 36 | ): Unit = 37 | try { 38 | AccountId.write(writer, instance.id) 39 | Metadata.write(writer, instance.metadata) 40 | } catch (ex: Exception) { 41 | throw wrapException(ex) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/AccountId.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * AccountId 15 | * 16 | * Generated from 'AccountId' regular structure 17 | */ 18 | public data class AccountId( 19 | public val domain: DomainId, 20 | public val signatory: PublicKey, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): AccountId = 24 | try { 25 | AccountId( 26 | DomainId.read(reader), 27 | PublicKey.read(reader), 28 | ) 29 | } catch (ex: Exception) { 30 | throw wrapException(ex) 31 | } 32 | 33 | override fun write( 34 | writer: ScaleCodecWriter, 35 | instance: AccountId, 36 | ): Unit = 37 | try { 38 | DomainId.write(writer, instance.domain) 39 | PublicKey.write(writer, instance.signatory) 40 | } catch (ex: Exception) { 41 | throw wrapException(ex) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/AccountPredicateAtom.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.ModelEnum 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 8 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 9 | import jp.co.soramitsu.iroha2.codec.ScaleReader 10 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 11 | import kotlin.Int 12 | 13 | /** 14 | * AccountPredicateAtom 15 | * 16 | * Generated from 'AccountPredicateAtom' enum 17 | */ 18 | public sealed class AccountPredicateAtom : ModelEnum { 19 | /** 20 | * @return Discriminator of variant in enum 21 | */ 22 | public abstract fun discriminant(): Int 23 | 24 | public companion object : ScaleReader, ScaleWriter { 25 | override fun read(reader: ScaleCodecReader): AccountPredicateAtom = 26 | when (val discriminant = reader.readUByte()) { 27 | else -> throw RuntimeException("Unresolved discriminant of the enum variant: $discriminant") 28 | } 29 | 30 | override fun write( 31 | writer: ScaleCodecWriter, 32 | instance: AccountPredicateAtom, 33 | ) { 34 | writer.directWrite(instance.discriminant()) 35 | when (val discriminant = instance.discriminant()) { 36 | else -> throw RuntimeException("Unresolved discriminant of the enum variant: $discriminant") 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/AccountRoleChanged.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * AccountRoleChanged 15 | * 16 | * Generated from 'AccountRoleChanged' regular structure 17 | */ 18 | public data class AccountRoleChanged( 19 | public val account: AccountId, 20 | public val role: RoleId, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): AccountRoleChanged = 24 | try { 25 | AccountRoleChanged( 26 | AccountId.read(reader), 27 | RoleId.read(reader), 28 | ) 29 | } catch (ex: Exception) { 30 | throw wrapException(ex) 31 | } 32 | 33 | override fun write( 34 | writer: ScaleCodecWriter, 35 | instance: AccountRoleChanged, 36 | ): Unit = 37 | try { 38 | AccountId.write(writer, instance.account) 39 | RoleId.write(writer, instance.role) 40 | } catch (ex: Exception) { 41 | throw wrapException(ex) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/ActionPredicateAtom.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.ModelEnum 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 8 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 9 | import jp.co.soramitsu.iroha2.codec.ScaleReader 10 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 11 | import kotlin.Int 12 | 13 | /** 14 | * ActionPredicateAtom 15 | * 16 | * Generated from 'ActionPredicateAtom' enum 17 | */ 18 | public sealed class ActionPredicateAtom : ModelEnum { 19 | /** 20 | * @return Discriminator of variant in enum 21 | */ 22 | public abstract fun discriminant(): Int 23 | 24 | public companion object : ScaleReader, ScaleWriter { 25 | override fun read(reader: ScaleCodecReader): ActionPredicateAtom = 26 | when (val discriminant = reader.readUByte()) { 27 | else -> throw RuntimeException("Unresolved discriminant of the enum variant: $discriminant") 28 | } 29 | 30 | override fun write( 31 | writer: ScaleCodecWriter, 32 | instance: ActionPredicateAtom, 33 | ) { 34 | writer.directWrite(instance.discriminant()) 35 | when (val discriminant = instance.discriminant()) { 36 | else -> throw RuntimeException("Unresolved discriminant of the enum variant: $discriminant") 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/Asset.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * Asset 15 | * 16 | * Generated from 'Asset' regular structure 17 | */ 18 | public data class Asset( 19 | public val id: AssetId, 20 | public val `value`: AssetValue, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): Asset = 24 | try { 25 | Asset( 26 | AssetId.read(reader), 27 | AssetValue.read(reader), 28 | ) 29 | } catch (ex: Exception) { 30 | throw wrapException(ex) 31 | } 32 | 33 | override fun write( 34 | writer: ScaleCodecWriter, 35 | instance: Asset, 36 | ): Unit = 37 | try { 38 | AssetId.write(writer, instance.id) 39 | AssetValue.write(writer, instance.`value`) 40 | } catch (ex: Exception) { 41 | throw wrapException(ex) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/AssetChanged.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * AssetChanged 15 | * 16 | * Generated from 'AssetChanged' regular structure 17 | */ 18 | public data class AssetChanged( 19 | public val asset: AssetId, 20 | public val amount: AssetValue, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): AssetChanged = 24 | try { 25 | AssetChanged( 26 | AssetId.read(reader), 27 | AssetValue.read(reader), 28 | ) 29 | } catch (ex: Exception) { 30 | throw wrapException(ex) 31 | } 32 | 33 | override fun write( 34 | writer: ScaleCodecWriter, 35 | instance: AssetChanged, 36 | ): Unit = 37 | try { 38 | AssetId.write(writer, instance.asset) 39 | AssetValue.write(writer, instance.amount) 40 | } catch (ex: Exception) { 41 | throw wrapException(ex) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/AssetDefinitionId.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * AssetDefinitionId 15 | * 16 | * Generated from 'AssetDefinitionId' regular structure 17 | */ 18 | public data class AssetDefinitionId( 19 | public val domain: DomainId, 20 | public val name: Name, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): AssetDefinitionId = 24 | try { 25 | AssetDefinitionId( 26 | DomainId.read(reader), 27 | Name.read(reader), 28 | ) 29 | } catch (ex: Exception) { 30 | throw wrapException(ex) 31 | } 32 | 33 | override fun write( 34 | writer: ScaleCodecWriter, 35 | instance: AssetDefinitionId, 36 | ): Unit = 37 | try { 38 | DomainId.write(writer, instance.domain) 39 | Name.write(writer, instance.name) 40 | } catch (ex: Exception) { 41 | throw wrapException(ex) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/AssetId.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * AssetId 15 | * 16 | * Generated from 'AssetId' regular structure 17 | */ 18 | public data class AssetId( 19 | public val account: AccountId, 20 | public val definition: AssetDefinitionId, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): AssetId = 24 | try { 25 | AssetId( 26 | AccountId.read(reader), 27 | AssetDefinitionId.read(reader), 28 | ) 29 | } catch (ex: Exception) { 30 | throw wrapException(ex) 31 | } 32 | 33 | override fun write( 34 | writer: ScaleCodecWriter, 35 | instance: AssetId, 36 | ): Unit = 37 | try { 38 | AccountId.write(writer, instance.account) 39 | AssetDefinitionId.write(writer, instance.definition) 40 | } catch (ex: Exception) { 41 | throw wrapException(ex) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/AssetPredicateAtom.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.ModelEnum 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 8 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 9 | import jp.co.soramitsu.iroha2.codec.ScaleReader 10 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 11 | import kotlin.Int 12 | 13 | /** 14 | * AssetPredicateAtom 15 | * 16 | * Generated from 'AssetPredicateAtom' enum 17 | */ 18 | public sealed class AssetPredicateAtom : ModelEnum { 19 | /** 20 | * @return Discriminator of variant in enum 21 | */ 22 | public abstract fun discriminant(): Int 23 | 24 | public companion object : ScaleReader, ScaleWriter { 25 | override fun read(reader: ScaleCodecReader): AssetPredicateAtom = 26 | when (val discriminant = reader.readUByte()) { 27 | else -> throw RuntimeException("Unresolved discriminant of the enum variant: $discriminant") 28 | } 29 | 30 | override fun write( 31 | writer: ScaleCodecWriter, 32 | instance: AssetPredicateAtom, 33 | ) { 34 | writer.directWrite(instance.discriminant()) 35 | when (val discriminant = instance.discriminant()) { 36 | else -> throw RuntimeException("Unresolved discriminant of the enum variant: $discriminant") 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/BlockEvent.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * BlockEvent 15 | * 16 | * Generated from 'BlockEvent' regular structure 17 | */ 18 | public data class BlockEvent( 19 | public val `header`: BlockHeader, 20 | public val status: BlockStatus, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): BlockEvent = 24 | try { 25 | BlockEvent( 26 | BlockHeader.read(reader), 27 | BlockStatus.read(reader), 28 | ) 29 | } catch (ex: Exception) { 30 | throw wrapException(ex) 31 | } 32 | 33 | override fun write( 34 | writer: ScaleCodecWriter, 35 | instance: BlockEvent, 36 | ): Unit = 37 | try { 38 | BlockHeader.write(writer, instance.`header`) 39 | BlockStatus.write(writer, instance.status) 40 | } catch (ex: Exception) { 41 | throw wrapException(ex) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/BlockMessage.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * BlockMessage 15 | * 16 | * Generated from 'BlockMessage' regular structure 17 | */ 18 | public data class BlockMessage( 19 | public val signedBlock: SignedBlock, 20 | ) { 21 | public companion object : ScaleReader, ScaleWriter { 22 | override fun read(reader: ScaleCodecReader): BlockMessage = 23 | try { 24 | BlockMessage( 25 | SignedBlock.read(reader), 26 | ) 27 | } catch (ex: Exception) { 28 | throw wrapException(ex) 29 | } 30 | 31 | override fun write( 32 | writer: ScaleCodecWriter, 33 | instance: BlockMessage, 34 | ): Unit = 35 | try { 36 | SignedBlock.write(writer, instance.signedBlock) 37 | } catch (ex: Exception) { 38 | throw wrapException(ex) 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/BlockParameters.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * BlockParameters 15 | * 16 | * Generated from 'BlockParameters' regular structure 17 | */ 18 | public data class BlockParameters( 19 | public val maxTransactions: NonZeroOfu64, 20 | ) { 21 | public companion object : ScaleReader, ScaleWriter { 22 | override fun read(reader: ScaleCodecReader): BlockParameters = 23 | try { 24 | BlockParameters( 25 | NonZeroOfu64.read(reader), 26 | ) 27 | } catch (ex: Exception) { 28 | throw wrapException(ex) 29 | } 30 | 31 | override fun write( 32 | writer: ScaleCodecWriter, 33 | instance: BlockParameters, 34 | ): Unit = 35 | try { 36 | NonZeroOfu64.write(writer, instance.maxTransactions) 37 | } catch (ex: Exception) { 38 | throw wrapException(ex) 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/BlockSubscriptionRequest.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * BlockSubscriptionRequest 15 | * 16 | * Generated from 'BlockSubscriptionRequest' regular structure 17 | */ 18 | public data class BlockSubscriptionRequest( 19 | public val nonZeroOfu64: NonZeroOfu64, 20 | ) { 21 | public companion object : 22 | ScaleReader, 23 | ScaleWriter { 24 | override fun read(reader: ScaleCodecReader): BlockSubscriptionRequest = 25 | try { 26 | BlockSubscriptionRequest( 27 | NonZeroOfu64.read(reader), 28 | ) 29 | } catch (ex: Exception) { 30 | throw wrapException(ex) 31 | } 32 | 33 | override fun write( 34 | writer: ScaleCodecWriter, 35 | instance: BlockSubscriptionRequest, 36 | ): Unit = 37 | try { 38 | NonZeroOfu64.write(writer, instance.nonZeroOfu64) 39 | } catch (ex: Exception) { 40 | throw wrapException(ex) 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/CanBurnAsset.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.ModelPermission 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 8 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 9 | import jp.co.soramitsu.iroha2.codec.ScaleReader 10 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 11 | import jp.co.soramitsu.iroha2.wrapException 12 | import kotlin.Unit 13 | 14 | /** 15 | * CanBurnAsset 16 | * 17 | * Generated from 'CanBurnAsset' regular structure 18 | */ 19 | public data class CanBurnAsset( 20 | public val asset: AssetId, 21 | ) : ModelPermission { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): CanBurnAsset = 24 | try { 25 | CanBurnAsset( 26 | AssetId.read(reader), 27 | ) 28 | } catch (ex: Exception) { 29 | throw wrapException(ex) 30 | } 31 | 32 | override fun write( 33 | writer: ScaleCodecWriter, 34 | instance: CanBurnAsset, 35 | ): Unit = 36 | try { 37 | AssetId.write(writer, instance.asset) 38 | } catch (ex: Exception) { 39 | throw wrapException(ex) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/CanExecuteTrigger.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.ModelPermission 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 8 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 9 | import jp.co.soramitsu.iroha2.codec.ScaleReader 10 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 11 | import jp.co.soramitsu.iroha2.wrapException 12 | import kotlin.Unit 13 | 14 | /** 15 | * CanExecuteTrigger 16 | * 17 | * Generated from 'CanExecuteTrigger' regular structure 18 | */ 19 | public data class CanExecuteTrigger( 20 | public val trigger: TriggerId, 21 | ) : ModelPermission { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): CanExecuteTrigger = 24 | try { 25 | CanExecuteTrigger( 26 | TriggerId.read(reader), 27 | ) 28 | } catch (ex: Exception) { 29 | throw wrapException(ex) 30 | } 31 | 32 | override fun write( 33 | writer: ScaleCodecWriter, 34 | instance: CanExecuteTrigger, 35 | ): Unit = 36 | try { 37 | TriggerId.write(writer, instance.trigger) 38 | } catch (ex: Exception) { 39 | throw wrapException(ex) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/CanMintAsset.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.ModelPermission 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 8 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 9 | import jp.co.soramitsu.iroha2.codec.ScaleReader 10 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 11 | import jp.co.soramitsu.iroha2.wrapException 12 | import kotlin.Unit 13 | 14 | /** 15 | * CanMintAsset 16 | * 17 | * Generated from 'CanMintAsset' regular structure 18 | */ 19 | public data class CanMintAsset( 20 | public val asset: AssetId, 21 | ) : ModelPermission { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): CanMintAsset = 24 | try { 25 | CanMintAsset( 26 | AssetId.read(reader), 27 | ) 28 | } catch (ex: Exception) { 29 | throw wrapException(ex) 30 | } 31 | 32 | override fun write( 33 | writer: ScaleCodecWriter, 34 | instance: CanMintAsset, 35 | ): Unit = 36 | try { 37 | AssetId.write(writer, instance.asset) 38 | } catch (ex: Exception) { 39 | throw wrapException(ex) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/CanModifyAccountMetadata.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.ModelPermission 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 8 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 9 | import jp.co.soramitsu.iroha2.codec.ScaleReader 10 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 11 | import jp.co.soramitsu.iroha2.wrapException 12 | import kotlin.Unit 13 | 14 | /** 15 | * CanModifyAccountMetadata 16 | * 17 | * Generated from 'CanModifyAccountMetadata' regular structure 18 | */ 19 | public data class CanModifyAccountMetadata( 20 | public val account: AccountId, 21 | ) : ModelPermission { 22 | public companion object : 23 | ScaleReader, 24 | ScaleWriter { 25 | override fun read(reader: ScaleCodecReader): CanModifyAccountMetadata = 26 | try { 27 | CanModifyAccountMetadata( 28 | AccountId.read(reader), 29 | ) 30 | } catch (ex: Exception) { 31 | throw wrapException(ex) 32 | } 33 | 34 | override fun write( 35 | writer: ScaleCodecWriter, 36 | instance: CanModifyAccountMetadata, 37 | ): Unit = 38 | try { 39 | AccountId.write(writer, instance.account) 40 | } catch (ex: Exception) { 41 | throw wrapException(ex) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/CanModifyAssetMetadata.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.ModelPermission 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 8 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 9 | import jp.co.soramitsu.iroha2.codec.ScaleReader 10 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 11 | import jp.co.soramitsu.iroha2.wrapException 12 | import kotlin.Unit 13 | 14 | /** 15 | * CanModifyAssetMetadata 16 | * 17 | * Generated from 'CanModifyAssetMetadata' regular structure 18 | */ 19 | public data class CanModifyAssetMetadata( 20 | public val asset: AssetId, 21 | ) : ModelPermission { 22 | public companion object : 23 | ScaleReader, 24 | ScaleWriter { 25 | override fun read(reader: ScaleCodecReader): CanModifyAssetMetadata = 26 | try { 27 | CanModifyAssetMetadata( 28 | AssetId.read(reader), 29 | ) 30 | } catch (ex: Exception) { 31 | throw wrapException(ex) 32 | } 33 | 34 | override fun write( 35 | writer: ScaleCodecWriter, 36 | instance: CanModifyAssetMetadata, 37 | ): Unit = 38 | try { 39 | AssetId.write(writer, instance.asset) 40 | } catch (ex: Exception) { 41 | throw wrapException(ex) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/CanModifyDomainMetadata.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.ModelPermission 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 8 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 9 | import jp.co.soramitsu.iroha2.codec.ScaleReader 10 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 11 | import jp.co.soramitsu.iroha2.wrapException 12 | import kotlin.Unit 13 | 14 | /** 15 | * CanModifyDomainMetadata 16 | * 17 | * Generated from 'CanModifyDomainMetadata' regular structure 18 | */ 19 | public data class CanModifyDomainMetadata( 20 | public val domain: DomainId, 21 | ) : ModelPermission { 22 | public companion object : 23 | ScaleReader, 24 | ScaleWriter { 25 | override fun read(reader: ScaleCodecReader): CanModifyDomainMetadata = 26 | try { 27 | CanModifyDomainMetadata( 28 | DomainId.read(reader), 29 | ) 30 | } catch (ex: Exception) { 31 | throw wrapException(ex) 32 | } 33 | 34 | override fun write( 35 | writer: ScaleCodecWriter, 36 | instance: CanModifyDomainMetadata, 37 | ): Unit = 38 | try { 39 | DomainId.write(writer, instance.domain) 40 | } catch (ex: Exception) { 41 | throw wrapException(ex) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/CanModifyTrigger.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.ModelPermission 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 8 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 9 | import jp.co.soramitsu.iroha2.codec.ScaleReader 10 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 11 | import jp.co.soramitsu.iroha2.wrapException 12 | import kotlin.Unit 13 | 14 | /** 15 | * CanModifyTrigger 16 | * 17 | * Generated from 'CanModifyTrigger' regular structure 18 | */ 19 | public data class CanModifyTrigger( 20 | public val trigger: TriggerId, 21 | ) : ModelPermission { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): CanModifyTrigger = 24 | try { 25 | CanModifyTrigger( 26 | TriggerId.read(reader), 27 | ) 28 | } catch (ex: Exception) { 29 | throw wrapException(ex) 30 | } 31 | 32 | override fun write( 33 | writer: ScaleCodecWriter, 34 | instance: CanModifyTrigger, 35 | ): Unit = 36 | try { 37 | TriggerId.write(writer, instance.trigger) 38 | } catch (ex: Exception) { 39 | throw wrapException(ex) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/CanModifyTriggerMetadata.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.ModelPermission 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 8 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 9 | import jp.co.soramitsu.iroha2.codec.ScaleReader 10 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 11 | import jp.co.soramitsu.iroha2.wrapException 12 | import kotlin.Unit 13 | 14 | /** 15 | * CanModifyTriggerMetadata 16 | * 17 | * Generated from 'CanModifyTriggerMetadata' regular structure 18 | */ 19 | public data class CanModifyTriggerMetadata( 20 | public val trigger: TriggerId, 21 | ) : ModelPermission { 22 | public companion object : 23 | ScaleReader, 24 | ScaleWriter { 25 | override fun read(reader: ScaleCodecReader): CanModifyTriggerMetadata = 26 | try { 27 | CanModifyTriggerMetadata( 28 | TriggerId.read(reader), 29 | ) 30 | } catch (ex: Exception) { 31 | throw wrapException(ex) 32 | } 33 | 34 | override fun write( 35 | writer: ScaleCodecWriter, 36 | instance: CanModifyTriggerMetadata, 37 | ): Unit = 38 | try { 39 | TriggerId.write(writer, instance.trigger) 40 | } catch (ex: Exception) { 41 | throw wrapException(ex) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/CanRegisterAccount.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.ModelPermission 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 8 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 9 | import jp.co.soramitsu.iroha2.codec.ScaleReader 10 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 11 | import jp.co.soramitsu.iroha2.wrapException 12 | import kotlin.Unit 13 | 14 | /** 15 | * CanRegisterAccount 16 | * 17 | * Generated from 'CanRegisterAccount' regular structure 18 | */ 19 | public data class CanRegisterAccount( 20 | public val domain: DomainId, 21 | ) : ModelPermission { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): CanRegisterAccount = 24 | try { 25 | CanRegisterAccount( 26 | DomainId.read(reader), 27 | ) 28 | } catch (ex: Exception) { 29 | throw wrapException(ex) 30 | } 31 | 32 | override fun write( 33 | writer: ScaleCodecWriter, 34 | instance: CanRegisterAccount, 35 | ): Unit = 36 | try { 37 | DomainId.write(writer, instance.domain) 38 | } catch (ex: Exception) { 39 | throw wrapException(ex) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/CanRegisterAsset.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.ModelPermission 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 8 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 9 | import jp.co.soramitsu.iroha2.codec.ScaleReader 10 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 11 | import jp.co.soramitsu.iroha2.wrapException 12 | import kotlin.Unit 13 | 14 | /** 15 | * CanRegisterAsset 16 | * 17 | * Generated from 'CanRegisterAsset' regular structure 18 | */ 19 | public data class CanRegisterAsset( 20 | public val owner: AccountId, 21 | ) : ModelPermission { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): CanRegisterAsset = 24 | try { 25 | CanRegisterAsset( 26 | AccountId.read(reader), 27 | ) 28 | } catch (ex: Exception) { 29 | throw wrapException(ex) 30 | } 31 | 32 | override fun write( 33 | writer: ScaleCodecWriter, 34 | instance: CanRegisterAsset, 35 | ): Unit = 36 | try { 37 | AccountId.write(writer, instance.owner) 38 | } catch (ex: Exception) { 39 | throw wrapException(ex) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/CanRegisterTrigger.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.ModelPermission 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 8 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 9 | import jp.co.soramitsu.iroha2.codec.ScaleReader 10 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 11 | import jp.co.soramitsu.iroha2.wrapException 12 | import kotlin.Unit 13 | 14 | /** 15 | * CanRegisterTrigger 16 | * 17 | * Generated from 'CanRegisterTrigger' regular structure 18 | */ 19 | public data class CanRegisterTrigger( 20 | public val authority: AccountId, 21 | ) : ModelPermission { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): CanRegisterTrigger = 24 | try { 25 | CanRegisterTrigger( 26 | AccountId.read(reader), 27 | ) 28 | } catch (ex: Exception) { 29 | throw wrapException(ex) 30 | } 31 | 32 | override fun write( 33 | writer: ScaleCodecWriter, 34 | instance: CanRegisterTrigger, 35 | ): Unit = 36 | try { 37 | AccountId.write(writer, instance.authority) 38 | } catch (ex: Exception) { 39 | throw wrapException(ex) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/CanTransferAsset.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.ModelPermission 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 8 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 9 | import jp.co.soramitsu.iroha2.codec.ScaleReader 10 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 11 | import jp.co.soramitsu.iroha2.wrapException 12 | import kotlin.Unit 13 | 14 | /** 15 | * CanTransferAsset 16 | * 17 | * Generated from 'CanTransferAsset' regular structure 18 | */ 19 | public data class CanTransferAsset( 20 | public val asset: AssetId, 21 | ) : ModelPermission { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): CanTransferAsset = 24 | try { 25 | CanTransferAsset( 26 | AssetId.read(reader), 27 | ) 28 | } catch (ex: Exception) { 29 | throw wrapException(ex) 30 | } 31 | 32 | override fun write( 33 | writer: ScaleCodecWriter, 34 | instance: CanTransferAsset, 35 | ): Unit = 36 | try { 37 | AssetId.write(writer, instance.asset) 38 | } catch (ex: Exception) { 39 | throw wrapException(ex) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/CanUnregisterAccount.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.ModelPermission 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 8 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 9 | import jp.co.soramitsu.iroha2.codec.ScaleReader 10 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 11 | import jp.co.soramitsu.iroha2.wrapException 12 | import kotlin.Unit 13 | 14 | /** 15 | * CanUnregisterAccount 16 | * 17 | * Generated from 'CanUnregisterAccount' regular structure 18 | */ 19 | public data class CanUnregisterAccount( 20 | public val account: AccountId, 21 | ) : ModelPermission { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): CanUnregisterAccount = 24 | try { 25 | CanUnregisterAccount( 26 | AccountId.read(reader), 27 | ) 28 | } catch (ex: Exception) { 29 | throw wrapException(ex) 30 | } 31 | 32 | override fun write( 33 | writer: ScaleCodecWriter, 34 | instance: CanUnregisterAccount, 35 | ): Unit = 36 | try { 37 | AccountId.write(writer, instance.account) 38 | } catch (ex: Exception) { 39 | throw wrapException(ex) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/CanUnregisterAsset.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.ModelPermission 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 8 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 9 | import jp.co.soramitsu.iroha2.codec.ScaleReader 10 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 11 | import jp.co.soramitsu.iroha2.wrapException 12 | import kotlin.Unit 13 | 14 | /** 15 | * CanUnregisterAsset 16 | * 17 | * Generated from 'CanUnregisterAsset' regular structure 18 | */ 19 | public data class CanUnregisterAsset( 20 | public val asset: AssetId, 21 | ) : ModelPermission { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): CanUnregisterAsset = 24 | try { 25 | CanUnregisterAsset( 26 | AssetId.read(reader), 27 | ) 28 | } catch (ex: Exception) { 29 | throw wrapException(ex) 30 | } 31 | 32 | override fun write( 33 | writer: ScaleCodecWriter, 34 | instance: CanUnregisterAsset, 35 | ): Unit = 36 | try { 37 | AssetId.write(writer, instance.asset) 38 | } catch (ex: Exception) { 39 | throw wrapException(ex) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/CanUnregisterDomain.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.ModelPermission 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 8 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 9 | import jp.co.soramitsu.iroha2.codec.ScaleReader 10 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 11 | import jp.co.soramitsu.iroha2.wrapException 12 | import kotlin.Unit 13 | 14 | /** 15 | * CanUnregisterDomain 16 | * 17 | * Generated from 'CanUnregisterDomain' regular structure 18 | */ 19 | public data class CanUnregisterDomain( 20 | public val domain: DomainId, 21 | ) : ModelPermission { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): CanUnregisterDomain = 24 | try { 25 | CanUnregisterDomain( 26 | DomainId.read(reader), 27 | ) 28 | } catch (ex: Exception) { 29 | throw wrapException(ex) 30 | } 31 | 32 | override fun write( 33 | writer: ScaleCodecWriter, 34 | instance: CanUnregisterDomain, 35 | ): Unit = 36 | try { 37 | DomainId.write(writer, instance.domain) 38 | } catch (ex: Exception) { 39 | throw wrapException(ex) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/CanUnregisterTrigger.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.ModelPermission 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 8 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 9 | import jp.co.soramitsu.iroha2.codec.ScaleReader 10 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 11 | import jp.co.soramitsu.iroha2.wrapException 12 | import kotlin.Unit 13 | 14 | /** 15 | * CanUnregisterTrigger 16 | * 17 | * Generated from 'CanUnregisterTrigger' regular structure 18 | */ 19 | public data class CanUnregisterTrigger( 20 | public val trigger: TriggerId, 21 | ) : ModelPermission { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): CanUnregisterTrigger = 24 | try { 25 | CanUnregisterTrigger( 26 | TriggerId.read(reader), 27 | ) 28 | } catch (ex: Exception) { 29 | throw wrapException(ex) 30 | } 31 | 32 | override fun write( 33 | writer: ScaleCodecWriter, 34 | instance: CanUnregisterTrigger, 35 | ): Unit = 36 | try { 37 | TriggerId.write(writer, instance.trigger) 38 | } catch (ex: Exception) { 39 | throw wrapException(ex) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/ChainId.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.String 12 | import kotlin.Unit 13 | 14 | /** 15 | * ChainId 16 | * 17 | * Generated from 'ChainId' regular structure 18 | */ 19 | public data class ChainId( 20 | public val string: String, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): ChainId = 24 | try { 25 | ChainId( 26 | reader.readString(), 27 | ) 28 | } catch (ex: Exception) { 29 | throw wrapException(ex) 30 | } 31 | 32 | override fun write( 33 | writer: ScaleCodecWriter, 34 | instance: ChainId, 35 | ): Unit = 36 | try { 37 | writer.writeAsList(instance.string.toByteArray(Charsets.UTF_8)) 38 | } catch (ex: Exception) { 39 | throw wrapException(ex) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/ConfigurationEventFilter.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Long 12 | import kotlin.Unit 13 | 14 | /** 15 | * ConfigurationEventFilter 16 | * 17 | * Generated from 'ConfigurationEventFilter' regular structure 18 | */ 19 | public data class ConfigurationEventFilter( 20 | public val eventSet: Long, 21 | ) { 22 | public companion object : 23 | ScaleReader, 24 | ScaleWriter { 25 | override fun read(reader: ScaleCodecReader): ConfigurationEventFilter = 26 | try { 27 | ConfigurationEventFilter( 28 | reader.readUint32(), 29 | ) 30 | } catch (ex: Exception) { 31 | throw wrapException(ex) 32 | } 33 | 34 | override fun write( 35 | writer: ScaleCodecWriter, 36 | instance: ConfigurationEventFilter, 37 | ): Unit = 38 | try { 39 | writer.writeUint32(instance.eventSet) 40 | } catch (ex: Exception) { 41 | throw wrapException(ex) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/CustomInstruction.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * CustomInstruction 15 | * 16 | * Generated from 'CustomInstruction' regular structure 17 | */ 18 | public data class CustomInstruction( 19 | public val payload: Json, 20 | ) { 21 | public companion object : ScaleReader, ScaleWriter { 22 | override fun read(reader: ScaleCodecReader): CustomInstruction = 23 | try { 24 | CustomInstruction( 25 | Json.read(reader), 26 | ) 27 | } catch (ex: Exception) { 28 | throw wrapException(ex) 29 | } 30 | 31 | override fun write( 32 | writer: ScaleCodecWriter, 33 | instance: CustomInstruction, 34 | ): Unit = 35 | try { 36 | Json.write(writer, instance.payload) 37 | } catch (ex: Exception) { 38 | throw wrapException(ex) 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/CustomParameter.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * CustomParameter 15 | * 16 | * Generated from 'CustomParameter' regular structure 17 | */ 18 | public data class CustomParameter( 19 | public val id: CustomParameterId, 20 | public val payload: Json, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): CustomParameter = 24 | try { 25 | CustomParameter( 26 | CustomParameterId.read(reader), 27 | Json.read(reader), 28 | ) 29 | } catch (ex: Exception) { 30 | throw wrapException(ex) 31 | } 32 | 33 | override fun write( 34 | writer: ScaleCodecWriter, 35 | instance: CustomParameter, 36 | ): Unit = 37 | try { 38 | CustomParameterId.write(writer, instance.id) 39 | Json.write(writer, instance.payload) 40 | } catch (ex: Exception) { 41 | throw wrapException(ex) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/CustomParameterId.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * CustomParameterId 15 | * 16 | * Generated from 'CustomParameterId' regular structure 17 | */ 18 | public data class CustomParameterId( 19 | public val name: Name, 20 | ) { 21 | public companion object : ScaleReader, ScaleWriter { 22 | override fun read(reader: ScaleCodecReader): CustomParameterId = 23 | try { 24 | CustomParameterId( 25 | Name.read(reader), 26 | ) 27 | } catch (ex: Exception) { 28 | throw wrapException(ex) 29 | } 30 | 31 | override fun write( 32 | writer: ScaleCodecWriter, 33 | instance: CustomParameterId, 34 | ): Unit = 35 | try { 36 | Name.write(writer, instance.name) 37 | } catch (ex: Exception) { 38 | throw wrapException(ex) 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/DomainId.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * DomainId 15 | * 16 | * Generated from 'DomainId' regular structure 17 | */ 18 | public data class DomainId( 19 | public val name: Name, 20 | ) { 21 | public companion object : ScaleReader, ScaleWriter { 22 | override fun read(reader: ScaleCodecReader): DomainId = 23 | try { 24 | DomainId( 25 | Name.read(reader), 26 | ) 27 | } catch (ex: Exception) { 28 | throw wrapException(ex) 29 | } 30 | 31 | override fun write( 32 | writer: ScaleCodecWriter, 33 | instance: DomainId, 34 | ): Unit = 35 | try { 36 | Name.write(writer, instance.name) 37 | } catch (ex: Exception) { 38 | throw wrapException(ex) 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/DomainOwnerChanged.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * DomainOwnerChanged 15 | * 16 | * Generated from 'DomainOwnerChanged' regular structure 17 | */ 18 | public data class DomainOwnerChanged( 19 | public val domain: DomainId, 20 | public val newOwner: AccountId, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): DomainOwnerChanged = 24 | try { 25 | DomainOwnerChanged( 26 | DomainId.read(reader), 27 | AccountId.read(reader), 28 | ) 29 | } catch (ex: Exception) { 30 | throw wrapException(ex) 31 | } 32 | 33 | override fun write( 34 | writer: ScaleCodecWriter, 35 | instance: DomainOwnerChanged, 36 | ): Unit = 37 | try { 38 | DomainId.write(writer, instance.domain) 39 | AccountId.write(writer, instance.newOwner) 40 | } catch (ex: Exception) { 41 | throw wrapException(ex) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/DomainPredicateAtom.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.ModelEnum 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 8 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 9 | import jp.co.soramitsu.iroha2.codec.ScaleReader 10 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 11 | import kotlin.Int 12 | 13 | /** 14 | * DomainPredicateAtom 15 | * 16 | * Generated from 'DomainPredicateAtom' enum 17 | */ 18 | public sealed class DomainPredicateAtom : ModelEnum { 19 | /** 20 | * @return Discriminator of variant in enum 21 | */ 22 | public abstract fun discriminant(): Int 23 | 24 | public companion object : ScaleReader, ScaleWriter { 25 | override fun read(reader: ScaleCodecReader): DomainPredicateAtom = 26 | when (val discriminant = reader.readUByte()) { 27 | else -> throw RuntimeException("Unresolved discriminant of the enum variant: $discriminant") 28 | } 29 | 30 | override fun write( 31 | writer: ScaleCodecWriter, 32 | instance: DomainPredicateAtom, 33 | ) { 34 | writer.directWrite(instance.discriminant()) 35 | when (val discriminant = instance.discriminant()) { 36 | else -> throw RuntimeException("Unresolved discriminant of the enum variant: $discriminant") 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/EventMessage.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * EventMessage 15 | * 16 | * Generated from 'EventMessage' regular structure 17 | */ 18 | public data class EventMessage( 19 | public val eventBox: EventBox, 20 | ) { 21 | public companion object : ScaleReader, ScaleWriter { 22 | override fun read(reader: ScaleCodecReader): EventMessage = 23 | try { 24 | EventMessage( 25 | EventBox.read(reader), 26 | ) 27 | } catch (ex: Exception) { 28 | throw wrapException(ex) 29 | } 30 | 31 | override fun write( 32 | writer: ScaleCodecWriter, 33 | instance: EventMessage, 34 | ): Unit = 35 | try { 36 | EventBox.write(writer, instance.eventBox) 37 | } catch (ex: Exception) { 38 | throw wrapException(ex) 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/Executor.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * Executor 15 | * 16 | * Generated from 'Executor' regular structure 17 | */ 18 | public data class Executor( 19 | public val wasm: WasmSmartContract, 20 | ) { 21 | public companion object : ScaleReader, ScaleWriter { 22 | override fun read(reader: ScaleCodecReader): Executor = 23 | try { 24 | Executor( 25 | WasmSmartContract.read(reader), 26 | ) 27 | } catch (ex: Exception) { 28 | throw wrapException(ex) 29 | } 30 | 31 | override fun write( 32 | writer: ScaleCodecWriter, 33 | instance: Executor, 34 | ): Unit = 35 | try { 36 | WasmSmartContract.write(writer, instance.wasm) 37 | } catch (ex: Exception) { 38 | throw wrapException(ex) 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/ExecutorEventFilter.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Long 12 | import kotlin.Unit 13 | 14 | /** 15 | * ExecutorEventFilter 16 | * 17 | * Generated from 'ExecutorEventFilter' regular structure 18 | */ 19 | public data class ExecutorEventFilter( 20 | public val eventSet: Long, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): ExecutorEventFilter = 24 | try { 25 | ExecutorEventFilter( 26 | reader.readUint32(), 27 | ) 28 | } catch (ex: Exception) { 29 | throw wrapException(ex) 30 | } 31 | 32 | override fun write( 33 | writer: ScaleCodecWriter, 34 | instance: ExecutorEventFilter, 35 | ): Unit = 36 | try { 37 | writer.writeUint32(instance.eventSet) 38 | } catch (ex: Exception) { 39 | throw wrapException(ex) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/ExecutorUpgrade.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * ExecutorUpgrade 15 | * 16 | * Generated from 'ExecutorUpgrade' regular structure 17 | */ 18 | public data class ExecutorUpgrade( 19 | public val newDataModel: ExecutorDataModel, 20 | ) { 21 | public companion object : ScaleReader, ScaleWriter { 22 | override fun read(reader: ScaleCodecReader): ExecutorUpgrade = 23 | try { 24 | ExecutorUpgrade( 25 | ExecutorDataModel.read(reader), 26 | ) 27 | } catch (ex: Exception) { 28 | throw wrapException(ex) 29 | } 30 | 31 | override fun write( 32 | writer: ScaleCodecWriter, 33 | instance: ExecutorUpgrade, 34 | ): Unit = 35 | try { 36 | ExecutorDataModel.write(writer, instance.newDataModel) 37 | } catch (ex: Exception) { 38 | throw wrapException(ex) 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/FetchSize.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * FetchSize 15 | * 16 | * Generated from 'FetchSize' regular structure 17 | */ 18 | public data class FetchSize( 19 | public val fetchSize: NonZeroOfu64? = null, 20 | ) { 21 | public companion object : ScaleReader, ScaleWriter { 22 | override fun read(reader: ScaleCodecReader): FetchSize = 23 | try { 24 | FetchSize( 25 | reader.readNullable(NonZeroOfu64) as NonZeroOfu64?, 26 | ) 27 | } catch (ex: Exception) { 28 | throw wrapException(ex) 29 | } 30 | 31 | override fun write( 32 | writer: ScaleCodecWriter, 33 | instance: FetchSize, 34 | ): Unit = 35 | try { 36 | writer.writeNullable(NonZeroOfu64, instance.fetchSize) 37 | } catch (ex: Exception) { 38 | throw wrapException(ex) 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/FindAccountMetadata.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * FindAccountMetadata 15 | * 16 | * Generated from 'FindAccountMetadata' regular structure 17 | */ 18 | public data class FindAccountMetadata( 19 | public val id: AccountId, 20 | public val key: Name, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): FindAccountMetadata = 24 | try { 25 | FindAccountMetadata( 26 | AccountId.read(reader), 27 | Name.read(reader), 28 | ) 29 | } catch (ex: Exception) { 30 | throw wrapException(ex) 31 | } 32 | 33 | override fun write( 34 | writer: ScaleCodecWriter, 35 | instance: FindAccountMetadata, 36 | ): Unit = 37 | try { 38 | AccountId.write(writer, instance.id) 39 | Name.write(writer, instance.key) 40 | } catch (ex: Exception) { 41 | throw wrapException(ex) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/FindAccountsWithAsset.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * FindAccountsWithAsset 15 | * 16 | * Generated from 'FindAccountsWithAsset' regular structure 17 | */ 18 | public data class FindAccountsWithAsset( 19 | public val assetDefinition: AssetDefinitionId, 20 | ) { 21 | public companion object : ScaleReader, ScaleWriter { 22 | override fun read(reader: ScaleCodecReader): FindAccountsWithAsset = 23 | try { 24 | FindAccountsWithAsset( 25 | AssetDefinitionId.read(reader), 26 | ) 27 | } catch (ex: Exception) { 28 | throw wrapException(ex) 29 | } 30 | 31 | override fun write( 32 | writer: ScaleCodecWriter, 33 | instance: FindAccountsWithAsset, 34 | ): Unit = 35 | try { 36 | AssetDefinitionId.write(writer, instance.assetDefinition) 37 | } catch (ex: Exception) { 38 | throw wrapException(ex) 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/FindAssetMetadata.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * FindAssetMetadata 15 | * 16 | * Generated from 'FindAssetMetadata' regular structure 17 | */ 18 | public data class FindAssetMetadata( 19 | public val id: AssetId, 20 | public val key: Name, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): FindAssetMetadata = 24 | try { 25 | FindAssetMetadata( 26 | AssetId.read(reader), 27 | Name.read(reader), 28 | ) 29 | } catch (ex: Exception) { 30 | throw wrapException(ex) 31 | } 32 | 33 | override fun write( 34 | writer: ScaleCodecWriter, 35 | instance: FindAssetMetadata, 36 | ): Unit = 37 | try { 38 | AssetId.write(writer, instance.id) 39 | Name.write(writer, instance.key) 40 | } catch (ex: Exception) { 41 | throw wrapException(ex) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/FindAssetQuantityById.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * FindAssetQuantityById 15 | * 16 | * Generated from 'FindAssetQuantityById' regular structure 17 | */ 18 | public data class FindAssetQuantityById( 19 | public val id: AssetId, 20 | ) { 21 | public companion object : ScaleReader, ScaleWriter { 22 | override fun read(reader: ScaleCodecReader): FindAssetQuantityById = 23 | try { 24 | FindAssetQuantityById( 25 | AssetId.read(reader), 26 | ) 27 | } catch (ex: Exception) { 28 | throw wrapException(ex) 29 | } 30 | 31 | override fun write( 32 | writer: ScaleCodecWriter, 33 | instance: FindAssetQuantityById, 34 | ): Unit = 35 | try { 36 | AssetId.write(writer, instance.id) 37 | } catch (ex: Exception) { 38 | throw wrapException(ex) 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/FindAssets.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Any 12 | import kotlin.Boolean 13 | import kotlin.Int 14 | import kotlin.Unit 15 | 16 | /** 17 | * FindAssets 18 | * 19 | * Generated from 'FindAssets' tuple structure 20 | */ 21 | public class FindAssets { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): FindAssets = 24 | try { 25 | FindAssets() 26 | } catch (ex: Exception) { 27 | throw wrapException(ex) 28 | } 29 | 30 | override fun write( 31 | writer: ScaleCodecWriter, 32 | instance: FindAssets, 33 | ): Unit = 34 | try { 35 | } catch (ex: Exception) { 36 | throw wrapException(ex) 37 | } 38 | 39 | public fun equals( 40 | o1: FindAssets, 41 | o2: Any?, 42 | ): Boolean = 43 | when (o2) { 44 | null -> false 45 | else -> o2::class == o1::class 46 | } 47 | 48 | override fun hashCode(): Int = ".FindAssets".hashCode() 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/FindBlocks.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Any 12 | import kotlin.Boolean 13 | import kotlin.Int 14 | import kotlin.Unit 15 | 16 | /** 17 | * FindBlocks 18 | * 19 | * Generated from 'FindBlocks' tuple structure 20 | */ 21 | public class FindBlocks { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): FindBlocks = 24 | try { 25 | FindBlocks() 26 | } catch (ex: Exception) { 27 | throw wrapException(ex) 28 | } 29 | 30 | override fun write( 31 | writer: ScaleCodecWriter, 32 | instance: FindBlocks, 33 | ): Unit = 34 | try { 35 | } catch (ex: Exception) { 36 | throw wrapException(ex) 37 | } 38 | 39 | public fun equals( 40 | o1: FindBlocks, 41 | o2: Any?, 42 | ): Boolean = 43 | when (o2) { 44 | null -> false 45 | else -> o2::class == o1::class 46 | } 47 | 48 | override fun hashCode(): Int = ".FindBlocks".hashCode() 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/FindDomainMetadata.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * FindDomainMetadata 15 | * 16 | * Generated from 'FindDomainMetadata' regular structure 17 | */ 18 | public data class FindDomainMetadata( 19 | public val id: DomainId, 20 | public val key: Name, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): FindDomainMetadata = 24 | try { 25 | FindDomainMetadata( 26 | DomainId.read(reader), 27 | Name.read(reader), 28 | ) 29 | } catch (ex: Exception) { 30 | throw wrapException(ex) 31 | } 32 | 33 | override fun write( 34 | writer: ScaleCodecWriter, 35 | instance: FindDomainMetadata, 36 | ): Unit = 37 | try { 38 | DomainId.write(writer, instance.id) 39 | Name.write(writer, instance.key) 40 | } catch (ex: Exception) { 41 | throw wrapException(ex) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/FindPeers.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Any 12 | import kotlin.Boolean 13 | import kotlin.Int 14 | import kotlin.Unit 15 | 16 | /** 17 | * FindPeers 18 | * 19 | * Generated from 'FindPeers' tuple structure 20 | */ 21 | public class FindPeers { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): FindPeers = 24 | try { 25 | FindPeers() 26 | } catch (ex: Exception) { 27 | throw wrapException(ex) 28 | } 29 | 30 | override fun write( 31 | writer: ScaleCodecWriter, 32 | instance: FindPeers, 33 | ): Unit = 34 | try { 35 | } catch (ex: Exception) { 36 | throw wrapException(ex) 37 | } 38 | 39 | public fun equals( 40 | o1: FindPeers, 41 | o2: Any?, 42 | ): Boolean = 43 | when (o2) { 44 | null -> false 45 | else -> o2::class == o1::class 46 | } 47 | 48 | override fun hashCode(): Int = ".FindPeers".hashCode() 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/FindPermissionsByAccountId.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * FindPermissionsByAccountId 15 | * 16 | * Generated from 'FindPermissionsByAccountId' regular structure 17 | */ 18 | public data class FindPermissionsByAccountId( 19 | public val id: AccountId, 20 | ) { 21 | public companion object : 22 | ScaleReader, 23 | ScaleWriter { 24 | override fun read(reader: ScaleCodecReader): FindPermissionsByAccountId = 25 | try { 26 | FindPermissionsByAccountId( 27 | AccountId.read(reader), 28 | ) 29 | } catch (ex: Exception) { 30 | throw wrapException(ex) 31 | } 32 | 33 | override fun write( 34 | writer: ScaleCodecWriter, 35 | instance: FindPermissionsByAccountId, 36 | ): Unit = 37 | try { 38 | AccountId.write(writer, instance.id) 39 | } catch (ex: Exception) { 40 | throw wrapException(ex) 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/FindRoles.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Any 12 | import kotlin.Boolean 13 | import kotlin.Int 14 | import kotlin.Unit 15 | 16 | /** 17 | * FindRoles 18 | * 19 | * Generated from 'FindRoles' tuple structure 20 | */ 21 | public class FindRoles { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): FindRoles = 24 | try { 25 | FindRoles() 26 | } catch (ex: Exception) { 27 | throw wrapException(ex) 28 | } 29 | 30 | override fun write( 31 | writer: ScaleCodecWriter, 32 | instance: FindRoles, 33 | ): Unit = 34 | try { 35 | } catch (ex: Exception) { 36 | throw wrapException(ex) 37 | } 38 | 39 | public fun equals( 40 | o1: FindRoles, 41 | o2: Any?, 42 | ): Boolean = 43 | when (o2) { 44 | null -> false 45 | else -> o2::class == o1::class 46 | } 47 | 48 | override fun hashCode(): Int = ".FindRoles".hashCode() 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/FindRolesByAccountId.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * FindRolesByAccountId 15 | * 16 | * Generated from 'FindRolesByAccountId' regular structure 17 | */ 18 | public data class FindRolesByAccountId( 19 | public val id: AccountId, 20 | ) { 21 | public companion object : ScaleReader, ScaleWriter { 22 | override fun read(reader: ScaleCodecReader): FindRolesByAccountId = 23 | try { 24 | FindRolesByAccountId( 25 | AccountId.read(reader), 26 | ) 27 | } catch (ex: Exception) { 28 | throw wrapException(ex) 29 | } 30 | 31 | override fun write( 32 | writer: ScaleCodecWriter, 33 | instance: FindRolesByAccountId, 34 | ): Unit = 35 | try { 36 | AccountId.write(writer, instance.id) 37 | } catch (ex: Exception) { 38 | throw wrapException(ex) 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/FindTriggerMetadata.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * FindTriggerMetadata 15 | * 16 | * Generated from 'FindTriggerMetadata' regular structure 17 | */ 18 | public data class FindTriggerMetadata( 19 | public val id: TriggerId, 20 | public val key: Name, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): FindTriggerMetadata = 24 | try { 25 | FindTriggerMetadata( 26 | TriggerId.read(reader), 27 | Name.read(reader), 28 | ) 29 | } catch (ex: Exception) { 30 | throw wrapException(ex) 31 | } 32 | 33 | override fun write( 34 | writer: ScaleCodecWriter, 35 | instance: FindTriggerMetadata, 36 | ): Unit = 37 | try { 38 | TriggerId.write(writer, instance.id) 39 | Name.write(writer, instance.key) 40 | } catch (ex: Exception) { 41 | throw wrapException(ex) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/ForwardCursor.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.String 12 | import kotlin.Unit 13 | 14 | /** 15 | * ForwardCursor 16 | * 17 | * Generated from 'ForwardCursor' regular structure 18 | */ 19 | public data class ForwardCursor( 20 | public val query: String, 21 | public val cursor: NonZeroOfu64, 22 | ) { 23 | public companion object : ScaleReader, ScaleWriter { 24 | override fun read(reader: ScaleCodecReader): ForwardCursor = 25 | try { 26 | ForwardCursor( 27 | reader.readString(), 28 | NonZeroOfu64.read(reader), 29 | ) 30 | } catch (ex: Exception) { 31 | throw wrapException(ex) 32 | } 33 | 34 | override fun write( 35 | writer: ScaleCodecWriter, 36 | instance: ForwardCursor, 37 | ): Unit = 38 | try { 39 | writer.writeAsList(instance.query.toByteArray(Charsets.UTF_8)) 40 | NonZeroOfu64.write(writer, instance.cursor) 41 | } catch (ex: Exception) { 42 | throw wrapException(ex) 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/HashOf.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Any 12 | import kotlin.Unit 13 | 14 | /** 15 | * HashOf 16 | * 17 | * Generated from 'HashOf>' regular structure 18 | */ 19 | public data class HashOf( 20 | public val hash: Hash, 21 | ) { 22 | public companion object : ScaleReader>, ScaleWriter> { 23 | override fun read(reader: ScaleCodecReader): HashOf = 24 | try { 25 | HashOf( 26 | Hash.read(reader), 27 | ) 28 | } catch (ex: Exception) { 29 | throw wrapException(ex) 30 | } 31 | 32 | override fun write( 33 | writer: ScaleCodecWriter, 34 | instance: HashOf, 35 | ): Unit = 36 | try { 37 | Hash.write(writer, instance.hash) 38 | } catch (ex: Exception) { 39 | throw wrapException(ex) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/IpfsPath.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.String 12 | import kotlin.Unit 13 | 14 | /** 15 | * IpfsPath 16 | * 17 | * Generated from 'IpfsPath' regular structure 18 | */ 19 | public data class IpfsPath( 20 | public val string: String, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): IpfsPath = 24 | try { 25 | IpfsPath( 26 | reader.readString(), 27 | ) 28 | } catch (ex: Exception) { 29 | throw wrapException(ex) 30 | } 31 | 32 | override fun write( 33 | writer: ScaleCodecWriter, 34 | instance: IpfsPath, 35 | ): Unit = 36 | try { 37 | writer.writeAsList(instance.string.toByteArray(Charsets.UTF_8)) 38 | } catch (ex: Exception) { 39 | throw wrapException(ex) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/Ipv6Addr.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Array 12 | import kotlin.Int 13 | import kotlin.Unit 14 | 15 | /** 16 | * Ipv6Addr 17 | * 18 | * Generated from 'Ipv6Addr' regular structure 19 | */ 20 | public data class Ipv6Addr( 21 | public val arrayOfU16: Array, 22 | ) { 23 | public companion object : ScaleReader, ScaleWriter { 24 | override fun read(reader: ScaleCodecReader): Ipv6Addr = 25 | try { 26 | Ipv6Addr( 27 | reader.readArray(8) { reader.readUint16() }, 28 | ) 29 | } catch (ex: Exception) { 30 | throw wrapException(ex) 31 | } 32 | 33 | override fun write( 34 | writer: ScaleCodecWriter, 35 | instance: Ipv6Addr, 36 | ): Unit = 37 | try { 38 | instance.arrayOfU16.forEach { value -> 39 | writer.writeUint16(value) 40 | } 41 | } catch (ex: Exception) { 42 | throw wrapException(ex) 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/Json.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.String 12 | import kotlin.Unit 13 | 14 | /** 15 | * Json 16 | * 17 | * Generated from 'Json' regular structure 18 | */ 19 | public data class Json( 20 | public val string: String, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): Json = 24 | try { 25 | Json( 26 | reader.readString(), 27 | ) 28 | } catch (ex: Exception) { 29 | throw wrapException(ex) 30 | } 31 | 32 | override fun write( 33 | writer: ScaleCodecWriter, 34 | instance: Json, 35 | ): Unit = 36 | try { 37 | writer.writeAsList(instance.string.toByteArray(Charsets.UTF_8)) 38 | } catch (ex: Exception) { 39 | throw wrapException(ex) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/Log.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.String 12 | import kotlin.Unit 13 | 14 | /** 15 | * Log 16 | * 17 | * Generated from 'Log' regular structure 18 | */ 19 | public data class Log( 20 | public val level: Level, 21 | public val msg: String, 22 | ) { 23 | public companion object : ScaleReader, ScaleWriter { 24 | override fun read(reader: ScaleCodecReader): Log = 25 | try { 26 | Log( 27 | Level.read(reader), 28 | reader.readString(), 29 | ) 30 | } catch (ex: Exception) { 31 | throw wrapException(ex) 32 | } 33 | 34 | override fun write( 35 | writer: ScaleCodecWriter, 36 | instance: Log, 37 | ): Unit = 38 | try { 39 | Level.write(writer, instance.level) 40 | writer.writeAsList(instance.msg.toByteArray(Charsets.UTF_8)) 41 | } catch (ex: Exception) { 42 | throw wrapException(ex) 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/MetadataPredicateAtom.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.ModelEnum 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 8 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 9 | import jp.co.soramitsu.iroha2.codec.ScaleReader 10 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 11 | import kotlin.Int 12 | 13 | /** 14 | * MetadataPredicateAtom 15 | * 16 | * Generated from 'MetadataPredicateAtom' enum 17 | */ 18 | public sealed class MetadataPredicateAtom : ModelEnum { 19 | /** 20 | * @return Discriminator of variant in enum 21 | */ 22 | public abstract fun discriminant(): Int 23 | 24 | public companion object : ScaleReader, ScaleWriter { 25 | override fun read(reader: ScaleCodecReader): MetadataPredicateAtom = 26 | when (val discriminant = reader.readUByte()) { 27 | else -> throw RuntimeException("Unresolved discriminant of the enum variant: $discriminant") 28 | } 29 | 30 | override fun write( 31 | writer: ScaleCodecWriter, 32 | instance: MetadataPredicateAtom, 33 | ) { 34 | writer.directWrite(instance.discriminant()) 35 | when (val discriminant = instance.discriminant()) { 36 | else -> throw RuntimeException("Unresolved discriminant of the enum variant: $discriminant") 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/Mismatch.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Any 12 | import kotlin.Unit 13 | 14 | /** 15 | * Mismatch 16 | * 17 | * Generated from 'Mismatch' regular structure 18 | */ 19 | public data class Mismatch( 20 | public val expected: AssetType, 21 | public val `actual`: AssetType, 22 | ) { 23 | public companion object : ScaleReader>, ScaleWriter> { 24 | override fun read(reader: ScaleCodecReader): Mismatch = 25 | try { 26 | Mismatch( 27 | AssetType.read(reader), 28 | AssetType.read(reader), 29 | ) 30 | } catch (ex: Exception) { 31 | throw wrapException(ex) 32 | } 33 | 34 | override fun write( 35 | writer: ScaleCodecWriter, 36 | instance: Mismatch, 37 | ): Unit = 38 | try { 39 | AssetType.write(writer, instance.expected) 40 | AssetType.write(writer, instance.`actual`) 41 | } catch (ex: Exception) { 42 | throw wrapException(ex) 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/Name.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.String 12 | import kotlin.Unit 13 | 14 | /** 15 | * Name 16 | * 17 | * Generated from 'Name' regular structure 18 | */ 19 | public data class Name( 20 | public val string: String, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): Name = 24 | try { 25 | Name( 26 | reader.readString(), 27 | ) 28 | } catch (ex: Exception) { 29 | throw wrapException(ex) 30 | } 31 | 32 | override fun write( 33 | writer: ScaleCodecWriter, 34 | instance: Name, 35 | ): Unit = 36 | try { 37 | writer.writeAsList(instance.string.toByteArray(Charsets.UTF_8)) 38 | } catch (ex: Exception) { 39 | throw wrapException(ex) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/NewAccount.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * NewAccount 15 | * 16 | * Generated from 'NewAccount' regular structure 17 | */ 18 | public data class NewAccount( 19 | public val id: AccountId, 20 | public val metadata: Metadata, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): NewAccount = 24 | try { 25 | NewAccount( 26 | AccountId.read(reader), 27 | Metadata.read(reader), 28 | ) 29 | } catch (ex: Exception) { 30 | throw wrapException(ex) 31 | } 32 | 33 | override fun write( 34 | writer: ScaleCodecWriter, 35 | instance: NewAccount, 36 | ): Unit = 37 | try { 38 | AccountId.write(writer, instance.id) 39 | Metadata.write(writer, instance.metadata) 40 | } catch (ex: Exception) { 41 | throw wrapException(ex) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/NewRole.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * NewRole 15 | * 16 | * Generated from 'NewRole' regular structure 17 | */ 18 | public data class NewRole( 19 | public val `inner`: Role, 20 | public val grantTo: AccountId, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): NewRole = 24 | try { 25 | NewRole( 26 | Role.read(reader), 27 | AccountId.read(reader), 28 | ) 29 | } catch (ex: Exception) { 30 | throw wrapException(ex) 31 | } 32 | 33 | override fun write( 34 | writer: ScaleCodecWriter, 35 | instance: NewRole, 36 | ): Unit = 37 | try { 38 | Role.write(writer, instance.`inner`) 39 | AccountId.write(writer, instance.grantTo) 40 | } catch (ex: Exception) { 41 | throw wrapException(ex) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/NonZeroOfu16.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Int 12 | import kotlin.Unit 13 | 14 | /** 15 | * NonZeroOfu16 16 | * 17 | * Generated from 'NonZeroOfu16' regular structure 18 | */ 19 | public data class NonZeroOfu16( 20 | public val u16: Int, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): NonZeroOfu16 = 24 | try { 25 | NonZeroOfu16( 26 | reader.readUint16(), 27 | ) 28 | } catch (ex: Exception) { 29 | throw wrapException(ex) 30 | } 31 | 32 | override fun write( 33 | writer: ScaleCodecWriter, 34 | instance: NonZeroOfu16, 35 | ): Unit = 36 | try { 37 | writer.writeUint16(instance.u16) 38 | } catch (ex: Exception) { 39 | throw wrapException(ex) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/NonZeroOfu32.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Long 12 | import kotlin.Unit 13 | 14 | /** 15 | * NonZeroOfu32 16 | * 17 | * Generated from 'NonZeroOfu32' regular structure 18 | */ 19 | public data class NonZeroOfu32( 20 | public val u32: Long, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): NonZeroOfu32 = 24 | try { 25 | NonZeroOfu32( 26 | reader.readUint32(), 27 | ) 28 | } catch (ex: Exception) { 29 | throw wrapException(ex) 30 | } 31 | 32 | override fun write( 33 | writer: ScaleCodecWriter, 34 | instance: NonZeroOfu32, 35 | ): Unit = 36 | try { 37 | writer.writeUint32(instance.u32) 38 | } catch (ex: Exception) { 39 | throw wrapException(ex) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/NonZeroOfu64.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import java.math.BigInteger 12 | import kotlin.Unit 13 | 14 | /** 15 | * NonZeroOfu64 16 | * 17 | * Generated from 'NonZeroOfu64' regular structure 18 | */ 19 | public data class NonZeroOfu64( 20 | public val u64: BigInteger, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): NonZeroOfu64 = 24 | try { 25 | NonZeroOfu64( 26 | reader.readUint64(), 27 | ) 28 | } catch (ex: Exception) { 29 | throw wrapException(ex) 30 | } 31 | 32 | override fun write( 33 | writer: ScaleCodecWriter, 34 | instance: NonZeroOfu64, 35 | ): Unit = 36 | try { 37 | writer.writeUint64(instance.u64) 38 | } catch (ex: Exception) { 39 | throw wrapException(ex) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/NumericPredicateAtom.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.ModelEnum 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 8 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 9 | import jp.co.soramitsu.iroha2.codec.ScaleReader 10 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 11 | import kotlin.Int 12 | 13 | /** 14 | * NumericPredicateAtom 15 | * 16 | * Generated from 'NumericPredicateAtom' enum 17 | */ 18 | public sealed class NumericPredicateAtom : ModelEnum { 19 | /** 20 | * @return Discriminator of variant in enum 21 | */ 22 | public abstract fun discriminant(): Int 23 | 24 | public companion object : ScaleReader, ScaleWriter { 25 | override fun read(reader: ScaleCodecReader): NumericPredicateAtom = 26 | when (val discriminant = reader.readUByte()) { 27 | else -> throw RuntimeException("Unresolved discriminant of the enum variant: $discriminant") 28 | } 29 | 30 | override fun write( 31 | writer: ScaleCodecWriter, 32 | instance: NumericPredicateAtom, 33 | ) { 34 | writer.directWrite(instance.discriminant()) 35 | when (val discriminant = instance.discriminant()) { 36 | else -> throw RuntimeException("Unresolved discriminant of the enum variant: $discriminant") 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/NumericSpec.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Long 12 | import kotlin.Unit 13 | 14 | /** 15 | * NumericSpec 16 | * 17 | * Generated from 'NumericSpec' regular structure 18 | */ 19 | public data class NumericSpec( 20 | public val scale: Long? = null, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): NumericSpec = 24 | try { 25 | NumericSpec( 26 | reader.readNullable(), 27 | ) 28 | } catch (ex: Exception) { 29 | throw wrapException(ex) 30 | } 31 | 32 | override fun write( 33 | writer: ScaleCodecWriter, 34 | instance: NumericSpec, 35 | ): Unit = 36 | try { 37 | writer.writeNullable(instance.scale) 38 | } catch (ex: Exception) { 39 | throw wrapException(ex) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/ParameterChanged.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * ParameterChanged 15 | * 16 | * Generated from 'ParameterChanged' regular structure 17 | */ 18 | public data class ParameterChanged( 19 | public val oldValue: Parameter, 20 | public val newValue: Parameter, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): ParameterChanged = 24 | try { 25 | ParameterChanged( 26 | Parameter.read(reader), 27 | Parameter.read(reader), 28 | ) 29 | } catch (ex: Exception) { 30 | throw wrapException(ex) 31 | } 32 | 33 | override fun write( 34 | writer: ScaleCodecWriter, 35 | instance: ParameterChanged, 36 | ): Unit = 37 | try { 38 | Parameter.write(writer, instance.oldValue) 39 | Parameter.write(writer, instance.newValue) 40 | } catch (ex: Exception) { 41 | throw wrapException(ex) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/Peer.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * Peer 15 | * 16 | * Generated from 'Peer' regular structure 17 | */ 18 | public data class Peer( 19 | public val address: SocketAddr, 20 | public val id: PeerId, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): Peer = 24 | try { 25 | Peer( 26 | SocketAddr.read(reader), 27 | PeerId.read(reader), 28 | ) 29 | } catch (ex: Exception) { 30 | throw wrapException(ex) 31 | } 32 | 33 | override fun write( 34 | writer: ScaleCodecWriter, 35 | instance: Peer, 36 | ): Unit = 37 | try { 38 | SocketAddr.write(writer, instance.address) 39 | PeerId.write(writer, instance.id) 40 | } catch (ex: Exception) { 41 | throw wrapException(ex) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/PeerId.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * PeerId 15 | * 16 | * Generated from 'PeerId' regular structure 17 | */ 18 | public data class PeerId( 19 | public val publicKey: PublicKey, 20 | ) { 21 | public companion object : ScaleReader, ScaleWriter { 22 | override fun read(reader: ScaleCodecReader): PeerId = 23 | try { 24 | PeerId( 25 | PublicKey.read(reader), 26 | ) 27 | } catch (ex: Exception) { 28 | throw wrapException(ex) 29 | } 30 | 31 | override fun write( 32 | writer: ScaleCodecWriter, 33 | instance: PeerId, 34 | ): Unit = 35 | try { 36 | PublicKey.write(writer, instance.publicKey) 37 | } catch (ex: Exception) { 38 | throw wrapException(ex) 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/PeerIdPredicateAtom.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.ModelEnum 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 8 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 9 | import jp.co.soramitsu.iroha2.codec.ScaleReader 10 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 11 | import kotlin.Int 12 | 13 | /** 14 | * PeerIdPredicateAtom 15 | * 16 | * Generated from 'PeerIdPredicateAtom' enum 17 | */ 18 | public sealed class PeerIdPredicateAtom : ModelEnum { 19 | /** 20 | * @return Discriminator of variant in enum 21 | */ 22 | public abstract fun discriminant(): Int 23 | 24 | public companion object : ScaleReader, ScaleWriter { 25 | override fun read(reader: ScaleCodecReader): PeerIdPredicateAtom = 26 | when (val discriminant = reader.readUByte()) { 27 | else -> throw RuntimeException("Unresolved discriminant of the enum variant: $discriminant") 28 | } 29 | 30 | override fun write( 31 | writer: ScaleCodecWriter, 32 | instance: PeerIdPredicateAtom, 33 | ) { 34 | writer.directWrite(instance.discriminant()) 35 | when (val discriminant = instance.discriminant()) { 36 | else -> throw RuntimeException("Unresolved discriminant of the enum variant: $discriminant") 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/Permission.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.String 12 | import kotlin.Unit 13 | 14 | /** 15 | * Permission 16 | * 17 | * Generated from 'Permission' regular structure 18 | */ 19 | public data class Permission( 20 | public val name: String, 21 | public val payload: Json, 22 | ) { 23 | public companion object : ScaleReader, ScaleWriter { 24 | override fun read(reader: ScaleCodecReader): Permission = 25 | try { 26 | Permission( 27 | reader.readString(), 28 | Json.read(reader), 29 | ) 30 | } catch (ex: Exception) { 31 | throw wrapException(ex) 32 | } 33 | 34 | override fun write( 35 | writer: ScaleCodecWriter, 36 | instance: Permission, 37 | ): Unit = 38 | try { 39 | writer.writeAsList(instance.name.toByteArray(Charsets.UTF_8)) 40 | Json.write(writer, instance.payload) 41 | } catch (ex: Exception) { 42 | throw wrapException(ex) 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/QuerySignature.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * QuerySignature 15 | * 16 | * Generated from 'QuerySignature' regular structure 17 | */ 18 | public data class QuerySignature( 19 | public val signatureOfOfQueryRequestWithAuthority: SignatureOf, 20 | ) { 21 | public companion object : ScaleReader, ScaleWriter { 22 | override fun read(reader: ScaleCodecReader): QuerySignature = 23 | try { 24 | QuerySignature( 25 | SignatureOf.read(reader) as SignatureOf, 26 | ) 27 | } catch (ex: Exception) { 28 | throw wrapException(ex) 29 | } 30 | 31 | override fun write( 32 | writer: ScaleCodecWriter, 33 | instance: QuerySignature, 34 | ): Unit = 35 | try { 36 | SignatureOf.write(writer, instance.signatureOfOfQueryRequestWithAuthority) 37 | } catch (ex: Exception) { 38 | throw wrapException(ex) 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/QueryWithParams.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * QueryWithParams 15 | * 16 | * Generated from 'QueryWithParams' regular structure 17 | */ 18 | public data class QueryWithParams( 19 | public val query: QueryBox, 20 | public val params: QueryParams, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): QueryWithParams = 24 | try { 25 | QueryWithParams( 26 | QueryBox.read(reader), 27 | QueryParams.read(reader), 28 | ) 29 | } catch (ex: Exception) { 30 | throw wrapException(ex) 31 | } 32 | 33 | override fun write( 34 | writer: ScaleCodecWriter, 35 | instance: QueryWithParams, 36 | ): Unit = 37 | try { 38 | QueryBox.write(writer, instance.query) 39 | QueryParams.write(writer, instance.params) 40 | } catch (ex: Exception) { 41 | throw wrapException(ex) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/RepetitionError.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * RepetitionError 15 | * 16 | * Generated from 'RepetitionError' regular structure 17 | */ 18 | public data class RepetitionError( 19 | public val instruction: InstructionType, 20 | public val id: IdBox, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): RepetitionError = 24 | try { 25 | RepetitionError( 26 | InstructionType.read(reader), 27 | IdBox.read(reader), 28 | ) 29 | } catch (ex: Exception) { 30 | throw wrapException(ex) 31 | } 32 | 33 | override fun write( 34 | writer: ScaleCodecWriter, 35 | instance: RepetitionError, 36 | ): Unit = 37 | try { 38 | InstructionType.write(writer, instance.instruction) 39 | IdBox.write(writer, instance.id) 40 | } catch (ex: Exception) { 41 | throw wrapException(ex) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/RoleId.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * RoleId 15 | * 16 | * Generated from 'RoleId' regular structure 17 | */ 18 | public data class RoleId( 19 | public val name: Name, 20 | ) { 21 | public companion object : ScaleReader, ScaleWriter { 22 | override fun read(reader: ScaleCodecReader): RoleId = 23 | try { 24 | RoleId( 25 | Name.read(reader), 26 | ) 27 | } catch (ex: Exception) { 28 | throw wrapException(ex) 29 | } 30 | 31 | override fun write( 32 | writer: ScaleCodecWriter, 33 | instance: RoleId, 34 | ): Unit = 35 | try { 36 | Name.write(writer, instance.name) 37 | } catch (ex: Exception) { 38 | throw wrapException(ex) 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/RolePredicateAtom.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.ModelEnum 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 8 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 9 | import jp.co.soramitsu.iroha2.codec.ScaleReader 10 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 11 | import kotlin.Int 12 | 13 | /** 14 | * RolePredicateAtom 15 | * 16 | * Generated from 'RolePredicateAtom' enum 17 | */ 18 | public sealed class RolePredicateAtom : ModelEnum { 19 | /** 20 | * @return Discriminator of variant in enum 21 | */ 22 | public abstract fun discriminant(): Int 23 | 24 | public companion object : ScaleReader, ScaleWriter { 25 | override fun read(reader: ScaleCodecReader): RolePredicateAtom = 26 | when (val discriminant = reader.readUByte()) { 27 | else -> throw RuntimeException("Unresolved discriminant of the enum variant: $discriminant") 28 | } 29 | 30 | override fun write( 31 | writer: ScaleCodecWriter, 32 | instance: RolePredicateAtom, 33 | ) { 34 | writer.directWrite(instance.discriminant()) 35 | when (val discriminant = instance.discriminant()) { 36 | else -> throw RuntimeException("Unresolved discriminant of the enum variant: $discriminant") 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/Schedule.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import java.math.BigInteger 12 | import kotlin.Unit 13 | 14 | /** 15 | * Schedule 16 | * 17 | * Generated from 'Schedule' regular structure 18 | */ 19 | public data class Schedule( 20 | public val startMs: BigInteger, 21 | public val periodMs: BigInteger? = null, 22 | ) { 23 | public companion object : ScaleReader, ScaleWriter { 24 | override fun read(reader: ScaleCodecReader): Schedule = 25 | try { 26 | Schedule( 27 | reader.readUint64(), 28 | reader.readNullable(), 29 | ) 30 | } catch (ex: Exception) { 31 | throw wrapException(ex) 32 | } 33 | 34 | override fun write( 35 | writer: ScaleCodecWriter, 36 | instance: Schedule, 37 | ): Unit = 38 | try { 39 | writer.writeUint64(instance.startMs) 40 | writer.writeNullable(instance.periodMs) 41 | } catch (ex: Exception) { 42 | throw wrapException(ex) 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/SignatureOf.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Any 12 | import kotlin.Unit 13 | 14 | /** 15 | * SignatureOf 16 | * 17 | * Generated from 'SignatureOf' regular structure 18 | */ 19 | public data class SignatureOf( 20 | public val signature: Signature, 21 | ) { 22 | public companion object : ScaleReader>, ScaleWriter> { 23 | override fun read(reader: ScaleCodecReader): SignatureOf = 24 | try { 25 | SignatureOf( 26 | Signature.read(reader), 27 | ) 28 | } catch (ex: Exception) { 29 | throw wrapException(ex) 30 | } 31 | 32 | override fun write( 33 | writer: ScaleCodecWriter, 34 | instance: SignatureOf, 35 | ): Unit = 36 | try { 37 | Signature.write(writer, instance.signature) 38 | } catch (ex: Exception) { 39 | throw wrapException(ex) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/SocketAddrV4.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Int 12 | import kotlin.Unit 13 | 14 | /** 15 | * SocketAddrV4 16 | * 17 | * Generated from 'SocketAddrV4' regular structure 18 | */ 19 | public data class SocketAddrV4( 20 | public val ip: Ipv4Addr, 21 | public val port: Int, 22 | ) { 23 | public companion object : ScaleReader, ScaleWriter { 24 | override fun read(reader: ScaleCodecReader): SocketAddrV4 = 25 | try { 26 | SocketAddrV4( 27 | Ipv4Addr.read(reader), 28 | reader.readUint16(), 29 | ) 30 | } catch (ex: Exception) { 31 | throw wrapException(ex) 32 | } 33 | 34 | override fun write( 35 | writer: ScaleCodecWriter, 36 | instance: SocketAddrV4, 37 | ): Unit = 38 | try { 39 | Ipv4Addr.write(writer, instance.ip) 40 | writer.writeUint16(instance.port) 41 | } catch (ex: Exception) { 42 | throw wrapException(ex) 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/SocketAddrV6.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Int 12 | import kotlin.Unit 13 | 14 | /** 15 | * SocketAddrV6 16 | * 17 | * Generated from 'SocketAddrV6' regular structure 18 | */ 19 | public data class SocketAddrV6( 20 | public val ip: Ipv6Addr, 21 | public val port: Int, 22 | ) { 23 | public companion object : ScaleReader, ScaleWriter { 24 | override fun read(reader: ScaleCodecReader): SocketAddrV6 = 25 | try { 26 | SocketAddrV6( 27 | Ipv6Addr.read(reader), 28 | reader.readUint16(), 29 | ) 30 | } catch (ex: Exception) { 31 | throw wrapException(ex) 32 | } 33 | 34 | override fun write( 35 | writer: ScaleCodecWriter, 36 | instance: SocketAddrV6, 37 | ): Unit = 38 | try { 39 | Ipv6Addr.write(writer, instance.ip) 40 | writer.writeUint16(instance.port) 41 | } catch (ex: Exception) { 42 | throw wrapException(ex) 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/Sorting.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * Sorting 15 | * 16 | * Generated from 'Sorting' regular structure 17 | */ 18 | public data class Sorting( 19 | public val sortByMetadataKey: Name? = null, 20 | ) { 21 | public companion object : ScaleReader, ScaleWriter { 22 | override fun read(reader: ScaleCodecReader): Sorting = 23 | try { 24 | Sorting( 25 | reader.readNullable(Name) as Name?, 26 | ) 27 | } catch (ex: Exception) { 28 | throw wrapException(ex) 29 | } 30 | 31 | override fun write( 32 | writer: ScaleCodecWriter, 33 | instance: Sorting, 34 | ): Unit = 35 | try { 36 | writer.writeNullable(Name, instance.sortByMetadataKey) 37 | } catch (ex: Exception) { 38 | throw wrapException(ex) 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/TimeEvent.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * TimeEvent 15 | * 16 | * Generated from 'TimeEvent' regular structure 17 | */ 18 | public data class TimeEvent( 19 | public val interval: TimeInterval, 20 | ) { 21 | public companion object : ScaleReader, ScaleWriter { 22 | override fun read(reader: ScaleCodecReader): TimeEvent = 23 | try { 24 | TimeEvent( 25 | TimeInterval.read(reader), 26 | ) 27 | } catch (ex: Exception) { 28 | throw wrapException(ex) 29 | } 30 | 31 | override fun write( 32 | writer: ScaleCodecWriter, 33 | instance: TimeEvent, 34 | ): Unit = 35 | try { 36 | TimeInterval.write(writer, instance.interval) 37 | } catch (ex: Exception) { 38 | throw wrapException(ex) 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/TimeEventFilter.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * TimeEventFilter 15 | * 16 | * Generated from 'TimeEventFilter' regular structure 17 | */ 18 | public data class TimeEventFilter( 19 | public val executionTime: ExecutionTime, 20 | ) { 21 | public companion object : ScaleReader, ScaleWriter { 22 | override fun read(reader: ScaleCodecReader): TimeEventFilter = 23 | try { 24 | TimeEventFilter( 25 | ExecutionTime.read(reader), 26 | ) 27 | } catch (ex: Exception) { 28 | throw wrapException(ex) 29 | } 30 | 31 | override fun write( 32 | writer: ScaleCodecWriter, 33 | instance: TimeEventFilter, 34 | ): Unit = 35 | try { 36 | ExecutionTime.write(writer, instance.executionTime) 37 | } catch (ex: Exception) { 38 | throw wrapException(ex) 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/TimeInterval.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import java.math.BigInteger 12 | import kotlin.Unit 13 | 14 | /** 15 | * TimeInterval 16 | * 17 | * Generated from 'TimeInterval' regular structure 18 | */ 19 | public data class TimeInterval( 20 | public val sinceMs: BigInteger, 21 | public val lengthMs: BigInteger, 22 | ) { 23 | public companion object : ScaleReader, ScaleWriter { 24 | override fun read(reader: ScaleCodecReader): TimeInterval = 25 | try { 26 | TimeInterval( 27 | reader.readUint64(), 28 | reader.readUint64(), 29 | ) 30 | } catch (ex: Exception) { 31 | throw wrapException(ex) 32 | } 33 | 34 | override fun write( 35 | writer: ScaleCodecWriter, 36 | instance: TimeInterval, 37 | ): Unit = 38 | try { 39 | writer.writeUint64(instance.sinceMs) 40 | writer.writeUint64(instance.lengthMs) 41 | } catch (ex: Exception) { 42 | throw wrapException(ex) 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/TransactionLimitError.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.String 12 | import kotlin.Unit 13 | 14 | /** 15 | * TransactionLimitError 16 | * 17 | * Generated from 'TransactionLimitError' regular structure 18 | */ 19 | public data class TransactionLimitError( 20 | public val reason: String, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): TransactionLimitError = 24 | try { 25 | TransactionLimitError( 26 | reader.readString(), 27 | ) 28 | } catch (ex: Exception) { 29 | throw wrapException(ex) 30 | } 31 | 32 | override fun write( 33 | writer: ScaleCodecWriter, 34 | instance: TransactionLimitError, 35 | ): Unit = 36 | try { 37 | writer.writeAsList(instance.reason.toByteArray(Charsets.UTF_8)) 38 | } catch (ex: Exception) { 39 | throw wrapException(ex) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/TransactionSignature.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * TransactionSignature 15 | * 16 | * Generated from 'TransactionSignature' regular structure 17 | */ 18 | public data class TransactionSignature( 19 | public val signatureOfOfTransactionPayload: SignatureOf, 20 | ) { 21 | public companion object : ScaleReader, ScaleWriter { 22 | override fun read(reader: ScaleCodecReader): TransactionSignature = 23 | try { 24 | TransactionSignature( 25 | SignatureOf.read(reader) as SignatureOf, 26 | ) 27 | } catch (ex: Exception) { 28 | throw wrapException(ex) 29 | } 30 | 31 | override fun write( 32 | writer: ScaleCodecWriter, 33 | instance: TransactionSignature, 34 | ): Unit = 35 | try { 36 | SignatureOf.write(writer, instance.signatureOfOfTransactionPayload) 37 | } catch (ex: Exception) { 38 | throw wrapException(ex) 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/Trigger.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * Trigger 15 | * 16 | * Generated from 'Trigger' regular structure 17 | */ 18 | public data class Trigger( 19 | public val id: TriggerId, 20 | public val action: Action, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): Trigger = 24 | try { 25 | Trigger( 26 | TriggerId.read(reader), 27 | Action.read(reader), 28 | ) 29 | } catch (ex: Exception) { 30 | throw wrapException(ex) 31 | } 32 | 33 | override fun write( 34 | writer: ScaleCodecWriter, 35 | instance: Trigger, 36 | ): Unit = 37 | try { 38 | TriggerId.write(writer, instance.id) 39 | Action.write(writer, instance.action) 40 | } catch (ex: Exception) { 41 | throw wrapException(ex) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/TriggerId.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.Unit 12 | 13 | /** 14 | * TriggerId 15 | * 16 | * Generated from 'TriggerId' regular structure 17 | */ 18 | public data class TriggerId( 19 | public val name: Name, 20 | ) { 21 | public companion object : ScaleReader, ScaleWriter { 22 | override fun read(reader: ScaleCodecReader): TriggerId = 23 | try { 24 | TriggerId( 25 | Name.read(reader), 26 | ) 27 | } catch (ex: Exception) { 28 | throw wrapException(ex) 29 | } 30 | 31 | override fun write( 32 | writer: ScaleCodecWriter, 33 | instance: TriggerId, 34 | ): Unit = 35 | try { 36 | Name.write(writer, instance.name) 37 | } catch (ex: Exception) { 38 | throw wrapException(ex) 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/TriggerPredicateAtom.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.ModelEnum 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 8 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 9 | import jp.co.soramitsu.iroha2.codec.ScaleReader 10 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 11 | import kotlin.Int 12 | 13 | /** 14 | * TriggerPredicateAtom 15 | * 16 | * Generated from 'TriggerPredicateAtom' enum 17 | */ 18 | public sealed class TriggerPredicateAtom : ModelEnum { 19 | /** 20 | * @return Discriminator of variant in enum 21 | */ 22 | public abstract fun discriminant(): Int 23 | 24 | public companion object : ScaleReader, ScaleWriter { 25 | override fun read(reader: ScaleCodecReader): TriggerPredicateAtom = 26 | when (val discriminant = reader.readUByte()) { 27 | else -> throw RuntimeException("Unresolved discriminant of the enum variant: $discriminant") 28 | } 29 | 30 | override fun write( 31 | writer: ScaleCodecWriter, 32 | instance: TriggerPredicateAtom, 33 | ) { 34 | writer.directWrite(instance.discriminant()) 35 | when (val discriminant = instance.discriminant()) { 36 | else -> throw RuntimeException("Unresolved discriminant of the enum variant: $discriminant") 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /modules/model/src/main/kotlin/jp/co/soramitsu/iroha2/generated/WasmExecutionFail.kt: -------------------------------------------------------------------------------- 1 | // 2 | // Auto-generated file. DO NOT EDIT! 3 | // 4 | package jp.co.soramitsu.iroha2.generated 5 | 6 | import jp.co.soramitsu.iroha2.codec.ScaleCodecReader 7 | import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter 8 | import jp.co.soramitsu.iroha2.codec.ScaleReader 9 | import jp.co.soramitsu.iroha2.codec.ScaleWriter 10 | import jp.co.soramitsu.iroha2.wrapException 11 | import kotlin.String 12 | import kotlin.Unit 13 | 14 | /** 15 | * WasmExecutionFail 16 | * 17 | * Generated from 'WasmExecutionFail' regular structure 18 | */ 19 | public data class WasmExecutionFail( 20 | public val reason: String, 21 | ) { 22 | public companion object : ScaleReader, ScaleWriter { 23 | override fun read(reader: ScaleCodecReader): WasmExecutionFail = 24 | try { 25 | WasmExecutionFail( 26 | reader.readString(), 27 | ) 28 | } catch (ex: Exception) { 29 | throw wrapException(ex) 30 | } 31 | 32 | override fun write( 33 | writer: ScaleCodecWriter, 34 | instance: WasmExecutionFail, 35 | ): Unit = 36 | try { 37 | writer.writeAsList(instance.reason.toByteArray(Charsets.UTF_8)) 38 | } catch (ex: Exception) { 39 | throw wrapException(ex) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/test-tools/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | implementation project(":admin-client") 3 | implementation project(":block") 4 | 5 | implementation "org.testcontainers:testcontainers:$testContainersVer" 6 | 7 | implementation "io.ktor:ktor-client-logging:$ktorVer" 8 | implementation "org.jetbrains.kotlin:kotlin-test:$kotlinVer" 9 | implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVer" 10 | implementation "org.jetbrains.kotlin:kotlin-test-junit5:$kotlinVer" 11 | 12 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVer" 13 | implementation "ch.qos.logback:logback-classic:$logbackVer" 14 | implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVer" 15 | implementation "org.yaml:snakeyaml:2.0" 16 | 17 | implementation "com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonKotlinVer" 18 | 19 | testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlinVer" 20 | } 21 | 22 | jacocoTestReport { 23 | mustRunAfter(":admin-client:jacocoTestReport") 24 | mustRunAfter(":block:jacocoTestReport") 25 | mustRunAfter(":client:jacocoTestReport") 26 | mustRunAfter(":codegen:jacocoTestReport") 27 | mustRunAfter(":model:jacocoTestReport") 28 | } 29 | -------------------------------------------------------------------------------- /modules/test-tools/src/main/resources/client.toml: -------------------------------------------------------------------------------- 1 | chain = "00000000-0000-0000-0000-000000000000" 2 | torii_url = "http://127.0.0.1:8080/" 3 | 4 | [basic_auth] 5 | web_login = "mad_hatter" 6 | password = "ilovetea" 7 | 8 | [account] 9 | domain = "wonderland" 10 | public_key = "ed0120CE7FA46C9DCE7EA4B125E2E36BDB63EA33073E7590AC92816AE1E861B7048B03" 11 | private_key = "802620CCF31D85E3B32A4BEA59987CE0C78E3B8E2DB93881468AB2435FE45D5C9DCD53" -------------------------------------------------------------------------------- /modules/test-tools/src/main/resources/executor.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger-iroha/iroha-java/5467c487e173f9b472393420dd0b390c640c3f8f/modules/test-tools/src/main/resources/executor.wasm -------------------------------------------------------------------------------- /modules/test-tools/src/main/resources/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | # Set executor paths 6 | EXECUTOR_RELATIVE_PATH=$(jq -r '.executor' /config/genesis.json) 7 | EXECUTOR_ABSOLUTE_PATH=$(realpath "/config/$EXECUTOR_RELATIVE_PATH") 8 | 9 | # Update genesis.json 10 | jq --arg executor "$EXECUTOR_ABSOLUTE_PATH" --argjson topology "$TOPOLOGY" '.executor = $executor | .topology = $topology' /config/genesis.json > /tmp/genesis.json 11 | 12 | # Sign the genesis 13 | kagami genesis sign /tmp/genesis.json --public-key "$GENESIS_PUBLIC_KEY" --private-key "$GENESIS_PRIVATE_KEY" --out-file "$GENESIS" 14 | 15 | # Start irohad 16 | exec irohad -------------------------------------------------------------------------------- /modules/test-tools/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 | 16 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0' 3 | } 4 | 5 | rootProject.name = 'iroha2-java' 6 | 7 | include 'client' 8 | project(':client').projectDir = 'modules/client' as File 9 | 10 | include 'codegen' 11 | project(':codegen').projectDir = 'modules/codegen' as File 12 | 13 | include 'model' 14 | project(':model').projectDir = 'modules/model' as File 15 | 16 | include 'block' 17 | project(':block').projectDir = 'modules/block' as File 18 | 19 | include 'admin-client' 20 | project(':admin-client').projectDir = 'modules/admin-client' as File 21 | 22 | include 'test-tools' 23 | project(':test-tools').projectDir = 'modules/test-tools' as File 24 | 25 | include 'tutorial' 26 | project(':tutorial').projectDir = 'examples/tutorial' as File 27 | --------------------------------------------------------------------------------